Esempio n. 1
0
 public function getCommandByObjectId(IdRequestObject $idRequestObject)
 {
     $object = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $idRequestObject->getId());
     $type = getObjectType($object);
     if (array_search($type, array("referenceFolder", "userHome", "groupWorkroom", "room", "container")) !== false) {
         return new \Explorer\Commands\Index();
     }
 }
Esempio n. 2
0
 public function processData(\IRequestObject $requestObject)
 {
     if ($requestObject instanceof \UrlRequestObject) {
         $this->params = $requestObject->getParams();
         isset($this->params[0]) ? $this->id = $this->params[0] : "";
     } else {
         if ($requestObject instanceof \IdRequestObject) {
             $this->id = $requestObject->getId();
         }
     }
     $steam = $GLOBALS["STEAM"];
     //get singleton and portlet path
     $portalInstance = \Portal::getInstance();
     $portalPath = $portalInstance->getExtensionPath();
     //template
     $templateFileName = $portalPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($templateFileName);
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
     $object = $currentUser->get_workroom();
     $objectId = $this->id;
     //get the portal object
     $this->portalObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $type = getObjectType($this->portalObject);
     if (!($type === "portal")) {
         \ExtensionMaster::getInstance()->send404Error();
         die;
     }
     \Portal::getInstance()->setPortalObject($this->portalObject);
     //get the content of the portal object
     $portalColumns = $this->portalObject->get_inventory();
     $htmlBody = "";
     $extensionMaster = \ExtensionMaster::getInstance();
     $count = 0;
     $htmlCollectorColRow[][] = array();
     $col = 0;
     $row = 0;
     $this->rawHtmlWidget = new \Widgets\RawHtml();
     foreach ($portalColumns as $columnObject) {
         $columnObjectId = $columnObject->get_id();
         $widgets = $extensionMaster->getWidgetsByObjectId($columnObjectId, "view");
         $this->rawHtmlWidget->addWidgets($widgets);
         $data = \Widgets\Widget::getData($widgets);
         $htmlBody .= $data["html"];
         $count++;
     }
     $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
     if (isset($this->portalObject) && $this->portalObject->check_access_write($currentUser)) {
         $htmlBody .= "<script>if (readCookie(\"portalEditMode\") === \"{$objectId}\") {portalLockButton({$objectId})}</script>";
     }
     $tmpl->setVariable("BODY", $htmlBody);
     $htmlBodyTemplated = $tmpl->get();
     $this->rawHtmlWidget->setHtml($htmlBodyTemplated);
 }
Esempio n. 3
0
 public function processData(\IRequestObject $requestObject)
 {
     $this->params = $requestObject->getParams();
     $this->id = $this->params["id"];
     $this->user = $GLOBALS["STEAM"]->get_current_steam_user();
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     if (getObjectType($object) === "portal") {
         $portalInstance = \PortletTopic::getInstance();
         $portalObjectId = $object->get_id();
         \ExtensionMaster::getInstance()->callCommand("PortalCopy", "Portal", array("id" => $portalObjectId));
     } else {
         if ($object instanceof \steam_link) {
             $copy = \steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $object->get_link_object());
         } else {
             $copy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $object);
         }
         $copy->move($this->user);
     }
 }
Esempio n. 4
0
 public function getCurrentObject(UrlRequestObject $urlRequestObject)
 {
     $params = $urlRequestObject->getParams();
     $id = $params[0];
     if (isset($id)) {
         if (!isset($GLOBALS["STEAM"])) {
             return null;
         }
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id);
         if (!$object instanceof steam_object) {
             return null;
         }
         $type = getObjectType($object);
         if (array_search($type, array("gallery")) !== false) {
             return $object;
         }
     }
     return null;
 }
Esempio n. 5
0
 private function getDocumentsRecursive($object)
 {
     $result = array();
     $type = getObjectType($object);
     if ($type === "container" || $type === "room" || $type === "userHome") {
         $result = $object->get_inventory();
         foreach ($result as $key => $doc) {
             $typeDoc = getObjectType($doc);
             if (!($typeDoc === "document" || $typeDoc === "forum" || $typeDoc === "portal" || $typeDoc === "gallery")) {
                 unset($result[$key]);
             }
         }
         $containers = $object->get_inventory(CLASS_CONTAINER | CLASS_ROOM);
         foreach ($containers as $container) {
             $result = array_merge($result, $this->getDocumentsRecursive($container));
         }
     }
     return $result;
 }
Esempio n. 6
0
 private function updateChronic($steamObject)
 {
     $type = getObjectType($steamObject);
     if (array_search($type, array("document", "forum", "referenceFolder", "user", "trashbin", "gallery", "portal", "userHome", "groupWorkroom", "room", "container")) !== false) {
         $user = lms_steam::get_current_user();
         $chronic = $this->loadChronic();
         $pos = array_search($steamObject, $chronic);
         if ($pos === false) {
             $chronic[] = $steamObject;
         } else {
             unset($chronic[$pos]);
             $chronic = array_values($chronic);
             $chronic[] = $steamObject;
         }
         if (count($chronic) > CHRONIC_LENGTH) {
             $chronic = array_slice($chronic, count($chronic) - CHRONIC_LENGTH, CHRONIC_LENGTH);
         }
         $user->set_attribute("USER_CHRONIC", $chronic);
     }
 }
