コード例 #1
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 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"]);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     //$titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([headline])"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget(new \Widgets\Clearer());
     $align = new \Widgets\ComboBox();
     $align->setLabel("Ausrichtung");
     $align->setOptions(array(array("name" => "Linksbündig", "value" => "left"), array("name" => "Rechtsbündig", "value" => "right"), array("name" => "Zentriert", "value" => "center")));
     $align->setData($object);
     $align->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([alignment])"));
     $dialog->addWidget($align);
     $dialog->addWidget(new \Widgets\Clearer());
     $size = new \Widgets\ComboBox();
     $size->setLabel("Größe");
     $size->setOptions(array(array("name" => "15", "value" => "15"), array("name" => "20", "value" => "20"), array("name" => "25", "value" => "25"), array("name" => "30", "value" => "30"), array("name" => "35", "value" => "35"), array("name" => "40", "value" => "40"), array("name" => "50", "value" => "50"), array("name" => "60", "value" => "60")));
     $size->setData($object);
     $size->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([size])"));
     $dialog->addWidget($size);
     $this->dialog = $dialog;
 }
コード例 #2
0
ファイル: EditMessage.class.php プロジェクト: rolwi/koala
 public function processData(\IRequestObject $requestObject)
 {
     $params = $requestObject->getParams();
     $objectId = $params["messageObjectId"];
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Meldung bearbeiten");
     $dialog->setPositionX($this->params["mouseX"]);
     $dialog->setPositionY($this->params["mouseY"]);
     //$dialog->setWidth(450);
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_NAME"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Untertitel");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $contentText = new \Widgets\Textarea();
     $contentText->setLabel("Inhalt");
     $contentText->setTextareaClass("mce-small");
     $contentText->setWidth(480);
     $contentText->setData($object);
     $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
     $dialog->addWidget($contentText);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Link-Text");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:link_url_label"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Link-Adresse");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:link_url"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $widget = new \Widgets\Checkbox();
     $widget->setLabel("Link in einem neuen Fenster öffnen");
     $widget->setData($object);
     $widget->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:link_open"));
     $widget->setCheckedValue("checked");
     $widget->setUncheckedValue("");
     $dialog->addWidget($widget);
     //create widgets
     //$button1 = new \Widgets\Button();
     //TODO: add a edit box for the message here
     //$button1->setLabel("abschicken");
     //add widgets to dialog
     //$dialog->addWidget($button1);
     $this->dialog = $dialog;
 }
コード例 #3
0
ファイル: EditPosition.class.php プロジェクト: rolwi/koala
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $pyramidPosition = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     if ($this->params["action"] == "join") {
         // changing group (only) in the group choosing phase
         $pyramid = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["pyramid"]);
         $phase = $pyramid->get_attribute("PYRAMIDDISCUSSION ACTCOL");
         if ($phase == 0) {
             if ($this->params["formergroup"] == $this->params["newgroup"]) {
                 $formergroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["formergroup"]);
                 $formergroup->remove_member($user);
             } else {
                 if ($this->params["formergroup"] == 0) {
                     $newgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["newgroup"]);
                     $newgroup->add_member($user);
                 } else {
                     $formergroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["formergroup"]);
                     $formergroup->remove_member($user);
                     $newgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["newgroup"]);
                     $newgroup->add_member($user);
                 }
             }
         }
         $ajaxResponseObject->setStatus("ok");
         return $ajaxResponseObject;
     } else {
         $read_position_states = array();
         $read_position_states[$user->get_id()] = 1;
         $pyramidPosition->set_attribute("PYRAMIDDISCUSSION_POS_READ_STATES", $read_position_states);
         $column = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN");
         $row = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW");
         $dialog = new \Widgets\Dialog();
         $dialog->setTitle("Bearbeite Position " . $column . "-" . $row);
         $dialog->setWidth("600");
         $clearer = new \Widgets\Clearer();
         $titleInput = new \Widgets\TextInput();
         $titleInput->setLabel("Titel");
         $titleInput->setData($pyramidPosition);
         $titleInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
         $dialog->addWidget($titleInput);
         $dialog->addWidget($clearer);
         $textareaWidget = new \Widgets\Textarea();
         $textareaWidget->setTextareaClass("mce-small");
         $textareaWidget->setWidth("600");
         $textareaWidget->setData($pyramidPosition);
         $textareaWidget->setContentProvider(\Widgets\DataProvider::contentProvider());
         $dialog->addWidget($textareaWidget);
         $dialog->addWidget($clearer);
         $ajaxResponseObject->addWidget($dialog);
         $ajaxResponseObject->setStatus("ok");
         return $ajaxResponseObject;
     }
 }
