Exemplo n.º 1
0
 /**
  * Call getEditHTML() if you want a form to edit the values of each single attribute
  */
 function getEditHTML()
 {
     $AName = get_class($this->attributes);
     if ($AName == "stdClass" and $this->className == null) {
         die("Can't determine the name of the plugin!<br />If you extended the class PersistentObject please use HTMLGUI::setStandardSaveButton(\$this);");
     }
     if ($AName == "stdClass" or $AName == "Attributes") {
         $AName = str_replace("GUI", "", $this->className);
     }
     $pluginName = str_replace("Attributes", "", $AName);
     $userCanEdit = mUserdata::isDisallowedTo("cantEdit" . $pluginName);
     $userCanCreate = mUserdata::isDisallowedTo("cantCreate" . $pluginName);
     $html = "";
     if (count($this->prependedElements) > 0) {
         foreach ($this->prependedElements as $k => $v) {
             $html .= $v->getHTML();
         }
     }
     $userLabels = mUserdata::getRelabels($pluginName);
     $userHiddenFields = mUserdata::getHides($pluginName);
     $this->texts = $this->languageClass->getEditTexts();
     if (!$userCanEdit and ($userCanCreate and $this->editedID != -1 or !$userCanCreate)) {
         $html .= "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<td><img style=\"float:left;margin-right:10px;\" src=\"./images/navi/restrictions.png\" />" . $this->texts["kein Speichern"] . "</tr>\n\t\t\t</table>";
     }
     try {
         $as = PMReflector::getAttributesArray($this->attributes);
         foreach ($this->addedRows as $key => $value) {
             if ($key == "top") {
                 array_unshift($as, $value);
             }
             if ($key == "bottom") {
                 array_push($as, $value);
             }
         }
     } catch (ReflectionException $e) {
         $_SESSION["messages"]->addMessage(get_class($e) . " thrown!");
         $_SESSION["messages"]->addMessage("You need to set the attributes with setAttributes() of class HTMLGUI!");
         return "An Error was caught. Please check the system log for additional information.";
     }
     $DesktopLinkButton = $this->getDesktopLinkButton();
     $html .= "\n\t\t\t<form id=\"{$this->FormID}\">\n\t\t\t\t<div class=\"backgroundColor1 Tab\">\n\t\t\t\t\t<p>" . $this->getOperationsHTML($pluginName, $this->editedID) . $DesktopLinkButton . "" . ($this->labelCaption == null ? $this->name . " editieren:" : $this->labelCaption) . "</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t<table>\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t   <col class=\"backgroundColor2\" style=\"width:120px;\" />\n\t\t\t\t\t   <col class=\"backgroundColor3\" />\n\t\t\t\t\t</colgroup>";
     $tab = 0;
     $sortOrder = $as;
     if (count($this->showAttributes) > 0) {
         $sortOrder = $this->showAttributes;
     }
     foreach ($sortOrder as $key => $value) {
         if (isset($this->dontShow[$value])) {
             continue;
         }
         if (isset($userHiddenFields[$value])) {
             continue;
         }
         if (isset($this->types[$value]) and $this->types[$value] == "hidden") {
             $this->hiddenInputs .= $this->getInput($value);
             continue;
         }
         if (isset($this->insertSpaceBefore[$value])) {
             $html .= "";
             if ($this->insertSpaceBefore[$value] == "") {
                 $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"backgroundColor0\" colspan=\"2\"></td>\n\t\t\t\t\t</tr>";
             }
             if ($this->insertSpaceBefore[$value] != "" and !$this->tabs[$value]) {
                 $html .= "\n\t\t\t\t\t<tr class=\"FormSeparatorWithLabel\">\n\t\t\t\t\t\t<td colspan=\"2\">" . $this->insertSpaceBefore[$value] . "</td>\n\t\t\t\t\t</tr>";
             } elseif ($this->insertSpaceBefore[$value] != "" and $this->tabs[$value]) {
                 $html .= "\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div onclick=\"if(\$('Tab{$this->className}{$tab}').style.display == 'none') new Effect.BlindDown('Tab{$this->className}{$tab}', {queue: 'end'}); else new Effect.BlindUp('Tab{$this->className}{$tab}', {queue: 'end'});\" class=\"backgroundColor1 Tab borderColor1\">\n\t\t\t\t\t<p>" . $this->insertSpaceBefore[$value] . "</p>\n\t\t\t\t</div>\n\t\t\t\t<div id=\"Tab{$this->className}{$tab}\" style=\"display:none;\">\n\t\t\t\t<table>\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t<col class=\"backgroundColor2\" style=\"width:120px;\" />\n\t\t\t\t\t\t<col class=\"backgroundColor3\" />\n\t\t\t\t\t</colgroup>";
                 $tab++;
             }
         }
         $label = ucfirst($value);
         if (isset($this->labels[$value])) {
             $label = $this->labels[$value];
         }
         if (isset($userLabels[$value])) {
             $label = $userLabels[$value];
         }
         $html .= "\n\t\t\t\t\t<tr " . (isset($this->style[$value]) ? "style=\"" . $this->style[$value] . "\"" : "") . ">\n\t\t\t\t\t\t<td id=\"" . $value . "EditL\"><label for=\"" . $value . "\">" . $label . ":" . (isset($this->labelDescriptions[$value]) ? "<br /><small>" . $this->labelDescriptions[$value] . "</small>" : "") . "</label></td>\n\t\t\t\t\t\t<td id=\"" . $value . "EditR\">" . $this->getInput($value) . "" . (isset($this->fieldDescriptions[$value]) ? "<br /><small>" . $this->fieldDescriptions[$value] . "</small>" : "") . "</td>\n\t\t\t\t\t</tr>";
     }
     if ($tab > 0) {
         $html .= "\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t<table style=\"\">\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t<col class=\"backgroundColor2\" style=\"width:120px;\" />\n\t\t\t\t\t\t<col class=\"backgroundColor3\" />\n\t\t\t\t\t</colgroup>";
     }
     if (!$this->replaceSaveButton) {
         if (!(!$userCanEdit and ($userCanCreate and $this->editedID != -1 or !$userCanCreate)) and !$this->onlyDisplayMode) {
             $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t<input \n\t\t\t\t\t\t\t\ttype=\"button\" \n\t\t\t\t\t\t\t\tname=\"currentSaveButton\"\n\t\t\t\t\t\t\t\tvalue=\"" . ($this->labelSaveButton == null ? $this->name . " speichern" : $this->labelSaveButton) . "\" \n\t\t\t\t\t\t\t\tonclick=\"" . $this->saveButtonEvent . "\" \n\t\t\t\t\t\t\t\tstyle=\"background-image:url(./images/i2/save.gif);\"\n\t\t\t\t\t\t\t/>" . $this->hiddenInputs . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
         }
     } else {
         $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t" . $this->replaceSaveButton . $this->hiddenInputs . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
     }
     /*
     		if(PMReflector::implementsInterface($pluginName,"iScrollable") AND $this->editedID != -1) {
     			$html .= "
     					<tr>
     						<td class=\"backgroundColor0\" style=\"height:20px;\"></td>
     					</tr>
     					<tr>
     						<td colspan=\"2\" class=\"backgroundColor3\">
     							<table>
     								<tr>
     									<td 
     										title=\"[Shift] + [Alt] + y\"
     										style=\"cursor:pointer;width:7%;\"
     										onclick=\"rme('$pluginName', '$this->editedID', 'getNextID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\"
     										onmouseover=\"this.className='backgroundColor1';\"
     										onmouseout=\"this.className='';\">
     										<a href=\"javascript:rme('$pluginName', '$this->editedID', 'getNextID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"y\"></a><img src=\"./images/left.gif\">
     									</td>
     									<td 
     										title=\"[Shift] + [Alt] + x\"
     										style=\"cursor:pointer;width:23%;\"
     										onclick=\"rme('$pluginName', '$this->editedID', 'getPreviousID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\"
     										onmouseover=\"this.className='backgroundColor1';\"
     										onmouseout=\"this.className='';\">
     										<a href=\"javascript:rme('$pluginName', '$this->editedID', 'getPreviousID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"x\"></a><img src=\"./images/lefts.gif\">
     									</td>
     									
     									<td style=\"width:40%;\">".$this->texts["gehe zu Datensatz ID"].": <input onblur=\"blurMe(this);\" onfocus=\"focusMe(this);\" style=\"width:40px;text-align:right;\" onkeydown=\"if(event.keyCode == 13) rme('$pluginName', '$this->editedID', 'checkInputID',this.value,'if(checkResponse(transport)) loadLeftFrameV2(\'$pluginName\', transport.responseText);');\" type=\"text\" value=\"$this->editedID\" /></td>
     									
     									<td 
     										title=\"[Shift] + [Alt] + c\"
     										style=\"cursor:pointer;width:23%;\" 
     										onclick=\"rme('$pluginName', '$this->editedID', 'getNextID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\"
     										onmouseover=\"this.className='backgroundColor1';\"
     										onmouseout=\"this.className='';\">
     										<a href=\"javascript:rme('$pluginName', '$this->editedID', 'getNextID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"c\" ></a><img style=\"float:right;\" src=\"./images/rights.gif\">
     									</td>
     									<td 
     										title=\"[Shift] + [Alt] + v\"
     										style=\"cursor:pointer;width:7%;\" 
     										onclick=\"rme('$pluginName', '$this->editedID', 'getPreviousID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\"
     										onmouseover=\"this.className='backgroundColor1';\"
     										onmouseout=\"this.className='';\">
     										<a href=\"javascript:rme('$pluginName', '$this->editedID', 'getPreviousID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"v\"></a><img style=\"float:right;\" src=\"./images/right.gif\">
     									</td>
     								</tr>
     							</table>
     						</td>
     					</tr>";
     		}*/
     $html .= "\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t</form>";
     if (count($this->appendedElements) > 0) {
         foreach ($this->appendedElements as $k => $v) {
             $html .= $v->getHTML();
         }
     }
     return $html;
 }