From: dongsheng Date: Tue, 2 Sep 2008 04:05:11 +0000 (+0000) Subject: MDL-13766 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d31af46ae28ee0a7c0e150886395068c136be533;p=moodle.git MDL-13766 1. Remove search link in upload plugin 2. add get_name function --- diff --git a/lang/en_utf8/repository_upload.php b/lang/en_utf8/repository_upload.php new file mode 100644 index 0000000000..2c8456d956 --- /dev/null +++ b/lang/en_utf8/repository_upload.php @@ -0,0 +1,4 @@ + $v) { $this->options[$n] = $v; } + $this->name = $this->get_name(); } /** @@ -188,6 +189,22 @@ abstract class repository { return $str; } } + public function get_name(){ + global $DB; + // We always verify instance id from database, + // so we always know repository name before init + // a repository, so we don't enquery repository + // name from database again here. + if (isset($this->options['name'])) { + return $this->options['name']; + } else { + if ( $repo = $DB->get_record('repository_instances', array('id'=>$this->id)) ) { + return $repo->name; + } else { + return ''; + } + } + } /** * Provide repository instance information for Ajax @@ -198,7 +215,7 @@ abstract class repository { global $CFG; $repo = new stdclass; $repo->id = $this->id; - $repo->name = $this->options['name']; + $repo->name = $this->get_name(); $repo->type = $this->options['type']; $repo->icon = $CFG->wwwroot.'/repository/'.$repo->type.'/icon.png'; return $repo; @@ -386,6 +403,7 @@ abstract class repository { * 'dynload' => (bool) use dynamic loading, * 'manage' => (string) link to file manager, * 'nologin' => (bool) requires login, + * 'nosearch' => (bool) no search link, * 'upload' => array( // upload manager * 'name' => (string) label of the form element, * 'id' => (string) id of the form element @@ -1300,7 +1318,9 @@ _client.callback = { mgr.id = 'repo-mgr-$suffix-'+_client.repositoryid; mgr.target = "_blank"; } - oDiv.appendChild(search); + if(_client.ds.nosearch != true){ + oDiv.appendChild(search); + } if(mgr != null) { oDiv.appendChild(mgr); } diff --git a/repository/local/repository.class.php b/repository/local/repository.class.php index 8164ca9b44..58891e3ad7 100755 --- a/repository/local/repository.class.php +++ b/repository/local/repository.class.php @@ -176,5 +176,8 @@ class repository_local extends repository { // empty function is necessary to make it possible to edit the name of the repository public function admin_config_form(&$mform) { } + public function get_name(){ + return get_string('repositoryname', 'repository_local');; + } } ?> diff --git a/repository/upload/repository.class.php b/repository/upload/repository.class.php index c09f3b2c9a..ae61b90527 100755 --- a/repository/upload/repository.class.php +++ b/repository/upload/repository.class.php @@ -28,7 +28,8 @@ class repository_upload extends repository { return $this->info; }else{ $ret = array(); - $ret['nologin'] = true; + $ret['nologin'] = true; + $ret['nosearch'] = true; // define upload form in file picker $ret['upload'] = array('label'=>get_string('attachment', 'repository'), 'id'=>'repo-form'); $ret['manage'] = $CFG->wwwroot .'/files/index.php'; // temporary @@ -56,5 +57,8 @@ class repository_upload extends repository { // empty function is necessary to make it possible to edit the name of the repository public function admin_config_form(&$mform) { } + public function get_name(){ + return get_string('repositoryname', 'repository_upload');; + } } ?>