コード例 #4
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #5
0
    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;
    }
コード例 #6
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     if (isset($this->id)) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         if ($object instanceof \steam_document) {
             $mimetype = $object->get_attribute(DOC_MIME_TYPE);
             $objName = $object->get_name();
             $objDesc = trim($object->get_attribute(OBJ_DESC));
             if ($objDesc === 0 || $objDesc === "") {
                 $name = $objName;
             } else {
                 $name = $objDesc . " (" . $objName . ")";
             }
             $actionBar = new \Widgets\ActionBar();
             $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Bearbeiten", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             $contentText = new \Widgets\TextareaCode();
             $contentText->setWidth(945);
             $contentText->setRows(50);
             $contentText->setData($object);
             $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
             $clearer = new \Widgets\Clearer();
             // 				$html = "";
             // 				if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") {  // Image
             // 					$html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>";
             // 				} else if ($mimetype == "text/html") {
             // 					$html = strip_tags($object->get_content(),"<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img>");
             // 				} else if (strstr($mimetype, "text")) {
             // 					$html = "<pre>{$object->get_content()}</pre>";
             // 				} else {
             // 					header("location: " . PATH_URL . "Download/Document/" . $this->id . "/");
             // 				}
             // 				$rawHtml = new \Widgets\RawHtml();
             // 				$rawHtml->setHtml($html);
             //$rawHtml->addWidget($breadcrumb);
             //$rawHtml->addWidget($environment);
             //$rawHtml->addWidget($loader);
             $frameResponseObject->setTitle($name);
             $frameResponseObject->addWidget($actionBar);
             //$frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->addWidget($contentText);
             $frameResponseObject->addWidget($clearer);
             return $frameResponseObject;
         }
     } else {
         ExtensionMaster::getInstance()->send404Error();
     }
 }
コード例 #7
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 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("Eigenschaften von Spalte " . $object->get_attribute("OBJ_DESC"));
     $dialog->setPositionX($this->params["mouseX"]);
     $dialog->setPositionY($this->params["mouseY"]);
     $clearer = new \Widgets\Clearer();
     $sizeInput = new \Widgets\TextInput();
     $sizeInput->setLabel("Breite der Spalte");
     $sizeInput->setData($object);
     $sizeInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portal:column:width"));
     $dialog->addWidget($sizeInput);
     $dialog->addWidget($clearer);
     $this->dialog = $dialog;
 }
コード例 #8
0
ファイル: EditTopic.class.php プロジェクト: rolwi/koala
 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"]);
     $titel = new \Widgets\TextInput();
     $clearer = new \Widgets\Clearer();
     $titel->setLabel("Überschrift");
     $titel->setData($object);
     $titel->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titel);
     $dialog->addWidget($clearer);
     $this->dialog = $dialog;
 }
