Merge branch 'MDL-51991-master' of git://github.com/ryanwyllie/moodle

This commit is contained in:
David Monllao 2015-11-11 09:18:52 +08:00
commit 212dc418d4
8 changed files with 147 additions and 445 deletions

View File

@ -26,17 +26,9 @@ $string['addcolumnafter'] = 'Insert column after';
$string['addrowafter'] = 'Insert row after';
$string['all'] = 'Around each cell';
$string['allowbackgroundcolour'] = 'Allow background colour';
$string['allowbackgroundcolour_desc'] = 'Allow users to set the background colour for the table';
$string['allowborder'] = 'Allow borders';
$string['allowborder_desc'] = 'If enabled, table and cell borders can be customised. The default border is a solid, 1px, black line.';
$string['allowborderstyle'] = 'Allow border styling';
$string['allowborderstyle_desc'] = 'This setting has no effect unless \'Allow borders\' is enabled.';
$string['allowbordersize'] = 'Allow border size control';
$string['allowbordersize_desc'] = 'This setting has no effect unless \'Allow borders\' is enabled.';
$string['allowbordercolour'] = 'Allow border colour';
$string['allowbordercolour_desc'] = 'This setting has no effect unless \'Allow borders\' is enabled.';
$string['allowborder'] = 'Allow border styling';
$string['allowborder_desc'] = 'If enabled, table and cell borders can be customised.';
$string['allowwidth'] = 'Allow width';
$string['allowwidth_desc'] = 'Allow users to set the width of the tables.';
$string['appearance'] = 'Appearance';
$string['backgroundcolour'] = 'Background colour';
$string['both'] = 'Both';
@ -44,7 +36,6 @@ $string['bordercolour'] = 'Border colour';
$string['borders'] = 'Borders';
$string['bordersize'] = 'Size of borders';
$string['borderstyles'] = 'Style of borders';
$string['borderstyles_desc'] = 'Allowed border styles, separated by commas';
$string['caption'] = 'Caption';
$string['captionposition'] = 'Caption position';
$string['columns'] = 'Columns';
@ -53,14 +44,8 @@ $string['deletecolumn'] = 'Delete column';
$string['deleterow'] = 'Delete row';
$string['dashed'] = 'Dashed';
$string['dotted'] = 'Dotted';
$string['double'] = 'Double';
$string['edittable'] = 'Edit table';
$string['groove'] = 'Groove';
$string['headers'] = 'Define headers on';
$string['hidden'] = 'Hidden';
$string['inherit'] = 'Inherit';
$string['initial'] = 'Initial';
$string['inset'] = 'Inset';
$string['movecolumnleft'] = 'Move column left';
$string['movecolumnright'] = 'Move column right';
$string['moverowdown'] = 'Move row down';
@ -70,14 +55,11 @@ $string['none'] = 'None';
$string['numberofcolumns'] = 'Number of columns';
$string['numberofrows'] = 'Number of rows';
$string['outer'] = 'Around table';
$string['outset'] = 'Outset';
$string['pluginname'] = 'Table';
$string['ridge'] = 'Ridge';
$string['rows'] = 'Rows';
$string['settings'] = 'Table settings';
$string['solid'] = 'Solid';
$string['themedefault'] = 'Theme default';
$string['transparent'] = 'Transparent';
$string['unset'] = 'Unset';
$string['updatetable'] = 'Update table';
$string['width'] = 'Table width (in %)';

View File

