"MDL-21906, disable filepicker for editor during installation"

This commit is contained in:
Dongsheng Cai 2010-03-24 06:38:10 +00:00
parent bd0f26bd05
commit 137bbbc620
2 changed files with 14 additions and 10 deletions

View File

@ -986,6 +986,7 @@ $string['makeeditable'] = 'If you make \'$a\' editable by the web server process
$string['manageblocks'] = 'Blocks';
$string['managecourses'] = 'Manage courses';
$string['managedatabase'] = 'Database';
$string['manageeditorfiles'] = 'Manage files used by editor';
$string['managefilters'] = 'Filters';
$string['managemeta'] = 'Is this a meta course?';
$string['managemetadisabled'] = 'This is disabled because this course is already in a meta course';

View File

@ -201,18 +201,21 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
$str .= '</select>';
$str .= '</div>';
if ($maxfiles != 0 ) { // 0 means no files, -1 unlimited
$str .= '<div><input type="hidden" name="'.$elname.'[itemid]" value="'.$draftitemid.'" /></div>';
/// embedded image files - TODO: hide on the fly when switching editors
$str .= '<div id="'.$id.'_filemanager">';
$editorurl = "$CFG->wwwroot/repository/filepicker.php?action=browse&amp;env=editor&amp;itemid=$draftitemid&amp;subdirs=$subdirs&amp;maxbytes=$maxbytes&amp;ctx_id=".$ctx->id.'&amp;course='.$PAGE->course->id;
$str .= '<object type="text/html" data="'.$editorurl.'" height="160" width="600" style="border:1px solid #000">Error</object>'; // TODO: localise, fix styles, etc.
$str .= '</div>';
} else {
// should disable file picker
//$str .= 'No file allowed';
// during moodle installation, user area doesn't exist
// so we need to disable filepicker here.
if (!during_initial_install() && empty($CFG->adminsetuppending)) {
// 0 means no files, -1 unlimited
if ($maxfiles != 0 ) {
$str .= '<div><input type="hidden" name="'.$elname.'[itemid]" value="'.$draftitemid.'" /></div>';
$str .= '<div id="'.$id.'_filemanager">';
$editorurl = "$CFG->wwwroot/repository/filepicker.php?action=browse&amp;env=editor&amp;itemid=$draftitemid&amp;subdirs=$subdirs&amp;maxbytes=$maxbytes&amp;ctx_id=".$ctx->id.'&amp;course='.$PAGE->course->id;
$str .= html_writer::link($editorurl, get_string('manageeditorfiles'), array('target'=>'_blank'));
//$str .= '<object type="text/html" data="'.$editorurl.'" height="160" width="600" style="border:1px solid #000">Error</object>';
$str .= '</div>';
}
}
$str .= '</div>';
return $str;