コード例 #9
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 public function processData(\IRequestObject $requestObject)
 {
     $params = $requestObject->getParams();
     $objectId = $params["portletId"];
     $clearer = new \Widgets\Clearer();
     $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"]);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $addressInput = new \Widgets\TextInput();
     $addressInput->setLabel("RSS-Adresse");
     $addressInput->setData($object);
     $addressInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([address])"));
     $countInput = new \Widgets\TextInput();
     $countInput->setLabel("Anzahl Beiträge");
     $countInput->setData($object);
     $countInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([num_items])"));
     $lengthInput = new \Widgets\TextInput();
     $lengthInput->setLabel("Länge des Inhalts");
     $lengthInput->setData($object);
     $lengthInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([desc_length])"));
     $checkbox = new \Widgets\Checkbox();
     $checkbox->setLabel("HTML zulassen");
     $checkbox->setData($object);
     $checkbox->setCheckedValue("checked");
     $checkbox->setUncheckedValue("");
     $checkbox->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([allow_html])"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $dialog->addWidget($addressInput);
     $dialog->addWidget($clearer);
     $dialog->addWidget($countInput);
     $dialog->addWidget($clearer);
     $dialog->addWidget($lengthInput);
     $dialog->addWidget($clearer);
     $dialog->addWidget($checkbox);
     $this->dialog = $dialog;
 }
コード例 #10
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 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"));
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget(new \Widgets\Clearer());
     $align = new \Widgets\ComboBox();
     $align->setLabel("Sortierung");
     $align->setOptions(array(array("name" => "Frühe Termine zuerst anzeigen", "value" => "earliest_first"), array("name" => "Späte Termine zuerst anzeigen", "value" => "latest_first")));
     $align->setData($object);
     $align->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:app:app_order"));
     $dialog->addWidget($align);
     $this->dialog = $dialog;
 }
コード例 #11
0
ファイル: Comment.class.php プロジェクト: rolwi/koala
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
     $currentUserName = $currentUser->get_name();
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Eintrag diskutieren");
     $dialog->setDescription("...");
     $dialog->setPositionX($this->params["mouseX"]);
     $dialog->setPositionY($this->params["mouseY"]);
     // get discussion thread between portfolio owner and current user or create empty thread
     $threads = $this->entry->get_annotations();
     $discussion = null;
     foreach ($threads as $thread) {
         if ($thread->get_name() === $currentUserName) {
             $discussion = $thread;
         }
     }
     if (!isset($discussion)) {
         $discussion = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $currentUserName, "Discussing with " . $currentUserName . ".", "text/plain");
         $this->entry->add_annotation($discussion);
     }
     $chat = new \Widgets\Chat();
     $chat->setData($discussion);
     $dialog->addWidget($chat);
     $dialog->addWidget(new \Widgets\Clearer());
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml("<hr>");
     $dialog->addWidget($rawHtml);
     $textinput = new \Widgets\TextInput();
     $textinput->setData($discussion);
     $textinput->setContentProvider(\Widgets\DataProvider::annotationDataProvider());
     $textinput->setLabel("Kommentar schreiben");
     $dialog->addWidget($textinput);
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }
コード例 #12
0
ファイル: EditDocument.class.php プロジェクト: rolwi/koala
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     if (isset($this->id)) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         if ($object instanceof \steam_document) {
             $mimetype = $object->get_attribute(DOC_MIME_TYPE);
             $objName = $object->get_name();
             $objDesc = trim($object->get_attribute(OBJ_DESC));
             if ($objDesc === 0 || $objDesc === "") {
                 $name = $objName;
             } else {
                 $name = $objDesc . " (" . $objName . ")";
             }
             $actionBar = new \Widgets\ActionBar();
             if ($mimetype == "text/html") {
                 $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Quelltext", "link" => PATH_URL . "Explorer/CodeEditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             } else {
                 $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             }
             $contentText = new \Widgets\Textarea();
             $contentText->setWidth(945);
             $contentText->setheight(400);
             $contentText->setData($object);
             $contentText->setTextareaClass("mce-full");
             if ($mimetype !== "text/html") {
                 $contentText->setTextareaClass("plain");
             }
             $html = cleanHTML($object->get_content());
             $dirname = dirname($object->get_path()) . "/";
             preg_match_all('/src="([%a-z0-9.\\-_\\/]*)"/iU', $html, $matches);
             $orig_matches = $matches[0];
             $path_matches = $matches[1];
             foreach ($path_matches as $key => $path) {
                 $path = urldecode($path);
                 if (parse_url($path, PHP_URL_SCHEME) != null) {
                     continue;
                 }
                 $ref_object = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $dirname . $path);
                 if ($ref_object instanceof \steam_object) {
                     $new_path = PATH_URL . "Download/Document/" . $ref_object->get_id();
                 } else {
                     $new_path = PATH_URL . "styles/standard/images/404.jpg";
                 }
                 $html = str_replace($orig_matches[$key], "src=\"{$new_path}\" data-mce-src=\"{$path}\"", $html);
             }
             $contentText->setContentProvider(\Widgets\DataProvider::contentProvider($html));
             $clearer = new \Widgets\Clearer();
             // 				$html = "";
             // 				if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") {  // Image
             // 					$html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>";
             // 				} else if ($mimetype == "text/html") {
             // 					$html = strip_tags($object->get_content(),"<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img>");
             // 				} else if (strstr($mimetype, "text")) {
             // 					$html = "<pre>{$object->get_content()}</pre>";
             // 				} else {
             // 					header("location: " . PATH_URL . "Download/Document/" . $this->id . "/");
             // 				}
             // 				$rawHtml = new \Widgets\RawHtml();
             // 				$rawHtml->setHtml($html);
             //$rawHtml->addWidget($breadcrumb);
             //$rawHtml->addWidget($environment);
             //$rawHtml->addWidget($loader);
             $frameResponseObject->setTitle($name);
             $frameResponseObject->addWidget($actionBar);
             //$frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->addWidget($contentText);
             $frameResponseObject->addWidget($clearer);
             return $frameResponseObject;
         }
     } else {
         ExtensionMaster::getInstance()->send404Error();
     }
 }
