diff --git a/blocks/community/forms.php b/blocks/community/forms.php
index 4678fcbc966..a2f2164b4c3 100644
--- a/blocks/community/forms.php
+++ b/blocks/community/forms.php
@@ -140,7 +140,7 @@ class community_hub_search_form extends moodleform {
$smalllogohtml = '';
if (array_key_exists('id', $hub)) {
- // Retrieve hub logo + generate small logo
+ // Retrieve hub logo + generate small logo.
$params = array('hubid' => $hub['id'],
'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE);
$imgurl = new moodle_url(HUB_HUBDIRECTORYURL .
@@ -194,7 +194,7 @@ class community_hub_search_form extends moodleform {
array('class' => '', 'href' => $hub['url']));
}
- // Add hub to the hub items
+ // Add hub to the hub items.
$hubinfo = new stdClass();
$hubinfo->mainhtml = $hubfulldesc;
$hubinfo->rowhtml = html_writer::tag('div', $smalllogohtml ,
@@ -202,7 +202,7 @@ class community_hub_search_form extends moodleform {
$hubitems[$hub['url']] = $hubinfo;
}
- // Hub listing form element
+ // Hub listing form element.
$mform->addElement('listing','huburl', '', '', array('items' => $hubitems,
'showall' => get_string('showall', 'block_community'),
'hideall' => get_string('hideall', 'block_community')));
@@ -326,4 +326,4 @@ class community_hub_search_form extends moodleform {
return $errors;
}
-}
\ No newline at end of file
+}
diff --git a/lib/form/listing.php b/lib/form/listing.php
index 17ca6562aec..ad97f4fba4a 100644
--- a/lib/form/listing.php
+++ b/lib/form/listing.php
@@ -15,9 +15,9 @@
// along with Moodle. If not, see .
/**
- * Listing form element
+ * Listing form element.
*
- * Contains HTML class for a listing form element
+ * Contains HTML class for a listing form element.
*
* @package core_form
* @copyright 2012 Jerome Mouneyrac
@@ -27,7 +27,6 @@
require_once("HTML/QuickForm/button.php");
/**
-* What is it:
* The listing element is a simple customizable "select" without the input type=select.
* One main div contains the "large" html of an item.
* A show/hide div shows a hidden div containing the list of all items.
@@ -51,7 +50,7 @@ require_once("HTML/QuickForm/button.php");
class MoodleQuickForm_listing extends HTML_QuickForm_input {
/** @var array items to display */
- protected $items = array();
+ protected $items = array();
/** @var string language string for Show All */
protected $showall;
@@ -60,7 +59,7 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
protected $hideall;
/**
- * Constructor
+ * Constructor.
*
* @param string $elementName (optional) name of the listing
* @param string $elementLabel (optional) listing label
@@ -90,7 +89,7 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
/**
* Returns HTML for listing form element.
*
- * @return string
+ * @return string the HTML
*/
function toHtml() {
global $CFG, $PAGE;
@@ -98,18 +97,18 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
$mainhtml = html_writer::tag('div', $this->items[$this->getValue()]->mainhtml,
array('id' => $this->getName().'_items_main', 'class' => 'formlistingmain'));
- // Add the main div containing the selected item (+ the caption: "More items")
+ // Add the main div containing the selected item (+ the caption: "More items").
$html = html_writer::tag('div', $mainhtml .
html_writer::tag('div', $this->showall,
array('id' => $this->getName().'_items_caption', 'class' => 'formlistingmore')),
array('id'=>$this->getName().'_items', 'class' => 'formlisting hide'));
- // Add collapsible region: all the items
+ // Add collapsible region: all the items.
$itemrows = '';
$html .= html_writer::tag('div', $itemrows,
array('id' => $this->getName().'_items_all', 'class' => 'formlistingall'));
- // Add radio buttons for non javascript support
+ // Add radio buttons for non javascript support.
$radiobuttons = '';
foreach($this->items as $itemid => $item) {
$radioparams = array('name' => $this->getName(), 'value' => $itemid,
@@ -123,7 +122,7 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
;
}
- // Container for the hidden hidden input which will contain the selected item
+ // Container for the hidden hidden input which will contain the selected item.
$html .= html_writer::tag('div', $radiobuttons,
array('id' => 'formlistinginputcontainer', 'class' => 'formlistinginputcontainer'));
@@ -131,16 +130,15 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
'requires'=>array('node', 'event', 'transition'));
$PAGE->requires->js_init_call('M.form_listing.init',
- array(array('hiddeninputid' => $this->getAttribute('id'),
+ array(array(
'elementid' => $this->getName().'_items',
'hideall' => $this->hideall,
'showall' => $this->showall,
+ 'hiddeninputid' => $this->getAttribute('id'),
'items' => $this->items,
- 'attributid' => $this->getAttribute('id'),
'inputname' => $this->getName(),
'currentvalue' => $this->getValue())), true, $module);
return $html;
}
-
}
diff --git a/lib/form/yui/listing/listing.js b/lib/form/yui/listing/listing.js
index b260f552e4f..e66b6be305a 100644
--- a/lib/form/yui/listing/listing.js
+++ b/lib/form/yui/listing/listing.js
@@ -1,37 +1,67 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see .
+
+/**
+ * Form listing Javascript.
+ *
+ * It mainly handles loading the main content div when cliking on a tab/row.
+ * @copyright 2012 Jerome Mouneyrac
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
M.form_listing = {};
M.form_listing.Y = null;
M.form_listing.instances = [];
/**
- * This fucntion is called for each listing on page.
+ * This function is called for each listing form on page.
+ *
+ * @param {Array} params : {int} hiddeninputid - the id of the hidden input element
+ * {int} elementid - the id of the full form element
+ * {Array} items - items has for key the value return by the form, and for content an array with two attributs: mainhtml and rowhtml.
+ * {string} hideall - button label to hide all tabs(rows).
+ * {string} showall - button label to show all tabs(rows).
+ * {string} inputname - the name of the input element
+ * {string} currentvalue - the currently selected tab(row)
*/
M.form_listing.init = function(Y, params) {
if (params && params.hiddeninputid && params.elementid) {
- // Enable element that were hidden/displau for support of no-javascript
- // Display the form
+ // Enable element that were hidden/displau for support of no-javascript.
+ // Display the form.
Y.one('#'+params.elementid).removeClass('hide');
- // Replace the radio buttons by a hidden input
- Y.one('#formlistinginputcontainer').setHTML('');
+ // Replace the radio buttons by a hidden input.
+ Y.one('#formlistinginputcontainer').setHTML('');
var caption = Y.one('#'+params.elementid+'_caption');
var allitems = Y.one('#'+params.elementid+'_all');
var selecteditem = Y.one('#'+params.elementid+'_main');
var hiddeninput = Y.one('#'+params.hiddeninputid);
- // Do not display the listing by default
+ // Do not display the listing by default.
var show = 0;
allitems.hide();
- // Refresh the main item + set the hidden input to its value
+ // Refresh the main item + set the hidden input to its value.
var selectItem = function(e) {
var index = this.get('id').replace(params.elementid+'_all_',"");;
hiddeninput.set('value', items[index]);
selecteditem.setHTML(params.items[items[index]].mainhtml)
}
- // caption Onlick event to display/hide the listing
+ // Caption Onlick event to display/hide the listing.
var onClick = function(e) {
if (!show) {
allitems.show(true);
@@ -46,18 +76,18 @@ M.form_listing.init = function(Y, params) {
caption.on('click', onClick);
- // Fill the item rows with html + add event
- // PS: we need to save the items into a temporary "items[]" array because params.items keys could be
- // url. This temporary items[] avoid not working calls like Y.one('#myitems_http:www.google.com').
+ // Fill the item rows with html + add event.
+ // PS: we need to save the items into a temporary "items[]" array because params.items keys could be url.
+ // This temporary items[] avoid not working calls like Y.one('#myitems_http:www.google.com').
var items = [];
var itemindex = 0;
for (itemid in params.items) {
items[itemindex] = itemid;
-
- // Add the row
+
+ // Add the row.
allitems.append("
" + params.items[itemid].rowhtml + "
");
- // Add click event to the row
+ // Add click event to the row.
Y.one('#'+params.elementid+'_all_'+itemindex).on('click', selectItem);
itemindex = itemindex + 1;
diff --git a/lib/javascript-static.js b/lib/javascript-static.js
index ca6c377c7ed..1c385049331 100644
--- a/lib/javascript-static.js
+++ b/lib/javascript-static.js
@@ -95,7 +95,7 @@ M.util.CollapsibleRegion = function(Y, id, userpref, strtooltip) {
// Get the caption for the collapsible region
var caption = this.div.one('#'+id + '_caption');
-console.log('#'+id + '_caption');
+
// Create a link
var a = Y.Node.create('');
a.setAttribute('title', strtooltip);
diff --git a/theme/base/style/core.css b/theme/base/style/core.css
index 4e5402119f0..8e41668e2a8 100644
--- a/theme/base/style/core.css
+++ b/theme/base/style/core.css
@@ -1118,8 +1118,6 @@ table.flexible .r1, table.generaltable .r1 {background-color: #FAFAFA;}
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
- /*background-color: #F7F7F9;
- borde*/r: 1px solid #E1E1E8;
}
.formlistingrow {
@@ -1141,4 +1139,4 @@ table.flexible .r1, table.generaltable .r1 {background-color: #FAFAFA;}
body.jsenabled .formlistingradio {
display: none;
-}
\ No newline at end of file
+}