Exemplo n.º 1
0
 /**
  * get commands
  * 
  * this method returns an array of all possible commands/permission combinations
  * 
  * example:	
  * $commands = array
  *	(
  *		array("permission" => "read", "cmd" => "view", "lang_var" => "show"),
  *		array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
  *	);
  */
 function _getCommands()
 {
     $commands = array();
     $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "show", "default" => true);
     include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
     if (ilFMSettings::getInstance()->isEnabled()) {
         $commands[] = array('permission' => 'read', 'cmd' => 'fileManagerLaunch', 'lang_var' => 'fm_start', 'enable_anonymous' => false);
     }
     // why here, why read permission? it just needs info_screen_enabled = true in ilObjCategoryListGUI (alex, 30.7.2008)
     // this is not consistent, with all other objects...
     //$commands[] = array("permission" => "read", "cmd" => "showSummary", "lang_var" => "info_short", "enable_anonymous" => "false");
     if (ilObjFolderAccess::hasDownloadAction($_GET["ref_id"])) {
         $commands[] = array("permission" => "read", "cmd" => "downloadFolder", "lang_var" => "download", "enable_anonymous" => "false");
     }
     // BEGIN WebDAV: Mount Webfolder.
     include_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php';
     if (ilDAVActivationChecker::_isActive()) {
         include_once './Services/WebDAV/classes/class.ilDAVUtils.php';
         if (ilDAVUtils::getInstance()->isLocalPasswordInstructionRequired()) {
             $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
         } else {
             $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
         }
     }
     $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
     $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
     return $commands;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
 /**
  * get commands
  * 
  * this method returns an array of all possible commands/permission combinations
  * 
  * example:	
  * $commands = array
  *	(
  *		array("permission" => "read", "cmd" => "view", "lang_var" => "show"),
  *		array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
  *	);
  */
 function _getCommands()
 {
     $commands = array();
     $commands[] = array("permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true);
     // begin-patch fm
     include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
     if (ilFMSettings::getInstance()->isEnabled()) {
         $commands[] = array('permission' => 'read', 'cmd' => 'fileManagerLaunch', 'lang_var' => 'fm_start', 'enable_anonymous' => false);
     }
     // end-patch fm
     // BEGIN WebDAV
     require_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php';
     if (ilDAVActivationChecker::_isActive()) {
         include_once './Services/WebDAV/classes/class.ilDAVUtils.php';
         if (ilDAVUtils::getInstance()->isLocalPasswordInstructionRequired()) {
             $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
         } else {
             $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
         }
     }
     // END WebDAV
     $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
     $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
     return $commands;
 }
 /**
  * get commands
  * 
  * this method returns an array of all possible commands/permission combinations
  * 
  * example:	
  * $commands = array
  *	(
  *		array("permission" => "read", "cmd" => "view", "lang_var" => "show"),
  *		array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
  *	);
  */
 function _getCommands()
 {
     $commands = array();
     $commands[] = array("permission" => "crs_linked", "cmd" => "", "lang_var" => "view", "default" => true);
     include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
     if (ilFMSettings::getInstance()->isEnabled()) {
         $commands[] = array('permission' => 'read', 'cmd' => 'fileManagerLaunch', 'lang_var' => 'fm_start', 'enable_anonymous' => false);
     }
     $commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
     // on waiting list
     $commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
     // regualar users
     $commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "crs_unsubscribe");
     include_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php';
     if (ilDAVActivationChecker::_isActive()) {
         include_once './Services/WebDAV/classes/class.ilDAVUtils.php';
         if (ilDAVUtils::getInstance()->isLocalPasswordInstructionRequired()) {
             $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
         } else {
             $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
         }
     }
     $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
     $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
     return $commands;
 }
