From ac0250434edf98a3a40024f2eb04c25b43f9692e Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 19 Nov 2008 20:21:27 +0000 Subject: [PATCH] MDL-16698 formslib: skeleton of new editor element - no JS or html editor integration yet --- lib/form/editor.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/form/editor.php b/lib/form/editor.php index e56f14e9b7..04630ca922 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -12,7 +12,7 @@ require_once('HTML/QuickForm/element.php'); class MoodleQuickForm_editor extends HTML_QuickForm_element { protected $_helpbutton = ''; - protected $_options = array('subdirs'=>0, 'maxbytes'=>0, 'changeformat'=>0, 'upload'=>0); + protected $_options = array('subdirs'=>0, 'maxbytes'=>0, 'maxfiles'=>0, 'changeformat'=>0); protected $_values = array('text'=>null, 'format'=>null, 'itemid'=>null); function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $options=null, $attributes=null) { @@ -60,6 +60,14 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $maxbytes); } + function getMaxfiles() { + return $this->_options['maxfiles']; + } + + function setMaxfiles($num) { + $this->_options['maxfiles'] = $num; + } + function getSubdirs() { return $this->_options['subdirs']; } @@ -107,7 +115,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { $subdirs = $this->_options['subdirs']; $maxbytes = $this->_options['maxbytes']; - $upload = $this->_options['upload']; + $maxfiles = $this->_options['maxfiles']; $changeformat = $this->_options['changeformat']; // TO DO: implement as ajax calls $text = $this->_values['text']; @@ -116,7 +124,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { // security - never ever allow guest/not logged in user to upload anything if (isguestuser() or !isloggedin()) { - $upload = 0; + $maxfiles = 0; } $str = $this->_getTabs(); @@ -150,7 +158,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { $str .= ''; /// embedded image files - TODO: hide if tinymce used because it has own image upload/manage dialog - if ($upload) { + if ($maxfiles) { if (empty($draftitemid)) { // no existing area info provided - let's use fresh new draft area require_once("$CFG->libdir/filelib.php"); -- 2.39.5