コード例 #13
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 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"));
     $clearer = new \Widgets\Clearer();
     $descriptionInput = new \Widgets\TextInput();
     $descriptionInput->setLabel("Überschrift");
     $descriptionInput->setData($object);
     $descriptionInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($descriptionInput);
     $dialog->addWidget($clearer);
     $descriptionInput = new \Widgets\TextInput();
     $descriptionInput->setLabel("Beschreibung");
     $descriptionInput->setData($object);
     $descriptionInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([poll_topic])"));
     $dialog->addWidget($descriptionInput);
     $dialog->addWidget($clearer);
     //datepicker
     $datepickerStart = new \Widgets\DatePicker();
     $datepickerStart->setLabel("Start der Abstimmung");
     $datepickerStart->setData($object);
     $datepickerStart->setContentProvider(new AttributeDataProviderPortletPollDates("start_date"));
     $dialog->addWidget($datepickerStart);
     $dialog->addWidget($clearer);
     $datepickerEnd = new \Widgets\DatePicker();
     $datepickerEnd->setLabel("Ende der Abstimmung");
     $datepickerEnd->setData($object);
     $datepickerEnd->setContentProvider(new AttributeDataProviderPortletPollDates("end_date"));
     $dialog->addWidget($datepickerEnd);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     $descLabelWidth = 60;
     $descInputWidth = 250;
     $voteLabelWidth = 1;
     $voteInputWidth = 20;
     //items
     //0
     $item0Description = new \Widgets\TextInput();
     $item0Description->setLabelWidth($descLabelWidth);
     $item0Description->setInputWidth($descInputWidth);
     $item0Description->setInputBackgroundColor("rgb(255,120,111)");
     $item0Description->setLabel("Antworten");
     $item0Description->setData($object);
     $item0Description->setContentProvider(new AttributeDataProviderPortletPollVotes(0, "description"));
     $dialog->addWidget($item0Description);
     $item0Votes = new \Widgets\TextInput();
     $item0Votes->setLabelWidth($voteLabelWidth);
     $item0Votes->setInputWidth($voteInputWidth);
     $item0Votes->setInputBackgroundColor("rgb(255,120,111)");
     //$item0Votes->setLabel("Stimmen");
     $item0Votes->setData($object);
     $item0Votes->setContentProvider(new AttributeDataProviderPortletPollVotes(0, "votes"));
     $dialog->addWidget($item0Votes);
     $dialog->addWidget($clearer);
     //1
     $item1Description = new \Widgets\TextInput();
     $item1Description->setLabelWidth($descLabelWidth);
     $item1Description->setInputWidth($descInputWidth);
     $item1Description->setInputBackgroundColor("rgb(250,186,97)");
     $item1Description->setData($object);
     $item1Description->setContentProvider(new AttributeDataProviderPortletPollVotes(1, "description"));
     $dialog->addWidget($item1Description);
     $item1Votes = new \Widgets\TextInput();
     $item1Votes->setLabelWidth($voteLabelWidth);
     $item1Votes->setInputWidth($voteInputWidth);
     $item1Votes->setInputBackgroundColor("rgb(250,186,97)");
     //$item1Votes->setLabel("Stimmen");
     $item1Votes->setData($object);
     $item1Votes->setContentProvider(new AttributeDataProviderPortletPollVotes(1, "votes"));
     $dialog->addWidget($item1Votes);
     $dialog->addWidget($clearer);
     //2
     $item2Description = new \Widgets\TextInput();
     $item2Description->setLabelWidth($descLabelWidth);
     $item2Description->setInputWidth($descInputWidth);
     $item2Description->setInputBackgroundColor("rgb(244,229,123)");
     //$item2Description->setLabel("Beschreibung Feld 3");
     $item2Description->setData($object);
     $item2Description->setContentProvider(new AttributeDataProviderPortletPollVotes(2, "description"));
     $dialog->addWidget($item2Description);
     $item2Votes = new \Widgets\TextInput();
     $item2Votes->setLabelWidth($voteLabelWidth);
     $item2Votes->setInputWidth($voteInputWidth);
     $item2Votes->setInputBackgroundColor("rgb(244,229,123)");
     //$item2Votes->setLabel("Stimmen");
     $item2Votes->setData($object);
     $item2Votes->setContentProvider(new AttributeDataProviderPortletPollVotes(2, "votes"));
     $dialog->addWidget($item2Votes);
     $dialog->addWidget($clearer);
     //3
     $item3Description = new \Widgets\TextInput();
     $item3Description->setLabelWidth($descLabelWidth);
     $item3Description->setInputWidth($descInputWidth);
     $item3Description->setInputBackgroundColor("rgb(194,222,102)");
     //$item3Description->setLabel("Beschreibung Feld 4");
     $item3Description->setData($object);
     $item3Description->setContentProvider(new AttributeDataProviderPortletPollVotes(3, "description"));
     $dialog->addWidget($item3Description);
     $item3Votes = new \Widgets\TextInput();
     $item3Votes->setLabelWidth($voteLabelWidth);
     $item3Votes->setInputWidth($voteInputWidth);
     $item3Votes->setInputBackgroundColor("rgb(194,222,102)");
     //$item3Votes->setLabel("Stimmen");
     $item3Votes->setData($object);
     $item3Votes->setContentProvider(new AttributeDataProviderPortletPollVotes(3, "votes"));
     $dialog->addWidget($item3Votes);
     $dialog->addWidget($clearer);
     //4
     $item4Description = new \Widgets\TextInput();
     $item4Description->setLabelWidth($descLabelWidth);
     $item4Description->setInputWidth($descInputWidth);
     $item4Description->setInputBackgroundColor("rgb(113,182,255)");
     //$item4Description->setLabel("Beschreibung Feld 5");
     $item4Description->setData($object);
     $item4Description->setContentProvider(new AttributeDataProviderPortletPollVotes(4, "description"));
     $dialog->addWidget($item4Description);
     $item4Votes = new \Widgets\TextInput();
     $item4Votes->setLabelWidth($voteLabelWidth);
     $item4Votes->setInputWidth($voteInputWidth);
     $item4Votes->setInputBackgroundColor("rgb(113,182,255)");
     //$item4Votes->setLabel("Stimmen");
     $item4Votes->setData($object);
     $item4Votes->setContentProvider(new AttributeDataProviderPortletPollVotes(4, "votes"));
     $dialog->addWidget($item4Votes);
     $dialog->addWidget($clearer);
     //5
     $item5Description = new \Widgets\TextInput();
     $item5Description->setLabelWidth($descLabelWidth);
     $item5Description->setInputWidth($descInputWidth);
     $item5Description->setInputBackgroundColor("rgb(207,163,224)");
     //$item5Description->setLabel("Beschreibung Feld 6");
     $item5Description->setData($object);
     $item5Description->setContentProvider(new AttributeDataProviderPortletPollVotes(5, "description"));
     $dialog->addWidget($item5Description);
     $item5Votes = new \Widgets\TextInput();
     $item5Votes->setLabelWidth($voteLabelWidth);
     $item5Votes->setInputWidth($voteInputWidth);
     $item5Votes->setInputBackgroundColor("rgb(207,163,224)");
     //$item5Votes->setLabel("Stimmen");
     $item5Votes->setData($object);
     $item5Votes->setContentProvider(new AttributeDataProviderPortletPollVotes(5, "votes"));
     $dialog->addWidget($item5Votes);
     $dialog->addWidget($clearer);
     $this->dialog = $dialog;
 }
