/**
  * @return bool
  * @throws ilCloudException
  */
 public function executeCommand()
 {
     global $ilCtrl, $ilTabs, $ilNavigationHistory, $lng;
     // Navigation History
     $link = $ilCtrl->getLinkTarget($this, "render");
     try {
         ilCloudConnector::getActiveServices();
     } catch (Exception $e) {
         ilUtil::sendFailure($lng->txt("cld_no_service_active"), true);
         ilObjectGUI::redirectToRefId($this->parent_id);
     }
     if ($this->object != NULL) {
         $ilNavigationHistory->addItem($this->object->getRefId(), $link, "cld");
         try {
             ilCloudConnector::checkServiceActive($this->object->getServiceName());
         } catch (Exception $e) {
             ilUtil::sendFailure($lng->txt("cld_plugin_not_active"), true);
             ilObjectGUI::redirectToRefId($this->parent_id);
         }
         if ($this->object->getAuthComplete() == false && !$_GET["authMode"]) {
             if ($this->checkPermissionBool("write")) {
                 $this->serviceAuth($this->object);
             } else {
                 ilUtil::sendFailure($lng->txt("cld_auth_failed"), true);
                 ilObjectGUI::redirectToRefId($this->parent_id);
             }
         }
         $this->plugin_service = ilCloudConnector::getServiceClass($this->object->getServiceName(), $this->object->getId(), false);
     }
     $next_class = $ilCtrl->getNextClass($this);
     $cmd = $ilCtrl->getCmd($this);
     switch ($cmd) {
         case "editSettings":
             $next_class = "ilcloudpluginsettingsgui";
             break;
         case "afterServiceAuth":
             $this->checkPermission("write");
             $this->{$cmd}();
             return;
         case "render":
             $this->addHeaderAction();
             break;
     }
     switch ($next_class) {
         case "ilinfoscreengui":
             $this->prepareOutput();
             $this->infoScreenForward();
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case "ilpermissiongui":
             $this->prepareOutput();
             $ilTabs->activateTab("id_permissions");
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui = new ilPermissionGUI($this);
             $this->ctrl->forwardCommand($perm_gui);
             break;
         case "ilcloudpluginuploadgui":
             if ($this->checkPermissionBool("upload")) {
                 $upload_gui = ilCloudConnector::getUploadGUIClass($this->plugin_service);
                 $this->ctrl->forwardCommand($upload_gui);
             }
             break;
         case "ilcloudplugincreatefoldergui":
             if ($this->checkPermissionBool("folders_create")) {
                 $folder_gui = ilCloudConnector::getCreateFolderGUIClass($this->plugin_service);
                 $this->ctrl->forwardCommand($folder_gui);
             }
             break;
         case "ilcloudplugindeletegui":
             if ($this->checkPermissionBool("delete_files") || $this->checkPermissionBool("delete_folders")) {
                 $delete_gui = ilCloudConnector::getDeleteGUIClass($this->plugin_service);
                 $this->ctrl->forwardCommand($delete_gui);
             }
             break;
         case "ilcloudpluginsettingsgui":
             $this->prepareOutput();
             if ($this->checkPermissionBool("write")) {
                 $settings_gui = ilCloudConnector::getSettingsGUIClass($this->plugin_service);
                 $settings_gui->setCloudObject($this->object);
                 $this->ctrl->forwardCommand($settings_gui);
             }
             break;
         case "ilcloudpluginactionlistgui":
             $action_list_gui = ilCloudConnector::getActionListGUIClass($this->plugin_service);
             $this->ctrl->forwardCommand($action_list_gui);
             break;
         case "ilcloudpluginitemcreationlistgui":
             $item_creation_gui = ilCloudConnector::getItemCreationListGUIClass($this->plugin_service);
             $this->ctrl->forwardCommand($item_creation_gui);
             break;
         case "ilcloudpluginfiletreegui":
             $file_tree_gui = ilCloudConnector::getFileTreeGUIClass($this->plugin_service, ilCloudFileTree::getFileTreeFromSession());
             $this->ctrl->forwardCommand($file_tree_gui);
             break;
         case "ilcloudpluginheaderactiongui":
             $header_action_gui = ilCloudConnector::getHeaderActionGUIClass($this->plugin_service);
             $this->ctrl->forwardCommand($header_action_gui);
             break;
         case "ilcloudplugininitgui":
             $init_gui = ilCloudConnector::getInitGUIClass($this->plugin_service);
             $this->ctrl->forwardCommand($init_gui);
             break;
         default:
             return parent::executeCommand();
     }
     return true;
 }
 function addToolbar($root_node)
 {
     global $lng, $ilToolbar, $tpl;
     $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService());
     $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders());
     if ($list_gui_html) {
         // toolbar
         $ov_id = "il_add_new_cld_item_v";
         $ov_trigger_id = $ov_id . "_tr";
         $toolbar_locator = new ilLocatorGUI();
         $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node));
         $ilToolbar->setId('xcld_toolbar');
         $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>");
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($lng->txt("cld_add_new_item"), "#", "", "", "", $ov_trigger_id, 'submit emphsubmit');
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $ov = new ilOverlayGUI($ov_id);
         $ov->add();
         $ov->addTrigger($ov_trigger_id, "click", $ov_trigger_id, false, "tl", "tr");
         $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" class="ilOverlay ilNoDisplay">' . $list_gui_html . '</div>');
     }
 }
 /**
  * @param $root_node
  */
 public function addToolbar($root_node)
 {
     global $lng, $ilToolbar, $ilLog;
     $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService());
     $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders());
     if ($list_gui_html) {
         //toolbar
         $toolbar_locator = new ilLocatorGUI();
         $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node));
         $ilToolbar->setId('xcld_toolbar');
         $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>");
         $ilToolbar->addSeparator();
         include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
         $adv = new ilAdvancedSelectionListGUI();
         $adv->setListTitle($lng->txt("cld_add_new_item"));
         $ilCloudGroupedListGUI = $create_list_gui->getGroupedListItems($this->getPermUploadItems(), $this->getPermCreateFolders());
         if ($ilCloudGroupedListGUI->hasItems()) {
             $adv->setGroupedList($ilCloudGroupedListGUI);
         }
         $adv->setStyle(ilAdvancedSelectionListGUI::STYLE_EMPH);
         $ilToolbar->addText($adv->getHTML());
     }
 }