Exemplo n.º 5
0
 /**
  * Gets the username from $ilAuth, and converts it into an ILIAS login name.
  */
 private static function getLoginFromAuth()
 {
     global $ilAuth;
     // BEGIN WebDAV: Strip Microsoft Domain Names from logins
     require_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php';
     if (ilDAVActivationChecker::_isActive()) {
         require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
         require_once 'Services/Database/classes/class.ilAuthContainerMDB2.php';
         $login = ilAuthContainerMDB2::toUsernameWithoutDomain($ilAuth->getUsername());
     } else {
         $login = $ilAuth->getUsername();
     }
     return $login;
 }
Exemplo n.º 6
0
 /**
  * Get item properties
  *
  * Overwrite this method to add properties at
  * the bottom of the item html
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 public function getProperties($a_item = '')
 {
     global $objDefinition;
     $props = array();
     // please list alert properties first
     // example (use $lng->txt instead of "Status"/"Offline" strings):
     // $props[] = array("alert" => true, "property" => "Status", "value" => "Offline");
     // $props[] = array("alert" => false, "property" => ..., "value" => ...);
     // ...
     // #8280: WebDav is only supported in repository
     if ($this->context == self::CONTEXT_REPOSITORY) {
         // BEGIN WebDAV Display locking information
         require_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php';
         if (ilDAVActivationChecker::_isActive()) {
             require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
             global $ilias, $lng;
             // Show lock info
             require_once 'Services/WebDAV/classes/class.ilDAVLocks.php';
             $davLocks = new ilDAVLocks();
             if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
                 $locks =& $davLocks->getLocksOnObjectObj($this->obj_id);
                 if (count($locks) > 0) {
                     $lockUser = new ilObjUser($locks[0]['ilias_owner']);
                     $props[] = array("alert" => false, "property" => $lng->txt("in_use_by"), "value" => $lockUser->getLogin(), "link" => "./ilias.php?user="******"alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_special_filename"), 'propertyNameVisible' => false);
             } else {
                 if (preg_match('/^\\./', $this->title)) {
                     $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"), "value" => $lng->txt("filename_hidden_unix_file"), 'propertyNameVisible' => false);
                 } else {
                     if (preg_match('/~$/', $this->title)) {
                         $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"), "value" => $lng->txt("filename_hidden_backup_file"), 'propertyNameVisible' => false);
                     } else {
                         if (preg_match('/[\\/]/', $this->title)) {
                             $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_special_characters"), 'propertyNameVisible' => false);
                         } else {
                             if (preg_match('/[\\\\\\/:*?"<>|]/', $this->title)) {
                                 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_windows_special_characters"), 'propertyNameVisible' => false);
                             } else {
                                 if (preg_match('/\\.$/', $this->title)) {
                                     $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_windows_empty_extension"), 'propertyNameVisible' => false);
                                 } else {
                                     if (preg_match('/^(\\.|\\.\\.)$/', $this->title)) {
                                         $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_special_filename"), 'propertyNameVisible' => false);
                                     } else {
                                         if (preg_match('/#/', $this->title)) {
                                             $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_windows_webdav_issue"), 'propertyNameVisible' => false);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // END WebDAV Display warning for invisible files and files with special characters
         // BEGIN ChangeEvent: display changes.
         require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
         if (ilChangeEvent::_isActive()) {
             global $ilias, $lng, $ilUser;
             if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
                 // Performance improvement: for container objects
                 // we only display 'changed inside' events, for
                 // leaf objects we only display 'object new/changed'
                 // events
                 $isContainer = in_array($this->type, array('cat', 'fold', 'crs', 'grp'));
                 if ($isContainer) {
                     $state = ilChangeEvent::_lookupInsideChangeState($this->obj_id, $ilUser->getId());
                     if ($state > 0) {
                         $props[] = array("alert" => true, "value" => $lng->txt('state_changed_inside'), 'propertyNameVisible' => false);
                     }
                 } elseif ($this->type == "file") {
                     $state = ilChangeEvent::_lookupChangeState($this->obj_id, $ilUser->getId());
                     if ($state > 0) {
                         $props[] = array("alert" => true, "value" => $lng->txt($state == 1 ? 'state_unread' : 'state_changed'), 'propertyNameVisible' => false);
                     }
                 }
             }
         }
         // END ChangeEvent: display changes.
     }
     return $props;
 }