public function processData(\IRequestObject $requestObject) { $params = $requestObject->getParams(); $objectId = $params["portletId"]; $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId); $dialog = new \Widgets\Dialog(); $dialog->setTitle("Bearbeiten von " . $object->get_attribute("OBJ_DESC")); $dialog->setPositionX($this->params["mouseX"]); $dialog->setPositionY($this->params["mouseY"]); $clearer = new \Widgets\Clearer(); /* not used $titelInput = new \Widgets\TextInput(); $titelInput->setLabel("Titel"); $titelInput->setData($object); $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC")); $dialog->addWidget($titelInput); $dialog->addWidget($clearer); */ $headlineInput = new \Widgets\TextInput(); $headlineInput->setLabel("Überschrift"); $headlineInput->setData($object); $headlineInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([headline])")); $dialog->addWidget($headlineInput); $dialog->addWidget($clearer); $urlInput = new \Widgets\TextInput(); $urlInput->setLabel("Adresse"); $urlInput->setData($object); $urlInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([url])")); $dialog->addWidget($urlInput); $dialog->addWidget($clearer); $descriptionInput = new \Widgets\TextInput(); $descriptionInput->setLabel("Beschreibung"); $descriptionInput->setData($object); $descriptionInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([description])")); $dialog->addWidget($descriptionInput); $dialog->addWidget($clearer); /* $mediaTypeInput = new \Widgets\TextInput(); $mediaTypeInput->setLabel("Typ"); //Film, Bild, Ton $mediaTypeInput->setData($object); $mediaTypeInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([media_type])")); $dialog->addWidget($mediaTypeInput); $dialog->addWidget($clearer); */ $radioButton = new \Widgets\RadioButton(); $radioButton->setLabel("Typ"); $radioButton->setOptions(array(array("name" => "Film", "value" => "movie"), array("name" => "Bild", "value" => "image"), array("name" => "Ton", "value" => "audio"))); $radioButton->setData($object); $radioButton->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([media_type])")); $dialog->addWidget($radioButton); $dialog->addWidget($clearer); $this->dialog = $dialog; }
public function processData(\IRequestObject $requestObject) { $params = $requestObject->getParams(); $objectId = $params["messageObjectId"]; $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId); $oldImageId = $object->get_attribute("bid:portlet:msg:picture_id"); $dialog = new \Widgets\Dialog(); $dialog->setTitle("Meldungsbild bearbeiten"); $dialog->setPositionX($this->params["mouseX"]); $dialog->setPositionY($this->params["mouseY"]); //$dialog->setWidth(450); $emptyImageUrl = PATH_URL . "portletMsg/asset/empty.jpg"; $ajaxUploader = new \Widgets\AjaxUploader(); if ($oldImageId !== 0) { $imgWidget = new \Widgets\RawHtml(); $imgWidget->setHtml("Um ein Bild hochzuladen ziehen sie eine Datei auf dieses Feld oder doppelklicken sie hier.<br><img id=\"uploaderImage\" src=\"" . PATH_URL . "download/document/{$oldImageId}\"></img>"); $ajaxUploader->setPreview($imgWidget); } else { $imgWidget = new \Widgets\RawHtml(); $imgWidget->setHtml("Um ein Bild hochzuladen ziehen sie eine Datei auf dieses Feld oder doppelklicken sie hier.<br><img id=\"uploaderImage\" src=\"{$emptyImageUrl}\"></img>"); $ajaxUploader->setPreview($imgWidget); } $ajaxUploader->setSizeLimit(return_bytes(ini_get('post_max_size'))); $ajaxUploader->setNamespace("PortletMsg"); $ajaxUploader->setCommand("UploadImage"); $ajaxUploader->setDestId($object->get_id()); $ajaxUploader->setMultiUpload(false); $ajaxUploader->setOnComplete("function(id, fileName, responseJSON){document.getElementById('uploaderImage').src = '" . PATH_URL . "download/document/' + responseJSON.oid; jQuery('#uploaderImage').addClass('saved')}"); $dialog->addWidget($ajaxUploader); $raw = new \Widgets\RawHtml(); $raw->setHtml(<<<END \t\t<a href="#" class="button pill negative" onclick="sendRequest('DeleteImage', {'id':{$object->get_id()}}, '', 'data', null, function() {document.getElementById('uploaderImage').src = '{$emptyImageUrl}'; jQuery('#uploaderImage').addClass('saved')}, 'PortletMsg');">Bild löschen</a> END ); $dialog->addWidget($raw); $dialog->addWidget(new \Widgets\Clearer()); $radioButton = new \Widgets\RadioButton(); $radioButton->setLabel("Bildposition"); $radioButton->setOptions(array(array("name" => "links", "value" => "left"), array("name" => "nicht umfließend", "value" => "none"), array("name" => "rechts", "value" => "right"))); $radioButton->setData($object); $radioButton->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:picture_alignment")); $dialog->addWidget($radioButton); $dialog->addWidget(new \Widgets\Clearer()); $sizeInput = new \Widgets\TextInput(); $sizeInput->setLabel("Bildbreite"); $sizeInput->setData($object); $sizeInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:picture_width")); $dialog->addWidget($sizeInput); $this->dialog = $dialog; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $type = ""; $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $type = getObjectType($object); switch ($type) { case "document": $labelName = "Dateiname"; $typeName = "Dokument"; break; case "forum": $labelName = "Forumname"; $typeName = "Forum"; break; case "referenceFolder": $labelName = "Linkname"; $typeName = "Referenz"; break; case "referenceFile": $labelName = "Linkname"; $typeName = "Referenz"; break; case "user": $labelName = "Benutzername"; $typeName = "Benutzer"; break; case "group": $labelName = "Gruppenname"; $typeName = "Gruppe"; break; case "trashbin": $labelName = "Papierkorb"; $typeName = "Papierkorb"; break; case "gallery": $labelName = "Galeriename"; $typeName = "Galerie"; break; case "portal": $labelName = "Portalname"; $typeName = "Portal"; break; case "portalColumn": $labelName = "Spaltenname"; $typeName = "Portal-Spalte"; break; case "portalPortlet": $labelName = "Portletname"; $typeName = "Portal-Portlet"; break; case "userHome": $labelName = "Ordnername"; $typeName = "Benutzerordner"; break; case "groupWorkroom": $labelName = "Ordnername"; $typeName = "Gruppen-Arbeitsraum"; break; case "room": $labelName = "Ordnername"; $typeName = "Ordner"; break; case "container": $labelName = "Ordnername"; $typeName = "Ordner"; break; case "unknown": $labelName = "Name"; $typeName = "unbekannt"; break; default: $labelName = "Name"; $typeName = "unbekannt"; break; } $dialog = new \Widgets\Dialog(); $dialog->setTitle("Eigenschaften von »" . getCleanName($object) . "«<br>({$typeName})"); $dialog->setPositionX($this->params["mouseX"]); $dialog->setPositionY($this->params["mouseY"]); if ($type == "userHome" || $type == "groupWorkroom") { $dataNameInput = new \Widgets\TextInput(); $dataNameInput->setLabel("{$labelName}"); $dataNameInput->setData($object); $dataNameInput->setReadOnly(true); $dataNameInput->setContentProvider(\Widgets\DataProvider::staticProvider(getCleanName($object, -1))); /* $titelInput = new \Widgets\TextInput(); $titelInput->setLabel("Titel (Beschreibung)"); $titelInput->setData($object); $titelInput->setContentProvider(\Widgets\DataProvider::staticProvider(getCleanName($object)));*/ } else { $dataNameInput = new \Widgets\TextInput(); $dataNameInput->setLabel("{$labelName}"); $dataNameInput->setData($object); $dataNameInput->setContentProvider(new NameAttributeDataProvider("OBJ_NAME", getCleanName($object, -1))); if ($type == "document") { $docType = $object->get_attribute("DOC_MIME_TYPE"); $isJpg = strpos($docType, "jpg") !== false; $isJpeg = strpos($docType, "jpeg") !== false; $isGif = strpos($docType, "gif") !== false; $isPng = strpos($docType, "png") !== false; if ($isGif || $isJpeg || $isJpg || $isPng) { $textArea = new \Widgets\Textarea(); $textArea->setLabel("Beschreibung"); $textArea->setData($object); $textArea->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC")); $textArea->setHeight(100); $desc = $object->get_attribute("OBJ_DESC"); if ($desc !== 0) { $jsWrapperPicture = new \Widgets\JSWrapper(); $jsWrapperPicture->setJs('$(".plain").val("' . $desc . '")'); } } } /* $titelInput = new \Widgets\TextInput(); $titelInput->setLabel("Titel (Beschreibung)"); $titelInput->setData($object); $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));*/ } $ownerField = new \Widgets\TextField(); $ownerField->setLabel("Besitzer"); $creator = $object->get_creator(); $creatorName = getCleanName($creator); $ownerField->setValue($creatorName); $changedField = new \Widgets\TextField(); $changedField->setLabel("zuletzt geändert"); $changedDate = $object->get_attribute(OBJ_LAST_CHANGED); $changedDate = getFormatedDate($changedDate); $changedField->setValue($changedDate); $createdField = new \Widgets\TextField(); $createdField->setLabel("erstellt"); $createDate = $object->get_attribute(OBJ_CREATION_TIME); $createDate = getFormatedDate($createDate); $createdField->setValue($createDate); //$hiddenCheckbox = new \Widgets\Checkbox(); //$hiddenCheckbox->setLabel("Verstecken"); //$hiddenCheckbox->setCheckedValue("1"); //$hiddenCheckbox->setUncheckedValue(0); //$hiddenCheckbox->setData($object); //$hiddenCheckbox->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:hidden")); $containerViewRadio = new \Widgets\RadioButton(); $containerViewRadio->setLabel("Erstes Dokument"); $containerViewRadio->setData($object); $containerViewRadio->setOptions(array(array("name" => "Normal (Ordneransicht)", "value" => "normal"), array("name" => "Deckblatt (statt der Ordneransicht)", "value" => "index"), array("name" => "Kopfdokument (über der Ordneransicht)", "value" => "head"))); $containerViewRadio->setDefaultChecked("normal"); $containerViewRadio->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:presentation")); // $descriptionTextarea = new \Widgets\Textarea(); // $descriptionTextarea->setLabel("Beschreibung"); // $descriptionTextarea->setData($object); // $descriptionTextarea->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:description")); //TODO: value is array $keywordArea = new \Widgets\TextInput(); $keywordArea->setLabel("Schlüsselwörter"); $keywordArea->setData($object); $keywordArea->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_KEYWORDS")); //TODO: bid-attribute $descriptionInput = new \Widgets\TextInput(); $descriptionInput->setLabel("Beschreibung"); $descriptionInput->setData($object); $descriptionInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:description")); $checkboxInput = new \Widgets\Checkbox(); $checkboxInput->setLabel("Benutzer dürfen editieren?"); $checkboxInput->setCheckedValue("1"); $checkboxInput->setUncheckedValue(0); $checkboxInput->setData($object); $checkboxInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:forum_is_editable")); $seperator = new \Widgets\RawHtml(); $seperator->setHtml("<br style=\"clear:both\"/>"); $headlineAlg = new \Widgets\RawHtml(); $headlineAlg->setHtml("<h3>Allgemein</h3>"); $headlineMeta = new \Widgets\RawHtml(); $headlineMeta->setHtml("<h3>Meta-Informationen</h3>"); $headlineView = new \Widgets\RawHtml(); $headlineView->setHtml("<h3>Darstellung</h3>"); $dialog->addWidget($headlineAlg); //$dialog->addWidget($titelInput); //$dialog->addWidget($seperator); if ($type == "document") { $docType = $object->get_attribute("DOC_MIME_TYPE"); $isJpg = strpos($docType, "jpg") !== false; $isJpeg = strpos($docType, "jpeg") !== false; $isGif = strpos($docType, "gif") !== false; $isPng = strpos($docType, "png") !== false; if ($isGif || $isJpeg || $isJpg || $isPng) { $fileName = new \Widgets\TextInput(); $fileName->setLabel("Dateiname"); $fileName->setData($object); $fileName->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_NAME")); $dialog->addWidget($fileName); } } else { $dialog->addWidget($dataNameInput); } $dialog->addWidget($seperator); $dialog->addWidget($ownerField); $dialog->addWidget($seperator); $dialog->addWidget($changedField); $dialog->addWidget($seperator); $dialog->addWidget($createdField); $dialog->addWidget($seperator); if ($type == "container" || $type == "room") { $dialog->addWidget($headlineView); //$dialog->addWidget($hiddenCheckbox); //$dialog->addWidget($seperator); $dialog->addWidget($containerViewRadio); $dialog->addWidget($seperator); } else { if ($type == "document") { $docType = $object->get_attribute("DOC_MIME_TYPE"); $isJpg = strpos($docType, "jpg") !== false; $isJpeg = strpos($docType, "jpeg") !== false; $isGif = strpos($docType, "gif") !== false; $isPng = strpos($docType, "png") !== false; if ($isGif || $isJpeg || $isJpg || $isPng) { $dialog->addWidget($textArea); $dialog->addWidget($jsWrapperPicture); } } else { if ($type == "forum") { $creatorId = $creator->get_id(); $currentUser = $GLOBALS["STEAM"]->get_current_steam_user(); $currentUserId = $currentUser->get_id(); if ($currentUserId == $creatorId) { // $checkValue= $object->get_attribute("bid:forum_is_editable"); // $checked = $checkValue ? 1 : 0; // $checkboxInput; $dialog->addWidget($checkboxInput); $dialog->addWidget($seperator); } } } } // $dialog->addWidget($headlineMeta); // $dialog->addWidget($keywordArea); // $dialog->addWidget($seperator); // $dialog->addWidget($descriptionInput); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($dialog); return $ajaxResponseObject; }