コード例 #14
0
ファイル: Edit.class.php プロジェクト: rolwi/koala
 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"));
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $descriptionInput = new \Widgets\TextInput();
     $descriptionInput->setLabel("Beschreibung");
     $descriptionInput->setData($object);
     $descriptionInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:content([poll_topic])"));
     $dialog->addWidget($descriptionInput);
     $dialog->addWidget($clearer);
     //datepicker
     $datepickerStart = new \Widgets\DatePicker();
     $datepickerStart->setLabel("Start der Abstimmung");
     $datepickerStart->setData($object);
     $datepickerStart->setContentProvider(new AttributeDataProviderPortletTermplanDates("start_date"));
     $dialog->addWidget($datepickerStart);
     $dialog->addWidget($clearer);
     $datepickerEnd = new \Widgets\DatePicker();
     $datepickerEnd->setLabel("Ende der Abstimmung");
     $datepickerEnd->setData($object);
     $datepickerEnd->setContentProvider(new AttributeDataProviderPortletTermplanDates("end_date"));
     $dialog->addWidget($datepickerEnd);
     $dialog->addWidget($clearer);
     $termLabelWidth = 50;
     $termInputWidth = 300;
     //term descriptions
     $term0 = new \Widgets\TextInput();
     $term0->setLabelWidth($termLabelWidth);
     $term0->setInputWidth($termInputWidth);
     $term0->setLabel("Eintrag 1");
     $term0->setData($object);
     $term0->setContentProvider(new AttributeDataProviderPortletTermplanEntries("0"));
     $dialog->addWidget($term0);
     $dialog->addWidget($clearer);
     $term1 = new \Widgets\TextInput();
     $term1->setLabelWidth($termLabelWidth);
     $term1->setInputWidth($termInputWidth);
     $term1->setLabel("Eintrag 2");
     $term1->setData($object);
     $term1->setContentProvider(new AttributeDataProviderPortletTermplanEntries("1"));
     $dialog->addWidget($term1);
     $dialog->addWidget($clearer);
     $term2 = new \Widgets\TextInput();
     $term2->setLabelWidth($termLabelWidth);
     $term2->setInputWidth($termInputWidth);
     $term2->setLabel("Eintrag 3");
     $term2->setData($object);
     $term2->setContentProvider(new AttributeDataProviderPortletTermplanEntries("2"));
     $dialog->addWidget($term2);
     $dialog->addWidget($clearer);
     $term3 = new \Widgets\TextInput();
     $term3->setLabelWidth($termLabelWidth);
     $term3->setInputWidth($termInputWidth);
     $term3->setLabel("Eintrag 4");
     $term3->setData($object);
     $term3->setContentProvider(new AttributeDataProviderPortletTermplanEntries("3"));
     $dialog->addWidget($term3);
     $dialog->addWidget($clearer);
     $term4 = new \Widgets\TextInput();
     $term4->setLabelWidth($termLabelWidth);
     $term4->setInputWidth($termInputWidth);
     $term4->setLabel("Eintrag 5");
     $term4->setData($object);
     $term4->setContentProvider(new AttributeDataProviderPortletTermplanEntries("4"));
     $dialog->addWidget($term4);
     $dialog->addWidget($clearer);
     $term5 = new \Widgets\TextInput();
     $term5->setLabelWidth($termLabelWidth);
     $term5->setInputWidth($termInputWidth);
     $term5->setLabel("Eintrag 6");
     $term5->setData($object);
     $term5->setContentProvider(new AttributeDataProviderPortletTermplanEntries("5"));
     $dialog->addWidget($term5);
     $dialog->addWidget($clearer);
     $this->dialog = $dialog;
 }
コード例 #15
0
ファイル: EditReply.class.php プロジェクト: rolwi/koala
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $object_id = $this->id;
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     /** log-in user */
     $steamUser = \lms_steam::get_current_user();
     /** id of the log-in user */
     $steamUserId = $steamUser->get_id();
     /** name of the log-in user */
     $steamUserName = $steamUser->get_name();
     /** the current object */
     $object = \steam_factory::get_object($steamId, $object_id);
     /** the content of the message object */
     $object_content = $object->get_content(1);
     /** additional required attributes */
     $attrib = $object->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME, OBJ_LAST_CHANGED), 1);
     /** get the annotating category */
     $category = $object->get_annotating(1);
     /** check the rights of the log-in user */
     $allowed_write = $object->check_access_write($steamUser, 1);
     // flush the buffer
     $result = $steam->buffer_flush();
     $object_content = $result[$object_content];
     $attrib = $result[$attrib];
     $category = $result[$category];
     $allowed_write = $result[$allowed_write];
     $category_attributes = $category->get_attributes(array(OBJ_NAME, OBJ_DESC), 1);
     $result = $steam->buffer_flush();
     $category_attributes = $result[$category_attributes];
     $content = $object_content;
     $title = $attrib[OBJ_DESC];
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Bearbeite aktuelles Thema »" . getCleanName($object) . "«");
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $contentText = new \Widgets\Textarea();
     $contentText->setLabel("Inhalt");
     $contentText->setTextareaClass("mce-small");
     $contentText->setWidth(480);
     $contentText->setData($object);
     $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
     $dialog->addWidget($contentText);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     /*$ajaxForm = new \Widgets\AjaxForm();
     		 $ajaxForm->setSubmitCommand("EditReplyContent");
     		 $ajaxForm->setSubmitNamespace("Forum");
     
     		 $ajaxForm->setHtml(<<<END
     		 <input type="hidden" name="id" value="{$this->id}">
     		 <input type="hidden" name="forum" value="{$this->params["forum"]}">
     		 <div class="widgets_lable">Überschrift:</div>
     		 <div class="widgets_textinput"><input type="text" value="{$title}" name="title"></div><br clear="all">
     		 <div class="widgets_lable">Inhalt:</div>
     		 <div class="widgets_textarea"><textarea rows="10" style="width:100%" class="tinymce"  value="{$content}" name="content1" id="content1"></textarea><br clear="all">
     		 <input id="content_id" type="hidden" name="content" value="">
     		 <script type="text/javascript">
     		 tinyMCE.init({
     		 mode : "textareas",
     
     		 // General options
     		 theme : "advanced",
     		 skin: "o2k7",
     		 id: "content1",
     		 name:"content1",
     		 force_br_newlines : true,
     		 force_p_newlines : false,
     		 forced_root_block : '',
     
     		 language: "de",
     		 plugins : "emotions,paste",
     
     			//Specific options
     			setup : function(ed) {
     			ed.onKeyUp.add(function(ed, o) {
     			var content = "<p>"+ed.getContent()+"</p>";
     			$("#content_id").val(content);
     			});
     			ed.onInit.add(function(ed) {
     			ed.setContent('{$content}');
     			});
     
     			},
     
     			// Theme options
     			theme_advanced_buttons1 : "bold,italic,underline,|,image,link,unlink,|,forecolor,removeformat,|,undo,redo,pasteword,|,code",
     			theme_advanced_buttons2 : "",
     			theme_advanced_buttons3 : "",
     			theme_advanced_buttons4 : "",
     			theme_advanced_toolbar_location : "top",
     			theme_advanced_toolbar_align : "left",
     			theme_advanced_statusbar_location : "none",
     			theme_advanced_resizing : false
     			});
     
     			</script>
     			END
     			);
     			$dialog->addWidget($ajaxForm);*/
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }
コード例 #16
0
ファイル: Properties.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #17
0
ファイル: EditTopic.class.php プロジェクト: rolwi/koala
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $forumId = $this->params["forum"];
     $objectId = $this->id;
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     $forum = \steam_factory::get_object($steamId, $forumId);
     /** log-in user */
     $steamUser = \lms_steam::get_current_user();
     /** id of the log-in user */
     $steamUserId = $steamUser instanceof \steam_user ? $steamUser->get_id() : 0;
     /** the current category object */
     $object = \steam_factory::get_object($steamId, $objectId);
     /** the content of the category object */
     $object_content = $object->get_content(1);
     /** additional required attributes */
     $attrib = $object->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME, OBJ_LAST_CHANGED, "bid:description"), 1);
     /* get the annotating forum object */
     $forum = $object->get_annotating(1);
     /** check the rights of the log-in user */
     $allowed_write = $object->check_access_write($steamUser, 1);
     // flush the buffer
     $result = $steam->buffer_flush();
     $object_content = $result[$object_content];
     $attrib = $result[$attrib];
     $forum = $result[$forum];
     $allowed_write = $result[$allowed_write];
     $forum_attrib = $forum->get_attributes(array(OBJ_NAME, OBJ_DESC, "bid:description"), 1);
     $result = $steam->buffer_flush();
     $forum_attrib = $result[$forum_attrib];
     $content = $object_content;
     $title = $attrib[OBJ_DESC];
     $description = isset($attrib["bid:description"]) ? $attrib["bid:description"] : "";
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Bearbeite aktuelles Thema »" . getCleanName($object) . "«");
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $contentText = new \Widgets\Textarea();
     $contentText->setLabel("Inhalt");
     $contentText->setTextareaClass("mce-small");
     $contentText->setWidth(480);
     $contentText->setData($object);
     $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
     $dialog->addWidget($contentText);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     /*$widget = new \Widgets\Checkbox();
     		$widget->setLabel("Benutzer dürfen ihre Antworten bearbeiten");
     		$widget->setData($object);
     		$widget->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:forum:is_editable"));
     		$widget->setCheckedValue("checked");
     		$widget->setUncheckedValue("");
     		$dialog->addWidget($widget);*/
     /*	$ajaxForm = new \Widgets\AjaxForm();
     		$ajaxForm->setSubmitCommand("EditTopicContent");
     		$ajaxForm->setSubmitNamespace("Forum");
     
     		$ajaxForm->setHtml(<<<END
     	<input type="hidden" name="id" value="{$this->id}">
     	
     	
     	<div class="widgets_lable">Überschrift:</div>
     	<div class="widgets_textinput"><input type="text" value="{$title}" name="title"></div><br clear="all">
     	<div class="widgets_lable">Inhalt:</div>
     	<div class="widgets_textarea"><textarea rows="10" style="width:100%" class="tinymce"  value="{$content}" name="content1" id="content1"></textarea><br clear="all">
     	
     END
     		);
     			
     		$dialog->addWidget($ajaxForm);*/
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }