private function getCleanName() { if ($this->object instanceof steam_user) { $title = $this->object->get_attribute(USER_FIRSTNAME) . " " . $this->object->get_attribute(USER_FULLNAME); } else { $user = isUserHome($this->object); if ($user) { $title = getCleanName($user); } else { if ($this->object instanceof steam_trashbin) { $title = "Papierkorb"; } else { $desc = $this->object->get_attribute(OBJ_DESC); if ($desc !== 0 && trim($desc) !== "") { $title = $desc; } else { $title = $this->object->get_name(); } $title = str_replace("'s workarea", "", stripslashes($title)); $title = str_replace(" workarea", "", stripslashes($title)); $title = str_replace("s workroom.", "", $title); $title = str_replace("s workroom", "", $title); $title = preg_replace("/.*'s bookmarks/", "Lesezeichen", $title); } } } return $title; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $idRequestObject = new \IdRequestObject(); $idRequestObject->setId($this->id); $extensions = \ExtensionMaster::getInstance()->getExtensionByType("IObjectExtension"); $commands = array(); foreach ($extensions as $extension) { if (!strstr(strtolower(get_class($extension)), "portlet")) { $command = $extension->getCreateNewCommand($idRequestObject); if ($command) { $commands[] = $command; } } } $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $dialog = new \Widgets\Dialog(); $dialog->setTitle("Erstelle ein neues Objekt in »" . getCleanName($object) . "«"); $dialog->setCloseButtonLabel(null); $dialog->setPositionX($this->params["mouseX"]); $dialog->setPositionY($this->params["mouseY"]); $html = "<div id=\"wizard\" style=\"margin-left: 20px; margin-right: 20px\">"; foreach ($commands as $command) { $namespaces = $command->getExtension()->getUrlNamespaces(); $html .= "<a href=\"\" onclick=\"sendRequest('{$command->getCommandName()}', {'id':{$this->id}}, 'wizard', 'wizard', null, null, '{$namespaces[0]}');return false;\" title=\"{$command->getExtension()->getObjectReadableDescription()}\"><img src=\"{$command->getExtension()->getObjectIconUrl()}\"> {$command->getExtension()->getObjectReadableName()}</a><br>"; } $html .= "<div style=\"float:right\"><a class=\"button pill negative\" onclick=\"closeDialog();return false;\" href=\"#\">Abbrechen</a></div></div><div id=\"wizard_wrapper\"></div>"; $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html); $dialog->addWidget($rawHtml); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($dialog); return $ajaxResponseObject; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $dialog = new \Widgets\Dialog(); $dialog->setTitle("Erstelle neues Thema in »" . getCleanName($object) . "«"); $ajaxForm = new \Widgets\AjaxForm(); $ajaxForm->setSubmitCommand("CreateTopic"); $ajaxForm->setSubmitNamespace("Forum"); $ajaxForm->setHtml(<<<END \t<input type="hidden" name="id" value="{$this->id}"> \t<div class="widgets_lable">Überschrift:</div> \t<div class="widgets_textinput"><input type="text" value="" name="title"></div><br clear="all"> \t<div class="widgets_lable">Inhalt:</div> \t<div class="widgets_textarea"><textarea rows="10" style="width:100%" class="mce-small" value="" name="content" id="content"></textarea><br clear="all"> \t<script type="text/javascript"> \t\t \tvar mce_defaults = { \t \t\t\tmode : "specific_textareas", \t \t\t\t \t \t\t\t// General options \t\t\t\t\ttheme : "advanced", \t\t\t\t\tcontent_css : "{PATH_URL}widgets/css/tinymce.css", \t\t\t\t\tskin: "o2k7", \t\t\t\t\tremove_linebreaks: false, \t\t\t\t convert_urls : false, \t\t\t\t verify_html: "false", \t\t\t\t\tlanguage: "de", \t\t\t\t\t \t\t\t\t\t// Theme options \t\t\t\t\ttheme_advanced_buttons3 : "", \t\t\t\t\ttheme_advanced_buttons4 : "", \t\t\t\t\ttheme_advanced_toolbar_location : "top", \t\t\t\t\ttheme_advanced_toolbar_align : "left", \t\t\t\t\ttheme_advanced_statusbar_location : "none", \t\t\t\t\ttheme_advanced_resizing : false, \t\t\t\t\t \t \t}; \t \t \t \t \t \t\tload("mce", function() { \t\t\t\t\ttinyMCE.init(\$.extend({ \t\t\t\t\t\teditor_selector: "mce-small", \t\t\t\t\t\tplugins : "emotions,paste,noneditable", \t\t\t\t\t\t// Theme options \t\t\t\t\t\ttheme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist,|,link,unlink,|,forecolor,removeformat,|,undo,redo,pasteword", \t\t\t\t\t\ttheme_advanced_buttons2 : "" \t\t\t\t\t}, mce_defaults)); \t \t\t}); \t \t</script> END ); $dialog->addWidget($ajaxForm); $dialog->setCloseButtonLabel(null); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($dialog); return $ajaxResponseObject; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $rawHtml = new \Widgets\RawHtml(); $url = \ExtensionMaster::getInstance()->getUrlForObjectId($this->object->get_id(), "view"); $desc = $this->object->get_attribute("OBJ_DESC"); $name = getCleanName($this->object, 50); if (isset($url) && $url != "") { $html = "<a href=\"" . $url . "\" title=\"{$desc}\"> " . $name . "</a>"; } else { $html = $name; } $rawHtml->setHtml($html); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($rawHtml); return $ajaxResponseObject; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $objDesc = trim($this->object->get_attribute(OBJ_DESC)); if ($objDesc === 0 || $objDesc === "") { $this->object->set_attribute(OBJ_DESC, $this->object->get_name()); } $titelInput = new \Widgets\TextInput(); $titelInput->setData($this->object); $titelInput->setFocus(true); $titelInput->setContentProvider(new NameAttributeDataProvider("OBJ_NAME", getCleanName($this->object, -1))); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setJs("jQuery(document).click(function() {removeAllDirectEditors();})"); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($titelInput); $ajaxResponseObject->addWidget($rawHtml); return $ajaxResponseObject; }
public function getCellData($cell, $contentItem) { if (!is_int($cell)) { throw new \Exception("cell must be an integer!!"); } if ($cell == $this->rawImage) { return "<img src=\"" . PATH_URL . "explorer/asset/icons/mimetype/" . deriveIcon($contentItem->get_link_object()) . "\"></img>"; } else { if ($cell == $this->rawName) { $url = \ExtensionMaster::getInstance()->getUrlForObjectId($contentItem->get_link_object()->get_id(), "view"); $desc = $contentItem->get_link_object()->get_attribute("OBJ_DESC"); $name = getCleanName($contentItem->get_link_object(), 50); if (isset($url) && $url != "") { return "<a href=\"" . $url . "\" title=\"{$desc}\"> " . $name . "</a>"; } else { return $name; } } else { if ($cell == $this->rawChangeDate) { return getReadableDate($contentItem->get_link_object()->get_attribute("OBJ_LAST_CHANGED")); } } } }
private function getChronicEntry($steam_object) { $result = array("name" => "<img src=\"" . PATH_URL . "explorer/asset/icons/mimetype/" . deriveIcon($steam_object) . "\"></img> " . getCleanName($steam_object, 20), "link" => \ExtensionMaster::getInstance()->getUrlForObjectId($steam_object->get_id(), "view")); return $result; }
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; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $frameResponseObject->setTitle(getCleanName($this->portalObject)); $frameResponseObject->addWidget($this->rawHtmlWidget); return $frameResponseObject; }
public function getCellData($cell, $contentItem) { if (!is_int($cell)) { throw new \Exception("cell must be an integer!!"); } $objType = getObjectType($contentItem); if ($cell == $this->rawCheckbox) { if (!$contentItem instanceof \steam_trashbin) { return "<input id=\"{$contentItem->get_id()}_checkbox\" style=\"margin-top:-4px\" type=\"checkbox\" onclick=\"event.stopPropagation(); if(this.checked) { jQuery('#{$contentItem->get_id()}').addClass('listviewer-item-selected') } else { jQuery('#{$contentItem->get_id()}').removeClass('listviewer-item-selected') }\"></input>"; } else { return ""; } } else { if ($cell == $this->rawImage) { return "<img src=\"" . PATH_URL . "explorer/asset/icons/mimetype/" . deriveIcon($contentItem) . "\"></img>"; } else { if ($cell == $this->rawName) { $tipsy = new \Widgets\Tipsy(); $tipsy->setElementId($contentItem->get_id() . "_" . $this->rawName); $tipsy->setHtml("<div style=\"font-weight:bold; width:100px; float:left;\">Besitzer</div> <img style=\"margin: 3px\" align=\"middle\" src=\"" . PATH_URL . "download/image/" . $contentItem->get_creator()->get_attribute(OBJ_ICON)->get_id() . "/30/30\"> " . $contentItem->get_creator()->get_attribute(USER_FIRSTNAME) . " " . $contentItem->get_creator()->get_attribute(USER_FULLNAME) . "<br clear=\"all\">" . "<div style=\"font-weight:bold; width:100px; float:left;\">zuletzt geändert</div> " . getFormatedDate($contentItem->get_attribute(OBJ_LAST_CHANGED)) . "<br>" . "<div style=\"font-weight:bold; width:100px; float:left;\">erstellt</div> " . getFormatedDate($contentItem->get_attribute(OBJ_CREATION_TIME)) . "<br>"); $url = PATH_URL . "explorer/index/" . $contentItem->get_id() . "/"; $desc = $contentItem->get_attribute("OBJ_DESC"); //$name = $objectModel->getReadableName(); $name = getCleanName($contentItem, 50); if (isset($url) && $url != "") { return "<a href=\"" . $url . "\" title=\"{$desc}\"> " . $name . "</a>" . "<script>" . $tipsy->getHtml() . "</script>"; } else { return $name . "<script>" . $tipsy->getHtml() . "</script>"; } } else { if ($cell == $this->rawMarker) { $html = ""; if ($objType == "referenceFile") { $html .= "<div class=\"marker\">" . \Explorer\Model\Sanction::getMarkerHtml($contentItem->get_link_object()) . "</div>"; } else { $html .= "<div class=\"marker\">" . \Explorer\Model\Sanction::getMarkerHtml($contentItem) . "</div>"; } $html .= "<div class=\"marker\" id=\"{$contentItem->get_id()}_BookmarkMarkerWrapper\">"; $linkError = false; if ($contentItem instanceof \steam_exit) { $exitObject = $contentItem->get_exit(); if ($exitObject instanceof \steam_object) { $id = $exitObject->get_id(); } else { $linkError = true; $html .= "<div style=\"color:red\">Link defekt</div>"; } } else { if ($contentItem instanceof \steam_link) { $linkObject = $contentItem->get_link_object(); if ($linkObject instanceof \steam_object) { $id = $linkObject->get_id(); } else { $linkError = true; $html .= "<div style=\"color:red\">Link defekt</div>"; } } else { $id = $contentItem->get_id(); } } if (!$linkError && \Bookmarks\Model\Bookmark::isBookmark($id)) { $html .= \Bookmarks\Model\Bookmark::getMarkerHtml($id); } $html .= "</div>"; return $html; } else { if ($cell == $this->rawChangeDate) { if ($objType == "referenceFile") { return getReadableDate($contentItem->get_link_object()->get_attribute("OBJ_LAST_CHANGED")); } else { return getReadableDate($contentItem->get_attribute("OBJ_LAST_CHANGED")); } } else { if ($cell == $this->rawSize) { return getObjectReadableSize($contentItem); } else { if ($cell == $this->rawMenu) { $popupMenu = new \Widgets\PopupMenu(); $popupMenu->setData($contentItem); $popupMenu->setElementId("listviewer-overlay"); return $popupMenu; } } } } } } } }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $rawHtml = new \Widgets\RawHtml(); $steam = $GLOBALS["STEAM"]; $objectId = $this->id; $myExtension = \Forum::getInstance(); $forumObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId); $steamUser = $GLOBALS["STEAM"]->get_current_steam_user(); $lastSessionTime = $steamUser->get_attribute("bid:last_session_time"); $lastSessionTime = is_array($lastSessionTime) ? intval($lastSessionTime[0]) : intval(time()); /** check the rights of the log-in user */ $forum_allowed_write = $forumObject->check_access(SANCTION_SANCTION, $steamUser); $forum_allowed_read = $forumObject->check_access_read($steamUser); $forum_allowed_annotate = $forumObject->check_access_annotate($steamUser); if (!$forum_allowed_read) { throw new \Exception("You have no permission to read this forum", E_USER_RIGHTS); } $forumAttributes = $forumObject->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME, "bid:description", "bid:forum_subscription")); $categories = $forumObject->get_annotations(); $forumAnnotations = $categories; foreach ($categories as $category) { $id = $category->get_id(); $categoryAttributes[$id] = $category->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME, "bid:description"), 1); $messages[$id] = $category->get_annotations(false, 1); $categoryCreator[$id] = $category->get_creator(1); } $result = $steam->buffer_flush(); foreach ($categories as $category) { $id = $category->get_id(); $messages[$id] = $result[$messages[$id]]; $categoryMessageCount[$id] = count($messages[$id]); sort($messages[$id]); if ($categoryMessageCount[$id] > 0) { $categoryLastMessageAttributes[$id] = end($messages[$id])->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME), 1); $categoryLastMessageCreator[$id] = end($messages[$id])->get_creator(1); } $categoryAttributes[$id] = $result[$categoryAttributes[$id]]; $categoryCreator[$id] = $result[$categoryCreator[$id]]; $categoryCreator[$id]->get_attributes(array(OBJ_NAME), 1); } $result = $steam->buffer_flush(); foreach ($categories as $category) { $id = $category->get_id(); if ($categoryMessageCount[$id] > 0) { $categoryLastMessageAttributes[$id] = $result[$categoryLastMessageAttributes[$id]]; $categoryLastMessageCreator[$id] = $result[$categoryLastMessageCreator[$id]]; $categoryLastMessageCreator[$id]->get_attributes(array(OBJ_NAME), 1); } } $result = $steam->buffer_flush(); $myExtension->addCSS(); $content = $myExtension->loadTemplate("forumIndex.template.html"); $content->setCurrentBlock('BLOCK_FORUM_HEAD'); $content->setVariable("FORUM_HEADING", urldecode($forumAttributes["OBJ_NAME"])); $content->setVariable("FORUM_UNDERTITLE", $forumAttributes["OBJ_DESC"] !== 0 ? $forumAttributes["OBJ_DESC"] : ""); $content->setVariable("FORUM_DESCRIPTION", $forumAttributes["bid:description"] !== 0 ? $forumAttributes["bid:description"] : ""); $content->parse('BLOCK_FORUM_HEAD'); // sort all forum topics usort($forumAnnotations, "sortTopicsByDate"); if (count($forumAnnotations) == 0) { $content->setVariable("NO_CONTENT", "Dieses Forum enthält keine Themen."); } else { foreach ($forumAnnotations as $annotation) { $content->setCurrentBlock('BLOCK_FORUM_CONTENT'); $content->setVariable("TOPIC", $annotation->get_attribute("OBJ_DESC")); $content->setVariable("TOPIC_AUTHOR", getCleanName($annotation->get_attribute("DOC_USER_MODIFIED"))); $content->setVariable("TOPIC_DATE", getReadableDate($annotation->get_attribute("OBJ_CREATION_TIME"))); $content->setVariable("LINK_SHOW_TOPIC", PATH_URL . "forum/showTopic/" . $objectId . "/" . $annotation->get_id()); $count = count($annotation->get_annotations()); $content->setVariable("REPLY_COUNT", $count); if ($count > 0) { $content->setVariable("LAST_REPLY_TOPIC", $categoryLastMessageAttributes[$annotation->get_id()][OBJ_DESC]); $content->setVariable("LAST_REPLY_DATE", date("d.m.Y G:i", $annotation->get_attribute("OBJ_LAST_CHANGED"))); $content->setVariable("LAST_REPLY_USER", getCleanName($annotation->get_attribute("DOC_USER_MODIFIED"))); $lastPostTime = $annotation->get_attribute("OBJ_CREATION_TIME"); if ($lastSessionTime < $lastPostTime) { $imageUrl = \Forum::getInstance()->getAssetUrl() . "icons/new_message_info.gif"; //$content->setVariable("NEW_IMAGE", '<img src="'.$imageUrl.'" title="Neue Antworten.">'); } } // $popupMenu= new \Widgets\PopupMenu(); // $popupMenu->setData($annotation); // $popupMenu->setElementId("overlay_menu"); // $popupMenu->setParams(array(array("key" => "forum", "value" => $objectId))); // $content->setVariable("POPUP_MENU", $popupMenu->getHtml()); // $rawHtml->addWidget($popupMenu); $content->parse('BLOCK_FORUM_CONTENT'); } } $actionBar = new \Widgets\ActionBar(); $actions = array(); if ($forum_allowed_annotate) { $actions[] = array("name" => "Neues Thema", "ajax" => array("onclick" => array("command" => "newTopic", "params" => array("id" => $this->id), "requestType" => "popup"))); } if ($forum_allowed_write) { $actions[] = array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "Properties", "params" => array("id" => $this->id), "requestType" => "popup", "namespace" => "explorer"))); $actions[] = array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup", "namespace" => "explorer"))); } $actionBar->setActions($actions); //$breadcrumb = new \Widgets\Breadcrumb(); //$breadcrumb->setData(array($currentRoom)); $frameResponseObject->setTitle("Forum - " . $forumAttributes["OBJ_DESC"]); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($actionBar); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
public function getCellData($cell, $contentItem) { if (!is_int($cell)) { throw new \Exception("cell must be an integer!!"); } if ($cell == $this->rawImage) { return "<img src=\"" . PATH_URL . "explorer/asset/icons/mimetype/" . deriveIcon($contentItem) . "\"></img>"; } else { if ($cell == $this->rawName) { $url = \ExtensionMaster::getInstance()->getUrlForObjectId($contentItem->get_id(), "view"); $name = getCleanName($contentItem); if (isset($url) && $url != "") { return "<a href=\"" . $url . "\" title=\"{$desc}\"> " . $name . "</a>"; } else { return $name; } } else { if ($cell == $this->rawMarker) { $html = ""; $html .= "<div class=\"marker\">" . \Explorer\Model\Sanction::getMarkerHtml($contentItem) . "</div>"; $html .= "<div class=\"marker\" id=\"{$contentItem->get_id()}_BookmarkMarkerWrapper\">"; $linkError = false; if ($contentItem instanceof \steam_exit) { $exitObject = $contentItem->get_exit(); if ($exitObject instanceof \steam_object) { $id = $exitObject->get_id(); } else { $linkError = true; $html .= "<div style=\"color:red\">Link defekt</div>"; } } else { if ($contentItem instanceof \steam_link) { $linkObject = $contentItem->get_link_object(); if ($linkObject instanceof \steam_object) { $id = $linkObject->get_id(); } else { $linkError = true; $html .= "<div style=\"color:red\">Link defekt</div>"; } } else { $id = $contentItem->get_id(); } } if (!$linkError && \Bookmarks\Model\Bookmark::isBookmark($id)) { $html .= \Bookmarks\Model\Bookmark::getMarkerHtml($id); } $html .= "</div>"; return $html; } else { if ($cell == $this->rawChangeDate) { return getReadableDate($contentItem->get_attribute("OBJ_LAST_CHANGED")); } else { if ($cell == $this->rawSize) { if ($contentItem instanceof \steam_document) { return getReadableSize($contentItem->get_content_size()); } else { if ($contentItem instanceof \steam_container) { try { $html = "<div style=\"color: #ccc\">" . count($contentItem->get_inventory()) . " Objekte</div>"; } catch (\steam_exception $e) { $html = "keine Berechtigung"; } return $html; } } } } } } } }
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; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $objId = $this->id; $steam = $GLOBALS["STEAM"]; $steamUser = \lms_steam::get_current_user(); $dialog = new \Widgets\Dialog(); $dialog->setWidth(600); $dialog->setTitle("Rechte von »" . getCleanName($object) . "«"); $dialog->setPositionX($this->params["mouseX"]); $dialog->setPositionY($this->params["mouseY"]); //GET CREATOR TODO: USEFULL FOR ROOT FOLDER $env = $object->get_environment(); $envName = $env instanceof \steam_room ? $env->get_name() : ""; //SET ICON URL $privatePicUrl = PATH_URL . "explorer/asset/icons/private.png"; $userdefPicUrl = PATH_URL . "explorer/asset/icons/user_defined.png"; $userglobalPicUrl = PATH_URL . "explorer/asset/icons/server_public.png"; $worldglobalPicUrl = PATH_URL . "explorer/asset/icons/world_public.png"; //GET OWNER OF THE CURRENT OBJECT $owner = $object->get_creator(); $creatorId = $owner->get_id(); $ownerFullName = $owner->get_full_name(); //GET ACQUIRE SETTINGS $acquire = $object->get_acquire(); $acqChecked = $acquire instanceof \steam_room ? true : false; //GET FAVORITES $favs = $steamUser->get_buddies(); $favorites = array(); foreach ($favs as $fav) { $favorites[$fav->get_id()] = $fav; } //GET GROUPS $groups = $steamUser->get_groups(); //GET GROUPS EVERYONE $everyone = \steam_factory::groupname_to_object($steam->get_id(), "everyone"); $everyoneId = $everyone->get_id(); $groups[$everyoneId] = $everyone; //GET GROUP STEAM $steamgroup = \steam_factory::groupname_to_object($steam->get_id(), "sTeam"); $steamgroupId = $steamgroup->get_id(); //GET SOME ATTRIBUTES $attrib = $object->get_attributes(array(OBJ_NAME, OBJ_DESC, "bid:doctype")); //GET SANCTION $sanction = $object->get_sanction(); if ($env instanceof \steam_room) { $environmentSanction = $env->get_sanction(); } $additionalUser = array(); foreach ($sanction as $id => $sanct) { if (!array_key_exists($id, $groups) && !array_key_exists($id, $favorites) && $id != $creatorId && $id != 0 && $id != $everyoneId) { $additionalUser[$id] = \steam_factory::get_object($steam->get_id(), $id); } } $bid_doctype = isset($attrib["bid:doctype"]) ? $attrib["bid:doctype"] : ""; $docTypeQuestionary = strcmp($attrib["bid:doctype"], "questionary") == 0; $docTypeMessageBoard = $object instanceof \steam_messageboard; if ($docTypeQuestionary) { $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_INSERT; } else { if ($docTypeMessageBoard) { $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_ANNOTATE; } else { $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_WRITE | SANCTION_EXECUTE | SANCTION_MOVE | SANCTION_INSERT | SANCTION_ANNOTATE; } } //MAPPING GROUPS $groupsMapping = array(); $groupsMapping[$everyone->get_id()] = $everyone->get_name(); foreach ($groups as $group) { $groupsMapping[$group->get_id()] = $group->get_name(); } //MAPPING FAVORITES $favoritesMapping = array(); foreach ($favorites as $favorite) { if ($favorite instanceof \steam_user) { $favoritesMapping[$favorite->get_id()] = $favorite->get_full_name(); } else { $favoritesMapping[$favorite->get_id()] = $favorite->get_name(); } } //MAPPING ADDITIONAL USERS $additionalMapping = array(); foreach ($sanction as $id => $sanct) { if (!array_key_exists($id, $groupsMapping) && !array_key_exists($id, $favoritesMapping) && $id != $creatorId && $id != 0 && $id != $everyoneId) { $additionalMapping[$id] = \steam_factory::get_object($steam->get_id(), $id)->get_name(); } } //MAPPING ADDITIONAL USERS ACQUIRED $additionalMappingEnvironment = array(); if (isset($environmentSanction) && count($environmentSanction) > 0) { foreach ($environmentSanction as $id => $sanct) { if (!array_key_exists($id, $groupsMapping) && !array_key_exists($id, $favoritesMapping) && $id != $creatorId && $id != 0 && $id != $groupEveryoneId) { $additionalMappingEnvironment[$id] = \steam_factory::get_object($steam, $id)->get_name(); } } } $content = \Explorer::getInstance()->loadTemplate("sanction.template.html"); //ACQUIRE if ($envName == "") { $content->setVariable("NO_ENVIRONMENT", "disabled"); } if ($acqChecked) { $content->setVariable("ACQUIRE_START", "activateAcq();"); } $content->setVariable("INHERIT_FROM", getCleanName($env)); //PICTURES $content->setVariable("PRIVATE_PIC", $privatePicUrl); $content->setVariable("USER_DEF_PIC", $userdefPicUrl); $content->setVariable("USER_GLOBAL_PIC", $userglobalPicUrl); $content->setVariable("SERVER_GLOBAL_PIC", $worldglobalPicUrl); //OWNER $content->setVariable("OWNER_FULL_NAME", $ownerFullName); $content->setVariable("EVERYONE_ID", $everyoneId); $content->setVariable("STEAM_ID", $steamgroupId); $content->setVariable("SEND_REQUEST_SANCTION", 'sendRequest("UpdateSanctions", { "id": ' . $objId . ', "sanctionId": id, "type": "sanction", "value": value }, "", "data", function(response){jQuery(\'#dynamic_wrapper\').remove(); jQuery(\'#overlay\').remove(); sendRequest(\'Sanctions\', {\'id\':\'' . $objId . '\'}, \'\', \'popup\', null, null, \'explorer\');}, null, "explorer");'); $content->setVariable("SEND_REQUEST_CRUDE", 'sendRequest("UpdateSanctions", { "id": ' . $objId . ', "type": "crude", "value": value }, "", "data", function(response){jQuery(\'#dynamic_wrapper\').remove(); jQuery(\'#overlay\').remove(); sendRequest(\'Sanctions\', {\'id\':\'' . $objId . '\'}, \'\', \'popup\', null, null, \'explorer\');}, null, "explorer");'); $content->setVariable("SEND_REQUEST_ACQ_ACT", 'sendRequest("UpdateSanctions", { "id": ' . $objId . ', "type": "acquire", "value": "acq" }, "", "data", null, null, "explorer");'); $content->setVariable("SEND_REQUEST_ACQ_DEACT", 'sendRequest("UpdateSanctions", { "id": ' . $objId . ', "type": "acquire", "value": "non_acq" }, "", "data", null, null, "explorer");'); //TEMPLATE GROUPS if (count($groupsMapping) == 0) { $content->setVariable("NO_GROUP_MEMBER", "Sie sind kein Mitglied einer Gruppe"); $content->setVariable("NO_GROUP_MEMBER_ACQ", "Sie sind kein Mitglied einer Gruppe"); } else { foreach ($groupsMapping as $id => $name) { $dropDownValue = 0; if (isset($sanction[$id])) { if ($sanction[$id] == SANCTION_READ) { $dropDownValue = 1; } elseif ($sanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT)) { $dropDownValue = 2; } elseif ($sanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT | SANCTION_SANCTION)) { $dropDownValue = 3; } } $dropDownValueAcq = 0; if (isset($environmentSanction[$id])) { if ($environmentSanction[$id] == SANCTION_READ) { $dropDownValueAcq = 1; } elseif ($environmentSanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT)) { $dropDownValueAcq = 2; } elseif ($environmentSanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT | SANCTION_SANCTION)) { $dropDownValueAcq = 3; } } //HACK $group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id); // SANCTION_WRITE | SANCTION_EXECUTE | SANCTION_MOVE | SANCTION_INSERT | SANCTION_ANNOTATE; $readCheck = $object->check_access_read($group); $writeCheck = $object->check_access($SANCTION_WRITE_FOR_CURRENT_OBJECT, $group); $sanctionCheck = $object->check_access(SANCTION_SANCTION, $group); $content->setCurrentBlock("GROUPS"); $content->setCurrentBlock("GROUP_DDSETTINGS"); $content->setVariable("GROUPID", $id); $content->setVariable("GROUP_ID", $id); if ($sanctionCheck) { $content->setVariable("GROUP_RIGHTS", "Lesen, Schreiben und Berechtigen"); } elseif ($writeCheck) { $content->setVariable("GROUP_RIGHTS", "Lesen und Schreiben"); } elseif ($readCheck) { $content->setVariable("GROUP_RIGHTS", "Nur Lesen"); } else { $content->setVariable("GROUP_RIGHTS", ""); } if ($name == "Everyone") { $content->setVariable("GROUPNAME", "Jeder"); } else { if ($name == "sTeam") { $content->setVariable("GROUPNAME", "Angemeldete Benutzer"); } else { $content->setVariable("GROUPNAME", $group->get_groupname()); } } $content->setVariable("OPTIONVALUE", $dropDownValue); $content->parse("GROUP_DDSETTINGS"); $content->parse("GROUPS"); $content->setCurrentBlock("GROUPS_ACQ"); $content->setCurrentBlock("GROUP_DDSETTINGS_ACQ"); $content->setVariable("GROUPID_ACQ", $id); $content->setVariable("GROUP_ID_ACQ", $id); if ($name == "Everyone") { $content->setVariable("GROUPNAME_ACQ", "Jeder"); } else { if ($name == "sTeam") { $content->setVariable("GROUPNAME_ACQ", "Angemeldete Benutzer"); } else { $content->setVariable("GROUPNAME_ACQ", $name); } } if ($sanctionCheck) { $content->setVariable("GROUP_RIGHTS_ACQ", "Lesen, Schreiben und Berechtigen"); } elseif ($writeCheck) { $content->setVariable("GROUP_RIGHTS_ACQ", "Lesen und Schreiben"); } elseif ($readCheck) { $content->setVariable("GROUP_RIGHTS_ACQ", "Nur Lesen"); } else { $content->setVariable("GROUP_RIGHTS_ACQ", ""); } $content->setVariable("OPTIONVALUE_ACQ", $dropDownValueAcq); $content->parse("GROUP_DDSETTINGS_ACQ"); $content->parse("GROUPS_ACQ"); } } //TEMPLATE FAVORITES if (count($favoritesMapping) == 0) { $content->setVariable("NO_FAV_MEMBER", "Sie haben keine Favoriten"); $content->setVariable("NO_FAV_MEMBER_ACQ", "Sie haben keine Favoriten"); } else { $content->setVariable("DUMMY_FAV", ""); $content->setVariable("DUMMY_FAV_ACQ", ""); foreach ($favoritesMapping as $id => $name) { $dropDownValue = 0; if (isset($sanction[$id])) { if ($sanction[$id] == SANCTION_READ) { $dropDownValue = 1; } elseif ($sanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT)) { $dropDownValue = 2; } elseif ($sanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT | SANCTION_SANCTION)) { $dropDownValue = 3; } } $dropDownValueAcq = 0; if (isset($environmentSanction[$id])) { if ($environmentSanction[$id] == SANCTION_READ) { $dropDownValueAcq = 1; } elseif ($environmentSanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT)) { $dropDownValueAcq = 2; } elseif ($environmentSanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT | SANCTION_SANCTION)) { $dropDownValueAcq = 3; } } $favo = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id); $readCheck = $object->check_access_read($favo); $writeCheck = $object->check_access($SANCTION_WRITE_FOR_CURRENT_OBJECT, $favo); $sanctionCheck = $object->check_access(SANCTION_SANCTION, $favo); $content->setCurrentBlock("FAVORITES"); $content->setCurrentBlock("FAV_DDSETINGS"); $content->setVariable("FAVID", $id); $content->setVariable("FAV_ID", $id); $content->setVariable("FAVNAME", $name); $content->setVariable("FAV_OPTION_VALUE", $dropDownValue); if ($sanctionCheck) { $content->setVariable("FAV_RIGHTS", "Lesen, Schreiben und Berechtigen"); } elseif ($writeCheck) { $content->setVariable("FAV_RIGHTS", "Lesen und Schreiben"); } elseif ($readCheck) { $content->setVariable("FAV_RIGHTS", "Nur Lesen"); } else { $content->setVariable("FAV_RIGHTS", ""); } $content->parse("FAV_DDSETTINGS"); $content->parse("FAVORITES"); $content->setCurrentBlock("FAVORITES_ACQ"); $content->setCurrentBlock("FAV_DDSETINGS_ACQ"); $content->setVariable("FAVID_ACQ", $id); $content->setVariable("FAV_ID_ACQ", $id); if ($sanctionCheck) { $content->setVariable("FAV_RIGHTS_ACQ", "Lesen, Schreiben und Berechtigen"); } elseif ($writeCheck) { $content->setVariable("FAV_RIGHTS_ACQ", "Lesen und Schreiben"); } elseif ($readCheck) { $content->setVariable("FAV_RIGHTS_ACQ", "Nur Lesen"); } else { $content->setVariable("FAV_RIGHTS_ACQ", ""); } $content->setVariable("FAVNAME_ACQ", $name); $content->setVariable("FAV_OPTION_VALUE_ACQ", $dropDownValueAcq); $content->parse("FAV_DDSETTING_ACQS"); $content->parse("FAVORITES_ACQ"); } } //TEMPLATE ADDITIONAL USERS if (count($additionalMapping) == 0) { $content->setVariable("NO_AU_MEMBER", "Keine weiteren berechtigten Nutzer"); } else { $content->setVariable("DUMMY_AU", ""); $content->setVariable("DUMMY_AU_ACQ", ""); foreach ($additionalMapping as $id => $name) { $au = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id); // SANCTION_WRITE | SANCTION_EXECUTE | SANCTION_MOVE | SANCTION_INSERT | SANCTION_ANNOTATE; $readCheck = $object->check_access_read($au); $writeCheck = $object->check_access($SANCTION_WRITE_FOR_CURRENT_OBJECT, $au); $sanctionCheck = $object->check_access(SANCTION_SANCTION, $au); $dropDownValue = 0; if (isset($sanction[$id])) { if ($sanction[$id] == SANCTION_READ) { $dropDownValue = 1; } elseif ($sanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT)) { $dropDownValue = 2; } elseif ($sanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT | SANCTION_SANCTION)) { $dropDownValue = 3; } } $content->setCurrentBlock("AU"); $content->setCurrentBlock("AU_DDSETINGS"); $content->setVariable("AUID", $id); $content->setVariable("AU_ID", $id); $content->setVariable("AUNAME", $name); $content->setVariable("AU_OPTION_VALUE", $dropDownValue); if ($sanctionCheck) { $content->setVariable("AU_RIGHTS", "Lesen, Schreiben und Berechtigen"); } elseif ($writeCheck) { $content->setVariable("AU_RIGHTS", "Lesen und Schreiben"); } elseif ($readCheck) { $content->setVariable("AU_RIGHTS", "Nur Lesen"); } else { $content->setVariable("AU_RIGHTS", ""); } $content->parse("AU_DDSETTINGS"); $content->parse("AU"); } } if (count($additionalMappingEnvironment) == 0) { $content->setVariable("NO_AU_MEMBER_ACQ", "Keine weiteren berechtigten Nutzer"); } else { foreach ($additionalMappingEnvironment as $id => $name) { $readCheck = $object->check_access_read($au); $writeCheck = $object->check_access($SANCTION_WRITE_FOR_CURRENT_OBJECT, $au); $sanctionCheck = $object->check_access(SANCTION_SANCTION, $au); $dropDownValueAcq = 0; if (isset($environmentSanction[$id])) { if ($environmentSanction[$id] == SANCTION_READ) { $dropDownValueAcq = 1; } elseif ($environmentSanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT)) { $dropDownValueAcq = 2; } elseif ($environmentSanction[$id] <= (SANCTION_READ | $SANCTION_WRITE_FOR_CURRENT_OBJECT | SANCTION_SANCTION)) { $dropDownValueAcq = 3; } } $content->setCurrentBlock("AU_ACQ"); $content->setCurrentBlock("AU_DDSETINGS_ACQ"); $content->setVariable("AUID_ACQ", $id); $content->setVariable("AU_ID_ACQ", $id); if ($sanctionCheck) { $content->setVariable("AU_RIGHTS_ACQ", "Lesen, Schreiben und Berechtigen"); } elseif ($writeCheck) { $content->setVariable("AU_RIGHTS_ACQ", "Lesen und Schreiben"); } elseif ($readCheck) { $content->setVariable("AU_RIGHTS_ACQ", "Nur Lesen"); } else { $content->setVariable("AU_RIGHTS_ACQ", ""); } $content->setVariable("AUNAME_ACQ", $name); $content->setVariable("AU_OPTION_VALUE_ACQ", $dropDownValueAcq); $content->parse("AU_DDSETTINGS_ACQ"); $content->parse("AU_ACQ"); } } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $dialog->addWidget($rawHtml); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($dialog); return $ajaxResponseObject; }
if (!$first) { print ' '; } else { $first = false; } if ($site['id'] == $ID) { if (isset($ini) and trim($ini['mostramenu']) == "1") { print '<li id="active"><a id="current" href="#">' . getCleanName2($name, $num_mod, $num_prac, $ini['menu']) . '</a></li>'; } else { print '<li id="active"><a id="current" href="#">' . getCleanName($name, $num_mod, $num_prac) . '</a></li>'; } } else { if (isset($ini) and trim($ini['mostramenu']) == "1") { print '<li><a href="' . getFullLink($link) . $ext . '">' . getCleanName2($name, $num_mod, $num_prac, $ini['menu']) . '</a></li>'; } else { print '<li><a href="' . getFullLink($link) . $ext . '">' . getCleanName($name, $num_mod, $num_prac) . '</a></li>'; } } } print '</ul>'; print '</div>'; print '</div>'; } // afegit jordi : si és l'índex general de cursos, hem saltat el menú. Aquí tamquem l'if corresponent 06/05/2010 } //afegit jordi : si s'ha marcat que no volem menú superior } // if $nomenu != 1 break; } // Fi opció 3
function getCleanName($object, $length = 30) { if (!$object instanceof steam_object) { return ""; } if ($object instanceof steam_user) { $title = $object->get_attribute(USER_FIRSTNAME) . " " . $object->get_attribute(USER_FULLNAME); } else { $user = isUserHome($object); if ($user) { $title = getCleanName($user); } else { if ($object instanceof steam_trashbin) { $title = "Papierkorb"; } else { $desc = $object->get_attribute(OBJ_DESC); if ($desc !== 0 && trim($desc) !== "") { $title = $desc; } else { $title = $object->get_name(); } $title = str_replace("'s workarea", "", stripslashes($title)); $title = str_replace(" workarea", "", stripslashes($title)); $title = str_replace("s workroom.", "", $title); $title = str_replace("s workroom", "", $title); $title = preg_replace("/.*'s bookmarks/", "Lesezeichen", $title); } } } if ($length != -1 && $length < strlen($title)) { $title = substr($title, 0, $length - 1) . "..."; } return $title; }
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; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { if (isset($this->id)) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); if ($object instanceof \steam_exit) { $object = $object->get_exit(); $this->id = $object->get_id(); } } else { $currentUser = $GLOBALS["STEAM"]->get_current_steam_user(); $object = $currentUser->get_workroom(); $this->id = $object->get_id(); } if (!$object instanceof \steam_object) { \ExtensionMaster::getInstance()->send404Error(); die; } $objectModel = \AbstractObjectModel::getObjectModel($object); if ($object && $object instanceof \steam_container) { $count = $object->count_inventory(); if ($count > 150) { die("Es befinden sich {$count} Objekte im diesem Ordner. Das Laden ist nicht möglich."); } $objects = $object->get_inventory(); } else { $objects = array(); } $objectType = getObjectType($object); switch ($objectType) { case "document": header("location: " . PATH_URL . "explorer/ViewDocument/" . $this->id . "/"); die; break; case "forum": header("location: " . PATH_URL . "forum/Index/" . $this->id . "/"); die; break; case "referenceFolder": $exitObject = $object->get_exit(); header("location: " . PATH_URL . "explorer/Index/" . $exitObject->get_id() . "/"); die; break; case "referenceFile": $linkObject = $object->get_link_object(); header("location: " . PATH_URL . "explorer/Index/" . $linkObject->get_id() . "/"); die; break; case "user": header("location: " . PATH_URL . "user/Index/" . $object->get_name() . "/"); die; break; case "group": \ExtensionMaster::getInstance()->send404Error(); die; break; case "trashbin": \ExtensionMaster::getInstance()->send404Error(); die; break; case "portal_old": $rawHtml = new \Widgets\RawHtml(); //$rawHtml->setHtml("Dies ist ein \"altes\" Portal und kann nicht mehr angezeigt werden. Bitte umwandeln."); $frameResponseObject->addWidget($rawHtml); $frameResponseObject->setProblemDescription("Dies ist ein \"altes\" Portal und kann nicht mehr angezeigt werden."); $frameResponseObject->setProblemSolution("Bitte umwandeln."); return $frameResponseObject; break; case "gallery": header("location: " . PATH_URL . "gallery/Index/" . $this->id . "/"); die; break; case "portal": header("location: " . PATH_URL . "portal/Index/" . $this->id . "/"); die; break; case "portalColumn": \ExtensionMaster::getInstance()->send404Error(); die; break; case "portalPortlet": \ExtensionMaster::getInstance()->send404Error(); die; break; case "userHome": //ok break; case "groupWorkroom": //ok break; case "room": //ok break; case "container": //ok break; case "unknown": \ExtensionMaster::getInstance()->send404Error(); die; break; } $title = getCleanName($object); $parent = $object->get_environment(); if ($parent instanceof \steam_container) { //$parentLink = array("name"=>"nach oben", "link"=>PATH_URL . "explorer/Index/" . $parent->get_id() . "/"); $parentLink = ""; } else { $parentLink = ""; } $breadcrumb = new \Widgets\Breadcrumb(); $breadcrumb->setData(array($parentLink, array("name" => "<img src=\"" . PATH_URL . "explorer/asset/icons/mimetype/" . deriveIcon($object) . "\"></img> " . $title . " " . \Explorer\Model\Sanction::getMarkerHtml($object, false)))); $this->getExtension()->addJS(); $this->getExtension()->addCSS(); $actionBar = new \Widgets\ActionBar(); $actionBar->setActions(array(array("name" => "Neu", "ajax" => array("onclick" => array("command" => "newElement", "params" => array("id" => $this->id), "requestType" => "popup"))), 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"))))); //$actionBar->setActions(array(array("name"=>"Neu", "ajax"=>array("onclick"=>array("command"=>"newelement"))), array("name"=>"Eigenschaften", "link"=>PATH_URL."explorer/properties/"), array("name"=>"Rechte", "link"=>PATH_URL."explorer/rights/"))); $presentation = $object->get_attribute("bid:presentation"); $preHtml = ""; if ($presentation === "head") { $objects = $object->get_inventory(); if (count($objects) > 0) { $first = $objects[0]; $mimetype = $first->get_attribute(DOC_MIME_TYPE); if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") { // Image $preHtml = "<div style=\"text-align:center\"><img style=\"max-width:100%\" src=\"" . PATH_URL . "Download/Document/" . $first->get_id() . "/\"></div>"; } else { if ($mimetype == "text/html") { $preHtml = strip_tags($first->get_content(), "<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img><hr><table><tr><th><td><ul><ol><li>"); } else { if (strstr($mimetype, "text")) { $bidDokument = new \BidDocument($first); $preHtml = $bidDokument->get_content(); } } } } } else { if ($presentation === "index" && !(isset($_GET["view"]) && $_GET["view"] === "list")) { $objects = $object->get_inventory(); if (count($objects) > 0) { $first = $objects[0]; $url = \ExtensionMaster::getInstance()->getUrlForObjectId($first->get_id(), "view"); header("location: {$url}"); exit; } } } if ($preHtml !== "") { $preHtml = "<div style=\"border-bottom: 1px solid #ccc; padding-bottom:10px; margin-bottom:10px\">{$preHtml}</div>"; } $environment = new \Widgets\RawHtml(); $environment->setHtml("{$preHtml}<input type=\"hidden\" id=\"environment\" name=\"environment\" value=\"{$this->id}\">"); $loader = new \Widgets\Loader(); $loader->setWrapperId("explorerWrapper"); $loader->setMessage("Lade Dokumente ..."); $loader->setCommand("loadContent"); $loader->setParams(array("id" => $this->id)); $loader->setElementId("explorerWrapper"); $loader->setType("updater"); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml("<div id=\"explorerContent\">" . $breadcrumb->getHtml() . $environment->getHtml() . $loader->getHtml() . "</div>"); $rawHtml->addWidget($breadcrumb); $rawHtml->addWidget($environment); $rawHtml->addWidget($loader); $frameResponseObject->setTitle($title); $frameResponseObject->addWidget($actionBar); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }