/** * Overwrite this method, if link target is not build by ctrl class * (e.g. "lm_presentation.php", "forum.php"). This is the case * for all links now, but bringing everything to ilCtrl should * be realised in the future. * * @param string $a_cmd command * */ function getCommandLink($a_cmd) { global $ilCtrl; switch ($a_cmd) { // BEGIN WebDAV: Mount Webfolder. case 'mount_webfolder': require_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php'; if (ilDAVActivationChecker::_isActive()) { require_once 'Services/WebDAV/classes/class.ilDAVServer.php'; $davServer = ilDAVServer::getInstance(); // XXX: The following is a very dirty, ugly trick. // To mount URI needs to be put into two attributes: // href and folder. This hack returns both attributes // like this: http://...mount_uri..." folder="http://...folder_uri... $cmd_link = $davServer->getMountURI($this->ref_id) . '" folder="' . $davServer->getFolderURI($this->ref_id); break; } // fall through if plugin is not active // END Mount Webfolder. // fall through if plugin is not active // END Mount Webfolder. case "edit": default: $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id); $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]); break; } return $cmd_link; }
/** * Show webdav password instruction * @return */ protected function showPasswordInstructionObject($a_init = true) { global $tpl, $ilToolbar; if ($a_init) { ilUtil::sendInfo($this->lng->txt('webdav_pwd_instruction')); $this->initFormPasswordInstruction(); } include_once 'Services/WebDAV/classes/class.ilDAVServer.php'; $davServer = ilDAVServer::getInstance(); $ilToolbar->addButton($this->lng->txt('mount_webfolder'), $davServer->getMountURI($this->object->getRefId()), '_blank', '', $davServer->getFolderURI($this->object->getRefId())); $tpl->setContent($this->form->getHTML()); }
/** * Edit settings. */ public function editWebDAVSettings() { global $rbacsystem, $ilErr, $ilTabs; global $tpl, $ilCtrl, $lng, $tree, $settings; $this->tabs_gui->setTabActive('webdav'); if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) { $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING); } require_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; require_once "./Services/Form/classes/class.ilCheckboxInputGUI.php"; require_once "./Services/Form/classes/class.ilRadioGroupInputGUI.php"; require_once "./Services/Form/classes/class.ilRadioOption.php"; require_once "./Services/Form/classes/class.ilTextAreaInputGUI.php"; require_once "./Services/WebDAV/classes/class.ilDAVServer.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("settings")); // Enable webdav $ilDAVServer = ilDAVServer::getInstance(); $isPearAuthHTTPInstalled = @(include_once "Auth/HTTP.php"); $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_webdav"), "enable_webdav"); $cb_prop->setValue('1'); $cb_prop->setChecked($this->object->isWebdavEnabled() && $isPearAuthHTTPInstalled); $cb_prop->setDisabled(!$isPearAuthHTTPInstalled); $cb_prop->setInfo($isPearAuthHTTPInstalled ? sprintf($lng->txt('enable_webdav_info'), $ilDAVServer->getMountURI($tree->getRootId(), 0, null, null, true)) : $lng->txt('webdav_pear_auth_http_needed')); $form->addItem($cb_prop); // Webdav help text if ($isPearAuthHTTPInstalled) { $rgi_prop = new ilRadioGroupInputGUI($lng->txt('webfolder_instructions'), 'custom_webfolder_instructions_choice'); $rgi_prop->addOption(new ilRadioOption($lng->txt('use_default_instructions'), 'default')); $rgi_prop->addOption(new ilRadioOption($lng->txt('use_customized_instructions'), 'custom')); $rgi_prop->setValue($this->object->isCustomWebfolderInstructionsEnabled() ? 'custom' : 'default'); $rgi_prop->setDisabled(!$isPearAuthHTTPInstalled); $form->addItem($rgi_prop); $tai_prop = new ilTextAreaInputGUI('', 'custom_webfolder_instructions'); $tai_prop->setValue($this->object->getCustomWebfolderInstructions()); $tai_prop->setInfo($lng->txt("webfolder_instructions_info")); $tai_prop->setCols(80); $tai_prop->setRows(20); $tai_prop->setDisabled(!$isPearAuthHTTPInstalled); $form->addItem($tai_prop); } // command buttons $form->addCommandButton('saveWebDAVSettings', $lng->txt('save')); $form->addCommandButton('view', $lng->txt('cancel')); $tpl->setContent($form->getHTML()); }
/** * Get command link url. * * Overwrite this method, if link target is not build by ctrl class * (e.g. "forum.php"). This is the case * for all links now, but bringing everything to ilCtrl should * be realised in the future. * * @param string $a_cmd command * * @return string command link url */ function getCommandLink($a_cmd) { if ($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SHOP) { // BEGIN WebDAV Get mount webfolder link. require_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php'; if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive()) { require_once 'Services/WebDAV/classes/class.ilDAVServer.php'; $davServer = ilDAVServer::getInstance(); // XXX: The following is a very dirty, ugly trick. // To mount URI needs to be put into two attributes: // href and folder. This hack returns both attributes // like this: http://...mount_uri..." folder="http://...folder_uri... return $davServer->getMountURI($this->ref_id) . '" folder="' . $davServer->getFolderURI($this->ref_id); } // END WebDAV Get mount webfolder link. $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId()); $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", $a_cmd); $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]); return $cmd_link; /* separate method for this line $cmd_link = $this->ctrl->getLinkTargetByClass($this->gui_class_name, $a_cmd); return $cmd_link; */ } else { $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", ""); $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id); return $this->ctrl->getLinkTargetByClass($this->gui_class_name, $a_cmd); } }