Esempio n. 7
0
 public function getCurrentObject(UrlRequestObject $urlRequestObject)
 {
     $params = $urlRequestObject->getParams();
     $id = $params[0];
     if (isset($id)) {
         if (!isset($GLOBALS["STEAM"])) {
             return null;
         }
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id);
         if (!$object instanceof steam_object) {
             return null;
         }
         $type = getObjectType($object);
         if (array_search($type, array("referenceFolder", "container", "userHome", "groupWorkroom", "room", "document")) !== false) {
             return $object;
         }
     } else {
         $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
         $object = $currentUser->get_workroom();
         return $object;
     }
     return null;
 }
Esempio n. 8
0
function updateObjectAttributes($object_id)
{
    global $dbxlink;
    $type_id = getObjectType($object_id);
    $oldvalues = getAttrValues($object_id);
    $num_attrs = isset($_REQUEST['num_attrs']) ? $_REQUEST['num_attrs'] : 0;
    for ($i = 0; $i < $num_attrs; $i++) {
        genericAssertion("{$i}_attr_id", 'uint');
        $attr_id = $_REQUEST["{$i}_attr_id"];
        if (!array_key_exists($attr_id, $oldvalues)) {
            throw new InvalidRequestArgException('attr_id', $attr_id, 'malformed request');
        }
        $value = $_REQUEST["{$i}_value"];
        // If the object is a rack, skip certain attributes as they are handled elsewhere
        // (height, sort_order)
        if ($type_id == 1560 and ($attr_id == 27 or $attr_id == 29)) {
            continue;
        }
        // Delete attribute and move on, when the field is empty or if the field
        // type is a dictionary and it is the "--NOT SET--" value of 0.
        if ($value == '' || $oldvalues[$attr_id]['type'] == 'dict' && $value == 0) {
            if (permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $attr_id)))) {
                commitUpdateAttrValue($object_id, $attr_id);
            } else {
                showError('Permission denied, "' . $oldvalues[$attr_id]['name'] . '" left unchanged');
            }
            continue;
        }
        // The value could be uint/float, but we don't know ATM. Let SQL
        // server check this and complain.
        if ('date' == $oldvalues[$attr_id]['type']) {
            $value = assertDateArg("{$i}_value");
        } else {
            assertStringArg("{$i}_value");
        }
        switch ($oldvalues[$attr_id]['type']) {
            case 'uint':
            case 'float':
            case 'string':
            case 'date':
                $oldvalue = $oldvalues[$attr_id]['value'];
                break;
            case 'dict':
                $oldvalue = $oldvalues[$attr_id]['key'];
                break;
            default:
        }
        if ($value === $oldvalue) {
            // ('' == 0), but ('' !== 0)
            continue;
        }
        if (permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $attr_id)))) {
            commitUpdateAttrValue($object_id, $attr_id, $value);
        } else {
            showError('Permission denied, "' . $oldvalues[$attr_id]['name'] . '" left unchanged');
        }
    }
}
Esempio n. 9
0
function commitUpdateAttrValue($object_id, $attr_id, $value = '')
{
    global $object_attribute_cache;
    if (isset($object_attribute_cache[$object_id])) {
        unset($object_attribute_cache[$object_id]);
    }
    $result = usePreparedSelectBlade('select type as attr_type from Attribute where id = ?', array($attr_id));
    $row = $result->fetch(PDO::FETCH_NUM);
    $attr_type = $row[0];
    unset($result);
    switch ($attr_type) {
        case 'uint':
        case 'float':
        case 'string':
            $column = $attr_type . '_value';
            break;
        case 'dict':
        case 'date':
            $column = 'uint_value';
            break;
        default:
            throw new InvalidArgException('$attr_type', $attr_type, 'Unknown attribute type found in object #' . $object_id . ', attribute #' . $attr_id);
    }
    usePreparedDeleteBlade('AttributeValue', array('object_id' => $object_id, 'attr_id' => $attr_id));
    if ($value == '') {
        return;
    }
    $type_id = getObjectType($object_id);
    usePreparedInsertBlade('AttributeValue', array($column => $value, 'object_id' => $object_id, 'object_tid' => $type_id, 'attr_id' => $attr_id));
}
Esempio n. 10
0
function getObjectReadableSize($object)
{
    $type = getObjectType($object);
    try {
        if ($type == "document") {
            $html = getReadableSize($object->get_content_size());
        } else {
            if ($type == "container" || $type == "room" || $type == "groupWorkroom" || $type == "userHome") {
                $html = count($object->get_inventory()) . " Objekte";
            } else {
                if ($type == "portal") {
                    $html = count($object->get_inventory()) . " Spalten";
                } else {
                    if ($type == "gallery") {
                        $html = count($object->get_inventory()) . " Bilder";
                    } else {
                        if ($type == "forum") {
                            $html = count($object->get_annotations()) . " Themen";
                        } else {
                            if ($type == "referenceFile") {
                                $linkObject = $object->get_link_object();
                                $html = getObjectReadableSize($linkObject);
                            } else {
                                if ($type == "referenceFolder") {
                                    $exitObject = $object->get_exit();
                                    $html = getObjectReadableSize($exitObject);
                                } else {
                                    $html = "";
                                }
                            }
                        }
                    }
                }
            }
        }
    } catch (steam_exception $e) {
        $html = "keine Berechtigung";
    }
    return $html;
}
Esempio n. 11
0
 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;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 12
0
 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;
 }
Esempio n. 13
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_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;
 }