Example #1
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     header("HTTP/1.0 403 Not Found");
     $content = \NotAccess::getInstance()->loadTemplate("403-inline.template.html");
     $content->setVariable("TITLE", "Kein Zugriff");
     $content->setVariable("MESSAGE", "Sie haben keine Zugriff auf dieses Dokument.<br/><br/><a href=\"javascript:history.back();\">Der einzige Weg führt zurück.</a>");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $rawHtml->setCss(\NotAccess::getInstance()->readCss());
     $frameResponseObject->setTitle("Sie haben keinen Zugriff (Fehler 403).");
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #2
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     header("HTTP/1.0 404 Not Found");
     $content = \NotFound::getInstance()->loadTemplate("404-inline.template.html");
     $content->setVariable("TITLE", "Endstation Hbf");
     $content->setVariable("MESSAGE", "Sie haben das Ende erreicht. Hier war noch niemand zuvor. Nicht mal wir Entwickler.<br/><br/><a href=\"javascript:history.back();\">Der einzige Weg führt zurück.</a>");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $rawHtml->setCss(\NotFound::getInstance()->readCss());
     $frameResponseObject->setTitle("Seite nicht gefunden (Fehler 404).");
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #3
0
 public function getHtmlForObjectId(\FrameResponseObject $frameResponseObject)
 {
     $rawHtml = new \Widgets\RawHtml();
     $objectId = $this->id;
     if (isset($this->params[1])) {
         $from = $this->params[1];
     } else {
         $from = 0;
     }
     $steam = $GLOBALS["STEAM"]->get_id();
     $currentRoom = \steam_factory::get_object($steam, $objectId);
     $this->object = $currentRoom;
     $currentRoomPath = $currentRoom->get_path(1);
     $currentRoomData = $currentRoom->get_attributes(array(OBJ_NAME, OBJ_DESC), 1);
     $steamUser = $GLOBALS["STEAM"]->get_current_steam_user();
     $steamUserId = $steamUser->get_id();
     //check if user may write in this folder
     $writeAllowed = $currentRoom->check_access_write($steamUser, 1);
     //get inventory and inventorys attributes if allowed to
     $allowed = $currentRoom->check_access_read($steamUser, 1);
     $result = $GLOBALS["STEAM"]->buffer_flush();
     $writeAllowed = $result[$writeAllowed];
     $allowed = $result[$allowed];
     $currentRoomPath = $result[$currentRoomPath];
     $currentRoomData = $result[$currentRoomData];
     $currentRoomDisplayName = str_replace("'s workarea", "", stripslashes($currentRoomData[OBJ_NAME]));
     if (isset($currentRoomData[OBJ_DESC]) && $currentRoomData[OBJ_DESC] != "") {
         $currentRoomDisplayName = $currentRoomData[OBJ_DESC];
     }
     $currentRoomDisplayName = str_replace("s workroom.", "", $currentRoomDisplayName);
     $numberOfThumbs = 10;
     //forces a stable navigation structure
     $from -= $from % $numberOfThumbs;
     //navigation commands
     $picCount = sizeof($currentRoom->get_inventory());
     $to = $from + ($numberOfThumbs - 1);
     if ($from >= $picCount) {
         $from = $picCount - 1 - ($picCount - 1) % $numberOfThumbs;
     }
     if ($to >= $picCount) {
         $to = $picCount - 1;
     }
     if ($allowed && $currentRoom instanceof \steam_container) {
         if ($from >= 0 && $to >= $numberOfThumbs - 1) {
             $inventory = $currentRoom->get_inventory_paged($from, $to);
         } else {
             $inventory = $currentRoom->get_inventory_paged(0, $numberOfThumbs - 1);
         }
     } else {
         $inventory = array();
     }
     //$contentJS = $this->loadTemplate("overlay.template.js");
     //add css
     //	\Gallery::getInstance()->addCSS();
     //add js
     //	\Gallery::getInstance()->addJS();
     //\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/jquery.min.js");
     //	\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/jquery.colorbox.js");
     //	\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/colorbox.control.js");
     //TODO: overlay.template.js not working - overlay to start gallery missing
     //$this->addJS("overlay.template.js");
     $tpl = \Gallery::getInstance()->loadTemplate("gallery.template.html");
     //$tpl= new \HTML_TEMPLATE_IT();
     //$tpl->loadTemplateFile(\Gallery::getInstance()->getExtensionPath()."ui/html/gallery.template.html");
     $tpl->setVariable("IMAGEURL", \Gallery::getInstance()->getAssetUrl() . "image/round_green_play_button_4044.jpg");
     $tpl->setVariable("FROM", max($from + 1, 1));
     $tpl->setVariable("TO", min($to + 1, $picCount));
     $tpl->setVariable("PIC_COUNT", $picCount);
     $pagemin = $from - $numberOfThumbs;
     $pagemin = max($pagemin, 0);
     //Navigation
     $backlink = "<a href=\"" . PATH_URL . "gallery/index/" . $objectId . "/" . $pagemin . "\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_prev_on.gif\"></a>";
     if ($from == 0) {
         $backlink = "<a href=\"\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zur&uuml;ck\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_prev_off.gif\"></a>";
         $tpl->setVariable("BACKLINK", $backlink);
     } else {
         $tpl->setVariable("BACKLINK", $backlink);
     }
     $pagemax = min($to, $picCount - 1);
     $forwardlink = "<a href=\"" . PATH_URL . "gallery/index/" . $objectId . "/" . ($pagemax + 1) . "\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_next_on.gif\"></a>";
     if ($to >= $picCount - 1) {
         $forwardlink = "<a href=\"\" class=\"pagingright\"><img alt=\"Vor\" title=\"Vor\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_next_off.gif\">";
         $tpl->setVariable("FORWARDLINK", $forwardlink);
     } else {
         $tpl->setVariable("FORWARDLINK", $forwardlink);
     }
     //Rights
     foreach ($inventory as $item) {
         $tnr[$item->get_id()] = array();
         $tnr[$item->get_id()]["creator"] = $item->get_creator(1);
         $tnr[$item->get_id()]["item_write_access"] = $item->check_access_write($GLOBALS["STEAM"]->get_current_steam_user(), 1);
         $tnr[$item->get_id()]["item_read_access"] = $item->check_access_read($GLOBALS["STEAM"]->get_current_steam_user(), 1);
     }
     $result = $GLOBALS["STEAM"]->buffer_flush();
     $creators = array();
     $itemWriteAccess = array();
     $itemReadAccess = array();
     foreach ($inventory as $item) {
         $creators[$item->get_id()] = $result[$tnr[$item->get_id()]["creator"]];
         $itemWriteAccess[$item->get_id()] = $result[$tnr[$item->get_id()]["item_write_access"]];
         $itemReadAccess[$item->get_id()] = $result[$tnr[$item->get_id()]["item_read_access"]];
     }
     \steam_factory::load_attributes($steam, $inventory, array(OBJ_NAME, OBJ_DESC, OBJ_KEYWORDS, DOC_MIME_TYPE, "bid:description"));
     // If you want to use further Methods of caching e.g. PHP PEARs Cache_Lite
     // insert caching mechanisms in here...
     // below this, the steam connector is no longer used...
     $undisplayedPicCount = 0;
     //GET RIGHTS
     $sanction = $currentRoom->get_sanction();
     $attrib = $this->object->get_attributes(array(OBJ_NAME, OBJ_DESC, "bid:doctype"));
     $bid_doctype = isset($attrib["bid:doctype"]) ? $attrib["bid:doctype"] : "";
     $docTypeQuestionary = strcmp($attrib["bid:doctype"], "questionary") == 0;
     $docTypeMessageBoard = $this->object instanceof \steam_messageboard;
     // in questionaries the write right is limited to insert rights only
     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;
         }
     }
     $sanctionFlag = false;
     if (isset($sanction[$steamUserId])) {
         if ($sanction[$steamUserId] >= $SANCTION_WRITE_FOR_CURRENT_OBJECT) {
             $sanctionFlag = true;
         }
     }
     $env = $currentRoom->get_environment();
     if ($env instanceof \steam_room) {
         $envSanction = $env->get_sanction();
         if (isset($envSanction[$steamUserId])) {
             if ($envSanction[$steamUserId] >= $SANCTION_WRITE_FOR_CURRENT_OBJECT) {
                 $sanctionFlag = true;
             }
         }
     }
     $currentRoomCreater = $currentRoom->get_creator();
     $currentRoomCreaterId = $currentRoomCreater->get_id();
     if ($currentRoomCreaterId == $steamUserId) {
         $sanctionFlag = true;
     }
     for ($i = 0; $i < count($inventory); $i++) {
         $tpl->setCurrentBlock("ITEM");
         $item = $inventory[$i];
         if ($sanctionFlag) {
             $tpl->setVariable("REMOVE_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/trash.png");
             $tpl->setVariable("ITEM_PATH_URL2", PATH_URL);
             $tpl->setVariable("ITEM_THUMBNAIL_ID2", $item->get_id());
         }
         $tpl->setVariable("FULLSCREEN_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/image_fullscreen.png");
         $tpl->setVariable("SAVE_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/image_save.png");
         $tpl->setVariable("EDIT_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/image_properties.gif");
         $popupMenu = new \Widgets\PopupMenu();
         $popupMenu->setData($item);
         $popupMenu->setElementId("gallery-overlay");
         $tpl->setVariable("POPUP_MENU", $popupMenu->getHtml());
         $rawHtml->addWidget($popupMenu);
         // Skip image if rights are insufficient
         if (!$itemReadAccess[$item->get_id()]) {
             $undisplayedPicCount++;
             continue;
         }
         $itemName = $item->get_attribute(OBJ_NAME);
         $itemDescription = $item->get_attribute(OBJ_DESC);
         $itemKeywords = implode(", ", $item->get_attribute(OBJ_KEYWORDS));
         $itemMimetype = $item->get_attribute(DOC_MIME_TYPE);
         //set Item
         $tpl->setVariable("OBJECT_ID", $item->get_id());
         $tpl->setVariable("OBJECT_NAME", $itemName);
         $tpl->setVariable("OBJECT_DESC", $itemDescription);
         $tpl->setVariable("OBJECT_KEYWORDS", $itemKeywords);
         // render a steam_document
         if ($item instanceof \steam_document) {
             //care for documents not to be displayed in the browser
             if ($itemMimetype === "image/gif" || $itemMimetype === "image/jpg" || $itemMimetype === "image/jpeg" || $itemMimetype === "image/png") {
                 $tpl->setVariable("ITEM_PATH_URL", PATH_URL);
                 $tpl->setVariable("ITEM_THUMBNAIL_ID", $item->get_id());
                 $tpl->setVariable("ITEM_BIGTHUMB_ID", $item->get_id());
                 if ($i - $undisplayedPicCount == 0) {
                     $tpl->setVariable("FIRST_GALLERY_ID", $item->get_id());
                 }
                 $tpl->parse("ITEM");
             }
         }
     }
     //set invisible items for colorbox
     for ($i = 0; $i < count($inventory); $i++) {
         $tpl->setCurrentBlock("INV");
         $item = $inventory[$i];
         // Skip image if rights are insufficient
         if (!$itemReadAccess[$item->get_id()]) {
             $undisplayedPicCount++;
             continue;
         }
         $itemName = $item->get_attribute(OBJ_NAME);
         $itemDescription = $item->get_attribute(OBJ_DESC);
         $itemKeywords = implode(", ", $item->get_attribute(OBJ_KEYWORDS));
         $itemMimetype = $item->get_attribute(DOC_MIME_TYPE);
         // set display name
         $objectDisplayName = $itemName;
         if ($itemDescription === 0) {
             $itemDescription = "";
         }
         $tpl->setVariable("OBJECT_NAME", $objectDisplayName);
         $tpl->setVariable("OBJECT_DESC", $itemDescription);
         // render a steam_document
         if ($item instanceof \steam_document) {
             //care for documents not to be displayed in the browser
             if ($itemMimetype === "image/gif" || $itemMimetype === "image/jpg" || $itemMimetype === "image/jpeg" || $itemMimetype === "image/png") {
                 $tpl->setVariable("ITEM_PATH_URL", PATH_URL);
                 $tpl->setVariable("ITEM_THUMBNAIL_ID", $item->get_id());
                 $tpl->parse("INV");
             }
         }
     }
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Neues Bild", "ajax" => array("onclick" => array("command" => "Addpicture", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "Properties", "params" => array("id" => $this->id), "requestType" => "popup", "namespace" => "explorer"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup", "namespace" => "explorer")))));
     $css = self::auslesen(PATH_URL . "gallery/css/style.css");
     $js = self::auslesen(PATH_URL . "gallery/js/code.js");
     $rawHtml->setCss($css);
     $rawHtml->setJs($js);
     $rawHtml->setHtml($tpl->get());
     if ($sanctionFlag) {
         $frameResponseObject->addWidget($actionBar);
     }
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }