MDL-15348 Add changes for filepicker to support the display of existing files

This commit is contained in:
moodler
2008-09-08 05:41:45 +00:00
parent 455860cecb
commit 757f30a20c
2 changed files with 13 additions and 11 deletions
+12 -10
View File
@@ -5,9 +5,9 @@ require_once("HTML/QuickForm/button.php");
require_once(dirname(dirname(dirname(__FILE__))) . '/repository/lib.php');
/**
* HTML class for a button type element
* HTML class for a single filepicker element (based on button)
*
* @author Dongsheng Cai <[email protected]oodle.org>
* @author Moodle.com
* @version 1.0
* @since Moodle 2.0
* @access public
@@ -52,21 +52,24 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_button {
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
$currentvalue = $this->getValue();
$strsaved = get_string('filesaved', 'repository');
if (empty($COURSE->context)) {
$ctx = get_context_instance(CONTEXT_SYSTEM);
$context = get_context_instance(CONTEXT_SYSTEM);
} else {
$ctx = $COURSE->context;
$context = $COURSE->context;
}
$ret = repository_get_client($ctx);
$repository_info = repository_get_client($context);
$suffix = $repository_info['suffix'];
$suffix = $ret['suffix'];
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
$str = $this->_getTabs();
$str .= '<input type="hidden" name="'.$elname.'" id="'.$id.'_'.$suffix.'" value="" />';
$str .= '<input type="hidden" value="'.$currentvalue.'" name="'.$this->_attributes['name'].'" id="'.$this->_attributes['id'].'_'.$suffix.'" />';
$id = $this->_attributes['id'];
$str .= <<<EOD
<script type="text/javascript">
function updatefile_$suffix(str){
@@ -82,8 +85,7 @@ function callpicker_$suffix(){
}
</script>
EOD;
// $this->_getAttrString($this->_attributes);
$str .= '<input value ="'.get_string('openpicker', 'repository').'" type="button" onclick=\'callpicker_'.$suffix.'()\' />'.'<span id="repo_info_'.$suffix.'" style="color:green"></span>'.$ret['css'].$ret['js'];
$str .= '<input value ="'.get_string('openpicker', 'repository').'" type="button" onclick=\'callpicker_'.$suffix.'()\' />'.'<span id="repo_info_'.$suffix.'" class="notifysuccess">'.$currentvalue.'</span>'.$repository_info['css'].$repository_info['js'];
return $str;
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2008090108; // YYYYMMDD = date of the last version bump
$version = 2008090800; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20080908)'; // Human-friendly version name