@ -60,19 +60,10 @@ function atto_table_strings_for_js() {
'width',
'outer',
'noborder',
'inherit',
'themedefault',
'initial',
'unset',
'hidden',
'dotted',
'dashed',
'solid',
'double',
'groove',
'ridge',
'inset',
'outset'),
'solid'),
'atto_table');
$PAGE->requires->strings_for_js(array('top',
@ -88,12 +79,7 @@ function atto_table_strings_for_js() {
*/
function atto_table_params_for_js($elementid, $options, $foptions) {
$params = array('allowBorders' => (bool) get_config('atto_table', 'allowborders'),
'allowBorderStyles' => (bool) get_config('atto_table', 'allowborderstyles'),
'borderStyles' => get_config('atto_table', 'borderstyles'),
'allowBorderSize' => (bool) get_config('atto_table', 'allowbordersize'),
'allowBorderColour' => (bool) get_config('atto_table', 'allowbordercolour'),
'allowWidth' => (bool) get_config('atto_table', 'allowwidth'),
'availableColors' => get_config('atto_table', 'availablecolors'),
'allowBackgroundColour' => (bool) get_config('atto_table', 'allowbackgroundcolour'));
return $params;
}

View File

@ -38,77 +38,21 @@ if ($ADMIN->fulltree) {
$default);
$settings->add($setting);
$name = new lang_string('allowborderstyle', 'atto_table');
$desc = new lang_string('allowborderstyle_desc', 'atto_table');
$default = 0;
$setting = new admin_setting_configcheckbox('atto_table/allowborderstyles',
$name,
$desc,
$default);
$settings->add($setting);
$name = new lang_string('borderstyles', 'atto_table');
$desc = new lang_string('borderstyles_desc', 'atto_table');
$default = array(
'initial' => new lang_string('initial', 'atto_table'),
'unset' => new lang_string('unset', 'atto_table'),
'none' => new lang_string('none', 'atto_table'),
'hidden' => new lang_string('hidden', 'atto_table'),
'dotted' => new lang_string('dotted', 'atto_table'),
'dashed' => new lang_string('dashed', 'atto_table'),
'solid' => new lang_string('solid', 'atto_table'),
'double' => new lang_string('double', 'atto_table'),
'groove' => new lang_string('groove', 'atto_table'),
'ridge' => new lang_string('ridge', 'atto_table'),
'inset' => new lang_string('inset', 'atto_table'),
'outset' => new lang_string('outset', 'atto_table'),
);
$setting = new admin_setting_configmultiselect('atto_table/borderstyles',
$name,
$desc,
array_keys($default),
$default);
$settings->add($setting);
$name = new lang_string('allowbordersize', 'atto_table');
$desc = new lang_string('allowbordersize_desc', 'atto_table');
$default = 0;
$setting = new admin_setting_configcheckbox('atto_table/allowbordersize',
$name,
$desc,
$default);
$settings->add($setting);
$name = new lang_string('allowbordercolour', 'atto_table');
$desc = new lang_string('allowbordercolour_desc', 'atto_table');
$default = 0;
$setting = new admin_setting_configcheckbox('atto_table/allowbordercolour',
$name,
$desc,
$default);
$settings->add($setting);
$name = new lang_string('allowbackgroundcolour', 'atto_table');
$desc = new lang_string('allowbackgroundcolour_desc', 'atto_table');
$default = 0;
$setting = new admin_setting_configcheckbox('atto_table/allowbackgroundcolour',
$name,
$desc,
'',
$default);
$settings->add($setting);
$name = new lang_string('allowwidth', 'atto_table');
$desc = new lang_string('allowwidth_desc', 'atto_table');
$default = 0;
$setting = new admin_setting_configcheckbox('atto_table/allowwidth',
$name,
$desc,
'',
$default);
$settings->add($setting);
}

View File

@ -40,9 +40,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 1 | atto_table |
| allowbordercolour | 1 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -66,9 +63,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 1 | atto_table |
| allowbordercolour | 1 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -105,9 +99,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 0 | atto_table |
| allowborderstyles | 0 | atto_table |
| allowbordersize | 0 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -140,9 +131,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 0 | atto_table |
| allowborderstyles | 0 | atto_table |
| allowbordersize | 0 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -155,12 +143,6 @@ Feature: Atto tables
And I click on "Show more buttons" "button"
And I click on "Table" "button"
When I click on "Edit table" "link"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I press "Update table"
@ -176,9 +158,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 0 | atto_table |
| allowbordersize | 0 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -191,9 +170,9 @@ Feature: Atto tables
And I click on "Show more buttons" "button"
When I click on "Table" "button"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
@ -212,9 +191,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 0 | atto_table |
| allowbordersize | 0 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -227,12 +203,6 @@ Feature: Atto tables
And I click on "Show more buttons" "button"
And I click on "Table" "button"
When I click on "Edit table" "link"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around each cell"
@ -249,9 +219,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 0 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -263,12 +230,6 @@ Feature: Atto tables
And I select the text in the "Blog entry body" Atto editor
And I click on "Show more buttons" "button"
When I click on "Table" "button"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around table"
@ -287,9 +248,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 0 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -302,12 +260,6 @@ Feature: Atto tables
And I click on "Show more buttons" "button"
And I click on "Table" "button"
When I click on "Edit table" "link"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around table"
@ -326,9 +278,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 1 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -340,12 +289,6 @@ Feature: Atto tables
And I select the text in the "Blog entry body" Atto editor
And I click on "Show more buttons" "button"
When I click on "Table" "button"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around table"
@ -366,9 +309,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 1 | atto_table |
| allowbordercolour | 0 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -381,12 +321,6 @@ Feature: Atto tables
And I click on "Show more buttons" "button"
And I click on "Table" "button"
When I click on "Edit table" "link"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should not exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around table"
@ -407,9 +341,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 1 | atto_table |
| allowbordercolour | 1 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -421,12 +352,6 @@ Feature: Atto tables
And I select the text in the "Blog entry body" Atto editor
And I click on "Show more buttons" "button"
When I click on "Table" "button"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "#FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around table"
@ -449,9 +374,6 @@ Feature: Atto tables
Given the following config values are set as admin:
| config | value | plugin |
| allowborders | 1 | atto_table |
| allowborderstyles | 1 | atto_table |
| allowbordersize | 1 | atto_table |
| allowbordercolour | 1 | atto_table |
| allowbackgroundcolour | 1 | atto_table |
| allowwidth | 1 | atto_table |
And I log in as "admin"
@ -464,12 +386,6 @@ Feature: Atto tables
And I click on "Show more buttons" "button"
And I click on "Table" "button"
When I click on "Edit table" "link"
Then ".moodle-dialogue-base .atto_form .borders" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .borderstyle" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordersize" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .bordercolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element" should exist
Then ".moodle-dialogue-base .atto_form .customwidth" "css_element" should exist
And I click on "FFFFFF" "radio" in the ".moodle-dialogue-base .atto_form .backgroundcolour" "css_element"
And I set the field "Table width (in %)" to "100"
And I set the field "Borders" to "Around table"

View File

@ -35,7 +35,7 @@ YUI.add('moodle-atto_table-button', function (Y, NAME) {
var COMPONENT = 'atto_table',
DEFAULT = {
BORDERSTYLE: 'inherit',
BORDERSTYLE: 'none',
BORDERWIDTH: '1'
},
DIALOGUE = {
@ -84,52 +84,45 @@ var COMPONENT = 'atto_table',
'<option value="all">{{get_string "all" component}}' + '</option>' +
'</select>' +
'<br>' +
'{{#if allowBorderStyles}}' +
'<label for="{{elementid}}_atto_table_borderstyle" class="sameline">' +
'{{get_string "borderstyles" component}}</label>' +
'<select name="borderstyles" class="{{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">' +
'<option value="inherit">{{get_string "inherit" component}}</option>' +
'{{#each borderStyles}}' +
'<option value="' + '{{this}}' + '">' + '{{get_string this ../component}}' + '</option>' +
'{{/each}}' +
'</select>' +
'<br>' +
'{{/if}}' +
'{{#if allowBorderSize}}' +
'<label for="{{elementid}}_atto_table_bordersize" class="sameline">' +
'{{get_string "bordersize" component}}</label>' +
'<input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="{{CSS.BORDERSIZE}}"' +
'type="number" value="1" size="8" min="1" max="50"/>' +
'<label style="display: inline-block;">{{CSS.BORDERSIZEUNIT}}</label>' +
'<br>' +
'{{/if}}' +
'{{#if allowBorderColour}}' +
'<label for="{{elementid}}_atto_table_bordercolour" class="sameline">' +
'{{get_string "bordercolour" component}}</label>' +
'<div id="{{elementid}}_atto_table_bordercolour"' +
'class="{{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1">' +
'<label class="hideborder" for="{{../elementid}}_atto_table_bordercolour_-1"' +
'style="background-color:transparent;color:transparent">' +
'<label for="{{elementid}}_atto_table_borderstyle" class="sameline">' +
'{{get_string "borderstyles" component}}</label>' +
'<select name="borderstyles" class="{{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">' +
'{{#each borderStyles}}' +
'<option value="' + '{{this}}' + '">' + '{{get_string this ../component}}' + '</option>' +
'{{/each}}' +
'</select>' +
'<br>' +
'<label for="{{elementid}}_atto_table_bordersize" class="sameline">' +
'{{get_string "bordersize" component}}</label>' +
'<input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="{{CSS.BORDERSIZE}}"' +
'type="number" value="1" size="8" min="1" max="50"/>' +
'<label style="display: inline-block;">{{CSS.BORDERSIZEUNIT}}</label>' +
'<br>' +
'<label for="{{elementid}}_atto_table_bordercolour" class="sameline">' +
'{{get_string "bordercolour" component}}</label>' +
'<div id="{{elementid}}_atto_table_bordercolour"' +
'class="{{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1">' +
'<label class="hideborder" for="{{../elementid}}_atto_table_bordercolour_-1"' +
'style="background-color:transparent;color:transparent">' +
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
'type="radio" name="borderColour" value="none" checked="checked"'+
'title="{{get_string "themedefault" component}}"></input>' +
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
'type="radio" name="borderColour" value="none" checked="checked"'+
'title="{{get_string "themedefault" component}}"></input>' +
'{{get_string "themedefault" component}}' +
'{{get_string "themedefault" component}}' +
'</label>' +
'{{#each availableColours}}' +
'<label for="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'style="background-color:{{this}};color:{{this}}">' +
'<input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'type="radio" name="borderColour" value="' + '{{this}}' + '" title="{{this}}">' +
'{{this}}' +
'</label>' +
'{{#each availableColours}}' +
'<label for="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'style="background-color:{{this}};color:{{this}}">' +
'<input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'type="radio" name="borderColour" value="' + '{{this}}' + '" title="{{this}}">' +
'{{this}}' +
'</label>' +
'{{/each}}' +
'</div>' +
'<br>' +
'{{/if}}' +
'{{/each}}' +
'</div>' +
'<br>' +
'{{/if}}' +
'{{#if allowBackgroundColour}}' +
'<label for="{{elementid}}_atto_table_backgroundcolour" class="sameline">' +
@ -162,7 +155,8 @@ var COMPONENT = 'atto_table',
'{{#if allowWidth}}' +
'<label for="{{elementid}}_atto_table_width" class="sameline">' +
'{{get_string "width" component}}</label>' +
'<input name="width" id="{{elementid}}_atto_table_width" class="{{CSS.WIDTH}}" size="8" type="number" min="0" max="100"/>' +
'<input name="width" id="{{elementid}}_atto_table_width" class="{{CSS.WIDTH}}" size="8" ' +
'type="number" min="0" max="100"/>' +
'<label style="display: inline-block;">{{CSS.WIDTHUNIT}}</label>' +
'<br>' +
'{{/if}}' +
@ -346,10 +340,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
nonedit: !edit,
allowStyling: this.get('allowStyling'),
allowBorders: allowBorders,
allowBorderStyles: this.get('allowBorderStyles'),
borderStyles: this.get('borderStyles'),
allowBorderSize: this.get('allowBorderSize'),
allowBorderColour: this.get('allowBorderColour'),
allowBackgroundColour: this.get('allowBackgroundColour'),
availableColours: this.get('availableColors'),
allowWidth: this.get('allowWidth')
@ -386,6 +377,10 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
borderColour = tableForm.all('[name="borderColour"]'),
disabledValue = 'removeAttribute';
if (!enableBorders) {
return;
}
if (enableBorders.get('value') === 'default') {
disabledValue = 'setAttribute';
}
@ -1402,16 +1397,6 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
value: true
},
/**
* Whether or not to allow style of borders
*
* @attribute allowBorderStyle
* @type Boolean
*/
allowBorderStyles: {
value: true
},
/**
* What border styles to allow
*
@ -1420,38 +1405,11 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
borderStyles: {
value: [
'none',
'solid',
'dashed',
'dotted'
],
setter: function(value) {
if (value) {
return value.replace(/ /g,'').split(',');
} else {
// Not a valid value - revert to default value.
return Y.Attribute.INVALID_VALUE;
}
}
},
/**
* Whether or not to allow border size
*
* @attribute allowBorderSize
* @type Boolean
*/
allowBorderSize: {
value: true
},
/**
* Whether or not to allow colourizing borders
*
* @attribute allowBorderColours
* @type Boolean
*/
allowBorderColour: {
value: true
]
},
/**

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ YUI.add('moodle-atto_table-button', function (Y, NAME) {
var COMPONENT = 'atto_table',
DEFAULT = {
BORDERSTYLE: 'inherit',
BORDERSTYLE: 'none',
BORDERWIDTH: '1'
},
DIALOGUE = {
@ -84,52 +84,45 @@ var COMPONENT = 'atto_table',
'<option value="all">{{get_string "all" component}}' + '</option>' +
'</select>' +
'<br>' +
'{{#if allowBorderStyles}}' +
'<label for="{{elementid}}_atto_table_borderstyle" class="sameline">' +
'{{get_string "borderstyles" component}}</label>' +
'<select name="borderstyles" class="{{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">' +
'<option value="inherit">{{get_string "inherit" component}}</option>' +
'{{#each borderStyles}}' +
'<option value="' + '{{this}}' + '">' + '{{get_string this ../component}}' + '</option>' +
'{{/each}}' +
'</select>' +
'<br>' +
'{{/if}}' +
'{{#if allowBorderSize}}' +
'<label for="{{elementid}}_atto_table_bordersize" class="sameline">' +
'{{get_string "bordersize" component}}</label>' +
'<input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="{{CSS.BORDERSIZE}}"' +
'type="number" value="1" size="8" min="1" max="50"/>' +
'<label style="display: inline-block;">{{CSS.BORDERSIZEUNIT}}</label>' +
'<br>' +
'{{/if}}' +
'{{#if allowBorderColour}}' +
'<label for="{{elementid}}_atto_table_bordercolour" class="sameline">' +
'{{get_string "bordercolour" component}}</label>' +
'<div id="{{elementid}}_atto_table_bordercolour"' +
'class="{{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1">' +
'<label class="hideborder" for="{{../elementid}}_atto_table_bordercolour_-1"' +
'style="background-color:transparent;color:transparent">' +
'<label for="{{elementid}}_atto_table_borderstyle" class="sameline">' +
'{{get_string "borderstyles" component}}</label>' +
'<select name="borderstyles" class="{{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">' +
'{{#each borderStyles}}' +
'<option value="' + '{{this}}' + '">' + '{{get_string this ../component}}' + '</option>' +
'{{/each}}' +
'</select>' +
'<br>' +
'<label for="{{elementid}}_atto_table_bordersize" class="sameline">' +
'{{get_string "bordersize" component}}</label>' +
'<input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="{{CSS.BORDERSIZE}}"' +
'type="number" value="1" size="8" min="1" max="50"/>' +
'<label style="display: inline-block;">{{CSS.BORDERSIZEUNIT}}</label>' +
'<br>' +
'<label for="{{elementid}}_atto_table_bordercolour" class="sameline">' +
'{{get_string "bordercolour" component}}</label>' +
'<div id="{{elementid}}_atto_table_bordercolour"' +
'class="{{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1">' +
'<label class="hideborder" for="{{../elementid}}_atto_table_bordercolour_-1"' +
'style="background-color:transparent;color:transparent">' +
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
'type="radio" name="borderColour" value="none" checked="checked"'+
'title="{{get_string "themedefault" component}}"></input>' +
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
'type="radio" name="borderColour" value="none" checked="checked"'+
'title="{{get_string "themedefault" component}}"></input>' +
'{{get_string "themedefault" component}}' +
'{{get_string "themedefault" component}}' +
'</label>' +
'{{#each availableColours}}' +
'<label for="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'style="background-color:{{this}};color:{{this}}">' +
'<input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'type="radio" name="borderColour" value="' + '{{this}}' + '" title="{{this}}">' +
'{{this}}' +
'</label>' +
'{{#each availableColours}}' +
'<label for="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'style="background-color:{{this}};color:{{this}}">' +
'<input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'type="radio" name="borderColour" value="' + '{{this}}' + '" title="{{this}}">' +
'{{this}}' +
'</label>' +
'{{/each}}' +
'</div>' +
'<br>' +
'{{/if}}' +
'{{/each}}' +
'</div>' +
'<br>' +
'{{/if}}' +
'{{#if allowBackgroundColour}}' +
'<label for="{{elementid}}_atto_table_backgroundcolour" class="sameline">' +
@ -162,7 +155,8 @@ var COMPONENT = 'atto_table',
'{{#if allowWidth}}' +
'<label for="{{elementid}}_atto_table_width" class="sameline">' +
'{{get_string "width" component}}</label>' +
'<input name="width" id="{{elementid}}_atto_table_width" class="{{CSS.WIDTH}}" size="8" type="number" min="0" max="100"/>' +
'<input name="width" id="{{elementid}}_atto_table_width" class="{{CSS.WIDTH}}" size="8" ' +
'type="number" min="0" max="100"/>' +
'<label style="display: inline-block;">{{CSS.WIDTHUNIT}}</label>' +
'<br>' +
'{{/if}}' +
@ -346,10 +340,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
nonedit: !edit,
allowStyling: this.get('allowStyling'),
allowBorders: allowBorders,
allowBorderStyles: this.get('allowBorderStyles'),
borderStyles: this.get('borderStyles'),
allowBorderSize: this.get('allowBorderSize'),
allowBorderColour: this.get('allowBorderColour'),
allowBackgroundColour: this.get('allowBackgroundColour'),
availableColours: this.get('availableColors'),
allowWidth: this.get('allowWidth')
@ -386,6 +377,10 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
borderColour = tableForm.all('[name="borderColour"]'),
disabledValue = 'removeAttribute';
if (!enableBorders) {
return;
}
if (enableBorders.get('value') === 'default') {
disabledValue = 'setAttribute';
}
@ -1402,16 +1397,6 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
value: true
},
/**
* Whether or not to allow style of borders
*
* @attribute allowBorderStyle
* @type Boolean
*/
allowBorderStyles: {
value: true
},
/**
* What border styles to allow
*
@ -1420,38 +1405,11 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
borderStyles: {
value: [
'none',
'solid',
'dashed',
'dotted'
],
setter: function(value) {
if (value) {
return value.replace(/ /g,'').split(',');
} else {
// Not a valid value - revert to default value.
return Y.Attribute.INVALID_VALUE;
}
}
},
/**
* Whether or not to allow border size
*
* @attribute allowBorderSize
* @type Boolean
*/
allowBorderSize: {
value: true
},
/**
* Whether or not to allow colourizing borders
*
* @attribute allowBorderColours
* @type Boolean
*/
allowBorderColour: {
value: true
]
},
/**

View File

@ -33,7 +33,7 @@
var COMPONENT = 'atto_table',
DEFAULT = {
BORDERSTYLE: 'inherit',
BORDERSTYLE: 'none',
BORDERWIDTH: '1'
},
DIALOGUE = {
@ -82,52 +82,45 @@ var COMPONENT = 'atto_table',
'<option value="all">{{get_string "all" component}}' + '</option>' +
'</select>' +
'<br>' +
'{{#if allowBorderStyles}}' +
'<label for="{{elementid}}_atto_table_borderstyle" class="sameline">' +
'{{get_string "borderstyles" component}}</label>' +
'<select name="borderstyles" class="{{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">' +
'<option value="inherit">{{get_string "inherit" component}}</option>' +
'{{#each borderStyles}}' +
'<option value="' + '{{this}}' + '">' + '{{get_string this ../component}}' + '</option>' +
'{{/each}}' +
'</select>' +
'<br>' +
'{{/if}}' +
'{{#if allowBorderSize}}' +
'<label for="{{elementid}}_atto_table_bordersize" class="sameline">' +
'{{get_string "bordersize" component}}</label>' +
'<input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="{{CSS.BORDERSIZE}}"' +
'type="number" value="1" size="8" min="1" max="50"/>' +
'<label style="display: inline-block;">{{CSS.BORDERSIZEUNIT}}</label>' +
'<br>' +
'{{/if}}' +
'{{#if allowBorderColour}}' +
'<label for="{{elementid}}_atto_table_bordercolour" class="sameline">' +
'{{get_string "bordercolour" component}}</label>' +
'<div id="{{elementid}}_atto_table_bordercolour"' +
'class="{{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1">' +
'<label class="hideborder" for="{{../elementid}}_atto_table_bordercolour_-1"' +
'style="background-color:transparent;color:transparent">' +
'<label for="{{elementid}}_atto_table_borderstyle" class="sameline">' +
'{{get_string "borderstyles" component}}</label>' +
'<select name="borderstyles" class="{{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">' +
'{{#each borderStyles}}' +
'<option value="' + '{{this}}' + '">' + '{{get_string this ../component}}' + '</option>' +
'{{/each}}' +
'</select>' +
'<br>' +
'<label for="{{elementid}}_atto_table_bordersize" class="sameline">' +
'{{get_string "bordersize" component}}</label>' +
'<input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="{{CSS.BORDERSIZE}}"' +
'type="number" value="1" size="8" min="1" max="50"/>' +
'<label style="display: inline-block;">{{CSS.BORDERSIZEUNIT}}</label>' +
'<br>' +
'<label for="{{elementid}}_atto_table_bordercolour" class="sameline">' +
'{{get_string "bordercolour" component}}</label>' +
'<div id="{{elementid}}_atto_table_bordercolour"' +
'class="{{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1">' +
'<label class="hideborder" for="{{../elementid}}_atto_table_bordercolour_-1"' +
'style="background-color:transparent;color:transparent">' +
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
'type="radio" name="borderColour" value="none" checked="checked"'+
'title="{{get_string "themedefault" component}}"></input>' +
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
'type="radio" name="borderColour" value="none" checked="checked"'+
'title="{{get_string "themedefault" component}}"></input>' +
'{{get_string "themedefault" component}}' +
'{{get_string "themedefault" component}}' +
'</label>' +
'{{#each availableColours}}' +
'<label for="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'style="background-color:{{this}};color:{{this}}">' +
'<input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'type="radio" name="borderColour" value="' + '{{this}}' + '" title="{{this}}">' +
'{{this}}' +
'</label>' +
'{{#each availableColours}}' +
'<label for="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'style="background-color:{{this}};color:{{this}}">' +
'<input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"' +
'type="radio" name="borderColour" value="' + '{{this}}' + '" title="{{this}}">' +
'{{this}}' +
'</label>' +
'{{/each}}' +
'</div>' +
'<br>' +
'{{/if}}' +
'{{/each}}' +
'</div>' +
'<br>' +
'{{/if}}' +
'{{#if allowBackgroundColour}}' +
'<label for="{{elementid}}_atto_table_backgroundcolour" class="sameline">' +
@ -160,7 +153,8 @@ var COMPONENT = 'atto_table',
'{{#if allowWidth}}' +
'<label for="{{elementid}}_atto_table_width" class="sameline">' +
'{{get_string "width" component}}</label>' +
'<input name="width" id="{{elementid}}_atto_table_width" class="{{CSS.WIDTH}}" size="8" type="number" min="0" max="100"/>' +
'<input name="width" id="{{elementid}}_atto_table_width" class="{{CSS.WIDTH}}" size="8" ' +
'type="number" min="0" max="100"/>' +
'<label style="display: inline-block;">{{CSS.WIDTHUNIT}}</label>' +
'<br>' +
'{{/if}}' +
@ -344,10 +338,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
nonedit: !edit,
allowStyling: this.get('allowStyling'),
allowBorders: allowBorders,
allowBorderStyles: this.get('allowBorderStyles'),
borderStyles: this.get('borderStyles'),
allowBorderSize: this.get('allowBorderSize'),
allowBorderColour: this.get('allowBorderColour'),
allowBackgroundColour: this.get('allowBackgroundColour'),
availableColours: this.get('availableColors'),
allowWidth: this.get('allowWidth')
@ -384,6 +375,10 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
borderColour = tableForm.all('[name="borderColour"]'),
disabledValue = 'removeAttribute';
if (!enableBorders) {
return;
}
if (enableBorders.get('value') === 'default') {
disabledValue = 'setAttribute';
}
@ -1400,16 +1395,6 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
value: true
},
/**
* Whether or not to allow style of borders
*
* @attribute allowBorderStyle
* @type Boolean
*/
allowBorderStyles: {
value: true
},
/**
* What border styles to allow
*
@ -1418,38 +1403,11 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
borderStyles: {
value: [
'none',
'solid',
'dashed',
'dotted'
],
setter: function(value) {
if (value) {
return value.replace(/ /g,'').split(',');
} else {
// Not a valid value - revert to default value.
return Y.Attribute.INVALID_VALUE;
}
}
},
/**
* Whether or not to allow border size
*
* @attribute allowBorderSize
* @type Boolean
*/
allowBorderSize: {
value: true
},
/**
* Whether or not to allow colourizing borders
*
* @attribute allowBorderColours
* @type Boolean
*/
allowBorderColour: {
value: true
]
},
/**