public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $count = count($this->selection); if (!in_array($this->id, $this->selection) || in_array($this->id, $this->selection) && $count == 1) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $env = $object->get_environment(); $inventory = $env->get_inventory(); foreach ($inventory as $key => $element) { if ($element->get_id() == $this->id) { $index = $key; } } $popupMenu = new \Widgets\PopupMenu(); if ($object instanceof \steam_trashbin) { $items = array(array("name" => "Papierkorb leeren", "command" => "EmptyTrashbin", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}")); } else { if ($env instanceof \steam_trashbin) { $items = array(array("name" => "Wiederherstellen", "command" => "Restore", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'env':document.getElementById('environment').value}")); } else { $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png"; $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png"; $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png"; $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png"; $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png"; $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png"; $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png"; $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png"; $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png"; $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png"; $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png"; $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png"; $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png"; $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png"; $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png"; $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png"; $items = array(array("name" => "Kopieren<img src=\"{$copyIcon}\">", "command" => "Copy", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Ausschneiden<img src=\"{$cutIcon}\">", "command" => "Cut", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Referenzieren<img src=\"{$referIcon}\">", "command" => "Reference", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Löschen<img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("raw" => " <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'transparent'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/transparent.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'red'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/red.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'orange'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/orange.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'yellow'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/yellow.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'green'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/green.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'blue'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/blue.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'purple'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/purple.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'grey'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/grey.png\"></a>"))), array("name" => "Lesezeichen<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(!\Bookmarks\Model\Bookmark::isBookmark($this->id) ? array("name" => "Lesezeichen anlegen<img src=\"{$bookmarkIcon}\">", "command" => "AddBookmark", "namespace" => "bookmarks", "elementId" => "{$this->id}_BookmarkMarkerWrapper", "params" => "{'id':'{$this->id}'}") : "")), array("name" => "Umsortieren<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array($index != 0 ? array("name" => "Eins nach oben<img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'up'}") : "", $index < count($inventory) - 1 ? array("name" => "Eins nach unten<img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'down'}") : "", $index != 0 ? array("name" => "Ganz nach oben<img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'top'}") : "", $index < count($inventory) - 1 ? array("name" => "Ganz nach unten<img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'bottom'}") : "")), array("name" => "SEPARATOR"), array("raw" => "<a href=\"#\" onclick=\"event.stopPropagation(); removeAllDirectEditors();if (!jQuery('#{$this->id}_1').hasClass('directEditor')) { jQuery('#{$this->id}_1').addClass('directEditor').html(''); var obj = new Object; obj.id = '{$this->id}'; sendRequest('GetDirectEditor', obj, '{$this->id}_1', 'updater'); } jQuery('.popupmenuwapper').parent().html('');jQuery('.open').removeClass('open'); return false;\">Umbenennen<img src=\"{$renameIcon}\"></a>"), $object instanceof \steam_container && $object->get_attribute("bid:presentation") === "index" ? array("name" => "Listenansicht<img src=\"{$blankIcon}\">", "link" => PATH_URL . "Explorer/Index/" . $this->id . "/?view=list") : "", $object instanceof \steam_document && strstr($object->get_attribute(DOC_MIME_TYPE), "text") ? array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/") : "", array("name" => "Eigenschaften...<img src=\"{$propertiesIcon}\">", "command" => "Properties", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"), array("name" => "Rechte...<img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup")); } } $popupMenu->setItems($items); $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px"); $popupMenu->setWidth("170px"); } else { $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png"; $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png"; $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png"; $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png"; $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png"; $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png"; $popupMenu = new \Widgets\PopupMenu(); $items = array(array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Copy', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Kopiere Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte kopieren<img src=\"{$copyIcon}\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Cut', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Schneide Objekte aus ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte ausschneiden<img src=\"{$cutIcon}\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Reference', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Referenziere Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte referenzieren<img src=\"{$referIcon}\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte löschen<img src=\"{$trashIcon}\"></a>"), array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("raw" => " <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'transparent'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/transparent.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'red'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/red.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'orange'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/orange.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'yellow'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/yellow.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'green'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/green.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'blue'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/blue.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'purple'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/purple.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t<a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'grey'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0, getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/grey.png\"></a>")))); $popupMenu->setItems($items); $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px"); $popupMenu->setWidth("180px"); } $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($popupMenu); return $ajaxResponseObject; }
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 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; } } } } } } } }