diff --git a/admin/cli/upgrade.php b/admin/cli/upgrade.php index b223605e0b082..83f114598e8c3 100644 --- a/admin/cli/upgrade.php +++ b/admin/cli/upgrade.php @@ -92,6 +92,10 @@ $oldversion = "$CFG->release ($CFG->version)"; $newversion = "$release ($version)"; +if (!moodle_needs_upgrading()) { + cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0); +} + // Test environment first. list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE); if (!$envstatus) { diff --git a/admin/environment.xml b/admin/environment.xml index c43b94e2e7e94..cd1781868052b 100644 --- a/admin/environment.xml +++ b/admin/environment.xml @@ -651,6 +651,7 @@ + diff --git a/admin/index.php b/admin/index.php index 7e8a6fc0f4055..70dcafa08054c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -306,8 +306,8 @@ } } - // at this stage there can be only one admin - users may change username, so do not rely on that - $adminuser = get_complete_user_data('id', $CFG->siteadmins); + // at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that + $adminuser = get_complete_user_data('id', reset(explode(',', $CFG->siteadmins))); if ($adminuser->password === 'adminsetuppending') { // prevent installation hijacking diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index 5721d54648fe9..b9e436f7cc4cf 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -103,7 +103,7 @@ $usernames = explode(',', $form->username); foreach ($usernames as $username) { - $username = trim(moodle_strtolower($username)); + $username = trim(textlib::strtolower($username)); if (!empty($username)) { if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) { if ($form->accessctrl == 'allow') { diff --git a/admin/roles/lib.php b/admin/roles/lib.php index d2dbaba656385..d57233ff1a224 100644 --- a/admin/roles/lib.php +++ b/admin/roles/lib.php @@ -610,8 +610,8 @@ public function read_submitted_permissions() { $shortname = optional_param('shortname', null, PARAM_RAW); if (!is_null($shortname)) { $this->role->shortname = $shortname; - $this->role->shortname = textlib_get_instance()->specialtoascii($this->role->shortname); - $this->role->shortname = moodle_strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT)); + $this->role->shortname = textlib::specialtoascii($this->role->shortname); + $this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT)); if (empty($this->role->shortname)) { $this->errors['shortname'] = get_string('errorbadroleshortname', 'role'); } diff --git a/admin/settings.php b/admin/settings.php index 3f8d2c93002ee..3e66f24d48eab 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -131,8 +131,8 @@ echo ''; } -$PAGE->requires->yui_module('moodle-core-formslib', - 'M.core.init_formslib', +$PAGE->requires->yui_module('moodle-core-formchangechecker', + 'M.core_formchangechecker.init', array(array( 'formid' => 'adminsettings' )) diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 9c86f4f26c260..c791205ca97de 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -97,6 +97,7 @@ ); $temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices)); $temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1)); + $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0)); $temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT)); $temp->add(new admin_setting_configcheckbox('navlinkcoursesections', new lang_string('navlinkcoursesections', 'admin'), new lang_string('navlinkcoursesections_help', 'admin'), 0)); diff --git a/admin/settings/courses.php b/admin/settings/courses.php index 88fbdef20a4ba..321ce4497629f 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -97,7 +97,6 @@ $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', new lang_string('generalusers','backup'), new lang_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0))); $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', new lang_string('generalanonymize','backup'), new lang_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0))); $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0))); - $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_user_files', new lang_string('generaluserfiles','backup'), new lang_string('configgeneraluserfiles','backup'), array('value'=>1, 'locked'=>0))); $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0))); $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0))); $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0))); @@ -144,7 +143,6 @@ $temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), '')); $temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1)); $temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1)); - $temp->add(new admin_setting_configcheckbox('backup/backup_auto_user_files', new lang_string('generaluserfiles', 'backup'), new lang_string('configgeneraluserfiles','backup'), 1)); $temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), 1)); $temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1)); $temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1)); diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 6ed940247872e..6d192b6d37de2 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -477,6 +477,13 @@ $ADMIN->add('reportplugins', $page); } +/// Add all admin tools +if ($hassiteconfig) { + $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin'))); + $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'), + $CFG->wwwroot . '/' . $CFG->admin . '/tools.php')); +} + // Now add various admin tools foreach (get_plugin_list('tool') as $plugin => $plugindir) { $settings_path = "$plugindir/settings.php"; @@ -485,13 +492,6 @@ } } -/// Add all admin tools -if ($hassiteconfig) { - $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin'))); - $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'), - $CFG->wwwroot . '/' . $CFG->admin . '/tools.php')); -} - /// Add all local plugins - must be always last! if ($hassiteconfig) { $ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins'))); diff --git a/admin/tool/customlang/db/access.php b/admin/tool/customlang/db/access.php index fa7c1aab5f756..12f07926500eb 100644 --- a/admin/tool/customlang/db/access.php +++ b/admin/tool/customlang/db/access.php @@ -18,8 +18,7 @@ /** * Defines the capabilities used by the Language customization admin tool * - * @package tool - * @subpackage customlang + * @package tool_customlang * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/admin/tool/customlang/db/install.xml b/admin/tool/customlang/db/install.xml index 4cee03bfeb9f8..4887c1f8c6392 100644 --- a/admin/tool/customlang/db/install.xml +++ b/admin/tool/customlang/db/install.xml @@ -1,22 +1,22 @@ - - + - + - - - - + + + + @@ -28,7 +28,7 @@
- + diff --git a/admin/tool/unittest/db/access.php b/admin/tool/unittest/db/access.php index 6a0c8d26561b6..73d07dc1f6f6d 100644 --- a/admin/tool/unittest/db/access.php +++ b/admin/tool/unittest/db/access.php @@ -17,12 +17,13 @@ /** * Unitest caps. * - * @package tool - * @subpackage unittest + * @package tool_unittest * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( // Note: do not add managers here, unittests are dangerous and not intended for production sites!!! diff --git a/admin/tool/uploaduser/locallib.php b/admin/tool/uploaduser/locallib.php index 83b648c9b32f8..b46f97291a64d 100644 --- a/admin/tool/uploaduser/locallib.php +++ b/admin/tool/uploaduser/locallib.php @@ -179,13 +179,11 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr print_error('csvfewcolumns', 'error', $returnurl); } - $textlib = textlib_get_instance(); // profile fields may contain unicode chars - // test columns $processed = array(); foreach ($columns as $key=>$unused) { $field = $columns[$key]; - $lcfield = $textlib->strtolower($field); + $lcfield = textlib::strtolower($field); if (in_array($field, $stdfields) or in_array($lcfield, $stdfields)) { // standard fields are only lowercase $newfield = $lcfield; @@ -281,8 +279,6 @@ function uu_process_template($template, $user) { * Internal callback function. */ function uu_process_template_callback($username, $firstname, $lastname, $block) { - $textlib = textlib_get_instance(); - switch ($block[3]) { case 'u': $repl = $username; @@ -299,18 +295,18 @@ function uu_process_template_callback($username, $firstname, $lastname, $block) switch ($block[1]) { case '+': - $repl = $textlib->strtoupper($repl); + $repl = textlib::strtoupper($repl); break; case '-': - $repl = $textlib->strtolower($repl); + $repl = textlib::strtolower($repl); break; case '~': - $repl = $textlib->strtotitle($repl); + $repl = textlib::strtotitle($repl); break; } if (!empty($block[2])) { - $repl = $textlib->substr($repl, 0 , $block[2]); + $repl = textlib::substr($repl, 0 , $block[2]); } return $repl; diff --git a/admin/tool/uploaduser/user_form.php b/admin/tool/uploaduser/user_form.php index 33b11193508a9..7fb74b0641b2c 100644 --- a/admin/tool/uploaduser/user_form.php +++ b/admin/tool/uploaduser/user_form.php @@ -53,8 +53,7 @@ function definition () { $mform->setDefault('delimiter_name', 'comma'); } - $textlib = textlib_get_instance(); - $choices = $textlib->get_encodings(); + $choices = textlib::get_encodings(); $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices); $mform->setDefault('encoding', 'UTF-8'); diff --git a/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php b/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php index f2def4aad10f3..18b4995736621 100644 --- a/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php +++ b/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php @@ -23,8 +23,7 @@ /** * reporting about the ones not physically implemented as BIGINTs - * and providing one SQL script to fix all them. Also, under MySQL, - * it performs one check of signed bigints. MDL-11038 + * and providing one SQL script to fix all them. MDL-11038 * * @package tool * @subpackage xmldb @@ -53,7 +52,6 @@ function init() { 'wrongints' => 'tool_xmldb', 'nowrongintsfound' => 'tool_xmldb', 'yeswrongintsfound' => 'tool_xmldb', - 'mysqlextracheckbigints' => 'tool_xmldb', )); // Correct fields must be type bigint for MySQL and int8 for PostgreSQL @@ -90,8 +88,8 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) { $metacolumn = $metacolumns[$xmldb_field->getName()]; // Going to check this field in DB $o.='
  • ' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' '; - // Detect if the physical field is wrong and, under mysql, check for incorrect signed fields too - if ($metacolumn->type != $this->correct_type || ($this->dbfamily == 'mysql' && $xmldb_field->getUnsigned() && !$metacolumn->unsigned)) { + // Detect if the physical field is wrong + if ($metacolumn->type != $this->correct_type) { $o.='' . $this->str['wrong'] . ''; // Add the wrong field to the list $obj = new stdClass(); diff --git a/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php b/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php index 1cf39694d6769..632d12ea2d005 100644 --- a/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php +++ b/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php @@ -88,7 +88,7 @@ function invoke() { $c.= ' ' . "\n"; $c.= '
  • ' . "\n"; $c.= ' ' . "\n"; - $c.= ' ' . "\n"; + $c.= ' ' . "\n"; $c.= ' ' . "\n"; $c.= ' ' . "\n"; $c.= ' ' . "\n"; diff --git a/admin/tool/xmldb/actions/edit_field/edit_field.class.php b/admin/tool/xmldb/actions/edit_field/edit_field.class.php index 2c38399c8690f..f13ec300bf647 100644 --- a/admin/tool/xmldb/actions/edit_field/edit_field.class.php +++ b/admin/tool/xmldb/actions/edit_field/edit_field.class.php @@ -155,11 +155,6 @@ function invoke() { // xmldb_field Decimals $o.= ' '; $o.= ' '; - // xmldb_field Unsigned - $unsignedoptions = array (0 => 'signed', 1 => 'unsigned'); - $select = html_writer::select($unsignedoptions, 'unsigned', $field->getUnsigned(), false); - $o.= ' '; - $o.= ' '; // xmldb_field NotNull $notnulloptions = array (0 => 'null', 'not null'); $select = html_writer::select($notnulloptions, 'notnull', $field->getNotNull(), false); diff --git a/admin/tool/xmldb/actions/edit_field/edit_field.js b/admin/tool/xmldb/actions/edit_field/edit_field.js index 61aac8bc2c9fc..57dcfcaa2b2da 100644 --- a/admin/tool/xmldb/actions/edit_field/edit_field.js +++ b/admin/tool/xmldb/actions/edit_field/edit_field.js @@ -50,7 +50,6 @@ function transformForm(event) { var typeField = document.getElementById('menutype'); var lengthField = document.getElementById('length'); var decimalsField = document.getElementById('decimals'); - var unsignedField = document.getElementById('menuunsigned'); var notnullField = document.getElementById('menunotnull'); var sequenceField = document.getElementById('menusequence'); var defaultField = document.getElementById('default'); @@ -60,15 +59,12 @@ function transformForm(event) { // Initially, enable everything decimalsField.disabled = false; - unsignedField.disabled = false; notnullField.disabled = false; sequenceField.disabled = false; defaultField.disabled = false; // Based on sequence, disable some items if (sequenceField.value == '1') { - unsignedField.disabled = true; - unsignedField.value = '1'; notnullField.disabled = true; notnullField.value = '1'; defaultField.disabled = true; @@ -79,51 +75,47 @@ function transformForm(event) { switch (typeField.value) { case '1': // XMLDB_TYPE_INTEGER lengthTip.innerHTML = ' 1...20'; + lengthField.disabled = false; decimalsTip.innerHTML = ''; decimalsField.disabled = true; decimalsField.value = ''; break; case '2': // XMLDB_TYPE_NUMBER lengthTip.innerHTML = ' 1...20'; + lengthField.disabled = false; decimalsTip.innerHTML = ' 0...length or empty'; - unsignedField.disabled = true; - unsignedField.value = '0'; break; case '3': // XMLDB_TYPE_FLOAT lengthTip.innerHTML = ' 1...20 or empty'; + lengthField.disabled = false; decimalsTip.innerHTML = ' 0...length or empty'; - unsignedField.disabled = true; - unsignedField.value = '0'; break; case '4': // XMLDB_TYPE_CHAR lengthTip.innerHTML = ' 1...1333'; // Hardcoded, yes! + lengthField.disabled = false; decimalsTip.innerHTML = ''; decimalsField.disabled = true; decimalsField.value = ''; - unsignedField.disabled = true; - unsignedField.value = '0'; sequenceField.disabled = true; sequenceField.value = '0'; break; case '5': // XMLDB_TYPE_TEXT - lengthTip.innerHTML = ' small, medium, big'; + lengthTip.innerHTML = ''; + lengthField.disabled = true; decimalsTip.innerHTML = ''; decimalsField.disabled = true; decimalsField.value = ''; - unsignedField.disabled = true; - unsignedField.value = '0'; sequenceField.disabled = true; sequenceField.value = '0'; defaultField.disabled = true; defaultField.value = ''; break; case '6': // XMLDB_TYPE_BINARY - lengthTip.innerHTML = ' small, medium, big'; + lengthTip.innerHTML = ''; + lengthField.disabled = true; decimalsTip.innerHTML = ''; decimalsField.disabled = true; decimalsField.value = ''; - unsignedField.disabled = true; - unsignedField.value = '0'; sequenceField.disabled = true; sequenceField.value = '0'; defaultField.disabled = true; @@ -136,8 +128,6 @@ function transformForm(event) { decimalsTip.innerHTML = ''; decimalsField.disabled = true; decimalsField.value = ''; - unsignedField.disabled = true; - unsignedField.value = '0'; sequenceField.disabled = true; sequenceField.value = '0'; defaultField.disabled = true; diff --git a/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php b/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php index 0e1f7d86f479e..90b1433cbb0dd 100644 --- a/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php +++ b/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php @@ -49,8 +49,6 @@ function init() { 'numberincorrectlength' => 'tool_xmldb', 'floatincorrectlength' => 'tool_xmldb', 'charincorrectlength' => 'tool_xmldb', - 'textincorrectlength' => 'tool_xmldb', - 'binaryincorrectlength' => 'tool_xmldb', 'numberincorrectdecimals' => 'tool_xmldb', 'floatincorrectdecimals' => 'tool_xmldb', 'defaultincorrect' => 'tool_xmldb', @@ -96,7 +94,6 @@ function invoke() { $type = required_param('type', PARAM_INT); $length = strtolower(optional_param('length', NULL, PARAM_ALPHANUM)); $decimals = optional_param('decimals', NULL, PARAM_INT); - $unsigned = optional_param('unsigned', false, PARAM_BOOL); $notnull = optional_param('notnull', false, PARAM_BOOL); $sequence = optional_param('sequence', false, PARAM_BOOL); $default = optional_param('default', NULL, PARAM_PATH); @@ -112,7 +109,6 @@ function invoke() { // Perform some automatic assumptions if ($sequence) { - $unsigned = true; $notnull = true; $default = NULL; } @@ -203,35 +199,14 @@ function invoke() { } } } - // Text checks - if ($type == XMLDB_TYPE_TEXT) { - if ($length != 'small' && - $length != 'medium' && - $length != 'big') { - $errors[] = $this->str['textincorrectlength']; - } - if ($default !== NULL && $default !== '') { - if (substr($default, 0, 1) == "'" || - substr($default, -1, 1) == "'") { - $errors[] = $this->str['defaultincorrect']; - } - } - } - // Binary checks - if ($type == XMLDB_TYPE_BINARY) { - if ($length != 'small' && - $length != 'medium' && - $length != 'big') { - $errors[] = $this->str['binaryincorrectlength']; - } - } + // No text checks + // No binary checks if (!empty($errors)) { $tempfield = new xmldb_field($name); $tempfield->setType($type); $tempfield->setLength($length); $tempfield->setDecimals($decimals); - $tempfield->setUnsigned($unsigned); $tempfield->setNotNull($notnull); $tempfield->setSequence($sequence); $tempfield->setDefault($default); @@ -268,7 +243,6 @@ function invoke() { $field->setType($type); $field->setLength($length); $field->setDecimals($decimals); - $field->setUnsigned($unsigned); $field->setNotNull($notnull); $field->setSequence($sequence); $field->setDefault($default); diff --git a/admin/tool/xmldb/actions/generate_documentation/xmldb.xsl b/admin/tool/xmldb/actions/generate_documentation/xmldb.xsl index 2bace7f06832f..97403f6bad8c4 100644 --- a/admin/tool/xmldb/actions/generate_documentation/xmldb.xsl +++ b/admin/tool/xmldb/actions/generate_documentation/xmldb.xsl @@ -43,7 +43,6 @@ '; - } - } - } - } - } - } - } // If there are changes pending to be saved, but the file cannot be written... inform here if ($dbdir->path_exists && file_exists($key . '/install.xml') && diff --git a/admin/tool/xmldb/actions/new_table/new_table.class.php b/admin/tool/xmldb/actions/new_table/new_table.class.php index bb34696d5a7c6..cfdb38522bab8 100644 --- a/admin/tool/xmldb/actions/new_table/new_table.class.php +++ b/admin/tool/xmldb/actions/new_table/new_table.class.php @@ -90,7 +90,6 @@ function invoke() { $field->setType(XMLDB_TYPE_INTEGER); $field->setLength(10); $field->setNotNull(true); - $field->setUnsigned(true); $field->setSequence(true); $field->setLoaded(true); $field->setChanged(true); diff --git a/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php b/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php index 36a1d8800d14c..7ce215793fea6 100644 --- a/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php +++ b/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php @@ -125,10 +125,8 @@ function invoke() { $optionspacer . 'rename_field', $optionspacer . 'change_field_type', $optionspacer . 'change_field_precision', - $optionspacer . 'change_field_unsigned', $optionspacer . 'change_field_notnull', $optionspacer . 'change_field_default', - $optionspacer . 'drop_enum_from_field', // TODO: Moodle 2.1 - Drop drop_enum_from_field 'Keys', $optionspacer . 'add_key', $optionspacer . 'drop_key', @@ -218,13 +216,6 @@ function invoke() { $o.= $this->str['mustselectonefield']; } break; - case 'change_field_unsigned': - if ($fieldkeyindexinitial == 'f') { //Only if we have got one field - $o.= s($this->change_field_unsigned_php($structure, $tableparam, $fieldkeyindexparam)); - } else { - $o.= $this->str['mustselectonefield']; - } - break; case 'change_field_notnull': if ($fieldkeyindexinitial == 'f') { // Only if we have got one field $o.= s($this->change_field_notnull_php($structure, $tableparam, $fieldkeyindexparam)); @@ -232,13 +223,6 @@ function invoke() { $o.= $this->str['mustselectonefield']; } break; - case 'drop_enum_from_field': // TODO: Moodle 2.1 - Drop drop_enum_from_field - if ($fieldkeyindexinitial == 'f') { // Only if we have got one field - $o.= s($this->drop_enum_from_field_php($structure, $tableparam, $fieldkeyindexparam)); - } else { - $o.= $this->str['mustselectonefield']; - } - break; case 'change_field_default': if ($fieldkeyindexinitial == 'f') { // Only if we have got one field $o.= s($this->change_field_default_php($structure, $tableparam, $fieldkeyindexparam)); @@ -553,54 +537,6 @@ function change_field_precision_php($structure, $table, $field) { return $result; } - /** - * This function will generate all the PHP code needed to - * change the unsigned/signed of one field using XMLDB objects and functions - * - * @param xmldb_structure structure object containing all the info - * @param string table table name - * @param string field field name to change unsigned/signed - */ - function change_field_unsigned_php($structure, $table, $field) { - - $result = ''; - // Validate if we can do it - if (!$table = $structure->getTable($table)) { - return false; - } - if (!$field = $table->getField($field)) { - return false; - } - if ($table->getAllErrors()) { - return false; - } - - // Calculate the unsigned tip text - $unsigned = $field->getUnsigned() ? 'unsigned' : 'signed'; - - // Add the standard PHP header - $result .= XMLDB_PHP_HEADER; - - // Add contents - $result .= XMLDB_LINEFEED; - $result .= ' // Changing sign of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $unsigned . XMLDB_LINEFEED; - $result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED; - $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED; - - // Launch the proper DDL - $result .= XMLDB_LINEFEED; - $result .= ' // Launch change of sign for field ' . $field->getName() . XMLDB_LINEFEED; - $result .= ' $dbman->change_field_unsigned($table, $field);' . XMLDB_LINEFEED; - - // Add the proper upgrade_xxxx_savepoint call - $result .= $this->upgrade_savepoint_php ($structure); - - // Add standard PHP footer - $result .= XMLDB_PHP_FOOTER; - - return $result; - } - /** * This function will generate all the PHP code needed to * change the nullability of one field using XMLDB objects and functions @@ -649,57 +585,6 @@ function change_field_notnull_php($structure, $table, $field) { return $result; } - /** - * This function will generate all the PHP code needed to - * drop the enum values (check constraint) of one field - * using XMLDB objects and functions - * - * Note this function is here as part of the process of - * dropping enums completely from Moodle 2.0: MDL-18577 - * and will be out in Moodle 2.1 - * TODO: Moodle 2.1 - Drop drop_enum_from_field_php - * - * @param xmldb_structure structure object containing all the info - * @param string table table name - * @param string field field name to change its enum - */ - function drop_enum_from_field_php($structure, $table, $field) { - - $result = ''; - // Validate if we can do it - if (!$table = $structure->getTable($table)) { - return false; - } - if (!$field = $table->getField($field)) { - return false; - } - if ($table->getAllErrors()) { - return false; - } - - // Add the standard PHP header - $result .= XMLDB_PHP_HEADER; - - // Add contents - $result .= XMLDB_LINEFEED; - $result .= ' // Drop list of values (enum) from field ' . $field->getName() . ' on table ' . $table->getName() . XMLDB_LINEFEED; - $result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED; - $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED; - - // Launch the proper DDL - $result .= XMLDB_LINEFEED; - $result .= ' // Launch drop of list of values from field ' . $field->getName() . XMLDB_LINEFEED; - $result .= ' $dbman->drop_enum_from_field($table, $field);' . XMLDB_LINEFEED; - - // Add the proper upgrade_xxxx_savepoint call - $result .= $this->upgrade_savepoint_php ($structure); - - // Add standard PHP footer - $result .= XMLDB_PHP_FOOTER; - - return $result; - } - /** * This function will generate all the PHP code needed to * change the default of one field using XMLDB objects and functions diff --git a/admin/tool/xmldb/lang/en/tool_xmldb.php b/admin/tool/xmldb/lang/en/tool_xmldb.php index b24a219f85704..a378c268ee4a6 100644 --- a/admin/tool/xmldb/lang/en/tool_xmldb.php +++ b/admin/tool/xmldb/lang/en/tool_xmldb.php @@ -27,7 +27,6 @@ $string['aftertable'] = 'After table:'; $string['back'] = 'Back'; $string['backtomainview'] = 'Back to main'; -$string['binaryincorrectlength'] = 'Incorrect length for binary field'; $string['cannotuseidfield'] = 'Cannot insert the "id" field. It is an autonumeric column'; $string['completelogbelow'] = '(see the complete log of the search below)'; $string['confirmdeletefield'] = 'Are you absolutely sure that you want to delete the field:'; @@ -126,7 +125,6 @@ $string['mustselectonefield'] = 'You must select one field to see field related actions!'; $string['mustselectoneindex'] = 'You must select one index to see index related actions!'; $string['mustselectonekey'] = 'You must select one key to see key related actions!'; -$string['mysqlextracheckbigints'] = 'Under MySQL it also looks for incorrectly signed bigints, generating the required SQL to be executed in order to fix all them.'; $string['newfield'] = 'New field'; $string['newindex'] = 'New index'; $string['newkey'] = 'New key'; @@ -160,7 +158,6 @@ $string['table'] = 'Table'; $string['tablenameempty'] = 'The table name cannot be empty'; $string['tables'] = 'Tables'; -$string['textincorrectlength'] = 'Incorrect length for text field'; $string['unload'] = 'Unload'; $string['up'] = 'Up'; $string['view'] = 'View'; diff --git a/auth/cas/auth.php b/auth/cas/auth.php index d66bdb8029793..fa6fb0f61477f 100644 --- a/auth/cas/auth.php +++ b/auth/cas/auth.php @@ -51,7 +51,7 @@ function prevent_local_passwords() { */ function user_login ($username, $password) { $this->connectCAS(); - return phpCAS::isAuthenticated() && (trim(moodle_strtolower(phpCAS::getUser())) == $username); + return phpCAS::isAuthenticated() && (trim(textlib::strtolower(phpCAS::getUser())) == $username); } /** @@ -336,15 +336,15 @@ function process_config($config) { set_config('host_url', trim($config->host_url), $this->pluginconfig); set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig); set_config('contexts', trim($config->contexts), $this->pluginconfig); - set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig); - set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $this->pluginconfig); + set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig); + set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig); set_config('search_sub', $config->search_sub, $this->pluginconfig); set_config('opt_deref', $config->opt_deref, $this->pluginconfig); set_config('bind_dn', trim($config->bind_dn), $this->pluginconfig); set_config('bind_pw', $config->bind_pw, $this->pluginconfig); set_config('ldap_version', $config->ldap_version, $this->pluginconfig); set_config('objectclass', trim($config->objectclass), $this->pluginconfig); - set_config('memberattribute', moodle_strtolower(trim($config->memberattribute)), $this->pluginconfig); + set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig); set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig); set_config('attrcreators', trim($config->attrcreators), $this->pluginconfig); set_config('groupecreators', trim($config->groupecreators), $this->pluginconfig); @@ -364,8 +364,7 @@ function iscreator($username) { return false; } - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); // Test for group creator if (!empty($this->config->groupecreators)) { diff --git a/auth/db/lang/en/auth_db.php b/auth/db/lang/en/auth_db.php index 2443235bb0d67..6f42064fb0c5e 100644 --- a/auth/db/lang/en/auth_db.php +++ b/auth/db/lang/en/auth_db.php @@ -57,7 +57,7 @@ $string['auth_dbsybasequotinghelp'] = 'Sybase style single quote escaping - needed for Oracle, MS SQL and some other databases. Do not use for MySQL!'; $string['auth_dbtable'] = 'Name of the table in the database'; $string['auth_dbtable_key'] = 'Table'; -$string['auth_dbtype'] = 'The database type (See the ADOdb documentation for details)'; +$string['auth_dbtype'] = 'The database type (See the ADOdb documentation for details)'; $string['auth_dbtype_key'] = 'Database'; $string['auth_dbupdatinguser'] = 'Updating user {$a->name} id {$a->id}'; $string['auth_dbuser'] = 'Username with read access to the database'; diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 9f88bbd43bdff..d1572a357e01a 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -133,9 +133,8 @@ function user_login($username, $password) { return false; } - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); - $extpassword = $textlib->convert($password, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); + $extpassword = textlib::convert($password, 'utf-8', $this->config->ldapencoding); // Before we connect to LDAP, check if this is an AD SSO login // if we succeed in this block, we'll return success early. @@ -199,8 +198,7 @@ function user_login($username, $password) { * @return mixed array with no magic quotes or false on error */ function get_userinfo($username) { - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); $ldapconnection = $this->ldap_connect(); if(!($user_dn = $this->ldap_find_userdn($ldapconnection, $extusername))) { @@ -245,9 +243,9 @@ function get_userinfo($username) { continue; // wrong data mapping! } if (is_array($entry[$value])) { - $newval = $textlib->convert($entry[$value][0], $this->config->ldapencoding, 'utf-8'); + $newval = textlib::convert($entry[$value][0], $this->config->ldapencoding, 'utf-8'); } else { - $newval = $textlib->convert($entry[$value], $this->config->ldapencoding, 'utf-8'); + $newval = textlib::convert($entry[$value], $this->config->ldapencoding, 'utf-8'); } if (!empty($newval)) { // favour ldap entries that are set $ldapval = $newval; @@ -298,8 +296,7 @@ function get_userlist() { * @param string $username */ function user_exists($username) { - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); // Returns true if given username exists on ldap $users = $this->ldap_get_userlist('('.$this->config->user_attribute.'='.ldap_filter_addslashes($extusername).')'); @@ -315,9 +312,8 @@ function user_exists($username) { * @param mixed $plainpass Plaintext password */ function user_create($userobject, $plainpass) { - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($userobject->username, 'utf-8', $this->config->ldapencoding); - $extpassword = $textlib->convert($plainpass, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($userobject->username, 'utf-8', $this->config->ldapencoding); + $extpassword = textlib::convert($plainpass, 'utf-8', $this->config->ldapencoding); switch ($this->config->passtype) { case 'md5': @@ -342,7 +338,7 @@ function user_create($userobject, $plainpass) { } foreach ($values as $value) { if (!empty($userobject->$key) ) { - $newuser[$value] = $textlib->convert($userobject->$key, 'utf-8', $this->config->ldapencoding); + $newuser[$value] = textlib::convert($userobject->$key, 'utf-8', $this->config->ldapencoding); } } } @@ -570,8 +566,7 @@ function user_confirm($username, $confirmsecret) { function password_expire($username) { $result = 0; - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); $ldapconnection = $this->ldap_connect(); $user_dn = $this->ldap_find_userdn($ldapconnection, $extusername); @@ -616,7 +611,6 @@ function sync_users($do_updates=true) { print_string('connectingldap', 'auth_ldap'); $ldapconnection = $this->ldap_connect(); - $textlib = textlib_get_instance(); $dbman = $DB->get_manager(); /// Define table user to be created @@ -667,7 +661,7 @@ function sync_users($do_updates=true) { if ($entry = @ldap_first_entry($ldapconnection, $ldap_result)) { do { $value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute); - $value = $textlib->convert($value[0], $this->config->ldapencoding, 'utf-8'); + $value = textlib::convert($value[0], $this->config->ldapencoding, 'utf-8'); $this->ldap_bulk_insert($value); } while ($entry = ldap_next_entry($ldapconnection, $entry)); } @@ -845,7 +839,7 @@ function sync_users($do_updates=true) { $user->mnethostid = $CFG->mnet_localhost_id; // get_userinfo_asobj() might have replaced $user->username with the value // from the LDAP server (which can be mixed-case). Make sure it's lowercase - $user->username = trim(moodle_strtolower($user->username)); + $user->username = trim(textlib::strtolower($user->username)); if (empty($user->lang)) { $user->lang = $CFG->lang; } @@ -889,7 +883,7 @@ function update_user_record($username, $updatekeys = false) { global $CFG, $DB; // Just in case check text case - $username = trim(moodle_strtolower($username)); + $username = trim(textlib::strtolower($username)); // Get the current user record $user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id)); @@ -934,7 +928,7 @@ function update_user_record($username, $updatekeys = false) { function ldap_bulk_insert($username) { global $DB, $CFG; - $username = moodle_strtolower($username); // usernames are __always__ lowercase. + $username = textlib::strtolower($username); // usernames are __always__ lowercase. $DB->insert_record_raw('tmp_extuser', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id), false, true); echo '.'; @@ -947,8 +941,7 @@ function ldap_bulk_insert($username) { * @return boolean result */ function user_activate($username) { - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); $ldapconnection = $this->ldap_connect(); @@ -998,8 +991,7 @@ function iscreator($username) { return null; } - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); $ldapconnection = $this->ldap_connect(); @@ -1057,8 +1049,7 @@ function user_update($olduser, $newuser) { return true; } - $textlib = textlib_get_instance(); - $extoldusername = $textlib->convert($olduser->username, 'utf-8', $this->config->ldapencoding); + $extoldusername = textlib::convert($olduser->username, 'utf-8', $this->config->ldapencoding); $ldapconnection = $this->ldap_connect(); @@ -1112,9 +1103,9 @@ function user_update($olduser, $newuser) { $ambiguous = false; } - $nuvalue = $textlib->convert($newuser->$key, 'utf-8', $this->config->ldapencoding); + $nuvalue = textlib::convert($newuser->$key, 'utf-8', $this->config->ldapencoding); empty($nuvalue) ? $nuvalue = array() : $nuvalue; - $ouvalue = $textlib->convert($olduser->$key, 'utf-8', $this->config->ldapencoding); + $ouvalue = textlib::convert($olduser->$key, 'utf-8', $this->config->ldapencoding); foreach ($ldapkeys as $ldapkey) { $ldapkey = $ldapkey; @@ -1210,9 +1201,8 @@ function user_update_password($user, $newpassword) { $result = false; $username = $user->username; - $textlib = textlib_get_instance(); - $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding); - $extpassword = $textlib->convert($newpassword, 'utf-8', $this->config->ldapencoding); + $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding); + $extpassword = textlib::convert($newpassword, 'utf-8', $this->config->ldapencoding); switch ($this->config->passtype) { case 'md5': @@ -1380,13 +1370,13 @@ function ldap_attributes () { $moodleattributes = array(); foreach ($this->userfields as $field) { if (!empty($this->config->{"field_map_$field"})) { - $moodleattributes[$field] = moodle_strtolower(trim($this->config->{"field_map_$field"})); + $moodleattributes[$field] = textlib::strtolower(trim($this->config->{"field_map_$field"})); if (preg_match('/,/', $moodleattributes[$field])) { $moodleattributes[$field] = explode(',', $moodleattributes[$field]); // split ? } } } - $moodleattributes['username'] = moodle_strtolower(trim($this->config->user_attribute)); + $moodleattributes['username'] = textlib::strtolower(trim($this->config->user_attribute)); return $moodleattributes; } @@ -1435,9 +1425,8 @@ function ldap_get_userlist($filter='*') { $users = ldap_get_entries_moodle($ldapconnection, $ldap_result); // Add found users to list - $textlib = textlib_get_instance(); for ($i = 0; $i < count($users); $i++) { - $extuser = $textlib->convert($users[$i][$this->config->user_attribute][0], + $extuser = textlib::convert($users[$i][$this->config->user_attribute][0], $this->config->ldapencoding, 'utf-8'); array_push($fresult, $extuser); } @@ -1575,8 +1564,7 @@ function ntlmsso_magic($sesskey) { // (according to my reading of RFC-1945, RFC-2616 and RFC-2617 and // my local tests), so we need to convert the REMOTE_USER value // (i.e., what we got from the HTTP WWW-Authenticate header) into UTF-8 - $textlib = textlib_get_instance(); - $username = $textlib->convert($_SERVER['REMOTE_USER'], 'iso-8859-1', 'utf-8'); + $username = textlib::convert($_SERVER['REMOTE_USER'], 'iso-8859-1', 'utf-8'); switch ($this->config->ntlmsso_type) { case 'ntlm': @@ -1592,7 +1580,7 @@ function ntlmsso_magic($sesskey) { return false; // Should never happen! } - $username = moodle_strtolower($username); // Compatibility hack + $username = textlib::strtolower($username); // Compatibility hack set_cache_flag($this->pluginconfig.'/ntlmsess', $sesskey, $username, AUTH_NTLMTIMEOUT); return true; } @@ -1794,8 +1782,8 @@ function process_config($config) { set_config('host_url', trim($config->host_url), $this->pluginconfig); set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig); set_config('contexts', trim($config->contexts), $this->pluginconfig); - set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig); - set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $this->pluginconfig); + set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig); + set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig); set_config('search_sub', $config->search_sub, $this->pluginconfig); set_config('opt_deref', $config->opt_deref, $this->pluginconfig); set_config('preventpassindb', $config->preventpassindb, $this->pluginconfig); @@ -1803,15 +1791,15 @@ function process_config($config) { set_config('bind_pw', $config->bind_pw, $this->pluginconfig); set_config('ldap_version', $config->ldap_version, $this->pluginconfig); set_config('objectclass', trim($config->objectclass), $this->pluginconfig); - set_config('memberattribute', moodle_strtolower(trim($config->memberattribute)), $this->pluginconfig); + set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig); set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig); set_config('creators', trim($config->creators), $this->pluginconfig); set_config('create_context', trim($config->create_context), $this->pluginconfig); set_config('expiration', $config->expiration, $this->pluginconfig); set_config('expiration_warning', trim($config->expiration_warning), $this->pluginconfig); - set_config('expireattr', moodle_strtolower(trim($config->expireattr)), $this->pluginconfig); + set_config('expireattr', textlib::strtolower(trim($config->expireattr)), $this->pluginconfig); set_config('gracelogins', $config->gracelogins, $this->pluginconfig); - set_config('graceattr', moodle_strtolower(trim($config->graceattr)), $this->pluginconfig); + set_config('graceattr', textlib::strtolower(trim($config->graceattr)), $this->pluginconfig); set_config('auth_user_create', $config->auth_user_create, $this->pluginconfig); set_config('forcechangepassword', $config->forcechangepassword, $this->pluginconfig); set_config('stdchangepassword', $config->stdchangepassword, $this->pluginconfig); diff --git a/backup/converter/moodle1/handlerlib.php b/backup/converter/moodle1/handlerlib.php index f0c97541ca95a..da87824949bb4 100644 --- a/backup/converter/moodle1/handlerlib.php +++ b/backup/converter/moodle1/handlerlib.php @@ -441,7 +441,6 @@ public function on_root_element_end() { 'users' => 0, // @todo how to detect this from moodle.xml? 'anonymize' => 0, 'role_assignments' => 0, - 'user_files' => 0, 'activities' => 1, 'blocks' => 1, 'filters' => 0, @@ -1190,8 +1189,7 @@ public function process_question(array $data, array $raw) { // replay the upgrade step 2010080901 - updating question image if (!empty($data['image'])) { - $textlib = textlib_get_instance(); - if ($textlib->substr($textlib->strtolower($data['image']), 0, 7) == 'http://') { + if (textlib::substr(textlib::strtolower($data['image']), 0, 7) == 'http://') { // it is a link, appending to existing question text $data['questiontext'] .= ' '; diff --git a/backup/converter/moodle1/lib.php b/backup/converter/moodle1/lib.php index 86e2026b579fa..e79dbfea35080 100644 --- a/backup/converter/moodle1/lib.php +++ b/backup/converter/moodle1/lib.php @@ -1161,9 +1161,6 @@ class moodle1_file_manager implements loggable { /** @var string the root of the converter temp directory */ protected $basepath; - /** @var textlib instance used during the migration */ - protected $textlib; - /** @var array of file ids that were migrated by this instance */ protected $fileids = array(); @@ -1187,7 +1184,6 @@ public function __construct(moodle1_converter $converter, $contextid = null, $co $this->userid = $userid; // set other useful bits $this->basepath = $converter->get_tempdir_path(); - $this->textlib = textlib_get_instance(); } /** @@ -1218,7 +1214,7 @@ public function migrate_file($sourcepath, $filepath = '/', $filename = null, $so } $filepath = clean_param($filepath, PARAM_PATH); - if ($this->textlib->strlen($filepath) > 255) { + if (textlib::strlen($filepath) > 255) { throw new moodle1_convert_exception('file_path_longer_than_255_chars'); } diff --git a/backup/moodle2/backup_activity_task.class.php b/backup/moodle2/backup_activity_task.class.php index f3a22b70b795e..360dd63117b52 100644 --- a/backup/moodle2/backup_activity_task.class.php +++ b/backup/moodle2/backup_activity_task.class.php @@ -16,17 +16,23 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_activity_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** - * abstract activity task that provides all the properties and common tasks to be performed - * when one activity is being backup + * Provides all the settings and steps to perform one complete backup of the activity * - * TODO: Finish phpdocs + * Activities are supposed to provide the subclass of this class in their file + * mod/MODULENAME/backup/moodle2/backup_MODULENAME_activity_task.class.php + * The expected name of the subclass is backup_MODULENAME_activity_task */ abstract class backup_activity_task extends backup_task { @@ -38,6 +44,10 @@ abstract class backup_activity_task extends backup_task { /** * Constructor - instantiates one object of this class + * + * @param string $name the task identifier + * @param int $moduleid course module id (id in course_modules table) + * @param backup_plan|null $plan the backup plan instance this task is part of */ public function __construct($name, $moduleid, $plan = null) { @@ -59,28 +69,43 @@ public function __construct($name, $moduleid, $plan = null) { parent::__construct($name, $plan); } + /** + * @return int the course module id (id in the course_modules table) + */ public function get_moduleid() { return $this->moduleid; } + /** + * @return int the course section id (id in the course_sections table) + */ public function get_sectionid() { return $this->sectionid; } + /** + * @return string the name of the module, eg 'workshop' (from the modules table) + */ public function get_modulename() { return $this->modulename; } + /** + * @return int the id of the activity instance (id in the activity's instances table) + */ public function get_activityid() { return $this->activityid; } + /** + * @return int the id of the associated CONTEXT_MODULE instance + */ public function get_contextid() { return $this->contextid; } /** - * Activity tasks have their own directory to write files + * @return string full path to the directory where this task writes its files */ public function get_taskbasepath() { return $this->get_basepath() . '/activities/' . $this->modulename . '_' . $this->moduleid; @@ -184,9 +209,11 @@ public function execute() { /** - * Specialisation that, first of all, looks for the setting within - * the task with the the prefix added and later, delegates to parent - * without adding anything + * Tries to look for the instance specific setting value, task specific setting value or the + * common plan setting value - in that order + * + * @param string $name the name of the setting + * @return mixed|null the value of the setting or null if not found */ public function get_setting($name) { $namewithprefix = $this->modulename . '_' . $this->moduleid . '_' . $name; @@ -211,7 +238,7 @@ public function get_setting($name) { // Protected API starts here /** - * Define the common setting that any backup activity will have + * Defines the common setting that any backup activity will have */ protected function define_settings() { @@ -264,21 +291,44 @@ protected function define_settings() { } /** - * Define (add) particular settings that each activity can have + * Defines activity specific settings to be added to the common ones + * + * This method is called from {@link self::define_settings()}. The activity module + * author may use it to define additional settings that influence the execution of + * the backup. + * + * Most activities just leave the method empty. + * + * @see self::define_settings() for the example how to define own settings */ abstract protected function define_my_settings(); /** - * Define (add) particular steps that each activity can have + * Defines activity specific steps for this task + * + * This method is called from {@link self::build()}. Activities are supposed + * to call {self::add_step()} in it to include their specific steps in the + * backup plan. */ abstract protected function define_my_steps(); /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the activity instance's scripts into a site-independent form + * + * The current instance of the activity may be referenced from other places in + * the course by URLs like http://my.moodle.site/mod/workshop/view.php?id=42 + * Obvisouly, such URLs are not valid any more once the course is restored elsewhere. + * For this reason the backup file does not store the original URLs but encodes them + * into a transportable form. During the restore, the reverse process is applied and + * the encoded URLs are replaced with the new ones valid for the target site. + * + * Every plugin must override this method in its subclass. + * + * @see backup_xml_transformer class that actually runs the transformation + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { throw new coding_exception('encode_content_links() method needs to be overridden in each subclass of backup_activity_task'); } - } diff --git a/backup/moodle2/backup_block_task.class.php b/backup/moodle2/backup_block_task.class.php index 7d3f26e54c716..91e025378163d 100644 --- a/backup/moodle2/backup_block_task.class.php +++ b/backup/moodle2/backup_block_task.class.php @@ -16,12 +16,15 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * abstract block task that provides all the properties and common steps to be performed * when one block is being backup diff --git a/backup/moodle2/backup_course_task.class.php b/backup/moodle2/backup_course_task.class.php index 070506cef7a76..8c35274912c54 100644 --- a/backup/moodle2/backup_course_task.class.php +++ b/backup/moodle2/backup_course_task.class.php @@ -16,10 +16,13 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_course_task + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** diff --git a/backup/moodle2/backup_coursereport_plugin.class.php b/backup/moodle2/backup_coursereport_plugin.class.php index 8d89b31326cbc..ceab0838d4bc2 100644 --- a/backup/moodle2/backup_coursereport_plugin.class.php +++ b/backup/moodle2/backup_coursereport_plugin.class.php @@ -24,10 +24,11 @@ * backed up, a course report should make use of the second and third * parameters in get_plugin_element(). * - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 onwards The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 onwards The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class backup_coursereport_plugin extends backup_plugin { // Use default parent behaviour diff --git a/backup/moodle2/backup_custom_fields.php b/backup/moodle2/backup_custom_fields.php index d899a65ef32ca..e0ceb334d95d4 100644 --- a/backup/moodle2/backup_custom_fields.php +++ b/backup/moodle2/backup_custom_fields.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines various element classes used in specific areas + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Implementation of backup_final_element that provides one interceptor for anonymization of data * diff --git a/backup/moodle2/backup_default_block_task.class.php b/backup/moodle2/backup_default_block_task.class.php index b3f5eaeea609f..4b12633690f10 100644 --- a/backup/moodle2/backup_default_block_task.class.php +++ b/backup/moodle2/backup_default_block_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_default_block_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Default block task to backup blocks that haven't own DB structures to be added * when one block is being backup diff --git a/backup/moodle2/backup_final_task.class.php b/backup/moodle2/backup_final_task.class.php index 78bab3ce630b7..abbecb8be797e 100644 --- a/backup/moodle2/backup_final_task.class.php +++ b/backup/moodle2/backup_final_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_final_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Final task that provides all the final steps necessary in order to finish one * backup (mainly gathering references and creating the main xml) apart from @@ -59,7 +64,7 @@ public function build() { // done in a single pass $this->add_step(new backup_annotate_all_question_files('question_files')); - // Annotate all the user files (conditionally) (private, profile and icon files) + // Annotate all the user files (conditionally) (profile and icon files) // Because each user has its own context, we need a separate/specialised step here // This step also ensures that the contexts for all the users exist, so next // step can be safely executed (join between users and contexts) diff --git a/backup/moodle2/backup_format_plugin.class.php b/backup/moodle2/backup_format_plugin.class.php index d1af1b923f417..978c69a5e92e9 100644 --- a/backup/moodle2/backup_format_plugin.class.php +++ b/backup/moodle2/backup_format_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_format_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class extending standard backup_plugin in order to implement some * helper methods related with the course formats (format plugin) diff --git a/backup/moodle2/backup_gradingform_plugin.class.php b/backup/moodle2/backup_gradingform_plugin.class.php index a06412a5466f0..7fd4029681d53 100644 --- a/backup/moodle2/backup_gradingform_plugin.class.php +++ b/backup/moodle2/backup_gradingform_plugin.class.php @@ -16,10 +16,13 @@ // along with Moodle. If not, see . /** - * @package core - * @subpackage backup-moodle2 - * @copyright 2011 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_gradingform_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); @@ -28,5 +31,4 @@ * Base class for all advanced grading form plugins */ abstract class backup_gradingform_plugin extends backup_plugin { - } diff --git a/backup/moodle2/backup_plagiarism_plugin.class.php b/backup/moodle2/backup_plagiarism_plugin.class.php index 17a1d23adc30e..86b3cc2aa1abc 100644 --- a/backup/moodle2/backup_plagiarism_plugin.class.php +++ b/backup/moodle2/backup_plagiarism_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_plagiarism_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class extending standard backup_plugin in order to implement some * helper methods related with the plagiarism plugins (plagiarism plugin) diff --git a/backup/moodle2/backup_plan_builder.class.php b/backup/moodle2/backup_plan_builder.class.php index 0342462ffe0eb..d7a1f0aed752e 100644 --- a/backup/moodle2/backup_plan_builder.class.php +++ b/backup/moodle2/backup_plan_builder.class.php @@ -16,10 +16,13 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_plan_builder class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/backup/moodle2/backup_plugin.class.php b/backup/moodle2/backup_plugin.class.php index da0abfa0cac0b..6a060abf8fbc5 100644 --- a/backup/moodle2/backup_plugin.class.php +++ b/backup/moodle2/backup_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class implementing the plugins support for moodle2 backups * diff --git a/backup/moodle2/backup_qtype_plugin.class.php b/backup/moodle2/backup_qtype_plugin.class.php index 5d940c55f87ca..c6839a7094caa 100644 --- a/backup/moodle2/backup_qtype_plugin.class.php +++ b/backup/moodle2/backup_qtype_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_qtype_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class extending standard backup_plugin in order to implement some * helper methods related with the questions (qtype plugin) diff --git a/backup/moodle2/backup_report_plugin.class.php b/backup/moodle2/backup_report_plugin.class.php index fbc2174744e9c..8f2b34fe50430 100644 --- a/backup/moodle2/backup_report_plugin.class.php +++ b/backup/moodle2/backup_report_plugin.class.php @@ -24,10 +24,11 @@ * backed up, a report should make use of the second and third * parameters in get_plugin_element(). * - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 Petr Skoda - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 Petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class backup_report_plugin extends backup_plugin { // Use default parent behaviour diff --git a/backup/moodle2/backup_root_task.class.php b/backup/moodle2/backup_root_task.class.php index af710e1dd2227..011a7b5f602c1 100644 --- a/backup/moodle2/backup_root_task.class.php +++ b/backup/moodle2/backup_root_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_root_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Start task that provides all the settings common to all backups and some initialization steps * @@ -91,13 +96,6 @@ protected function define_settings() { $this->add_setting($roleassignments); $users->add_dependency($roleassignments); - // Define user_files (dependent of users and anonymize) - $userfiles = new backup_user_files_setting('user_files', base_setting::IS_BOOLEAN, true); - $userfiles->set_ui(new backup_setting_ui_checkbox($userfiles, get_string('rootsettinguserfiles', 'backup'))); - $this->add_setting($userfiles); - $users->add_dependency($userfiles); - $anonymize->add_dependency($userfiles, setting_dependency::DISABLED_TRUE); - // Define activities $activities = new backup_activities_setting('activities', base_setting::IS_BOOLEAN, true); $activities->set_ui(new backup_setting_ui_checkbox($activities, get_string('rootsettingactivities', 'backup'))); diff --git a/backup/moodle2/backup_section_task.class.php b/backup/moodle2/backup_section_task.class.php index 8986d8c5f95d1..ab4b4c8a10daa 100644 --- a/backup/moodle2/backup_section_task.class.php +++ b/backup/moodle2/backup_section_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_section_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * section task that provides all the properties and common steps to be performed * when one section is being backup diff --git a/backup/moodle2/backup_settingslib.php b/backup/moodle2/backup_settingslib.php index 6614aee4e1416..31e3c7374f14c 100644 --- a/backup/moodle2/backup_settingslib.php +++ b/backup/moodle2/backup_settingslib.php @@ -16,10 +16,13 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines classes used to handle backup settings + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ // TODO: Reduce these to the minimum because ui/dependencies are 100% separated @@ -36,6 +39,15 @@ class backup_generic_setting extends root_backup_setting {} */ class backup_filename_setting extends backup_generic_setting { + /** + * Instantiates a setting object + * + * @param string $name Name of the setting + * @param string $vtype Type of the setting, eg {@link base_setting::IS_TEXT} + * @param mixed $value Value of the setting + * @param bool $visibility Is the setting visible in the UI, eg {@link base_setting::VISIBLE} + * @param int $status Status of the setting with regards to the locking, eg {@link base_setting::NOT_LOCKED} + */ public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) { parent::__construct($name, $vtype, $value, $visibility, $status); } @@ -68,13 +80,6 @@ class backup_activities_setting extends backup_generic_setting {} */ class backup_anonymize_setting extends root_backup_setting {} -/** - * root setting to control if backup will include - * user files or no (images, local storage), depends of @backup_users_setting - * exactly in the same way than @backup_anonymize_setting so we extend from it - */ -class backup_user_files_setting extends backup_anonymize_setting {} - /** * root setting to control if backup will include * role assignments or no (any level), depends of @backup_users_setting diff --git a/backup/moodle2/backup_stepslib.php b/backup/moodle2/backup_stepslib.php index 8454934ba0805..78d272144ee90 100644 --- a/backup/moodle2/backup_stepslib.php +++ b/backup/moodle2/backup_stepslib.php @@ -16,15 +16,16 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines various backup steps that will be used by common tasks in backup + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -/** - * Define all the backup steps that will be used by common tasks in backup - */ +defined('MOODLE_INTERNAL') || die(); /** * create the temp dir where backup/restore will happen, @@ -98,6 +99,7 @@ abstract class backup_activity_structure_step extends backup_structure_step { * we are going to add subplugin information to * @param bool $multiple to define if multiple subplugins can produce information * for each instance of $element (true) or no (false) + * @return void */ protected function add_subplugin_structure($subplugintype, $element, $multiple) { @@ -135,6 +137,8 @@ protected function add_subplugin_structure($subplugintype, $element, $multiple) /** * As far as activity backup steps are implementing backup_subplugin stuff, they need to * have the parent task available for wrapping purposes (get course/context....) + * + * @return backup_activity_task */ public function get_task() { return $this->task; @@ -143,6 +147,9 @@ public function get_task() { /** * Wraps any activity backup structure within the common 'activity' element * that will include common to all activities information like id, context... + * + * @param backup_nested_element $activitystructure the element to wrap + * @return backup_nested_element the $activitystructure wrapped by the common 'activity' element */ protected function prepare_activity_structure($activitystructure) { @@ -1761,10 +1768,6 @@ protected function define_execution() { // List of fileareas we are going to annotate $fileareas = array('profile', 'icon'); - if ($this->get_setting_value('user_files')) { // private files only if enabled in settings - $fileareas[] = 'private'; - } - // Fetch all annotated (final) users $rs = $DB->get_recordset('backup_ids_temp', array( 'backupid' => $this->get_backupid(), 'itemname' => 'userfinal')); diff --git a/backup/moodle2/backup_subplugin.class.php b/backup/moodle2/backup_subplugin.class.php index ca3e953d3fcb7..7cb30e3896c03 100644 --- a/backup/moodle2/backup_subplugin.class.php +++ b/backup/moodle2/backup_subplugin.class.php @@ -16,12 +16,16 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_subplugin class + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class implementing the subplugins support for moodle2 backups * diff --git a/backup/moodle2/backup_theme_plugin.class.php b/backup/moodle2/backup_theme_plugin.class.php index d4a3a098f3cb6..7978c527fbec3 100644 --- a/backup/moodle2/backup_theme_plugin.class.php +++ b/backup/moodle2/backup_theme_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 onwards The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_theme_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 onwards The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Base class for theme backup plugins. * diff --git a/backup/moodle2/backup_xml_transformer.class.php b/backup/moodle2/backup_xml_transformer.class.php index f0be3cd6e380a..a3770d035289d 100644 --- a/backup/moodle2/backup_xml_transformer.class.php +++ b/backup/moodle2/backup_xml_transformer.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_xml_transformer class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class implementing the @xml_contenttrasnformed logic to be applied in moodle2 backups * diff --git a/backup/moodle2/restore_activity_task.class.php b/backup/moodle2/restore_activity_task.class.php index 50f305dbdc2dc..4872fc092627b 100644 --- a/backup/moodle2/restore_activity_task.class.php +++ b/backup/moodle2/restore_activity_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_activity_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * abstract activity task that provides all the properties and common tasks to be performed * when one activity is being restored diff --git a/backup/moodle2/restore_block_task.class.php b/backup/moodle2/restore_block_task.class.php index d4715d7bffa3e..64e5b9946986b 100644 --- a/backup/moodle2/restore_block_task.class.php +++ b/backup/moodle2/restore_block_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_block_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * abstract block task that provides all the properties and common steps to be performed * when one block is being restored diff --git a/backup/moodle2/restore_course_task.class.php b/backup/moodle2/restore_course_task.class.php index 1ab98bf330667..87828b4cbb8e8 100644 --- a/backup/moodle2/restore_course_task.class.php +++ b/backup/moodle2/restore_course_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_course_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * course task that provides all the properties and common steps to be performed * when one course is being restored diff --git a/backup/moodle2/restore_coursereport_plugin.class.php b/backup/moodle2/restore_coursereport_plugin.class.php index 9a94e234d17b7..af0ebb048b6b0 100644 --- a/backup/moodle2/restore_coursereport_plugin.class.php +++ b/backup/moodle2/restore_coursereport_plugin.class.php @@ -19,10 +19,11 @@ /** * Restore for course plugin: course report. * - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class restore_coursereport_plugin extends restore_plugin { // Use default parent behaviour diff --git a/backup/moodle2/restore_default_block_task.class.php b/backup/moodle2/restore_default_block_task.class.php index c3267a2d0d0d9..78c3577041000 100644 --- a/backup/moodle2/restore_default_block_task.class.php +++ b/backup/moodle2/restore_default_block_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_default_block_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Default block task to restore blocks not having own DB structures to be added * diff --git a/backup/moodle2/restore_final_task.class.php b/backup/moodle2/restore_final_task.class.php index cebf2ea9e113f..09a9db32031e7 100644 --- a/backup/moodle2/restore_final_task.class.php +++ b/backup/moodle2/restore_final_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_final_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Final task that provides all the final steps necessary in order to finish one * restore like gradebook, interlinks... apart from some final cleaning diff --git a/backup/moodle2/restore_format_plugin.class.php b/backup/moodle2/restore_format_plugin.class.php index 454d3a80d7419..ce7f030f1103d 100644 --- a/backup/moodle2/restore_format_plugin.class.php +++ b/backup/moodle2/restore_format_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_format_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class extending standard restore_plugin in order to implement some * helper methods related with the course formats (format plugin) diff --git a/backup/moodle2/restore_gradingform_plugin.class.php b/backup/moodle2/restore_gradingform_plugin.class.php index ff7f9985a34cc..6caa7dcd3b105 100644 --- a/backup/moodle2/restore_gradingform_plugin.class.php +++ b/backup/moodle2/restore_gradingform_plugin.class.php @@ -16,10 +16,12 @@ // along with Moodle. If not, see . /** - * @package core - * @subpackage backup-moodle2 - * @copyright 2011 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_gradingform_plugin class + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/backup/moodle2/restore_plagiarism_plugin.class.php b/backup/moodle2/restore_plagiarism_plugin.class.php index 039d117b783ae..6b80a41e7dfde 100644 --- a/backup/moodle2/restore_plagiarism_plugin.class.php +++ b/backup/moodle2/restore_plagiarism_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_plagiarism_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class extending standard restore_plugin in order to implement some * helper methods related with the plagiarism plugins diff --git a/backup/moodle2/restore_plan_builder.class.php b/backup/moodle2/restore_plan_builder.class.php index 22511ceb70389..faf4a1271f28a 100644 --- a/backup/moodle2/restore_plan_builder.class.php +++ b/backup/moodle2/restore_plan_builder.class.php @@ -16,10 +16,13 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_plan_builder class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/backup/moodle2/restore_plugin.class.php b/backup/moodle2/restore_plugin.class.php index 5ed177ea5f5f4..d85790b6bd06f 100644 --- a/backup/moodle2/restore_plugin.class.php +++ b/backup/moodle2/restore_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class implementing the plugins support for moodle2 restore * diff --git a/backup/moodle2/restore_qtype_plugin.class.php b/backup/moodle2/restore_qtype_plugin.class.php index 42c6c1d9910e7..40b06ac51a247 100644 --- a/backup/moodle2/restore_qtype_plugin.class.php +++ b/backup/moodle2/restore_qtype_plugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_qtype_plugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class extending standard restore_plugin in order to implement some * helper methods related with the questions (qtype plugin) diff --git a/backup/moodle2/restore_report_plugin.class.php b/backup/moodle2/restore_report_plugin.class.php index 7db2151b159e7..bc42c89655f64 100644 --- a/backup/moodle2/restore_report_plugin.class.php +++ b/backup/moodle2/restore_report_plugin.class.php @@ -19,10 +19,11 @@ /** * Restore for plugin report. * - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 Petr Skoda - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 Petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class restore_report_plugin extends restore_plugin { // Use default parent behaviour diff --git a/backup/moodle2/restore_root_task.class.php b/backup/moodle2/restore_root_task.class.php index a5163e969a7ec..319fe08ccd7a2 100644 --- a/backup/moodle2/restore_root_task.class.php +++ b/backup/moodle2/restore_root_task.class.php @@ -16,12 +16,16 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_root_task class + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Start task that provides all the settings common to all restores and other initial steps * @@ -121,19 +125,6 @@ protected function define_settings() { $this->add_setting($roleassignments); $users->add_dependency($roleassignments); - // Define user_files (dependent of users) - $defaultvalue = false; // Safer default - $changeable = false; - if (isset($rootsettings['user_files']) && $rootsettings['user_files']) { // Only enabled when available - $defaultvalue = true; - $changeable = true; - } - $userfiles = new restore_user_files_setting('user_files', base_setting::IS_BOOLEAN, $defaultvalue); - $userfiles->set_ui(new backup_setting_ui_checkbox($userfiles, get_string('rootsettinguserfiles', 'backup'))); - $userfiles->get_ui()->set_changeable($changeable); - $this->add_setting($userfiles); - $users->add_dependency($userfiles); - // Define activitites $defaultvalue = false; // Safer default $changeable = false; diff --git a/backup/moodle2/restore_section_task.class.php b/backup/moodle2/restore_section_task.class.php index 5c03bcb7b8502..9d48778fed1f6 100644 --- a/backup/moodle2/restore_section_task.class.php +++ b/backup/moodle2/restore_section_task.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_section_task class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * section task that provides all the properties and common steps to be performed * when one section is being restored @@ -71,11 +76,9 @@ public function build() { // Define the task contextid (the course one) $this->contextid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id; - // Executed conditionally if restoring to new course or deleting or if overwrite_conf setting is enabled - if ($this->get_target() == backup::TARGET_NEW_COURSE || $this->get_target() == backup::TARGET_CURRENT_DELETING || - $this->get_target() == backup::TARGET_EXISTING_DELETING || $this->get_setting_value('overwrite_conf') == true) { - $this->add_step(new restore_section_structure_step('course_info', 'section.xml')); - } + // We always try to restore as much info from sections as possible, no matter of the type + // of restore (new, existing, deleting, import...). MDL-27764 + $this->add_step(new restore_section_structure_step('course_info', 'section.xml')); // At the end, mark it as built $this->built = true; diff --git a/backup/moodle2/restore_settingslib.php b/backup/moodle2/restore_settingslib.php index 6d8b162609a80..09f92fe0d3446 100644 --- a/backup/moodle2/restore_settingslib.php +++ b/backup/moodle2/restore_settingslib.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines classes used to handle restore settings + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // TODO: Reduce these to the minimum because ui/dependencies are 100% separated // Root restore settings @@ -44,13 +49,6 @@ class restore_users_setting extends restore_generic_setting {} */ class restore_role_assignments_setting extends root_backup_setting {} -/** - * root setting to control if restore will create - * user files or no (images, local storage), depends of @restore_users_setting - * exactly in the same way than @restore_role_assignments_setting so we extend from it - */ -class restore_user_files_setting extends restore_role_assignments_setting {} - /** * root setting to control if restore will create activities * A lot of other settings (_included at activity levels) diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index acf17be39b0b7..58048ec59a255 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -16,15 +16,16 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines various restore steps that will be used by common tasks in restore + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -/** - * Define all the restore steps that will be used by common tasks in restore - */ +defined('MOODLE_INTERNAL') || die(); /** * delete old directories and conditionally create backup_temp_ids table @@ -683,7 +684,7 @@ class restore_create_included_users extends restore_execution_step { protected function define_execution() { - restore_dbops::create_included_users($this->get_basepath(), $this->get_restoreid(), $this->get_setting_value('user_files'), $this->task->get_userid()); + restore_dbops::create_included_users($this->get_basepath(), $this->get_restoreid(), $this->task->get_userid()); } } diff --git a/backup/moodle2/restore_subplugin.class.php b/backup/moodle2/restore_subplugin.class.php index 8972e358405e2..bf21779f4fe7b 100644 --- a/backup/moodle2/restore_subplugin.class.php +++ b/backup/moodle2/restore_subplugin.class.php @@ -16,12 +16,17 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines restore_subplugin class + * + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Class implementing the subplugins support for moodle2 restore * diff --git a/backup/moodle2/restore_theme_plugin.class.php b/backup/moodle2/restore_theme_plugin.class.php index 84931947dd57b..1935d448488d2 100644 --- a/backup/moodle2/restore_theme_plugin.class.php +++ b/backup/moodle2/restore_theme_plugin.class.php @@ -19,10 +19,11 @@ /** * Restore for course plugin: theme. * - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2011 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_backup + * @subpackage moodle2 + * @category backup + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class restore_theme_plugin extends restore_plugin { // Use default parent behaviour diff --git a/backup/restorelib.php b/backup/restorelib.php index 6eba7761df643..911df714a71bf 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -226,7 +226,7 @@ function restore_create_messages($restore,$xml_file) { //Process contacts if ($contactcount) { if (!defined('RESTORE_SILENTLY')) { - echo '
  • '.moodle_strtolower(get_string('contacts','message')).'
  • '; + echo '
  • '.textlib::strtolower(get_string('contacts','message')).'
  • '; } $counter = 0; while ($counter < $contactcount) { diff --git a/backup/util/dbops/backup_controller_dbops.class.php b/backup/util/dbops/backup_controller_dbops.class.php index cd89d82f55fe3..dffdb8d73a06e 100644 --- a/backup/util/dbops/backup_controller_dbops.class.php +++ b/backup/util/dbops/backup_controller_dbops.class.php @@ -440,7 +440,6 @@ private static function apply_general_config_defaults(backup_controller $control 'backup_general_users' => 'users', 'backup_general_anonymize' => 'anonymize', 'backup_general_role_assignments' => 'role_assignments', - 'backup_general_user_files' => 'user_files', 'backup_general_activities' => 'activities', 'backup_general_blocks' => 'blocks', 'backup_general_filters' => 'filters', diff --git a/backup/util/dbops/backup_plan_dbops.class.php b/backup/util/dbops/backup_plan_dbops.class.php index f6e25b7f49890..2ce9434ee3d39 100644 --- a/backup/util/dbops/backup_plan_dbops.class.php +++ b/backup/util/dbops/backup_plan_dbops.class.php @@ -204,7 +204,7 @@ public static function get_default_backup_filename($format, $type, $id, $users, global $DB; // Calculate backup word - $backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename'))); + $backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename'))); $backupword = trim(clean_filename($backupword), '_'); $shortname = ''; @@ -228,7 +228,7 @@ public static function get_default_backup_filename($format, $type, $id, $users, break; } $shortname = str_replace(' ', '_', $shortname); - $shortname = moodle_strtolower(trim(clean_filename($shortname), '_')); + $shortname = textlib::strtolower(trim(clean_filename($shortname), '_')); } $name = empty($shortname) ? $id : $shortname; @@ -236,7 +236,7 @@ public static function get_default_backup_filename($format, $type, $id, $users, // Calculate date $backupdateformat = str_replace(' ', '_', get_string('backupnameformat', 'langconfig')); $date = userdate(time(), $backupdateformat, 99, false); - $date = moodle_strtolower(trim(clean_filename($date), '_')); + $date = textlib::strtolower(trim(clean_filename($date), '_')); // Calculate info $info = ''; diff --git a/backup/util/dbops/restore_dbops.class.php b/backup/util/dbops/restore_dbops.class.php index 58342b2a59a20..25f2e533d1c4d 100644 --- a/backup/util/dbops/restore_dbops.class.php +++ b/backup/util/dbops/restore_dbops.class.php @@ -730,7 +730,7 @@ public static function send_files_to_pool($basepath, $restoreid, $component, $fi * ready to be created. Also, annotate their newids * once created for later reference */ - public static function create_included_users($basepath, $restoreid, $userfiles, $userid) { + public static function create_included_users($basepath, $restoreid, $userid) { global $CFG, $DB; $authcache = array(); // Cache to get some bits from authentication plugins @@ -871,10 +871,6 @@ public static function create_included_users($basepath, $restoreid, $userfiles, // Create user files in pool (profile, icon, private) by context restore_dbops::send_files_to_pool($basepath, $restoreid, 'user', 'icon', $recuser->parentitemid, $userid); restore_dbops::send_files_to_pool($basepath, $restoreid, 'user', 'profile', $recuser->parentitemid, $userid); - if ($userfiles) { // private files only if enabled in settings - restore_dbops::send_files_to_pool($basepath, $restoreid, 'user', 'private', $recuser->parentitemid, $userid); - } - } } $rs->close(); diff --git a/backup/util/helper/backup_cron_helper.class.php b/backup/util/helper/backup_cron_helper.class.php index 8631be6488df6..32ab61e3a1c6a 100644 --- a/backup/util/helper/backup_cron_helper.class.php +++ b/backup/util/helper/backup_cron_helper.class.php @@ -323,7 +323,6 @@ public static function launch_automated_backup($course, $starttime, $userid) { $settings = array( 'users' => 'backup_auto_users', 'role_assignments' => 'backup_auto_role_assignments', - 'user_files' => 'backup_auto_user_files', 'activities' => 'backup_auto_activities', 'blocks' => 'backup_auto_blocks', 'filters' => 'backup_auto_filters', @@ -460,7 +459,7 @@ public static function remove_excess_backups($course) { $storage = $config->backup_auto_storage; $dir = $config->backup_auto_destination; - $backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename'))); + $backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename'))); $backupword = trim(clean_filename($backupword), '_'); if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) { diff --git a/backup/util/settings/backup_setting.class.php b/backup/util/settings/backup_setting.class.php index 2d19245fda7e5..8b6c3f07964dc 100644 --- a/backup/util/settings/backup_setting.class.php +++ b/backup/util/settings/backup_setting.class.php @@ -16,16 +16,18 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-settings - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_setting class + * + * @package core_backup + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** - * This abstract class defines one backup_setting - * - * TODO: Finish phpdocs + * Parent class for all backup settings */ abstract class backup_setting extends base_setting implements checksumable { @@ -35,12 +37,12 @@ abstract class backup_setting extends base_setting implements checksumable { const SECTION_LEVEL = 9; const ACTIVITY_LEVEL = 13; + /** @var int Level of the setting, eg {@link self::ROOT_LEVEL} */ + protected $level; + /** - * One of the above constants - * @var {int} + * {@inheritdoc} */ - protected $level; // level of the setting - public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) { parent::__construct($name, $vtype, $value, $visibility, $status); // Generate a default ui @@ -48,9 +50,7 @@ public function __construct($name, $vtype, $value = null, $visibility = self::VI } /** - * Returns the level of the setting - * - * @return {int} One of the above constants + * @return int Level of the setting, eg {@link self::ROOT_LEVEL} */ public function get_level() { return $this->level; @@ -112,7 +112,7 @@ public function is_checksum_correct($checksum) { } } -/* +/** * Exception class used by all the @backup_setting stuff */ class backup_setting_exception extends base_setting_exception { diff --git a/backup/util/settings/base_setting.class.php b/backup/util/settings/base_setting.class.php index 82e6eb1b1d9ec..765c6ac1aab77 100644 --- a/backup/util/settings/base_setting.class.php +++ b/backup/util/settings/base_setting.class.php @@ -86,6 +86,15 @@ abstract class base_setting { */ protected $help = array(); + /** + * Instantiates a setting object + * + * @param string $name Name of the setting + * @param string $vtype Type of the setting, eg {@link self::IS_TEXT} + * @param mixed $value Value of the setting + * @param bool $visibility Is the setting visible in the UI, eg {@link self::VISIBLE} + * @param int $status Status of the setting with regards to the locking, eg {@link self::NOT_LOCKED} + */ public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) { // Check vtype if ($vtype !== self::IS_BOOLEAN && $vtype !== self::IS_INTEGER && @@ -294,7 +303,7 @@ public function register_dependency(setting_dependency $dependency) { if ($this->is_circular_reference($dependency->get_dependent_setting())) { $a = new stdclass(); $a->alreadydependent = $this->name; - $a->main = $dependentsetting->get_name(); + $a->main = $dependency->get_dependent_setting()->get_name(); throw new base_setting_exception('setting_circular_reference', $a); } $this->dependencies[$dependency->get_dependent_setting()->get_name()] = $dependency; diff --git a/backup/util/settings/root/root_backup_setting.class.php b/backup/util/settings/root/root_backup_setting.class.php index 62a0f1740bf8c..7b459e6f30598 100644 --- a/backup/util/settings/root/root_backup_setting.class.php +++ b/backup/util/settings/root/root_backup_setting.class.php @@ -16,19 +16,24 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-settings - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines root_backup_setting class + * + * @package core_backup + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Abstract class containing all the common stuff for root backup settings - * - * TODO: Finish phpdocs */ abstract class root_backup_setting extends backup_setting { + /** + * {@inheritdoc} + */ public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) { $this->level = self::ROOT_LEVEL; parent::__construct($name, $vtype, $value, $visibility, $status); diff --git a/backup/util/settings/simpletest/testsettings.php b/backup/util/settings/simpletest/testsettings.php index fd079cc62c909..7d0d8a794fd3f 100644 --- a/backup/util/settings/simpletest/testsettings.php +++ b/backup/util/settings/simpletest/testsettings.php @@ -32,10 +32,12 @@ require_once($CFG->dirroot . '/backup/backup.class.php'); require_once($CFG->dirroot . '/backup/util/settings/base_setting.class.php'); require_once($CFG->dirroot . '/backup/util/settings/backup_setting.class.php'); +require_once($CFG->dirroot . '/backup/util/settings/setting_dependency.class.php'); require_once($CFG->dirroot . '/backup/util/settings/root/root_backup_setting.class.php'); require_once($CFG->dirroot . '/backup/util/settings/activity/activity_backup_setting.class.php'); require_once($CFG->dirroot . '/backup/util/settings/section/section_backup_setting.class.php'); require_once($CFG->dirroot . '/backup/util/settings/course/course_backup_setting.class.php'); +require_once($CFG->dirroot . '/backup/util/ui/backup_ui_setting.class.php'); /* * setting tests (all) @@ -209,6 +211,21 @@ function test_base_setting() { $this->assertEqual($e->a->alreadydependent, 'test4'); } + $bs1 = new mock_base_setting('test1', base_setting::IS_INTEGER, null); + $bs2 = new mock_base_setting('test2', base_setting::IS_INTEGER, null); + $bs1->register_dependency(new setting_dependency_disabledif_empty($bs1, $bs2)); + try { + // $bs1 is already dependent on $bs2 so this should fail. + $bs2->register_dependency(new setting_dependency_disabledif_empty($bs2, $bs1)); + $this->assertTrue(false, 'base_setting_exception expected'); + } catch (exception $e) { + $this->assertTrue($e instanceof base_setting_exception); + $this->assertEqual($e->errorcode, 'setting_circular_reference'); + $this->assertTrue($e->a instanceof stdclass); + $this->assertEqual($e->a->main, 'test1'); + $this->assertEqual($e->a->alreadydependent, 'test2'); + } + // Create 3 settings and observe between them, last one must // automatically inherit all the settings defined in the main one $bs1 = new mock_base_setting('test1', base_setting::IS_INTEGER, null); diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php index 08454409e316c..7afcdfd368af4 100644 --- a/backup/util/ui/renderer.php +++ b/backup/util/ui/renderer.php @@ -97,7 +97,9 @@ public function backup_details($details, $nextstageurl) { $html .= html_writer::start_tag('div', array('class'=>'backup-section settings-section')); $html .= $this->output->heading(get_string('backupsettings', 'backup'), 2, array('class'=>'header')); foreach ($details->root_settings as $label=>$value) { - if ($label == 'filename') continue; + if ($label == 'filename' or $label == 'user_files') { + continue; + } $html .= $this->backup_detail_pair(get_string('rootsetting'.str_replace('_','',$label), 'backup'), $value?$yestick:$notick); } $html .= html_writer::end_tag('div'); @@ -568,6 +570,12 @@ public function render_import_course_search(import_course_search $component) { $output = html_writer::start_tag('div', array('class' => 'import-course-search')); if ($component->get_count() === 0) { $output .= $this->output->notification(get_string('nomatchingcourses', 'backup')); + + $output .= html_writer::start_tag('div', array('class'=>'ics-search')); + $output .= html_writer::empty_tag('input', array('type'=>'text', 'name'=>restore_course_search::$VAR_SEARCH, 'value'=>$component->get_search())); + $output .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'searchcourses', 'value'=>get_string('search'))); + $output .= html_writer::end_tag('div'); + $output .= html_writer::end_tag('div'); return $output; } diff --git a/backup/util/ui/restore_ui_components.php b/backup/util/ui/restore_ui_components.php index adae38a6474f8..b95681dee5afc 100644 --- a/backup/util/ui/restore_ui_components.php +++ b/backup/util/ui/restore_ui_components.php @@ -164,22 +164,37 @@ final public function search() { $this->totalcount = 0; $contextlevel = $this->get_itemcontextlevel(); list($sql, $params) = $this->get_searchsql(); - $resultset = $DB->get_recordset_sql($sql, $params, 0, 250); - foreach ($resultset as $result) { - context_instance_preload($result); - $context = get_context_instance($contextlevel, $result->id); - if (count($this->requiredcapabilities) > 0) { - foreach ($this->requiredcapabilities as $cap) { - if (!has_capability($cap['capability'], $context, $cap['user'])) { - continue 2; + $blocksz = 5000; + $offs = 0; + // Get total number, to avoid some incorrect iterations + $countsql = preg_replace('/ORDER BY.*/', '', $sql); + $totalcourses = $DB->count_records_sql("SELECT COUNT(*) FROM ($countsql) sel", $params); + // User to be checked is always the same (usually null, get it form first element) + $firstcap = reset($this->requiredcapabilities); + $userid = isset($firstcap['user']) ? $firstcap['user'] : null; + // Extract caps to check, this saves us a bunch of iterations + $requiredcaps = array(); + foreach ($this->requiredcapabilities as $cap) { + $requiredcaps[] = $cap['capability']; + } + // Iterate while we have records and haven't reached MAXRESULTS + while ($totalcourses > $offs and $this->totalcount < self::$MAXRESULTS) { + $resultset = $DB->get_records_sql($sql, $params, $offs, $blocksz); + foreach ($resultset as $result) { + context_instance_preload($result); + $context = get_context_instance($contextlevel, $result->id); + if (count($requiredcaps) > 0) { + if (!has_all_capabilities($requiredcaps, $context, $userid)) { + continue; } } + $this->results[$result->id] = $result; + $this->totalcount++; + if ($this->totalcount >= self::$MAXRESULTS) { + break; + } } - $this->results[$result->id] = $result; - $this->totalcount++; - if ($this->totalcount >= self::$MAXRESULTS) { - break; - } + $offs += $blocksz; } return $this->totalcount; diff --git a/blocks/community/communitycourse.php b/blocks/community/communitycourse.php index 8daffbf5e1615..dbd9e075d77f5 100644 --- a/blocks/community/communitycourse.php +++ b/blocks/community/communitycourse.php @@ -128,7 +128,7 @@ $remove = optional_param('remove', '', PARAM_INTEGER); $communityid = optional_param('communityid', '', PARAM_INTEGER); if ($remove != -1 and !empty($communityid) and confirm_sesskey()) { - $communitymanager->block_community_remove_course($communityid, $USER->id); + $communitymanager->block_community_remove_course($communityid, $USER->id); echo $OUTPUT->header(); echo $renderer->remove_success(new moodle_url(get_referer(false))); echo $OUTPUT->footer(); @@ -245,4 +245,4 @@ } } -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/blocks/community/db/install.xml b/blocks/community/db/install.xml index 9803f0a9b3f8b..7ee85bb46ff81 100644 --- a/blocks/community/db/install.xml +++ b/blocks/community/db/install.xml @@ -1,13 +1,13 @@ -
    ' . $select . '
    (, ) - unsigned not null diff --git a/admin/tool/xmldb/actions/main_view/main_view.class.php b/admin/tool/xmldb/actions/main_view/main_view.class.php index c8feb613396be..30af587196202 100644 --- a/admin/tool/xmldb/actions/main_view/main_view.class.php +++ b/admin/tool/xmldb/actions/main_view/main_view.class.php @@ -277,40 +277,6 @@ function invoke() { } } } - // TODO: Drop this check in Moodle 2.1 - // Intercept loaded structure here and look for ENUM fields - if (isset($dbdir->xml_file)) { - if ($structure =& $dbdir->xml_file->getStructure()) { - if ($tables = $structure->getTables()) { - foreach ($tables as $table) { - if ($fields = $table->getFields()) { - foreach ($fields as $field) { - if (!empty($field->hasenums)) { - if ($hithis) { - $o .= '
    '; - } else { - $o .= '
    '; - } - $o .= 'Table ' . $table->getName() . ', field ' . $field->getName() . ' has ENUM info'; - if (!empty($field->hasenumsenabled)) { - $o .= ' that seems to be active (true). ENUMs support has been dropped in Moodle 2.0, ' . - ' the XMLDB Editor will delete any ENUM reference next time you save this file' . - ' and you MUST provide one upgrade block in your code to drop them from DB. See' . - ' ' . - ' Moodle Docs for more info and examples.'; - } else { - $o .= ' that seem to be inactive (false). ENUMs support has been dropped in Moodle 2.0,' . - ' the XMLDB Editor will, simply, delete any ENUM reference next time you save this file.' . - ' No further action is necessary.'; - } - $o .= '
    - - + + diff --git a/blocks/community/locallib.php b/blocks/community/locallib.php index f76088fc34ce1..5c39f75348e9b 100644 --- a/blocks/community/locallib.php +++ b/blocks/community/locallib.php @@ -82,7 +82,7 @@ public function block_community_download_course_backup($course) { global $CFG, $USER; require_once($CFG->libdir . "/filelib.php"); require_once($CFG->dirroot. "/course/publish/lib.php"); - + $params['courseid'] = $course->id; $params['filetype'] = HUB_BACKUP_FILE_TYPE; @@ -104,7 +104,7 @@ public function block_community_download_course_backup($course) { $token = $registeredhub->token; $curlurl .= '&token='.$token; } - + $ch = curl_init($curlurl); curl_setopt($ch, CURLOPT_FILE, $fp); $data = curl_exec($ch); @@ -143,4 +143,4 @@ public function block_community_remove_course($communityid, $userid) { array('userid' => $userid, 'id' => $communityid)); } -} \ No newline at end of file +} diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php index 1df8f82cb47df..4fb6c508bf03d 100644 --- a/blocks/community/renderer.php +++ b/blocks/community/renderer.php @@ -124,7 +124,7 @@ public function course_list($courses, $huburl, $contextcourseid) { //create title html $coursename = html_writer::tag('h3', $course->fullname, array('class' => 'hubcoursetitle')); - $coursenamehtml = html_writer::tag('div', $coursename, + $coursenamehtml = html_writer::tag('div', $coursename, array('class' => 'hubcoursetitlepanel')); // create screenshots html diff --git a/blocks/community/yui/imagegallery/imagegallery.js b/blocks/community/yui/imagegallery/imagegallery.js index 4671ad29ba67a..f91abb08e4203 100644 --- a/blocks/community/yui/imagegallery/imagegallery.js +++ b/blocks/community/yui/imagegallery/imagegallery.js @@ -44,12 +44,12 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { this.overlay.render(); this.overlay.hide(); - + //attach a show event on the image divs () for (var i=0;iâ†"; var nextimagelink = "
    →
    "; - + /// need to load the images in the overlay var overlay = Y.one('#imageoverlay'); overlay.setContent(''); - + overlay.append(Y.Node.create('
    ')); this.overlay.destroy(); this.overlay = new M.core.dialogue({ - headerContent:previousimagelink + '
    Image ' + headerContent:previousimagelink + '
    Image ' + screennumber + ' / ' + this.imageidnumbers[imageid] + '
    ' + nextimagelink, bodyContent:Y.one('#imageoverlay').get('innerHTML'), visible: false, //by default it is not displayed @@ -127,7 +127,7 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { if(overlaywidth > screenshot.width) { overlaywidth = screenshot.width; } - + this.overlay.set('width', overlaywidth); this.overlay.set("centered", true); this.overlay.show(); @@ -196,4 +196,4 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { }, '@VERSION@', { requires:['base','node','overlay', 'moodle-enrol-notification'] -}); \ No newline at end of file +}); diff --git a/blocks/completionstatus/block_completionstatus.php b/blocks/completionstatus/block_completionstatus.php index 7013b1292ce80..07a7b473a6c66 100644 --- a/blocks/completionstatus/block_completionstatus.php +++ b/blocks/completionstatus/block_completionstatus.php @@ -36,7 +36,7 @@ class block_completionstatus extends block_base { public function init() { - $this->title = get_string('completionstatus', 'block_completionstatus'); + $this->title = get_string('pluginname', 'block_completionstatus'); } public function get_content() { diff --git a/blocks/completionstatus/lang/en/block_completionstatus.php b/blocks/completionstatus/lang/en/block_completionstatus.php index 50bea4e88d16c..fcc965ac7fdc0 100644 --- a/blocks/completionstatus/lang/en/block_completionstatus.php +++ b/blocks/completionstatus/lang/en/block_completionstatus.php @@ -1,7 +1,6 @@ first} of {$a->second}'; $string['pluginname'] = 'Course completion status'; diff --git a/blocks/course_list/block_course_list.php b/blocks/course_list/block_course_list.php index 3c773a63e2a4b..282f9e22d07d4 100644 --- a/blocks/course_list/block_course_list.php +++ b/blocks/course_list/block_course_list.php @@ -4,7 +4,7 @@ class block_course_list extends block_list { function init() { - $this->title = get_string('courses'); + $this->title = get_string('pluginname', 'block_course_list'); } function has_config() { diff --git a/blocks/course_list/lang/en/block_course_list.php b/blocks/course_list/lang/en/block_course_list.php index a30a5c01fe9e0..4e79fc13a4bdb 100644 --- a/blocks/course_list/lang/en/block_course_list.php +++ b/blocks/course_list/lang/en/block_course_list.php @@ -29,4 +29,4 @@ $string['confighideallcourseslink'] = 'Hide "All courses" link at the bottom of the block. Link hiding does not affects Admin\'s view'; $string['hideallcourseslink'] = 'Hide All courses link'; $string['owncourses'] = 'Admin user sees own courses'; -$string['pluginname'] = 'Course list'; +$string['pluginname'] = 'Courses'; diff --git a/blocks/dock.js b/blocks/dock.js index c01445fb67f7d..5560a32d7aa7f 100644 --- a/blocks/dock.js +++ b/blocks/dock.js @@ -478,7 +478,7 @@ M.core_dock.delayEvent = function(event, options, target) { */ M.core_dock.fixTitleOrientation = function(item, title, text) { var Y = this.Y; - + var title = Y.one(title); if(M.core_dock.cfg.orientation != 'vertical') { @@ -809,7 +809,7 @@ M.core_dock.genericblock.prototype = { */ initialise_block : function(Y, node) { M.core_dock.init(Y); - + this.Y = Y; if (!node) { return false; @@ -919,7 +919,7 @@ M.core_dock.genericblock.prototype = { // Register an event so that when it is removed we can put it back as a block dockitem.on('dockeditem:itemremoved', this.return_to_block, this, dockitem); dock.add(dockitem); - + if (!this.skipsetposition) { // save the users preference M.util.set_user_preference('docked_block_instance_'+this.id, 1); diff --git a/blocks/html/lib.php b/blocks/html/lib.php index 4d8fc11b22842..17d98cecb2823 100644 --- a/blocks/html/lib.php +++ b/blocks/html/lib.php @@ -18,11 +18,18 @@ /** * Form for editing HTML block instances. * - * @package block_html * @copyright 2010 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package block_html + * @category files + * @param stdClass $course course object + * @param stdClass $birecord_or_cm block instance record + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ - function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload) { global $SCRIPT; @@ -79,4 +86,4 @@ function block_html_global_db_replace($search, $replace) { } } $instances->close(); -} \ No newline at end of file +} diff --git a/blocks/navigation/block_navigation.php b/blocks/navigation/block_navigation.php index 8bfa9b7179f10..d5610c06199bd 100644 --- a/blocks/navigation/block_navigation.php +++ b/blocks/navigation/block_navigation.php @@ -1,5 +1,4 @@ config->enabledock) || $this->config->enabledock=='yes')); } + /** + * Gets Javascript that may be required for navigation + */ function get_required_javascript() { global $CFG; user_preference_allow_ajax_update('docked_block_instance_'.$this->instance->id, PARAM_INT); @@ -124,6 +132,8 @@ function get_required_javascript() { /** * Gets the content for this block by grabbing it from $this->page + * + * @return object $this->content */ function get_content() { global $CFG, $OUTPUT; @@ -134,7 +144,7 @@ function get_content() { // JS for navigation moved to the standard theme, the code will probably have to depend on the actual page structure // $this->page->requires->js('/lib/javascript-navigation.js'); // Navcount is used to allow us to have multiple trees although I dont' know why - // you would want to trees the same + // you would want two trees the same block_navigation::$navcount++; @@ -192,7 +202,7 @@ function get_content() { $options = array(); $options['linkcategories'] = (!empty($this->config->linkcategories) && $this->config->linkcategories == 'yes'); - + // Grab the items to display $renderer = $this->page->get_renderer('block_navigation'); $this->content = new stdClass(); @@ -208,10 +218,10 @@ function get_content() { * Returns the attributes to set for this block * * This function returns an array of HTML attributes for this block including - * the defaults - * {@link block_tree->html_attributes()} is used to get the default arguments + * the defaults. + * {@link block_tree::html_attributes()} is used to get the default arguments * and then we check whether the user has enabled hover expansion and add the - * appropriate hover class if it has + * appropriate hover class if it has. * * @return array An array of HTML attributes */ @@ -227,85 +237,79 @@ public function html_attributes() { * Trims the text and shorttext properties of this node and optionally * all of its children. * + * @param navigation_node $node * @param int $mode One of navigation_node::TRIM_* * @param int $long The length to trim text to * @param int $short The length to trim shorttext to * @param bool $recurse Recurse all children - * @param textlib|null $textlib */ - public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true, $textlib=null) { - if ($textlib == null) { - $textlib = textlib_get_instance(); - } + public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) { switch ($mode) { case self::TRIM_RIGHT : - if ($textlib->strlen($node->text)>($long+3)) { + if (textlib::strlen($node->text)>($long+3)) { // Truncate the text to $long characters - $node->text = $this->trim_right($textlib, $node->text, $long); + $node->text = $this->trim_right($node->text, $long); } - if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) { + if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) { // Truncate the shorttext - $node->shorttext = $this->trim_right($textlib, $node->shorttext, $short); + $node->shorttext = $this->trim_right($node->shorttext, $short); } break; case self::TRIM_LEFT : - if ($textlib->strlen($node->text)>($long+3)) { + if (textlib::strlen($node->text)>($long+3)) { // Truncate the text to $long characters - $node->text = $this->trim_left($textlib, $node->text, $long); + $node->text = $this->trim_left($node->text, $long); } - if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) { + if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) { // Truncate the shorttext - $node->shorttext = $this->trim_left($textlib, $node->shorttext, $short); + $node->shorttext = $this->trim_left($node->shorttext, $short); } break; case self::TRIM_CENTER : - if ($textlib->strlen($node->text)>($long+3)) { + if (textlib::strlen($node->text)>($long+3)) { // Truncate the text to $long characters - $node->text = $this->trim_center($textlib, $node->text, $long); + $node->text = $this->trim_center($node->text, $long); } - if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) { + if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) { // Truncate the shorttext - $node->shorttext = $this->trim_center($textlib, $node->shorttext, $short); + $node->shorttext = $this->trim_center($node->shorttext, $short); } break; } if ($recurse && $node->children->count()) { foreach ($node->children as &$child) { - $this->trim($child, $mode, $long, $short, true, $textlib); + $this->trim($child, $mode, $long, $short, true); } } } /** * Truncate a string from the left - * @param textlib $textlib * @param string $string The string to truncate * @param int $length The length to truncate to * @return string The truncated string */ - protected function trim_left($textlib, $string, $length) { - return '...'.$textlib->substr($string, $textlib->strlen($string)-$length, $length); + protected function trim_left($string, $length) { + return '...'.textlib::substr($string, textlib::strlen($string)-$length, $length); } /** * Truncate a string from the right - * @param textlib $textlib * @param string $string The string to truncate * @param int $length The length to truncate to * @return string The truncated string */ - protected function trim_right($textlib, $string, $length) { - return $textlib->substr($string, 0, $length).'...'; + protected function trim_right($string, $length) { + return textlib::substr($string, 0, $length).'...'; } /** * Truncate a string in the center - * @param textlib $textlib * @param string $string The string to truncate * @param int $length The length to truncate to * @return string The truncated string */ - protected function trim_center($textlib, $string, $length) { + protected function trim_center($string, $length) { $trimlength = ceil($length/2); - $start = $textlib->substr($string, 0, $trimlength); - $end = $textlib->substr($string, $textlib->strlen($string)-$trimlength); + $start = textlib::substr($string, 0, $trimlength); + $end = textlib::substr($string, textlib::strlen($string)-$trimlength); $string = $start.'...'.$end; return $string; } diff --git a/blocks/navigation/edit_form.php b/blocks/navigation/edit_form.php index 0d36b6b09fa06..3134e59f23e74 100644 --- a/blocks/navigation/edit_form.php +++ b/blocks/navigation/edit_form.php @@ -1,5 +1,4 @@ . +/** + * Outputs the navigation tree. + * + * @since 2.0 + * @package block_navigation + * @copyright 2009 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Renderer for block navigation + * + * @package block_navigation + * @category navigation + * @copyright 2009 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class block_navigation_renderer extends plugin_renderer_base { - + /** + * Returns the content of the navigation tree. + * + * @param global_navigation $navigation + * @param int $expansionlimit + * @param array $options + * @return string $content + */ public function navigation_tree(global_navigation $navigation, $expansionlimit, array $options = array()) { $navigation->add_class('navigation_node'); $content = $this->navigation_node(array($navigation), array('class'=>'block_tree list'), $expansionlimit, $options); @@ -10,7 +48,16 @@ public function navigation_tree(global_navigation $navigation, $expansionlimit, } return $content; } - + /** + * Produces a navigation node for the navigation tree + * + * @param array $items + * @param array $attrs + * @param int $expansionlimit + * @param array $options + * @param int $depth + * @return string + */ protected function navigation_node($items, $attrs=array(), $expansionlimit=null, array $options = array(), $depth=1) { // exit if empty, we don't want an empty ul element @@ -116,4 +163,4 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null, } } -} \ No newline at end of file +} diff --git a/blocks/navigation/version.php b/blocks/navigation/version.php index 3d5bf5eed0fcf..fee1d15918cee 100644 --- a/blocks/navigation/version.php +++ b/blocks/navigation/version.php @@ -17,8 +17,7 @@ /** * Version details * - * @package block - * @subpackage navigation + * @package block_navigation * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/blocks/online_users/db/access.php b/blocks/online_users/db/access.php index d042fac3e4bcf..ff00c60bb0037 100644 --- a/blocks/online_users/db/access.php +++ b/blocks/online_users/db/access.php @@ -1,27 +1,28 @@ . -/////////////////////////////////////////////////////////////////////////// -// // -// NOTICE OF COPYRIGHT // -// // -// Moodle - Modular Object-Oriented Dynamic Learning Environment // -// http://moodle.com // -// // -// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com // -// // -// This program 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 2 of the License, or // -// (at your option) any later version. // -// // -// This program 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: // -// // -// http://www.gnu.org/copyleft/gpl.html // -// // -/////////////////////////////////////////////////////////////////////////// +/** + * Online users block caps. + * + * @package block_online_users + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/blocks/participants/block_participants.php b/blocks/participants/block_participants.php index 5779210ab75af..deeeb7d9989ee 100644 --- a/blocks/participants/block_participants.php +++ b/blocks/participants/block_participants.php @@ -19,10 +19,13 @@ function get_content() { $this->content->icons = array(); $this->content->footer = ''; - /// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php - $currentcontext = $this->page->context; + // user/index.php expect course context, so get one if page has module context. + $currentcontext = $this->page->context->get_course_context(false); - if ($this->page->course->id == SITEID) { + if (empty($currentcontext)) { + $this->content = ''; + return $this->content; + } else if ($this->page->course->id == SITEID) { if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) { $this->content = ''; return $this->content; @@ -33,6 +36,7 @@ function get_content() { return $this->content; } } + $icon = ' '; $this->content->items[] = ''.$icon.get_string('participants').''; @@ -46,5 +50,3 @@ function applicable_formats() { } } - - diff --git a/blocks/private_files/block_private_files.php b/blocks/private_files/block_private_files.php index 32e1282e5b3ea..594f27600f584 100644 --- a/blocks/private_files/block_private_files.php +++ b/blocks/private_files/block_private_files.php @@ -27,7 +27,7 @@ class block_private_files extends block_base { function init() { - $this->title = get_string('myfiles'); + $this->title = get_string('pluginname', 'block_private_files'); } function specialization() { diff --git a/blocks/private_files/lang/en/block_private_files.php b/blocks/private_files/lang/en/block_private_files.php index f13e21fcf5ea0..e3970e6fa3ba3 100644 --- a/blocks/private_files/lang/en/block_private_files.php +++ b/blocks/private_files/lang/en/block_private_files.php @@ -24,5 +24,5 @@ */ $string['managemyfiles'] = 'Manage my files'; -$string['pluginname'] = 'User private files'; +$string['pluginname'] = 'My private files'; $string['privatefiles'] = 'Private files'; diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 8ca1504f974d4..086983d179270 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -26,7 +26,7 @@ class block_rss_client extends block_base { function init() { - $this->title = get_string('feedstitle', 'block_rss_client'); + $this->title = get_string('pluginname', 'block_rss_client'); } function preferred_width() { @@ -267,13 +267,10 @@ function get_item_html($item){ */ function format_title($title,$max=64) { - // Loading the textlib singleton instance. We are going to need it. - $textlib = textlib_get_instance(); - - if ($textlib->strlen($title) <= $max) { + if (textlib::strlen($title) <= $max) { return s($title); } else { - return s($textlib->substr($title,0,$max-3).'...'); + return s(textlib::substr($title,0,$max-3).'...'); } } diff --git a/blocks/rss_client/db/access.php b/blocks/rss_client/db/access.php index 45cbf7472c050..6eeb8629d9b73 100644 --- a/blocks/rss_client/db/access.php +++ b/blocks/rss_client/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities - +// 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 . + +/** + * RSS client block caps. + * + * @package block_rss_client + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/blocks/rss_client/db/install.xml b/blocks/rss_client/db/install.xml index e5f9ebf189f21..90096d38b416b 100644 --- a/blocks/rss_client/db/install.xml +++ b/blocks/rss_client/db/install.xml @@ -1,17 +1,17 @@ -
    - - - + + + - - + + diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php index 5711917027518..d25e090769d47 100644 --- a/blocks/rss_client/editfeed.php +++ b/blocks/rss_client/editfeed.php @@ -220,7 +220,7 @@ public static function autodiscover_feed_url($url){ $settingsurl = new moodle_url('/admin/settings.php?section=blocksettingrss_client'); $PAGE->navbar->add(get_string('blocks')); - $PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl); + $PAGE->navbar->add(get_string('pluginname', 'block_rss_client'), $settingsurl); $PAGE->navbar->add(get_string('managefeeds', 'block_rss_client')); $PAGE->navbar->add($strtitle); diff --git a/blocks/rss_client/lang/en/block_rss_client.php b/blocks/rss_client/lang/en/block_rss_client.php index aa809efb95c59..33ca8175a12cb 100644 --- a/blocks/rss_client/lang/en/block_rss_client.php +++ b/blocks/rss_client/lang/en/block_rss_client.php @@ -52,7 +52,6 @@ $string['feedsaddedit'] = 'Add/edit feeds'; $string['feedsconfigurenewinstance'] = 'Click here to configure this block to display RSS feeds.'; $string['feedsconfigurenewinstance2'] = 'Click the edit icon above to configure this block to display RSS feeds.'; -$string['feedstitle'] = 'Remote RSS Feeds'; $string['feedupdated'] = 'News feed updated'; $string['feedurl'] = 'Feed URL'; $string['findmorefeeds'] = 'Find more RSS feeds'; @@ -61,7 +60,7 @@ $string['nofeeds'] = 'There are no RSS feeds defined for this site.'; $string['numentries'] = 'Entries per feed'; $string['pickfeed'] = 'Pick a news feed'; -$string['pluginname'] = 'RSS client'; +$string['pluginname'] = 'Remote RSS feeds'; $string['remotenewsfeed'] = 'Remote news feed'; $string['rss_client:createprivatefeeds'] = 'Create private RSS feeds'; $string['rss_client:createsharedfeeds'] = 'Create shared RSS feeds'; diff --git a/blocks/rss_client/managefeeds.php b/blocks/rss_client/managefeeds.php index 553a61932555e..321aed4d7a175 100644 --- a/blocks/rss_client/managefeeds.php +++ b/blocks/rss_client/managefeeds.php @@ -86,7 +86,7 @@ $settingsurl = new moodle_url('/admin/settings.php?section=blocksettingrss_client'); $managefeeds = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams); $PAGE->navbar->add(get_string('blocks')); -$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl); +$PAGE->navbar->add(get_string('pluginname', 'block_rss_client'), $settingsurl); $PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'), $managefeeds); echo $OUTPUT->header(); diff --git a/blocks/rss_client/viewfeed.php b/blocks/rss_client/viewfeed.php index ef8da2944bc3f..469e621283af8 100644 --- a/blocks/rss_client/viewfeed.php +++ b/blocks/rss_client/viewfeed.php @@ -74,7 +74,7 @@ $settingsurl = new moodle_url('/admin/settings.php?section=blocksettingrss_client'); $managefeeds = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams); $PAGE->navbar->add(get_string('blocks')); -$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl); +$PAGE->navbar->add(get_string('pluginname', 'block_rss_client'), $settingsurl); $PAGE->navbar->add(get_string('managefeeds', 'block_rss_client')); $PAGE->navbar->add($strviewfeed); echo $OUTPUT->header(); diff --git a/blocks/section_links/config_instance.html b/blocks/section_links/config_instance.html index af42b297beb22..efc2fbc4238f5 100644 --- a/blocks/section_links/config_instance.html +++ b/blocks/section_links/config_instance.html @@ -19,7 +19,7 @@ * Section links block * * @package moodlecore - * @Author Jason Hardin + * @Author Jason Hardin * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/blocks/selfcompletion/block_selfcompletion.php b/blocks/selfcompletion/block_selfcompletion.php index 9954a39443732..9fe4a84b37345 100644 --- a/blocks/selfcompletion/block_selfcompletion.php +++ b/blocks/selfcompletion/block_selfcompletion.php @@ -36,7 +36,7 @@ class block_selfcompletion extends block_base { public function init() { - $this->title = get_string('selfcompletion', 'block_selfcompletion'); + $this->title = get_string('pluginname', 'block_selfcompletion'); } public function get_content() { diff --git a/blocks/selfcompletion/lang/en/block_selfcompletion.php b/blocks/selfcompletion/lang/en/block_selfcompletion.php index 03cf0dc032d77..403d0b2f2a751 100644 --- a/blocks/selfcompletion/lang/en/block_selfcompletion.php +++ b/blocks/selfcompletion/lang/en/block_selfcompletion.php @@ -26,5 +26,4 @@ $string['alreadyselfcompleted'] = 'You have already marked yourself as complete in this course'; $string['completecourse'] = 'Complete course'; $string['pluginname'] = 'Self completion'; -$string['selfcompletion'] = 'Self completion'; $string['selfcompletionnotenabled'] = 'The self completion criteria has not been enabled for this course'; diff --git a/blog/lib.php b/blog/lib.php index 080df708c88f7..ab9fd52fb856f 100644 --- a/blog/lib.php +++ b/blog/lib.php @@ -150,8 +150,6 @@ function blog_sync_external_entries($externalblog) { $rssfile = new moodle_simplepie_file($externalblog->url); $filetest = new SimplePie_Locator($rssfile); - $textlib = textlib_get_instance(); // Going to use textlib services - if (!$filetest->is_feed($rssfile)) { $externalblog->failedlastsync = 1; $DB->update_record('blog_external', $externalblog); @@ -203,8 +201,8 @@ function blog_sync_external_entries($externalblog) { $newentry->subject = clean_param($entry->get_title(), PARAM_TEXT); // Observe 128 max chars in DB // TODO: +1 to raise this to 255 - if ($textlib->strlen($newentry->subject) > 128) { - $newentry->subject = $textlib->substr($newentry->subject, 0, 125) . '...'; + if (textlib::strlen($newentry->subject) > 128) { + $newentry->subject = textlib::substr($newentry->subject, 0, 125) . '...'; } $newentry->summary = $entry->get_description(); @@ -239,8 +237,7 @@ function blog_sync_external_entries($externalblog) { $oldesttimestamp = $timestamp; } - $textlib = textlib_get_instance(); - if ($textlib->strlen($newentry->uniquehash) > 255) { + if (textlib::strlen($newentry->uniquehash) > 255) { // The URL for this item is too long for the field. Rather than add // the entry without the link we will skip straight over it. // RSS spec says recommended length 500, we use 255. diff --git a/calendar/delete.php b/calendar/delete.php index 8a3d0977036b4..7ab989a471fa8 100644 --- a/calendar/delete.php +++ b/calendar/delete.php @@ -68,8 +68,8 @@ // Is used several times, and sometimes with modification if required $viewcalendarurl = new moodle_url(CALENDAR_URL.'view.php', array('view'=>'upcoming')); -$viewcalendarurl->param('cal_y', date('Y', $event->timestart)); -$viewcalendarurl->param('cal_m', date('m', $event->timestart)); +$viewcalendarurl->param('cal_y', userdate($event->timestart, '%Y')); +$viewcalendarurl->param('cal_m', userdate($event->timestart, '%m')); // If confirm is set (PARAM_BOOL) then we have confirmation of initention to delete if ($confirm) { @@ -124,4 +124,4 @@ calendar_print_event($event, false); echo $OUTPUT->box_end(); -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/calendar/event.php b/calendar/event.php index dd98be36decc5..130e682351f1b 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -168,9 +168,9 @@ $params = array( 'view' => 'day', - 'cal_d' => date('j', $event->timestart), - 'cal_m' => date('n', $event->timestart), - 'cal_y' => date('y', $event->timestart), + 'cal_d' => userdate($event->timestart, '%d'), + 'cal_m' => userdate($event->timestart, '%m'), + 'cal_y' => userdate($event->timestart, '%Y'), ); $eventurl = new moodle_url('/calendar/view.php', $params); if (!empty($event->courseid) && $event->courseid != SITEID) { diff --git a/calendar/event_form.php b/calendar/event_form.php index 1dd18d1759d4a..9bbae6c259e8d 100644 --- a/calendar/event_form.php +++ b/calendar/event_form.php @@ -133,14 +133,16 @@ function definition () { $mform->setDefault('repeats', 1); $mform->disabledIf('repeats','repeat','notchecked'); - } else if ($repeatedevents > 0) { + } else if ($repeatedevents) { $mform->addElement('hidden', 'repeatid'); $mform->setType('repeatid', PARAM_INT); $mform->addElement('header', 'repeatedevents', get_string('repeatedevents', 'calendar')); - $mform->addElement('checkbox', 'repeateditall', null, get_string('repeateditall', 'calendar', $repeatedevents), 'repeat'); - $mform->setDefault('repeateditall', 'checked'); + $mform->addElement('radio', 'repeateditall', null, get_string('repeateditall', 'calendar', $this->_customdata->event->eventrepeats), 1); + $mform->addElement('radio', 'repeateditall', null, get_string('repeateditthis', 'calendar'), 0); + + $mform->setDefault('repeateditall', 1); } diff --git a/calendar/export_execute.php b/calendar/export_execute.php index 7f195becba551..ee0bed88d7a3e 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -152,7 +152,7 @@ $ev = new iCalendar_event; $ev->add_property('uid', $event->id.'@'.$hostaddress); $ev->add_property('summary', $event->name); - $ev->add_property('description', $event->description); + $ev->add_property('description', clean_param($event->description, PARAM_NOTAGS)); $ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL $ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified)); $ev->add_property('dtstamp', Bennu::timestamp_to_datetime()); // now diff --git a/calendar/lib.php b/calendar/lib.php index e4e76cd901d61..645ae189470e8 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1510,7 +1510,7 @@ function calendar_get_default_courses() { $courses = array(); if (!empty($CFG->calendar_adminseesall) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) { list ($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx'); - $sql = "SELECT c.* $select + $sql = "SELECT DISTINCT c.* $select FROM {course} c JOIN {event} e ON e.courseid = c.id $join"; @@ -1622,13 +1622,13 @@ function calendar_format_event_time($event, $now, $linkparams = null, $usecommon } } } else { - $time = ' '; + $time = calendar_time_representation($event->timestart); // Set printable representation if (!$showtime) { $day = calendar_day_representation($event->timestart, $now, $usecommonwords); $url = calendar_get_link_href(new moodle_url(CALENDAR_URL.'view.php', $linkparams), $startdate['mday'], $startdate['mon'], $startdate['year']); - $eventtime = html_writer::link($url, $day).trim($time); + $eventtime = html_writer::link($url, $day).', '.trim($time); } else { $eventtime = $time; } diff --git a/cohort/lib.php b/cohort/lib.php index e33f77aed031d..367b19ec9dedc 100644 --- a/cohort/lib.php +++ b/cohort/lib.php @@ -71,8 +71,9 @@ function cohort_add_cohort($cohort) { */ function cohort_update_cohort($cohort) { global $DB; - if (isset($cohort->component) and empty($cohort->component)) { - $cohort->component = NULL; + if (property_exists($cohort, 'component') and empty($cohort->component)) { + // prevent NULLs + $cohort->component = ''; } $cohort->timemodified = time(); $DB->update_record('cohort', $cohort); diff --git a/config-dist.php b/config-dist.php index dbc732c31c6d4..abc8da1b26dc7 100644 --- a/config-dist.php +++ b/config-dist.php @@ -383,7 +383,7 @@ // memory limit to something higher. // The value for the settings should be a valid PHP memory value. e.g. 512M, 1G // -// $CFG->extramemorylimit = 1G; +// $CFG->extramemorylimit = '1G'; // // The CSS files the Moodle produces can be extremely large and complex, especially // if you are using a custom theme that builds upon several other themes. diff --git a/course/completion.js b/course/completion.js index 3be2c38c6fa54..4d9542a2c993e 100644 --- a/course/completion.js +++ b/course/completion.js @@ -18,17 +18,21 @@ M.core_completion.init = function(Y) { } else { var current = args.state.get('value'); - + var modulename = args.modulename.get('value'); if (current == 1) { + var altstr = M.str.completion['completion-alt-manual-y'].replace('{$a}', modulename); + var titlestr = M.str.completion['completion-title-manual-y'].replace('{$a}', modulename); args.state.set('value', 0); args.image.set('src', M.util.image_url('i/completion-manual-y', 'moodle')); - args.image.set('alt', M.str.completion['completion-alt-manual-y']); - args.image.set('title', M.str.completion['completion-title-manual-y']); + args.image.set('alt', altstr); + args.image.set('title', titlestr); } else { + var altstr = M.str.completion['completion-alt-manual-n'].replace('{$a}', modulename); + var titlestr = M.str.completion['completion-title-manual-n'].replace('{$a}', modulename); args.state.set('value', 1); args.image.set('src', M.util.image_url('i/completion-manual-n', 'moodle')); - args.image.set('alt', M.str.completion['completion-alt-manual-n']); - args.image.set('title', M.str.completion['completion-title-manual-n']); + args.image.set('alt', altstr); + args.image.set('title', titlestr); } } @@ -48,6 +52,7 @@ M.core_completion.init = function(Y) { var completionstate = 0; var state = null; var image = null; + var modulename = null; var inputs = Y.Node.getDOMNode(form).getElementsByTagName('input'); for (var i=0; icriteria_grade)) { - if ($grade_item = grade_category::fetch_course_category($course->id)->grade_item) { - $grade_item->gradepass = $data->criteria_grade_value; - if (method_exists($grade_item, 'update')) { - $grade_item->update('course/completion.php'); - } - } + if ($grade_item = grade_category::fetch_course_category($course->id)->grade_item) { + $grade_item->gradepass = $data->criteria_grade_value; + if (method_exists($grade_item, 'update')) { + $grade_item->update('course/completion.php'); + } + } } redirect($CFG->wwwroot."/course/view.php?id=$course->id", get_string('changessaved')); diff --git a/course/format/topics/format.php b/course/format/topics/format.php index cc7c3c03af0b0..b8ce8f2286241 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -42,7 +42,7 @@ if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) { $course->marker = $marker; - $DB->set_field("course", "marker", $marker, array("id"=>$course->id)); + course_set_marker($course->id, $marker); } $streditsummary = get_string('editsummary'); diff --git a/course/info.php b/course/info.php index aca5105489bc7..4da6eb3e0c60a 100644 --- a/course/info.php +++ b/course/info.php @@ -37,7 +37,7 @@ $PAGE->set_pagelayout('popup'); $PAGE->set_url('/course/info.php', array('id' => $course->id)); $PAGE->set_title(get_string("summaryof", "", $course->fullname)); - $PAGE->set_heading('Course info'); + $PAGE->set_heading(get_string('courseinfo')); $PAGE->set_course($course); $PAGE->navbar->add(get_string('summary')); diff --git a/course/lib.php b/course/lib.php index d34d9ecbeb251..6282112f86a86 100644 --- a/course/lib.php +++ b/course/lib.php @@ -389,8 +389,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per // If $log->url has been trimmed short by the db size restriction // code in add_to_log, keep a note so we don't add a link to a broken url - $tl=textlib_get_instance(); - $brokenurl=($tl->strlen($log->url)==100 && $tl->substr($log->url,97)=='...'); + $brokenurl=(textlib::strlen($log->url)==100 && textlib::substr($log->url,97)=='...'); $row = array(); if ($course->id == SITEID) { @@ -1341,6 +1340,18 @@ function course_set_display($courseid, $display) { return $display; } +/** + * Set highlighted section. Only one section can be highlighted at the time. + * + * @param int $courseid course id + * @param int $marker highlight section with this number, 0 means remove higlightin + * @return void + */ +function course_set_marker($courseid, $marker) { + global $DB; + $DB->set_field("course", "marker", $marker, array('id' => $courseid)); +} + /** * For a given course section, marks it visible or hidden, * and does the same for every activity in that section @@ -1435,8 +1446,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, $initialised = true; } - $tl = textlib_get_instance(); - $modinfo = get_fast_modinfo($course); $completioninfo = new completion_info($course); @@ -1561,8 +1570,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, // Avoid unnecessary duplication: if e.g. a forum name already // includes the word forum (or Forum, etc) then it is unhelpful // to include that in the accessible description that is added. - if (false !== strpos($tl->strtolower($instancename), - $tl->strtolower($altname))) { + if (false !== strpos(textlib::strtolower($instancename), + textlib::strtolower($altname))) { $altname = ''; } // File type after name, for alphabetic lists (screen reader). @@ -1721,9 +1730,9 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, } if ($completionicon) { $imgsrc = $OUTPUT->pix_url('i/completion-'.$completionicon); - $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion')); + $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion', $mod->name)); if ($completion == COMPLETION_TRACKING_MANUAL && !$isediting) { - $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion')); + $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion', $mod->name)); $newstate = $completiondata->completionstate==COMPLETION_COMPLETE ? COMPLETION_INCOMPLETE @@ -1742,6 +1751,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, echo "
    + @@ -1806,65 +1816,49 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, return false; } - $urlbase = "/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey().'&add='; + // Retrieve all modules with associated metadata + $modules = get_module_metadata($course, $modnames); + // We'll sort resources and activities into two lists $resources = array(); $activities = array(); - foreach($modnames as $modname=>$modnamestr) { - if (!course_allowed_module($course, $modname)) { - continue; - } + // We need to add the section section to the link for each module + $sectionlink = '§ion=' . $section; - $libfile = "$CFG->dirroot/mod/$modname/lib.php"; - if (!file_exists($libfile)) { - continue; - } - include_once($libfile); - $gettypesfunc = $modname.'_get_types'; - if (function_exists($gettypesfunc)) { + foreach ($modules as $module) { + if (isset($module->types)) { + // This module has a subtype // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!! - if ($types = $gettypesfunc()) { - $menu = array(); - $atype = null; - $groupname = null; - foreach($types as $type) { - if ($type->typestr === '--') { - continue; - } - if (strpos($type->typestr, '--') === 0) { - $groupname = str_replace('--', '', $type->typestr); - continue; - } - $type->type = str_replace('&', '&', $type->type); - if ($type->modclass == MOD_CLASS_RESOURCE) { - $atype = MOD_CLASS_RESOURCE; - } - $menu[$urlbase.$type->type] = $type->typestr; + $subtypes = array(); + foreach ($module->types as $subtype) { + $subtypes[$subtype->link . $sectionlink] = $subtype->title; + } + + // Sort module subtypes into the list + if (!empty($module->title)) { + // This grouping has a name + if ($module->archetype == MOD_CLASS_RESOURCE) { + $resources[] = array($module->title=>$subtypes); + } else { + $activities[] = array($module->title=>$subtypes); } - if (!is_null($groupname)) { - if ($atype == MOD_CLASS_RESOURCE) { - $resources[] = array($groupname=>$menu); - } else { - $activities[] = array($groupname=>$menu); - } + } else { + // This grouping does not have a name + if ($module->archetype == MOD_CLASS_RESOURCE) { + $resources = array_merge($resources, $subtypes); } else { - if ($atype == MOD_CLASS_RESOURCE) { - $resources = array_merge($resources, $menu); - } else { - $activities = array_merge($activities, $menu); - } + $activities = array_merge($activities, $subtypes); } } } else { - $archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER); - if ($archetype == MOD_ARCHETYPE_RESOURCE) { - $resources[$urlbase.$modname] = $modnamestr; - } else if ($archetype === MOD_ARCHETYPE_SYSTEM) { + // This module has no subtypes + if ($module->archetype == MOD_ARCHETYPE_RESOURCE) { + $resources[$module->link . $sectionlink] = $module->title; + } else if ($module->archetype === MOD_ARCHETYPE_SYSTEM) { // System modules cannot be added by user, do not add to dropdown } else { - // all other archetypes are considered activity - $activities[$urlbase.$modname] = $modnamestr; + $activities[$module->link . $sectionlink] = $module->title; } } } @@ -1903,6 +1897,96 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, } } +/** + * Retrieve all metadata for the requested modules + * + * @param object $course The Course + * @param array $modnames An array containing the list of modules and their + * names + * @return array A list of stdClass objects containing metadata about each + * module + */ +function get_module_metadata($course, $modnames) { + global $CFG, $OUTPUT; + + // get_module_metadata will be called once per section on the page and courses may show + // different modules to one another + static $modlist = array(); + if (!isset($modlist[$course->id])) { + $modlist[$course->id] = array(); + } + + $return = array(); + $urlbase = "/course/mod.php?id=$course->id&sesskey=".sesskey().'&add='; + foreach($modnames as $modname => $modnamestr) { + if (!course_allowed_module($course, $modname)) { + continue; + } + if (isset($modlist[$modname])) { + // This module is already cached + $return[$modname] = $modlist[$course->id][$modname]; + continue; + } + + // Include the module lib + $libfile = "$CFG->dirroot/mod/$modname/lib.php"; + if (!file_exists($libfile)) { + continue; + } + include_once($libfile); + + // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!! + $gettypesfunc = $modname.'_get_types'; + if (function_exists($gettypesfunc)) { + if ($types = $gettypesfunc()) { + $group = new stdClass(); + $group->name = $modname; + $group->icon = $OUTPUT->pix_icon('icon', '', $modname, array('class' => 'icon')); + foreach($types as $type) { + if ($type->typestr === '--') { + continue; + } + if (strpos($type->typestr, '--') === 0) { + $group->title = str_replace('--', '', $type->typestr); + continue; + } + // Set the Sub Type metadata + $subtype = new stdClass(); + $subtype->title = $type->typestr; + $subtype->type = str_replace('&', '&', $type->type); + $subtype->name = preg_replace('/.*type=/', '', $subtype->type); + $subtype->archetype = $type->modclass; + + // The group archetype should match the subtype archetypes and all subtypes + // should have the same archetype + $group->archetype = $subtype->archetype; + + if (get_string_manager()->string_exists('help' . $subtype->name, $modname)) { + $subtype->help = get_string('help' . $subtype->name, $modname); + } + $subtype->link = $urlbase . $subtype->type; + $group->types[] = $subtype; + } + $modlist[$course->id][$modname] = $group; + } + } else { + $module = new stdClass(); + $module->title = get_string('modulename', $modname); + $module->name = $modname; + $module->link = $urlbase . $modname; + $module->icon = $OUTPUT->pix_icon('icon', '', $module->name, array('class' => 'icon')); + if (get_string_manager()->string_exists('modulename_help', $modname)) { + $module->help = get_string('modulename_help', $modname); + } + $module->archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER); + $modlist[$course->id][$modname] = $module; + } + $return[$modname] = $modlist[$course->id][$modname]; + } + + return $return; +} + /** * Return the course category context for the category with id $categoryid, except * that if $categoryid is 0, return the system context. @@ -2872,9 +2956,10 @@ function delete_mod_from_section($mod, $section) { /** * Moves a section up or down by 1. CANNOT BE USED DIRECTLY BY AJAX! * - * @param object $course - * @param int $section + * @param object $course course object + * @param int $section Section number (not id!!!) * @param int $move (-1 or 1) + * @return boolean true if section moved successfully */ function move_section($course, $section, $move) { /// Moves a whole course section up and down within the course @@ -2901,6 +2986,13 @@ function move_section($course, $section, $move) { $DB->set_field("course_sections", "section", $sectiondest, array("id"=>$sectionrecord->id)); $DB->set_field("course_sections", "section", $section, array("id"=>$sectiondestrecord->id)); + // Update highlighting if the move affects highlighted section + if ($course->marker == $section) { + course_set_marker($course->id, $sectiondest); + } elseif ($course->marker == $sectiondest) { + course_set_marker($course->id, $section); + } + // if the focus is on the section that is being moved, then move the focus along if (course_get_display($course->id) == $section) { course_set_display($course->id, $sectiondest); diff --git a/course/publish/forms.php b/course/publish/forms.php index 84a9852f01d83..3b5e8df0a3abc 100644 --- a/course/publish/forms.php +++ b/course/publish/forms.php @@ -333,7 +333,7 @@ public function definition() { $editoroptions = array('maxfiles' => 0, 'maxbytes' => 0, 'trusttext' => false, 'forcehttps' => false); $mform->addElement('editor', 'creatornotes', get_string('creatornotes', 'hub'), '', $editoroptions); - $mform->addRule('creatornotes', $strrequired, 'required', null, 'client'); + $mform->addRule('creatornotes', $strrequired, 'required', null, 'client'); $mform->setType('creatornotes', PARAM_CLEANHTML); $mform->addHelpButton('creatornotes', 'creatornotes', 'hub'); diff --git a/course/publish/index.php b/course/publish/index.php index 962775051c84f..f868ca39a73ab 100644 --- a/course/publish/index.php +++ b/course/publish/index.php @@ -110,11 +110,11 @@ } $renderer = $PAGE->get_renderer('core', 'publish'); - + /// UNPUBLISH $cancel = optional_param('cancel', 0, PARAM_BOOL); if (!empty($cancel) and confirm_sesskey()) { - $confirm = optional_param('confirm', 0, PARAM_BOOL); + $confirm = optional_param('confirm', 0, PARAM_BOOL); $hubcourseid = optional_param('hubcourseid', 0, PARAM_INT); $publicationid = optional_param('publicationid', 0, PARAM_INT); $timepublished = optional_param('timepublished', 0, PARAM_INT); @@ -161,7 +161,7 @@ empty($hubname)?$huburl:$hubname), 'notifysuccess'); } - + /// OUTPUT echo $OUTPUT->header(); echo $confirmmessage; @@ -177,4 +177,4 @@ echo $OUTPUT->footer(); -} \ No newline at end of file +} diff --git a/course/publish/lib.php b/course/publish/lib.php index 4d166eb090565..fe13219fce9a2 100644 --- a/course/publish/lib.php +++ b/course/publish/lib.php @@ -279,7 +279,7 @@ public function get_sorted_subjects() { $subsublevel[substr($key, 0, 8)][substr($key, 0, 10)][$key] = $option; } } - + //recreate the initial structure returned by get_string_manager() $subjects = array(); foreach ($toplevel as $key => $name) { diff --git a/course/publish/metadata.php b/course/publish/metadata.php index b8a8caa638543..9067f795848bd 100644 --- a/course/publish/metadata.php +++ b/course/publish/metadata.php @@ -184,10 +184,10 @@ } // PUBLISH ACTION - + //publish the course information $function = 'hub_register_courses'; - $params = array('courses' => array($courseinfo)); + $params = array('courses' => array($courseinfo)); try { $courseids = $xmlrpcclient->call($function, $params); } catch (Exception $e) { diff --git a/course/publish/renderer.php b/course/publish/renderer.php index 64483e8bca5b3..970fed51db49a 100644 --- a/course/publish/renderer.php +++ b/course/publish/renderer.php @@ -119,7 +119,7 @@ public function registeredonhublisting($courseid, $publications) { . $courseid . "&updatestatusid=" . $publication->id . "&sesskey=" . sesskey())); } - //add button cells + //add button cells $cells = array($publication->enrollable ? get_string('advertised', 'hub') : get_string('shared', 'hub'), $hubname, userdate($publication->timepublished, @@ -207,7 +207,7 @@ public function hubinfo($hubinfo) { $hubdescription .= html_writer::tag('a', $hubinfo['name'], array('class' => 'hublink', 'href' => $hubinfo['url'], 'onclick' => 'this.target="_blank"')); - + $hubdescription .= html_writer::tag('div', format_text($hubinfo['description'], FORMAT_PLAIN), array('class' => 'hubdescription')); $hubdescription = html_writer::tag('div', $hubdescription, array('class' => 'hubinfo')); diff --git a/course/recent.php b/course/recent.php index 134cce0e07be6..fcf09fd9f40f6 100644 --- a/course/recent.php +++ b/course/recent.php @@ -78,7 +78,7 @@ $PAGE->set_title("$course->shortname: $strrecentactivity"); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo", 3); +echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo", 2); $mform->display(); @@ -238,8 +238,8 @@ $modfullname = $modnames[$cm->modname]; $image = "pix_url('icon', $cm->modname) . "\" class=\"icon\" alt=\"$modfullname\" />"; - echo "

    $image $modfullname". - " wwwroot/mod/$cm->modname/view.php?id=$cm->id\" $linkformat>$name

    "; + echo "

    $image $modfullname". + " wwwroot/mod/$cm->modname/view.php?id=$cm->id\" $linkformat>$name

    "; } } else { @@ -269,7 +269,7 @@ } else { - echo '

    ' . get_string('norecentactivity') . '

    '; + echo '

    ' . get_string('norecentactivity') . '

    '; } diff --git a/course/rest.php b/course/rest.php index 933e4f1a9c15b..5125ffb72d3f0 100644 --- a/course/rest.php +++ b/course/rest.php @@ -159,10 +159,7 @@ require_login($course); $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); require_capability('moodle/course:update', $coursecontext); - $newcourse = new stdClass(); - $newcourse->id = $course->id; - $newcourse->marker = $value; - $DB->update_record('course', $newcourse); + course_set_marker($course->id, $value); break; } break; diff --git a/course/search.php b/course/search.php index 1e191a376539a..b3be91283e64c 100644 --- a/course/search.php +++ b/course/search.php @@ -320,13 +320,15 @@ // checks whether user can do site backup if (has_capability('moodle/backup:backupcourse', $coursecontext)) { - echo "id\">\n $course->id)); + echo "\npix_url('t/backup') . "\" class=\"iconsmall\" alt=\"".get_string("backup")."\" />\n "; } // checks whether user can do restore if (has_capability('moodle/restore:restorecourse', $coursecontext)) { - echo "id&wdir=/backupdata\">\n $coursecontext->id)); + echo "\npix_url('t/restore') . "\" class=\"iconsmall\" alt=\"".get_string("restore")."\" />\n "; } diff --git a/course/view.php b/course/view.php index 7317094058ffe..8b2621f38a0ca 100644 --- a/course/view.php +++ b/course/view.php @@ -138,12 +138,15 @@ if (!empty($section)) { if (!empty($move) and confirm_sesskey()) { - if (!move_section($course, $section, $move)) { + if (move_section($course, $section, $move)) { + if ($course->id == SITEID) { + redirect($CFG->wwwroot . '/?redirect=0'); + } else { + redirect($PAGE->url); + } + } else { echo $OUTPUT->notification('An error occurred while moving a section'); } - // Clear the navigation cache at this point so that the affects - // are seen immediately on the navigation. - $PAGE->navigation->clear_cache(); } } } diff --git a/enrol/authorize/db/access.php b/enrol/authorize/db/access.php index c04804b4c745c..9f0f0476ef18b 100644 --- a/enrol/authorize/db/access.php +++ b/enrol/authorize/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Authorize.Net enrolment plugin capabilities. + * + * @package enrol_authorize + * @copyright 2006 Eugene Venter + * @author Eugene Venter + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/enrol/authorize/db/install.xml b/enrol/authorize/db/install.xml index 0a65b29e1b36b..1f96ce5ac0aff 100644 --- a/enrol/authorize/db/install.xml +++ b/enrol/authorize/db/install.xml @@ -1,22 +1,22 @@ -
    - + - + - - - - - - - + + + + + + + @@ -32,12 +32,12 @@
    - - - + + + - - + + diff --git a/enrol/authorize/localfuncs.php b/enrol/authorize/localfuncs.php index 98634edbfa1a0..6a5a1e574520b 100644 --- a/enrol/authorize/localfuncs.php +++ b/enrol/authorize/localfuncs.php @@ -233,7 +233,7 @@ function send_welcome_messages($orderdata) { $a->profileurl = "$CFG->wwwroot/user/view.php?id=$lastuserid"; $a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$lastuserid"; $emailmessage = get_string('welcometocoursesemail', 'enrol_authorize', $a); - $subject = get_string("enrolmentnew", '', format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)))); + $subject = get_string("enrolmentnew", 'enrol', format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)))); $eventdata = new stdClass(); $eventdata->modulename = 'moodle'; diff --git a/enrol/category/db/access.php b/enrol/category/db/access.php index 8c24b9695074e..1a9ead040d080 100644 --- a/enrol/category/db/access.php +++ b/enrol/category/db/access.php @@ -1,5 +1,4 @@ . /** - * category enrolment plugin event handler definition. + * Category enrolment plugin event handler definition. * - * @package enrol - * @subpackage category - * @copyright 2010 Petr Skoda {@link http://skodak.org} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package enrol_category + * @category event + * @copyright 2010 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); @@ -42,4 +41,4 @@ 'internal' => 1, ), -); +); \ No newline at end of file diff --git a/enrol/cohort/ajax.php b/enrol/cohort/ajax.php index 87d319bbd630c..e65d1ed845672 100644 --- a/enrol/cohort/ajax.php +++ b/enrol/cohort/ajax.php @@ -79,7 +79,7 @@ require_capability('enrol/cohort:config', $context); $roleid = required_param('roleid', PARAM_INT); $cohortid = required_param('cohortid', PARAM_INT); - + $roles = $manager->get_assignable_roles(); if (!enrol_cohort_can_view_cohort($cohortid) || !array_key_exists($roleid, $roles)) { throw new enrol_ajax_exception('errorenrolcohort'); @@ -112,4 +112,4 @@ } echo json_encode($outcome); -die(); \ No newline at end of file +die(); diff --git a/enrol/cohort/db/access.php b/enrol/cohort/db/access.php index dcd09e885c841..98ce7b0f232c6 100644 --- a/enrol/cohort/db/access.php +++ b/enrol/cohort/db/access.php @@ -1,5 +1,4 @@ array( + + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'manager' => CAP_ALLOW, + ) + ), +); + + diff --git a/enrol/database/lang/en/enrol_database.php b/enrol/database/lang/en/enrol_database.php index 0787b008ac482..b423c7bc5b4dc 100644 --- a/enrol/database/lang/en/enrol_database.php +++ b/enrol/database/lang/en/enrol_database.php @@ -23,6 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['database:unenrol'] = 'Unenrol suspended users'; $string['dbencoding'] = 'Database encoding'; $string['dbhost'] = 'Database host'; $string['dbhost_desc'] = 'Type database server IP address or host name'; @@ -43,12 +44,13 @@ $string['defaultrole_desc'] = 'The role that will be assigned by default if no other role is specified in external table.'; $string['ignorehiddencourses'] = 'Ignore hidden courses'; $string['ignorehiddencourses_desc'] = 'If enabled users will not be enrolled on courses that are set to be unavailable to students.'; +$string['localcategoryfield'] = 'Local category field'; $string['localcoursefield'] = 'Local course field'; $string['localrolefield'] = 'Local role field'; $string['localuserfield'] = 'Local user field'; $string['newcoursetable'] = 'Remote new courses table'; $string['newcoursetable_desc'] = 'Specify of the name of the table that contains list of courses that should be created automatically. Empty means no courses are created.'; -$string['newcoursecategory'] = 'New course category id field'; +$string['newcoursecategory'] = 'New course category field'; $string['newcoursefullname'] = 'New course full name field'; $string['newcourseidnumber'] = 'New course ID number field'; $string['newcourseshortname'] = 'New course short name field'; diff --git a/enrol/database/lib.php b/enrol/database/lib.php index 08b86f9beae70..ce8d6d2e1fa86 100644 --- a/enrol/database/lib.php +++ b/enrol/database/lib.php @@ -51,6 +51,43 @@ public function instance_deleteable($instance) { return false; } + /** + * Does this plugin allow manual unenrolment of a specific user? + * Yes, but only if user suspended... + * + * @param stdClass $instance course enrol instance + * @param stdClass $ue record from user_enrolments table + * + * @return bool - true means user with 'enrol/xxx:unenrol' may unenrol this user, false means nobody may touch this user enrolment + */ + public function allow_unenrol_user(stdClass $instance, stdClass $ue) { + if ($ue->status == ENROL_USER_SUSPENDED) { + return true; + } + + return false; + } + + /** + * Gets an array of the user enrolment actions + * + * @param course_enrolment_manager $manager + * @param stdClass $ue A user enrolment object + * @return array An array of user_enrolment_actions + */ + public function get_user_enrolment_actions(course_enrolment_manager $manager, $ue) { + $actions = array(); + $context = $manager->get_context(); + $instance = $ue->enrolmentinstance; + $params = $manager->get_moodlepage()->url->params(); + $params['ue'] = $ue->id; + if ($this->allow_unenrol_user($instance, $ue) && has_capability('enrol/database:unenrol', $context)) { + $url = new moodle_url('/enrol/unenroluser.php', $params); + $actions[] = new user_enrolment_action(new pix_icon('t/delete', ''), get_string('unenrol', 'enrol'), $url, array('class'=>'unenrollink', 'rel'=>$ue->id)); + } + return $actions; + } + /** * Forces synchronisation of user enrolments with external database, * does not create new courses. @@ -585,6 +622,8 @@ public function sync_courses($verbose = false) { $idnumber = strtolower($this->get_config('newcourseidnumber')); $category = strtolower($this->get_config('newcoursecategory')); + $localcategoryfield = $this->get_config('localcategoryfield', 'id'); + $sqlfields = array($fullname, $shortname); if ($category) { $sqlfields[] = $category; @@ -616,17 +655,17 @@ public function sync_courses($verbose = false) { } continue; } - if ($category and !$DB->record_exists('course_categories', array('id'=>$fields[$category]))) { + if ($category and !$coursecategory = $DB->get_record('course_categories', array($localcategoryfield=>$fields[$category]), 'id')) { if ($verbose) { - mtrace(' error: invalid category id, can not create course: '.$fields[$shortname]); + mtrace(' error: invalid category '.$localcategoryfield.', can not create course: '.$fields[$shortname]); } continue; } $course = new stdClass(); $course->fullname = $fields[$fullname]; $course->shortname = $fields[$shortname]; - $course->idnumber = $idnumber ? $fields[$idnumber] : NULL; - $course->category = $category ? $fields[$category] : NULL; + $course->idnumber = $idnumber ? $fields[$idnumber] : ''; + $course->category = $category ? $coursecategory->id : NULL; $createcourses[] = $course; } } @@ -781,7 +820,7 @@ protected function db_encode($text) { } return $text; } else { - return textlib_get_instance()->convert($text, 'utf-8', $dbenc); + return textlib::convert($text, 'utf-8', $dbenc); } } @@ -796,7 +835,7 @@ protected function db_decode($text) { } return $text; } else { - return textlib_get_instance()->convert($text, $dbenc, 'utf-8'); + return textlib::convert($text, $dbenc, 'utf-8'); } } } diff --git a/enrol/database/settings.php b/enrol/database/settings.php index f75afe6367032..369bd3952ea25 100644 --- a/enrol/database/settings.php +++ b/enrol/database/settings.php @@ -66,6 +66,8 @@ $options = array('id'=>'id', 'shortname'=>'shortname', 'fullname'=>'fullname'); $settings->add(new admin_setting_configselect('enrol_database/localrolefield', get_string('localrolefield', 'enrol_database'), '', 'shortname', $options)); + $options = array('id'=>'id', 'idnumber'=>'idnumber'); + $settings->add(new admin_setting_configselect('enrol_database/localcategoryfield', get_string('localcategoryfield', 'enrol_database'), '', 'id', $options)); $settings->add(new admin_setting_heading('enrol_database_remoteheader', get_string('settingsheaderremote', 'enrol_database'), '')); diff --git a/enrol/database/version.php b/enrol/database/version.php index fe7178e467da4..6f085ff61eedf 100644 --- a/enrol/database/version.php +++ b/enrol/database/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2011112900; // Requires this Moodle version +$plugin->version = 2012031000; // The current plugin version (Date: YYYYMMDDXX) +$plugin->requires = 2012022300; // Requires this Moodle version $plugin->component = 'enrol_database'; // Full name of the plugin (used for diagnostics) //TODO: should we add cron sync? \ No newline at end of file diff --git a/enrol/externallib.php b/enrol/externallib.php index 123f438037e2c..71e0f69dfb767 100644 --- a/enrol/externallib.php +++ b/enrol/externallib.php @@ -123,7 +123,13 @@ public static function get_enrolled_users_parameters() { 'name' => new external_value(PARAM_ALPHANUMEXT, 'option name'), 'value' => new external_value(PARAM_RAW, 'option value') ) - ), 'method options', VALUE_DEFAULT, array()), + ), 'Option names: + * withcapability (string) return only users with this capability. This option requires \'moodle/role:review\' on the course context. + * groupid (integer) return only users in this group id. This option requires \'moodle/site:accessallgroups\' on the course context. + * onlyactive (integer) return only users with active enrolments and matching time restrictions. This option requires \'moodle/course:enrolreview\' on the course context. + * userfields (\'string, string, ...\') return only the values of these user fields. + * limitfrom (integer) sql limit from. + * limitnumber (integer) maximum number of returned users.', VALUE_DEFAULT, array()), ) ); } @@ -152,6 +158,8 @@ public static function get_enrolled_users($courseid, $options) { $groupid = 0; $onlyactive = false; $userfields = array(); + $limitfrom = 0; + $limitnumber = 0; foreach ($options as $option) { switch ($option['name']) { case 'withcapability': @@ -168,6 +176,11 @@ public static function get_enrolled_users($courseid, $options) { foreach ($thefields as $f) { $userfields[] = clean_param($f, PARAM_ALPHANUMEXT); } + case 'limitfrom' : + $limitfrom = clean_param($option['value'], PARAM_INT); + break; + case 'limitnumber' : + $limitnumber = clean_param($option['value'], PARAM_INT); break; } } @@ -213,7 +226,7 @@ public static function get_enrolled_users($courseid, $options) { FROM {user} u $ctxjoin WHERE u.id IN ($enrolledsql) ORDER BY u.id ASC"; - $enrolledusers = $DB->get_recordset_sql($sql, $enrolledparams); + $enrolledusers = $DB->get_recordset_sql($sql, $enrolledparams, $limitfrom, $limitnumber); $users = array(); foreach ($enrolledusers as $user) { context_instance_preload($user); diff --git a/enrol/flatfile/db/install.xml b/enrol/flatfile/db/install.xml index ea0c6cfe90ee5..e6accedfc2857 100644 --- a/enrol/flatfile/db/install.xml +++ b/enrol/flatfile/db/install.xml @@ -1,19 +1,19 @@ -
    - + - - - - - - + + + + + + diff --git a/enrol/guest/db/access.php b/enrol/guest/db/access.php index 2fa37e6f2b993..e2ac24d3983ee 100644 --- a/enrol/guest/db/access.php +++ b/enrol/guest/db/access.php @@ -1,5 +1,4 @@ password) { $plugin = enrol_get_plugin('guest'); if ($plugin->get_config('showhint')) { - $textlib = textlib_get_instance(); - $hint = $textlib->substr($instance->password, 0, 1); + $hint = textlib::substr($instance->password, 0, 1); $errors['guestpassword'] = get_string('passwordinvalidhint', 'enrol_guest', $hint); } else { $errors['guestpassword'] = get_string('passwordinvalid', 'enrol_guest'); diff --git a/enrol/ldap/db/access.php b/enrol/ldap/db/access.php index 8eb1aa60b7194..8d06963a38cd1 100644 --- a/enrol/ldap/db/access.php +++ b/enrol/ldap/db/access.php @@ -1,5 +1,4 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/enrol/ldap/lib.php b/enrol/ldap/lib.php index 730ec5a8ac2b3..f3678bc07fee7 100644 --- a/enrol/ldap/lib.php +++ b/enrol/ldap/lib.php @@ -648,8 +648,7 @@ protected function find_ext_enrolments ($ldapconnection, $memberuid, $role) { return array(); } - $textlib = textlib_get_instance(); - $extmemberuid = $textlib->convert($memberuid, 'utf-8', $this->get_config('ldapencoding')); + $extmemberuid = textlib::convert($memberuid, 'utf-8', $this->get_config('ldapencoding')); if($this->get_config('memberattribute_isdn')) { if (!($extmemberuid = $this->ldap_find_userdn ($ldapconnection, $extmemberuid))) { diff --git a/enrol/ldap/settingslib.php b/enrol/ldap/settingslib.php index 62cae7094b4d3..61397a6879e47 100644 --- a/enrol/ldap/settingslib.php +++ b/enrol/ldap/settingslib.php @@ -63,7 +63,7 @@ public function write_setting($data) { return $validated; } if ($this->lowercase) { - $data = moodle_strtolower($data); + $data = textlib::strtolower($data); } return ($this->config_write($this->name, trim($data)) ? '' : get_string('errorsetting', 'admin')); } @@ -118,7 +118,7 @@ public function write_setting($data) { if (!$this->config_write('contexts_role'.$roleid, trim($data['contexts']))) { $return = get_string('errorsetting', 'admin'); } - if (!$this->config_write('memberattribute_role'.$roleid, moodle_strtolower(trim($data['memberattribute'])))) { + if (!$this->config_write('memberattribute_role'.$roleid, textlib::strtolower(trim($data['memberattribute'])))) { $return = get_string('errorsetting', 'admin'); } } diff --git a/enrol/locallib.php b/enrol/locallib.php index fb2663e13fd0d..f7d5030655dd8 100644 --- a/enrol/locallib.php +++ b/enrol/locallib.php @@ -119,7 +119,7 @@ public function __construct(moodle_page $moodlepage, $course, $instancefilter = /** * Returns the current moodle page - * @return moodle_page + * @return moodle_page */ public function get_moodlepage() { return $this->moodlepage; @@ -764,20 +764,14 @@ public function get_other_users_for_display(core_enrol_renderer $renderer, moodl $userroles = $this->get_other_users($sort, $direction, $page, $perpage); $roles = $this->get_all_roles(); - $courseid = $this->get_course()->id; $context = $this->get_context(); + $now = time(); + $extrafields = get_extra_user_fields($context); $users = array(); foreach ($userroles as $userrole) { if (!array_key_exists($userrole->id, $users)) { - $users[$userrole->id] = array( - 'userid' => $userrole->id, - 'courseid' => $courseid, - 'picture' => new user_picture($userrole), - 'firstname' => fullname($userrole, true), - 'email' => $userrole->email, - 'roles' => array() - ); + $users[$userrole->id] = $this->prepare_user_for_display($userrole, $extrafields, $now); } $a = new stdClass; $a->role = $roles[$userrole->roleid]->localname; @@ -800,6 +794,7 @@ public function get_other_users_for_display(core_enrol_renderer $renderer, moodl break; } } + $users[$userrole->id]['roles'] = array(); $users[$userrole->id]['roles'][$userrole->roleid] = array( 'text' => $roletext, 'unchangeable' => !$changeable @@ -825,7 +820,6 @@ public function get_users_for_display(course_enrolment_manager $manager, $sort, $users = $this->get_users($sort, $direction, $page, $perpage); $now = time(); - $strnever = get_string('never'); $straddgroup = get_string('addgroup', 'group'); $strunenrol = get_string('unenrol', 'enrol'); $stredit = get_string('edit'); @@ -833,7 +827,6 @@ public function get_users_for_display(course_enrolment_manager $manager, $sort, $allroles = $this->get_all_roles(); $assignable = $this->get_assignable_roles(); $allgroups = $this->get_all_groups(); - $courseid = $this->get_course()->id; $context = $this->get_context(); $canmanagegroups = has_capability('moodle/course:managegroups', $context); @@ -842,36 +835,23 @@ public function get_users_for_display(course_enrolment_manager $manager, $sort, $userdetails = array(); foreach ($users as $user) { - $details = array( - 'userid' => $user->id, - 'courseid' => $courseid, - 'picture' => new user_picture($user), - 'firstname' => fullname($user, true), - 'lastseen' => $strnever, - 'roles' => array(), - 'groups' => array(), - 'enrolments' => array() - ); - foreach ($extrafields as $field) { - $details[$field] = $user->{$field}; - } - - if ($user->lastaccess) { - $details['lastseen'] = format_time($now - $user->lastaccess); - } + $details = $this->prepare_user_for_display($user, $extrafields, $now); // Roles + $details['roles'] = array(); foreach ($this->get_user_roles($user->id) as $rid=>$rassignable) { $details['roles'][$rid] = array('text'=>$allroles[$rid]->localname, 'unchangeable'=>(!$rassignable || !isset($assignable[$rid]))); } // Users $usergroups = $this->get_user_groups($user->id); + $details['groups'] = array(); foreach($usergroups as $gid=>$unused) { $details['groups'][$gid] = $allgroups[$gid]->name; } // Enrolments + $details['enrolments'] = array(); foreach ($this->get_user_enrolments($user->id) as $ue) { if ($ue->timestart and $ue->timeend) { $period = get_string('periodstartend', 'enrol', array('start'=>userdate($ue->timestart), 'end'=>userdate($ue->timeend))); @@ -898,6 +878,39 @@ public function get_users_for_display(course_enrolment_manager $manager, $sort, return $userdetails; } + /** + * Prepare a user record for display + * + * This function is called by both {@link get_users_for_display} and {@link get_other_users_for_display} to correctly + * prepare user fields for display + * + * Please note that this function does not check capability for moodle/coures:viewhiddenuserfields + * + * @param object $user The user record + * @param array $extrafields The list of fields as returned from get_extra_user_fields used to determine which + * additional fields may be displayed + * @param int $now The time used for lastaccess calculation + * @return array The fields to be displayed including userid, courseid, picture, firstname, lastseen and any + * additional fields from $extrafields + */ + private function prepare_user_for_display($user, $extrafields, $now) { + $details = array( + 'userid' => $user->id, + 'courseid' => $this->get_course()->id, + 'picture' => new user_picture($user), + 'firstname' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())), + 'lastseen' => get_string('never'), + ); + foreach ($extrafields as $field) { + $details[$field] = $user->{$field}; + } + + if ($user->lastaccess) { + $details['lastseen'] = format_time($now - $user->lastaccess); + } + return $details; + } + public function get_manual_enrol_buttons() { $plugins = $this->get_enrolment_plugins(); $buttons = array(); @@ -1269,4 +1282,4 @@ abstract public function get_identifier(); * @param stdClass $properties */ abstract public function process(course_enrolment_manager $manager, array $users, stdClass $properties); -} \ No newline at end of file +} diff --git a/enrol/manual/db/access.php b/enrol/manual/db/access.php index 4658fc7b57de6..561ef29a39d91 100644 --- a/enrol/manual/db/access.php +++ b/enrol/manual/db/access.php @@ -1,5 +1,4 @@ . + /** * Manual plugin external functions and service definitions. * - * @package enrol - * @subpackage manual - * @author 2011 Jerome Mouneyrac + * @package enrol_manual + * @category webservice + * @copyright 2011 Jerome Mouneyrac * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/enrol/manual/version.php b/enrol/manual/version.php index 5ed20125c9bf1..4a7b7605161a7 100644 --- a/enrol/manual/version.php +++ b/enrol/manual/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2011112900; // Requires this Moodle version $plugin->component = 'enrol_manual'; // Full name of the plugin (used for diagnostics) diff --git a/enrol/manual/yui/quickenrolment/quickenrolment.js b/enrol/manual/yui/quickenrolment/quickenrolment.js index d5658b464b921..88c09ea4dab3f 100644 --- a/enrol/manual/yui/quickenrolment/quickenrolment.js +++ b/enrol/manual/yui/quickenrolment/quickenrolment.js @@ -380,7 +380,11 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) { params['role'] = this.get(UEP.BASE).one('.'+CSS.ENROLMENTOPTION+'.'+CSS.ROLE+' select').get('value'); params['startdate'] = this.get(UEP.BASE).one('.'+CSS.ENROLMENTOPTION+'.'+CSS.STARTDATE+' select').get('value'); params['duration'] = this.get(UEP.BASE).one('.'+CSS.ENROLMENTOPTION+'.'+CSS.DURATION+' select').get('value'); - params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0; + if (this.get(UEP.DISABLEGRADEHISTORY) != true) { + params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0; + } else { + params['recovergrades'] = 0; + } Y.io(M.cfg.wwwroot+this.get(UEP.AJAXURL), { method:'POST', diff --git a/enrol/meta/db/access.php b/enrol/meta/db/access.php index 54aad043e031a..b6d41a47b491f 100644 --- a/enrol/meta/db/access.php +++ b/enrol/meta/db/access.php @@ -1,5 +1,4 @@ set_url('/enrol/otherusers.php', $manager->get_url_params()+$table->get_url_params()); -/*** - * Actions will go here - */ +$userdetails = array ( + 'picture' => false, + 'firstname' => get_string('firstname'), + 'lastname' => get_string('lastname'), +); +$extrafields = get_extra_user_fields($context); +foreach ($extrafields as $field) { + $userdetails[$field] = get_user_field_name($field); +} -/*$fields = array( - 'userdetails' => array ( - 'picture' => false, - 'firstname' => get_string('firstname'), - 'lastname' => get_string('lastname'), - 'email' => get_string('email') - ), - 'lastseen' => get_string('lastaccess'), - 'role' => array( - 'roles' => get_string('roles', 'role'), - 'context' => get_string('context') - ) -);*/ $fields = array( - 'userdetails' => array ( - 'picture' => false, - 'firstname' => get_string('firstname'), - 'lastname' => get_string('lastname'), - 'email' => get_string('email') - ), + 'userdetails' => $userdetails, 'lastseen' => get_string('lastaccess'), 'role' => get_string('roles', 'role') ); + +// Remove hidden fields if the user has no access +if (!has_capability('moodle/course:viewhiddenuserfields', $context)) { + $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields)); + if (isset($hiddenfields['lastaccess'])) { + unset($fields['lastseen']); + } +} + $table->set_fields($fields, $OUTPUT); //$users = $manager->get_other_users($table->sort, $table->sortdirection, $table->page, $table->perpage); diff --git a/enrol/paypal/db/access.php b/enrol/paypal/db/access.php index c474d92a8d9fb..f97fff992fac0 100644 --- a/enrol/paypal/db/access.php +++ b/enrol/paypal/db/access.php @@ -1,5 +1,4 @@ -
    - + - - - + + + @@ -26,7 +26,7 @@ - + diff --git a/enrol/paypal/ipn.php b/enrol/paypal/ipn.php index 8c5f014582975..b4a6bf424031e 100644 --- a/enrol/paypal/ipn.php +++ b/enrol/paypal/ipn.php @@ -243,7 +243,7 @@ $eventdata->name = 'paypal_enrolment'; $eventdata->userfrom = $teacher; $eventdata->userto = $user; - $eventdata->subject = get_string("enrolmentnew", '', $shortname); + $eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname); $eventdata->fullmessage = get_string('welcometocoursetext', '', $a); $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = ''; @@ -262,8 +262,8 @@ $eventdata->name = 'paypal_enrolment'; $eventdata->userfrom = $user; $eventdata->userto = $teacher; - $eventdata->subject = get_string("enrolmentnew", '', $shortname); - $eventdata->fullmessage = get_string('enrolmentnewuser', '', $a); + $eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname); + $eventdata->fullmessage = get_string('enrolmentnewuser', 'enrol', $a); $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = ''; $eventdata->smallmessage = ''; @@ -281,8 +281,8 @@ $eventdata->name = 'paypal_enrolment'; $eventdata->userfrom = $user; $eventdata->userto = $admin; - $eventdata->subject = get_string("enrolmentnew", '', $shortname); - $eventdata->fullmessage = get_string('enrolmentnewuser', '', $a); + $eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname); + $eventdata->fullmessage = get_string('enrolmentnewuser', 'enrol', $a); $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = ''; $eventdata->smallmessage = ''; diff --git a/enrol/self/db/access.php b/enrol/self/db/access.php index 54fa9d8be221d..314720c29690e 100644 --- a/enrol/self/db/access.php +++ b/enrol/self/db/access.php @@ -1,5 +1,4 @@ get_config('showhint')) { - $textlib = textlib_get_instance(); - $hint = $textlib->substr($instance->password, 0, 1); + $hint = textlib::substr($instance->password, 0, 1); $errors['enrolpassword'] = get_string('passwordinvalidhint', 'enrol_self', $hint); } else { $errors['enrolpassword'] = get_string('passwordinvalid', 'enrol_self'); diff --git a/enrol/users.php b/enrol/users.php index 8ff9c26c638f2..2ebbab5ec8b84 100644 --- a/enrol/users.php +++ b/enrol/users.php @@ -183,6 +183,18 @@ 'group' => get_string('groups', 'group'), 'enrol' => get_string('enrolmentinstances', 'enrol') ); + +// Remove hidden fields if the user has no access +if (!has_capability('moodle/course:viewhiddenuserfields', $context)) { + $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields)); + if (isset($hiddenfields['lastaccess'])) { + unset($fields['lastseen']); + } + if (isset($hiddenfields['groups'])) { + unset($fields['group']); + } +} + $table->set_fields($fields, $renderer); $canassign = has_capability('moodle/role:assign', $manager->get_context()); @@ -202,4 +214,4 @@ echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('enrolledusers', 'enrol')); echo $renderer->render($table); -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/filter/algebra/AlgParser.pm b/filter/algebra/AlgParser.pm index 804e8328198e7..411ee98e43c7a 100644 --- a/filter/algebra/AlgParser.pm +++ b/filter/algebra/AlgParser.pm @@ -553,10 +553,10 @@ sub tolatex { if ($args[2]->[0] =~ /binop[12]|numberE|unop1/) {($p3,$p4)=qw{ \left( \right) };} if ($args[0] eq '/'){ -# return('\frac{' . $p1 . $args[1]->tolatex() . $p2 . '}'. +# return('\frac{' . $p1 . $args[1]->tolatex() . $p2 . '}'. # '{' . $p3 . $args[2]->tolatex() . $p4 . '}' ); return('\frac{' . $args[1]->tolatex() . '}'. - '{' . $args[2]->tolatex() . '}' ); + '{' . $args[2]->tolatex() . '}' ); } else{ return ($p1 . $args[1]->tolatex() . $p2 . $args[0] . $p3 . diff --git a/grade/edit/scale/edit_form.php b/grade/edit/scale/edit_form.php index fa6af485daf96..ccb7ab1d352ca 100644 --- a/grade/edit/scale/edit_form.php +++ b/grade/edit/scale/edit_form.php @@ -138,23 +138,22 @@ function validation($data, $files) { if (count($scalearray) < 2) { $errors['scale'] = get_string('badlyformattedscale', 'grades'); } else { - $thescale = implode(',',$scalearray); + $thescale = implode(',',$scalearray); - $textlib = textlib_get_instance(); //this check strips out whitespace from the scale we're validating but not from those already in the DB - $count = $DB->count_records_select('scale', "courseid=:courseid AND ".$DB->sql_compare_text('scale', $textlib->strlen($thescale)).'=:scale', - array('courseid'=>$courseid, 'scale'=>$thescale)); + $count = $DB->count_records_select('scale', "courseid=:courseid AND ".$DB->sql_compare_text('scale', textlib::strlen($thescale)).'=:scale', + array('courseid'=>$courseid, 'scale'=>$thescale)); if ($count) { //if this is a new scale but we found a duplice in the DB //or we found a duplicate in another course report the error if (empty($old->id) or $old->courseid != $courseid) { - $errors['scale'] = get_string('duplicatescale', 'grades'); + $errors['scale'] = get_string('duplicatescale', 'grades'); } else if ($old->scale !== $thescale and $old->scale !== $data['scale']) { //if the old scale from DB is different but we found a duplicate then we're trying to modify a scale to be a duplicate - $errors['scale'] = get_string('duplicatescale', 'grades'); - } - } + $errors['scale'] = get_string('duplicatescale', 'grades'); + } + } } } diff --git a/grade/export/ods/db/access.php b/grade/export/ods/db/access.php index 9207be1ea2290..c5ff1eb81f7f5 100644 --- a/grade/export/ods/db/access.php +++ b/grade/export/ods/db/access.php @@ -1,5 +1,4 @@ . +/** + * Capabilities gradeexport plugin. + * + * @package gradeexport_ods + * @copyright 2007 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradeexport/ods:view' => array( diff --git a/grade/export/txt/db/access.php b/grade/export/txt/db/access.php index 068e920c422a7..27adf4c1c1bfc 100644 --- a/grade/export/txt/db/access.php +++ b/grade/export/txt/db/access.php @@ -1,5 +1,4 @@ . +/** + * Capabilities gradeexport plugin. + * + * @package gradeexport_txt + * @copyright 2007 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradeexport/txt:view' => array( diff --git a/grade/export/xls/db/access.php b/grade/export/xls/db/access.php index 5c199167a2909..571888f7dad6d 100644 --- a/grade/export/xls/db/access.php +++ b/grade/export/xls/db/access.php @@ -1,5 +1,4 @@ . +/** + * Capabilities gradeexport plugin. + * + * @package gradeexport_xls + * @copyright 2007 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradeexport/xls:view' => array( diff --git a/grade/export/xml/db/access.php b/grade/export/xml/db/access.php index 068269e2fb773..3f8191232deed 100644 --- a/grade/export/xml/db/access.php +++ b/grade/export/xml/db/access.php @@ -1,5 +1,4 @@ . +/** + * Capabilities gradeexport plugin. + * + * @package gradeexport_xml + * @copyright 2007 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradeexport/xml:view' => array( diff --git a/grade/grading/form/rubric/db/install.xml b/grade/grading/form/rubric/db/install.xml index 01ea46e397176..1ac544d00ae3e 100644 --- a/grade/grading/form/rubric/db/install.xml +++ b/grade/grading/form/rubric/db/install.xml @@ -1,16 +1,16 @@ -
    - - - + + + - + @@ -19,11 +19,11 @@
    - - - + + + - + @@ -32,12 +32,12 @@
    - - - - + + + + - + diff --git a/grade/import/csv/db/access.php b/grade/import/csv/db/access.php index da144c5f37f64..1288047f181df 100644 --- a/grade/import/csv/db/access.php +++ b/grade/import/csv/db/access.php @@ -1,5 +1,4 @@ . +/** + * Capabilities gradeimport plugin. + * + * @package gradeimport_csv + * @copyright 2007 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradeimport/csv:view' => array( diff --git a/grade/import/csv/index.php b/grade/import/csv/index.php index 886bf4303d011..11ae292f7c4ba 100644 --- a/grade/import/csv/index.php +++ b/grade/import/csv/index.php @@ -116,10 +116,9 @@ $text = $mform->get_file_content('userfile'); // trim utf-8 bom - $textlib = textlib_get_instance(); /// normalize line endings and do the encoding conversion - $text = $textlib->convert($text, $formdata->encoding); - $text = $textlib->trim_utf8_bom($text); + $text = textlib::convert($text, $formdata->encoding); + $text = textlib::trim_utf8_bom($text); // Fix mac/dos newlines $text = preg_replace('!\r\n?!',"\n",$text); $fp = fopen($filename, "w"); diff --git a/grade/import/grade_import_form.php b/grade/import/grade_import_form.php index 84629f86788cb..6021f60a29713 100644 --- a/grade/import/grade_import_form.php +++ b/grade/import/grade_import_form.php @@ -41,8 +41,7 @@ function definition (){ // file upload $mform->addElement('filepicker', 'userfile', get_string('file')); $mform->addRule('userfile', null, 'required'); - $textlib = textlib_get_instance(); - $encodings = $textlib->get_encodings(); + $encodings = textlib::get_encodings(); $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings); if (!empty($features['includeseparator'])) { diff --git a/grade/import/xml/db/access.php b/grade/import/xml/db/access.php index 7d9460f8157d3..ff8820f384191 100644 --- a/grade/import/xml/db/access.php +++ b/grade/import/xml/db/access.php @@ -1,5 +1,4 @@ . +/** + * Capabilities gradeimport plugin. + * + * @package gradeimport_xml + * @copyright 2007 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradeimport/xml:view' => array( diff --git a/grade/report/grader/db/access.php b/grade/report/grader/db/access.php index 9859577bf68b5..ef0c9354aea4e 100644 --- a/grade/report/grader/db/access.php +++ b/grade/report/grader/db/access.php @@ -22,6 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradereport/grader:view' => array( diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 5771195be70cd..eca29e3f5d1fa 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -1039,7 +1039,7 @@ public function get_right_rows() { $module = array( 'name' => 'gradereport_grader', 'fullpath' => '/grade/report/grader/module.js', - 'requires' => array('base', 'dom', 'event', 'event-mouseenter', 'event-key', 'io-base', 'json-parse', 'overlay') + 'requires' => array('base', 'dom', 'event', 'event-mouseenter', 'event-key', 'io-queue', 'json-parse', 'overlay') ); $PAGE->requires->js_init_call('M.gradereport_grader.init_report', $jsarguments, false, $module); $PAGE->requires->strings_for_js(array('addfeedback','feedback', 'grade'), 'grades'); diff --git a/grade/report/outcomes/db/access.php b/grade/report/outcomes/db/access.php index a4dcba68ff328..3ad31f1017b65 100644 --- a/grade/report/outcomes/db/access.php +++ b/grade/report/outcomes/db/access.php @@ -22,6 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradereport/outcomes:view' => array( diff --git a/grade/report/overview/db/access.php b/grade/report/overview/db/access.php index 6843f94a7c7c4..b33412cee5de8 100644 --- a/grade/report/overview/db/access.php +++ b/grade/report/overview/db/access.php @@ -22,6 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradereport/overview:view' => array( diff --git a/grade/report/overview/renderer.php b/grade/report/overview/renderer.php index 1090d2fae26fb..d6be4761b687f 100644 --- a/grade/report/overview/renderer.php +++ b/grade/report/overview/renderer.php @@ -35,7 +35,7 @@ class gradereport_overview_renderer extends plugin_renderer_base { public function graded_users_selector($report, $course, $userid, $groupid, $includeall) { global $USER; - + $select = grade_get_graded_users_select($report, $course, $userid, $groupid, $includeall); $output = html_writer::tag('div', $this->output->render($select), array('id'=>'graded_users_selector')); $output .= html_writer::tag('p', '', array('style'=>'page-break-after: always;')); diff --git a/grade/report/user/db/access.php b/grade/report/user/db/access.php index ac07dbb8e8a12..5a54d5b64fd37 100644 --- a/grade/report/user/db/access.php +++ b/grade/report/user/db/access.php @@ -22,6 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'gradereport/user:view' => array( diff --git a/grade/report/user/lib.php b/grade/report/user/lib.php index 9e823cfe2114c..b57e8a1c251b7 100644 --- a/grade/report/user/lib.php +++ b/grade/report/user/lib.php @@ -312,6 +312,7 @@ private function fill_table_recursive(&$element) { $hidden = ''; $excluded = ''; $class = ''; + $classfeedback = ''; // If this is a hidden grade category, hide it completely from the user if ($type == 'category' && $grade_object->is_hidden() && !$this->canviewhidden && ( @@ -368,6 +369,10 @@ private function fill_table_recursive(&$element) { /// Actual Grade $gradeval = $grade_grade->finalgrade; + if ($this->showfeedback) { + // Copy $class before appending itemcenter as feedback should not be centered + $classfeedback = $class; + } $class .= " itemcenter "; if ($this->showweight) { $data['weight']['class'] = $class; @@ -477,13 +482,13 @@ private function fill_table_recursive(&$element) { // Feedback if ($this->showfeedback) { if ($grade_grade->overridden > 0 AND ($type == 'categoryitem' OR $type == 'courseitem')) { - $data['feedback']['class'] = $class.' feedbacktext'; + $data['feedback']['class'] = $classfeedback.' feedbacktext'; $data['feedback']['content'] = get_string('overridden', 'grades').': ' . format_text($grade_grade->feedback, $grade_grade->feedbackformat); } else if (empty($grade_grade->feedback) or (!$this->canviewhidden and $grade_grade->is_hidden())) { - $data['feedback']['class'] = $class.' feedbacktext'; + $data['feedback']['class'] = $classfeedback.' feedbacktext'; $data['feedback']['content'] = ' '; } else { - $data['feedback']['class'] = $class.' feedbacktext'; + $data['feedback']['class'] = $classfeedback.' feedbacktext'; $data['feedback']['content'] = format_text($grade_grade->feedback, $grade_grade->feedbackformat); } } diff --git a/grade/report/user/styles.css b/grade/report/user/styles.css index b7751e17523c7..f0e5a3c9c316e 100644 --- a/grade/report/user/styles.css +++ b/grade/report/user/styles.css @@ -33,8 +33,8 @@ .user-grade td.item {border-left: 1px solid gray;border-right: 1px solid gray;} .user-grade td.excluded {background-color: #666;} .user-grade td.hidden {color: #aaa;} -.user-grade td.feedbacktext {max-width:600px;padding:0;} +.user-grade td.feedbacktext {max-width:600px;padding:2px 2px;} .pagelayout-report .user-grade .feedbacktext .no-overflow {overflow:auto;padding:0.25em;} table.user-grade td.feedbacktext {text-align:left;width: 40%;font-size: 0.8em;white-space:normal;} -table.user-grade td.itemcenter {text-align:center;} \ No newline at end of file +table.user-grade td.itemcenter {text-align:center;} diff --git a/group/group_form.php b/group/group_form.php index 15639491787e1..37044effcb350 100644 --- a/group/group_form.php +++ b/group/group_form.php @@ -85,11 +85,9 @@ function validation($data, $files) { $errors = parent::validation($data, $files); - $textlib = textlib_get_instance(); - $name = trim($data['name']); if ($data['id'] and $group = $DB->get_record('groups', array('id'=>$data['id']))) { - if ($textlib->strtolower($group->name) != $textlib->strtolower($name)) { + if (textlib::strtolower($group->name) != textlib::strtolower($name)) { if (groups_get_group_by_name($COURSE->id, $name)) { $errors['name'] = get_string('groupnameexists', 'group', $name); } diff --git a/group/grouping_form.php b/group/grouping_form.php index f438882dc340f..258234e7ffb3e 100644 --- a/group/grouping_form.php +++ b/group/grouping_form.php @@ -75,11 +75,9 @@ function validation($data, $files) { $errors = parent::validation($data, $files); - $textlib = textlib_get_instance(); - $name = trim($data['name']); if ($data['id'] and $grouping = $DB->get_record('groupings', array('id'=>$data['id']))) { - if ($textlib->strtolower($grouping->name) != $textlib->strtolower($name)) { + if (textlib::strtolower($grouping->name) != textlib::strtolower($name)) { if (groups_get_grouping_by_name($COURSE->id, $name)) { $errors['name'] = get_string('groupingnameexists', 'group', $name); } diff --git a/index.php b/index.php index 99bae5f6d3ccd..946332d4c5f87 100644 --- a/index.php +++ b/index.php @@ -34,6 +34,13 @@ redirect_if_major_upgrade_required(); + $urlparams = array(); + if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 0) { + $urlparams['redirect'] = 0; + } + $PAGE->set_url('/', $urlparams); + $PAGE->set_course($SITE); + if ($CFG->forcelogin) { require_login(); } else { @@ -42,13 +49,6 @@ $hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); - $urlparams = array(); - if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 0) { - $urlparams['redirect'] = 0; - } - $PAGE->set_url('/', $urlparams); - $PAGE->set_course($SITE); - /// If the site is currently under maintenance, then print a message if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) { print_maintenance_message(); @@ -168,7 +168,7 @@ $newsforumcontext = get_context_instance(CONTEXT_MODULE, $newsforumcm->id, MUST_EXIST); $forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext)); - echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block')); + echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block')); if (isloggedin()) { $SESSION->fromdiscussion = $CFG->wwwroot; @@ -194,13 +194,13 @@ case FRONTPAGECOURSELIST: if (isloggedin() and !$hassiteconfig and !isguestuser() and empty($CFG->disablemycourses)) { - echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block')); + echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block')); echo $OUTPUT->heading(get_string('mycourses'), 2, 'headingblock header'); print_my_moodle(); echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipmycourses')); } else if ((!$hassiteconfig and !isguestuser()) or ($DB->count_records('course') <= FRONTPAGECOURSELIMIT)) { // admin should not see list of courses when there are too many of them - echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block')); + echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block')); echo $OUTPUT->heading(get_string('availablecourses'), 2, 'headingblock header'); print_courses(0); echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipavailablecourses')); @@ -208,7 +208,7 @@ break; case FRONTPAGECATEGORYNAMES: - echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block')); + echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block')); echo $OUTPUT->heading(get_string('categories'), 2, 'headingblock header'); echo $OUTPUT->box_start('generalbox categorybox'); print_whole_category_list(NULL, NULL, NULL, -1, false); @@ -218,7 +218,7 @@ break; case FRONTPAGECATEGORYCOMBO: - echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block')); + echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block')); echo $OUTPUT->heading(get_string('courses'), 2, 'headingblock header'); $renderer = $PAGE->get_renderer('core','course'); // if there are too many courses, budiling course category tree could be slow, diff --git a/install/lang/ca_valencia/admin.php b/install/lang/ca_valencia/admin.php new file mode 100644 index 0000000000000..8343647de138e --- /dev/null +++ b/install/lang/ca_valencia/admin.php @@ -0,0 +1,44 @@ +. + +/** + * Automatically generated strings for Moodle 2.3dev installer + * + * Do not edit this file manually! It contains just a subset of strings + * needed during the very first steps of installation. This file was + * generated automatically by export-installer.php (which is part of AMOS + * {@link http://docs.moodle.org/dev/Languages/AMOS}) using the + * list of strings defined in /install/stringnames.txt. + * + * @package installer + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['clianswerno'] = 'No'; +$string['cliansweryes'] = 'Sí'; +$string['cliincorrectvalueerror'] = 'Error, valor incorrecte "{$a->value}" per a "{$a->option}"'; +$string['cliincorrectvalueretry'] = 'Valor incorrecte, per favor, torneu-ho a provar.'; +$string['clitypevalue'] = 'Valor de tipus'; +$string['clitypevaluedefault'] = 'valor de tipus, premeu Intro per fer servir un valor per defecte ({$a})'; +$string['cliunknowoption'] = 'Opcions invàlides: + {$a} +L\'opció --help vos orientarà.'; +$string['cliyesnoprompt'] = 'Escriu y (significa Sí) o n (significa No)'; +$string['environmentrequireinstall'] = 'es requereix instal·lar/habilitar'; +$string['environmentrequireversion'] = 'esteu executant la versió {$a->current} i es requereix la {$a->needed}'; diff --git a/install/lang/ca_valencia/langconfig.php b/install/lang/ca_valencia/langconfig.php new file mode 100644 index 0000000000000..82852804455a1 --- /dev/null +++ b/install/lang/ca_valencia/langconfig.php @@ -0,0 +1,35 @@ +. + +/** + * Automatically generated strings for Moodle 2.3dev installer + * + * Do not edit this file manually! It contains just a subset of strings + * needed during the very first steps of installation. This file was + * generated automatically by export-installer.php (which is part of AMOS + * {@link http://docs.moodle.org/dev/Languages/AMOS}) using the + * list of strings defined in /install/stringnames.txt. + * + * @package installer + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['parentlanguage'] = 'ca'; +$string['thisdirection'] = 'ltr'; +$string['thislanguage'] = 'Valencià (Català meridional)'; diff --git a/install/lang/en_ar/langconfig.php b/install/lang/en_ar/langconfig.php new file mode 100644 index 0000000000000..809db1ac2bf1b --- /dev/null +++ b/install/lang/en_ar/langconfig.php @@ -0,0 +1,34 @@ +. + +/** + * Automatically generated strings for Moodle 2.3dev installer + * + * Do not edit this file manually! It contains just a subset of strings + * needed during the very first steps of installation. This file was + * generated automatically by export-installer.php (which is part of AMOS + * {@link http://docs.moodle.org/dev/Languages/AMOS}) using the + * list of strings defined in /install/stringnames.txt. + * + * @package installer + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['parentlanguage'] = 'en'; +$string['thislanguage'] = 'English - Pirate'; diff --git a/install/lang/eu/install.php b/install/lang/eu/install.php index 1708adf8f420f..4f7b57e26edb1 100644 --- a/install/lang/eu/install.php +++ b/install/lang/eu/install.php @@ -37,8 +37,9 @@ $string['databasehost'] = 'Datu-basearen ostalaria'; $string['databasename'] = 'Datu-basearen izena'; $string['dataroot'] = 'Datu-direktorioa'; +$string['datarootpermission'] = 'Datu-direktorioen baimena'; $string['dbprefix'] = 'Taulen aurrizkia'; -$string['dirroot'] = 'Moodle-ren direktorioa'; +$string['dirroot'] = 'Moodle direktorioa'; $string['environmenthead'] = 'Zure ingurunea egiaztatzen...'; $string['errorsinenvironment'] = 'Kale egin du ingurunearen egiaztatzeak!'; $string['installation'] = 'Instalazioa'; diff --git a/install/lang/he/install.php b/install/lang/he/install.php index ac6a0d44e2e26..a756854938a3f 100644 --- a/install/lang/he/install.php +++ b/install/lang/he/install.php @@ -86,10 +86,10 @@ $string['pathswrongadmindir'] = 'ספריית ×”-admin ×œ× ×§×™×™×ž×ª'; $string['phpextension'] = 'הרחבת PHP {$a}'; $string['phpversion'] = 'גירסת PHP'; -$string['phpversionhelp'] = '

    גירסת PHP חייבת להיות לפחות 4.3.0 ×ו 5.1.0 (בגירס×ות 5.0.x קיימות מספר בעיות ידועות)

    -

    במערכת שלך פועלת כרגע גירסת {$a}

    -

    ×תה חייב לשדרג ×ת גירסת ×”-PHP שלך ×ו לעבור למחשב מ×רח ×¢× ×¢× ×’×™×¨×¡×ª PHP חדשה!
    -(×‘×ž×§×¨×™× ×©×œ גרסת 5.0.x תוכל ×’× ×œ×¨×“×ª בגירסה ל- 4.4.x) +$string['phpversionhelp'] = '

    גרסת PHP חייבת להיות לפחות 4.3.0 ×ו 5.1.0 (בגרס×ות 5.0.x קיימות מספר בעיות ידועות)

    +

    במערכת שלך פועלת כרגע גרסת {$a}

    +

    ×תה חייב לשדרג ×ת גרסת ×”-PHP שלך ×ו לעבור למחשב מ×רח ×¢× ×¢× ×’×™×¨×¡×ª PHP חדשה!
    +(×‘×ž×§×¨×™× ×©×œ גרסת 5.0.x תוכל ×’× ×œ×¨×“×ª בגרסה ל- 4.4.x)

    '; $string['welcomep10'] = '{$a->installername} ({$a->installerversion})'; $string['welcomep20'] = 'הינך רו××” ×ת עמוד ×–×” מפני שהתקנת והפעלת בהלכה ×ת {$a->packname} {$a->packversion} diff --git a/install/lang/hr/install.php b/install/lang/hr/install.php index 068abc674421f..babe10112c5d8 100644 --- a/install/lang/hr/install.php +++ b/install/lang/hr/install.php @@ -34,12 +34,14 @@ $string['availablelangs'] = 'Popis dostupnih jezika'; $string['chooselanguagehead'] = 'Odaberite jezik'; $string['chooselanguagesub'] = 'Molimo odaberite jezik instalacije. Ovaj jezik će biti koriÅ¡ten kao zadani jezik sustava, a kasnije to možete lagano promijeniti.'; +$string['clialreadyconfigured'] = 'Datoteka config.php već postoji. Upotrijebite naredbu admin/cli/install_database.php ako želite nastaviti instalaciju.'; $string['clialreadyinstalled'] = 'Datoteka config.php već postoji. Upotrijebite naredbu admin/cli/upgrade.php ako želite nadograditi svoj sustav.'; $string['cliinstallheader'] = 'Moodle {$a} program za instalaciju iz naredbenog retka'; $string['databasehost'] = 'Poslužitelj baze podataka (HOST)'; $string['databasename'] = 'Naziv baze podataka'; $string['databasetypehead'] = 'Odaberite vrstu baze podataka'; $string['dataroot'] = 'Mapa s podacima'; +$string['datarootpermission'] = 'Ovlasti nad mapom s podacima'; $string['dbprefix'] = 'Prefiks tablice'; $string['dirroot'] = 'Moodle mapa'; $string['environmenthead'] = 'Provjera okruženja vaÅ¡eg poslužitelja ...'; diff --git a/install/lang/kl/langconfig.php b/install/lang/kl/langconfig.php new file mode 100644 index 0000000000000..06e2ba396da79 --- /dev/null +++ b/install/lang/kl/langconfig.php @@ -0,0 +1,33 @@ +. + +/** + * Automatically generated strings for Moodle 2.3dev installer + * + * Do not edit this file manually! It contains just a subset of strings + * needed during the very first steps of installation. This file was + * generated automatically by export-installer.php (which is part of AMOS + * {@link http://docs.moodle.org/dev/Languages/AMOS}) using the + * list of strings defined in /install/stringnames.txt. + * + * @package installer + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['thislanguage'] = 'Kalaallisut'; diff --git a/install/lang/nl/install.php b/install/lang/nl/install.php index 5c93c66ba4995..e1fac48e1cf67 100644 --- a/install/lang/nl/install.php +++ b/install/lang/nl/install.php @@ -39,7 +39,7 @@ $string['databasehost'] = 'Databank host:'; $string['databasename'] = 'Datanbanknaam:'; $string['databasetypehead'] = 'Kies databankdriver'; -$string['dataroot'] = 'Gegevens'; +$string['dataroot'] = 'Gegevensmap'; $string['dbprefix'] = 'Tabelvoorvoegsel'; $string['dirroot'] = 'Moodle-map'; $string['environmenthead'] = 'Omgeving controleren ...'; diff --git a/install/lang/pt/admin.php b/install/lang/pt/admin.php index e27070f5d6532..783189c0c1078 100644 --- a/install/lang/pt/admin.php +++ b/install/lang/pt/admin.php @@ -32,11 +32,13 @@ $string['clianswerno'] = 'n'; $string['cliansweryes'] = 's'; -$string['cliincorrectvalueretry'] = 'Valor incorrecto, por favor tente novamente'; +$string['cliincorrectvalueerror'] = 'Erro. Valor "{$a->value}" incorreto para "{$a->option}"'; +$string['cliincorrectvalueretry'] = 'Valor incorreto, por favor tente novamente'; $string['clitypevalue'] = 'valor do tipo'; +$string['clitypevaluedefault'] = 'Escreva o valor. Ou Enter para usar o valor por omissão ({$a}).'; $string['cliunknowoption'] = 'Opções desconhecidas: {$a} Por favor use a opção --help'; $string['cliyesnoprompt'] = 'digite s (para sim) ou n (para não)'; -$string['environmentrequireinstall'] = 'é necessário estar instalada/activa'; +$string['environmentrequireinstall'] = 'é necessário estar instalada/ativa'; $string['environmentrequireversion'] = 'É requerida a versão {$a->needed} e está a correr a versão {$a->current}'; diff --git a/install/lang/pt/error.php b/install/lang/pt/error.php index 565007770158b..16f6da4d36a5a 100644 --- a/install/lang/pt/error.php +++ b/install/lang/pt/error.php @@ -30,15 +30,15 @@ defined('MOODLE_INTERNAL') || die(); -$string['cannotcreatelangdir'] = 'Não é possível criar o directório para pacotes linguísticos'; -$string['cannotcreatetempdir'] = 'Não é possível criar o directório temporário'; +$string['cannotcreatelangdir'] = 'Não é possível criar o diretório para pacotes linguísticos'; +$string['cannotcreatetempdir'] = 'Não é possível criar o diretório temporário'; $string['cannotdownloadcomponents'] = 'Não é possível descarregar componentes'; $string['cannotdownloadzipfile'] = 'Não é possível descarregar o ficheiro ZIP'; $string['cannotfindcomponent'] = 'O componente não foi encontrado'; $string['cannotsavemd5file'] = 'Não é possível gravar ficheiro md5'; $string['cannotsavezipfile'] = 'Não é possível gravar ficheiro ZIP'; -$string['cannotunzipfile'] = 'Não é possível descompactar ficheiro ZIP'; -$string['componentisuptodate'] = 'O componente está actualizado'; +$string['cannotunzipfile'] = 'Não é possível descompatar ficheiro ZIP'; +$string['componentisuptodate'] = 'O componente está atualizado'; $string['downloadedfilecheckfailed'] = 'Falhou a verificação do ficheiro descarregado.'; $string['invalidmd5'] = 'md5 inválido'; $string['missingrequiredfield'] = 'Falta algum campo necessário'; diff --git a/install/lang/pt/install.php b/install/lang/pt/install.php index de7b066dad0bb..5a7334f29516b 100644 --- a/install/lang/pt/install.php +++ b/install/lang/pt/install.php @@ -30,26 +30,26 @@ defined('MOODLE_INTERNAL') || die(); -$string['admindirname'] = 'Directório de administração'; +$string['admindirname'] = 'Diretório de administração'; $string['availablelangs'] = 'Lista de línguas disponíveis'; $string['chooselanguagehead'] = 'Escolha uma língua'; $string['chooselanguagesub'] = 'Escolha por favor a língua a usar na instalação. Esta língua será usada por omissão no site, mas pode ser alterada posteriormente.'; -$string['clialreadyinstalled'] = 'O ficheiro config.php já existe. Por favor, use o script admin/cli/upgrade.php se quiser actualizar o seu site.'; +$string['clialreadyinstalled'] = 'O ficheiro config.php já existe. Por favor, use o script admin/cli/upgrade.php se quiser atualizar o seu site.'; $string['cliinstallheader'] = 'Programa de instalação do Moodle {$a} por linha de comandos'; $string['databasehost'] = 'Servidor da base de dados'; $string['databasename'] = 'Nome da base de dados'; $string['databasetypehead'] = 'Escolha driver da base de dados'; -$string['dataroot'] = 'Directório de dados'; +$string['dataroot'] = 'Diretório de dados'; $string['dbprefix'] = 'Prefixo das tabelas'; -$string['dirroot'] = 'Directório do Moodle'; +$string['dirroot'] = 'Diretório do Moodle'; $string['environmenthead'] = 'A verificar o seu ambiente ...'; -$string['environmentsub2'] = 'Cada versão do Moodle tem requisitos mínimos relativamente à versão do PHP e às extensões PHP obrigatórias. É feita uma análise total ao ambiente existente antes de cada instalação ou actualização. Por favor contacte o seu administrador de sistemas se não souber como instalar uma nova versão do PHP ou activar as suas extensões.'; +$string['environmentsub2'] = 'Cada versão do Moodle tem requisitos mínimos relativamente à versão do PHP e às extensões PHP obrigatórias. É feita uma análise total ao ambiente existente antes de cada instalação ou atualização. Por favor contate o seu administrador de sistemas se não souber como instalar uma nova versão do PHP ou ativar as suas extensões.'; $string['errorsinenvironment'] = 'Erros no ambiente!'; $string['installation'] = 'Instalação'; $string['langdownloaderror'] = 'Não foi possível descarregar a língua "{$a}". O processo de instalação continuará em Inglês.'; -$string['memorylimithelp'] = '

    Actualmente o seu servidor impõe ao PHP um limite de memória de {$a}.

    +$string['memorylimithelp'] = '

    Atualmente o seu servidor impõe ao PHP um limite de memória de {$a}.

    -

    Isso poderá causar mais tarde problemas, especialmente se tiver um grande número de módulos activos e/ou um número elevado de utilizadores.

    +

    Isso poderá causar mais tarde problemas, especialmente se tiver um grande número de módulos ativos e/ou um número elevado de utilizadores.

    Recomendamos que configure o PHP com um limite maior, por exemplo, 40M. Existem várias formas de fazer essa alteração:

    @@ -57,39 +57,39 @@
  • Recompilar o PHP com --enable-memory-limit. Isso permitirá que o próprio Moodle modifique o limite de memória.
  • Se tiver acesso ao ficheiro php.ini, poderá modificar o valor de memory_limit para algo como 40M. Se não tiver acesso, poderá pedir ao adiminstrador do seu sistema que o faça.
  • -
  • Em alguns servidores PHP poderá criar um ficheiro .htaccess no directório do Moodle, com a linha: +
  • Em alguns servidores PHP poderá criar um ficheiro .htaccess no diretório do Moodle, com a linha:

    php_value memory_limit 40M

    No entanto, em alguns servidores, isso faz com que nenhuma página PHP funcione (verá erros quando tentar ver as páginas) e terá que apagar o ficheiro .htaccess.

  • '; $string['paths'] = 'Caminhos'; -$string['pathserrcreatedataroot'] = 'O programa de instalação não conseguiu criar o directório de dados ({$a->dataroot})'; +$string['pathserrcreatedataroot'] = 'O programa de instalação não conseguiu criar o diretório de dados ({$a->dataroot})'; $string['pathshead'] = 'Confirmar caminhos'; -$string['pathsrodataroot'] = 'A directoria dataroot não tem permissões de escrita.'; -$string['pathsroparentdataroot'] = 'O directório pai ({$a->parent}) não tem permissões de escrita. O programa de instalação não conseguiu criar o directório de dados ({$a->dataroot})'; +$string['pathsrodataroot'] = 'A diretoria dataroot não tem permissões de escrita.'; +$string['pathsroparentdataroot'] = 'O diretório pai ({$a->parent}) não tem permissões de escrita. O programa de instalação não conseguiu criar o diretório de dados ({$a->dataroot})'; $string['pathssubadmindir'] = 'Alguns (poucos) alojamentos web usam /admin como um URL especial para permitir o acesso ao control panel ou a outras funcionalidades. Infelizmente esta designação entra em conflito com a localização que o Moodle atribui às páginas de administração. -A solução passa por renomear o directório admin da sua instalação do Moodle e colocando o nome escolhido aqui. Por exemplo: +A solução passa por renomear o diretório admin da sua instalação do Moodle e colocando o nome escolhido aqui. Por exemplo: moodleadmin. Isto corrige os links de administração no Moodle.'; -$string['pathssubdataroot'] = 'É necessário um local onde o Moodle possa gravar os ficheiros submetidos. Este directório tem que ter permissões de leitura e ESCRITA pelo servidor web (normalmente \'nobody\' ou \'apache\'), mas não pode estar acessível através da web. O programa de instalação tentará criar este directório se ele ainda não existir.'; -$string['pathssubdirroot'] = 'Caminho completo para a directoria de instalação do Moodle.'; +$string['pathssubdataroot'] = 'É necessário um local onde o Moodle possa gravar os ficheiros submetidos. Este diretório tem que ter permissões de leitura e ESCRITA pelo servidor web (normalmente \'nobody\' ou \'apache\'), mas não pode estar acessível através da web. O programa de instalação tentará criar este diretório se ele ainda não existir.'; +$string['pathssubdirroot'] = 'Caminho completo para a diretoria de instalação do Moodle.'; $string['pathssubwwwroot'] = 'Endereço web completo para acesso ao Moodle. Não é possível aceder ao Moodle usando vários endereços. -Se o seu site tem vários endereços públicos é necessário definir redireccionamentos permanentes em todos eles excepto neste. +Se o seu site tem vários endereços públicos é necessário definir redirecionamentos permanentes em todos eles exceto neste. Se o seu site pode ser acedido via intranet e Internet use este endereço público e configure o DNS para que a intranet permita a utilização deste endereço. -Se o endereço não estiver correcto mude o URL no seu browser para reiniciar a instalação com um valor diferente.'; -$string['pathsunsecuredataroot'] = 'O directório dataroot não é seguro'; -$string['pathswrongadmindir'] = 'A directoria admin não existe'; +Se o endereço não estiver correto mude o URL no seu browser para reiniciar a instalação com um valor diferente.'; +$string['pathsunsecuredataroot'] = 'O diretório dataroot não é seguro'; +$string['pathswrongadmindir'] = 'A diretoria admin não existe'; $string['phpextension'] = 'Extensão PHP {$a}'; $string['phpversion'] = 'Versão do PHP'; $string['phpversionhelp'] = '

    O Moodle precisa da versão 4.3.0 ou 5.1.0 do PHP (5.0.x produz vários problemas) ou superior.

    -

    Actualmente está a utilizar a versão {$a}

    -

    Deverá actualizar o PHP ou migrar para outro servidor com uma versão do PHP mais recente!

    +

    Atualmente está a utilizar a versão {$a}

    +

    Deverá atualizar o PHP ou migrar para outro servidor com uma versão do PHP mais recente!

    (No caso da versão 5.0.x, poderá regredir para uma versão 4.4.x)

    '; $string['welcomep10'] = '{$a->installername} ({$a->installerversion})'; $string['welcomep20'] = 'Está a ver esta página porque o pacote {$a->packname} {$a->packversion} foi instalado e posto a funcionar com sucesso no seu computador. Parabens!'; $string['welcomep30'] = 'Esta versão do {$a->installername} inclui aplicações para criar um ambiente onde o Moodle possa funcionar, nomeadamente:'; $string['welcomep40'] = 'Este pacote também inclui Moodle {$a->moodlerelease} ({$a->moodleversion}).'; -$string['welcomep50'] = 'A utilização de todas as aplicações neste pacote está regida pelas respectivas licenças. O pacote {$a->installername} completo é open source distribuido nos termos da licença GPL.'; -$string['welcomep60'] = 'As páginas seguintes vão conduzí-lo por alguns passos simples de seguir para configurar o Moodle no seu computador. Poderá aceitar as definições seleccionadas por omissão, ou, opcionalmente, usar outras definições mais apropriadas às suas necessidades.'; +$string['welcomep50'] = 'A utilização de todas as aplicações neste pacote está regida pelas respetivas licenças. O pacote {$a->installername} completo é open source distribuido nos termos da licença GPL.'; +$string['welcomep60'] = 'As páginas seguintes vão conduzí-lo por alguns passos simples de seguir para configurar o Moodle no seu computador. Poderá aceitar as definições selecionadas por omissão, ou, opcionalmente, usar outras definições mais apropriadas às suas necessidades.'; $string['welcomep70'] = 'Clique no botão "Seguinte" em baixo, para continuar com a configuração do Moodle.'; $string['wwwroot'] = 'Endereço Web'; diff --git a/iplookup/lib.php b/iplookup/lib.php index 920f55551f0a0..44a2c80c52e7d 100644 --- a/iplookup/lib.php +++ b/iplookup/lib.php @@ -39,8 +39,6 @@ function iplookup_find_location($ip) { if (!empty($CFG->geoipfile) and file_exists($CFG->geoipfile)) { require_once('Net/GeoIP.php'); - $textlib = textlib_get_instance(); - $geoip = Net_GeoIP::getInstance($CFG->geoipfile, Net_GeoIP::STANDARD); $location = $geoip->lookupLocation($ip); $geoip->close(); @@ -50,7 +48,7 @@ function iplookup_find_location($ip) { return $info; } if (!empty($location->city)) { - $info['city'] = $textlib->convert($location->city, 'iso-8859-1', 'utf-8'); + $info['city'] = textlib::convert($location->city, 'iso-8859-1', 'utf-8'); $info['title'][] = $info['city']; } diff --git a/lang/en/admin.php b/lang/en/admin.php index dbf6a26d7cc1d..6b6c8dfe3df48 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -106,6 +106,7 @@ {$a} Please use --help option.'; $string['cliupgradefinished'] = 'Command line upgrade completed successfully.'; +$string['cliupgradenoneed'] = 'No upgrade needed for the installed version {$a}. Thanks for coming anyway!'; $string['cliyesnoprompt'] = 'type y (means yes) or n (means no)'; $string['commentsperpage'] = 'Comments displayed per page'; $string['commonfiltersettings'] = 'Common filter settings'; @@ -377,6 +378,7 @@ $string['curlrequired'] = 'The cURL PHP extension is now required by Moodle, in order to communicate with Moodle repositories.'; $string['curltimeoutkbitrate'] = 'Bitrate to use when calculating cURL timeouts (Kbps)'; $string['curltimeoutkbitrate_help'] = 'This setting is used to calculate an appropriate timeout during large cURL requests. As part of this calculation an HTTP HEAD request is made to determine the size of the content. Setting this to 0 disables this request from being made.'; +$string['currenttheme'] = 'Current theme'; $string['customcheck'] = 'Other checks'; $string['custommenu'] = 'Custom menu'; $string['custommenuitems'] = 'Custom menu items'; @@ -701,6 +703,8 @@ $string['navshowfrontpagemods_help'] = 'If enabled, front page activities will be shown on the navigation under site pages.'; $string['navshowallcourses'] = 'Show all courses'; $string['navshowcategories'] = 'Show course categories'; +$string['navshowmycoursecategories'] = 'Show my course categories'; +$string['navshowmycoursecategories_help'] = 'If enabled courses in the users my courses branch will be shown in categories.'; $string['neverdeleteruns'] = 'Never delete runs'; $string['nobookmarksforuser'] = 'You do not have any bookmarks.'; $string['nodatabase'] = 'No database'; @@ -883,6 +887,8 @@ $string['sectionerror'] = 'Section error!'; $string['secureforms'] = 'Use additional form security'; $string['security'] = 'Security'; +$string['selectdevice'] = 'Select device'; +$string['selecttheme'] = 'Select theme for {$a} device'; $string['server'] = 'Server'; $string['serverchecks'] = 'Server checks'; $string['serverlimit'] = 'Server limit'; @@ -946,7 +952,7 @@ $string['themelist'] = 'Theme list'; $string['themenoselected'] = 'No theme selected'; $string['themeresetcaches'] = 'Clear theme caches'; -$string['themeselect'] = 'Select theme'; +$string['themeselect'] = 'Change theme'; $string['themeselector'] = 'Theme selector'; $string['themesettings'] = 'Theme settings'; $string['therewereerrors'] = 'There were errors in your data'; @@ -963,6 +969,7 @@ $string['unicoderecommended'] = 'Storing all your data in Unicode (UTF-8) is recommended. New installations should be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).'; $string['unicoderequired'] = 'It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).'; $string['uninstallplugin'] = 'Uninstall'; +$string['unsettheme'] = 'Unset theme'; $string['unsupported'] = 'Unsupported'; $string['unsuspenduser'] = 'Activate user account'; $string['updateaccounts'] = 'Update existing accounts'; diff --git a/lang/en/auth.php b/lang/en/auth.php index 72bd8e688f54d..3c0ada00aff04 100644 --- a/lang/en/auth.php +++ b/lang/en/auth.php @@ -128,7 +128,7 @@ $string['stdchangepassword'] = 'Use standard page for changing password'; $string['stdchangepassword_expl'] = 'If the external authentication system allows password changes through Moodle, switch this to Yes. This setting overrides \'Change Password URL\'.'; $string['stdchangepassword_explldap'] = 'NOTE: It is recommended that you use LDAP over an SSL encrypted tunnel (ldaps://) if the LDAP server is remote.'; -$string['suspended'] = 'Suspended acount'; +$string['suspended'] = 'Suspended account'; $string['suspended_help'] = 'Suspended user accounts cannot log in or use web services, and any outgoing messages are discarded.'; $string['unlocked'] = 'Unlocked'; $string['unlockedifempty'] = 'Unlocked if empty'; diff --git a/lang/en/backup.php b/lang/en/backup.php index 0116d50c36fef..a2cea189cbf9f 100644 --- a/lang/en/backup.php +++ b/lang/en/backup.php @@ -86,7 +86,6 @@ $string['configgenerallogs'] = 'If enabled logs will be included in backups by default.'; $string['configgeneralroleassignments'] = 'If enabled by default roles assignments will also be backed up.'; $string['configgeneraluserscompletion'] = 'If enabled user completion information will be included in backups by default.'; -$string['configgeneraluserfiles'] = 'Sets the default for whether user files will be included in backups.'; $string['configgeneralusers'] = 'Sets the default for whether to include users in backups.'; $string['confirmcancel'] = 'Cancel backup'; $string['confirmcancelquestion'] = 'Are you sure you wish to cancel? @@ -127,7 +126,6 @@ $string['generallogs'] = 'Include logs'; $string['generalroleassignments'] = 'Include role assignments'; $string['generaluserscompletion'] = 'Include user completion information'; -$string['generaluserfiles'] = 'Include user files'; $string['generalusers'] = 'Include users'; $string['importfile'] = 'Import a backup file'; $string['importbackupstage1action'] = 'Next'; @@ -200,7 +198,6 @@ $string['rootsettingusers'] = 'Include enrolled users'; $string['rootsettinganonymize'] = 'Anonymize user information'; $string['rootsettingroleassignments'] = 'Include user role assignments'; -$string['rootsettinguserfiles'] = 'Include user files'; $string['rootsettingactivities'] = 'Include activities'; $string['rootsettingblocks'] = 'Include blocks'; $string['rootsettingfilters'] = 'Include filters'; diff --git a/lang/en/calendar.php b/lang/en/calendar.php index 5157014e63e75..dd0b7b46985e1 100644 --- a/lang/en/calendar.php +++ b/lang/en/calendar.php @@ -114,7 +114,7 @@ $string['quickdownloadcalendar'] = 'Quick download / subscribe to calendar'; $string['recentupcoming'] = 'Recent and next 60 days'; $string['repeatedevents'] = 'Repeated events'; -$string['repeateditall'] = 'Apply changes to all {$a} events in this repeat series'; +$string['repeateditall'] = 'Also apply changes to the other {$a} events in this repeat series'; $string['repeateditthis'] = 'Apply changes to this event only'; $string['repeatevent'] = 'Repeat this event'; $string['repeatnone'] = 'No repeats'; diff --git a/lang/en/completion.php b/lang/en/completion.php index 66fc44d06810d..c55779e23dc67 100644 --- a/lang/en/completion.php +++ b/lang/en/completion.php @@ -36,12 +36,12 @@ $string['completion_link'] = 'activity/completion'; $string['completion-alt-auto-enabled'] = 'The system marks this item complete according to conditions'; $string['completion-alt-auto-fail'] = 'Completed (did not achieve pass grade)'; -$string['completion-alt-auto-n'] = 'Not completed'; +$string['completion-alt-auto-n'] = 'Not completed: {$a}'; $string['completion-alt-auto-pass'] = 'Completed (achieved pass grade)'; -$string['completion-alt-auto-y'] = 'Completed'; +$string['completion-alt-auto-y'] = 'Completed: {$a}'; $string['completion-alt-manual-enabled'] = 'Students can manually mark this item complete'; -$string['completion-alt-manual-n'] = 'Not completed; select to mark as complete'; -$string['completion-alt-manual-y'] = 'Completed; select to mark as not complete'; +$string['completion-alt-manual-n'] = 'Not completed: {$a}. Select to mark as complete.'; +$string['completion-alt-manual-y'] = 'Completed: {$a}. Select to mark as not complete.'; $string['completion_automatic'] = 'Show activity as complete when conditions are met'; $string['completiondisabled'] = 'Disabled, not shown in activity settings'; $string['completionexpected'] = 'Expect completed on'; @@ -54,8 +54,8 @@ If a blank tick box is shown, a tick will appear automatically when you have completed the activity according to conditions set by the teacher.'; $string['completion_manual'] = 'Students can manually mark the activity as completed'; $string['completion_none'] = 'Do not indicate activity completion'; -$string['completion-title-manual-n'] = 'Mark as complete'; -$string['completion-title-manual-y'] = 'Mark as not complete'; +$string['completion-title-manual-n'] = 'Mark as complete: {$a}'; +$string['completion-title-manual-y'] = 'Mark as not complete: {$a}'; $string['completionnotenabled'] = 'Completion is not enabled'; $string['completionnotenabledforcourse'] = 'Completion is not enabled for this course'; $string['completionnotenabledforsite'] = 'Completion is not enabled for this site'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index f9371e34bb895..fd18d930630ca 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -455,6 +455,7 @@ $string['dndenabled'] = 'Drag and drop available'; $string['dndenabled_help'] = 'You can drag one or more files from your desktop and drop them onto the box below to upload them.
    Note: this may not work with other web browsers'; $string['dndenabled_insentence'] = 'drag and drop available'; +$string['dndenabled_inbox'] = 'drag and drop files here to upload them'; $string['documentation'] = 'Moodle documentation'; $string['down'] = 'Down'; $string['download'] = 'Download'; @@ -970,6 +971,7 @@ $string['markedthistopic'] = 'This topic is highlighted as the current topic'; $string['markthistopic'] = 'Highlight this topic as the current topic'; $string['matchingsearchandrole'] = 'Matching \'{$a->search}\' and {$a->role}'; +$string['maxsizeandattachments'] = 'Maximum size for new files: {$a->size}, maximum attachments: {$a->attachments}'; $string['maxfilesreached'] = 'You are allowed to attach a maximum of {$a} file(s) to this item'; $string['maximumgrade'] = 'Maximum grade'; $string['maximumgradex'] = 'Maximum grade: {$a}'; diff --git a/lang/en/question.php b/lang/en/question.php index 48a68b7a39ace..8fdab4fbe95e7 100644 --- a/lang/en/question.php +++ b/lang/en/question.php @@ -386,6 +386,7 @@ $string['showquestiontext'] = 'Show question text in the question list'; $string['shown'] = 'Shown'; $string['shownumpartscorrect'] = 'Show the number of correct responses'; +$string['shownumpartscorrectwhenfinished'] = 'Show the number of correct responses once the question has finished'; $string['specificfeedback'] = 'Specific feedback'; $string['started'] = 'Started'; $string['state'] = 'State'; diff --git a/lib/accesslib.php b/lib/accesslib.php index 29aac48d35720..bd45588f988ab 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -33,20 +33,25 @@ * - has_all_capabilities() * - require_capability() * - require_login() (from moodlelib) + * - is_enrolled() + * - is_viewing() + * - is_guest() * - is_siteadmin() + * - isguestuser() + * - isloggedin() * * What courses has this user access to? * - get_enrolled_users() * * What users can do X in this context? - * - get_users_by_capability() + * - get_enrolled_users() - at and bellow course context + * - get_users_by_capability() - above course context * * Modify roles * - role_assign() * - role_unassign() * - role_unassign_all() * - * * Advanced - for internal use only * - load_all_capabilities() * - reload_all_capabilities() @@ -117,8 +122,7 @@ * DB need to ensure that the default role caps * are dealt with appropriately. * - * @package core - * @subpackage role + * @package core_access * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -155,11 +159,11 @@ define('RISK_MANAGETRUST', 0x0001); /** Capability allows changes in system configuration - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ define('RISK_CONFIG', 0x0002); -/** Capability allows user to add scritped content - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ +/** Capability allows user to add scripted content - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ define('RISK_XSS', 0x0004); /** Capability allows access to personal user information - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ define('RISK_PERSONAL', 0x0008); -/** Capability allows users to add content otehrs may see - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ +/** Capability allows users to add content others may see - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ define('RISK_SPAM', 0x0010); /** capability allows mass delete of data belonging to other users - see {@link http://docs.moodle.org/dev/Hardening_new_Roles_system} */ define('RISK_DATALOSS', 0x0020); @@ -177,8 +181,8 @@ /** rolename displays - the name is simply short role name */ define('ROLENAME_SHORT', 5); -/** maximum size of context cache - it is possible to tweak this config.php or in any script before inclusion of context.php */ if (!defined('CONTEXT_CACHE_MAX_SIZE')) { + /** maximum size of context cache - it is possible to tweak this config.php or in any script before inclusion of context.php */ define('CONTEXT_CACHE_MAX_SIZE', 2500); } @@ -190,7 +194,7 @@ * Sadly, a PHP global variable is the only way to implement this, without rewriting everything * as methods of a class, instead of functions. * - * @private + * @access private * @global stdClass $ACCESSLIB_PRIVATE * @name $ACCESSLIB_PRIVATE */ @@ -208,6 +212,7 @@ * accesslib's private caches. You need to do this before setting up test data, * and also at the end of the tests. * + * @access private * @return void */ function accesslib_clear_all_caches_for_unit_testing() { @@ -226,7 +231,7 @@ function accesslib_clear_all_caches_for_unit_testing() { * * This reset does not touch global $USER. * - * @private + * @access private * @param bool $resetcontexts * @return void */ @@ -246,7 +251,7 @@ function accesslib_clear_all_caches($resetcontexts) { /** * Gets the accessdata for role "sitewide" (system down to course) * - * @private + * @access private * @param int $roleid * @return array */ @@ -330,8 +335,8 @@ function get_guest_role() { * Check whether a user has a particular capability in a given context. * * For example: - * $context = get_context_instance(CONTEXT_MODULE, $cm->id); - * has_capability('mod/forum:replypost',$context) + * $context = context_module::instance($cm->id); + * has_capability('mod/forum:replypost', $context) * * By default checks the capabilities of the current user, but you can pass a * different userid. By default will return true for admin users, but you can override that with the fourth argument. @@ -339,9 +344,11 @@ function get_guest_role() { * Guest and not-logged-in users can never get any dangerous capability - that is any write capability * or capabilities with XSS, config or data loss risks. * + * @category access + * * @param string $capability the name of the capability to check. For example mod/forum:view - * @param context $context the context to check the capability in. You normally get this with {@link get_context_instance}. - * @param integer|object $user A user id or object. By default (null) checks the permissions of the current user. + * @param context $context the context to check the capability in. You normally get this with instance method of a context class. + * @param integer|stdClass $user A user id or object. By default (null) checks the permissions of the current user. * @param boolean $doanything If false, ignores effect of admin role assignment * @return boolean true if the user has this capability. Otherwise false. */ @@ -482,16 +489,18 @@ function has_capability($capability, context $context, $user = null, $doanything * the capabilities that most users are likely to have first in the list for best * performance. * + * @category access * @see has_capability() + * * @param array $capabilities an array of capability names. - * @param context $context the context to check the capability in. You normally get this with {@link get_context_instance}. - * @param integer $userid A user id. By default (null) checks the permissions of the current user. + * @param context $context the context to check the capability in. You normally get this with instance method of a context class. + * @param integer|stdClass $user A user id or object. By default (null) checks the permissions of the current user. * @param boolean $doanything If false, ignore effect of admin role assignment * @return boolean true if the user has any of these capabilities. Otherwise false. */ -function has_any_capability(array $capabilities, context $context, $userid = null, $doanything = true) { +function has_any_capability(array $capabilities, context $context, $user = null, $doanything = true) { foreach ($capabilities as $capability) { - if (has_capability($capability, $context, $userid, $doanything)) { + if (has_capability($capability, $context, $user, $doanything)) { return true; } } @@ -505,16 +514,18 @@ function has_any_capability(array $capabilities, context $context, $userid = nul * the capabilities that fewest users are likely to have first in the list for best * performance. * + * @category access * @see has_capability() + * * @param array $capabilities an array of capability names. - * @param context $context the context to check the capability in. You normally get this with {@link get_context_instance}. - * @param integer $userid A user id. By default (null) checks the permissions of the current user. + * @param context $context the context to check the capability in. You normally get this with instance method of a context class. + * @param integer|stdClass $user A user id or object. By default (null) checks the permissions of the current user. * @param boolean $doanything If false, ignore effect of admin role assignment * @return boolean true if the user has all of these capabilities. Otherwise false. */ -function has_all_capabilities(array $capabilities, context $context, $userid = null, $doanything = true) { +function has_all_capabilities(array $capabilities, context $context, $user = null, $doanything = true) { foreach ($capabilities as $capability) { - if (!has_capability($capability, $context, $userid, $doanything)) { + if (!has_capability($capability, $context, $user, $doanything)) { return false; } } @@ -527,6 +538,8 @@ function has_all_capabilities(array $capabilities, context $context, $userid = n * Please note that use of proper capabilities is always encouraged, * this function is supposed to be used from core or for temporary hacks. * + * @category access + * * @param int|stdClass $user_or_id user id or user object * @return bool true if user is one of the administrators, false otherwise */ @@ -597,7 +610,7 @@ function has_coursecontact_role($userid) { * and then verify if user has at least one role with allow * and at the same time no role with prohibit. * - * @private + * @access private * @param string $capability * @param context $context * @param array $accessdata @@ -703,7 +716,7 @@ function require_capability($capability, context $context, $userid = null, $doan * [ra] => [/path][roleid]=roleid * [rdef] => [/path:roleid][capability]=permission * - * @private + * @access private * @param int $userid - the id of the user * @return array access info array */ @@ -817,7 +830,7 @@ function get_user_access_sitewide($userid) { * * This function injects all course related access info into the accessdata array. * - * @private + * @access private * @param int $userid the id of the user * @param context_course $coursecontext course context * @param array $accessdata accessdata array (modified) @@ -937,7 +950,7 @@ function load_course_context($userid, context_course $coursecontext, &$accessdat * This role-centric function is useful for role_switching * and temporary course roles. * - * @private + * @access private * @param int $roleid the id of the user * @param context $context needs path! * @param array $accessdata accessdata array (is modified) @@ -991,7 +1004,7 @@ function load_role_access_by_context($roleid, context $context, &$accessdata) { /** * Returns empty accessdata structure. * - * @private + * @access private * @return array empt accessdata */ function get_empty_accessdata() { @@ -1010,7 +1023,7 @@ function get_empty_accessdata() { /** * Get accessdata for a given user. * - * @private + * @access private * @param int $userid * @param bool $preloadonly true means do not return access array * @return array accessdata @@ -1061,7 +1074,7 @@ function get_user_accessdata($userid, $preloadonly=false) { * Try to minimise the size of $USER->access by eliminating duplicate override storage, * this function looks for contexts with the same overrides and shares them. * - * @private + * @access private * @return void */ function dedupe_user_access() { @@ -1103,7 +1116,7 @@ function dedupe_user_access() { * Call it only _after_ you've setup $USER and called check_enrolment_plugins(); * @see check_enrolment_plugins() * - * @private + * @access private * @return void */ function load_all_capabilities() { @@ -1142,7 +1155,7 @@ function load_all_capabilities() { * * Note: reloads $USER->access completely. * - * @private + * @access private * @return void */ function reload_all_capabilities() { @@ -1172,8 +1185,9 @@ function reload_all_capabilities() { * Adds a temp role to current USER->access array. * * Useful for the "temporary guest" access we grant to logged-in users. - * @since 2.2 + * This is useful for enrol plugins only. * + * @since 2.2 * @param context_course $coursecontext * @param int $roleid * @return void @@ -1211,8 +1225,9 @@ function load_temp_course_role(context_course $coursecontext, $roleid) { /** * Removes any extra guest roles from current USER->access array. - * @since 2.2 + * This is useful for enrol plugins only. * + * @since 2.2 * @param context_course $coursecontext * @return void */ @@ -1303,7 +1318,7 @@ function assign_legacy_capabilities($capability, $legacyperms) { /** * Verify capability risks. * - * @param object $capability a capability - a row from the capabilities table. + * @param stdClass $capability a capability - a row from the capabilities table. * @return boolean whether this capability is safe - that is, whether people with the * safeoverrides capability should be allowed to change it. */ @@ -1514,10 +1529,10 @@ function unassign_capability($capability, $roleid, $contextid = null) { * It just checks for permissions and overrides. * Use get_roles_with_cap_in_context() if resolution is required. * - * @param string $capability - capability name (string) - * @param string $permission - optional, the permission defined for this capability + * @param string $capability capability name (string) + * @param string $permission optional, the permission defined for this capability * either CAP_ALLOW, CAP_PREVENT or CAP_PROHIBIT. Defaults to null which means any. - * @param stdClass $context, null means any + * @param stdClass $context null means any * @return array of role records */ function get_roles_with_capability($capability, $permission = null, $context = null) { @@ -1730,7 +1745,7 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual = if ($context = context::instance_by_id($ra->contextid, IGNORE_MISSING)) { // this is a bit expensive but necessary $context->mark_dirty(); - /// If the user is the current user, then do full reload of capabilities too. + // If the user is the current user, then do full reload of capabilities too. if (!empty($USER->id) && $USER->id == $ra->userid) { reload_all_capabilities(); } @@ -1757,7 +1772,7 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual = $DB->delete_records('role_assignments', array('id'=>$ra->id)); // this is a bit expensive but necessary $context->mark_dirty(); - /// If the user is the current user, then do full reload of capabilities too. + // If the user is the current user, then do full reload of capabilities too. if (!empty($USER->id) && $USER->id == $ra->userid) { reload_all_capabilities(); } @@ -1777,6 +1792,8 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual = /** * Determines if a user is currently logged in * + * @category access + * * @return bool */ function isloggedin() { @@ -1788,6 +1805,8 @@ function isloggedin() { /** * Determines if a user is logged in as real guest user with username 'guest'. * + * @category access + * * @param int|object $user mixed user object or id, $USER if not specified * @return bool true if user is the real guest user, false if not logged in or other user */ @@ -1828,6 +1847,8 @@ function isguestuser($user = null) { /** * Does user have a (temporary or real) guest access to course? * + * @category access + * * @param context $context * @param stdClass|int $user * @return bool @@ -1867,8 +1888,10 @@ function is_guest(context $context, $user = null) { * Returns true if the user has moodle/course:view capability in the course, * this is intended for admins, managers (aka small admins), inspectors, etc. * + * @category access + * * @param context $context - * @param int|stdClass $user, if null $USER is used + * @param int|stdClass $user if null $USER is used * @param string $withcapability extra capability name * @return bool */ @@ -1900,8 +1923,11 @@ function is_viewing(context $context, $user = null, $withcapability = '') { * * Since 2.2 the result for active enrolments and current user are cached. * + * @package core_enrol + * @category access + * * @param context $context - * @param int|stdClass $user, if null $USER is used, otherwise user object or id expected + * @param int|stdClass $user if null $USER is used, otherwise user object or id expected * @param string $withcapability extra capability name * @param bool $onlyactive consider only active enrolments in enabled plugins and time restrictions * @return bool @@ -2102,6 +2128,9 @@ function can_access_course(stdClass $course, $user = null, $withcapability = '', * * This function is using 'eu[0-9]+_' prefix for table names and parameters. * + * @package core_enrol + * @category access + * * @param context $context * @param string $withcapability * @param int $groupid 0 means ignore groups, any other value limits the result by group id @@ -2265,6 +2294,9 @@ function get_enrolled_sql(context $context, $withcapability = '', $groupid = 0, /** * Returns list of users enrolled into course. * + * @package core_enrol + * @category access + * * @param context $context * @param string $withcapability * @param int $groupid 0 means ignore groups, any other value limits the result by group id @@ -2295,6 +2327,9 @@ function get_enrolled_users(context $context, $withcapability = '', $groupid = 0 /** * Counts list of users enrolled into course (as per above function) * + * @package core_enrol + * @category access + * * @param context $context * @param string $withcapability * @param int $groupid 0 means ignore groups, any other value limits the result by group id @@ -2318,6 +2353,7 @@ function count_enrolled_users(context $context, $withcapability = '', $groupid = * Loads the capability definitions for the component (from file). If no * capabilities are defined for the component, we simply return an empty array. * + * @access private * @param string $component full plugin name, examples: 'moodle', 'mod_forum' * @return array array of capabilities */ @@ -2341,6 +2377,7 @@ function load_capability_def($component) { /** * Gets the capabilities that have been cached in the database for this component. * + * @access private * @param string $component - examples: 'moodle', 'mod_forum' * @return array array of capabilities */ @@ -2421,6 +2458,7 @@ function reset_role_capabilities($roleid) { * will cause any stored capabilities for the component to be removed from * the database. * + * @access private * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results' * @return boolean true if success, exception in case of any problems */ @@ -2527,6 +2565,7 @@ function update_capabilities($component = 'moodle') { * Deletes cached capabilities that are no longer needed by the component. * Also unassigns these capabilities from any roles that have them. * + * @access private * @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results' * @param array $newcapdef array of the new capability definitions that will be * compared with the cached capabilities @@ -2580,7 +2619,7 @@ function get_all_risks() { /** * Return a link to moodle docs for a given capability name * - * @param object $capability a capability - a row from the mdl_capabilities table. + * @param stdClass $capability a capability - a row from the mdl_capabilities table. * @return string the human-readable capability name as a link to Moodle Docs. */ function get_capability_docs_link($capability) { @@ -2593,10 +2632,10 @@ function get_capability_docs_link($capability) { * defaults) of a role used in capability overrides in contexts at a given * context. * - * @param context $context * @param int $roleid + * @param context $context * @param string $cap capability, optional, defaults to '' - * @return array of capabilities + * @return array Array of capabilities */ function role_context_capabilities($roleid, context $context, $cap = '') { global $DB; @@ -2638,7 +2677,7 @@ function role_context_capabilities($roleid, context $context, $cap = '') { * Constructs array with contextids as first parameter and context paths, * in both cases bottom top including self. * - * @private + * @access private * @param context $context * @return array */ @@ -2671,7 +2710,7 @@ function is_inside_frontpage(context $context) { * Returns capability information (cached) * * @param string $capabilityname - * @return object or null if capability not found + * @return stdClass or null if capability not found */ function get_capability_info($capabilityname) { global $ACCESSLIB_PRIVATE, $DB; // one request per page only @@ -3246,6 +3285,9 @@ function get_overridable_roles(context $context, $rolenamedisplay = ROLENAME_ALI /** * Create a role menu suitable for default role selection in enrol plugins. + * + * @package core_enrol + * * @param context $context * @param int $addroleid current or default role - always added to list * @return array roleid=>localised role name @@ -3274,6 +3316,7 @@ function get_default_enrol_roles(context $context, $addroleid = null) { /** * Return context levels where this role is assignable. + * * @param integer $roleid the id of a role. * @return array list of the context levels at which this role may be assigned. */ @@ -3368,7 +3411,7 @@ function set_role_contextlevels($roleid, array $contextlevels) { * have capability both $capability and moodle/site:accessallgroups * in this context, as well as users who have $capability and who are * in $groups. - * @return mixed + * @return array of user records */ function get_users_by_capability(context $context, $capability, $fields = '', $sort = '', $limitfrom = '', $limitnum = '', $groups = '', $exceptions = '', $doanything_ignored = null, $view_ignored = null, $useviewallgroups = false) { @@ -3452,7 +3495,7 @@ function get_users_by_capability(context $context, $capability, $fields = '', $s unset($needed[$cap]); unset($prohibited[$cap]); } else if ($isfrontpage and !empty($prohibited[$cap][$defaultfrontpageroleid])) { - // everybody is disqualified on the frontapge + // everybody is disqualified on the frontpage unset($needed[$cap]); unset($prohibited[$cap]); } @@ -3478,7 +3521,7 @@ function get_users_by_capability(context $context, $capability, $fields = '', $s unset($n); } - /// ***** Set up default fields ****** + // ***** Set up default fields ****** if (empty($fields)) { if ($iscoursepage) { $fields = 'u.*, ul.timeaccess AS lastaccess'; @@ -3491,7 +3534,7 @@ function get_users_by_capability(context $context, $capability, $fields = '', $s } } - /// Set up default sort + // Set up default sort if (empty($sort)) { // default to course lastaccess or just lastaccess if ($iscoursepage) { $sort = 'ul.timeaccess'; @@ -3516,11 +3559,11 @@ function get_users_by_capability(context $context, $capability, $fields = '', $s } } - /// We never return deleted users or guest account. + // We never return deleted users or guest account. $wherecond[] = "u.deleted = 0 AND u.id <> :guestid"; $params['guestid'] = $CFG->siteguest; - /// Groups + // Groups if ($groups) { $groups = (array)$groups; list($grouptest, $grpparams) = $DB->get_in_or_equal($groups, SQL_PARAMS_NAMED, 'grp'); @@ -3539,7 +3582,7 @@ function get_users_by_capability(context $context, $capability, $fields = '', $s } } - /// User exceptions + // User exceptions if (!empty($exceptions)) { $exceptions = (array)$exceptions; list($exsql, $exparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'exc', false); @@ -3613,7 +3656,7 @@ function get_users_by_capability(context $context, $capability, $fields = '', $s } $joins = implode("\n", $joins); - /// Ok, let's get the users! + // Ok, let's get the users! $sql = "SELECT $fields FROM {user} u $joins @@ -3963,7 +4006,7 @@ function role_switch($roleid, context $context) { /** * Checks if the user has switched roles within the given course. * - * Note: You can only switch roles within the course, hence it takes a courseid + * Note: You can only switch roles within the course, hence it takes a course id * rather than a context. On that note Petr volunteered to implement this across * all other contexts, all requests for this should be forwarded to him ;) * @@ -4095,7 +4138,7 @@ function role_get_name($role, context_course $coursecontext) { * @param array $roleoptions array roleid => rolename or roleid => roleobject * @param context $context a context * @param int $rolenamedisplay - * @return array Array of context-specific role names, or role objexts with a ->localname field added. + * @return array Array of context-specific role names, or role objects with a ->localname field added. */ function role_fix_names($roleoptions, context $context, $rolenamedisplay = ROLENAME_ALIAS) { global $DB; @@ -4214,8 +4257,8 @@ function fix_role_sortorder($allroles) { /** * Switch the sort order of two roles (used in admin/roles/manage.php). * - * @param object $first The first role. Actually, only ->sortorder is used. - * @param object $second The second role. Actually, only ->sortorder is used. + * @param stdClass $first The first role. Actually, only ->sortorder is used. + * @param stdClass $second The second role. Actually, only ->sortorder is used. * @return boolean success or failure */ function switch_roles($first, $second) { @@ -4230,7 +4273,7 @@ function switch_roles($first, $second) { /** * Duplicates all the base definitions of a role * - * @param object $sourcerole role to copy from + * @param stdClass $sourcerole role to copy from * @param int $targetrole id of role to copy to */ function role_cap_duplicate($sourcerole, $targetrole) { @@ -4255,7 +4298,7 @@ function role_cap_duplicate($sourcerole, $targetrole) { * user has this capability in this context. * Use get_role_names_with_cap_in_context() if you need role names to display in the UI * - * @param object $context + * @param stdClass $context * @param string $capability * @return array($neededroles, $forbiddenroles) */ @@ -4314,7 +4357,7 @@ function get_roles_with_cap_in_context($context, $capability) { * Returns an array of role IDs that have ALL of the the supplied capabilities * Uses get_roles_with_cap_in_context(). Returns $allowed minus $forbidden * - * @param object $context + * @param stdClass $context * @param array $capabilities An array of capabilities * @return array of roles with all of the required capabilities */ @@ -4349,7 +4392,7 @@ function get_roles_with_caps_in_context($context, $capabilities) { * Returns an array of role names that have ALL of the the supplied capabilities * Uses get_roles_with_caps_in_context(). Returns $allowed minus $forbidden * - * @param object $context + * @param stdClass $context * @param array $capabilities An array of capabilities * @return array of roles with all of the required capabilities */ @@ -4401,7 +4444,7 @@ function prohibit_is_removable($roleid, context $context, $capability) { } if (count($prohibits) > 1) { - // more prohibints can not be removed + // more prohibits can not be removed return false; } @@ -4411,8 +4454,9 @@ function prohibit_is_removable($roleid, context $context, $capability) { /** * More user friendly role permission changing, * it should produce as few overrides as possible. + * * @param int $roleid - * @param object $context + * @param stdClass $context * @param string $capname capability name * @param int $permission * @return void @@ -4478,39 +4522,87 @@ function role_change_permission($roleid, $context, $capname, $permission) { /** * Basic moodle context abstraction class. * - * @author Petr Skoda - * @since 2.2 + * Google confirms that no other important framework is using "context" class, + * we could use something else like mcontext or moodle_context, but we need to type + * this very often which would be annoying and it would take too much space... + * + * This class is derived from stdClass for backwards compatibility with + * odl $context record that was returned from DML $DB->get_record() + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 * * @property-read int $id context id * @property-read int $contextlevel CONTEXT_SYSTEM, CONTEXT_COURSE, etc. * @property-read int $instanceid id of related instance in each context * @property-read string $path path to context, starts with system context - * @property-read dept $depth + * @property-read int $depth */ abstract class context extends stdClass { - /* - * Google confirms that no other important framework is using "context" class, - * we could use something else like mcontext or moodle_context, but we need to type - * this very often which would be annoying and it would take too much space... - * - * This class is derived from stdClass for backwards compatibility with - * odl $context record that was returned from DML $DB->get_record() + /** + * The context id + * Can be accessed publicly through $context->id + * @var int */ - protected $_id; + + /** + * The context level + * Can be accessed publicly through $context->contextlevel + * @var int One of CONTEXT_* e.g. CONTEXT_COURSE, CONTEXT_MODULE + */ protected $_contextlevel; + + /** + * Id of the item this context is related to e.g. COURSE_CONTEXT => course.id + * Can be accessed publicly through $context->instanceid + * @var int + */ protected $_instanceid; + + /** + * The path to the context always starting from the system context + * Can be accessed publicly through $context->path + * @var string + */ protected $_path; - protected $_depth; - /* context caching info */ + /** + * The depth of the context in relation to parent contexts + * Can be accessed publicly through $context->depth + * @var int + */ + protected $_depth; + /** + * @var array Context caching info + */ private static $cache_contextsbyid = array(); + + /** + * @var array Context caching info + */ private static $cache_contexts = array(); - protected static $cache_count = 0; // why do we do count contexts? Because count($array) is horribly slow for large arrays + /** + * Context count + * Why do we do count contexts? Because count($array) is horribly slow for large arrays + * @var int + */ + protected static $cache_count = 0; + + /** + * @var array Context caching info + */ protected static $cache_preloaded = array(); + + /** + * @var context_system The system context once initialised + */ protected static $systemcontext = null; /** @@ -4644,7 +4736,7 @@ protected static function preload_from_record(stdClass $rec) { /** * Magic setter method, we do not want anybody to modify properties from the outside * @param string $name - * @param mixed @value + * @param mixed $value */ public function __set($name, $value) { debugging('Can not change context instance properties!'); @@ -4671,7 +4763,7 @@ public function __get($name) { /** * Full support for isset on our magic read only properties. - * @param $name + * @param string $name * @return bool */ public function __isset($name) { @@ -5124,7 +5216,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at context level. * * @static - * @param $force + * @param bool $force * @return void */ protected static function build_paths($force) { @@ -5216,11 +5308,17 @@ public function mark_dirty() { * * Thank you Tim Hunt for helping me with this nasty trick. * - * @author Petr Skoda - * @since 2.2 + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_helper extends context { + /** + * @var array An array mapping context levels to classes + */ private static $alllevels = array( CONTEXT_SYSTEM => 'context_system', CONTEXT_USER => 'context_user', @@ -5380,7 +5478,7 @@ public static function preload_from_record(stdClass $rec) { * To be used if you expect multiple queries for course activities... * * @static - * @param $courseid + * @param int $courseid */ public static function preload_course($courseid) { // Users can call this multiple times without doing any harm @@ -5440,9 +5538,13 @@ public function get_capabilities() { /** - * Basic context class - * @author Petr Skoda (http://skodak.org) - * @since 2.2 + * System context class + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_system extends context { /** @@ -5648,7 +5750,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at system context level. * * @static - * @param $force + * @param bool $force */ protected static function build_paths($force) { global $DB; @@ -5678,8 +5780,12 @@ protected static function build_paths($force) { /** * User context class - * @author Petr Skoda (http://skodak.org) - * @since 2.2 + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_user extends context { /** @@ -5829,7 +5935,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at user context level. * * @static - * @param $force + * @param bool $force */ protected static function build_paths($force) { global $DB; @@ -5846,8 +5952,12 @@ protected static function build_paths($force) { /** * Course category context class - * @author Petr Skoda (http://skodak.org) - * @since 2.2 + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_coursecat extends context { /** @@ -6015,7 +6125,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at course category context level. * * @static - * @param $force + * @param bool $force */ protected static function build_paths($force) { global $DB; @@ -6066,8 +6176,12 @@ protected static function build_paths($force) { /** * Course context class - * @author Petr Skoda (http://skodak.org) - * @since 2.2 + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_course extends context { /** @@ -6234,7 +6348,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at course context level. * * @static - * @param $force + * @param bool $force */ protected static function build_paths($force) { global $DB; @@ -6281,8 +6395,12 @@ protected static function build_paths($force) { /** * Course module context class - * @author Petr Skoda (http://skodak.org) - * @since 2.2 + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_module extends context { /** @@ -6484,7 +6602,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at module context level. * * @static - * @param $force + * @param bool $force */ protected static function build_paths($force) { global $DB; @@ -6516,8 +6634,12 @@ protected static function build_paths($force) { /** * Block context class - * @author Petr Skoda (http://skodak.org) - * @since 2.2 + * + * @package core_access + * @category access + * @copyright Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.2 */ class context_block extends context { /** @@ -6697,7 +6819,7 @@ protected static function get_cleanup_sql() { * Rebuild context paths and depths at block context level. * * @static - * @param $force + * @param bool $force */ protected static function build_paths($force) { global $DB; @@ -6756,7 +6878,7 @@ function load_temp_role($context, $roleid, array $accessdata) { * Not available any more, use remove_temp_course_roles() instead. * * @deprecated since 2.2 - * @param object $context + * @param stdClass $context * @param array $accessdata * @return array access data */ @@ -6863,7 +6985,7 @@ function get_parent_contextid(context $context) { * contexts ;-) * * @deprecated since 2.2, use $context->get_child_contexts() instead - * @param context $context. + * @param context $context * @return array Array of child records */ function get_child_contexts(context $context) { @@ -6907,7 +7029,7 @@ function build_context_path($force = false) { /** * Rebuild all related context depth and path caches * - * @deprecated + * @deprecated since 2.2 * @param array $fixcontexts array of contexts, strongtyped * @return void */ @@ -6935,7 +7057,7 @@ function preload_course_contexts($courseid) { * Preloads context information together with instances. * Use context_instance_preload() to strip the context info from the record and cache the context instance. * - * @deprecated + * @deprecated since 2.2 * @param string $joinon for example 'u.id' * @param string $contextlevel context level of instance in $joinon * @param string $tablealias context table alias @@ -7037,6 +7159,7 @@ function delete_context($contextlevel, $instanceid, $deleterecord = true) { /** * Returns context level name + * * @deprecated since 2.2 * @param integer $contextlevel $context->context level. One of the CONTEXT_... constants. * @return string the name for this type of context. diff --git a/lib/adminlib.php b/lib/adminlib.php index 4025f91700fb8..48c9099cd9ce9 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1137,12 +1137,10 @@ public function prune($name) { * @return mixed array-object structure of found settings and pages */ public function search($query) { - $textlib = textlib_get_instance(); - $found = false; if (strpos(strtolower($this->name), $query) !== false) { $found = true; - } else if (strpos($textlib->strtolower($this->visiblename), $query) !== false) { + } else if (strpos(textlib::strtolower($this->visiblename), $query) !== false) { $found = true; } if ($found) { @@ -1286,12 +1284,10 @@ public function search($query) { return array($this->name => $result); } - $textlib = textlib_get_instance(); - $found = false; if (strpos(strtolower($this->name), $query) !== false) { $found = true; - } else if (strpos($textlib->strtolower($this->visiblename), $query) !== false) { + } else if (strpos(textlib::strtolower($this->visiblename), $query) !== false) { $found = true; } if ($found) { @@ -1613,17 +1609,16 @@ public function is_related($query) { if (strpos(strtolower($this->name), $query) !== false) { return true; } - $textlib = textlib_get_instance(); - if (strpos($textlib->strtolower($this->visiblename), $query) !== false) { + if (strpos(textlib::strtolower($this->visiblename), $query) !== false) { return true; } - if (strpos($textlib->strtolower($this->description), $query) !== false) { + if (strpos(textlib::strtolower($this->description), $query) !== false) { return true; } $current = $this->get_setting(); if (!is_null($current)) { if (is_string($current)) { - if (strpos($textlib->strtolower($current), $query) !== false) { + if (strpos(textlib::strtolower($current), $query) !== false) { return true; } } @@ -1631,7 +1626,7 @@ public function is_related($query) { $default = $this->get_defaultsetting(); if (!is_null($default)) { if (is_string($default)) { - if (strpos($textlib->strtolower($default), $query) !== false) { + if (strpos(textlib::strtolower($default), $query) !== false) { return true; } } @@ -2210,9 +2205,8 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); foreach ($this->choices as $desc) { - if (strpos($textlib->strtolower($desc), $query) !== false) { + if (strpos(textlib::strtolower($desc), $query) !== false) { return true; } } @@ -2440,12 +2434,11 @@ public function is_related($query) { if (!$this->load_choices()) { return false; } - $textlib = textlib_get_instance(); foreach ($this->choices as $key=>$value) { - if (strpos($textlib->strtolower($key), $query) !== false) { + if (strpos(textlib::strtolower($key), $query) !== false) { return true; } - if (strpos($textlib->strtolower($value), $query) !== false) { + if (strpos(textlib::strtolower($value), $query) !== false) { return true; } } @@ -2624,9 +2617,8 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); foreach ($this->choices as $desc) { - if (strpos($textlib->strtolower($desc), $query) !== false) { + if (strpos(textlib::strtolower($desc), $query) !== false) { return true; } } @@ -4716,7 +4708,6 @@ public function search($query) { $found = false; if ($modules = $DB->get_records('modules')) { - $textlib = textlib_get_instance(); foreach ($modules as $module) { if (!file_exists("$CFG->dirroot/mod/$module->name/lib.php")) { continue; @@ -4726,7 +4717,7 @@ public function search($query) { break; } $strmodulename = get_string('modulename', $module->name); - if (strpos($textlib->strtolower($strmodulename), $query) !== false) { + if (strpos(textlib::strtolower($strmodulename), $query) !== false) { $found = true; break; } @@ -4798,15 +4789,14 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); - $query = $textlib->strtolower($query); + $query = textlib::strtolower($query); $enrols = enrol_get_plugins(false); foreach ($enrols as $name=>$enrol) { $localised = get_string('pluginname', 'enrol_'.$name); - if (strpos($textlib->strtolower($name), $query) !== false) { + if (strpos(textlib::strtolower($name), $query) !== false) { return true; } - if (strpos($textlib->strtolower($localised), $query) !== false) { + if (strpos(textlib::strtolower($localised), $query) !== false) { return true; } } @@ -4969,7 +4959,6 @@ public function search($query) { $found = false; if ($blocks = $DB->get_records('block')) { - $textlib = textlib_get_instance(); foreach ($blocks as $block) { if (!file_exists("$CFG->dirroot/blocks/$block->name/")) { continue; @@ -4979,7 +4968,7 @@ public function search($query) { break; } $strblockname = get_string('pluginname', 'block_'.$block->name); - if (strpos($textlib->strtolower($strblockname), $query) !== false) { + if (strpos(textlib::strtolower($strblockname), $query) !== false) { $found = true; break; } @@ -5024,7 +5013,6 @@ public function search($query) { $found = false; if ($processors = get_message_processors()) { - $textlib = textlib_get_instance(); foreach ($processors as $processor) { if (!$processor->available) { continue; @@ -5034,7 +5022,7 @@ public function search($query) { break; } $strprocessorname = get_string('pluginname', 'message_'.$processor->name); - if (strpos($textlib->strtolower($strprocessorname), $query) !== false) { + if (strpos(textlib::strtolower($strprocessorname), $query) !== false) { $found = true; break; } @@ -5096,10 +5084,9 @@ public function search($query) { } $found = false; - $textlib = textlib_get_instance(); require_once($CFG->dirroot . '/question/engine/lib.php'); foreach (get_plugin_list('qbehaviour') as $behaviour => $notused) { - if (strpos($textlib->strtolower(question_engine::get_behaviour_name($behaviour)), + if (strpos(textlib::strtolower(question_engine::get_behaviour_name($behaviour)), $query) !== false) { $found = true; break; @@ -5144,10 +5131,9 @@ public function search($query) { } $found = false; - $textlib = textlib_get_instance(); require_once($CFG->dirroot . '/question/engine/bank.php'); foreach (question_bank::get_all_qtypes() as $qtype) { - if (strpos($textlib->strtolower($qtype->local_name()), $query) !== false) { + if (strpos(textlib::strtolower($qtype->local_name()), $query) !== false) { $found = true; break; } @@ -5186,7 +5172,6 @@ public function search($query) { } $found = false; - $textlib = textlib_get_instance(); $portfolios = get_plugin_list('portfolio'); foreach ($portfolios as $p => $dir) { if (strpos($p, $query) !== false) { @@ -5197,7 +5182,7 @@ public function search($query) { if (!$found) { foreach (portfolio_instances(false, false) as $instance) { $title = $instance->get('name'); - if (strpos($textlib->strtolower($title), $query) !== false) { + if (strpos(textlib::strtolower($title), $query) !== false) { $found = true; break; } @@ -5238,7 +5223,6 @@ public function search($query) { } $found = false; - $textlib = textlib_get_instance(); $repositories= get_plugin_list('repository'); foreach ($repositories as $p => $dir) { if (strpos($p, $query) !== false) { @@ -5249,7 +5233,7 @@ public function search($query) { if (!$found) { foreach (repository::get_types() as $instance) { $title = $instance->get_typename(); - if (strpos($textlib->strtolower($title), $query) !== false) { + if (strpos(textlib::strtolower($title), $query) !== false) { $found = true; break; } @@ -5321,7 +5305,6 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); $authsavailable = get_plugin_list('auth'); foreach ($authsavailable as $auth => $dir) { if (strpos($auth, $query) !== false) { @@ -5329,7 +5312,7 @@ public function is_related($query) { } $authplugin = get_auth_plugin($auth); $authtitle = $authplugin->get_title(); - if (strpos($textlib->strtolower($authtitle), $query) !== false) { + if (strpos(textlib::strtolower($authtitle), $query) !== false) { return true; } } @@ -5524,13 +5507,12 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); $editors_available = editors_get_available(); foreach ($editors_available as $editor=>$editorstr) { if (strpos($editor, $query) !== false) { return true; } - if (strpos($textlib->strtolower($editorstr), $query) !== false) { + if (strpos(textlib::strtolower($editorstr), $query) !== false) { return true; } } @@ -5761,9 +5743,8 @@ public function search($query) { $found = false; $filternames = filter_get_all_installed(); - $textlib = textlib_get_instance(); foreach ($filternames as $path => $strfiltername) { - if (strpos($textlib->strtolower($strfiltername), $query) !== false) { + if (strpos(textlib::strtolower($strfiltername), $query) !== false) { $found = true; break; } @@ -5811,6 +5792,15 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa $site = get_site(); require_login(); + if (!empty($options['pagelayout'])) { + // A specific page layout has been requested. + $PAGE->set_pagelayout($options['pagelayout']); + } else if ($section === 'upgradesettings') { + $PAGE->set_pagelayout('maintenance'); + } else { + $PAGE->set_pagelayout('admin'); + } + $adminroot = admin_get_root(false, false); // settings not required for external pages $extpage = $adminroot->locate($section, true); @@ -5825,15 +5815,6 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa die; } - if (!empty($options['pagelayout'])) { - // A specific page layout has been requested. - $PAGE->set_pagelayout($options['pagelayout']); - } else if ($section === 'upgradesettings') { - $PAGE->set_pagelayout('maintenance'); - } else { - $PAGE->set_pagelayout('admin'); - } - // $PAGE->set_extra_button($extrabutton); TODO if (!$actualurl) { @@ -6071,11 +6052,10 @@ function admin_find_write_settings($node, $data) { function admin_search_settings_html($query) { global $CFG, $OUTPUT; - $textlib = textlib_get_instance(); - if ($textlib->strlen($query) < 2) { + if (textlib::strlen($query) < 2) { return ''; } - $query = $textlib->strtolower($query); + $query = textlib::strtolower($query); $adminroot = admin_get_root(); $findings = $adminroot->search($query); @@ -6406,7 +6386,6 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); $repositories= get_plugin_list('repository'); foreach ($repositories as $p => $dir) { if (strpos($p, $query) !== false) { @@ -6415,7 +6394,7 @@ public function is_related($query) { } foreach (repository::get_types() as $instance) { $title = $instance->get_typename(); - if (strpos($textlib->strtolower($title), $query) !== false) { + if (strpos(textlib::strtolower($title), $query) !== false) { return true; } } @@ -6811,10 +6790,9 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); $services = $DB->get_records('external_services', array(), 'id, name'); foreach ($services as $service) { - if (strpos($textlib->strtolower($service->name), $query) !== false) { + if (strpos(textlib::strtolower($service->name), $query) !== false) { return true; } } @@ -7369,14 +7347,13 @@ public function is_related($query) { return true; } - $textlib = textlib_get_instance(); $protocols = get_plugin_list('webservice'); foreach ($protocols as $protocol=>$location) { if (strpos($protocol, $query) !== false) { return true; } $protocolstr = get_string('pluginname', 'webservice_'.$protocol); - if (strpos($textlib->strtolower($protocolstr), $query) !== false) { + if (strpos(textlib::strtolower($protocolstr), $query) !== false) { return true; } } diff --git a/lib/bennu/iCalendar_rfc2445.php b/lib/bennu/iCalendar_rfc2445.php index f6376dd7a6fa5..a84f370a5c222 100644 --- a/lib/bennu/iCalendar_rfc2445.php +++ b/lib/bennu/iCalendar_rfc2445.php @@ -56,7 +56,7 @@ function rfc2445_fold($string) { - if(mb_strlen($string, 'utf-8') <= RFC2445_FOLDED_LINE_LENGTH) { + if(textlib::strlen($string, 'utf-8') <= RFC2445_FOLDED_LINE_LENGTH) { return $string; } @@ -66,15 +66,15 @@ function rfc2445_fold($string) { $len_count=0; //multi-byte string, get the correct length - $section_len = mb_strlen($string, 'utf-8'); + $section_len = textlib::strlen($string, 'utf-8'); while($len_count<$section_len) { //get the current portion of the line - $section = mb_substr($string, ($i * RFC2445_FOLDED_LINE_LENGTH), (RFC2445_FOLDED_LINE_LENGTH), 'utf-8'); + $section = textlib::substr($string, ($i * RFC2445_FOLDED_LINE_LENGTH), (RFC2445_FOLDED_LINE_LENGTH), 'utf-8'); //increment the length we've processed by the length of the new portion - $len_count += mb_strlen($section, 'utf-8'); + $len_count += textlib::strlen($section, 'utf-8'); /* Add the portion to the return value, terminating with CRLF.HTAB As per RFC 2445, CRLF.HTAB will be replaced by the processor of the diff --git a/lib/bennu/readme_moodle.txt b/lib/bennu/readme_moodle.txt index 9b1db6033dfa7..1c6154b12eebc 100644 --- a/lib/bennu/readme_moodle.txt +++ b/lib/bennu/readme_moodle.txt @@ -2,3 +2,4 @@ Description of Bennu library import - customised library by author, this version modifications: 1/ removed ereg functions deprecated as of php 5.3 (18 Nov 2009) +2/ replaced mbstring functions with moodle textlib (28 Nov 2011) \ No newline at end of file diff --git a/lib/completion/completion_aggregation.php b/lib/completion/completion_aggregation.php index 5591261f2979d..e7a0786378146 100644 --- a/lib/completion/completion_aggregation.php +++ b/lib/completion/completion_aggregation.php @@ -1,5 +1,4 @@ - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + +defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir.'/completion/data_object.php'); /** * Course completion critieria aggregation + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_aggregation extends data_object { - /** - * DB Table - * @var string $table - */ + /* @var string Database table name that stores completion aggregation information */ public $table = 'course_completion_aggr_methd'; /** * Array of required table fields, must start with 'id'. - * @var array $required_fields + * Defaults to id, course, criteriatype, method, value + * @var array */ public $required_fields = array('id', 'course', 'criteriatype', 'method', 'value'); - /** - * Course id - * @access public - * @var int - */ + /* @var int Course id */ public $course; - /** - * Criteria type this aggregation method applies to, or NULL for overall course aggregation - * @access public - * @var int - */ + /* @var int Criteria type this aggregation method applies to, or NULL for overall course aggregation */ public $criteriatype; - /** - * Aggregation method (COMPLETION_AGGREGATION_* constant) - * @access public - * @var int - */ + /* @var int Aggregation method (COMPLETION_AGGREGATION_* constant)*/ public $method; - /** - * Method value - * @access public - * @var mixed - */ + /* @var mixed Method value */ public $value; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object instance of data_object or false if none found. */ public static function fetch($params) { return self::fetch_helper('course_completion_aggr_methd', __CLASS__, $params); @@ -86,7 +75,6 @@ public static function fetch($params) { /** * Finds and returns all data_object instances based on params. - * @static abstract * * @param array $params associative arrays varname=>value * @return array array of data_object insatnces or false if none found. @@ -95,9 +83,8 @@ public static function fetch_all($params) {} /** * Set the aggregation method - * @access public - * @param $method int - * @return void + * + * @param int $method One of COMPLETION_AGGREGATION_ALL or COMPLETION_AGGREGATION_ANY */ public function setMethod($method) { $methods = array( diff --git a/lib/completion/completion_completion.php b/lib/completion/completion_completion.php index 6737789411686..2b5d8bf4bad63 100644 --- a/lib/completion/completion_completion.php +++ b/lib/completion/completion_completion.php @@ -1,5 +1,4 @@ . - /** * Course completion status for a particular user/course * - * @package moodlecore + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->libdir.'/completion/data_object.php'); +defined('MOODLE_INTERNAL') || die(); +require_once($CFG->libdir.'/completion/data_object.php'); /** * Course completion status for a particular user/course + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_completion extends data_object { - /** - * DB Table - * @var string $table - */ + /* @var string $table Database table name that stores completion information */ public $table = 'course_completions'; - /** - * Array of required table fields, must start with 'id'. - * @var array $required_fields - */ + /* @var array $required_fields Array of required table fields, must start with 'id'. */ public $required_fields = array('id', 'userid', 'course', 'deleted', 'timenotified', 'timeenrolled', 'timestarted', 'timecompleted', 'reaggregate'); - /** - * User ID - * @access public - * @var int - */ + /* @var int $userid User ID */ public $userid; - /** - * Course ID - * @access public - * @var int - */ + /* @var int $course Course ID */ public $course; - /** - * Set to 1 if this record has been deleted - * @access public - * @var int - */ + /* @var int $deleted set to 1 if this record has been deleted */ public $deleted; - /** - * Timestamp the interested parties were notified - * of this user's completion - * @access public - * @var int - */ + /* @var int Timestamp the interested parties were notified of this user's completion. */ public $timenotified; - /** - * Time of course enrolment - * @see completion_completion::mark_enrolled() - * @access public - * @var int - */ + /* @var int Time of course enrolment {@link completion_completion::mark_enrolled()} */ public $timeenrolled; /** - * Time the user started their course completion - * @see completion_completion::mark_inprogress() - * @access public - * @var int + * Time the user started their course completion {@link completion_completion::mark_inprogress()} + * @var int */ public $timestarted; - /** - * Timestamp of course completion - * @see completion_completion::mark_complete() - * @access public - * @var int - */ + /* @var int Timestamp of course completion {@link completion_completion::mark_complete()} */ public $timecompleted; - /** - * Flag to trigger cron aggregation (timestamp) - * @access public - * @var int - */ + /* @var int Flag to trigger cron aggregation (timestamp) */ public $reaggregate; /** * Finds and returns a data_object instance based on params. - * @static abstract * - * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @param array $params associative arrays varname = >value + * @return data_object instance of data_object or false if none found. */ public static function fetch($params) { $params['deleted'] = null; @@ -120,8 +86,8 @@ public static function fetch($params) { /** * Return status of this completion - * @access public - * @return boolean + * + * @return bool */ public function is_complete() { return (bool) $this->timecompleted; @@ -132,9 +98,7 @@ public function is_complete() { * * If the user is already marked as started, no change will occur * - * @access public - * @param integer $timeenrolled Time enrolled (optional) - * @return void + * @param integer $timeenrolled Time enrolled (optional) */ public function mark_enrolled($timeenrolled = null) { @@ -153,12 +117,9 @@ public function mark_enrolled($timeenrolled = null) { /** * Mark this user as inprogress in this course * - * If the user is already marked as inprogress, - * the time will not be changed + * If the user is already marked as inprogress, the time will not be changed * - * @access public - * @param integer $timestarted Time started (optional) - * @return void + * @param integer $timestarted Time started (optional) */ public function mark_inprogress($timestarted = null) { @@ -185,9 +146,8 @@ public function mark_inprogress($timestarted = null) { * This generally happens when the required completion criteria * in the course are complete. * - * @access public - * @param integer $timecomplete Time completed (optional) - * @return void + * @param integer $timecomplete Time completed (optional) + * @return void */ public function mark_complete($timecomplete = null) { @@ -212,11 +172,8 @@ public function mark_complete($timecomplete = null) { * Save course completion status * * This method creates a course_completions record if none exists - * @access public - * @return void */ private function _save() { - global $DB; if ($this->timeenrolled === null) { @@ -232,10 +189,10 @@ private function _save() { $this->reaggregate = 0; } - // Make sure timestarted is not null - if (!$this->timestarted) { - $this->timestarted = 0; - } + // Make sure timestarted is not null + if (!$this->timestarted) { + $this->timestarted = 0; + } $this->insert(); } diff --git a/lib/completion/completion_criteria.php b/lib/completion/completion_criteria.php index 293d318dd550d..d93e9a043a2e7 100644 --- a/lib/completion/completion_criteria.php +++ b/lib/completion/completion_criteria.php @@ -1,6 +1,4 @@ . - /** * Course completion criteria * - * @package moodlecore + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + +defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir.'/completion/data_object.php'); require_once($CFG->libdir.'/completion/completion_criteria_completion.php'); - /** - * Criteria type constants - * Primarily for storing criteria type in the database + * Self completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. */ define('COMPLETION_CRITERIA_TYPE_SELF', 1); + +/** + * Date completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_DATE', 2); + +/** + * Unenrol completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_UNENROL', 3); + +/** + * Activity completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_ACTIVITY', 4); + +/** + * Duration completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_DURATION', 5); + +/** + * Grade completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_GRADE', 6); + +/** + * Role completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_ROLE', 7); + +/** + * Course completion criteria type + * Criteria type constant, primarily for storing criteria type in the database. + */ define('COMPLETION_CRITERIA_TYPE_COURSE', 8); /** @@ -60,72 +94,64 @@ /** * Completion criteria abstract definition + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class completion_criteria extends data_object { - /** - * DB Table - * @var string $table - */ + + /* @var string Database table name that stores completion criteria information */ public $table = 'course_completion_criteria'; /** * Array of required table fields, must start with 'id'. - * @var array $required_fields + * Defaults to id, course, criteriatype, module, moduleinstane, courseinstance, + * enrolperiod, timeend, gradepass, role + * @var array */ public $required_fields = array('id', 'course', 'criteriatype', 'module', 'moduleinstance', 'courseinstance', 'enrolperiod', 'timeend', 'gradepass', 'role'); - /** - * Course id - * @var int - */ + /* @var int Course id */ public $course; /** * Criteria type * One of the COMPLETION_CRITERIA_TYPE_* constants - * @var int + * @var int */ public $criteriatype; - /** - * Module type this criteria relates to (for activity criteria) - * @var string - */ + /* @var string Module type this criteria relates to (for activity criteria) */ public $module; - /** - * Course module instance id this criteria relates to (for activity criteria) - * @var int - */ + /* @var int Course module instance id this criteria relates to (for activity criteria) */ public $moduleinstance; /** * Period after enrolment completion will be triggered (for period criteria) - * @var int (days) + * The value here is the number of days as an int. + * @var int */ public $enrolperiod; /** * Date of course completion (for date criteria) - * @var int (timestamp) + * This is a timestamp value + * @var int */ public $date; - /** - * Passing grade required to complete course (for grade completion) - * @var float - */ + /* @var float Passing grade required to complete course (for grade completion) */ public $gradepass; - /** - * Role ID that has the ability to mark a user as complete (for role completion) - * @var int - */ + /* @var int Role ID that has the ability to mark a user as complete (for role completion) */ public $role; /** * Finds and returns all data_object instances based on params. - * @static abstract * * @param array $params associative arrays varname=>value * @return array array of data_object insatnces or false if none found. @@ -134,9 +160,9 @@ public static function fetch_all($params) {} /** * Factory method for creating correct class object - * @static - * @param array - * @return object + * + * @param array $params associative arrays varname=>value + * @return completion_criteria */ public static function factory($params) { global $CFG, $COMPLETION_CRITERIA_TYPES; @@ -153,64 +179,64 @@ public static function factory($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodleform $mform Moodle forms object + * @param mixed $data optional Any additional data that can be used to set default values in the form + * @return void */ abstract public function config_form_display(&$mform, $data = null); /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param array $data Form data + * @return void */ abstract public function update_config(&$data); /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param object $completion The user's completion record + * @param boolean $mark Optionally set false to not save changes to database + * @return boolean */ abstract public function review($completion, $mark = true); /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ abstract public function get_title(); /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ abstract public function get_title_detailed(); /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ abstract public function get_type_title(); /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array */ abstract public function get_details($completion); /** * Return criteria status text for display in reports - * @access public - * @param object $completion The user's completion record - * @return string + * + * @param completion_completion $completion The user's completion record + * @return string */ public function get_status($completion) { return $completion->is_complete() ? get_string('yes') : get_string('no'); @@ -220,7 +246,7 @@ public function get_status($completion) { * Return true if the criteria's current status is different to what is sorted * in the database, e.g. pending an update * - * @param object $completion The user's criteria completion record + * @param completion_completion $completion The user's criteria completion record * @return bool */ public function is_pending($completion) { diff --git a/lib/completion/completion_criteria_activity.php b/lib/completion/completion_criteria_activity.php index 096d1572256ea..409bf42c08fdf 100644 --- a/lib/completion/completion_criteria_activity.php +++ b/lib/completion/completion_criteria_activity.php @@ -15,28 +15,38 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * This file contains the activity completion criteria type class and any + * supporting functions it may require. + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + /** * Course completion critieria - completion on activity completion * - * @package moodlecore + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_activity extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria [COMPLETION_CRITERIA_TYPE_ACTIVITY] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_ACTIVITY; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return completion_criteria_activity data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_ACTIVITY; @@ -45,10 +55,9 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodleform $mform Moodle forms object + * @param stdClass $data details of various modules */ public function config_form_display(&$mform, $data = null) { $mform->addElement('checkbox', 'criteria_activity['.$data->id.']', ucfirst(self::get_mod_name($data->module)).' - '.$data->name); @@ -60,9 +69,8 @@ public function config_form_display(&$mform, $data = null) { /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { global $DB; @@ -84,10 +92,9 @@ public function update_config(&$data) { /** * Get module instance module type - * @static - * @access public - * @param int $type Module type id - * @return string + * + * @param int $type Module type id + * @return string */ public static function get_mod_name($type) { static $types; @@ -101,9 +108,10 @@ public static function get_mod_name($type) { } /** - * Get module instance - * @access public - * @return object|false + * Gets the module instance from the database and returns it. + * If no module instance exists this function returns false. + * + * @return stdClass|bool */ public function get_mod_instance() { global $DB; @@ -124,10 +132,10 @@ public function get_mod_instance() { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @return bool */ public function review($completion, $mark = true) { global $DB; @@ -152,8 +160,8 @@ public function review($completion, $mark = true) { /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { return get_string('activitiescompleted', 'completion'); @@ -161,7 +169,7 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public + * * @return string */ public function get_title_detailed() { @@ -174,7 +182,7 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public + * * @return string */ public function get_type_title() { @@ -182,9 +190,7 @@ public function get_type_title() { } /** - * Find user's who have completed this criteria - * @access public - * @return void + * Find users who have completed this criteria and mark them accordingly */ public function cron() { global $DB; @@ -238,9 +244,10 @@ public function cron() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { global $DB, $CFG; diff --git a/lib/completion/completion_criteria_completion.php b/lib/completion/completion_criteria_completion.php index 26127f8b12803..f4d700d07729c 100644 --- a/lib/completion/completion_criteria_completion.php +++ b/lib/completion/completion_criteria_completion.php @@ -1,5 +1,4 @@ - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->libdir.'/completion/data_object.php'); +defined('MOODLE_INTERNAL') || die(); +require_once($CFG->libdir.'/completion/data_object.php'); /** * Completion data for a specific user, course and critieria + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_completion extends data_object { - /** - * DB Table - * @var string $table - */ + /* @var string Database table that stores completion type criteria */ public $table = 'course_completion_crit_compl'; - /** - * Array of required table fields, must start with 'id'. - * @var array $required_fields - */ + /* @var array Array of required table fields, must start with 'id'. */ public $required_fields = array('id', 'userid', 'course', 'criteriaid', 'gradefinal', 'rpl', 'deleted', 'unenroled', 'timecompleted'); - /** - * User ID - * @access public - * @var int - */ + /* @var int User ID */ public $userid; - /** - * Course ID - * @access public - * @var int - */ + /* @var int course ID */ public $course; - /** - * The id of the course completion criteria this completion references - * @access public - * @var int - */ + /* @var int The id of the course completion criteria this completion references */ public $criteriaid; - /** - * The final grade for the user in the course (if completing a grade criteria) - * @access public - * @var float - */ + /* @var float The final grade for the user in the course (if completing a grade criteria) */ public $gradefinal; - /** - * Record of prior learning, leave blank if none - * @access public - * @var string - */ + /* @var string Record of prior learning, leave blank if none */ public $rpl; - /** - * Course deleted flag - * @access public - * @var boolean - */ + /* @var bool Course deleted flag */ public $deleted; - /** - * Timestamp of user unenrolment (if completing a unenrol criteria) - * @access public - * @var int (timestamp) - */ + /* @var int Timestamp of user unenrolment (if completing a unenrol criteria) */ public $unenroled; - /** - * Timestamp of course criteria completion - * @see completion_criteria_completion::mark_complete() - * @access public - * @var int (timestamp) - */ + /* @var int Timestamp of course criteria completion {@link completion_criteria_completion::mark_complete()} */ public $timecompleted; - /** - * Associated criteria object - * @access private - * @var object completion_criteria - */ + /* @var completion_criterria Associated criteria object */ private $_criteria; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object instance of data_object or false if none found. */ public static function fetch($params) { $params['deleted'] = null; @@ -121,7 +84,6 @@ public static function fetch($params) { /** * Finds and returns all data_object instances based on params. - * @static abstract * * @param array $params associative arrays varname=>value * @return array array of data_object insatnces or false if none found. @@ -130,8 +92,8 @@ public static function fetch_all($params) {} /** * Return status of this criteria completion - * @access public - * @return boolean + * + * @return bool */ public function is_complete() { return (bool) $this->timecompleted; @@ -141,8 +103,6 @@ public function is_complete() { * Mark this criteria complete for the associated user * * This method creates a course_completion_crit_compl record - * @access public - * @return void */ public function mark_complete() { // Create record @@ -166,9 +126,8 @@ public function mark_complete() { /** * Attach a preloaded criteria object to this object - * @access public + * * @param $criteria object completion_criteria - * @return void */ public function attach_criteria(completion_criteria $criteria) { $this->_criteria = $criteria; @@ -177,13 +136,12 @@ public function attach_criteria(completion_criteria $criteria) { /** * Return the associated criteria with this completion * If nothing attached, load from the db - * @access public - * @return object completion_criteria + * + * @return completion_criteria */ public function get_criteria() { - if (!$this->_criteria) - { + if (!$this->_criteria) { global $DB; $params = array( @@ -199,10 +157,9 @@ public function get_criteria() { } /** - * Return criteria status text for display in reports - * @see completion_criteria::get_status() - * @access public - * @return string + * Return criteria status text for display in reports {@link completion_criteria::get_status()} + * + * @return string */ public function get_status() { return $this->_criteria->get_status($this); diff --git a/lib/completion/completion_criteria_course.php b/lib/completion/completion_criteria_course.php index 5f7acf209e97a..882ee6365c28d 100644 --- a/lib/completion/completion_criteria_course.php +++ b/lib/completion/completion_criteria_course.php @@ -1,5 +1,4 @@ . +/** + * This file contains the course criteria type. + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + /** * Course completion critieria - completion on course completion * * This course completion criteria depends on another course with * completion enabled to be marked as complete for this user * - * @package moodlecore + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_course extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant */ public $criteriatype = COMPLETION_CRITERIA_TYPE_COURSE; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object instance of data_object or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_COURSE; @@ -48,10 +56,9 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodle_form $mform Moodle forms object + * @param stdClass $data data used to define default value of the form */ public function config_form_display(&$mform, $data = null) { global $CFG; @@ -66,9 +73,8 @@ public function config_form_display(&$mform, $data = null) { /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param array $data Form data */ public function update_config(&$data) { @@ -87,10 +93,10 @@ public function update_config(&$data) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @return bool */ public function review($completion, $mark = true) { global $DB; @@ -113,8 +119,8 @@ public function review($completion, $mark = true) { /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { return get_string('prerequisitescompleted', 'completion'); @@ -122,8 +128,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { global $DB; @@ -136,8 +142,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('prerequisites', 'completion'); @@ -145,8 +151,6 @@ public function get_type_title() { /** * Find user's who have completed this criteria - * @access public - * @return void */ public function cron() { @@ -197,9 +201,10 @@ public function cron() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { global $CFG, $DB; diff --git a/lib/completion/completion_criteria_date.php b/lib/completion/completion_criteria_date.php index dfe1717ed3353..e6e81c09148a7 100644 --- a/lib/completion/completion_criteria_date.php +++ b/lib/completion/completion_criteria_date.php @@ -1,5 +1,4 @@ . +/** + * This file contains the date criteria type + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + /** * Course completion critieria - completion on specified date * - * @package moodlecore + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_date extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_DATE] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_DATE; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_DATE; @@ -45,13 +53,11 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodleform $mform Moodle forms object + * @param stdClass $data not used */ - public function config_form_display(&$mform, $data = null) - { + public function config_form_display(&$mform, $data = null) { $mform->addElement('checkbox', 'criteria_date', get_string('enable')); $mform->addElement('date_selector', 'criteria_date_value', get_string('afterspecifieddate', 'completion')); @@ -66,12 +72,10 @@ public function config_form_display(&$mform, $data = null) /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { - if (!empty($data->criteria_date)) { $this->course = $data->id; $this->timeend = $data->criteria_date_value; @@ -81,13 +85,12 @@ public function update_config(&$data) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @return bool */ - public function review($completion, $mark = true) - { + public function review($completion, $mark = true) { // If current time is past timeend if ($this->timeend && $this->timeend < time()) { if ($mark) { @@ -96,14 +99,13 @@ public function review($completion, $mark = true) return true; } - return false; } /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { return get_string('date'); @@ -111,8 +113,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { return userdate($this->timeend, '%d-%h-%y'); @@ -120,8 +122,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('date'); @@ -130,9 +132,9 @@ public function get_type_title() { /** * Return criteria status text for display in reports - * @access public - * @param object $completion The user's completion record - * @return string + * + * @param completion_completion $completion The user's completion record + * @return string */ public function get_status($completion) { return $completion->is_complete() ? get_string('yes') : userdate($this->timeend, '%d-%h-%y'); @@ -140,8 +142,6 @@ public function get_status($completion) { /** * Find user's who have completed this criteria - * @access public - * @return void */ public function cron() { global $DB; @@ -187,9 +187,10 @@ public function cron() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { $details = array(); diff --git a/lib/completion/completion_criteria_duration.php b/lib/completion/completion_criteria_duration.php index bc2c8a0788338..97bcb923b00e7 100644 --- a/lib/completion/completion_criteria_duration.php +++ b/lib/completion/completion_criteria_duration.php @@ -1,5 +1,4 @@ + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Course completion critieria - completion after specific duration from course enrolment + * + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_duration extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_DURATION] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_DURATION; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_DURATION; @@ -45,10 +53,9 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodleform $mform Moodle forms object + * @param stdClass $data not used */ public function config_form_display(&$mform, $data = null) { @@ -69,12 +76,10 @@ public function config_form_display(&$mform, $data = null) { /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { - if (!empty($data->criteria_duration)) { $this->course = $data->id; $this->enrolperiod = $data->criteria_duration_days; @@ -84,8 +89,9 @@ public function update_config(&$data) { /** * Get the time this user was enroled - * @param object $completion - * @return int + * + * @param completion_completion $completion + * @return int */ private function get_timeenrolled($completion) { global $DB; @@ -100,10 +106,10 @@ private function get_timeenrolled($completion) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @return bool */ public function review($completion, $mark = true) { $timeenrolled = $this->get_timeenrolled($completion); @@ -126,8 +132,8 @@ public function review($completion, $mark = true) { /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { return get_string('enrolmentduration', 'completion'); @@ -135,8 +141,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { return ceil($this->enrolperiod / (60 * 60 * 24)) . ' days'; @@ -144,8 +150,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('days', 'completion'); @@ -153,9 +159,9 @@ public function get_type_title() { /** * Return criteria status text for display in reports - * @access public - * @param object $completion The user's completion record - * @return string + * + * @param completion_completion $completion The user's completion record + * @return string */ public function get_status($completion) { $timeenrolled = $this->get_timeenrolled($completion); @@ -169,8 +175,6 @@ public function get_status($completion) { /** * Find user's who have completed this criteria - * @access public - * @return void */ public function cron() { global $DB; @@ -240,9 +244,10 @@ public function cron() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { $details = array(); diff --git a/lib/completion/completion_criteria_grade.php b/lib/completion/completion_criteria_grade.php index c1ff8a071225c..e452454d0805f 100644 --- a/lib/completion/completion_criteria_grade.php +++ b/lib/completion/completion_criteria_grade.php @@ -1,5 +1,4 @@ - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + +defined('MOODLE_INTERNAL') || die(); require_once $CFG->dirroot.'/grade/lib.php'; require_once $CFG->dirroot.'/grade/querylib.php'; /** * Course completion critieria - completion on achieving course grade + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_grade extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_GRADE] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_GRADE; /** * Finds and returns a data_object instance based on params. - * @static abstract * - * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @param array $params associative array varname => value of various + * parameters used to fetch data_object + * @return data_object data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_GRADE; @@ -51,10 +56,9 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodle_form $mform Moodle forms object + * @param stdClass $data containing default values to be set in the form */ public function config_form_display(&$mform, $data = null) { $mform->addElement('checkbox', 'criteria_grade', get_string('enable')); @@ -69,9 +73,8 @@ public function config_form_display(&$mform, $data = null) { /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { @@ -86,10 +89,9 @@ public function update_config(&$data) { /** * Get user's course grade in this course - * @static - * @access private - * @param object $completion - * @return float + * + * @param completion_completion $completion an instance of completion_completion class + * @return float */ private function get_grade($completion) { $grade = grade_get_course_grade($completion->userid, $this->course); @@ -98,10 +100,10 @@ private function get_grade($completion) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @return bool */ public function review($completion, $mark = true) { // Get user's course grade @@ -122,7 +124,7 @@ public function review($completion, $mark = true) { /** * Return criteria title for display in reports - * @access public + * * @return string */ public function get_title() { @@ -131,8 +133,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { return (float) $this->gradepass . '% required'; @@ -140,8 +142,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('grade'); @@ -149,9 +151,9 @@ public function get_type_title() { /** * Return criteria status text for display in reports - * @access public - * @param object $completion The user's completion record - * @return string + * + * @param completion_completion $completion The user's completion record + * @return string */ public function get_status($completion) { // Cast as floats to get rid of excess decimal places @@ -167,8 +169,6 @@ public function get_status($completion) { /** * Find user's who have completed this criteria - * @access public - * @return void */ public function cron() { global $DB; @@ -223,9 +223,10 @@ public function cron() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { $details = array(); diff --git a/lib/completion/completion_criteria_role.php b/lib/completion/completion_criteria_role.php index 08927bccfaf64..5b2d051cd00c8 100644 --- a/lib/completion/completion_criteria_role.php +++ b/lib/completion/completion_criteria_role.php @@ -1,5 +1,4 @@ + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Course completion critieria - marked by role + * + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_role extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_ROLE] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_ROLE; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_ROLE; @@ -44,12 +52,11 @@ public static function fetch($params) { } /** - * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void - */ + * Add appropriate form elements to the critieria form + * + * @param moodleform $mform Moodle forms object + * @param stdClass $data used to set default values of the form + */ public function config_form_display(&$mform, $data = null) { $mform->addElement('checkbox', 'criteria_role['.$data->id.']', $data->name); @@ -59,11 +66,10 @@ public function config_form_display(&$mform, $data = null) { } } - /** + /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { @@ -82,9 +88,8 @@ public function update_config(&$data) { /** * Mark this criteria as complete - * @access public - * @param object $completion The user's completion record - * @return void + * + * @param completion_completion $completion The user's completion record */ public function complete($completion) { $this->review($completion, true, true); @@ -92,15 +97,15 @@ public function complete($completion) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @param bool $is_complete Set to false if the criteria has been completed just now. + * @return bool */ public function review($completion, $mark = true, $is_complete = false) { // If we are marking this as complete - if ($is_complete && $mark) - { + if ($is_complete && $mark) { $completion->completedself = 1; $completion->mark_complete(); @@ -112,8 +117,8 @@ public function review($completion, $mark = true, $is_complete = false) { /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { global $DB; @@ -123,8 +128,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { global $DB; @@ -133,8 +138,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('approval', 'completion'); @@ -142,9 +147,10 @@ public function get_type_title() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { $details = array(); diff --git a/lib/completion/completion_criteria_self.php b/lib/completion/completion_criteria_self.php index 8dfeb25b6e0f6..065f00ff45be2 100644 --- a/lib/completion/completion_criteria_self.php +++ b/lib/completion/completion_criteria_self.php @@ -1,5 +1,4 @@ - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Course completion critieria - student self marked + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_self extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_SELF] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_SELF; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_SELF; @@ -45,10 +53,9 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodleform $mform Moodle forms object + * @param stdClass $data Form data */ public function config_form_display(&$mform, $data = null) { $mform->addElement('checkbox', 'criteria_self', get_string('enable')); @@ -60,9 +67,8 @@ public function config_form_display(&$mform, $data = null) { /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { if (!empty($data->criteria_self)) { @@ -73,9 +79,8 @@ public function update_config(&$data) { /** * Mark this criteria as complete - * @access public - * @param object $completion The user's completion record - * @return void + * + * @param completion_completion $completion The user's completion record */ public function complete($completion) { $this->review($completion, true, true); @@ -83,15 +88,15 @@ public function complete($completion) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @param bool $is_complete set true to mark activity complete. + * @return bool */ public function review($completion, $mark = true, $is_complete = false) { // If we are marking this as complete - if ($is_complete && $mark) - { + if ($is_complete && $mark) { $completion->completedself = 1; $completion->mark_complete(); @@ -103,8 +108,8 @@ public function review($completion, $mark = true, $is_complete = false) { /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { return get_string('selfcompletion', 'completion'); @@ -112,8 +117,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { return $this->get_title(); @@ -121,8 +126,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('self', 'completion'); @@ -130,9 +135,10 @@ public function get_type_title() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { $details = array(); diff --git a/lib/completion/completion_criteria_unenrol.php b/lib/completion/completion_criteria_unenrol.php index 49e14d71a68ab..62f30726d18c5 100644 --- a/lib/completion/completion_criteria_unenrol.php +++ b/lib/completion/completion_criteria_unenrol.php @@ -1,5 +1,4 @@ - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Course completion critieria - completion on unenrolment + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class completion_criteria_unenrol extends completion_criteria { - /** - * Criteria type constant - * @var int - */ + /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_UNENROL] */ public $criteriatype = COMPLETION_CRITERIA_TYPE_UNENROL; /** * Finds and returns a data_object instance based on params. - * @static abstract * * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * @return data_object data_object instance or false if none found. */ public static function fetch($params) { $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_UNENROL; @@ -45,10 +53,9 @@ public static function fetch($params) { /** * Add appropriate form elements to the critieria form - * @access public - * @param object $mform Moodle forms object - * @param mixed $data optional - * @return void + * + * @param moodleform $mform Moodle forms object + * @param stdClass $data Form data */ public function config_form_display(&$mform, $data = null) { $mform->addElement('checkbox', 'criteria_unenrol', get_string('completiononunenrolment','completion')); @@ -60,9 +67,8 @@ public function config_form_display(&$mform, $data = null) { /** * Update the criteria information stored in the database - * @access public - * @param array $data Form data - * @return void + * + * @param stdClass $data Form data */ public function update_config(&$data) { if (!empty($data->criteria_unenrol)) { @@ -73,10 +79,10 @@ public function update_config(&$data) { /** * Review this criteria and decide if the user has completed - * @access public - * @param object $completion The user's completion record - * @param boolean $mark Optionally set false to not save changes to database - * @return boolean + * + * @param completion_completion $completion The user's completion record + * @param bool $mark Optionally set false to not save changes to database + * @return bool */ public function review($completion, $mark = true) { // Check enrolment @@ -85,8 +91,8 @@ public function review($completion, $mark = true) { /** * Return criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title() { return get_string('unenrol', 'enrol'); @@ -94,8 +100,8 @@ public function get_title() { /** * Return a more detailed criteria title for display in reports - * @access public - * @return string + * + * @return string */ public function get_title_detailed() { return $this->get_title(); @@ -103,8 +109,8 @@ public function get_title_detailed() { /** * Return criteria type title for display in reports - * @access public - * @return string + * + * @return string */ public function get_type_title() { return get_string('unenrol', 'enrol'); @@ -112,9 +118,10 @@ public function get_type_title() { /** * Return criteria progress details for display in reports - * @access public - * @param object $completion The user's completion record - * @return array + * + * @param completion_completion $completion The user's completion record + * @return array An array with the following keys: + * type, criteria, requirement, status */ public function get_details($completion) { $details = array(); @@ -122,7 +129,6 @@ public function get_details($completion) { $details['criteria'] = get_string('unenrolment', 'completion'); $details['requirement'] = get_string('unenrolingfromcourse', 'completion'); $details['status'] = ''; - return $details; } } diff --git a/lib/completion/cron.php b/lib/completion/cron.php index 281a9d76d25a6..be480d47a21eb 100644 --- a/lib/completion/cron.php +++ b/lib/completion/cron.php @@ -1,5 +1,4 @@ . - /** * Cron job for reviewing and aggregating course completion criteria * - * @package moodlecore + * @package core_completion + * @category completion * @copyright 2009 Catalyst IT Ltd - * @author Aaron Barnes - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once $CFG->libdir.'/completionlib.php'; +defined('MOODLE_INTERNAL') || die(); +require_once($CFG->libdir.'/completionlib.php'); /** * Update user's course completion statuses * - * First update all criteria completions, then - * aggregate all criteria completions and update - * overall course completions - * - * @return void + * First update all criteria completions, then aggregate all criteria completions + * and update overall course completions */ function completion_cron() { @@ -48,7 +45,7 @@ function completion_cron() { /** * Mark users as started if the config option is set * - * @return void + * @return void */ function completion_cron_mark_started() { global $CFG, $DB; @@ -200,7 +197,7 @@ function completion_cron_mark_started() { * Loop through each installed criteria and run the * cron() method if it exists * - * @return void + * @return void */ function completion_cron_criteria() { @@ -227,8 +224,6 @@ function completion_cron_criteria() { /** * Aggregate each user's criteria completions - * - * @return void */ function completion_cron_completions() { global $DB; @@ -394,7 +389,6 @@ function completion_cron_completions() { * @param int $method COMPLETION_AGGREGATION_* constant * @param bool $data Criteria completion status * @param bool|null $state Aggregation state - * @return void */ function completion_cron_aggregate($method, $data, &$state) { if ($method == COMPLETION_AGGREGATION_ALL) { diff --git a/lib/completion/data_object.php b/lib/completion/data_object.php index c096c8e8bf446..01345ee0cc9bf 100644 --- a/lib/completion/data_object.php +++ b/lib/completion/data_object.php @@ -1,65 +1,66 @@ . -/////////////////////////////////////////////////////////////////////////// -// // -// NOTICE OF COPYRIGHT // -// // -// Moodle - Modular Object-Oriented Dynamic Learning Environment // -// http://moodle.com // -// // -// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // -// // -// This program 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 2 of the License, or // -// (at your option) any later version. // -// // -// This program 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: // -// // -// http://www.gnu.org/copyleft/gpl.html // -// // -/////////////////////////////////////////////////////////////////////////// +/** + * Course completion critieria aggregation + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); /** * A data abstraction object that holds methods and attributes - * @abstract + * + * @package core_completion + * @category completion + * @copyright 2009 Catalyst IT Ltd + * @author Aaron Barnes + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class data_object { - /** - * Table that the class maps to in the database - * @var string $table - */ + + /* @var string Table that the class maps to in the database */ public $table; - /** - * Array of required table fields, must start with 'id'. - * @var array $required_fields - */ + /* @var array Array of required table fields, must start with 'id'. */ public $required_fields = array('id'); /** * Array of optional fields with default values - usually long text information that is not always needed. * If you want to create an instance without optional fields use: new data_object($only_required_fields, false); - * @var array $optional_fields + * @var array */ public $optional_fields = array(); - /** - * The PK. - * @var int $id - */ + /* @var int The primary key */ public $id; /** * Constructor. Optionally (and by default) attempts to fetch corresponding row from DB. + * * @param array $params an array with required parameters for this data object. - * @param boolean $fetch Whether to fetch corresponding row from DB or not, + * @param bool $fetch Whether to fetch corresponding row from DB or not, * optional fields might not be defined if false used */ - public function __construct($params=NULL, $fetch=true) { + public function __construct($params = null, $fetch = true) { if (!empty($params) and (is_array($params) or is_object($params))) { if ($fetch) { if ($data = $this->fetch($params)) { @@ -80,6 +81,7 @@ public function __construct($params=NULL, $fetch=true) { /** * Makes sure all the optional fields are loaded. + * * If id present (==instance exists in db) fetches data from db. * Defaults are used for new instances. */ @@ -99,10 +101,12 @@ public function load_optional_fields() { /** * Finds and returns a data_object instance based on params. - * @static abstract * - * @param array $params associative arrays varname=>value - * @return object data_object instance or false if none found. + * This function MUST be overridden by all deriving classes. + * + * @param array $params associative arrays varname => value + * @throws coding_exception This function MUST be overridden + * @return data_object instance of data_object or false if none found. */ public static function fetch($params) { throw new coding_exception('fetch() method needs to be overridden in each subclass of data_object'); @@ -111,7 +115,10 @@ public static function fetch($params) { /** * Finds and returns all data_object instances based on params. * - * @param array $params associative arrays varname=>value + * This function MUST be overridden by all deriving classes. + * + * @param array $params associative arrays varname => value + * @throws coding_exception This function MUST be overridden * @return array array of data_object instances or false if none found. */ public static function fetch_all($params) { @@ -120,8 +127,12 @@ public static function fetch_all($params) { /** * Factory method - uses the parameters to retrieve matching instance from the DB. - * @static final protected - * @return mixed object instance or false if not found + * + * @final + * @param string $table The table name to fetch from + * @param string $classname The class that you want the result instantiated as + * @param array $params Any params required to select the desired row + * @return object Instance of $classname or false. */ protected static function fetch_helper($table, $classname, $params) { if ($instances = self::fetch_all_helper($table, $classname, $params)) { @@ -137,7 +148,11 @@ protected static function fetch_helper($table, $classname, $params) { /** * Factory method - uses the parameters to retrieve all matching instances from the DB. - * @static final protected + * + * @final + * @param string $table The table name to fetch from + * @param string $classname The class that you want the result instantiated as + * @param array $params Any params required to select the desired row * @return mixed array of object instances or false if not found */ public static function fetch_all_helper($table, $classname, $params) { @@ -185,7 +200,8 @@ public static function fetch_all_helper($table, $classname, $params) { /** * Updates this object in the Database, based on its object variables. ID must be set. - * @return boolean success + * + * @return bool success */ public function update() { global $DB; @@ -205,7 +221,8 @@ public function update() { /** * Deletes this object from the database. - * @return boolean success + * + * @return bool success */ public function delete() { global $DB; @@ -228,6 +245,8 @@ public function delete() { /** * Returns object with fields and values that are defined in database + * + * @return stdClass */ public function get_record_data() { $data = new stdClass(); @@ -248,6 +267,7 @@ public function get_record_data() { * Records this object in the Database, sets its id to the returned value, and returns that value. * If successful this function also fetches the new object data from database and stores it * in object properties. + * * @return int PK ID if successful, false otherwise */ public function insert() { @@ -274,6 +294,8 @@ public function insert() { * each variable in turn. If the DB has different data, the db's data is used to update * the object. This is different from the update() function, which acts on the DB record * based on the object. + * + * @return bool True for success, false otherwise. */ public function update_from_db() { if (empty($this->id)) { @@ -294,7 +316,10 @@ public function update_from_db() { /** * Given an associated array or object, cycles through each key/variable * and assigns the value to the corresponding variable in this object. - * @static final + * + * @final + * @param data_object $instance + * @param array $params */ public static function set_properties(&$instance, $params) { $params = (array) $params; @@ -310,8 +335,8 @@ public static function set_properties(&$instance, $params) { * deleted in the database. Default does nothing, can be overridden to * hook in special behaviour. * - * @param bool $deleted + * @param bool $deleted Set this to true if it has been deleted. */ - function notify_changed($deleted) { + public function notify_changed($deleted) { } -} +} \ No newline at end of file diff --git a/lib/completionlib.php b/lib/completionlib.php index b8d9df604951e..7094c0b3a82ff 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -1,5 +1,4 @@ . /** - * Contains a class used for tracking whether activities have been completed - * by students ('completion') + * Contains classes, functions and constants used during the tracking + * of activity completion for users. * * Completion top-level options (admin setting enablecompletion) * - * @package core - * @subpackage completion - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_completion + * @category completion + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); +/** + * Include the required completion libraries + */ require_once $CFG->libdir.'/completion/completion_aggregation.php'; require_once $CFG->libdir.'/completion/completion_criteria.php'; require_once $CFG->libdir.'/completion/completion_completion.php'; require_once $CFG->libdir.'/completion/completion_criteria_completion.php'; -/** The completion system is enabled in this site/course */ +/** + * The completion system is enabled in this site/course + */ define('COMPLETION_ENABLED', 1); -/** The completion system is not enabled in this site/course */ +/** + * The completion system is not enabled in this site/course + */ define('COMPLETION_DISABLED', 0); -// Completion tracking options per-activity (course_modules/completion) - -/** Completion tracking is disabled for this activity */ +/** + * Completion tracking is disabled for this activity + * This is a completion tracking option per-activity (course_modules/completion) + */ define('COMPLETION_TRACKING_NONE', 0); -/** Manual completion tracking (user ticks box) is enabled for this activity */ + +/** + * Manual completion tracking (user ticks box) is enabled for this activity + * This is a completion tracking option per-activity (course_modules/completion) + */ define('COMPLETION_TRACKING_MANUAL', 1); -/** Automatic completion tracking (system ticks box) is enabled for this activity */ +/** + * Automatic completion tracking (system ticks box) is enabled for this activity + * This is a completion tracking option per-activity (course_modules/completion) + */ define('COMPLETION_TRACKING_AUTOMATIC', 2); -// Completion state values (course_modules_completion/completionstate) - -/** The user has not completed this activity. */ +/** + * The user has not completed this activity. + * This is a completion state value (course_modules_completion/completionstate) + */ define('COMPLETION_INCOMPLETE', 0); -/** The user has completed this activity. It is not specified whether they have - * passed or failed it. */ +/** + * The user has completed this activity. It is not specified whether they have + * passed or failed it. + * This is a completion state value (course_modules_completion/completionstate) + */ define('COMPLETION_COMPLETE', 1); -/** The user has completed this activity with a grade above the pass mark. */ +/** + * The user has completed this activity with a grade above the pass mark. + * This is a completion state value (course_modules_completion/completionstate) + */ define('COMPLETION_COMPLETE_PASS', 2); -/** The user has completed this activity but their grade is less than the pass mark */ +/** + * The user has completed this activity but their grade is less than the pass mark + * This is a completion state value (course_modules_completion/completionstate) + */ define('COMPLETION_COMPLETE_FAIL', 3); -// Completion effect changes (used only in update_state) - -/** The effect of this change to completion status is unknown. */ +/** + * The effect of this change to completion status is unknown. + * A completion effect changes (used only in update_state) + */ define('COMPLETION_UNKNOWN', -1); -/** The user's grade has changed, so their new state might be - * COMPLETION_COMPLETE_PASS or COMPLETION_COMPLETE_FAIL. */ -// TODO Is this useful? +/** + * The user's grade has changed, so their new state might be + * COMPLETION_COMPLETE_PASS or COMPLETION_COMPLETE_FAIL. + * A completion effect changes (used only in update_state) + */ define('COMPLETION_GRADECHANGE', -2); -// Whether view is required to create an activity (course_modules/completionview) - -/** User must view this activity */ +/** + * User must view this activity. + * Whether view is required to create an activity (course_modules/completionview) + */ define('COMPLETION_VIEW_REQUIRED', 1); -/** User does not need to view this activity */ +/** + * User does not need to view this activity + * Whether view is required to create an activity (course_modules/completionview) + */ define('COMPLETION_VIEW_NOT_REQUIRED', 0); -// Completion viewed state (course_modules_completion/viewed) - -/** User has viewed this activity */ +/** + * User has viewed this activity. + * Completion viewed state (course_modules_completion/viewed) + */ define('COMPLETION_VIEWED', 1); -/** User has not viewed this activity */ +/** + * User has not viewed this activity. + * Completion viewed state (course_modules_completion/viewed) + */ define('COMPLETION_NOT_VIEWED', 0); -// Completion cacheing - -/** Cache expiry time in seconds (10 minutes) */ +/** + * Cache expiry time in seconds (10 minutes) + * Completion cacheing + */ define('COMPLETION_CACHE_EXPIRY', 10*60); -// Combining completion condition. This is also the value you should return -// if you don't have any applicable conditions. Used for activity completion. -/** Completion details should be ORed together and you should return false if - none apply */ +/** + * Completion details should be ORed together and you should return false if + * none apply. + */ define('COMPLETION_OR', false); -/** Completion details should be ANDed together and you should return true if - none apply */ +/** + * Completion details should be ANDed together and you should return true if + * none apply + */ define('COMPLETION_AND', true); -// Course completion criteria aggregation methods -define('COMPLETION_AGGREGATION_ALL', 1); -define('COMPLETION_AGGREGATION_ANY', 2); +/** + * Course completion criteria aggregation method. + */ +define('COMPLETION_AGGREGATION_ALL', 1); +/** + * Course completion criteria aggregation method. + */ +define('COMPLETION_AGGREGATION_ANY', 2); /** @@ -109,48 +152,40 @@ * Does not contain any data, so you can safely construct it multiple times * without causing any problems. * + * @package core + * @category completion + * @copyright 2008 Sam Marshall * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore */ class completion_info { - /** - * Course object passed during construction - * @access private - * @var object - */ + + /* @var stdClass Course object passed during construction */ private $course; - /** - * Course id - * @access public - * @var int - */ + /* @var int Course id */ public $course_id; - /** - * Completion criteria - * @access private - * @var array - * @see completion_info->get_criteria() - */ + /* @var array Completion criteria {@link completion_info::get_criteria()} */ private $criteria; /** * Return array of aggregation methods - * @access public - * @return array + * @return array */ public static function get_aggregation_methods() { return array( - COMPLETION_AGGREGATION_ALL => get_string('all'), - COMPLETION_AGGREGATION_ANY => get_string('any', 'completion'), + COMPLETION_AGGREGATION_ALL => get_string('all'), + COMPLETION_AGGREGATION_ANY => get_string('any', 'completion'), ); } /** * Constructs with course details. * - * @param object $course Moodle course object. Must have at least ->id, ->enablecompletion + * When instantiating a new completion info object you must provide a course + * object with at least id, and enablecompletion properties. + * + * @param stdClass $course Moodle course object. */ public function __construct($course) { $this->course = $course; @@ -160,10 +195,7 @@ public function __construct($course) { /** * Determines whether completion is enabled across entire site. * - * Static function. - * - * @global object - * @return int COMPLETION_ENABLED (true) if completion is enabled for the site, + * @return bool COMPLETION_ENABLED (true) if completion is enabled for the site, * COMPLETION_DISABLED (false) if it's complete */ public static function is_enabled_for_site() { @@ -175,16 +207,13 @@ public static function is_enabled_for_site() { * Checks whether completion is enabled in a particular course and possibly * activity. * - * @global object - * @uses COMPLETION_DISABLED - * @uses COMPLETION_ENABLED - * @param object $cm Course-module object. If not specified, returns the course + * @param stdClass|cm_info $cm Course-module object. If not specified, returns the course * completion enable state. * @return mixed COMPLETION_ENABLED or COMPLETION_DISABLED (==0) in the case of * site and course; COMPLETION_TRACKING_MANUAL, _AUTOMATIC or _NONE (==0) * for a course-module. */ - public function is_enabled($cm=null) { + public function is_enabled($cm = null) { global $CFG, $DB; // First check global completion @@ -214,8 +243,8 @@ public function is_enabled($cm=null) { /** * Displays the 'Your progress' help icon, if completion tracking is enabled. * Just prints the result of display_help_icon(). - * @deprecated Use display_help_icon instead. - * @return void + * + * @deprecated since Moodle 2.0 - Use display_help_icon instead. */ public function print_help_icon() { print $this->display_help_icon(); @@ -223,7 +252,7 @@ public function print_help_icon() { /** * Returns the 'Your progress' help icon, if completion tracking is enabled. - * @global object + * * @return string HTML code for help icon, or blank if not needed */ public function display_help_icon() { @@ -239,10 +268,10 @@ public function display_help_icon() { /** * Get a course completion for a user - * @access public - * @param $user_id int User id - * @param $criteriatype int Specific criteria type to return - * @return false|completion_criteria_completion + * + * @param int $user_id User id + * @param int $criteriatype Specific criteria type to return + * @return bool|completion_criteria_completion returns false on fail */ public function get_completion($user_id, $criteriatype) { $completions = $this->get_completions($user_id, $criteriatype); @@ -258,10 +287,10 @@ public function get_completion($user_id, $criteriatype) { /** * Get all course criteria's completion objects for a user - * @access public - * @param $user_id int User id - * @param $criteriatype int optional Specific criteria type to return - * @return array + * + * @param int $user_id User id + * @param int $criteriatype Specific criteria type to return (optional) + * @return array */ public function get_completions($user_id, $criteriatype = null) { $criterion = $this->get_criteria($criteriatype); @@ -286,10 +315,10 @@ public function get_completions($user_id, $criteriatype = null) { /** * Get completion object for a user and a criteria - * @access public - * @param $user_id int User id - * @param $criteria completion_criteria Criteria object - * @return completion_criteria_completion + * + * @param int $user_id User id + * @param completion_criteria $criteria Criteria object + * @return completion_criteria_completion */ public function get_user_completion($user_id, $criteria) { $params = array( @@ -304,8 +333,7 @@ public function get_user_completion($user_id, $criteria) { /** * Check if course has completion criteria set * - * @access public - * @return bool + * @return bool Returns true if there are criteria */ public function has_criteria() { $criteria = $this->get_criteria(); @@ -313,12 +341,10 @@ public function has_criteria() { return (bool) count($criteria); } - /** * Get course completion criteria - * @access public - * @param $criteriatype int optional Specific criteria type to return - * @return void + * + * @param int $criteriatype Specific criteria type to return (optional) */ public function get_criteria($criteriatype = null) { @@ -361,9 +387,9 @@ public function get_criteria($criteriatype = null) { /** * Get aggregation method - * @access public - * @param $criteriatype int optional If none supplied, get overall aggregation method - * @return int + * + * @param int $criteriatype If none supplied, get overall aggregation method (optional) + * @return int One of COMPLETION_AGGREGATION_ALL or COMPLETION_AGGREGATION_ANY */ public function get_aggregation_method($criteriatype = null) { $params = array( @@ -382,8 +408,8 @@ public function get_aggregation_method($criteriatype = null) { /** * Get incomplete course completion criteria - * @access public - * @return void + * + * @return array */ public function get_incomplete_criteria() { $incomplete = array(); @@ -410,9 +436,9 @@ public function clear_criteria() { /** * Has the supplied user completed this course - * @access public - * @param $user_id int User's id - * @return boolean + * + * @param int $user_id User's id + * @return boolean */ public function is_course_complete($user_id) { $params = array( @@ -441,14 +467,7 @@ public function is_course_complete($user_id) { * calling the involved module via modulename_get_completion_state() to check * module-specific conditions. * - * @global object - * @global object - * @uses COMPLETION_COMPLETE - * @uses COMPLETION_INCOMPLETE - * @uses COMPLETION_COMPLETE_PASS - * @uses COMPLETION_COMPLETE_FAIL - * @uses COMPLETION_TRACKING_MANUAL - * @param object $cm Course-module + * @param stdClass|cm_info $cm Course-module * @param int $possibleresult Expected completion result. If the event that * has just occurred (e.g. add post) can only result in making the activity * complete when it wasn't before, use COMPLETION_COMPLETE. If the event that @@ -510,21 +529,12 @@ public function update_state($cm, $possibleresult=COMPLETION_UNKNOWN, $userid=0) * * Internal function. Not private, so we can unit-test it. * - * @global object - * @global object - * @global object - * @uses COMPLETION_VIEW_REQUIRED - * @uses COMPLETION_NOT_VIEWED - * @uses COMPLETION_INCOMPLETE - * @uses FEATURE_COMPLETION_HAS_RULES - * @uses COMPLETION_COMPLETE - * @uses COMPLETION_AND - * @param object $cm Activity + * @param stdClass|cm_info $cm Activity * @param int $userid ID of user - * @param object $current Previous completion information from database + * @param stdClass $current Previous completion information from database * @return mixed */ - function internal_get_state($cm, $userid, $current) { + public function internal_get_state($cm, $userid, $current) { global $USER, $DB, $CFG; // Get user ID @@ -590,7 +600,6 @@ function internal_get_state($cm, $userid, $current) { } - /** * Marks a module as viewed. * @@ -600,10 +609,8 @@ function internal_get_state($cm, $userid, $current) { * Note that this function must be called before you print the page header because * it is possible that the navigation block may depend on it. If you call it after * printing the header, it shows a developer debug warning. - * @uses COMPLETION_VIEW_NOT_REQUIRED - * @uses COMPLETION_VIEWED - * @uses COMPLETION_COMPLETE - * @param object $cm Activity + * + * @param stdClass|cm_info $cm Activity * @param int $userid User ID or 0 (default) for current user * @return void */ @@ -634,8 +641,7 @@ public function set_module_viewed($cm, $userid=0) { * deciding whether completion information should be 'locked' in the module * editing form. * - * @global object - * @param object $cm Activity + * @param cm_info $cm Activity * @return int The number of users who have completion data stored for this * activity, 0 if none */ @@ -656,10 +662,9 @@ public function count_user_data($cm) { * deciding whether completion information should be 'locked' in the completion * settings form and activity completion settings. * - * @global object - * @param int $user_id Optionally only get course completion data for a single user + * @param int $user_id Optionally only get course completion data for a single user * @return int The number of users who have completion data stored for this - * course, 0 if none + * course, 0 if none */ public function count_course_user_data($user_id = null) { global $DB; @@ -687,7 +692,7 @@ public function count_course_user_data($user_id = null) { /** * Check if this course's completion criteria should be locked * - * @return boolean + * @return boolean */ public function is_course_locked() { return (bool) $this->count_course_user_data(); @@ -697,9 +702,6 @@ public function is_course_locked() { * Deletes all course completion completion data. * * Intended to be used when unlocking completion criteria settings. - * - * @global object - * @return void */ public function delete_course_completion_data() { global $DB; @@ -713,9 +715,7 @@ public function delete_course_completion_data() { * * Intended for use only when the activity itself is deleted. * - * @global object - * @global object - * @param object $cm Activity + * @param stdClass|cm_info $cm Activity */ public function delete_all_state($cm) { global $SESSION, $DB; @@ -738,7 +738,7 @@ public function delete_all_state($cm) { if ($criterion->moduleinstance == $cm->id) { $acriteria = $criterion; break; - } + } } if ($acriteria) { @@ -759,10 +759,7 @@ public function delete_all_state($cm) { * Resetting state of manual tickbox has same result as deleting state for * it. * - * @global object - * @uses COMPLETION_TRACKING_MANUAL - * @uses COMPLETION_UNKNOWN - * @param object $cm Activity + * @param stcClass|cm_info $cm Activity */ public function reset_all_state($cm) { global $DB; @@ -799,12 +796,7 @@ public function reset_all_state($cm) { * Obtains completion data for a particular activity and user (from the * session cache if available, or by SQL query) * - * @global object - * @global object - * @global object - * @global object - * @uses COMPLETION_CACHE_EXPIRY - * @param object $cm Activity; only required field is ->id + * @param stcClass|cm_info $cm Activity; only required field is ->id * @param bool $wholecourse If true (default false) then, when necessary to * fill the cache, retrieves information from the entire course not just for * this one activity @@ -815,7 +807,7 @@ public function reset_all_state($cm) { * Otherwise the method calls get_fast_modinfo itself. * @return object Completion data (record from course_modules_completion) */ - public function get_data($cm, $wholecourse=false, $userid=0, $modinfo=null) { + public function get_data($cm, $wholecourse = false, $userid = 0, $modinfo = null) { global $USER, $CFG, $SESSION, $DB; // Get user ID @@ -926,13 +918,10 @@ public function get_data($cm, $wholecourse=false, $userid=0, $modinfo=null) { * * (Internal function. Not private, so we can unit-test it.) * - * @global object - * @global object - * @global object - * @param object $cm Activity - * @param object $data Data about completion for that user + * @param stdClass|cm_info $cm Activity + * @param stdClass $data Data about completion for that user */ - function internal_set_data($cm, $data) { + public function internal_set_data($cm, $data) { global $USER, $SESSION, $DB; $transaction = $DB->start_delegated_transaction(); @@ -961,8 +950,6 @@ function internal_set_data($cm, $data) { * Obtains a list of activities for which completion is enabled on the * course. The list is ordered by the section order of those activities. * - * @global object - * @uses COMPLETION_TRACKING_NONE * @param array $modinfo For unit testing only, supply the value * here. Otherwise the method calls get_fast_modinfo * @return array Array from $cmid => $cm of all activities with completion enabled, @@ -996,15 +983,14 @@ public function get_activities($modinfo=null) { return $result; } - /** * Checks to see if the userid supplied has a tracked role in * this course * - * @param $userid User id - * @return bool + * @param int $userid User id + * @return bool */ - function is_tracked_user($userid) { + public function is_tracked_user($userid) { global $DB; $tracked = $this->generate_tracked_user_sql(); @@ -1018,18 +1004,17 @@ function is_tracked_user($userid) { return $DB->record_exists_sql($sql, $params); } - /** * Return number of users whose progress is tracked in this course * * Optionally supply a search's where clause, or a group id * - * @param string $where Where clause sql - * @param array $where_params Where clause params - * @param int $groupid Group id - * @return int + * @param string $where Where clause sql + * @param array $where_params Where clause params + * @param int $groupid Group id + * @return int */ - function get_num_tracked_users($where = '', $where_params = array(), $groupid = 0) { + public function get_num_tracked_users($where = '', $where_params = array(), $groupid = 0) { global $DB; $tracked = $this->generate_tracked_user_sql($groupid); @@ -1045,23 +1030,22 @@ function get_num_tracked_users($where = '', $where_params = array(), $groupid = return $DB->count_records_sql($sql, $params); } - /** * Return array of users whose progress is tracked in this course * * Optionally supply a search's where caluse, group id, sorting, paging * - * @param string $where Where clause sql (optional) - * @param array $where_params Where clause params (optional) - * @param integer $groupid Group ID to restrict to (optional) - * @param string $sort Order by clause (optional) - * @param integer $limitfrom Result start (optional) - * @param integer $limitnum Result max size (optional) + * @param string $where Where clause sql (optional) + * @param array $where_params Where clause params (optional) + * @param integer $groupid Group ID to restrict to (optional) + * @param string $sort Order by clause (optional) + * @param integer $limitfrom Result start (optional) + * @param integer $limitnum Result max size (optional) * @param context $extracontext If set, includes extra user information fields * as appropriate to display for current user in this context - * @return array + * @return array */ - function get_tracked_users($where = '', $where_params = array(), $groupid = 0, + public function get_tracked_users($where = '', $where_params = array(), $groupid = 0, $sort = '', $limitfrom = '', $limitnum = '', context $extracontext = null) { global $DB; @@ -1095,17 +1079,16 @@ function get_tracked_users($where = '', $where_params = array(), $groupid = 0, return $users ? $users : array(); // In case it returns false } - /** * Generate the SQL for finding tracked users in this course * * Returns an object containing the sql fragment and an array of * bound data params. * - * @param integer $groupid - * @return object + * @param integer $groupid + * @return stdClass With two properties, sql (string), and data (array) */ - function generate_tracked_user_sql($groupid = 0) { + public function generate_tracked_user_sql($groupid = 0) { global $CFG; $return = new stdClass(); @@ -1186,8 +1169,6 @@ function generate_tracked_user_sql($groupid = 0) { * Users are included (in the first array) even if they do not have * completion progress for any course-module. * - * @global object - * @global object * @param bool $sortfirstname If true, sort by first name, otherwise sort by * last name * @param string $where Where clause sql (optional) @@ -1197,7 +1178,7 @@ function generate_tracked_user_sql($groupid = 0) { * @param int $start User to start at if paging (optional) * @param context $extracontext If set, includes extra user information fields * as appropriate to display for current user in this context - * @return Object with ->total and ->start (same as $start) and ->users; + * @return stdClass with ->total and ->start (same as $start) and ->users; * an array of user objects (like mdl_user id, firstname, lastname) * containing an additional ->progress array of coursemoduleid => completionstate */ @@ -1231,8 +1212,7 @@ public function get_progress_all($where = '', $where_params = array(), $groupid {course_modules} cm INNER JOIN {course_modules_completion} cmc ON cm.id=cmc.coursemoduleid WHERE - cm.course=? AND cmc.userid $insql - ", $params); + cm.course=? AND cmc.userid $insql", $params); foreach ($rs as $progress) { $progress = (object)$progress; $results[$progress->userid]->progress[$progress->coursemoduleid] = $progress; @@ -1248,13 +1228,10 @@ public function get_progress_all($where = '', $where_params = array(), $groupid * been changed. If the changed grade is used to determine completion for * the course-module, then the completion status will be updated. * - * @uses COMPLETION_TRACKING_MANUAL - * @uses COMPLETION_INCOMPLETE - * @param object $cm Course-module for item that owns grade + * @param stdClass|cm_info $cm Course-module for item that owns grade * @param grade_item $item Grade item - * @param object $grade + * @param stdClass $grade * @param bool $deleted - * @return void */ public function inform_grade_changed($cm, $item, $grade, $deleted) { // Bail out now if completion is not enabled for course-module, it is enabled @@ -1286,15 +1263,11 @@ public function inform_grade_changed($cm, $item, $grade, $deleted) { * * Internal function. Not private, so we can unit-test it. * - * @uses COMPLETION_INCOMPLETE - * @uses COMPLETION_COMPLETE_PASS - * @uses COMPLETION_COMPLETE_FAIL - * @uses COMPLETION_COMPLETE - * @param object $item grade_item - * @param object $grade grade_grade + * @param grade_item $item an instance of grade_item + * @param grade_grade $grade an instance of grade_grade * @return int Completion state e.g. COMPLETION_INCOMPLETE */ - function internal_get_grade_state($item, $grade) { + public function internal_get_grade_state($item, $grade) { if (!$grade) { return COMPLETION_INCOMPLETE; } @@ -1327,12 +1300,11 @@ function internal_get_grade_state($item, $grade) { * This is to be used only for system errors (things that shouldn't happen) * and not user-level errors. * - * @global object - * @param string $error Error string (will not be displayed to user unless - * debugging is enabled) - * @return void Throws moodle_exception Exception with the error string as debug info + * @global type $CFG + * @param string $error Error string (will not be displayed to user unless debugging is enabled) + * @throws moodle_exception Exception with the error string as debug info */ - function internal_systemerror($error) { + public function internal_systemerror($error) { global $CFG; throw new moodle_exception('err_system','completion', $CFG->wwwroot.'/course/view.php?id='.$this->course->id,null,$error); @@ -1340,10 +1312,8 @@ function internal_systemerror($error) { /** * For testing only. Wipes information cached in user session. - * - * @global object */ - static function wipe_session_cache() { + public static function wipe_session_cache() { global $SESSION; unset($SESSION->completioncache); unset($SESSION->completioncacheuserid); diff --git a/lib/conditionlib.php b/lib/conditionlib.php index f3279a19dbc2f..0ece429a5a29d 100644 --- a/lib/conditionlib.php +++ b/lib/conditionlib.php @@ -18,26 +18,36 @@ * Used for tracking conditions that apply before activities are displayed * to students ('conditional availability'). * - * @package core - * @subpackage condition + * @package core_condition + * @category condition * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -/** The activity is not displayed to students at all when conditions aren't met. */ +/** + * CONDITION_STUDENTVIEW_HIDE - The activity is not displayed to students at all when conditions aren't met. + */ define('CONDITION_STUDENTVIEW_HIDE',0); -/** The activity is displayed to students as a greyed-out name, with informational - text that explains the conditions under which it will be available. */ +/** + * CONDITION_STUDENTVIEW_SHOW - The activity is displayed to students as a greyed-out name, with + * informational text that explains the conditions under which it will be available. + */ define('CONDITION_STUDENTVIEW_SHOW',1); -/** The $cm variable is expected to contain all completion-related data */ +/** + * CONDITION_MISSING_NOTHING - The $cm variable is expected to contain all completion-related data + */ define('CONDITION_MISSING_NOTHING',0); -/** The $cm variable is expected to contain the fields from course_modules but - not the course_modules_availability data */ +/** + * CONDITION_MISSING_EXTRATABLE - The $cm variable is expected to contain the fields from course_modules + * but not the course_modules_availability data + */ define('CONDITION_MISSING_EXTRATABLE',1); -/** The $cm variable is expected to contain nothing except the ID */ +/** + * CONDITION_MISSING_EVERYTHING - The $cm variable is expected to contain nothing except the ID + */ define('CONDITION_MISSING_EVERYTHING',2); require_once($CFG->libdir.'/completionlib.php'); @@ -53,19 +63,21 @@ $CONDITIONLIB_PRIVATE->usedincondition = array(); /** - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * Core class to handle conditional activites + * + * @package core_condition + * @category condition + * @copyright 2008 Sam Marshall + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class condition_info { - /** - * @var object, bool - */ + /** @var object bool */ private $cm, $gotdata; /** * Constructs with course-module details. * - * @global object + * @global moodle_database $DB * @uses CONDITION_MISSING_NOTHING * @uses CONDITION_MISSING_EVERYTHING * @uses DEBUG_DEVELOPER @@ -133,8 +145,8 @@ public function __construct($cm, $expectingmissing=CONDITION_MISSING_NOTHING, * Adds the extra availability conditions (if any) into the given * course-module object. * - * @global object - * @global object + * @global moodle_database $DB + * @global object $CFG * @param object $cm Moodle course-module data object */ public static function fill_availability_conditions(&$cm) { @@ -176,7 +188,7 @@ public static function fill_availability_conditions(&$cm) { /** * Obtains the name of a grade item. * - * @global object + * @global moodle_database $DB * @param object $gradeitemobj Object from get_record on grade_items table, * (can be empty if you want to just get !missing) * @return string Name of item of !missing if it didn't exist @@ -194,6 +206,8 @@ private static function get_grade_name($gradeitemobj) { } /** + * Just a wrapper to call require_data() + * * @see require_data() * @return object A course-module object with all the information required to * determine availability. @@ -206,7 +220,7 @@ public function get_full_course_module() { /** * Adds to the database a condition based on completion of another module. * - * @global object + * @global moodle_database $DB * @param int $cmid ID of other module * @param int $requiredcompletion COMPLETION_xx constant */ @@ -225,7 +239,7 @@ public function add_completion_condition($cmid, $requiredcompletion) { /** * Adds to the database a condition based on the value of a grade item. * - * @global object + * @global moodle_database $DB * @param int $gradeitemid ID of grade item * @param float $min Minimum grade (>=), up to 5 decimal points, or null if none * @param float $max Maximum grade (<), up to 5 decimal points, or null if none @@ -261,7 +275,7 @@ public function add_grade_condition($gradeitemid, $min, $max, $updateinmemory=fa /** * Erases from the database all conditions for this activity. * - * @global object + * @global moodle_database $DB */ public function wipe_conditions() { // Wipe from DB @@ -278,8 +292,8 @@ public function wipe_conditions() { * Obtains a string describing all availability restrictions (even if * they do not apply any more). * - * @global object - * @global object + * @global stdClass $COURSE + * @global moodle_database $DB * @param object $modinfo Usually leave as null for default. Specify when * calling recursively from inside get_fast_modinfo. The value supplied * here must include list of all CMs with 'id' and 'name' @@ -400,6 +414,7 @@ public function get_full_information($modinfo=null) { /** * Checks whether a given time refers exactly to midnight (in current user * timezone). + * * @param int $time Time * @return bool True if time refers to midnight, false if it's some other * time or if it is set to zero @@ -417,8 +432,8 @@ private static function is_midnight($time) { * - This does not take account of the viewhiddenactivities capability. * That should apply later. * - * @global object - * @global object + * @global stdClass $COURSE + * @global moodle_database $DB * @uses COMPLETION_COMPLETE * @uses COMPLETION_COMPLETE_FAIL * @uses COMPLETION_COMPLETE_PASS @@ -553,6 +568,7 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin /** * Shows a time either as a date or a full date and time, according to * user's timezone. + * * @param int $time Time * @param bool $dateonly If true, uses date only * @return string Date @@ -563,6 +579,8 @@ private function show_time($time, $dateonly) { } /** + * This function is used to check if information about availability should be shown to user or not + * * @return bool True if information about availability should be shown to * normal users * @throws coding_exception If data wasn't loaded @@ -589,9 +607,9 @@ private function require_data() { * the user, because gradebook rules might prohibit that. It may be a * non-final score subject to adjustment later. * - * @global object - * @global object - * @global object + * @global stdClass $USER + * @global moodle_database $DB + * @global stdClass $SESSION * @param int $gradeitemid Grade item ID we're interested in * @param bool $grabthelot If true, grabs all scores for current user on * this course, so that later ones come from cache @@ -671,7 +689,7 @@ private function get_cached_grade_score($gradeitemid, $grabthelot=false, $userid /** * For testing only. Wipes information cached in user session. * - * @global object + * @global stdClass $SESSION */ static function wipe_session_cache() { global $SESSION; @@ -712,7 +730,7 @@ public static function update_cm_from_form($cm, $fromform, $wipefirst=true) { * Used in course/lib.php because we need to disable the completion JS if * a completion value affects a conditional activity. * - * @global object + * @global stdClass $CONDITIONLIB_PRIVATE * @param object $course Moodle course object * @param object $cm Moodle course-module * @return bool True if this is used in a condition, false otherwise diff --git a/lib/csslib.php b/lib/csslib.php index 379ce16bd70d9..0995948714df9 100644 --- a/lib/csslib.php +++ b/lib/csslib.php @@ -198,6 +198,10 @@ function css_send_css_not_found() { function css_minify_css($files) { global $CFG; + if (empty($files)) { + return ''; + } + set_include_path($CFG->libdir . '/minify/lib' . PATH_SEPARATOR . get_include_path()); require_once('Minify.php'); @@ -220,8 +224,31 @@ function css_minify_css($files) { // This returns the CSS rather than echoing it for display 'quiet' => true ); - $result = Minify::serve('Files', $options); - return $result['content']; + + $error = 'unknown'; + try { + $result = Minify::serve('Files', $options); + if ($result['success']) { + return $result['content']; + } + } catch (Exception $e) { + $error = $e->getMessage(); + $error = str_replace("\r", ' ', $error); + $error = str_replace("\n", ' ', $error); + } + + // minification failed - try to inform the theme developer and include the non-minified version + $css = <<close(); $this->_error = null; - $textlib = textlib_get_instance(); - - $content = $textlib->convert($content, $encoding, 'utf-8'); + $content = textlib::convert($content, $encoding, 'utf-8'); // remove Unicode BOM from first line - $content = $textlib->trim_utf8_bom($content); + $content = textlib::trim_utf8_bom($content); // Fix mac/dos newlines $content = preg_replace('!\r\n?!', "\n", $content); // is there anyting in file? diff --git a/lib/datalib.php b/lib/datalib.php index 9a8d62fc19116..99f6b913be2c0 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -222,7 +222,7 @@ function get_users($get=true, $search='', $confirmed=false, array $exceptions=nu if ($exceptions) { list($exceptions, $eparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'ex', false); $params = $params + $eparams; - $except = " AND id $exceptions"; + $select .= " AND id $exceptions"; } if ($firstinitial) { @@ -1703,15 +1703,14 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user // database so that it doesn't cause a DB error. Log a warning so that // developers can avoid doing things which are likely to cause this on a // routine basis. - $tl = textlib_get_instance(); - if(!empty($info) && $tl->strlen($info)>255) { - $info = $tl->substr($info,0,252).'...'; + if(!empty($info) && textlib::strlen($info)>255) { + $info = textlib::substr($info,0,252).'...'; debugging('Warning: logged very long info',DEBUG_DEVELOPER); } // If the 100 field size is changed, also need to alter print_log in course/lib.php - if(!empty($url) && $tl->strlen($url)>100) { - $url=$tl->substr($url,0,97).'...'; + if(!empty($url) && textlib::strlen($url)>100) { + $url = textlib::substr($url,0,97).'...'; debugging('Warning: logged very long URL',DEBUG_DEVELOPER); } diff --git a/lib/db/access.php b/lib/db/access.php index ae5ca8e6a88b8..8fe0b868ee5d5 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -1,5 +1,4 @@ . /** - * Definition of core event handler - * and description of all events throws from core. + * Definition of core event handler and description of all events throws from core. * - * @package core - * @subpackage event - * @copyright 2007 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @category event + * @copyright 2007 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/lib/db/install.xml b/lib/db/install.xml index 81c5a9177c059..eeac75d9475ef 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,14 +1,14 @@ -
    - + - + @@ -17,10 +17,10 @@
    - + - + @@ -29,13 +29,13 @@
    - - - + + + - - + + @@ -47,16 +47,16 @@
    - - + + - - - - + + + + @@ -69,39 +69,39 @@
    - - - + + + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - + + + + + + + @@ -114,18 +114,18 @@
    - + - - - - - - - - - + + + + + + + + + @@ -136,11 +136,11 @@
    - - - - - + + + + + @@ -152,16 +152,16 @@
    - - - + + + - - - - - - + + + + + + @@ -172,14 +172,14 @@
    - - - - - - - - + + + + + + + + @@ -193,11 +193,11 @@
    - - - - - + + + + + @@ -208,15 +208,15 @@
    - - - - - - - - - + + + + + + + + + @@ -229,10 +229,10 @@
    - - - - + + + + @@ -243,34 +243,34 @@
    - + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + @@ -282,15 +282,15 @@
    - - - - - - - - - + + + + + + + + + @@ -304,28 +304,28 @@
    - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -341,13 +341,13 @@
    - - - - - - - + + + + + + + @@ -358,12 +358,12 @@
    - - - - - - + + + + + + @@ -375,14 +375,14 @@
    - - - + + + - - - - + + + + @@ -393,13 +393,13 @@
    - + - - - - + + + + @@ -411,9 +411,9 @@
    - - - + + + @@ -425,11 +425,11 @@
    - + - - - + + + @@ -441,11 +441,11 @@
    - + - + - + @@ -457,23 +457,23 @@
    - + - - - - - - + + + + + + - + - - - + + + - - + + @@ -488,12 +488,12 @@
    - + - + - - + + @@ -504,10 +504,10 @@
    - + - - + + @@ -519,13 +519,13 @@
    - - - + + + - + - + @@ -543,15 +543,15 @@
    - - - - - - - - - + + + + + + + + + @@ -559,7 +559,7 @@
    - + @@ -575,18 +575,18 @@
    - - - - - - - - - - - - + + + + + + + + + + + + @@ -598,19 +598,19 @@
    - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -622,10 +622,10 @@
    - - - - + + + + @@ -636,13 +636,13 @@
    - + - - - + + + - + @@ -653,11 +653,11 @@
    - - + + - - + + @@ -668,13 +668,13 @@
    - - + + - - - - + + + + @@ -691,21 +691,21 @@
    - + - + - - - - - - + + + + + + - - - - + + + + @@ -714,20 +714,20 @@
    - + - - - - - + + + + + - + @@ -743,28 +743,28 @@ - - - - + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -785,8 +785,8 @@
    - - + + @@ -799,10 +799,10 @@
    - - - - + + + + @@ -815,14 +815,14 @@
    - - - + + + - - - - + + + + @@ -833,17 +833,17 @@
    - - - + + + - - - - + + + + - - + + @@ -857,13 +857,13 @@
    - - - - + + + + - - + + @@ -876,13 +876,13 @@
    - - - - + + + + - - + + @@ -895,13 +895,13 @@
    - - - - + + + + - - + + @@ -914,13 +914,13 @@
    - - - - - - - + + + + + + + @@ -935,13 +935,13 @@
    - - - - - - - + + + + + + + @@ -956,13 +956,13 @@
    - - - - - - - + + + + + + + @@ -977,25 +977,25 @@
    - + - - - - - + + + + + - - + + - - - + + + - - - + + + @@ -1010,11 +1010,11 @@
    - + - - + + @@ -1028,11 +1028,11 @@
    - - - + + + - + @@ -1045,9 +1045,9 @@
    - + - + @@ -1055,12 +1055,12 @@
    - + - + - + @@ -1069,9 +1069,9 @@
    - - - + + + @@ -1084,9 +1084,9 @@
    - - - + + + @@ -1099,9 +1099,9 @@
    - - - + + + @@ -1114,15 +1114,15 @@
    - - - - - - + + + + + + - - + + @@ -1138,13 +1138,13 @@
    - - - + + + - - - + + + @@ -1159,9 +1159,9 @@
    - - - + + + @@ -1175,11 +1175,11 @@
    - - - - - + + + + + @@ -1193,9 +1193,9 @@
    - - - + + + @@ -1205,26 +1205,26 @@
    - + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -1232,9 +1232,9 @@
    - + - + @@ -1242,11 +1242,11 @@
    - - - - - + + + + + @@ -1257,14 +1257,14 @@
    - + - - - + + + - - + + @@ -1276,25 +1276,25 @@
    - - - + + + - - - - - - + + + + + + - + - - - - - + + + + + @@ -1306,13 +1306,13 @@
    - - - - - - - + + + + + + + @@ -1321,12 +1321,12 @@
    - - - - - - + + + + + + @@ -1336,8 +1336,8 @@
    - - + + @@ -1348,19 +1348,19 @@
    - - - + + + - - - - - - - - - + + + + + + + + + @@ -1373,13 +1373,13 @@
    - - - + + + - - - + + + @@ -1392,10 +1392,10 @@
    - - + + - + @@ -1407,16 +1407,16 @@
    - - - - - - - - - - + + + + + + + + + + @@ -1426,15 +1426,15 @@
    - - - - - - - - - + + + + + + + + + @@ -1449,7 +1449,7 @@
    - + @@ -1462,20 +1462,20 @@
    - - + + - - - - - - - + + + + + + + - + @@ -1484,11 +1484,11 @@
    - - - - - + + + + + @@ -1499,16 +1499,16 @@
    - - - - - + + + + + - + - + @@ -1522,17 +1522,17 @@
    - + - - - + + + - + @@ -1543,12 +1543,12 @@
    - + - + @@ -1556,11 +1556,11 @@
    - + - + @@ -1568,9 +1568,9 @@
    - - - + + + @@ -1581,9 +1581,9 @@
    - - - + + + @@ -1594,15 +1594,15 @@
    - - + + - + - + - + @@ -1613,9 +1613,9 @@
    - + - + @@ -1627,11 +1627,11 @@
    - - - - - + + + + + @@ -1640,14 +1640,14 @@
    - + - + - - + + @@ -1658,12 +1658,12 @@
    - - - - - - + + + + + + @@ -1673,16 +1673,16 @@
    - - + + - - - - - - - + + + + + + + @@ -1694,9 +1694,9 @@
    - - - + + + @@ -1707,21 +1707,21 @@
    - - - - + + + + - - - - - - - - - + + + + + + + + + @@ -1731,35 +1731,35 @@
    - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -1777,27 +1777,27 @@
    - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -1813,18 +1813,18 @@
    - - - + + + - - - + + + - - - - + + + + @@ -1839,24 +1839,24 @@
    - - - + + + - - - - - + + + + + - - - - - - - + + + + + + + @@ -1871,38 +1871,38 @@
    - - - + + + - - - - + + + + - - - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -1919,30 +1919,30 @@
    - - - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -1959,10 +1959,10 @@
    - + - - + + @@ -1971,14 +1971,14 @@
    - - - - - - - - + + + + + + + + @@ -1989,15 +1989,15 @@
    - - + + - - - - + + + + @@ -2009,9 +2009,9 @@
    - - - + + + @@ -2020,13 +2020,13 @@
    - - + + - - - - + + + + @@ -2038,16 +2038,16 @@
    - - + + - - + + - - - - + + + + @@ -2056,14 +2056,14 @@
    - - + + - - - - - + + + + + @@ -2072,10 +2072,10 @@
    - - - - + + + + @@ -2085,10 +2085,10 @@
    - - - - + + + + @@ -2098,15 +2098,15 @@
    - - + + - - + + - - + + @@ -2115,10 +2115,10 @@
    - - - - + + + + @@ -2131,14 +2131,14 @@
    - + - - + + - - + + @@ -2150,9 +2150,9 @@
    - - - + + + @@ -2164,12 +2164,12 @@
    - + - - - + + + @@ -2181,10 +2181,10 @@
    - - + + - + @@ -2196,15 +2196,15 @@
    - + - - - - - - + + + + + + @@ -2218,10 +2218,10 @@
    - + - + @@ -2229,10 +2229,10 @@
    - - + + - + @@ -2244,11 +2244,11 @@
    - - - + + + - + @@ -2258,14 +2258,14 @@
    - - - - + + + + - + @@ -2277,11 +2277,11 @@
    - - - - - + + + + + @@ -2291,7 +2291,7 @@
    - + @@ -2305,9 +2305,9 @@
    - + - + @@ -2315,9 +2315,9 @@
    - - - + + + @@ -2325,25 +2325,25 @@
    - + - + - + - - + + - - + + - - - + + + @@ -2358,10 +2358,10 @@
    - + - - + + @@ -2369,16 +2369,16 @@
    - + - - - + + + - - - + + + @@ -2386,10 +2386,10 @@
    - - + + - + @@ -2397,12 +2397,12 @@
    - - + + - - + + @@ -2411,12 +2411,12 @@
    - - + + - - - + + + @@ -2425,12 +2425,12 @@
    - - - - + + + + - + @@ -2439,12 +2439,12 @@
    - + - - - - + + + + @@ -2455,15 +2455,15 @@
    - + - - + + - - + + @@ -2475,14 +2475,14 @@
    - - - + + + - + - + @@ -2495,14 +2495,14 @@
    - - + + - - - - - + + + + + @@ -2510,16 +2510,16 @@
    - + - + - + - - + + - + @@ -2530,7 +2530,7 @@
    - + @@ -2547,8 +2547,8 @@
    - - + + @@ -2558,12 +2558,12 @@
    - - - + + + - - + + @@ -2573,18 +2573,18 @@
    - + - - - + + + - - + + - - - + + + @@ -2596,9 +2596,9 @@
    - - - + + + @@ -2608,15 +2608,15 @@
    - - + + - - + + - - - + + + @@ -2625,16 +2625,16 @@
    - - + + - - - - - - + + + + + + @@ -2647,12 +2647,12 @@
    - + - + - - + + @@ -2660,11 +2660,11 @@
    - + - + @@ -2673,22 +2673,22 @@
    - + - + - - - - - - + + + + + + - - - + + + @@ -2701,13 +2701,13 @@
    - + - - - - + + + + @@ -2720,13 +2720,13 @@
    - + - + - - + + @@ -2737,11 +2737,11 @@
    - + - + - + @@ -2753,17 +2753,17 @@
    - + - - - - - - + + + + + + - + @@ -2776,14 +2776,14 @@
    - + - - - - - - + + + + + + @@ -2791,8 +2791,8 @@
    - - + + @@ -2805,20 +2805,20 @@
    - - + + - - - - - - - - - - + + + + + + + + + + @@ -2830,15 +2830,15 @@
    - - - - - - - - - + + + + + + + + + diff --git a/lib/db/log.php b/lib/db/log.php index 4814f7d41c9a2..7549e34ec22a8 100644 --- a/lib/db/log.php +++ b/lib/db/log.php @@ -29,7 +29,6 @@ global $DB; // TODO: this is a hack, we should really do something with the SQL in SQL tables $logs = array( - array('module'=>'user', 'action'=>'view', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), array('module'=>'course', 'action'=>'user report', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), array('module'=>'course', 'action'=>'view', 'mtable'=>'course', 'field'=>'fullname'), array('module'=>'course', 'action'=>'update', 'mtable'=>'course', 'field'=>'fullname'), @@ -49,4 +48,5 @@ array('module'=>'group', 'action'=>'view', 'mtable'=>'groups', 'field'=>'name'), array('module'=>'tag', 'action'=>'update', 'mtable'=>'tag', 'field'=>'name'), array('module'=>'tag', 'action'=>'flag', 'mtable'=>'tag', 'field'=>'name'), + array('module'=>'user', 'action'=>'view', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), ); diff --git a/lib/db/services.php b/lib/db/services.php index e721810f7e746..328d29db578a3 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -1,5 +1,4 @@ . + /** * Core external functions and service definitions. * - * @package core - * @subpackage webservice - * @copyright 2009 Petr Skoda (http://skodak.org) + * @package core_webservice + * @category webservice + * @copyright 2009 Petr Skodak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index df9b3f88060c7..c42d27c87e4bd 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -187,6 +187,32 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2012021700.02); } + // The ability to backup user (private) files is out completely - MDL-29248 + if ($oldversion < 2012030100.01) { + unset_config('backup_general_user_files', 'backup'); + unset_config('backup_general_user_files_locked', 'backup'); + unset_config('backup_auto_user_files', 'backup'); + + upgrade_main_savepoint(true, 2012030100.01); + } + + if ($oldversion < 2012030100.02) { + // migrate all numbers to signed - it should be safe to interrupt this and continue later + upgrade_mysql_fix_unsigned_columns(); + + // Main savepoint reached + upgrade_main_savepoint(true, 2012030100.02); + } + + if ($oldversion < 2012030900.01) { + // migrate all texts and binaries to big size - it should be safe to interrupt this and continue later + upgrade_mysql_fix_lob_columns(); + + // Main savepoint reached + upgrade_main_savepoint(true, 2012030900.01); + } + + return true; } diff --git a/lib/db/upgradelib.php b/lib/db/upgradelib.php index f22f0fc6d92e1..7960694a309c2 100644 --- a/lib/db/upgradelib.php +++ b/lib/db/upgradelib.php @@ -31,3 +31,109 @@ defined('MOODLE_INTERNAL') || die(); + +/** + * Remove all signed numbers from current database - mysql only. + */ +function upgrade_mysql_fix_unsigned_columns() { + // we are not using standard API for changes of column + // because everything 'signed'-related will be removed soon + + // if anybody already has numbers higher than signed limit the execution stops + // and tables must be fixed manually before continuing upgrade + + global $DB; + + if ($DB->get_dbfamily() !== 'mysql') { + return; + } + + $pbar = new progress_bar('mysqlconvertunsigned', 500, true); + + $prefix = $DB->get_prefix(); + $tables = $DB->get_tables(); + + $tablecount = count($tables); + $i = 0; + foreach ($tables as $table) { + $i++; + // set appropriate timeout - 5 minutes per milion of records should be enough, min 60 minutes just in case + $count = $DB->count_records($table, array()); + $timeout = ($count/1000000)*5*60; + $timeout = ($timeout < 60*60) ? 60*60 : (int)$timeout; + + $sql = "SHOW COLUMNS FROM `{{$table}}`"; + $rs = $DB->get_recordset_sql($sql); + foreach ($rs as $column) { + upgrade_set_timeout($timeout); + + $column = (object)array_change_key_case((array)$column, CASE_LOWER); + if (stripos($column->type, 'unsigned') !== false) { + $type = preg_replace('/unsigned/i', 'signed', $column->type); + $notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL'; + $default = !is_null($column->default) ? "DEFAULT '$column->default'" : ''; + $autoinc = (stripos($column->extra, 'auto_increment') !== false) ? 'AUTO_INCREMENT' : ''; + // primary and unique not necessary here, change_database_structure does not add prefix + $sql = "ALTER TABLE `{$prefix}$table` MODIFY COLUMN `$column->field` $type $notnull $default $autoinc"; + $DB->change_database_structure($sql); + } + } + $rs->close(); + + $pbar->update($i, $tablecount, "Converted unsigned columns in MySQL database - $i/$tablecount."); + } +} + +/** + * Migrate all text and binary columns to big size - mysql only. + */ +function upgrade_mysql_fix_lob_columns() { + // we are not using standard API for changes of column intentionally + + global $DB; + + if ($DB->get_dbfamily() !== 'mysql') { + return; + } + + $pbar = new progress_bar('mysqlconvertlobs', 500, true); + + $prefix = $DB->get_prefix(); + $tables = $DB->get_tables(); + asort($tables); + + $tablecount = count($tables); + $i = 0; + foreach ($tables as $table) { + $i++; + // set appropriate timeout - 1 minute per thousand of records should be enough, min 60 minutes just in case + $count = $DB->count_records($table, array()); + $timeout = ($count/1000)*60; + $timeout = ($timeout < 60*60) ? 60*60 : (int)$timeout; + + $sql = "SHOW COLUMNS FROM `{{$table}}`"; + $rs = $DB->get_recordset_sql($sql); + foreach ($rs as $column) { + upgrade_set_timeout($timeout); + + $column = (object)array_change_key_case((array)$column, CASE_LOWER); + if ($column->type === 'tinytext' or $column->type === 'mediumtext' or $column->type === 'text') { + $notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL'; + $default = !is_null($column->default) ? "DEFAULT '$column->default'" : ''; + // primary, unique and inc are not supported for texts + $sql = "ALTER TABLE `{$prefix}$table` MODIFY COLUMN `$column->field` LONGTEXT $notnull $default"; + $DB->change_database_structure($sql); + } + if ($column->type === 'tinyblob' or $column->type === 'mediumblob' or $column->type === 'blob') { + $notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL'; + $default = !is_null($column->default) ? "DEFAULT '$column->default'" : ''; + // primary, unique and inc are not supported for blobs + $sql = "ALTER TABLE `{$prefix}$table` MODIFY COLUMN `$column->field` LONGBLOB $notnull $default"; + $DB->change_database_structure($sql); + } + } + $rs->close(); + + $pbar->update($i, $tablecount, "Converted LOB columns in MySQL database - $i/$tablecount."); + } +} diff --git a/lib/ddl/database_manager.php b/lib/ddl/database_manager.php index 476b9e1f4b029..22d24e43b1389 100644 --- a/lib/ddl/database_manager.php +++ b/lib/ddl/database_manager.php @@ -221,57 +221,6 @@ public function index_exists(xmldb_table $xmldb_table, xmldb_index $xmldb_index) return ($this->find_index_name($xmldb_table, $xmldb_index) !== false); } - /** - * Given one xmldb_field, the function returns the name of the check constraint in DB (if exists) - * of false if it doesn't exist. Note that XMLDB limits the number of check constraints per field - * to 1 "enum-like" constraint. So, if more than one is returned, only the first one will be - * retrieved by this function. - * - * @todo MDL-31147 Moodle 2.1 - Drop find_check_constraint_name() - * - * @param xmldb_table $xmldb_table The table to be searched. - * @param xmldb_field $xmldb_field The field to be searched. - * @return string|bool check constraint name or false - */ - public function find_check_constraint_name(xmldb_table $xmldb_table, xmldb_field $xmldb_field) { - - /// Check the table exists - if (!$this->table_exists($xmldb_table)) { - throw new ddl_table_missing_exception($xmldb_table->getName()); - } - - /// Check the field exists - if (!$this->field_exists($xmldb_table, $xmldb_field)) { - throw new ddl_field_missing_exception($xmldb_field->getName(), $xmldb_table->getName()); - } - - /// Get list of check_constraints in table/field - $checks = false; - if ($objchecks = $this->generator->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) { - /// Get only the 1st element. Shouldn't be more than 1 under XMLDB - $objcheck = array_shift($objchecks); - if ($objcheck) { - $checks = strtolower($objcheck->name); - } - } - - /// Arriving here, check not found - return $checks; - } - - /** - * Given one xmldb_field, check if it has a check constraint in DB - * - * TODO: Moodle 2.1 - Drop check_constraint_exists() - * - * @param xmldb_table $xmldb_table The table. - * @param xmldb_field $xmldb_field The field to be searched for any existing constraint. - * @return boolean true/false - */ - public function check_constraint_exists(xmldb_table $xmldb_table, xmldb_field $xmldb_field) { - return ($this->find_check_constraint_name($xmldb_table, $xmldb_field) !== false); - } - /** * This function IS NOT IMPLEMENTED. ONCE WE'LL BE USING RELATIONAL * INTEGRITY IT WILL BECOME MORE USEFUL. FOR NOW, JUST CALCULATE "OFFICIAL" @@ -659,12 +608,13 @@ public function change_field_precision(xmldb_table $xmldb_table, xmldb_field $xm /** * This function will change the unsigned/signed of the field in the table passed as arguments * + * @deprecated since 2.3, only singed numbers are allowed now, migration is automatic * @param xmldb_table $xmldb_table Table object (just the name is mandatory). * @param xmldb_field $xmldb_field Field object (full specs are required). * @return void */ public function change_field_unsigned(xmldb_table $xmldb_table, xmldb_field $xmldb_field) { - /// Just a wrapper over change_field_type. Does exactly the same processing + debugging('All unsigned numbers are converted to signed automatically during Moodle upgrade.'); $this->change_field_type($xmldb_table, $xmldb_field); } @@ -706,37 +656,6 @@ public function change_field_default(xmldb_table $xmldb_table, xmldb_field $xmld $this->execute_sql_arr($sqlarr); } - /** - * This function will drop the existing enum of the field in the table passed as arguments - * - * TODO: Moodle 2.1 - Drop drop_enum_from_field() - * - * @param xmldb_table $xmldb_table Table object (just the name is mandatory). - * @param xmldb_field $xmldb_field Index object (full specs are required). - * @return void - */ - public function drop_enum_from_field(xmldb_table $xmldb_table, xmldb_field $xmldb_field) { - if (!$this->table_exists($xmldb_table)) { - throw new ddl_table_missing_exception($xmldb_table->getName()); - } - /// Check the field exists - if (!$this->field_exists($xmldb_table, $xmldb_field)) { - throw new ddl_field_missing_exception($xmldb_field->getName(), $xmldb_table->getName()); - } - - if (!$this->check_constraint_exists($xmldb_table, $xmldb_field)) { - debugging('Enum for ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() . - ' does not exist. Delete skipped', DEBUG_DEVELOPER); - return; //Enum does not exist, nothing to delete - } - - if (!$sqlarr = $this->generator->getDropEnumSQL($xmldb_table, $xmldb_field)) { - return; //Empty array = nothing to do = no error - } - - $this->execute_sql_arr($sqlarr); - } - /** * This function will rename the field in the table passed as arguments * Before renaming the field, the function will check it exists diff --git a/lib/ddl/mssql_sql_generator.php b/lib/ddl/mssql_sql_generator.php index fa7cbadabc494..b24ab45db7279 100644 --- a/lib/ddl/mssql_sql_generator.php +++ b/lib/ddl/mssql_sql_generator.php @@ -42,7 +42,6 @@ class mssql_sql_generator extends sql_generator { public $number_type = 'DECIMAL'; // Proper type for NUMBER(x) in this DB - public $unsigned_allowed = false; // To define in the generator must handle unsigned information public $default_for_char = ''; // To define the default to set for NOT NULLs CHARs without default (null=do nothing) public $specify_nulls = true; //To force the generator if NULL clauses must be specified. It shouldn't be necessary @@ -52,8 +51,6 @@ class mssql_sql_generator extends sql_generator { public $sequence_name = 'IDENTITY(1,1)'; //Particular name for inline sequences in this generator public $sequence_only = false; //To avoid to output the rest of the field specs, leaving only the name and the sequence_name variable - public $enum_inline_code = false; //Does the generator need to add inline code in the column definition - public $add_table_comments = false; // Does the generator need to add code for table comments public $concat_character = '+'; //Characters to be used as concatenation operator. If not defined @@ -215,11 +212,6 @@ public function getDropFieldSQL($xmldb_table, $xmldb_field) { $results[] = 'ALTER TABLE ' . $tablename . ' DROP CONSTRAINT ' . $defaultname; } - /// Look for any check constraint in this field and drop it - if ($drop_check = $this->getDropEnumSQL($xmldb_table, $xmldb_field)) { - $results = array_merge($results, $drop_check); - } - /// Build the standard alter table drop column $results[] = 'ALTER TABLE ' . $tablename . ' DROP COLUMN ' . $fieldname; @@ -260,22 +252,6 @@ public function getRenameTableExtraSQL($xmldb_table, $newname) { $results = array(); - $newt = new xmldb_table($newname); //Temporal table for name calculations - - $oldtablename = $this->getTableName($xmldb_table); - $newtablename = $this->getTableName($newt); - - /// Rename all the check constraints in the table - $oldconstraintprefix = $this->getNameForObject($xmldb_table->getName(), ''); - $newconstraintprefix = $this->getNameForObject($newt->getName(), '', ''); - - if ($constraints = $this->getCheckConstraintsFromDB($xmldb_table)) { - foreach ($constraints as $constraint) { - /// Drop the old constraint - $results[] = 'ALTER TABLE ' . $newtablename . ' DROP CONSTRAINT ' . $constraint->name; - } - } - return $results; } @@ -436,25 +412,6 @@ public function getModifyDefaultSQL($xmldb_table, $xmldb_field) { return $results; } - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum - * (usually invoked from getModifyEnumSQL() - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getDropEnumSQL($xmldb_table, $xmldb_field) { - /// Let's introspect to know the real name of the check constraint - if ($check_constraints = $this->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) { - $check_constraint = array_shift($check_constraints); /// Get the 1st (should be only one) - $constraint_name = strtolower($check_constraint->name); /// Extract the REAL name - /// All we have to do is to drop the check constraint - return array('ALTER TABLE ' . $this->getTableName($xmldb_table) . - ' DROP CONSTRAINT ' . $constraint_name); - } else { /// Constraint not found. Nothing to do - return array(); - } - } - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default * (usually invoked from getModifyDefaultSQL() @@ -522,55 +479,6 @@ public function getDefaultConstraintName($xmldb_table, $xmldb_field) { } } - /** - * Given one xmldb_table returns one array with all the check constraints - * in the table (fetched from DB) - * Optionally the function allows one xmldb_field to be specified in - * order to return only the check constraints belonging to one field. - * Each element contains the name of the constraint and its description - * If no check constraints are found, returns an empty array - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) { - - - $results = array(); - - $tablename = $this->getTableName($xmldb_table); - - if ($constraints = $this->mdb->get_records_sql("SELECT o.name, c.text AS description - FROM sysobjects o, - sysobjects p, - syscomments c - WHERE p.id = o.parent_obj - AND o.id = c.id - AND o.xtype = 'C' - AND p.name = ?", array($tablename))) { - foreach ($constraints as $constraint) { - $results[$constraint->name] = $constraint; - } - } - - /// Filter by the required field if specified - if ($xmldb_field) { - $filtered_results = array(); - $filter = $xmldb_field->getName(); - /// Lets clean a bit each constraint description, looking for the filtered field - foreach ($results as $key => $result) { - $description = trim(preg_replace('/[\(\)]/', '', $result->description)); // Parenthesis out & trim - /// description starts by [$filter] assume it's a constraint belonging to the field - if (preg_match("/^\[{$filter}\]/i", $description)) { - $filtered_results[$key] = $result; - } - } - /// Assign filtered results to the final results array - $results = $filtered_results; - } - - return $results; - } - /** * Given three strings (table name, list of fields (comma separated) and suffix), * create the proper object name quoting it if necessary. diff --git a/lib/ddl/mysql_sql_generator.php b/lib/ddl/mysql_sql_generator.php index 5f893633c3e71..11e241a0de269 100644 --- a/lib/ddl/mysql_sql_generator.php +++ b/lib/ddl/mysql_sql_generator.php @@ -59,8 +59,6 @@ class mysql_sql_generator extends sql_generator { public $sequence_extra_code = false; //Does the generator need to add extra code to generate the sequence fields public $sequence_name = 'auto_increment'; //Particular name for inline sequences in this generator - public $enum_extra_code = false; //Does the generator need to add extra code to generate code for the enums in the table - public $add_after_clause = true; // Does the generator need to add the after clause for fields public $concat_character = null; //Characters to be used as concatenation operator. If not defined @@ -204,28 +202,10 @@ public function getTypeSQL($xmldb_type, $xmldb_length=null, $xmldb_decimals=null $dbtype .= '(' . $xmldb_length . ')'; break; case XMLDB_TYPE_TEXT: - if (empty($xmldb_length)) { - $xmldb_length = 'small'; - } - if ($xmldb_length == 'small') { - $dbtype = 'TEXT'; - } else if ($xmldb_length == 'medium') { - $dbtype = 'MEDIUMTEXT'; - } else { - $dbtype = 'LONGTEXT'; - } + $dbtype = 'LONGTEXT'; break; case XMLDB_TYPE_BINARY: - if (empty($xmldb_length)) { - $xmldb_length = 'small'; - } - if ($xmldb_length == 'small') { - $dbtype = 'BLOB'; - } else if ($xmldb_length == 'medium') { - $dbtype = 'MEDIUMBLOB'; - } else { - $dbtype = 'LONGBLOB'; - } + $dbtype = 'LONGBLOB'; break; case XMLDB_TYPE_DATETIME: $dbtype = 'DATETIME'; @@ -233,31 +213,6 @@ public function getTypeSQL($xmldb_type, $xmldb_length=null, $xmldb_decimals=null return $dbtype; } - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its enum - * (usually invoked from getModifyEnumSQL() - */ - public function getCreateEnumSQL($xmldb_table, $xmldb_field) { - /// For MySQL, just alter the field - return $this->getAlterFieldSQL($xmldb_table, $xmldb_field); - } - - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum - * (usually invoked from getModifyEnumSQL() - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getDropEnumSQL($xmldb_table, $xmldb_field) { - /// Let's introspect to know if there is one enum - if ($check_constraints = $this->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) { - /// For MySQL, just alter the field - return $this->getAlterFieldSQL($xmldb_table, $xmldb_field); - } else { - return array(); /// Enum not found. Nothing to do - } - } - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default * (usually invoked from getModifyDefaultSQL() @@ -311,59 +266,6 @@ function getCommentSQL ($xmldb_table) { return array($comment); } - /** - * Given one xmldb_table returns one array with all the check constraints - * in the table (fetched from DB) - * Optionally the function allows one xmldb_field to be specified in - * order to return only the check constraints belonging to one field. - * Each element contains the name of the constraint and its description - * If no check constraints are found, returns an empty array - * MySQL doesn't have check constraints in this implementation, but - * we return them based on the enum fields in the table - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) { - - $tablename = $xmldb_table->getName($xmldb_table); - - /// Fetch all the columns in the table - if (!$columns = $this->mdb->get_columns($tablename)) { - return array(); - } - - /// Filter by the required field if specified - if ($xmldb_field) { - $filter = $xmldb_field->getName(); - if (!isset($columns[$filter])) { - return array(); - } - $column = ($columns[$filter]); - if (!empty($column->enums)) { - $result = new stdClass(); - $result->name = $filter; - $result->description = implode(', ', $column->enums); - return array($result); - } else { - return array(); - } - - } else { - $results = array(); - /// Iterate over columns searching for enums - foreach ($columns as $key => $column) { - /// Enum found, let's add it to the constraints list - if (!empty($column->enums)) { - $result = new stdClass(); - $result->name = $key; - $result->description = implode(', ', $column->enums); - $results[$key] = $result; - } - } - return $results; - } - } - /** * Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg) * return if such name is currently in use (true) or no (false) diff --git a/lib/ddl/oracle_sql_generator.php b/lib/ddl/oracle_sql_generator.php index 80039a5df7ed1..a2cf1adc4ee94 100644 --- a/lib/ddl/oracle_sql_generator.php +++ b/lib/ddl/oracle_sql_generator.php @@ -43,7 +43,6 @@ class oracle_sql_generator extends sql_generator { public $number_type = 'NUMBER'; // Proper type for NUMBER(x) in this DB - public $unsigned_allowed = false; // To define in the generator must handle unsigned information public $default_for_char = ' '; // To define the default to set for NOT NULLs CHARs without default (null=do nothing) // Using this whitespace here because Oracle doesn't distinguish empty and null! :-( @@ -56,8 +55,6 @@ class oracle_sql_generator extends sql_generator { public $sequence_name = ''; //Particular name for inline sequences in this generator public $sequence_cache_size = 20; //Size of the sequences values cache (20 = Oracle Default) - public $enum_inline_code = false; //Does the generator need to add inline code in the column definition - public $alter_column_sql = 'ALTER TABLE TABLENAME MODIFY (COLUMNSPECS)'; //The SQL template to alter columns /** @@ -289,20 +286,6 @@ public function getRenameTableExtraSQL($xmldb_table, $newname) { $newt = new xmldb_table($newname); /// Temp table for trigger code generation $results = array_merge($results, $this->getCreateTriggerSQL($newt, $xmldb_field, $newseqname)); - /// Rename all the check constraints in the table - $oldtablename = $this->getTableName($xmldb_table); - $newtablename = $this->getTableName($newt); - - $oldconstraintprefix = $this->getNameForObject($xmldb_table->getName(), ''); - $newconstraintprefix = $this->getNameForObject($newt->getName(), '', ''); - - if ($constraints = $this->getCheckConstraintsFromDB($xmldb_table)) { - foreach ($constraints as $constraint) { - /// Drop the old constraint - $results[] = 'ALTER TABLE ' . $newtablename . ' DROP CONSTRAINT ' . $constraint->name; - } - } - return $results; } @@ -485,25 +468,6 @@ public function getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = return $results; } - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum - * (usually invoked from getModifyEnumSQL() - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getDropEnumSQL($xmldb_table, $xmldb_field) { - /// Let's introspect to know the real name of the check constraint - if ($check_constraints = $this->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) { - $check_constraint = array_shift($check_constraints); /// Get the 1st (should be only one) - $constraint_name = strtolower($check_constraint->name); /// Extract the REAL name - /// All we have to do is to drop the check constraint - return array('ALTER TABLE ' . $this->getTableName($xmldb_table) . - ' DROP CONSTRAINT ' . $constraint_name); - } else { /// Constraint not found. Nothing to do - return array(); - } - } - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default * (usually invoked from getModifyDefaultSQL() @@ -524,51 +488,6 @@ public function getDropDefaultSQL($xmldb_table, $xmldb_field) { return $this->getAlterFieldSQL($xmldb_table, $xmldb_field); } - /** - * Given one xmldb_table returns one array with all the check constraints - * in the table (fetched from DB) - * Optionally the function allows one xmldb_field to be specified in - * order to return only the check constraints belonging to one field. - * Each element contains the name of the constraint and its description - * If no check constraints are found, returns an empty array - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) { - - $results = array(); - - $tablename = strtoupper($this->getTableName($xmldb_table)); - - if ($constraints = $this->mdb->get_records_sql("SELECT lower(c.constraint_name) AS name, c.search_condition AS description - FROM user_constraints c - WHERE c.table_name = ? - AND c.constraint_type = 'C' - AND c.constraint_name not like 'SYS%'", - array($tablename))) { - foreach ($constraints as $constraint) { - $results[$constraint->name] = $constraint; - } - } - - /// Filter by the required field if specified - if ($xmldb_field) { - $filtered_results = array(); - $filter = $xmldb_field->getName(); - /// Lets clean a bit each constraint description, looking for the filtered field - foreach ($results as $key => $result) { - /// description starts by "$filter IN" assume it's a constraint belonging to the field - if (preg_match("/^{$filter} IN/i", $result->description)) { - $filtered_results[$key] = $result; - } - } - /// Assign filtered results to the final results array - $results = $filtered_results; - } - - return $results; - } - /** * Given one xmldb_table returns one string with the sequence of the table * in the table (fetched from DB) diff --git a/lib/ddl/postgres_sql_generator.php b/lib/ddl/postgres_sql_generator.php index acde9d2d4a187..cf57825b77be5 100644 --- a/lib/ddl/postgres_sql_generator.php +++ b/lib/ddl/postgres_sql_generator.php @@ -40,7 +40,6 @@ class postgres_sql_generator extends sql_generator { public $number_type = 'NUMERIC'; // Proper type for NUMBER(x) in this DB - public $unsigned_allowed = false; // To define in the generator must handle unsigned information public $default_for_char = ''; // To define the default to set for NOT NULLs CHARs without default (null=do nothing) public $sequence_extra_code = false; //Does the generator need to add extra code to generate the sequence fields @@ -48,8 +47,6 @@ class postgres_sql_generator extends sql_generator { public $sequence_name_small = 'SERIAL'; //Particular name for inline sequences in this generator public $sequence_only = true; //To avoid to output the rest of the field specs, leaving only the name and the sequence_name variable - public $enum_inline_code = false; //Does the generator need to add inline code in the column definition - public $rename_index_sql = 'ALTER TABLE OLDINDEXNAME RENAME TO NEWINDEXNAME'; //SQL sentence to rename one index //TABLENAME, OLDINDEXNAME, NEWINDEXNAME are dynamically replaced @@ -182,20 +179,6 @@ public function getRenameTableExtraSQL($xmldb_table, $newname) { /// Rename de sequence $results[] = 'ALTER TABLE ' . $oldseqname . ' RENAME TO ' . $newseqname; - /// Rename all the check constraints in the table - $oldtablename = $this->getTableName($xmldb_table); - $newtablename = $this->getTableName($newt); - - $oldconstraintprefix = $this->getNameForObject($xmldb_table->getName(), ''); - $newconstraintprefix = $this->getNameForObject($newt->getName(), '', ''); - - if ($constraints = $this->getCheckConstraintsFromDB($xmldb_table)) { - foreach ($constraints as $constraint) { - /// Drop the old constraint - $results[] = 'ALTER TABLE ' . $newtablename . ' DROP CONSTRAINT ' . $constraint->name; - } - } - return $results; } @@ -318,25 +301,6 @@ public function getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = return $results; } - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum - * (usually invoked from getModifyEnumSQL() - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getDropEnumSQL($xmldb_table, $xmldb_field) { - /// Let's introspect to know the real name of the check constraint - if ($check_constraints = $this->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) { - $check_constraint = array_shift($check_constraints); /// Get the 1st (should be only one) - $constraint_name = strtolower($check_constraint->name); /// Extract the REAL name - /// All we have to do is to drop the check constraint - return array('ALTER TABLE ' . $this->getTableName($xmldb_table) . - ' DROP CONSTRAINT ' . $constraint_name); - } else { /// Constraint not found. Nothing to do - return array(); - } - } - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default * (usually invoked from getModifyDefaultSQL() @@ -357,55 +321,6 @@ public function getDropDefaultSQL($xmldb_table, $xmldb_field) { return $this->getAlterFieldSQL($xmldb_table, $xmldb_field); } - /** - * Given one xmldb_table returns one array with all the check constraints - * in the table (fetched from DB) - * Optionally the function allows one xmldb_field to be specified in - * order to return only the check constraints belonging to one field. - * Each element contains the name of the constraint and its description - * If no check constraints are found, returns an empty array - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) { - - $results = array(); - - $tablename = $this->getTableName($xmldb_table); - - if ($constraints = $this->mdb->get_records_sql("SELECT co.conname AS name, co.consrc AS description - FROM pg_constraint co, pg_class cl - WHERE co.conrelid = cl.oid - AND co.contype = 'c' AND cl.relname = ?", - array($tablename))) { - foreach ($constraints as $constraint) { - $results[$constraint->name] = $constraint; - } - } - - /// Filter by the required field if specified - if ($xmldb_field) { - $filtered_results = array(); - $filter = $xmldb_field->getName(); - /// Lets clean a bit each constraint description, looking for the filtered field - foreach ($results as $key => $result) { - $description = preg_replace('/\("(.*?)"\)/', '($1)', $result->description);// Double quotes out - $description = preg_replace('/[\(\)]/', '', $description); // Parenthesis out - $description = preg_replace('/::[a-z]+/i', '', $description); // Casts out - $description = preg_replace("/({$filter})/i", '@$1@', $description); - $description = trim(preg_replace('/ or /i', ' OR ', $description)); // Uppercase or & trim - /// description starts by @$filter@ assume it's a constraint belonging to the field - if (preg_match("/^@{$filter}@/i", $description)) { - $filtered_results[$key] = $result; - } - } - /// Assign filtered results to the final results array - $results = $filtered_results; - } - - return $results; - } - public function addslashes($s) { // Postgres is gradually switching to ANSI quotes, we need to check what is expected if (!isset($this->std_strings)) { diff --git a/lib/ddl/simpletest/fixtures/invalid.xml b/lib/ddl/simpletest/fixtures/invalid.xml index 3f91a6611f982..36880563a31be 100644 --- a/lib/ddl/simpletest/fixtures/invalid.xml +++ b/lib/ddl/simpletest/fixtures/invalid.xml @@ -1,15 +1,15 @@ - +
    - + - - + + diff --git a/lib/ddl/simpletest/fixtures/xmldb_table.xml b/lib/ddl/simpletest/fixtures/xmldb_table.xml index b36b4b4caabde..90cb13768a22d 100644 --- a/lib/ddl/simpletest/fixtures/xmldb_table.xml +++ b/lib/ddl/simpletest/fixtures/xmldb_table.xml @@ -1,5 +1,5 @@ - +
    @@ -9,7 +9,7 @@ - + diff --git a/lib/ddl/simpletest/testddl.php b/lib/ddl/simpletest/testddl.php index a9377534fc9d1..4a27f80cf9421 100644 --- a/lib/ddl/simpletest/testddl.php +++ b/lib/ddl/simpletest/testddl.php @@ -544,14 +544,14 @@ public function test_add_field() { $this->assertEqual($columns['onechar']->meta_type ,'C'); $this->assertEqual($DB->get_field('test_table1', 'onechar', array(), IGNORE_MULTIPLE), 'Nice dflt!'); //check default has been applied - /// add one text field and check it + /// add one big text field and check it $field = new xmldb_field('onetext'); - $field->set_attributes(XMLDB_TYPE_TEXT); + $field->set_attributes(XMLDB_TYPE_TEXT, 'big'); $dbman->add_field($table, $field); $this->assertTrue($dbman->field_exists($table, 'onetext')); $columns = $DB->get_columns('test_table1'); $this->assertEqual($columns['onetext']->name ,'onetext'); - $this->assertEqual($columns['onetext']->max_length , -1); + $this->assertEqual($columns['onetext']->max_length , -1); // -1 means unknown or big $this->assertEqual($columns['onetext']->scale , null); $this->assertEqual($columns['onetext']->not_null , false); $this->assertEqual($columns['onetext']->primary_key , false); @@ -560,6 +560,20 @@ public function test_add_field() { $this->assertEqual($columns['onetext']->default_value, null); $this->assertEqual($columns['onetext']->meta_type ,'X'); + /// add one medium text field and check it + $field = new xmldb_field('mediumtext'); + $field->set_attributes(XMLDB_TYPE_TEXT, 'medium'); + $dbman->add_field($table, $field); + $columns = $DB->get_columns('test_table1'); + $this->assertTrue(($columns['mediumtext']->max_length == -1) or ($columns['mediumtext']->max_length >= 16777215)); // -1 means unknown or big + + /// add one small text field and check it + $field = new xmldb_field('smalltext'); + $field->set_attributes(XMLDB_TYPE_TEXT, 'small'); + $dbman->add_field($table, $field); + $columns = $DB->get_columns('test_table1'); + $this->assertTrue(($columns['smalltext']->max_length == -1) or ($columns['smalltext']->max_length >= 65535)); // -1 means unknown or big + /// add one binary field and check it $field = new xmldb_field('onebinary'); $field->set_attributes(XMLDB_TYPE_BINARY); @@ -901,20 +915,6 @@ public function test_change_field_precision() { //TODO: check the rest of attributes } - public function testChangeFieldSign() { - $dbman = $this->tdb->get_manager(); -// TODO: verify the signed is changed in db - - $table = $this->create_deftable('test_table1'); - $field = new xmldb_field('grade'); - $field->set_attributes(XMLDB_TYPE_NUMBER, '10,2', XMLDB_UNSIGNED, null, null, null); - $dbman->change_field_unsigned($table, $field); - - $field = new xmldb_field('grade'); - $field->set_attributes(XMLDB_TYPE_NUMBER, '10,2', null, null, null, null); - $dbman->change_field_unsigned($table, $field); - } - public function testChangeFieldNullability() { $DB = $this->tdb; // do not use global $DB! $dbman = $this->tdb->get_manager(); @@ -1146,73 +1146,6 @@ public function testDropForeignKey() { $dbman->drop_key($table, $key); } - /** - * Test behaviour of drop_enum_from_field() and related functions (find_check_constraint_name - * and check_constraint_exists). Needed to be able to drop existing "enum" fields in the upgrade - * from 1.9 to 2.0, will be completely deleted for Moodle 2.1 - * - * Because we already have dropped support for creation of enum fields in 2.0, we are going to - * create them here "manually" (hardcoded DB-dependent SQL). Just to be able to test the - * find and drop functions properly. - * - * TODO: Drop this tests completely from Moodle 2.1 - */ - public function test_drop_enum_from_field() { - $DB = $this->tdb; // do not use global $DB! - $dbman = $this->tdb->get_manager(); - - // Create normal table, no enums. - $table = new xmldb_table('test_table_cust0'); - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0'); - $field = new xmldb_field('type'); - $field->set_attributes(XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, 'general'); - $table->addField($field); - $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); - $dbman->create_table($table); - - $this->assertTrue($dbman->table_exists($table)); - $this->assertTrue($dbman->field_exists($table, $field)); - - // Check table hasn't enums at all - $this->assertFalse($dbman->check_constraint_exists($table, $field)); - $this->assertFalse($dbman->find_check_constraint_name($table, $field)); - ob_start(); - $this->assertFalse($dbman->drop_enum_from_field($table, $field)); // This just outputs debug warning if field hasn't enums - ob_end_clean(); - - // Insert some info - $record = new stdClass(); - $record->course = 666; - $record->type = 'qanda'; - $this->assertTrue($DB->insert_record('test_table_cust0', $record, false)); - - // Hackery starts here, depending of the db family we are testing... execute - // the needed SQL statements to get the "type" field defined as enum - $stmt = ''; - switch ($DB->get_dbfamily()) { - case 'mysql': // It's ENUM field for mysql - $stmt = "ALTER TABLE {$DB->get_prefix()}test_table_cust0 MODIFY type ENUM ('general', 'qanda', 'moodle') NOT NULL DEFAULT 'general'"; - break; - default: // It's check constraint for "normal" DBs - $stmt = "ALTER TABLE {$DB->get_prefix()}test_table_cust0 ADD CONSTRAINT ttcu0_ck CHECK (type IN ('general', 'qanda', 'moodle'))"; - } - $DB->change_database_structure($stmt); - - // Check table has enums now - $this->assertTrue($dbman->check_constraint_exists($table, $field)); - $this->assertTrue($dbman->find_check_constraint_name($table, $field)); - - // Removing an enum value - $dbman->drop_enum_from_field($table, $field); - - // Chech table hasn't enum anymore - $this->assertFalse($dbman->check_constraint_exists($table, $field)); - $this->assertFalse($dbman->find_check_constraint_name($table, $field)); - - $dbman->drop_table($table); - } - public function testRenameField() { $DB = $this->tdb; // do not use global $DB! $dbman = $this->tdb->get_manager(); @@ -1287,6 +1220,7 @@ public function testDeleteTablesFromXmldbFile() { $this->assertTrue($dbman->table_exists('test_table1')); // Real and valid xml file + //TODO: drop UNSINGED completely in Moodle 2.4 $dbman->delete_tables_from_xmldb_file($CFG->libdir . '/ddl/simpletest/fixtures/xmldb_table.xml'); // Check that the table has been deleted from DB diff --git a/lib/ddl/sql_generator.php b/lib/ddl/sql_generator.php index f70ab21e312c6..6103931c3f267 100644 --- a/lib/ddl/sql_generator.php +++ b/lib/ddl/sql_generator.php @@ -65,8 +65,6 @@ abstract class sql_generator { /** @var string Proper type for NUMBER(x) in this DB. */ public $number_type = 'NUMERIC'; - /** @var bool To define in the generator must handle unsigned information.*/ - public $unsigned_allowed = true; /** @var string To define the default to set for NOT NULLs CHARs without default (null=do nothing).*/ public $default_for_char = null; @@ -489,14 +487,7 @@ public function getFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL /// The type and length $field .= ' ' . $this->getTypeSQL($xmldb_field->getType(), $xmldb_field->getLength(), $xmldb_field->getDecimals()); } - /// The unsigned if supported - if ($this->unsigned_allowed && ($xmldb_field->getType() == XMLDB_TYPE_INTEGER || - $xmldb_field->getType() == XMLDB_TYPE_NUMBER || - $xmldb_field->getType() == XMLDB_TYPE_FLOAT)) { - if ($xmldb_field->getUnsigned()) { - $field .= ' unsigned'; - } - } + /// note: unsigned is not supported any more since moodle 2.3, all numbers are signed /// Calculate the not null clause $notnull = ''; /// Only if we don't want to skip it @@ -1367,19 +1358,6 @@ public function getDropTableExtraSQL($xmldb_table) { return array(); } - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum - * (usually invoked from getModifyEnumSQL() - * - * Note that this method may be dropped in future. - * - * @param xmldb_table $xmldb_table The xmldb_table object instance. - * @param xmldb_field $xmldb_field The xmldb_field object instance. - * - * @todo MDL-31147 Moodle 2.1 - Drop getDropEnumSQL() - */ - public abstract function getDropEnumSQL($xmldb_table, $xmldb_field); - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its default * (usually invoked from getModifyDefaultSQL() @@ -1393,20 +1371,6 @@ public abstract function getDropEnumSQL($xmldb_table, $xmldb_field); */ public abstract function getDropDefaultSQL($xmldb_table, $xmldb_field); - /** - * Given one xmldb_table and one optional xmldb_field, return one array with all the check - * constrainst found for that table (or field). Must exist for each DB supported. - * (usually invoked from find_check_constraint_name) - * - * Note that this method may be dropped in future. - * - * @param xmldb_table $xmldb_table The xmldb_table object instance. - * @param xmldb_field $xmldb_field The xmldb_field object instance. - * - * @todo MDL-31147 Moodle 2.1 - Drop getCheckConstraintsFromDB - */ - public abstract function getCheckConstraintsFromDB($xmldb_table, $xmldb_field=null); - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to add its default * (usually invoked from getModifyDefaultSQL() diff --git a/lib/ddl/sqlite_sql_generator.php b/lib/ddl/sqlite_sql_generator.php index d190d07065981..e10b24a869b9d 100644 --- a/lib/ddl/sqlite_sql_generator.php +++ b/lib/ddl/sqlite_sql_generator.php @@ -53,10 +53,6 @@ class sqlite_sql_generator extends sql_generator { public $sequence_only = true; //To avoid to output the rest of the field specs, leaving only the name and the sequence_name publiciable public $sequence_extra_code = false; //Does the generator need to add extra code to generate the sequence fields public $sequence_name = 'INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL'; //Particular name for inline sequences in this generator - public $unsigned_allowed = false; // To define in the generator must handle unsigned information - - public $enum_inline_code = true; //Does the generator need to add inline code in the column definition - public $enum_extra_code = false; //Does the generator need to add extra code to generate code for the enums in the table public $drop_index_sql = 'ALTER TABLE TABLENAME DROP INDEX INDEXNAME'; //SQL sentence to drop one index //TABLENAME, INDEXNAME are dynamically replaced @@ -282,22 +278,6 @@ public function getAddKeySQL($xmldb_table, $xmldb_key) { return $this->getAlterTableSchema($xmldb_table); } - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its enum - * (usually invoked from getModifyEnumSQL() - */ - public function getCreateEnumSQL($xmldb_table, $xmldb_field) { - return $this->getAlterTableSchema($xmldb_table, $xmldb_field, $xmldb_field); - } - - /** - * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum - * (usually invoked from getModifyEnumSQL() - */ - public function getDropEnumSQL($xmldb_table, $xmldb_field) { - return $this->getAlterTableSchema($xmldb_table, $xmldb_field, $xmldb_field); - } - /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default * (usually invoked from getModifyDefaultSQL() @@ -378,37 +358,6 @@ function getCommentSQL ($xmldb_table) { return array(); } - /** - * Given one xmldb_table returns one array with all the check constraints - * in the table (fetched from DB) - * Optionally the function allows one xmldb_field to be specified in - * order to return only the check constraints belonging to one field. - * Each element contains the name of the constraint and its description - * If no check constraints are found, returns an empty array. - * - * TODO: Moodle 2.1 - drop in Moodle 2.1 - */ - public function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) { - $tablename = $xmldb_table->getName($xmldb_table); - // Fetch all the columns in the table - if (!$columns = $this->mdb->get_columns($tablename, false)) { - return array(); - } - $results = array(); - $filter = $xmldb_field ? $xmldb_field->getName() : NULL; - // Iterate over columns searching for enums - foreach ($columns as $key => $column) { - // Enum found, let's add it to the constraints list - if (!empty($column->enums) && (!$filter || $column->name == $filter)) { - $result = new stdClass(); - $result->name = $key; - $result->description = implode(', ', $column->enums); - $results[$key] = $result; - } - } - return $results; - } - /** * Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg) * return if such name is currently in use (true) or no (false) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 5b3c9ca860b70..eed77e964e545 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -884,29 +884,6 @@ function index_exists($table, $index) { return $DB->get_manager()->index_exists($table, $index); } -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function find_check_constraint_name($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->find_check_constraint_name($table, $field); -} - -/** - * @deprecated - * @global object - */ -function check_constraint_exists($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->check_constraint_exists($table, $field); -} - /** * @deprecated * @global object @@ -1070,20 +1047,6 @@ function change_field_notnull($table, $field) { return true; } -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function change_field_enum($table, $field) { - global $DB; - debugging('Deprecated ddllib function used! Only dropping of enums is allowed.'); - $DB->get_manager()->drop_enum_from_field($table, $field); - return true; -} - /** * @deprecated * @global object @@ -4000,3 +3963,40 @@ function show_event($event) { $event = new calendar_event($event); return $event->toggle_visibility(true); } + +/** + * Converts string to lowercase using most compatible function available. + * + * @deprecated Use textlib::strtolower($text) instead. + * + * @param string $string The string to convert to all lowercase characters. + * @param string $encoding The encoding on the string. + * @return string + */ +function moodle_strtolower($string, $encoding='') { + + debugging('moodle_strtolower() is deprecated. Please use textlib::strtolower() instead.', DEBUG_DEVELOPER); + + //If not specified use utf8 + if (empty($encoding)) { + $encoding = 'UTF-8'; + } + //Use text services + return textlib::strtolower($string, $encoding); +} + +/** + * Original singleton helper function, please use static methods instead, + * ex: textlib::convert() + * + * @deprecated since Moodle 2.2 use textlib::xxxx() instead + * @see textlib + * @return textlib instance + */ +function textlib_get_instance() { + + debugging('textlib_get_instance() is deprecated. Please use static calling textlib::functioname() instead.', DEBUG_DEVELOPER); + + return new textlib(); +} + diff --git a/lib/dml/database_column_info.php b/lib/dml/database_column_info.php index a6c762af07a2b..a31d3621181ac 100644 --- a/lib/dml/database_column_info.php +++ b/lib/dml/database_column_info.php @@ -60,7 +60,6 @@ class database_column_info { * integer - number of digits * float - digits left from floating point * boolean - 1 - * enums - null * @var int */ public $max_length; @@ -73,16 +72,6 @@ class database_column_info { */ public $scale; - /** - * Enumerated field options, - * null if not enum type - * - * For performance reasons this field is optional! - * You can use DDL sql_generator::getCheckConstraintsFromDB() if needed. - * @var string - */ - public $enums; - /** * True if not null, false otherwise * @var bool @@ -113,6 +102,7 @@ class database_column_info { * True if integer unsigned, false if signed. * Null for other types * @var integer + * @deprecated since 2.3 */ public $unsigned; diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 88309a42af144..2baf138f37dd4 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -956,7 +956,7 @@ public abstract function change_database_structure($sql); /** * Executes a general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool true @@ -1798,6 +1798,7 @@ public function sql_cast_char2real($fieldname, $text=false) { * (Only MySQL needs this. MySQL things that 1 * -1 = 18446744073709551615 * if the 1 comes from an unsigned column). * + * @deprecated since 2.3 * @param string $fieldname The name of the field to be cast * @return string The piece of SQL code to be used in your statement. */ diff --git a/lib/dml/mssql_native_moodle_database.php b/lib/dml/mssql_native_moodle_database.php index 59e69184f3231..d5998a7187a34 100644 --- a/lib/dml/mssql_native_moodle_database.php +++ b/lib/dml/mssql_native_moodle_database.php @@ -655,7 +655,7 @@ protected function emulate_bound_params($sql, array $params=null) { /** * Execute general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool true diff --git a/lib/dml/mysqli_native_moodle_database.php b/lib/dml/mysqli_native_moodle_database.php index 3f70beff41ed7..242c5c43b9ec7 100644 --- a/lib/dml/mysqli_native_moodle_database.php +++ b/lib/dml/mysqli_native_moodle_database.php @@ -439,7 +439,12 @@ public function get_columns($table, $usecache=true) { $this->columns[$table] = array(); - $sql = "SHOW COLUMNS FROM {$this->prefix}$table"; + $sql = "SELECT column_name, data_type, character_maximum_length, numeric_precision, + numeric_scale, is_nullable, column_type, column_default, column_key, extra + FROM information_schema.columns + WHERE table_name = '" . $this->prefix.$table . "' + AND table_schema = '" . $this->dbname . "' + ORDER BY ordinal_position"; $this->query_start($sql, null, SQL_QUERY_AUX); $result = $this->mysqli->query($sql); $this->query_end(true); // Don't want to throw anything here ever. MDL-30147 @@ -448,141 +453,194 @@ public function get_columns($table, $usecache=true) { return array(); } - while ($rawcolumn = $result->fetch_assoc()) { - $rawcolumn = (object)array_change_key_case($rawcolumn, CASE_LOWER); - - $info = new stdClass(); - $info->name = $rawcolumn->field; - $matches = null; - - if (preg_match('/varchar\((\d+)\)/i', $rawcolumn->type, $matches)) { - $info->type = 'varchar'; - $info->meta_type = 'C'; - $info->max_length = $matches[1]; - $info->scale = null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->primary_key = ($rawcolumn->key === 'PRI'); - $info->binary = false; - $info->unsigned = null; - $info->auto_increment= false; - $info->unique = null; - - } else if (preg_match('/([a-z]*int[a-z]*)\((\d+)\)/i', $rawcolumn->type, $matches)) { - $info->type = $matches[1]; - $info->primary_key = ($rawcolumn->key === 'PRI'); - if ($info->primary_key) { - $info->meta_type = 'R'; - $info->max_length = $matches[2]; - $info->scale = null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->binary = false; - $info->unsigned = (stripos($rawcolumn->type, 'unsigned') !== false); - $info->auto_increment= true; - $info->unique = true; + if ($result->num_rows > 0) { + // standard table exists + while ($rawcolumn = $result->fetch_assoc()) { + $info = (object)$this->get_column_info((object)$rawcolumn); + $this->columns[$table][$info->name] = new database_column_info($info); + } + $result->close(); + + } else { + // temporary tables are not in information schema, let's try it the old way + $result->close(); + $sql = "SHOW COLUMNS FROM {$this->prefix}$table"; + $this->query_start($sql, null, SQL_QUERY_AUX); + $result = $this->mysqli->query($sql); + $this->query_end(true); + if ($result === false) { + return array(); + } + while ($rawcolumn = $result->fetch_assoc()) { + $rawcolumn = (object)array_change_key_case($rawcolumn, CASE_LOWER); + $rawcolumn->column_name = $rawcolumn->field; unset($rawcolumn->field); + $rawcolumn->column_type = $rawcolumn->type; unset($rawcolumn->type); + $rawcolumn->character_maximum_length = null; + $rawcolumn->numeric_precision = null; + $rawcolumn->numeric_scale = null; + $rawcolumn->is_nullable = $rawcolumn->null; unset($rawcolumn->null); + $rawcolumn->column_default = $rawcolumn->default; unset($rawcolumn->default); + $rawcolumn->column_key = $rawcolumn->key; unset($rawcolumn->default); + $rawcolumn->extra = ($rawcolumn->column_name === 'id') ? 'auto_increment' : ''; + + if (preg_match('/(enum|varchar)\((\d+)\)/i', $rawcolumn->column_type, $matches)) { + $rawcolumn->data_type = $matches[1]; + $rawcolumn->character_maximum_length = $matches[2]; + + } else if (preg_match('/([a-z]*int[a-z]*)\((\d+)\)/i', $rawcolumn->column_type, $matches)) { + $rawcolumn->data_type = $matches[1]; + $rawcolumn->character_maximum_length = $matches[2]; + + } else if (preg_match('/(decimal)\((\d+),(\d+)\)/i', $rawcolumn->column_type, $matches)) { + $rawcolumn->data_type = $matches[1]; + $rawcolumn->numeric_precision = $matches[2]; + $rawcolumn->numeric_scale = $matches[3]; + + } else if (preg_match('/(double|float)(\((\d+),(\d+)\))?/i', $rawcolumn->column_type, $matches)) { + $rawcolumn->data_type = $matches[1]; + $rawcolumn->numeric_precision = isset($matches[3]) ? $matches[3] : null; + $rawcolumn->numeric_scale = isset($matches[4]) ? $matches[4] : null; + + } else if (preg_match('/([a-z]*text)/i', $rawcolumn->column_type, $matches)) { + $rawcolumn->data_type = $matches[1]; + $rawcolumn->character_maximum_length = -1; // unknown + + } else if (preg_match('/([a-z]*blob)/i', $rawcolumn->column_type, $matches)) { + $rawcolumn->data_type = $matches[1]; + } else { - $info->meta_type = 'I'; - $info->max_length = $matches[2]; - $info->scale = null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->binary = false; - $info->unsigned = (stripos($rawcolumn->type, 'unsigned') !== false); - $info->auto_increment= false; - $info->unique = null; + $rawcolumn->data_type = $rawcolumn->column_type; } - } else if (preg_match('/(decimal)\((\d+),(\d+)\)/i', $rawcolumn->type, $matches)) { - $info->type = $matches[1]; - $info->meta_type = 'N'; - $info->max_length = $matches[2]; - $info->scale = $matches[3]; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->primary_key = ($rawcolumn->key === 'PRI'); - $info->binary = false; - $info->unsigned = (stripos($rawcolumn->type, 'unsigned') !== false); - $info->auto_increment= false; - $info->unique = null; - - } else if (preg_match('/(double|float)(\((\d+),(\d+)\))?/i', $rawcolumn->type, $matches)) { - $info->type = $matches[1]; - $info->meta_type = 'N'; - $info->max_length = isset($matches[3]) ? $matches[3] : null; - $info->scale = isset($matches[4]) ? $matches[4] : null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->primary_key = ($rawcolumn->key === 'PRI'); - $info->binary = false; - $info->unsigned = (stripos($rawcolumn->type, 'unsigned') !== false); - $info->auto_increment= false; - $info->unique = null; - - } else if (preg_match('/([a-z]*text)/i', $rawcolumn->type, $matches)) { - $info->type = $matches[1]; - $info->meta_type = 'X'; - $info->max_length = -1; - $info->scale = null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->primary_key = ($rawcolumn->key === 'PRI'); - $info->binary = false; - $info->unsigned = null; - $info->auto_increment= false; - $info->unique = null; - - } else if (preg_match('/([a-z]*blob)/i', $rawcolumn->type, $matches)) { - $info->type = $matches[1]; - $info->meta_type = 'B'; - $info->max_length = -1; - $info->scale = null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->primary_key = false; - $info->binary = true; - $info->unsigned = null; - $info->auto_increment= false; - $info->unique = null; - - } else if (preg_match('/enum\((.*)\)/i', $rawcolumn->type, $matches)) { - $info->type = 'enum'; - $info->meta_type = 'C'; - $info->enums = array(); - $info->max_length = 0; - $values = $matches[1]; - $values = explode(',', $values); - $textlib = textlib_get_instance(); - foreach ($values as $val) { - $val = trim($val, "'"); - $length = $textlib->strlen($val); - $info->enums[] = $val; - $info->max_length = ($info->max_length < $length) ? $length : $info->max_length; - } - $info->scale = null; - $info->not_null = ($rawcolumn->null === 'NO'); - $info->default_value = $rawcolumn->default; - $info->has_default = is_null($info->default_value) ? false : true; - $info->primary_key = ($rawcolumn->key === 'PRI'); - $info->binary = false; - $info->unsigned = null; - $info->auto_increment= false; - $info->unique = null; + $info = $this->get_column_info($rawcolumn); + $this->columns[$table][$info->name] = new database_column_info($info); } + $result->close(); + } - $this->columns[$table][$info->name] = new database_column_info($info); + return $this->columns[$table]; + } + + /** + * Returns moodle column info for raw column from information schema. + * @param stdClass $rawcolumn + * @return stdClass standardised colum info + */ + private function get_column_info(stdClass $rawcolumn) { + $rawcolumn = (object)$rawcolumn; + $info = new stdClass(); + $info->name = $rawcolumn->column_name; + $info->type = $rawcolumn->data_type; + $info->meta_type = $this->mysqltype2moodletype($rawcolumn->data_type); + $info->default_value = $rawcolumn->column_default; + $info->has_default = !is_null($rawcolumn->column_default); + $info->not_null = ($rawcolumn->is_nullable === 'NO'); + $info->primary_key = ($rawcolumn->column_key === 'PRI'); + $info->binary = false; + $info->unsigned = null; + $info->auto_increment = false; + $info->unique = null; + $info->scale = null; + + if ($info->meta_type === 'C') { + $info->max_length = $rawcolumn->character_maximum_length; + + } else if ($info->meta_type === 'I') { + if ($info->primary_key) { + $info->meta_type = 'R'; + $info->unique = true; + } + $info->max_length = $rawcolumn->numeric_precision; + $info->unsigned = (stripos($rawcolumn->column_type, 'unsigned') !== false); + $info->auto_increment= (strpos($rawcolumn->extra, 'auto_increment') !== false); + + } else if ($info->meta_type === 'N') { + $info->max_length = $rawcolumn->numeric_precision; + $info->scale = $rawcolumn->numeric_scale; + $info->unsigned = (stripos($rawcolumn->column_type, 'unsigned') !== false); + + } else if ($info->meta_type === 'X') { + if ("$rawcolumn->character_maximum_length" === '4294967295') { // watch out for PHP max int limits! + // means maximum moodle size for text column, in other drivers it may also mean unknown size + $info->max_length = -1; + } else { + $info->max_length = $rawcolumn->character_maximum_length; + } + $info->primary_key = false; + + } else if ($info->meta_type === 'B') { + $info->max_length = -1; + $info->primary_key = false; + $info->binary = true; } - $result->close(); + return $info; + } - return $this->columns[$table]; + /** + * Normalise column type. + * @param string $mysql_type + * @return string one character + * @throws dml_exception + */ + private function mysqltype2moodletype($mysql_type) { + $type = null; + + switch(strtoupper($mysql_type)) { + case 'BIT': + $type = 'L'; + break; + + case 'TINYINT': + case 'SMALLINT': + case 'MEDIUMINT': + case 'INT': + case 'BIGINT': + $type = 'I'; + break; + + case 'FLOAT': + case 'DOUBLE': + case 'DECIMAL': + $type = 'N'; + break; + + case 'CHAR': + case 'ENUM': + case 'SET': + case 'VARCHAR': + $type = 'C'; + break; + + case 'TINYTEXT': + case 'TEXT': + case 'MEDIUMTEXT': + case 'LONGTEXT': + $type = 'X'; + break; + + case 'BINARY': + case 'VARBINARY': + case 'BLOB': + case 'TINYBLOB': + case 'MEDIUMBLOB': + case 'LONGBLOB': + $type = 'B'; + break; + + case 'DATE': + case 'TIME': + case 'DATETIME': + case 'TIMESTAMP': + case 'YEAR': + $type = 'D'; + break; + } + + if (!$type) { + throw new dml_exception('invalidmysqlnativetype', $mysql_type); + } + return $type; } /** @@ -605,16 +663,6 @@ protected function normalise_value($column, $value) { } else if (is_float($value) and ($column->meta_type == 'C' or $column->meta_type == 'X')) { $value = "$value"; } - // workaround for problem with wrong enums in mysql - TODO: Out in Moodle 2.1 - if (!empty($column->enums)) { - if (is_null($value) and !$column->not_null) { - // ok - nulls allowed - } else { - if (!in_array((string)$value, $column->enums)) { - throw new dml_write_exception('Enum value '.s($value).' not allowed in field '.$field.' table '.$table.'.'); - } - } - } return $value; } @@ -709,7 +757,7 @@ protected function emulate_bound_params($sql, array $params=null) { /** * Execute general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool true @@ -1203,6 +1251,13 @@ public function sql_regex($positivematch=true) { return $positivematch ? 'REGEXP' : 'NOT REGEXP'; } + /** + * Returns the SQL to be used in order to an UNSIGNED INTEGER column to SIGNED. + * + * @deprecated since 2.3 + * @param string $fieldname The name of the field to be cast + * @return string The piece of SQL code to be used in your statement. + */ public function sql_cast_2signed($fieldname) { return ' CAST(' . $fieldname . ' AS SIGNED) '; } diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index bc08fb947d02e..b780bd4294661 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -313,7 +313,7 @@ protected function fix_table_names($sql) { if (preg_match_all('/\{([a-z][a-z0-9_]*)\}/', $sql, $matches)) { foreach($matches[0] as $key=>$match) { $name = $matches[1][$key]; - if ($this->temptables->is_temptable($name)) { + if ($this->temptables && $this->temptables->is_temptable($name)) { $sql = str_replace($match, $this->temptables->get_correct_name($name), $sql); } else { $sql = str_replace($match, $this->prefix.$name, $sql); @@ -523,7 +523,6 @@ public function get_columns($table, $usecache=true) { or $rawcolumn->COLTYPE === 'NVARCHAR' or $rawcolumn->COLTYPE === 'CHAR' or $rawcolumn->COLTYPE === 'NCHAR') { - //TODO add some basic enum support here $info->type = $rawcolumn->COLTYPE; $info->meta_type = 'C'; $info->max_length = $rawcolumn->WIDTH; @@ -990,7 +989,7 @@ public static function onespace2empty(&$item, $key=null) { /** * Execute general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool true diff --git a/lib/dml/pdo_moodle_database.php b/lib/dml/pdo_moodle_database.php index 5f54613ce837b..8b090a4916166 100644 --- a/lib/dml/pdo_moodle_database.php +++ b/lib/dml/pdo_moodle_database.php @@ -226,7 +226,7 @@ protected function create_recordset($sth) { /** * Execute general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool success @@ -411,17 +411,6 @@ public function insert_record($table, $dataobject, $returnid=true, $bulk=false) if (is_bool($value)) { $value = (int)$value; // prevent "false" problems } - if (!empty($column->enums)) { - // workaround for problem with wrong enums - if (is_null($value) and !$column->not_null) { - // ok - nulls allowed - } else { - if (!in_array((string)$value, $column->enums)) { - debugging('Enum value '.s($value).' not allowed in field '.$field.' table '.$table.'.'); - return false; - } - } - } $cleaned[$field] = $value; } diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index cdd1c5ecd4c00..d49803b0e8f19 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -585,7 +585,7 @@ public function change_database_structure($sql) { /** * Execute general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool true diff --git a/lib/dml/sqlite3_pdo_moodle_database.php b/lib/dml/sqlite3_pdo_moodle_database.php index b28334c87cc59..01731fc6c4a70 100644 --- a/lib/dml/sqlite3_pdo_moodle_database.php +++ b/lib/dml/sqlite3_pdo_moodle_database.php @@ -260,13 +260,6 @@ public function get_columns($table, $usecache=true) { $columninfo['meta_type'] = 'C'; break; case 'enu': // enums - if (preg_match('|'.$columninfo['name'].'\W+in\W+\(/\*liststart\*/(.*?)/\*listend\*/\)|im', $createsql, $tmp)) { - $tmp = explode(',', $tmp[1]); - foreach($tmp as $value) { - $columninfo['enums'][] = trim($value, '\'"'); - } - unset($tmp); - } $columninfo['meta_type'] = 'C'; break; case 'tex': // text diff --git a/lib/dml/sqlsrv_native_moodle_database.php b/lib/dml/sqlsrv_native_moodle_database.php index a938679903027..f8c799f4985ce 100644 --- a/lib/dml/sqlsrv_native_moodle_database.php +++ b/lib/dml/sqlsrv_native_moodle_database.php @@ -731,7 +731,7 @@ protected function emulate_bound_params($sql, array $params = null) { /** * Execute general sql query. Should be used only when no other method suitable. - * Do NOT use this to make changes in db structure, use database_manager::execute_sql() instead! + * Do NOT use this to make changes in db structure, use database_manager methods instead! * @param string $sql query * @param array $params query parameters * @return bool true diff --git a/lib/editor/tinymce/lib.php b/lib/editor/tinymce/lib.php index 1e46afb6a59cd..77a2756d3beef 100644 --- a/lib/editor/tinymce/lib.php +++ b/lib/editor/tinymce/lib.php @@ -28,7 +28,7 @@ class tinymce_texteditor extends texteditor { /** @var string active version - directory name */ - public $version = '3.4.6'; + public $version = '3.4.9'; public function supported_by_browser() { if (check_browser_version('MSIE', 6)) { diff --git a/lib/editor/tinymce/readme_moodle.txt b/lib/editor/tinymce/readme_moodle.txt index 7d0f83f131f09..e2eb6d1b7ad36 100644 --- a/lib/editor/tinymce/readme_moodle.txt +++ b/lib/editor/tinymce/readme_moodle.txt @@ -1,4 +1,4 @@ -Description of TinyMCE v3.4.6 library integration in Moodle +Description of TinyMCE v3.4.9 library integration in Moodle ========================================================================================= Copyright: (c) 2004-2011, Moxiecode Systems AB, All rights reserved. @@ -11,7 +11,7 @@ Upgrade procedure (by maintainer): 1/ clone https://github.com/moodle/custom-tinymce 2/ clone https://github.com/moodle/custom-tinymce_spellchecker_php - 3/ merge new changes in latest STABLE branches into these two repos + 3/ cherry pick Moodle changes into new branches based on stable upstream 4/ tweak paths in build script in moodle_build.sh and execute 5/ fix line endings 6/ download all TinyMCE lang files (extra/tools/download_langs.sh) diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/jquery.tinymce.js b/lib/editor/tinymce/tiny_mce/3.4.6/jquery.tinymce.js deleted file mode 100644 index 8e61a3cddb895..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/jquery.tinymce.js +++ /dev/null @@ -1 +0,0 @@ -(function(b){var e,d,a=[],c=window;b.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}p.css("visibility","hidden");function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);s.onInit.add(function(){var x,y=v;p.css("visibility","");if(v){if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}}})});b.each(r,function(t,s){s.render()})}if(!c.tinymce&&!d&&(g=j.script_url)){d=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}c.tinyMCEPreInit=c.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!c.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");b.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}b.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;d=2;if(j.script_loaded){j.script_loaded()}o();b.each(a,function(q,r){r()})}})}else{if(d===1){a.push(o)}else{o()}}return p};b.extend(b.expr[":"],{tinymce:function(g){return g.id&&!!tinyMCE.get(g.id)}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==e){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(c.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(c.tinymce)&&(l.is(":tinymce")))}var j={};b.each(["text","html","val"],function(n,l){var o=j[l]=b.fn[l],m=(l==="text");b.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==e){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(b(v),q)});return r}}});b.each(["append","prepend"],function(n,m){var o=j[m]=b.fn[m],l=(m==="prepend");b.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==e){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});b.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=b.fn[l];b.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=b.fn.attr;b.fn.attr=function(n,q,o){var m=this;if((!n)||(n!=="value")||(!g(m))){return j.attr.call(m,n,q,o)}if(q!==e){k.call(m.filter(":tinymce"),q);j.attr.call(m.not(":tinymce"),n,q,o);return m}else{var p=m[0],l=h(p);return l?l.getContent():j.attr.call(b(p),n,q,o)}}}})(jQuery); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/autoresize/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/autoresize/editor_plugin.js deleted file mode 100644 index 6c4ff0d5dfc3a..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/autoresize/editor_plugin.js +++ /dev/null @@ -1 +0,0 @@ -(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var i=a.getDoc(),f=i.body,k=i.documentElement,h=tinymce.DOM,j=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:i.body.offsetHeight;if(g>d.autoresize_min_height){j=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){j=d.autoresize_max_height;a.getBody().style.overflowY="auto"}else{a.getBody().style.overflowY="hidden"}if(j!==e){h.setStyle(h.get(a.id+"_ifr"),"height",j+"px");e=j}if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight));d.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0));a.onInit.add(function(f){f.dom.setStyle(f.getBody(),"paddingBottom",f.getParam("autoresize_bottom_margin",50)+"px")});a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(g,f){g.setProgressState(true);d.throbbing=true;g.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(g,f){b();setTimeout(function(){b();g.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})(); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/contextmenu/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/contextmenu/editor_plugin.js deleted file mode 100644 index af7ae54453bf2..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/contextmenu/editor_plugin.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(e){var h=this,f,d,i;h.editor=e;d=e.settings.contextmenu_never_use_native;h.onContextMenu=new tinymce.util.Dispatcher(this);f=e.onContextMenu.add(function(j,k){if((i!==0?i:k.ctrlKey)&&!d){return}a.cancel(k);if(k.target.nodeName=="IMG"){j.selection.select(k.target)}h._getMenu(j).showMenu(k.clientX||k.pageX,k.clientY||k.pageY);a.add(j.getDoc(),"click",function(l){g(j,l)});j.nodeChanged()});e.onRemove.add(function(){if(h._menu){h._menu.removeAll()}});function g(j,k){i=0;if(k&&k.button==2){i=k.ctrlKey;return}if(h._menu){h._menu.removeAll();h._menu.destroy();a.remove(j.getDoc(),"click",g)}}e.onMouseDown.add(g);e.onKeyDown.add(g);e.onKeyDown.add(function(j,k){if(k.shiftKey&&!k.ctrlKey&&!k.altKey&&k.keyCode===121){a.cancel(k);f(j,k)}})},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(e){var g=this,d=g._menu,j=e.selection,f=j.isCollapsed(),h=j.getNode()||e.getBody(),i,k;if(d){d.removeAll();d.destroy()}k=b.getPos(e.getContentAreaContainer());d=e.controlManager.createDropMenu("contextmenu",{offset_x:k.x+e.getParam("contextmenu_offset_x",0),offset_y:k.y+e.getParam("contextmenu_offset_y",0),constrain:1,keyboard_focus:true});g._menu=d;d.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(f);d.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(f);d.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((h.nodeName=="A"&&!e.dom.getAttrib(h,"name"))||!f){d.addSeparator();d.add({title:"advanced.link_desc",icon:"link",cmd:e.plugins.advlink?"mceAdvLink":"mceLink",ui:true});d.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}d.addSeparator();d.add({title:"advanced.image_desc",icon:"image",cmd:e.plugins.advimage?"mceAdvImage":"mceImage",ui:true});d.addSeparator();i=d.addMenu({title:"contextmenu.align"});i.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});i.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});i.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});i.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});g.onContextMenu.dispatch(g,d,h,f);return d}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})(); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/emotions.htm b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/emotions.htm deleted file mode 100644 index 8bafd3128346b..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/emotions.htm +++ /dev/null @@ -1,41 +0,0 @@ - - - - {#emotions_dlg.title} - - - - - -
    -
    {#emotions_dlg.title}:

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    {#emotions_dlg.cool}{#emotions_dlg.cry}{#emotions_dlg.embarassed}{#emotions_dlg.foot_in_mouth}
    {#emotions_dlg.frown}{#emotions_dlg.innocent}{#emotions_dlg.kiss}{#emotions_dlg.laughing}
    {#emotions_dlg.money_mouth}{#emotions_dlg.sealed}{#emotions_dlg.smile}{#emotions_dlg.surprised}
    {#emotions_dlg.tongue-out}{#emotions_dlg.undecided}{#emotions_dlg.wink}{#emotions_dlg.yell}
    - - - diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/js/emotions.js b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/js/emotions.js deleted file mode 100644 index e5c950fc44f19..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/js/emotions.js +++ /dev/null @@ -1,22 +0,0 @@ -tinyMCEPopup.requireLangPack(); - -var EmotionsDialog = { - init : function(ed) { - tinyMCEPopup.resizeToInnerSize(); - }, - - insert : function(file, title) { - var ed = tinyMCEPopup.editor, dom = ed.dom; - - tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', { - src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file, - alt : ed.getLang(title), - title : ed.getLang(title), - border : 0 - })); - - tinyMCEPopup.close(); - } -}; - -tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog); diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/langs/en_dlg.js deleted file mode 100644 index 500cffbcfcaf8..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/emotions/langs/en_dlg.js +++ /dev/null @@ -1 +0,0 @@ -tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert Emotion",yell:"Yell",wink:"Wink",undecided:"Undecided","tongue_out":"Tongue Out",surprised:"Surprised",smile:"Smile",sealed:"Sealed","money_mouth":"Money Mouth",laughing:"Laughing",kiss:"Kiss",innocent:"Innocent",frown:"Frown","foot_in_mouth":"Foot in Mouth",embarassed:"Embarassed"}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/lists/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/lists/editor_plugin.js deleted file mode 100644 index 67308f097f380..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/lists/editor_plugin.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{if(v&&u.tagName==="P"&&t.tagName==="P"){return true}else{return false}}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(A,y){var w=0;var t=1;var H=2;var J=3;var z=J;function C(M){return M.keyCode===9&&(A.queryCommandState("InsertUnorderedList")||A.queryCommandState("InsertOrderedList"))}function x(){var M=B();var O=M.parentNode.parentNode;var N=M.parentNode.lastChild===M;return N&&!u(O)&&K(M)}function u(M){if(n(M)){return M.parentNode&&M.parentNode.tagName==="LI"}else{return M.tagName==="LI"}}function D(){return A.selection.isCollapsed()&&K(B())}function B(){var M=A.selection.getStart();return((M.tagName=="BR"||M.tagName=="")&&M.parentNode.tagName=="LI")?M.parentNode:M}function K(M){var N=M.childNodes.length;if(M.tagName==="LI"){return N==0?true:N==1&&(M.firstChild.tagName==""||F(M)||G(M))}return false}function F(M){return tinymce.isWebKit&&M.firstChild.nodeName=="BR"}function G(M){var N=tinymce.grep(M.parentNode.childNodes,function(Q){return Q.nodeName=="LI"});var O=M==N[N.length-1];var P=M.firstChild;return tinymce.isIE9&&O&&(P.nodeValue==String.fromCharCode(160)||P.nodeValue==String.fromCharCode(32))}function L(M){return M.keyCode===13}function I(M){if(C(M)){return w}else{if(L(M)&&x()){return H}else{if(L(M)&&D()){return t}else{return J}}}}function s(M,N){if(z==w||z==t){return r.cancel(N)}}function v(P,R){var U;if(!tinymce.isGecko){return}var N=P.selection.getStart();if(R.keyCode!=8||N.tagName!=="IMG"){return}function O(Y){var Z=Y.firstChild;var X=null;do{if(!Z){break}if(Z.tagName==="LI"){X=Z}}while(Z=Z.nextSibling);return X}function W(Y,X){while(Y.childNodes.length>0){X.appendChild(Y.childNodes[0])}}U=N.parentNode.previousSibling;if(!U){return}var S;if(U.tagName==="UL"||U.tagName==="OL"){S=U}else{if(U.previousSibling&&(U.previousSibling.tagName==="UL"||U.previousSibling.tagName==="OL")){S=U.previousSibling}else{return}}var V=O(S);var M=P.dom.createRng();M.setStart(V,1);M.setEnd(V,1);P.selection.setRng(M);P.selection.collapse(true);var Q=P.selection.getBookmark();var T=N.parentNode.cloneNode(true);if(T.tagName==="P"||T.tagName==="DIV"){W(T,V)}else{V.appendChild(T)}N.parentNode.parentNode.removeChild(N.parentNode);P.selection.moveToBookmark(Q)}function E(M){var N=A.dom.getParent(M,"ol,ul");if(N!=null){var O=N.lastChild;O.appendChild(A.getDoc().createElement(""));A.selection.setCursorLocation(O,0)}}this.ed=A;A.addCommand("Indent",this.indent,this);A.addCommand("Outdent",this.outdent,this);A.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);A.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);A.onInit.add(function(){A.editorCommands.addCommands({outdent:function(){var N=A.selection,O=A.dom;function M(P){P=O.getParent(P,O.isBlock);return P&&(parseInt(A.dom.getStyle(P,"margin-left")||0,10)+parseInt(A.dom.getStyle(P,"padding-left")||0,10))>0}return M(N.getStart())||M(N.getEnd())||A.queryCommandState("InsertOrderedList")||A.queryCommandState("InsertUnorderedList")}},"state")});A.onKeyUp.add(function(N,O){if(z==w){N.execCommand(O.shiftKey?"Outdent":"Indent",true,null);z=J;return r.cancel(O)}else{if(z==t){var M=B();var Q=N.settings.list_outdent_on_enter===true||O.shiftKey;N.execCommand(Q?"Outdent":"Indent",true,null);if(tinymce.isIE){E(M)}return r.cancel(O)}else{if(z==H){if(tinymce.isIE8){var P=N.getDoc().createTextNode("\uFEFF");N.selection.getNode().appendChild(P)}else{if(tinymce.isIE9){N.execCommand("Outdent");return r.cancel(O)}}}}}});A.onKeyDown.add(function(M,N){z=I(N)});A.onKeyDown.add(s);A.onKeyDown.add(v);A.onKeyPress.add(s)},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O,Q){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(M.tagName==="P"||G.length>1){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true);return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(Q,L,O){var t,P=Q,N,M;while(!I.isBlock(Q.parentNode)&&Q.parentNode!==I.getRoot()){Q=I.split(Q.parentNode,Q.previousSibling);Q=Q.nextSibling;P=Q}if(O){t=O.cloneNode(true);Q.parentNode.insertBefore(t,Q);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");Q.parentNode.insertBefore(t,Q)}while(P&&P!=L){N=P.nextSibling;t.appendChild(P);P=N}if(t.childNodes.length===0){t.innerHTML='
    '}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(V){var U;if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(P(N,V)){I.addClass(V,"_mce_tagged_br");N=S(V)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D}}else{B={defaultAction:x}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true)})},outdent:function(){var v=this,u=v.ed,w=u.dom,s=[];function x(t){var z,y,A;if(!d(u,t,s)){if(w.getStyle(t,"margin-left")!==""||w.getStyle(t,"padding-left")!==""){return v.adjustPaddingFunction(false)(t)}A=w.getStyle(t,"text-align",true);if(A==="center"||A==="right"){w.setStyle(t,"text-align","left");return}t=c(t,w);z=t.parentNode;y=t.parentNode.parentNode;if(y.tagName==="P"){w.split(y,t.parentNode)}else{w.split(z,t);if(y.tagName==="LI"){w.split(y,t)}else{if(!w.is(y,"ol,ul")){w.rename(t,"p")}}}s.push(t)}}this.process({LI:x,defaultAction:this.adjustPaddingFunction(false)});e(s,m)},process:function(y){var D=this,w=D.ed.selection,z=D.ed.dom,C,u;function x(s){z.removeClass(s,"_mce_act_on");if(!s||s.nodeType!==1){return}s=k(s,z);var t=y[s.tagName];if(!t){t=y.defaultAction}t(s)}function v(s){D.splitSafeEach(s.childNodes,x)}function B(s,t){return t>=0&&s.hasChildNodes()&&t0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}()); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/moxieplayer.swf b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/moxieplayer.swf deleted file mode 100644 index 2a040358df0d1..0000000000000 Binary files a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/moxieplayer.swf and /dev/null differ diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/wordcount/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.6/plugins/wordcount/editor_plugin.js deleted file mode 100644 index a752ad32aef09..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/wordcount/editor_plugin.js +++ /dev/null @@ -1 +0,0 @@ -(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(a,b){var c=this,d=0;c.countre=a.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);c.cleanre=a.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);c.id=a.id+"-word-count";a.onPostRender.add(function(f,e){var g,h;h=f.getParam("wordcount_target_id");if(!h){g=tinymce.DOM.get(f.id+"_path_row");if(g){tinymce.DOM.add(g.parentNode,"div",{style:"float: right"},f.getLang("wordcount.words","Words: ")+'0')}}else{tinymce.DOM.add(h,"span",{},'0')}});a.onInit.add(function(e){e.selection.onSetContent.add(function(){c._count(e)});c._count(e)});a.onSetContent.add(function(e){c._count(e)});a.onKeyUp.add(function(f,g){if(g.keyCode==d){return}if(13==g.keyCode||8==d||46==d){c._count(f)}d=g.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},2000)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})(); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/editor_template.js b/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/editor_template.js deleted file mode 100644 index 7f30c18e4117f..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/editor_template.js +++ /dev/null @@ -1 +0,0 @@ -(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);j.forcedHighContrastMode=j.settings.detect_highcontrast&&l._isHighContrast();j.settings.skin=j.forcedHighContrastMode?"highcontrast":j.settings.skin;l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}if(j.settings.content_css!==false){j.contentCSS.push(j.baseURI.toAbsolute(k+"/skins/"+j.settings.skin+"/content.css"))}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l);j.onKeyUp.add(l._updateUndoStatus,l);j.onMouseUp.add(l._updateUndoStatus,l);j.dom.bind(j.dom.getRoot(),"dragend",function(){l._updateUndoStatus(j)})}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},_isHighContrast:function(){var i,j=d.add(d.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});i=(d.getStyle(j,"background-color",true)+"").toLowerCase().replace(/ /g,"");d.remove(j);return i!="rgb(171,239,86)"&&i!="#abef56"},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",attributes:{"class":n["class"]},selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(o){var p,n=[];f(l.items,function(q){n.push(q.value)});i.focus();i.undoManager.add();p=i.formatter.matchAll(n);if(!o||p[0]==o){if(p[0]){i.formatter.remove(p[0])}}else{i.formatter.apply(o)}i.undoManager.add();i.nodeChanged();return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r,selector:"*"});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});if(m&&m.value==l){k.select(null)}return false}});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}if(i["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:i["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,i.fontSize)}n.select(function(p){return i==p});if(o&&(o.value.fontSize==i.fontSize||o.value["class"]==i["class"])){n.select(null)}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",onselect:function(l){j.editor.execCommand("FormatBlock",false,l);return false}});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;if(r.settings){r.settings.aria_label=w.aria_label+r.getLang("advanced.help_shortcut")}m=j=d.create("span",{role:"application","aria-labelledby":r.id+"_voice",id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});d.add(m,"span",{"class":"mceVoiceLabel",style:"display:none;",id:r.id+"_voice"},w.aria_label);if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{role:"presentation",id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},""),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;r.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){window.focus();v.toolbarGroup.focus();return b.cancel(n)}else{if(n.keyCode===o){d.get(p.id+"_path_row").focus();return b.cancel(n)}}}});r.addShortcut("alt+0","","mceShortcuts",v);return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_ifr");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,m,k){var j=this.editor,l=this.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr");i=Math.max(l.theme_advanced_resizing_min_width||100,i);m=Math.max(l.theme_advanced_resizing_min_height||100,m);i=Math.min(l.theme_advanced_resizing_max_width||65535,i);m=Math.min(l.theme_advanced_resizing_max_height||65535,m);d.setStyle(n,"height","");d.setStyle(o,"height",m);if(l.theme_advanced_resize_horizontal){d.setStyle(n,"width","");d.setStyle(o,"width",i);if(i"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row",role:"group","aria-labelledby":p.id+"_path_voice"});if(w.theme_advanced_path){d.add(k,"span",{id:p.id+"_path_voice"},p.translate("advanced.path"));d.add(k,"span",{},": ")}else{d.add(k,"span",{}," ")}if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize",tabIndex:"-1"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","click",function(n){n.preventDefault()});b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){G.preventDefault();n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E)}function B(G){b.remove(d.doc,"mousemove",t);b.remove(p.getDoc(),"mousemove",r);b.remove(d.doc,"mouseup",s);b.remove(p.getDoc(),"mouseup",o);n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E,true)}D.preventDefault();C=D.screenX;z=D.screenY;x=d.get(v.editor.id+"_ifr");A=n=x.clientWidth;F=E=x.clientHeight;t=b.add(d.doc,"mousemove",y);r=b.add(p.getDoc(),"mousemove",y);s=b.add(d.doc,"mouseup",B);o=b.add(p.getDoc(),"mouseup",B)})})}j.deltaHeight-=21;k=m=null},_updateUndoStatus:function(j){var i=j.controlManager,k=j.undoManager;i.setDisabled("undo",!k.hasUndo()&&!k.typing);i.setDisabled("redo",!k.hasRedo())},_nodeChanged:function(m,r,D,q,E){var y=this,C,F=0,x,G,z=y.settings,w,k,u,B,l,j,i;e.each(y.stateControls,function(n){r.setActive(n,m.queryCommandState(y.controls[n][1]))});function o(p){var s,n=E.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s0){y.statusKeyboardNavigation=new e.ui.KeyboardNavigation({root:m.id+"_path_row",items:d.select("a",C),excludeFromTabOrder:true,onCancel:function(){m.focus()}},d)}}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:this.url+"/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:this.url+"/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var i=this.editor;i.windowManager.open({url:this.url+"/shortcuts.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:this.url+"/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:this.url+"/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:this.url+"/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:this.url+"/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/langs/en_dlg.js deleted file mode 100644 index aae6a6b505d80..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/langs/en_dlg.js +++ /dev/null @@ -1 +0,0 @@ -tinyMCE.addI18n('en.advanced_dlg',{"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage"}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce.js b/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce.js deleted file mode 100644 index f6754fdd172bd..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce.js +++ /dev/null @@ -1 +0,0 @@ -(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={DELETE:46,BACKSPACE:8}})(tinymce);(function(i){var g=i.VK,h=g.BACKSPACE,f=g.DELETE;function b(j){var l=j.dom,k=j.selection;j.onKeyDown.add(function(n,r){var m,s,p,q,o;o=r.keyCode==f;if(o||r.keyCode==h){r.preventDefault();m=k.getRng();s=l.getParent(m.startContainer,l.isBlock);if(o){s=l.getNext(s,l.isBlock)}if(s){p=s.firstChild;while(p.nodeType==3&&p.nodeValue.length==0){p=p.nextSibling}if(p&&p.nodeName==="SPAN"){q=p.cloneNode(false)}}n.getDoc().execCommand(o?"ForwardDelete":"Delete",false,null);s=l.getParent(m.startContainer,l.isBlock);i.each(l.select("span.Apple-style-span,font.Apple-style-span",s),function(t){var u=k.getBookmark();if(q){l.replace(q.cloneNode(false),t,true)}else{l.remove(t,true)}k.moveToBookmark(u)})}})}function c(j){j.onKeyUp.add(function(k,m){var l=m.keyCode;if(l==f||l==h){if(k.dom.isEmpty(k.getBody())){k.setContent("",{format:"raw"});k.nodeChanged();return}}})}function a(j){j.dom.bind(j.getDoc(),"focusin",function(){j.selection.setRng(j.selection.getRng())})}function e(j){if(!Range.prototype.getClientRects){j.onMouseDown.add(function(l,m){if(m.target.nodeName==="HTML"){var k=l.getBody();k.blur();setTimeout(function(){k.focus()},0)}})}}function d(j){j.onClick.add(function(k,l){l=l.target;if(/^(IMG|HR)$/.test(l.nodeName)){k.selection.getSel().setBaseAndExtent(l,0,l,1)}if(l.nodeName=="A"&&k.dom.hasClass(l,"mceItemAnchor")){k.selection.select(l)}k.nodeChanged()})}i.create("tinymce.util.Quirks",{Quirks:function(j){if(i.isWebKit){b(j);c(j);a(j);d(j)}if(i.isIE){c(j)}if(i.isGecko){e(j)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";l=d(l,",",d(l.toUpperCase()));h=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,audio,object"),g);b=d("pre,script,style,textarea");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(r){var A=this,n={},o={},y=[],q,p;r=r||{};if(r.verify_html===false){r.valid_elements="*[*]"}if(r.valid_styles){q={};k(r.valid_styles,function(C,B){q[B]=m.explode(C)})}p=r.whitespace_elements?d(r.whitespace_elements):b;function z(B){return new RegExp("^"+B.replace(/([?+*])/g,".$1")+"$")}function t(I){var H,D,W,S,X,C,F,R,U,N,V,Z,L,G,T,B,P,E,Y,aa,M,Q,K=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,O=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,J=/[*?+]/;if(I){I=i(I);if(n["@"]){P=n["@"].attributes;E=n["@"].attributesOrder}for(H=0,D=I.length;H=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)\\s*((?:[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},select:function(l,k){var j=this;return h.dom.Sizzle(l,j.get(k)||j.get(j.settings.root_element)||j.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(a.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return h.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(o){var n=k.settings;switch(m){case"style":if(!e(j,"string")){f(j,function(p,q){k.setStyle(o,q,p)});return}if(n.keep_values){if(j&&!k._isRes(j)){o.setAttribute("data-mce-style",j,2)}else{o.removeAttribute("data-mce-style",2)}}o.style.cssText=j;break;case"class":o.className=j||"";break;case"src":case"href":if(n.keep_values){if(n.url_converter){j=n.url_converter.call(n.url_converter_scope||k,j,m,o)}k.setAttrib(o,"data-mce-"+m,j,2)}break;case"shape":o.setAttribute("data-mce-style",j);break}if(e(j)&&j!==null&&j.length!==0){o.setAttribute(m,""+j,2)}else{o.removeAttribute(m,2)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(o,p,l){var j,k=this,m;o=k.get(o);if(!o||o.nodeType!==1){return l===m?false:l}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(p)){j=o.getAttribute("data-mce-"+p);if(j){return j}}if(b&&k.props[p]){j=o[k.props[p]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=o.getAttribute(p,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(p)){if(o[k.props[p]]===true&&j===""){return p}return j?p:""}if(o.nodeName==="FORM"&&o.getAttributeNode(p)){return o.getAttributeNode(p).nodeValue}if(p==="style"){j=j||o.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),o.nodeName);if(k.settings.keep_values&&!k._isRes(j)){o.setAttribute("data-mce-style",j)}}}if(d&&p==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(p){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return p}return l;case"shape":j=j.toLowerCase();break;default:if(p.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==m&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
    "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
    "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p;m=m.firstChild;if(m){j=new h.dom.TreeWalker(m);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){p=m.parentNode;if(l==="br"&&r.isBlock(p)&&p.firstChild===m&&p.lastChild===m){continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if((q===3&&!i.test(m.nodeValue))){return false}}while(m=j.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(v){var t,r=v.childNodes,u=v.nodeType;if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){k(r[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){if(!s.isBlock(v.parentNode)||h.trim(v.nodeValue).length>0){return}}else{if(u==1){r=v.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(r[0],v)}if(r.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}s.remove(v)}return v}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1&&p==q-1){if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return re[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="

    ";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="
    ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='_';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('_'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
    ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.getRangeAt(0)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;break}if(l.nodeName==="BR"){o=m.nodeIndex(l);k=l.parentNode;break}}while(l=(p?n.next():n.prev()));i=true}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}e.remove_trailing_brs=true;i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var p=this,m=e.root,l=e.items,n=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,k=e.excludeFromTabOrder,j,h,o,d,g;f=f||b.DOM;j=function(q){g=q.target.id};h=function(q){f.setAttrib(q.target.id,"tabindex","-1")};d=function(q){var r=f.get(g);f.setAttrib(r,"tabindex","0");r.focus()};p.focus=function(){f.get(g).focus()};p.destroy=function(){c(l,function(q){f.unbind(f.get(q.id),"focus",j);f.unbind(f.get(q.id),"blur",h)});f.unbind(f.get(m),"focus",d);f.unbind(f.get(m),"keydown",o);l=f=m=p.focus=j=h=o=d=null;p.destroy=function(){}};p.moveFocus=function(u,r){var q=-1,t=p.controls,s;if(!g){return}c(l,function(x,v){if(x.id===g){q=v;return false}});q+=u;if(q<0){q=l.length-1}else{if(q>=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.select("#menu_"+g.id)[0];h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(i){i=i.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");g=c.add(g,"a",{role:"option",href:"javascript:;",style:{backgroundColor:"#"+i},title:p.editor.getLang("colors."+i,i),"data-mce-color":"#"+i});if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+i;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){return;var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:p.convertURL,url_converter_scope:p,ie7_compat:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.contentCSS=[];p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(m.isIDevice&&!m.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language&&v.language_load!==false){p.add(m.baseURL+"/../../extra/strings.php?elanguage="+v.language+"ðeme="+v.theme)}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(z){var y={prefix:"plugins/",resource:z,suffix:"/editor_plugin"+m.suffix+".js"};var z=c.createUrl(y,z);c.load(z.resource,z)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+m.suffix+".js"})}}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,H=this,I=H.settings,E,A,D=H.getElement(),q,p,F,y,C,G,z,v=[];m.add(H);I.aria_label=I.aria_label||n.getAttrib(D,"aria-label",H.getLang("aria.rich_text_area"));if(I.theme){I.theme=I.theme.replace(/-/,"");q=h.get(I.theme);H.theme=new q();if(H.theme.init&&I.init_theme){H.theme.init(H,h.urls[I.theme]||m.documentBaseURL.replace(/\/$/,""))}}function B(J){var K=c.get(J),t=c.urls[J]||m.documentBaseURL.replace(/\/$/,""),s;if(K&&m.inArray(v,J)===-1){i(c.dependencies(J),function(u){B(u)});s=new K(H,t);H.plugins[J]=s;if(s.init){s.init(H,t);v.push(J)}}}i(g(I.plugins.replace(/\-/g,"")),B);if(I.popup_css!==false){if(I.popup_css){I.popup_css=H.documentBaseURI.toAbsolute(I.popup_css)}else{I.popup_css=H.baseURI.toAbsolute("themes/"+I.theme+"/skins/"+I.skin+"/dialog.css")}}if(I.popup_css_add){I.popup_css+=","+H.documentBaseURI.toAbsolute(I.popup_css_add)}H.controlManager=new m.ControlManager(H);if(I.custom_undo_redo){H.onBeforeExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.beforeChange()}});H.onExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.add()}})}H.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){H.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){H.execCommand("mceRepaint")}}H.onUndo.add(x);H.onRedo.add(x);H.onSetContent.add(x)}H.onBeforeRenderUI.dispatch(H,H.controlManager);if(I.render_ui){E=I.width||D.style.width||D.offsetWidth;A=I.height||D.style.height||D.offsetHeight;H.orgDisplay=D.style.display;G=/^[0-9\.]+(|px)$/i;if(G.test(""+E)){E=Math.max(parseInt(E)+(q.deltaWidth||0),100)}if(G.test(""+A)){A=Math.max(parseInt(A)+(q.deltaHeight||0),I.theme_advanced_resizing_min_height||100)}q=H.theme.renderUI({targetNode:D,width:E,height:A,deltaWidth:I.delta_width,deltaHeight:I.delta_height});H.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:E,height:A});if(I.content_css){m.each(g(I.content_css),function(s){H.contentCSS.push(H.documentBaseURI.toAbsolute(s))})}A=(q.iframeHeight||A)+(typeof(A)=="number"?(q.deltaHeight||0):"");if(A<(I.theme_advanced_resizing_min_height||100)){A=I.theme_advanced_resizing_min_height||100}H.iframeHTML=I.doctype+'';if(I.document_base_url!=m.documentBaseURL){H.iframeHTML+=''}if(I.ie7_compat){H.iframeHTML+=''}else{H.iframeHTML+=''}H.iframeHTML+='';for(z=0;z'}y=I.body_id||"tinymce";if(y.indexOf("=")!=-1){y=H.getParam("body_id","","hash");y=y[H.id]||y}C=I.body_class||"";if(C.indexOf("=")!=-1){C=H.getParam("body_class","","hash");C=C[H.id]||""}H.iframeHTML+='
    ';if(m.relaxedDomain&&(b||(m.isOpera&&parseFloat(opera.version())<11))){F='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+H.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}r=n.add(q.iframeContainer,"iframe",{id:H.id+"_ifr",src:F||'javascript:""',frameBorder:"0",allowTransparency:"true",title:I.aria_label,style:{width:"100%",height:A,display:"block"}});H.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=H.orgDisplay;n.get(H.id).style.display="none";n.setAttrib(H.id,"aria-hidden",true);if(!m.relaxedDomain||!F){H.setupIframe()}D=r=q=null},setupIframe:function(){var q=this,v=q.settings,x=n.get(q.id),y=q.getDoc(),u,p;if(!b||!m.relaxedDomain){y.open();y.write(q.iframeHTML);y.close();if(m.relaxedDomain){y.domain=m.relaxedDomain}}p=q.getBody();p.disabled=true;if(!v.readonly){p.contentEditable=true}p.disabled=false;q.schema=new m.html.Schema(v);q.dom=new m.dom.DOMUtils(q.getDoc(),{keep_values:true,url_converter:q.convertURL,url_converter_scope:q,hex_colors:v.force_hex_style_colors,class_filter:v.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:q.schema});q.parser=new m.html.DomParser(v,q.schema);if(!q.settings.allow_html_in_named_anchor){q.parser.addAttributeFilter("name",function(s,t){var A=s.length,C,z,B,D;while(A--){D=s[A];if(D.name==="a"&&D.firstChild){B=D.parent;C=D.lastChild;do{z=C.prev;B.insert(C,D);C=z}while(C)}}})}q.parser.addAttributeFilter("src,href,style",function(s,t){var z=s.length,B,D=q.dom,C,A;while(z--){B=s[z];C=B.attr(t);A="data-mce-"+t;if(!B.attributes.map[A]){if(t==="style"){B.attr(A,D.serializeStyle(D.parseStyle(C),B.name))}else{B.attr(A,q.convertURL(C,t,B.name))}}}});q.parser.addNodeFilter("script",function(s,t){var z=s.length;while(z--){s[z].attr("type","mce-text/javascript")}});q.parser.addNodeFilter("#cdata",function(s,t){var z=s.length,A;while(z--){A=s[z];A.type=8;A.name="#comment";A.value="[CDATA["+A.value+"]]"}});q.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,z){var A=t.length,B,s=q.schema.getNonEmptyElements();while(A--){B=t[A];if(B.isEmpty(s)){B.empty().append(new m.html.Node("br",1)).shortEnded=true}}});q.serializer=new m.dom.Serializer(v,q.dom,q.schema);q.selection=new m.dom.Selection(q.dom,q.getWin(),q.serializer);q.formatter=new m.Formatter(this);q.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(z,s,t){i(t,function(B,A){q.dom.setAttrib(z,A,B)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){q.formatter.register(s,{block:s,remove:"all"})});q.formatter.register(q.settings.formats);q.undoManager=new m.UndoManager(q);q.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return q.onChange.dispatch(q,s,t)}});q.undoManager.onUndo.add(function(t,s){return q.onUndo.dispatch(q,s,t)});q.undoManager.onRedo.add(function(t,s){return q.onRedo.dispatch(q,s,t)});q.forceBlocks=new m.ForceBlocks(q,{forced_root_block:v.forced_root_block});q.editorCommands=new m.EditorCommands(q);q.serializer.onPreProcess.add(function(s,t){return q.onPreProcess.dispatch(q,t,s)});q.serializer.onPostProcess.add(function(s,t){return q.onPostProcess.dispatch(q,t,s)});q.onPreInit.dispatch(q);if(!v.gecko_spellcheck){q.getBody().spellcheck=0}if(!v.readonly){q._addEvents()}q.controlManager.onPostRender.dispatch(q,q.controlManager);q.onPostRender.dispatch(q);q.quirks=new m.util.Quirks(this);if(v.directionality){q.getBody().dir=v.directionality}if(v.nowrap){q.getBody().style.whiteSpace="nowrap"}if(v.handle_node_change_callback){q.onNodeChange.add(function(t,s,z){q.execCallback("handle_node_change_callback",q.id,z,-1,-1,true,q.selection.isCollapsed())})}if(v.save_callback){q.onSaveContent.add(function(s,z){var t=q.execCallback("save_callback",q.id,z.content,q.getBody());if(t){z.content=t}})}if(v.onchange_callback){q.onChange.add(function(t,s){q.execCallback("onchange_callback",q,s)})}if(v.protect){q.onBeforeSetContent.add(function(s,t){if(v.protect){i(v.protect,function(z){t.content=t.content.replace(z,function(A){return""})})}})}if(v.convert_newlines_to_brs){q.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
    ")}})}if(v.preformatted){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
    '+t.content+"
    "}})}if(v.verify_css_classes){q.serializer.attribValueFilter=function(B,z){var A,t;if(B=="class"){if(!q.classesRE){t=q.dom.getClasses();if(t.length>0){A="";i(t,function(s){A+=(A?"|":"")+s["class"]});q.classesRE=new RegExp("("+A+")","gi")}}return !q.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(z)||q.classesRE.test(z)?z:""}return z}}if(v.cleanup_callback){q.onBeforeSetContent.add(function(s,t){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)});q.onPreProcess.add(function(s,t){if(t.set){q.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){q.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});q.onPostProcess.add(function(s,t){if(t.set){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=q.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(v.save_callback){q.onGetContent.add(function(s,t){if(t.save){t.content=q.execCallback("save_callback",q.id,t.content,q.getBody())}})}if(v.handle_event_callback){q.onEvent.add(function(s,t,z){if(q.execCallback("handle_event_callback",t,s,z)===false){j.cancel(t)}})}q.onSetContent.add(function(){q.addVisual(q.getBody())});if(v.padd_empty_editor){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}if(a){function r(s,t){i(s.dom.select("a"),function(A){var z=A.parentNode;if(s.dom.isBlock(z)&&z.lastChild===A){s.dom.add(z,"br",{"data-mce-bogus":1})}})}q.onExecCommand.add(function(s,t){if(t==="CreateLink"){r(s)}});q.onSetContent.add(q.selection.onSetContent.add(r))}q.load({initial:true,format:"html"});q.startContent=q.getContent({format:"raw"});q.undoManager.add();q.initialized=true;q.onInit.dispatch(q);q.execCallback("setupcontent_callback",q.id,q.getBody(),q.getDoc());q.execCallback("init_instance_callback",q);q.focus(true);q.nodeChanged({initial:1});i(q.contentCSS,function(s){q.dom.loadCSS(s)});if(v.auto_focus){setTimeout(function(){var s=m.get(v.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}x=null},focus:function(u){var y,q=this,s=q.selection,x=q.settings.content_editable,r,p,v=q.getDoc();if(!u){r=s.getRng();if(r.item){p=r.item(0)}q._refreshContentEditable();s.normalize();if(!x){q.getWin().focus()}if(m.isGecko){q.getBody().focus()}if(p&&p.ownerDocument==v){r=v.body.createControlRange();r.addElement(p);r.select()}}if(m.activeEditor!=q){if((y=m.activeEditor)!=null){y.onDeactivate.dispatch(y,q)}q.onActivate.dispatch(q,y)}m._setActive(q)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=q.getStart()||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(p,r,q){this.execCommands[p]={func:r,scope:q||this}},addQueryStateHandler:function(p,r,q){this.queryStateCommands[p]={func:r,scope:q||this}},addQueryValueHandler:function(p,r,q){this.queryValueCommands[p]={func:r,scope:q||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=false;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(u,s){var r=this,q,p=r.getBody(),t;s=s||{};s.format=s.format||"html";s.set=true;s.content=u;if(!s.no_events){r.onBeforeSetContent.dispatch(r,s)}u=s.content;if(!m.isIE&&(u.length===0||/^\s+$/.test(u))){t=r.settings.forced_root_block;if(t){u="<"+t+'>
    "}else{u='
    '}p.innerHTML=u;r.selection.select(p,true);r.selection.collapse(true);return}if(s.format!=="raw"){u=new m.html.Serializer({},r.schema).serialize(r.parser.parse(u))}s.content=m.trim(u);r.dom.setHTML(p,s.content);if(!s.no_events){r.onSetContent.dispatch(r,s)}r.selection.normalize();return s.content},getContent:function(q){var p=this,r;q=q||{};q.format=q.format||"html";q.get=true;if(!q.no_events){p.onBeforeGetContent.dispatch(p,q)}if(q.format=="raw"){r=p.getBody().innerHTML}else{r=p.serializer.serialize(p.getBody(),q)}q.content=m.trim(r);if(!q.no_events){p.onGetContent.dispatch(p,q)}return q.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var B=this,r,C=B.settings,q=B.dom,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function p(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[x[t.fakeType||t.type]].dispatch(B,t,D)}}i(x,function(t,s){switch(s){case"contextmenu":q.bind(B.getDoc(),s,p);break;case"paste":q.bind(B.getBody(),s,function(D){p(D)});break;case"submit":case"reset":q.bind(B.getElement().form||n.getParent(B.id,"form"),s,p);break;default:q.bind(C.content_editable?B.getBody():B.getDoc(),s,p)}});q.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(m.isGecko){q.bind(B.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=B.documentBaseURI.toAbsolute(s)}})}if(a){function u(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){E._refreshContentEditable();try{G.execCommand("styleWithCSS",0,false)}catch(D){if(!E._isHidden()){try{G.execCommand("useCSS",0,true)}catch(D){}}}if(!F.table_inline_editing){try{G.execCommand("enableInlineTableEditing",false,false)}catch(D){}}if(!F.object_resizing){try{G.execCommand("enableObjectResizing",false,false)}catch(D){}}}}B.onBeforeExecCommand.add(u);B.onMouseDown.add(u)}B.onMouseUp.add(B.nodeChanged);B.onKeyUp.add(function(s,t){var D=t.keyCode;if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45||D==46||D==8||(m.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});B.onKeyDown.add(function(t,D){if(D.keyCode!=8){return}var F=t.selection.getRng().startContainer;var E=t.selection.getRng().startOffset;while(F&&F.nodeType&&F.nodeType!=1&&F.parentNode){F=F.parentNode}if(F&&F.parentNode&&F.parentNode.tagName==="BLOCKQUOTE"&&F.parentNode.firstChild==F&&E==0){t.formatter.toggle("blockquote",null,F.parentNode);var s=t.selection.getRng();s.setStart(F,0);s.setEnd(F,0);t.selection.setRng(s);t.selection.collapse(false)}});B.onReset.add(function(){B.setContent(B.startContent,{format:"raw"})});if(C.custom_shortcuts){if(C.custom_undo_redo_keyboard_shortcuts){B.addShortcut("ctrl+z",B.getLang("undo_desc"),"Undo");B.addShortcut("ctrl+y",B.getLang("redo_desc"),"Redo")}B.addShortcut("ctrl+b",B.getLang("bold_desc"),"Bold");B.addShortcut("ctrl+i",B.getLang("italic_desc"),"Italic");B.addShortcut("ctrl+u",B.getLang("underline_desc"),"Underline");for(r=1;r<=6;r++){B.addShortcut("ctrl+"+r,"",["FormatBlock",false,"h"+r])}B.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);B.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);B.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function v(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(m.isMac&&D.ctrl!=t.metaKey){return}else{if(!m.isMac&&D.ctrl!=t.ctrlKey){return}}if(D.alt!=t.altKey){return}if(D.shift!=t.shiftKey){return}if(t.keyCode==D.keyCode||(t.charCode&&t.charCode==D.charCode)){s=D;return false}});return s}B.onKeyUp.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyPress.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyDown.add(function(s,t){var D=v(t);if(D){D.func.call(D.scope);return j.cancel(t)}})}if(m.isIE){q.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){q.unbind(t.node,t.ev,t.cb)}if(!q.hasClass(D,"mceItemNoResize")){ev="resizeend";s=q.bind(D,ev,function(F){var E;F=F.target;if(E=q.getStyle(F,"width")){q.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"width","")}if(E=q.getStyle(F,"height")){q.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"height","")}})}else{ev="resizestart";s=q.bind(D,"resizestart",j.cancel,j)}t=B.resizeInfo={node:D,ev:ev,cb:s}})}if(m.isOpera){B.onClick.add(function(s,t){j.prevent(t)})}if(C.custom_undo_redo){function y(){B.undoManager.typing=false;B.undoManager.add()}q.bind(B.getDoc(),"focusout",function(s){if(!B.removed&&B.undoManager.typing){y()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){y()});B.onKeyUp.add(function(s,D){var t=D.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||D.ctrlKey){y()}});B.onKeyDown.add(function(s,E){var D=E.keyCode,t;if(D==8){t=B.getDoc().selection;if(t&&t.createRange&&t.createRange().item){B.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));y();return j.cancel(E)}}if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45){if(m.isIE&&D==13){B.undoManager.beforeChange()}if(B.undoManager.typing){y()}return}if((D<16||D>20)&&D!=224&&D!=91&&!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.typing=true;B.undoManager.add()}});B.onMouseDown.add(function(){if(B.undoManager.typing){y()}})}if(m.isWebKit){q.bind(B.getDoc(),"selectionchange",function(){if(B.selectionTimer){clearTimeout(B.selectionTimer);B.selectionTimer=0}B.selectionTimer=window.setTimeout(function(){B.nodeChanged()},50)})}if(m.isGecko){function A(){var s=B.dom.getAttribs(B.selection.getStart().cloneNode(false));return function(){var t=B.selection.getStart();if(t!==B.getBody()){B.dom.removeAllAttribs(t);i(s,function(D){t.setAttributeNode(D.cloneNode(true))})}}}function z(){var t=B.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}B.onKeyPress.add(function(s,D){var t;if((D.keyCode==8||D.keyCode==46)&&z()){t=A();B.getDoc().execCommand("delete",false,null);t();return j.cancel(D)}});B.dom.bind(B.getDoc(),"cut",function(t){var s;if(z()){s=A();B.onKeyUp.addToTop(j.cancel,j);setTimeout(function(){s();B.onKeyUp.remove(j.cancel,j)},0)}})}},_refreshContentEditable:function(){var q=this,p,r;if(q._isHidden()){p=q.getBody();r=p.parentNode;r.removeChild(p);r.appendChild(p);p.focus()}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){return t("align"+v.substring(7))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e0||this.typing},hasRedo:function(){return e');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
    ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"
    ");T=v.dom.add(O,V.element,null,"
    ")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"
    ")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}if(!R.body.hasChildNodes()){R.body.appendChild(M.create("br"))}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
    ";return r[0]}else{y.innerHTML=b?"\u00a0":"
    "}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(BL.y+L.h){v.getWin().scrollTo(0,B1||ac==au){return ac}}}var am=V.selection.getRng();var aq=am.startContainer;var al=am.endContainer;if(aq!=al&&am.endOffset==0){var ap=an(aq,al);var ao=ap.nodeType==3?ap.length:ap.childNodes.length;am.setEnd(ap,ao)}return am}function Y(ao,au,ar,aq,am){var al=[],an=-1,at,aw=-1,ap=-1,av;O(ao.childNodes,function(ay,ax){if(ay.nodeName==="UL"||ay.nodeName==="OL"){an=ax;at=ay;return false}});O(ao.childNodes,function(ay,ax){if(ay.nodeName==="SPAN"&&c.getAttrib(ay,"data-mce-type")=="bookmark"){if(ay.id==au.id+"_start"){aw=ax}else{if(ay.id==au.id+"_end"){ap=ax}}}});if(an<=0||(awan)){O(a.grep(ao.childNodes),am);return 0}else{av=ar.cloneNode(S);O(a.grep(ao.childNodes),function(ay,ax){if((awan&&ax>an)){al.push(ay);ay.parentNode.removeChild(ay)}});if(awan){ao.insertBefore(av,at.nextSibling)}}aq.push(av);O(al,function(ax){av.appendChild(ax)});return av}}function aj(am,ao){var al=[],ap,an;ap=ai.inline||ai.block;an=c.create(ap);W(an);K.walk(am,function(aq){var ar;function at(au){var ax=au.nodeName.toLowerCase(),aw=au.parentNode.nodeName.toLowerCase(),av;if(g(ax,"br")){ar=0;if(ai.block){c.remove(au)}return}if(ai.wrapper&&x(au,Z,ah)){ar=0;return}if(ai.block&&!ai.wrapper&&G(ax)){au=c.rename(au,ap);W(au);al.push(au);ar=0;return}if(ai.selector){O(ad,function(ay){if("collapsed" in ay&&ay.collapsed!==ae){return}if(c.is(au,ay.selector)&&!b(au)){W(au,ay);av=true}});if(!ai.inline||av){ar=0;return}}if(d(ap,ax)&&d(aw,ap)&&!(au.nodeType===3&&au.nodeValue.length===1&&au.nodeValue.charCodeAt(0)===65279)){if(!ar){ar=an.cloneNode(S);au.parentNode.insertBefore(ar,au);al.push(ar)}ar.appendChild(au)}else{if(ax=="li"&&ao){ar=Y(au,ao,an,al,at)}else{ar=0;O(a.grep(au.childNodes),at);ar=0}}}O(aq,at)});if(ai.wrap_links===false){O(al,function(aq){function ar(aw){var av,au,at;if(aw.nodeName==="A"){au=an.cloneNode(S);al.push(au);at=a.grep(aw.childNodes);for(av=0;av1||!F(at))&&aq===0){c.remove(at,1);return}if(ai.inline||ai.wrapper){if(!ai.exact&&aq===1){at=ar(at)}O(ad,function(av){O(c.select(av.inline,at),function(ax){var aw;if(av.wrap_links===false){aw=ax.parentNode;do{if(aw.nodeName==="A"){return}}while(aw=aw.parentNode)}U(av,ah,ax,av.exact?ax:null)})});if(x(at.parentNode,Z,ah)){c.remove(at,1);at=0;return B}if(ai.merge_with_parents){c.getParent(at.parentNode,function(av){if(x(av,Z,ah)){c.remove(at,1);at=0;return B}})}if(at&&ai.merge_siblings!==false){at=u(C(at),at);at=u(at,C(at,B))}}})}if(ai){if(ac){X=c.createRng();X.setStartBefore(ac);X.setEndAfter(ac);aj(o(X,ad))}else{if(!ae||!ai.inline||c.select("td.mceSelected,th.mceSelected").length){var ak=V.selection.getNode();V.selection.setRng(ab());ag=q.getBookmark();aj(o(q.getRng(B),ad),ag);if(ai.styles&&(ai.styles.color||ai.styles.textDecoration)){a.walk(ak,I,"childNodes");I(ak)}q.moveToBookmark(ag);q.setRng(aa(q.getRng(B)));V.nodeChanged()}else{Q("apply",Z,ah)}}}}function A(Y,ah,ab){var ac=R(Y),aj=ac[0],ag,af,X;function aa(am){var al=am.startContainer,ar=am.startOffset,aq,ap,an,ao;if(al.nodeType==3&&ar>=al.nodeValue.length-1){al=al.parentNode;ar=s(al)+1}if(al.nodeType==1){an=al.childNodes;al=an[Math.min(ar,an.length-1)];aq=new t(al);if(ar>an.length-1){aq.next()}for(ap=aq.current();ap;ap=aq.next()){if(ap.nodeType==3&&!f(ap)){ao=c.create("a",null,E);ap.parentNode.insertBefore(ao,ap);am.setStart(ap,0);q.setRng(am);c.remove(ao);return}}}}function Z(ao){var an,am,al;an=a.grep(ao.childNodes);for(am=0,al=ac.length;am=0;Z--){if(P.apply[Z].name==Y){return true}}for(Z=P.remove.length-1;Z>=0;Z--){if(P.remove[Z].name==Y){return false}}return W(q.getNode())}aa=q.getNode();if(W(aa)){return B}X=q.getStart();if(X!=aa){if(W(X)){return B}}return S}function v(ad,ac){var aa,ab=[],Z={},Y,X,W;if(q.isCollapsed()){for(X=0;X=0;Y--){W=ad[X];if(P.remove[Y].name==W){Z[W]=true;break}}}for(Y=P.apply.length-1;Y>=0;Y--){for(X=0;X=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\s\r\n]+|)$/.test(W.nodeValue)}function N(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ag,Z){var Y=W.startContainer,ad=W.startOffset,aj=W.endContainer,ae=W.endOffset,ai,af,ac;function ah(am,an,ak,al){var ao,ap;al=al||c.getRoot();for(;;){ao=am.parentNode;if(ao==al||(!ag[0].block_expand&&F(ao))){return am}for(ai=ao[an];ai&&ai!=am;ai=ai[ak]){if(ai.nodeType==1&&!H(ai)){return am}if(ai.nodeType==3&&!f(ai)){return am}}am=am.parentNode}return am}function ab(ak,al){if(al===p){al=ak.nodeType===3?ak.length:ak.childNodes.length}while(ak&&ak.hasChildNodes()){ak=ak.childNodes[al];if(ak){al=ak.nodeType===3?ak.length:ak.childNodes.length}}return{node:ak,offset:al}}if(Y.nodeType==1&&Y.hasChildNodes()){af=Y.childNodes.length-1;Y=Y.childNodes[ad>af?af:ad];if(Y.nodeType==3){ad=0}}if(aj.nodeType==1&&aj.hasChildNodes()){af=aj.childNodes.length-1;aj=aj.childNodes[ae>af?af:ae-1];if(aj.nodeType==3){ae=aj.nodeValue.length}}if(H(Y.parentNode)){Y=Y.parentNode}if(H(Y)){Y=Y.nextSibling||Y}if(H(aj.parentNode)){ae=c.nodeIndex(aj);aj=aj.parentNode}if(H(aj)&&aj.previousSibling){aj=aj.previousSibling;ae=aj.length}if(ag[0].inline){ac=ab(aj,ae);if(ac.node){while(ac.node&&ac.offset===0&&ac.node.previousSibling){ac=ab(ac.node.previousSibling)}if(ac.node&&ac.offset>0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){aj=ac.node;aj.splitText(ac.offset-1)}else{if(ac.node.previousSibling){aj=ac.node.previousSibling}}}}}if(ag[0].inline||ag[0].block_expand){Y=ah(Y,"firstChild","nextSibling");aj=ah(aj,"lastChild","previousSibling")}if(ag[0].selector&&ag[0].expand!==S&&!ag[0].inline){function aa(al,ak){var am,an,ap,ao;if(al.nodeType==3&&al.nodeValue.length==0&&al[ak]){al=al[ak]}am=m(al);for(an=0;anY?Y:Z]}return W}function Q(ad,Y,ac){var aa,X=P[ad],ae=P[ad=="apply"?"remove":"apply"];function af(){return P.apply.length||P.remove.length}function ab(){P.apply=[];P.remove=[]}function ag(ah){O(P.apply.reverse(),function(ai){T(ai.name,ai.vars,ah);if(ai.name==="forecolor"&&ai.vars.value){I(ah.parentNode)}});O(P.remove.reverse(),function(ai){A(ai.name,ai.vars,ah)});c.remove(ah,1);ab()}for(aa=X.length-1;aa>=0;aa--){if(X[aa].name==Y){return}}X.push({name:Y,vars:ac});for(aa=ae.length-1;aa>=0;aa--){if(ae[aa].name==Y){ae.splice(aa,1)}}if(af()){V.getDoc().execCommand("FontName",false,"mceinline");P.lastRng=q.getRng();O(c.select("font,span"),function(ai){var ah;if(b(ai)){ah=q.getBookmark();ag(ai);q.moveToBookmark(ah);V.nodeChanged()}});if(!P.isListening&&af()){P.isListening=true;function W(ai,aj){var ah=c.createRng();ag(ai);ah.setStart(aj,aj.nodeValue.length);ah.setEnd(aj,aj.nodeValue.length);q.setRng(ah);V.nodeChanged()}var Z=false;O("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(ah){V[ah].addToTop(function(ai,al){if(al.keyCode==13&&!al.shiftKey){Z=true;return}if(af()&&!a.dom.RangeUtils.compareRanges(P.lastRng,q.getRng())){var aj=false;O(c.select("font,span"),function(ao){var ap,an;if(b(ao)){aj=true;ap=ao.firstChild;while(ap&&ap.nodeType!=3){ap=ap.firstChild}if(ap){W(ao,ap)}else{c.remove(ao)}}});if(Z&&!aj){var ak=q.getNode();var am=ak;while(am&&am.nodeType!=3){am=am.firstChild}if(am){ak=am.parentNode;while(!F(ak)){ak=ak.parentNode}W(ak,am)}}if(al.type=="keyup"||al.type=="mouseup"){ab();Z=false}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_jquery.js b/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_jquery.js deleted file mode 100644 index adff8d580bce9..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_jquery.js +++ /dev/null @@ -1 +0,0 @@ -(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={DELETE:46,BACKSPACE:8}})(tinymce);(function(i){var g=i.VK,h=g.BACKSPACE,f=g.DELETE;function b(j){var l=j.dom,k=j.selection;j.onKeyDown.add(function(n,r){var m,s,p,q,o;o=r.keyCode==f;if(o||r.keyCode==h){r.preventDefault();m=k.getRng();s=l.getParent(m.startContainer,l.isBlock);if(o){s=l.getNext(s,l.isBlock)}if(s){p=s.firstChild;while(p.nodeType==3&&p.nodeValue.length==0){p=p.nextSibling}if(p&&p.nodeName==="SPAN"){q=p.cloneNode(false)}}n.getDoc().execCommand(o?"ForwardDelete":"Delete",false,null);s=l.getParent(m.startContainer,l.isBlock);i.each(l.select("span.Apple-style-span,font.Apple-style-span",s),function(t){var u=k.getBookmark();if(q){l.replace(q.cloneNode(false),t,true)}else{l.remove(t,true)}k.moveToBookmark(u)})}})}function c(j){j.onKeyUp.add(function(k,m){var l=m.keyCode;if(l==f||l==h){if(k.dom.isEmpty(k.getBody())){k.setContent("",{format:"raw"});k.nodeChanged();return}}})}function a(j){j.dom.bind(j.getDoc(),"focusin",function(){j.selection.setRng(j.selection.getRng())})}function e(j){if(!Range.prototype.getClientRects){j.onMouseDown.add(function(l,m){if(m.target.nodeName==="HTML"){var k=l.getBody();k.blur();setTimeout(function(){k.focus()},0)}})}}function d(j){j.onClick.add(function(k,l){l=l.target;if(/^(IMG|HR)$/.test(l.nodeName)){k.selection.getSel().setBaseAndExtent(l,0,l,1)}if(l.nodeName=="A"&&k.dom.hasClass(l,"mceItemAnchor")){k.selection.select(l)}k.nodeChanged()})}i.create("tinymce.util.Quirks",{Quirks:function(j){if(i.isWebKit){b(j);c(j);a(j);d(j)}if(i.isIE){c(j)}if(i.isGecko){e(j)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";l=d(l,",",d(l.toUpperCase()));h=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,audio,object"),g);b=d("pre,script,style,textarea");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(r){var A=this,n={},o={},y=[],q,p;r=r||{};if(r.verify_html===false){r.valid_elements="*[*]"}if(r.valid_styles){q={};k(r.valid_styles,function(C,B){q[B]=m.explode(C)})}p=r.whitespace_elements?d(r.whitespace_elements):b;function z(B){return new RegExp("^"+B.replace(/([?+*])/g,".$1")+"$")}function t(I){var H,D,W,S,X,C,F,R,U,N,V,Z,L,G,T,B,P,E,Y,aa,M,Q,K=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,O=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,J=/[*?+]/;if(I){I=i(I);if(n["@"]){P=n["@"].attributes;E=n["@"].attributesOrder}for(H=0,D=I.length;H=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)\\s*((?:[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(o){var n=k.settings;switch(m){case"style":if(!e(j,"string")){f(j,function(p,q){k.setStyle(o,q,p)});return}if(n.keep_values){if(j&&!k._isRes(j)){o.setAttribute("data-mce-style",j,2)}else{o.removeAttribute("data-mce-style",2)}}o.style.cssText=j;break;case"class":o.className=j||"";break;case"src":case"href":if(n.keep_values){if(n.url_converter){j=n.url_converter.call(n.url_converter_scope||k,j,m,o)}k.setAttrib(o,"data-mce-"+m,j,2)}break;case"shape":o.setAttribute("data-mce-style",j);break}if(e(j)&&j!==null&&j.length!==0){o.setAttribute(m,""+j,2)}else{o.removeAttribute(m,2)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(o,p,l){var j,k=this,m;o=k.get(o);if(!o||o.nodeType!==1){return l===m?false:l}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(p)){j=o.getAttribute("data-mce-"+p);if(j){return j}}if(b&&k.props[p]){j=o[k.props[p]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=o.getAttribute(p,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(p)){if(o[k.props[p]]===true&&j===""){return p}return j?p:""}if(o.nodeName==="FORM"&&o.getAttributeNode(p)){return o.getAttributeNode(p).nodeValue}if(p==="style"){j=j||o.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),o.nodeName);if(k.settings.keep_values&&!k._isRes(j)){o.setAttribute("data-mce-style",j)}}}if(d&&p==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(p){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return p}return l;case"shape":j=j.toLowerCase();break;default:if(p.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==m&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
    "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
    "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p;m=m.firstChild;if(m){j=new h.dom.TreeWalker(m);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){p=m.parentNode;if(l==="br"&&r.isBlock(p)&&p.firstChild===m&&p.lastChild===m){continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if((q===3&&!i.test(m.nodeValue))){return false}}while(m=j.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(v){var t,r=v.childNodes,u=v.nodeType;if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){k(r[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){if(!s.isBlock(v.parentNode)||h.trim(v.nodeValue).length>0){return}}else{if(u==1){r=v.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(r[0],v)}if(r.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}s.remove(v)}return v}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1&&p==q-1){if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='_';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('_'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
    ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.getRangeAt(0)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;break}if(l.nodeName==="BR"){o=m.nodeIndex(l);k=l.parentNode;break}}while(l=(p?n.next():n.prev()));i=true}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}e.remove_trailing_brs=true;i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var p=this,m=e.root,l=e.items,n=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,k=e.excludeFromTabOrder,j,h,o,d,g;f=f||b.DOM;j=function(q){g=q.target.id};h=function(q){f.setAttrib(q.target.id,"tabindex","-1")};d=function(q){var r=f.get(g);f.setAttrib(r,"tabindex","0");r.focus()};p.focus=function(){f.get(g).focus()};p.destroy=function(){c(l,function(q){f.unbind(f.get(q.id),"focus",j);f.unbind(f.get(q.id),"blur",h)});f.unbind(f.get(m),"focus",d);f.unbind(f.get(m),"keydown",o);l=f=m=p.focus=j=h=o=d=null;p.destroy=function(){}};p.moveFocus=function(u,r){var q=-1,t=p.controls,s;if(!g){return}c(l,function(x,v){if(x.id===g){q=v;return false}});q+=u;if(q<0){q=l.length-1}else{if(q>=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.select("#menu_"+g.id)[0];h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(i){i=i.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");g=c.add(g,"a",{role:"option",href:"javascript:;",style:{backgroundColor:"#"+i},title:p.editor.getLang("colors."+i,i),"data-mce-color":"#"+i});if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+i;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){return;var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);if(j.adapter){j.adapter.patchEditor(m)}return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:p.convertURL,url_converter_scope:p,ie7_compat:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.contentCSS=[];p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(m.isIDevice&&!m.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language&&v.language_load!==false){p.add(m.baseURL+"/../../extra/strings.php?elanguage="+v.language+"ðeme="+v.theme)}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(z){var y={prefix:"plugins/",resource:z,suffix:"/editor_plugin"+m.suffix+".js"};var z=c.createUrl(y,z);c.load(z.resource,z)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+m.suffix+".js"})}}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,H=this,I=H.settings,E,A,D=H.getElement(),q,p,F,y,C,G,z,v=[];m.add(H);I.aria_label=I.aria_label||n.getAttrib(D,"aria-label",H.getLang("aria.rich_text_area"));if(I.theme){I.theme=I.theme.replace(/-/,"");q=h.get(I.theme);H.theme=new q();if(H.theme.init&&I.init_theme){H.theme.init(H,h.urls[I.theme]||m.documentBaseURL.replace(/\/$/,""))}}function B(J){var K=c.get(J),t=c.urls[J]||m.documentBaseURL.replace(/\/$/,""),s;if(K&&m.inArray(v,J)===-1){i(c.dependencies(J),function(u){B(u)});s=new K(H,t);H.plugins[J]=s;if(s.init){s.init(H,t);v.push(J)}}}i(g(I.plugins.replace(/\-/g,"")),B);if(I.popup_css!==false){if(I.popup_css){I.popup_css=H.documentBaseURI.toAbsolute(I.popup_css)}else{I.popup_css=H.baseURI.toAbsolute("themes/"+I.theme+"/skins/"+I.skin+"/dialog.css")}}if(I.popup_css_add){I.popup_css+=","+H.documentBaseURI.toAbsolute(I.popup_css_add)}H.controlManager=new m.ControlManager(H);if(I.custom_undo_redo){H.onBeforeExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.beforeChange()}});H.onExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.add()}})}H.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){H.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){H.execCommand("mceRepaint")}}H.onUndo.add(x);H.onRedo.add(x);H.onSetContent.add(x)}H.onBeforeRenderUI.dispatch(H,H.controlManager);if(I.render_ui){E=I.width||D.style.width||D.offsetWidth;A=I.height||D.style.height||D.offsetHeight;H.orgDisplay=D.style.display;G=/^[0-9\.]+(|px)$/i;if(G.test(""+E)){E=Math.max(parseInt(E)+(q.deltaWidth||0),100)}if(G.test(""+A)){A=Math.max(parseInt(A)+(q.deltaHeight||0),I.theme_advanced_resizing_min_height||100)}q=H.theme.renderUI({targetNode:D,width:E,height:A,deltaWidth:I.delta_width,deltaHeight:I.delta_height});H.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:E,height:A});if(I.content_css){m.each(g(I.content_css),function(s){H.contentCSS.push(H.documentBaseURI.toAbsolute(s))})}A=(q.iframeHeight||A)+(typeof(A)=="number"?(q.deltaHeight||0):"");if(A<(I.theme_advanced_resizing_min_height||100)){A=I.theme_advanced_resizing_min_height||100}H.iframeHTML=I.doctype+'';if(I.document_base_url!=m.documentBaseURL){H.iframeHTML+=''}if(I.ie7_compat){H.iframeHTML+=''}else{H.iframeHTML+=''}H.iframeHTML+='';for(z=0;z'}y=I.body_id||"tinymce";if(y.indexOf("=")!=-1){y=H.getParam("body_id","","hash");y=y[H.id]||y}C=I.body_class||"";if(C.indexOf("=")!=-1){C=H.getParam("body_class","","hash");C=C[H.id]||""}H.iframeHTML+='
    ';if(m.relaxedDomain&&(b||(m.isOpera&&parseFloat(opera.version())<11))){F='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+H.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}r=n.add(q.iframeContainer,"iframe",{id:H.id+"_ifr",src:F||'javascript:""',frameBorder:"0",allowTransparency:"true",title:I.aria_label,style:{width:"100%",height:A,display:"block"}});H.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=H.orgDisplay;n.get(H.id).style.display="none";n.setAttrib(H.id,"aria-hidden",true);if(!m.relaxedDomain||!F){H.setupIframe()}D=r=q=null},setupIframe:function(){var q=this,v=q.settings,x=n.get(q.id),y=q.getDoc(),u,p;if(!b||!m.relaxedDomain){y.open();y.write(q.iframeHTML);y.close();if(m.relaxedDomain){y.domain=m.relaxedDomain}}p=q.getBody();p.disabled=true;if(!v.readonly){p.contentEditable=true}p.disabled=false;q.schema=new m.html.Schema(v);q.dom=new m.dom.DOMUtils(q.getDoc(),{keep_values:true,url_converter:q.convertURL,url_converter_scope:q,hex_colors:v.force_hex_style_colors,class_filter:v.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:q.schema});q.parser=new m.html.DomParser(v,q.schema);if(!q.settings.allow_html_in_named_anchor){q.parser.addAttributeFilter("name",function(s,t){var A=s.length,C,z,B,D;while(A--){D=s[A];if(D.name==="a"&&D.firstChild){B=D.parent;C=D.lastChild;do{z=C.prev;B.insert(C,D);C=z}while(C)}}})}q.parser.addAttributeFilter("src,href,style",function(s,t){var z=s.length,B,D=q.dom,C,A;while(z--){B=s[z];C=B.attr(t);A="data-mce-"+t;if(!B.attributes.map[A]){if(t==="style"){B.attr(A,D.serializeStyle(D.parseStyle(C),B.name))}else{B.attr(A,q.convertURL(C,t,B.name))}}}});q.parser.addNodeFilter("script",function(s,t){var z=s.length;while(z--){s[z].attr("type","mce-text/javascript")}});q.parser.addNodeFilter("#cdata",function(s,t){var z=s.length,A;while(z--){A=s[z];A.type=8;A.name="#comment";A.value="[CDATA["+A.value+"]]"}});q.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,z){var A=t.length,B,s=q.schema.getNonEmptyElements();while(A--){B=t[A];if(B.isEmpty(s)){B.empty().append(new m.html.Node("br",1)).shortEnded=true}}});q.serializer=new m.dom.Serializer(v,q.dom,q.schema);q.selection=new m.dom.Selection(q.dom,q.getWin(),q.serializer);q.formatter=new m.Formatter(this);q.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(z,s,t){i(t,function(B,A){q.dom.setAttrib(z,A,B)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){q.formatter.register(s,{block:s,remove:"all"})});q.formatter.register(q.settings.formats);q.undoManager=new m.UndoManager(q);q.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return q.onChange.dispatch(q,s,t)}});q.undoManager.onUndo.add(function(t,s){return q.onUndo.dispatch(q,s,t)});q.undoManager.onRedo.add(function(t,s){return q.onRedo.dispatch(q,s,t)});q.forceBlocks=new m.ForceBlocks(q,{forced_root_block:v.forced_root_block});q.editorCommands=new m.EditorCommands(q);q.serializer.onPreProcess.add(function(s,t){return q.onPreProcess.dispatch(q,t,s)});q.serializer.onPostProcess.add(function(s,t){return q.onPostProcess.dispatch(q,t,s)});q.onPreInit.dispatch(q);if(!v.gecko_spellcheck){q.getBody().spellcheck=0}if(!v.readonly){q._addEvents()}q.controlManager.onPostRender.dispatch(q,q.controlManager);q.onPostRender.dispatch(q);q.quirks=new m.util.Quirks(this);if(v.directionality){q.getBody().dir=v.directionality}if(v.nowrap){q.getBody().style.whiteSpace="nowrap"}if(v.handle_node_change_callback){q.onNodeChange.add(function(t,s,z){q.execCallback("handle_node_change_callback",q.id,z,-1,-1,true,q.selection.isCollapsed())})}if(v.save_callback){q.onSaveContent.add(function(s,z){var t=q.execCallback("save_callback",q.id,z.content,q.getBody());if(t){z.content=t}})}if(v.onchange_callback){q.onChange.add(function(t,s){q.execCallback("onchange_callback",q,s)})}if(v.protect){q.onBeforeSetContent.add(function(s,t){if(v.protect){i(v.protect,function(z){t.content=t.content.replace(z,function(A){return""})})}})}if(v.convert_newlines_to_brs){q.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
    ")}})}if(v.preformatted){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
    '+t.content+"
    "}})}if(v.verify_css_classes){q.serializer.attribValueFilter=function(B,z){var A,t;if(B=="class"){if(!q.classesRE){t=q.dom.getClasses();if(t.length>0){A="";i(t,function(s){A+=(A?"|":"")+s["class"]});q.classesRE=new RegExp("("+A+")","gi")}}return !q.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(z)||q.classesRE.test(z)?z:""}return z}}if(v.cleanup_callback){q.onBeforeSetContent.add(function(s,t){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)});q.onPreProcess.add(function(s,t){if(t.set){q.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){q.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});q.onPostProcess.add(function(s,t){if(t.set){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=q.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(v.save_callback){q.onGetContent.add(function(s,t){if(t.save){t.content=q.execCallback("save_callback",q.id,t.content,q.getBody())}})}if(v.handle_event_callback){q.onEvent.add(function(s,t,z){if(q.execCallback("handle_event_callback",t,s,z)===false){j.cancel(t)}})}q.onSetContent.add(function(){q.addVisual(q.getBody())});if(v.padd_empty_editor){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}if(a){function r(s,t){i(s.dom.select("a"),function(A){var z=A.parentNode;if(s.dom.isBlock(z)&&z.lastChild===A){s.dom.add(z,"br",{"data-mce-bogus":1})}})}q.onExecCommand.add(function(s,t){if(t==="CreateLink"){r(s)}});q.onSetContent.add(q.selection.onSetContent.add(r))}q.load({initial:true,format:"html"});q.startContent=q.getContent({format:"raw"});q.undoManager.add();q.initialized=true;q.onInit.dispatch(q);q.execCallback("setupcontent_callback",q.id,q.getBody(),q.getDoc());q.execCallback("init_instance_callback",q);q.focus(true);q.nodeChanged({initial:1});i(q.contentCSS,function(s){q.dom.loadCSS(s)});if(v.auto_focus){setTimeout(function(){var s=m.get(v.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}x=null},focus:function(u){var y,q=this,s=q.selection,x=q.settings.content_editable,r,p,v=q.getDoc();if(!u){r=s.getRng();if(r.item){p=r.item(0)}q._refreshContentEditable();s.normalize();if(!x){q.getWin().focus()}if(m.isGecko){q.getBody().focus()}if(p&&p.ownerDocument==v){r=v.body.createControlRange();r.addElement(p);r.select()}}if(m.activeEditor!=q){if((y=m.activeEditor)!=null){y.onDeactivate.dispatch(y,q)}q.onActivate.dispatch(q,y)}m._setActive(q)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=q.getStart()||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(p,r,q){this.execCommands[p]={func:r,scope:q||this}},addQueryStateHandler:function(p,r,q){this.queryStateCommands[p]={func:r,scope:q||this}},addQueryValueHandler:function(p,r,q){this.queryValueCommands[p]={func:r,scope:q||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=false;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(u,s){var r=this,q,p=r.getBody(),t;s=s||{};s.format=s.format||"html";s.set=true;s.content=u;if(!s.no_events){r.onBeforeSetContent.dispatch(r,s)}u=s.content;if(!m.isIE&&(u.length===0||/^\s+$/.test(u))){t=r.settings.forced_root_block;if(t){u="<"+t+'>
    "}else{u='
    '}p.innerHTML=u;r.selection.select(p,true);r.selection.collapse(true);return}if(s.format!=="raw"){u=new m.html.Serializer({},r.schema).serialize(r.parser.parse(u))}s.content=m.trim(u);r.dom.setHTML(p,s.content);if(!s.no_events){r.onSetContent.dispatch(r,s)}r.selection.normalize();return s.content},getContent:function(q){var p=this,r;q=q||{};q.format=q.format||"html";q.get=true;if(!q.no_events){p.onBeforeGetContent.dispatch(p,q)}if(q.format=="raw"){r=p.getBody().innerHTML}else{r=p.serializer.serialize(p.getBody(),q)}q.content=m.trim(r);if(!q.no_events){p.onGetContent.dispatch(p,q)}return q.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var B=this,r,C=B.settings,q=B.dom,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function p(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[x[t.fakeType||t.type]].dispatch(B,t,D)}}i(x,function(t,s){switch(s){case"contextmenu":q.bind(B.getDoc(),s,p);break;case"paste":q.bind(B.getBody(),s,function(D){p(D)});break;case"submit":case"reset":q.bind(B.getElement().form||n.getParent(B.id,"form"),s,p);break;default:q.bind(C.content_editable?B.getBody():B.getDoc(),s,p)}});q.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(m.isGecko){q.bind(B.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=B.documentBaseURI.toAbsolute(s)}})}if(a){function u(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){E._refreshContentEditable();try{G.execCommand("styleWithCSS",0,false)}catch(D){if(!E._isHidden()){try{G.execCommand("useCSS",0,true)}catch(D){}}}if(!F.table_inline_editing){try{G.execCommand("enableInlineTableEditing",false,false)}catch(D){}}if(!F.object_resizing){try{G.execCommand("enableObjectResizing",false,false)}catch(D){}}}}B.onBeforeExecCommand.add(u);B.onMouseDown.add(u)}B.onMouseUp.add(B.nodeChanged);B.onKeyUp.add(function(s,t){var D=t.keyCode;if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45||D==46||D==8||(m.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});B.onKeyDown.add(function(t,D){if(D.keyCode!=8){return}var F=t.selection.getRng().startContainer;var E=t.selection.getRng().startOffset;while(F&&F.nodeType&&F.nodeType!=1&&F.parentNode){F=F.parentNode}if(F&&F.parentNode&&F.parentNode.tagName==="BLOCKQUOTE"&&F.parentNode.firstChild==F&&E==0){t.formatter.toggle("blockquote",null,F.parentNode);var s=t.selection.getRng();s.setStart(F,0);s.setEnd(F,0);t.selection.setRng(s);t.selection.collapse(false)}});B.onReset.add(function(){B.setContent(B.startContent,{format:"raw"})});if(C.custom_shortcuts){if(C.custom_undo_redo_keyboard_shortcuts){B.addShortcut("ctrl+z",B.getLang("undo_desc"),"Undo");B.addShortcut("ctrl+y",B.getLang("redo_desc"),"Redo")}B.addShortcut("ctrl+b",B.getLang("bold_desc"),"Bold");B.addShortcut("ctrl+i",B.getLang("italic_desc"),"Italic");B.addShortcut("ctrl+u",B.getLang("underline_desc"),"Underline");for(r=1;r<=6;r++){B.addShortcut("ctrl+"+r,"",["FormatBlock",false,"h"+r])}B.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);B.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);B.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function v(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(m.isMac&&D.ctrl!=t.metaKey){return}else{if(!m.isMac&&D.ctrl!=t.ctrlKey){return}}if(D.alt!=t.altKey){return}if(D.shift!=t.shiftKey){return}if(t.keyCode==D.keyCode||(t.charCode&&t.charCode==D.charCode)){s=D;return false}});return s}B.onKeyUp.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyPress.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyDown.add(function(s,t){var D=v(t);if(D){D.func.call(D.scope);return j.cancel(t)}})}if(m.isIE){q.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){q.unbind(t.node,t.ev,t.cb)}if(!q.hasClass(D,"mceItemNoResize")){ev="resizeend";s=q.bind(D,ev,function(F){var E;F=F.target;if(E=q.getStyle(F,"width")){q.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"width","")}if(E=q.getStyle(F,"height")){q.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"height","")}})}else{ev="resizestart";s=q.bind(D,"resizestart",j.cancel,j)}t=B.resizeInfo={node:D,ev:ev,cb:s}})}if(m.isOpera){B.onClick.add(function(s,t){j.prevent(t)})}if(C.custom_undo_redo){function y(){B.undoManager.typing=false;B.undoManager.add()}q.bind(B.getDoc(),"focusout",function(s){if(!B.removed&&B.undoManager.typing){y()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){y()});B.onKeyUp.add(function(s,D){var t=D.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||D.ctrlKey){y()}});B.onKeyDown.add(function(s,E){var D=E.keyCode,t;if(D==8){t=B.getDoc().selection;if(t&&t.createRange&&t.createRange().item){B.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));y();return j.cancel(E)}}if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45){if(m.isIE&&D==13){B.undoManager.beforeChange()}if(B.undoManager.typing){y()}return}if((D<16||D>20)&&D!=224&&D!=91&&!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.typing=true;B.undoManager.add()}});B.onMouseDown.add(function(){if(B.undoManager.typing){y()}})}if(m.isWebKit){q.bind(B.getDoc(),"selectionchange",function(){if(B.selectionTimer){clearTimeout(B.selectionTimer);B.selectionTimer=0}B.selectionTimer=window.setTimeout(function(){B.nodeChanged()},50)})}if(m.isGecko){function A(){var s=B.dom.getAttribs(B.selection.getStart().cloneNode(false));return function(){var t=B.selection.getStart();if(t!==B.getBody()){B.dom.removeAllAttribs(t);i(s,function(D){t.setAttributeNode(D.cloneNode(true))})}}}function z(){var t=B.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}B.onKeyPress.add(function(s,D){var t;if((D.keyCode==8||D.keyCode==46)&&z()){t=A();B.getDoc().execCommand("delete",false,null);t();return j.cancel(D)}});B.dom.bind(B.getDoc(),"cut",function(t){var s;if(z()){s=A();B.onKeyUp.addToTop(j.cancel,j);setTimeout(function(){s();B.onKeyUp.remove(j.cancel,j)},0)}})}},_refreshContentEditable:function(){var q=this,p,r;if(q._isHidden()){p=q.getBody();r=p.parentNode;r.removeChild(p);r.appendChild(p);p.focus()}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){return t("align"+v.substring(7))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e0||this.typing},hasRedo:function(){return e');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
    ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"
    ");T=v.dom.add(O,V.element,null,"
    ")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"
    ")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}if(!R.body.hasChildNodes()){R.body.appendChild(M.create("br"))}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
    ";return r[0]}else{y.innerHTML=b?"\u00a0":"
    "}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(BL.y+L.h){v.getWin().scrollTo(0,B1||ac==au){return ac}}}var am=V.selection.getRng();var aq=am.startContainer;var al=am.endContainer;if(aq!=al&&am.endOffset==0){var ap=an(aq,al);var ao=ap.nodeType==3?ap.length:ap.childNodes.length;am.setEnd(ap,ao)}return am}function Y(ao,au,ar,aq,am){var al=[],an=-1,at,aw=-1,ap=-1,av;O(ao.childNodes,function(ay,ax){if(ay.nodeName==="UL"||ay.nodeName==="OL"){an=ax;at=ay;return false}});O(ao.childNodes,function(ay,ax){if(ay.nodeName==="SPAN"&&c.getAttrib(ay,"data-mce-type")=="bookmark"){if(ay.id==au.id+"_start"){aw=ax}else{if(ay.id==au.id+"_end"){ap=ax}}}});if(an<=0||(awan)){O(a.grep(ao.childNodes),am);return 0}else{av=ar.cloneNode(S);O(a.grep(ao.childNodes),function(ay,ax){if((awan&&ax>an)){al.push(ay);ay.parentNode.removeChild(ay)}});if(awan){ao.insertBefore(av,at.nextSibling)}}aq.push(av);O(al,function(ax){av.appendChild(ax)});return av}}function aj(am,ao){var al=[],ap,an;ap=ai.inline||ai.block;an=c.create(ap);W(an);K.walk(am,function(aq){var ar;function at(au){var ax=au.nodeName.toLowerCase(),aw=au.parentNode.nodeName.toLowerCase(),av;if(g(ax,"br")){ar=0;if(ai.block){c.remove(au)}return}if(ai.wrapper&&x(au,Z,ah)){ar=0;return}if(ai.block&&!ai.wrapper&&G(ax)){au=c.rename(au,ap);W(au);al.push(au);ar=0;return}if(ai.selector){O(ad,function(ay){if("collapsed" in ay&&ay.collapsed!==ae){return}if(c.is(au,ay.selector)&&!b(au)){W(au,ay);av=true}});if(!ai.inline||av){ar=0;return}}if(d(ap,ax)&&d(aw,ap)&&!(au.nodeType===3&&au.nodeValue.length===1&&au.nodeValue.charCodeAt(0)===65279)){if(!ar){ar=an.cloneNode(S);au.parentNode.insertBefore(ar,au);al.push(ar)}ar.appendChild(au)}else{if(ax=="li"&&ao){ar=Y(au,ao,an,al,at)}else{ar=0;O(a.grep(au.childNodes),at);ar=0}}}O(aq,at)});if(ai.wrap_links===false){O(al,function(aq){function ar(aw){var av,au,at;if(aw.nodeName==="A"){au=an.cloneNode(S);al.push(au);at=a.grep(aw.childNodes);for(av=0;av1||!F(at))&&aq===0){c.remove(at,1);return}if(ai.inline||ai.wrapper){if(!ai.exact&&aq===1){at=ar(at)}O(ad,function(av){O(c.select(av.inline,at),function(ax){var aw;if(av.wrap_links===false){aw=ax.parentNode;do{if(aw.nodeName==="A"){return}}while(aw=aw.parentNode)}U(av,ah,ax,av.exact?ax:null)})});if(x(at.parentNode,Z,ah)){c.remove(at,1);at=0;return B}if(ai.merge_with_parents){c.getParent(at.parentNode,function(av){if(x(av,Z,ah)){c.remove(at,1);at=0;return B}})}if(at&&ai.merge_siblings!==false){at=u(C(at),at);at=u(at,C(at,B))}}})}if(ai){if(ac){X=c.createRng();X.setStartBefore(ac);X.setEndAfter(ac);aj(o(X,ad))}else{if(!ae||!ai.inline||c.select("td.mceSelected,th.mceSelected").length){var ak=V.selection.getNode();V.selection.setRng(ab());ag=q.getBookmark();aj(o(q.getRng(B),ad),ag);if(ai.styles&&(ai.styles.color||ai.styles.textDecoration)){a.walk(ak,I,"childNodes");I(ak)}q.moveToBookmark(ag);q.setRng(aa(q.getRng(B)));V.nodeChanged()}else{Q("apply",Z,ah)}}}}function A(Y,ah,ab){var ac=R(Y),aj=ac[0],ag,af,X;function aa(am){var al=am.startContainer,ar=am.startOffset,aq,ap,an,ao;if(al.nodeType==3&&ar>=al.nodeValue.length-1){al=al.parentNode;ar=s(al)+1}if(al.nodeType==1){an=al.childNodes;al=an[Math.min(ar,an.length-1)];aq=new t(al);if(ar>an.length-1){aq.next()}for(ap=aq.current();ap;ap=aq.next()){if(ap.nodeType==3&&!f(ap)){ao=c.create("a",null,E);ap.parentNode.insertBefore(ao,ap);am.setStart(ap,0);q.setRng(am);c.remove(ao);return}}}}function Z(ao){var an,am,al;an=a.grep(ao.childNodes);for(am=0,al=ac.length;am=0;Z--){if(P.apply[Z].name==Y){return true}}for(Z=P.remove.length-1;Z>=0;Z--){if(P.remove[Z].name==Y){return false}}return W(q.getNode())}aa=q.getNode();if(W(aa)){return B}X=q.getStart();if(X!=aa){if(W(X)){return B}}return S}function v(ad,ac){var aa,ab=[],Z={},Y,X,W;if(q.isCollapsed()){for(X=0;X=0;Y--){W=ad[X];if(P.remove[Y].name==W){Z[W]=true;break}}}for(Y=P.apply.length-1;Y>=0;Y--){for(X=0;X=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\s\r\n]+|)$/.test(W.nodeValue)}function N(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ag,Z){var Y=W.startContainer,ad=W.startOffset,aj=W.endContainer,ae=W.endOffset,ai,af,ac;function ah(am,an,ak,al){var ao,ap;al=al||c.getRoot();for(;;){ao=am.parentNode;if(ao==al||(!ag[0].block_expand&&F(ao))){return am}for(ai=ao[an];ai&&ai!=am;ai=ai[ak]){if(ai.nodeType==1&&!H(ai)){return am}if(ai.nodeType==3&&!f(ai)){return am}}am=am.parentNode}return am}function ab(ak,al){if(al===p){al=ak.nodeType===3?ak.length:ak.childNodes.length}while(ak&&ak.hasChildNodes()){ak=ak.childNodes[al];if(ak){al=ak.nodeType===3?ak.length:ak.childNodes.length}}return{node:ak,offset:al}}if(Y.nodeType==1&&Y.hasChildNodes()){af=Y.childNodes.length-1;Y=Y.childNodes[ad>af?af:ad];if(Y.nodeType==3){ad=0}}if(aj.nodeType==1&&aj.hasChildNodes()){af=aj.childNodes.length-1;aj=aj.childNodes[ae>af?af:ae-1];if(aj.nodeType==3){ae=aj.nodeValue.length}}if(H(Y.parentNode)){Y=Y.parentNode}if(H(Y)){Y=Y.nextSibling||Y}if(H(aj.parentNode)){ae=c.nodeIndex(aj);aj=aj.parentNode}if(H(aj)&&aj.previousSibling){aj=aj.previousSibling;ae=aj.length}if(ag[0].inline){ac=ab(aj,ae);if(ac.node){while(ac.node&&ac.offset===0&&ac.node.previousSibling){ac=ab(ac.node.previousSibling)}if(ac.node&&ac.offset>0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){aj=ac.node;aj.splitText(ac.offset-1)}else{if(ac.node.previousSibling){aj=ac.node.previousSibling}}}}}if(ag[0].inline||ag[0].block_expand){Y=ah(Y,"firstChild","nextSibling");aj=ah(aj,"lastChild","previousSibling")}if(ag[0].selector&&ag[0].expand!==S&&!ag[0].inline){function aa(al,ak){var am,an,ap,ao;if(al.nodeType==3&&al.nodeValue.length==0&&al[ak]){al=al[ak]}am=m(al);for(an=0;anY?Y:Z]}return W}function Q(ad,Y,ac){var aa,X=P[ad],ae=P[ad=="apply"?"remove":"apply"];function af(){return P.apply.length||P.remove.length}function ab(){P.apply=[];P.remove=[]}function ag(ah){O(P.apply.reverse(),function(ai){T(ai.name,ai.vars,ah);if(ai.name==="forecolor"&&ai.vars.value){I(ah.parentNode)}});O(P.remove.reverse(),function(ai){A(ai.name,ai.vars,ah)});c.remove(ah,1);ab()}for(aa=X.length-1;aa>=0;aa--){if(X[aa].name==Y){return}}X.push({name:Y,vars:ac});for(aa=ae.length-1;aa>=0;aa--){if(ae[aa].name==Y){ae.splice(aa,1)}}if(af()){V.getDoc().execCommand("FontName",false,"mceinline");P.lastRng=q.getRng();O(c.select("font,span"),function(ai){var ah;if(b(ai)){ah=q.getBookmark();ag(ai);q.moveToBookmark(ah);V.nodeChanged()}});if(!P.isListening&&af()){P.isListening=true;function W(ai,aj){var ah=c.createRng();ag(ai);ah.setStart(aj,aj.nodeValue.length);ah.setEnd(aj,aj.nodeValue.length);q.setRng(ah);V.nodeChanged()}var Z=false;O("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(ah){V[ah].addToTop(function(ai,al){if(al.keyCode==13&&!al.shiftKey){Z=true;return}if(af()&&!a.dom.RangeUtils.compareRanges(P.lastRng,q.getRng())){var aj=false;O(c.select("font,span"),function(ao){var ap,an;if(b(ao)){aj=true;ap=ao.firstChild;while(ap&&ap.nodeType!=3){ap=ap.firstChild}if(ap){W(ao,ap)}else{c.remove(ao)}}});if(Z&&!aj){var ak=q.getNode();var am=ak;while(am&&am.nodeType!=3){am=am.firstChild}if(am){ak=am.parentNode;while(!F(ak)){ak=ak.parentNode}W(ak,am)}}if(al.type=="keyup"||al.type=="mouseup"){ab();Z=false}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_prototype.js b/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_prototype.js deleted file mode 100644 index a99d300e28725..0000000000000 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_prototype.js +++ /dev/null @@ -1 +0,0 @@ -(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={DELETE:46,BACKSPACE:8}})(tinymce);(function(i){var g=i.VK,h=g.BACKSPACE,f=g.DELETE;function b(j){var l=j.dom,k=j.selection;j.onKeyDown.add(function(n,r){var m,s,p,q,o;o=r.keyCode==f;if(o||r.keyCode==h){r.preventDefault();m=k.getRng();s=l.getParent(m.startContainer,l.isBlock);if(o){s=l.getNext(s,l.isBlock)}if(s){p=s.firstChild;while(p.nodeType==3&&p.nodeValue.length==0){p=p.nextSibling}if(p&&p.nodeName==="SPAN"){q=p.cloneNode(false)}}n.getDoc().execCommand(o?"ForwardDelete":"Delete",false,null);s=l.getParent(m.startContainer,l.isBlock);i.each(l.select("span.Apple-style-span,font.Apple-style-span",s),function(t){var u=k.getBookmark();if(q){l.replace(q.cloneNode(false),t,true)}else{l.remove(t,true)}k.moveToBookmark(u)})}})}function c(j){j.onKeyUp.add(function(k,m){var l=m.keyCode;if(l==f||l==h){if(k.dom.isEmpty(k.getBody())){k.setContent("",{format:"raw"});k.nodeChanged();return}}})}function a(j){j.dom.bind(j.getDoc(),"focusin",function(){j.selection.setRng(j.selection.getRng())})}function e(j){if(!Range.prototype.getClientRects){j.onMouseDown.add(function(l,m){if(m.target.nodeName==="HTML"){var k=l.getBody();k.blur();setTimeout(function(){k.focus()},0)}})}}function d(j){j.onClick.add(function(k,l){l=l.target;if(/^(IMG|HR)$/.test(l.nodeName)){k.selection.getSel().setBaseAndExtent(l,0,l,1)}if(l.nodeName=="A"&&k.dom.hasClass(l,"mceItemAnchor")){k.selection.select(l)}k.nodeChanged()})}i.create("tinymce.util.Quirks",{Quirks:function(j){if(i.isWebKit){b(j);c(j);a(j);d(j)}if(i.isIE){c(j)}if(i.isGecko){e(j)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";l=d(l,",",d(l.toUpperCase()));h=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,audio,object"),g);b=d("pre,script,style,textarea");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(r){var A=this,n={},o={},y=[],q,p;r=r||{};if(r.verify_html===false){r.valid_elements="*[*]"}if(r.valid_styles){q={};k(r.valid_styles,function(C,B){q[B]=m.explode(C)})}p=r.whitespace_elements?d(r.whitespace_elements):b;function z(B){return new RegExp("^"+B.replace(/([?+*])/g,".$1")+"$")}function t(I){var H,D,W,S,X,C,F,R,U,N,V,Z,L,G,T,B,P,E,Y,aa,M,Q,K=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,O=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,J=/[*?+]/;if(I){I=i(I);if(n["@"]){P=n["@"].attributes;E=n["@"].attributesOrder}for(H=0,D=I.length;H=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)\\s*((?:[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},select:function(l,k){var j=this;return h.dom.Sizzle(l,j.get(k)||j.get(j.settings.root_element)||j.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(a.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return h.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(o){var n=k.settings;switch(m){case"style":if(!e(j,"string")){f(j,function(p,q){k.setStyle(o,q,p)});return}if(n.keep_values){if(j&&!k._isRes(j)){o.setAttribute("data-mce-style",j,2)}else{o.removeAttribute("data-mce-style",2)}}o.style.cssText=j;break;case"class":o.className=j||"";break;case"src":case"href":if(n.keep_values){if(n.url_converter){j=n.url_converter.call(n.url_converter_scope||k,j,m,o)}k.setAttrib(o,"data-mce-"+m,j,2)}break;case"shape":o.setAttribute("data-mce-style",j);break}if(e(j)&&j!==null&&j.length!==0){o.setAttribute(m,""+j,2)}else{o.removeAttribute(m,2)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(o,p,l){var j,k=this,m;o=k.get(o);if(!o||o.nodeType!==1){return l===m?false:l}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(p)){j=o.getAttribute("data-mce-"+p);if(j){return j}}if(b&&k.props[p]){j=o[k.props[p]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=o.getAttribute(p,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(p)){if(o[k.props[p]]===true&&j===""){return p}return j?p:""}if(o.nodeName==="FORM"&&o.getAttributeNode(p)){return o.getAttributeNode(p).nodeValue}if(p==="style"){j=j||o.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),o.nodeName);if(k.settings.keep_values&&!k._isRes(j)){o.setAttribute("data-mce-style",j)}}}if(d&&p==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(p){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return p}return l;case"shape":j=j.toLowerCase();break;default:if(p.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==m&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
    "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
    "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p;m=m.firstChild;if(m){j=new h.dom.TreeWalker(m);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){p=m.parentNode;if(l==="br"&&r.isBlock(p)&&p.firstChild===m&&p.lastChild===m){continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if((q===3&&!i.test(m.nodeValue))){return false}}while(m=j.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(v){var t,r=v.childNodes,u=v.nodeType;if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){k(r[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){if(!s.isBlock(v.parentNode)||h.trim(v.nodeValue).length>0){return}}else{if(u==1){r=v.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(r[0],v)}if(r.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}s.remove(v)}return v}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1&&p==q-1){if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return re[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="

    ";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="
    ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='_';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('_'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
    ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.getRangeAt(0)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;break}if(l.nodeName==="BR"){o=m.nodeIndex(l);k=l.parentNode;break}}while(l=(p?n.next():n.prev()));i=true}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}e.remove_trailing_brs=true;i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var p=this,m=e.root,l=e.items,n=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,k=e.excludeFromTabOrder,j,h,o,d,g;f=f||b.DOM;j=function(q){g=q.target.id};h=function(q){f.setAttrib(q.target.id,"tabindex","-1")};d=function(q){var r=f.get(g);f.setAttrib(r,"tabindex","0");r.focus()};p.focus=function(){f.get(g).focus()};p.destroy=function(){c(l,function(q){f.unbind(f.get(q.id),"focus",j);f.unbind(f.get(q.id),"blur",h)});f.unbind(f.get(m),"focus",d);f.unbind(f.get(m),"keydown",o);l=f=m=p.focus=j=h=o=d=null;p.destroy=function(){}};p.moveFocus=function(u,r){var q=-1,t=p.controls,s;if(!g){return}c(l,function(x,v){if(x.id===g){q=v;return false}});q+=u;if(q<0){q=l.length-1}else{if(q>=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.select("#menu_"+g.id)[0];h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(i){i=i.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");g=c.add(g,"a",{role:"option",href:"javascript:;",style:{backgroundColor:"#"+i},title:p.editor.getLang("colors."+i,i),"data-mce-color":"#"+i});if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+i;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){return;var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:p.convertURL,url_converter_scope:p,ie7_compat:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.contentCSS=[];p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(m.isIDevice&&!m.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language&&v.language_load!==false){p.add(m.baseURL+"/../../extra/strings.php?elanguage="+v.language+"ðeme="+v.theme)}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(z){var y={prefix:"plugins/",resource:z,suffix:"/editor_plugin"+m.suffix+".js"};var z=c.createUrl(y,z);c.load(z.resource,z)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+m.suffix+".js"})}}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,H=this,I=H.settings,E,A,D=H.getElement(),q,p,F,y,C,G,z,v=[];m.add(H);I.aria_label=I.aria_label||n.getAttrib(D,"aria-label",H.getLang("aria.rich_text_area"));if(I.theme){I.theme=I.theme.replace(/-/,"");q=h.get(I.theme);H.theme=new q();if(H.theme.init&&I.init_theme){H.theme.init(H,h.urls[I.theme]||m.documentBaseURL.replace(/\/$/,""))}}function B(J){var K=c.get(J),t=c.urls[J]||m.documentBaseURL.replace(/\/$/,""),s;if(K&&m.inArray(v,J)===-1){i(c.dependencies(J),function(u){B(u)});s=new K(H,t);H.plugins[J]=s;if(s.init){s.init(H,t);v.push(J)}}}i(g(I.plugins.replace(/\-/g,"")),B);if(I.popup_css!==false){if(I.popup_css){I.popup_css=H.documentBaseURI.toAbsolute(I.popup_css)}else{I.popup_css=H.baseURI.toAbsolute("themes/"+I.theme+"/skins/"+I.skin+"/dialog.css")}}if(I.popup_css_add){I.popup_css+=","+H.documentBaseURI.toAbsolute(I.popup_css_add)}H.controlManager=new m.ControlManager(H);if(I.custom_undo_redo){H.onBeforeExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.beforeChange()}});H.onExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.add()}})}H.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){H.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){H.execCommand("mceRepaint")}}H.onUndo.add(x);H.onRedo.add(x);H.onSetContent.add(x)}H.onBeforeRenderUI.dispatch(H,H.controlManager);if(I.render_ui){E=I.width||D.style.width||D.offsetWidth;A=I.height||D.style.height||D.offsetHeight;H.orgDisplay=D.style.display;G=/^[0-9\.]+(|px)$/i;if(G.test(""+E)){E=Math.max(parseInt(E)+(q.deltaWidth||0),100)}if(G.test(""+A)){A=Math.max(parseInt(A)+(q.deltaHeight||0),I.theme_advanced_resizing_min_height||100)}q=H.theme.renderUI({targetNode:D,width:E,height:A,deltaWidth:I.delta_width,deltaHeight:I.delta_height});H.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:E,height:A});if(I.content_css){m.each(g(I.content_css),function(s){H.contentCSS.push(H.documentBaseURI.toAbsolute(s))})}A=(q.iframeHeight||A)+(typeof(A)=="number"?(q.deltaHeight||0):"");if(A<(I.theme_advanced_resizing_min_height||100)){A=I.theme_advanced_resizing_min_height||100}H.iframeHTML=I.doctype+'';if(I.document_base_url!=m.documentBaseURL){H.iframeHTML+=''}if(I.ie7_compat){H.iframeHTML+=''}else{H.iframeHTML+=''}H.iframeHTML+='';for(z=0;z'}y=I.body_id||"tinymce";if(y.indexOf("=")!=-1){y=H.getParam("body_id","","hash");y=y[H.id]||y}C=I.body_class||"";if(C.indexOf("=")!=-1){C=H.getParam("body_class","","hash");C=C[H.id]||""}H.iframeHTML+='
    ';if(m.relaxedDomain&&(b||(m.isOpera&&parseFloat(opera.version())<11))){F='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+H.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}r=n.add(q.iframeContainer,"iframe",{id:H.id+"_ifr",src:F||'javascript:""',frameBorder:"0",allowTransparency:"true",title:I.aria_label,style:{width:"100%",height:A,display:"block"}});H.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=H.orgDisplay;n.get(H.id).style.display="none";n.setAttrib(H.id,"aria-hidden",true);if(!m.relaxedDomain||!F){H.setupIframe()}D=r=q=null},setupIframe:function(){var q=this,v=q.settings,x=n.get(q.id),y=q.getDoc(),u,p;if(!b||!m.relaxedDomain){y.open();y.write(q.iframeHTML);y.close();if(m.relaxedDomain){y.domain=m.relaxedDomain}}p=q.getBody();p.disabled=true;if(!v.readonly){p.contentEditable=true}p.disabled=false;q.schema=new m.html.Schema(v);q.dom=new m.dom.DOMUtils(q.getDoc(),{keep_values:true,url_converter:q.convertURL,url_converter_scope:q,hex_colors:v.force_hex_style_colors,class_filter:v.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:q.schema});q.parser=new m.html.DomParser(v,q.schema);if(!q.settings.allow_html_in_named_anchor){q.parser.addAttributeFilter("name",function(s,t){var A=s.length,C,z,B,D;while(A--){D=s[A];if(D.name==="a"&&D.firstChild){B=D.parent;C=D.lastChild;do{z=C.prev;B.insert(C,D);C=z}while(C)}}})}q.parser.addAttributeFilter("src,href,style",function(s,t){var z=s.length,B,D=q.dom,C,A;while(z--){B=s[z];C=B.attr(t);A="data-mce-"+t;if(!B.attributes.map[A]){if(t==="style"){B.attr(A,D.serializeStyle(D.parseStyle(C),B.name))}else{B.attr(A,q.convertURL(C,t,B.name))}}}});q.parser.addNodeFilter("script",function(s,t){var z=s.length;while(z--){s[z].attr("type","mce-text/javascript")}});q.parser.addNodeFilter("#cdata",function(s,t){var z=s.length,A;while(z--){A=s[z];A.type=8;A.name="#comment";A.value="[CDATA["+A.value+"]]"}});q.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,z){var A=t.length,B,s=q.schema.getNonEmptyElements();while(A--){B=t[A];if(B.isEmpty(s)){B.empty().append(new m.html.Node("br",1)).shortEnded=true}}});q.serializer=new m.dom.Serializer(v,q.dom,q.schema);q.selection=new m.dom.Selection(q.dom,q.getWin(),q.serializer);q.formatter=new m.Formatter(this);q.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(z,s,t){i(t,function(B,A){q.dom.setAttrib(z,A,B)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){q.formatter.register(s,{block:s,remove:"all"})});q.formatter.register(q.settings.formats);q.undoManager=new m.UndoManager(q);q.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return q.onChange.dispatch(q,s,t)}});q.undoManager.onUndo.add(function(t,s){return q.onUndo.dispatch(q,s,t)});q.undoManager.onRedo.add(function(t,s){return q.onRedo.dispatch(q,s,t)});q.forceBlocks=new m.ForceBlocks(q,{forced_root_block:v.forced_root_block});q.editorCommands=new m.EditorCommands(q);q.serializer.onPreProcess.add(function(s,t){return q.onPreProcess.dispatch(q,t,s)});q.serializer.onPostProcess.add(function(s,t){return q.onPostProcess.dispatch(q,t,s)});q.onPreInit.dispatch(q);if(!v.gecko_spellcheck){q.getBody().spellcheck=0}if(!v.readonly){q._addEvents()}q.controlManager.onPostRender.dispatch(q,q.controlManager);q.onPostRender.dispatch(q);q.quirks=new m.util.Quirks(this);if(v.directionality){q.getBody().dir=v.directionality}if(v.nowrap){q.getBody().style.whiteSpace="nowrap"}if(v.handle_node_change_callback){q.onNodeChange.add(function(t,s,z){q.execCallback("handle_node_change_callback",q.id,z,-1,-1,true,q.selection.isCollapsed())})}if(v.save_callback){q.onSaveContent.add(function(s,z){var t=q.execCallback("save_callback",q.id,z.content,q.getBody());if(t){z.content=t}})}if(v.onchange_callback){q.onChange.add(function(t,s){q.execCallback("onchange_callback",q,s)})}if(v.protect){q.onBeforeSetContent.add(function(s,t){if(v.protect){i(v.protect,function(z){t.content=t.content.replace(z,function(A){return""})})}})}if(v.convert_newlines_to_brs){q.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
    ")}})}if(v.preformatted){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
    '+t.content+"
    "}})}if(v.verify_css_classes){q.serializer.attribValueFilter=function(B,z){var A,t;if(B=="class"){if(!q.classesRE){t=q.dom.getClasses();if(t.length>0){A="";i(t,function(s){A+=(A?"|":"")+s["class"]});q.classesRE=new RegExp("("+A+")","gi")}}return !q.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(z)||q.classesRE.test(z)?z:""}return z}}if(v.cleanup_callback){q.onBeforeSetContent.add(function(s,t){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)});q.onPreProcess.add(function(s,t){if(t.set){q.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){q.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});q.onPostProcess.add(function(s,t){if(t.set){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=q.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(v.save_callback){q.onGetContent.add(function(s,t){if(t.save){t.content=q.execCallback("save_callback",q.id,t.content,q.getBody())}})}if(v.handle_event_callback){q.onEvent.add(function(s,t,z){if(q.execCallback("handle_event_callback",t,s,z)===false){j.cancel(t)}})}q.onSetContent.add(function(){q.addVisual(q.getBody())});if(v.padd_empty_editor){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}if(a){function r(s,t){i(s.dom.select("a"),function(A){var z=A.parentNode;if(s.dom.isBlock(z)&&z.lastChild===A){s.dom.add(z,"br",{"data-mce-bogus":1})}})}q.onExecCommand.add(function(s,t){if(t==="CreateLink"){r(s)}});q.onSetContent.add(q.selection.onSetContent.add(r))}q.load({initial:true,format:"html"});q.startContent=q.getContent({format:"raw"});q.undoManager.add();q.initialized=true;q.onInit.dispatch(q);q.execCallback("setupcontent_callback",q.id,q.getBody(),q.getDoc());q.execCallback("init_instance_callback",q);q.focus(true);q.nodeChanged({initial:1});i(q.contentCSS,function(s){q.dom.loadCSS(s)});if(v.auto_focus){setTimeout(function(){var s=m.get(v.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}x=null},focus:function(u){var y,q=this,s=q.selection,x=q.settings.content_editable,r,p,v=q.getDoc();if(!u){r=s.getRng();if(r.item){p=r.item(0)}q._refreshContentEditable();s.normalize();if(!x){q.getWin().focus()}if(m.isGecko){q.getBody().focus()}if(p&&p.ownerDocument==v){r=v.body.createControlRange();r.addElement(p);r.select()}}if(m.activeEditor!=q){if((y=m.activeEditor)!=null){y.onDeactivate.dispatch(y,q)}q.onActivate.dispatch(q,y)}m._setActive(q)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=q.getStart()||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(p,r,q){this.execCommands[p]={func:r,scope:q||this}},addQueryStateHandler:function(p,r,q){this.queryStateCommands[p]={func:r,scope:q||this}},addQueryValueHandler:function(p,r,q){this.queryValueCommands[p]={func:r,scope:q||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=false;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(u,s){var r=this,q,p=r.getBody(),t;s=s||{};s.format=s.format||"html";s.set=true;s.content=u;if(!s.no_events){r.onBeforeSetContent.dispatch(r,s)}u=s.content;if(!m.isIE&&(u.length===0||/^\s+$/.test(u))){t=r.settings.forced_root_block;if(t){u="<"+t+'>
    "}else{u='
    '}p.innerHTML=u;r.selection.select(p,true);r.selection.collapse(true);return}if(s.format!=="raw"){u=new m.html.Serializer({},r.schema).serialize(r.parser.parse(u))}s.content=m.trim(u);r.dom.setHTML(p,s.content);if(!s.no_events){r.onSetContent.dispatch(r,s)}r.selection.normalize();return s.content},getContent:function(q){var p=this,r;q=q||{};q.format=q.format||"html";q.get=true;if(!q.no_events){p.onBeforeGetContent.dispatch(p,q)}if(q.format=="raw"){r=p.getBody().innerHTML}else{r=p.serializer.serialize(p.getBody(),q)}q.content=m.trim(r);if(!q.no_events){p.onGetContent.dispatch(p,q)}return q.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var B=this,r,C=B.settings,q=B.dom,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function p(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[x[t.fakeType||t.type]].dispatch(B,t,D)}}i(x,function(t,s){switch(s){case"contextmenu":q.bind(B.getDoc(),s,p);break;case"paste":q.bind(B.getBody(),s,function(D){p(D)});break;case"submit":case"reset":q.bind(B.getElement().form||n.getParent(B.id,"form"),s,p);break;default:q.bind(C.content_editable?B.getBody():B.getDoc(),s,p)}});q.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(m.isGecko){q.bind(B.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=B.documentBaseURI.toAbsolute(s)}})}if(a){function u(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){E._refreshContentEditable();try{G.execCommand("styleWithCSS",0,false)}catch(D){if(!E._isHidden()){try{G.execCommand("useCSS",0,true)}catch(D){}}}if(!F.table_inline_editing){try{G.execCommand("enableInlineTableEditing",false,false)}catch(D){}}if(!F.object_resizing){try{G.execCommand("enableObjectResizing",false,false)}catch(D){}}}}B.onBeforeExecCommand.add(u);B.onMouseDown.add(u)}B.onMouseUp.add(B.nodeChanged);B.onKeyUp.add(function(s,t){var D=t.keyCode;if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45||D==46||D==8||(m.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});B.onKeyDown.add(function(t,D){if(D.keyCode!=8){return}var F=t.selection.getRng().startContainer;var E=t.selection.getRng().startOffset;while(F&&F.nodeType&&F.nodeType!=1&&F.parentNode){F=F.parentNode}if(F&&F.parentNode&&F.parentNode.tagName==="BLOCKQUOTE"&&F.parentNode.firstChild==F&&E==0){t.formatter.toggle("blockquote",null,F.parentNode);var s=t.selection.getRng();s.setStart(F,0);s.setEnd(F,0);t.selection.setRng(s);t.selection.collapse(false)}});B.onReset.add(function(){B.setContent(B.startContent,{format:"raw"})});if(C.custom_shortcuts){if(C.custom_undo_redo_keyboard_shortcuts){B.addShortcut("ctrl+z",B.getLang("undo_desc"),"Undo");B.addShortcut("ctrl+y",B.getLang("redo_desc"),"Redo")}B.addShortcut("ctrl+b",B.getLang("bold_desc"),"Bold");B.addShortcut("ctrl+i",B.getLang("italic_desc"),"Italic");B.addShortcut("ctrl+u",B.getLang("underline_desc"),"Underline");for(r=1;r<=6;r++){B.addShortcut("ctrl+"+r,"",["FormatBlock",false,"h"+r])}B.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);B.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);B.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function v(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(m.isMac&&D.ctrl!=t.metaKey){return}else{if(!m.isMac&&D.ctrl!=t.ctrlKey){return}}if(D.alt!=t.altKey){return}if(D.shift!=t.shiftKey){return}if(t.keyCode==D.keyCode||(t.charCode&&t.charCode==D.charCode)){s=D;return false}});return s}B.onKeyUp.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyPress.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyDown.add(function(s,t){var D=v(t);if(D){D.func.call(D.scope);return j.cancel(t)}})}if(m.isIE){q.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){q.unbind(t.node,t.ev,t.cb)}if(!q.hasClass(D,"mceItemNoResize")){ev="resizeend";s=q.bind(D,ev,function(F){var E;F=F.target;if(E=q.getStyle(F,"width")){q.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"width","")}if(E=q.getStyle(F,"height")){q.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"height","")}})}else{ev="resizestart";s=q.bind(D,"resizestart",j.cancel,j)}t=B.resizeInfo={node:D,ev:ev,cb:s}})}if(m.isOpera){B.onClick.add(function(s,t){j.prevent(t)})}if(C.custom_undo_redo){function y(){B.undoManager.typing=false;B.undoManager.add()}q.bind(B.getDoc(),"focusout",function(s){if(!B.removed&&B.undoManager.typing){y()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){y()});B.onKeyUp.add(function(s,D){var t=D.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||D.ctrlKey){y()}});B.onKeyDown.add(function(s,E){var D=E.keyCode,t;if(D==8){t=B.getDoc().selection;if(t&&t.createRange&&t.createRange().item){B.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));y();return j.cancel(E)}}if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45){if(m.isIE&&D==13){B.undoManager.beforeChange()}if(B.undoManager.typing){y()}return}if((D<16||D>20)&&D!=224&&D!=91&&!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.typing=true;B.undoManager.add()}});B.onMouseDown.add(function(){if(B.undoManager.typing){y()}})}if(m.isWebKit){q.bind(B.getDoc(),"selectionchange",function(){if(B.selectionTimer){clearTimeout(B.selectionTimer);B.selectionTimer=0}B.selectionTimer=window.setTimeout(function(){B.nodeChanged()},50)})}if(m.isGecko){function A(){var s=B.dom.getAttribs(B.selection.getStart().cloneNode(false));return function(){var t=B.selection.getStart();if(t!==B.getBody()){B.dom.removeAllAttribs(t);i(s,function(D){t.setAttributeNode(D.cloneNode(true))})}}}function z(){var t=B.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}B.onKeyPress.add(function(s,D){var t;if((D.keyCode==8||D.keyCode==46)&&z()){t=A();B.getDoc().execCommand("delete",false,null);t();return j.cancel(D)}});B.dom.bind(B.getDoc(),"cut",function(t){var s;if(z()){s=A();B.onKeyUp.addToTop(j.cancel,j);setTimeout(function(){s();B.onKeyUp.remove(j.cancel,j)},0)}})}},_refreshContentEditable:function(){var q=this,p,r;if(q._isHidden()){p=q.getBody();r=p.parentNode;r.removeChild(p);r.appendChild(p);p.focus()}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){return t("align"+v.substring(7))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e0||this.typing},hasRedo:function(){return e');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
    ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"
    ");T=v.dom.add(O,V.element,null,"
    ")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"
    ")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}if(!R.body.hasChildNodes()){R.body.appendChild(M.create("br"))}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
    ";return r[0]}else{y.innerHTML=b?"\u00a0":"
    "}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(BL.y+L.h){v.getWin().scrollTo(0,B1||ac==au){return ac}}}var am=V.selection.getRng();var aq=am.startContainer;var al=am.endContainer;if(aq!=al&&am.endOffset==0){var ap=an(aq,al);var ao=ap.nodeType==3?ap.length:ap.childNodes.length;am.setEnd(ap,ao)}return am}function Y(ao,au,ar,aq,am){var al=[],an=-1,at,aw=-1,ap=-1,av;O(ao.childNodes,function(ay,ax){if(ay.nodeName==="UL"||ay.nodeName==="OL"){an=ax;at=ay;return false}});O(ao.childNodes,function(ay,ax){if(ay.nodeName==="SPAN"&&c.getAttrib(ay,"data-mce-type")=="bookmark"){if(ay.id==au.id+"_start"){aw=ax}else{if(ay.id==au.id+"_end"){ap=ax}}}});if(an<=0||(awan)){O(a.grep(ao.childNodes),am);return 0}else{av=ar.cloneNode(S);O(a.grep(ao.childNodes),function(ay,ax){if((awan&&ax>an)){al.push(ay);ay.parentNode.removeChild(ay)}});if(awan){ao.insertBefore(av,at.nextSibling)}}aq.push(av);O(al,function(ax){av.appendChild(ax)});return av}}function aj(am,ao){var al=[],ap,an;ap=ai.inline||ai.block;an=c.create(ap);W(an);K.walk(am,function(aq){var ar;function at(au){var ax=au.nodeName.toLowerCase(),aw=au.parentNode.nodeName.toLowerCase(),av;if(g(ax,"br")){ar=0;if(ai.block){c.remove(au)}return}if(ai.wrapper&&x(au,Z,ah)){ar=0;return}if(ai.block&&!ai.wrapper&&G(ax)){au=c.rename(au,ap);W(au);al.push(au);ar=0;return}if(ai.selector){O(ad,function(ay){if("collapsed" in ay&&ay.collapsed!==ae){return}if(c.is(au,ay.selector)&&!b(au)){W(au,ay);av=true}});if(!ai.inline||av){ar=0;return}}if(d(ap,ax)&&d(aw,ap)&&!(au.nodeType===3&&au.nodeValue.length===1&&au.nodeValue.charCodeAt(0)===65279)){if(!ar){ar=an.cloneNode(S);au.parentNode.insertBefore(ar,au);al.push(ar)}ar.appendChild(au)}else{if(ax=="li"&&ao){ar=Y(au,ao,an,al,at)}else{ar=0;O(a.grep(au.childNodes),at);ar=0}}}O(aq,at)});if(ai.wrap_links===false){O(al,function(aq){function ar(aw){var av,au,at;if(aw.nodeName==="A"){au=an.cloneNode(S);al.push(au);at=a.grep(aw.childNodes);for(av=0;av1||!F(at))&&aq===0){c.remove(at,1);return}if(ai.inline||ai.wrapper){if(!ai.exact&&aq===1){at=ar(at)}O(ad,function(av){O(c.select(av.inline,at),function(ax){var aw;if(av.wrap_links===false){aw=ax.parentNode;do{if(aw.nodeName==="A"){return}}while(aw=aw.parentNode)}U(av,ah,ax,av.exact?ax:null)})});if(x(at.parentNode,Z,ah)){c.remove(at,1);at=0;return B}if(ai.merge_with_parents){c.getParent(at.parentNode,function(av){if(x(av,Z,ah)){c.remove(at,1);at=0;return B}})}if(at&&ai.merge_siblings!==false){at=u(C(at),at);at=u(at,C(at,B))}}})}if(ai){if(ac){X=c.createRng();X.setStartBefore(ac);X.setEndAfter(ac);aj(o(X,ad))}else{if(!ae||!ai.inline||c.select("td.mceSelected,th.mceSelected").length){var ak=V.selection.getNode();V.selection.setRng(ab());ag=q.getBookmark();aj(o(q.getRng(B),ad),ag);if(ai.styles&&(ai.styles.color||ai.styles.textDecoration)){a.walk(ak,I,"childNodes");I(ak)}q.moveToBookmark(ag);q.setRng(aa(q.getRng(B)));V.nodeChanged()}else{Q("apply",Z,ah)}}}}function A(Y,ah,ab){var ac=R(Y),aj=ac[0],ag,af,X;function aa(am){var al=am.startContainer,ar=am.startOffset,aq,ap,an,ao;if(al.nodeType==3&&ar>=al.nodeValue.length-1){al=al.parentNode;ar=s(al)+1}if(al.nodeType==1){an=al.childNodes;al=an[Math.min(ar,an.length-1)];aq=new t(al);if(ar>an.length-1){aq.next()}for(ap=aq.current();ap;ap=aq.next()){if(ap.nodeType==3&&!f(ap)){ao=c.create("a",null,E);ap.parentNode.insertBefore(ao,ap);am.setStart(ap,0);q.setRng(am);c.remove(ao);return}}}}function Z(ao){var an,am,al;an=a.grep(ao.childNodes);for(am=0,al=ac.length;am=0;Z--){if(P.apply[Z].name==Y){return true}}for(Z=P.remove.length-1;Z>=0;Z--){if(P.remove[Z].name==Y){return false}}return W(q.getNode())}aa=q.getNode();if(W(aa)){return B}X=q.getStart();if(X!=aa){if(W(X)){return B}}return S}function v(ad,ac){var aa,ab=[],Z={},Y,X,W;if(q.isCollapsed()){for(X=0;X=0;Y--){W=ad[X];if(P.remove[Y].name==W){Z[W]=true;break}}}for(Y=P.apply.length-1;Y>=0;Y--){for(X=0;X=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\s\r\n]+|)$/.test(W.nodeValue)}function N(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ag,Z){var Y=W.startContainer,ad=W.startOffset,aj=W.endContainer,ae=W.endOffset,ai,af,ac;function ah(am,an,ak,al){var ao,ap;al=al||c.getRoot();for(;;){ao=am.parentNode;if(ao==al||(!ag[0].block_expand&&F(ao))){return am}for(ai=ao[an];ai&&ai!=am;ai=ai[ak]){if(ai.nodeType==1&&!H(ai)){return am}if(ai.nodeType==3&&!f(ai)){return am}}am=am.parentNode}return am}function ab(ak,al){if(al===p){al=ak.nodeType===3?ak.length:ak.childNodes.length}while(ak&&ak.hasChildNodes()){ak=ak.childNodes[al];if(ak){al=ak.nodeType===3?ak.length:ak.childNodes.length}}return{node:ak,offset:al}}if(Y.nodeType==1&&Y.hasChildNodes()){af=Y.childNodes.length-1;Y=Y.childNodes[ad>af?af:ad];if(Y.nodeType==3){ad=0}}if(aj.nodeType==1&&aj.hasChildNodes()){af=aj.childNodes.length-1;aj=aj.childNodes[ae>af?af:ae-1];if(aj.nodeType==3){ae=aj.nodeValue.length}}if(H(Y.parentNode)){Y=Y.parentNode}if(H(Y)){Y=Y.nextSibling||Y}if(H(aj.parentNode)){ae=c.nodeIndex(aj);aj=aj.parentNode}if(H(aj)&&aj.previousSibling){aj=aj.previousSibling;ae=aj.length}if(ag[0].inline){ac=ab(aj,ae);if(ac.node){while(ac.node&&ac.offset===0&&ac.node.previousSibling){ac=ab(ac.node.previousSibling)}if(ac.node&&ac.offset>0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){aj=ac.node;aj.splitText(ac.offset-1)}else{if(ac.node.previousSibling){aj=ac.node.previousSibling}}}}}if(ag[0].inline||ag[0].block_expand){Y=ah(Y,"firstChild","nextSibling");aj=ah(aj,"lastChild","previousSibling")}if(ag[0].selector&&ag[0].expand!==S&&!ag[0].inline){function aa(al,ak){var am,an,ap,ao;if(al.nodeType==3&&al.nodeValue.length==0&&al[ak]){al=al[ak]}am=m(al);for(an=0;anY?Y:Z]}return W}function Q(ad,Y,ac){var aa,X=P[ad],ae=P[ad=="apply"?"remove":"apply"];function af(){return P.apply.length||P.remove.length}function ab(){P.apply=[];P.remove=[]}function ag(ah){O(P.apply.reverse(),function(ai){T(ai.name,ai.vars,ah);if(ai.name==="forecolor"&&ai.vars.value){I(ah.parentNode)}});O(P.remove.reverse(),function(ai){A(ai.name,ai.vars,ah)});c.remove(ah,1);ab()}for(aa=X.length-1;aa>=0;aa--){if(X[aa].name==Y){return}}X.push({name:Y,vars:ac});for(aa=ae.length-1;aa>=0;aa--){if(ae[aa].name==Y){ae.splice(aa,1)}}if(af()){V.getDoc().execCommand("FontName",false,"mceinline");P.lastRng=q.getRng();O(c.select("font,span"),function(ai){var ah;if(b(ai)){ah=q.getBookmark();ag(ai);q.moveToBookmark(ah);V.nodeChanged()}});if(!P.isListening&&af()){P.isListening=true;function W(ai,aj){var ah=c.createRng();ag(ai);ah.setStart(aj,aj.nodeValue.length);ah.setEnd(aj,aj.nodeValue.length);q.setRng(ah);V.nodeChanged()}var Z=false;O("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(ah){V[ah].addToTop(function(ai,al){if(al.keyCode==13&&!al.shiftKey){Z=true;return}if(af()&&!a.dom.RangeUtils.compareRanges(P.lastRng,q.getRng())){var aj=false;O(c.select("font,span"),function(ao){var ap,an;if(b(ao)){aj=true;ap=ao.firstChild;while(ap&&ap.nodeType!=3){ap=ap.firstChild}if(ap){W(ao,ap)}else{c.remove(ao)}}});if(Z&&!aj){var ak=q.getNode();var am=ak;while(am&&am.nodeType!=3){am=am.firstChild}if(am){ak=am.parentNode;while(!F(ak)){ak=ak.parentNode}W(ak,am)}}if(al.type=="keyup"||al.type=="mouseup"){ab();Z=false}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/jquery.tinymce.js b/lib/editor/tinymce/tiny_mce/3.4.9/jquery.tinymce.js new file mode 100644 index 0000000000000..85104c3e075d8 --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/jquery.tinymce.js @@ -0,0 +1 @@ +(function(b){var e,d,a=[],c=window;b.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}p.css("visibility","hidden");function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);s.onInit.add(function(){var x,y=v;p.css("visibility","");if(v){if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}}})});b.each(r,function(t,s){s.render()})}if(!c.tinymce&&!d&&(g=j.script_url)){d=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}c.tinyMCEPreInit=c.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!c.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");b.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}b.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;d=2;if(j.script_loaded){j.script_loaded()}o();b.each(a,function(q,r){r()})}})}else{if(d===1){a.push(o)}else{o()}}return p};b.extend(b.expr[":"],{tinymce:function(g){return !!(g.id&&tinyMCE.get(g.id))}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==e){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(c.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(c.tinymce)&&(l.is(":tinymce")))}var j={};b.each(["text","html","val"],function(n,l){var o=j[l]=b.fn[l],m=(l==="text");b.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==e){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(b(v),q)});return r}}});b.each(["append","prepend"],function(n,m){var o=j[m]=b.fn[m],l=(m==="prepend");b.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==e){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});b.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=b.fn[l];b.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=b.fn.attr;b.fn.attr=function(n,q,o){var m=this;if((!n)||(n!=="value")||(!g(m))){return j.attr.call(m,n,q,o)}if(q!==e){k.call(m.filter(":tinymce"),q);j.attr.call(m.not(":tinymce"),n,q,o);return m}else{var p=m[0],l=h(p);return l?l.getContent():j.attr.call(b(p),n,q,o)}}}})(jQuery); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/langs/en.js b/lib/editor/tinymce/tiny_mce/3.4.9/langs/en.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/langs/en.js rename to lib/editor/tinymce/tiny_mce/3.4.9/langs/en.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/license.txt b/lib/editor/tinymce/tiny_mce/3.4.9/license.txt similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/license.txt rename to lib/editor/tinymce/tiny_mce/3.4.9/license.txt diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/css/advhr.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/css/advhr.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/css/advhr.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/css/advhr.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/js/rule.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/js/rule.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/js/rule.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/js/rule.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/langs/en_dlg.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/langs/en_dlg.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/rule.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/rule.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advhr/rule.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advhr/rule.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/css/advimage.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/css/advimage.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/css/advimage.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/css/advimage.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/image.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/image.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/image.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/image.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/img/sample.gif b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/img/sample.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/img/sample.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/img/sample.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/js/image.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/js/image.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/js/image.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/js/image.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/langs/en_dlg.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advimage/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advimage/langs/en_dlg.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/css/advlink.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/css/advlink.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/css/advlink.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/css/advlink.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/js/advlink.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/js/advlink.js similarity index 97% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/js/advlink.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/js/advlink.js index cd5cf414ffa04..2862e4c7271b3 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/advlink/js/advlink.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/advlink/js/advlink.js @@ -54,6 +54,13 @@ function init() { document.getElementById('popupurl').style.width = '180px'; elm = inst.dom.getParent(elm, "A"); + if (elm == null) { + var prospect = inst.dom.create("p", null, inst.selection.getContent()); + if (prospect.childNodes.length === 1) { + elm = prospect.firstChild; + } + } + if (elm != null && elm.nodeName == "A") action = "update"; @@ -503,7 +510,7 @@ function getTargetListHTML(elm_id, target_form_element) { var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); var html = ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; + html += option("video"); + html += option("audio"); + html += option("flash", "object"); + html += option("quicktime", "object"); + html += option("shockwave", "object"); + html += option("windowsmedia", "object"); + html += option("realmedia", "object"); + html += option("iframe"); if (editor.getParam('media_embedded_audio', false)) { - html += ''; + html += option('embeddedaudio', "object"); } - + html += ''; return html; + }, + + setDefaultDialogSettings : function(editor) { + var defaultDialogSettings = editor.getParam("media_dialog_defaults", {}); + tinymce.each(defaultDialogSettings, function(v, k) { + setVal(k, v); + }); } }; diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/langs/en_dlg.js similarity index 90% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/langs/en_dlg.js index 49412596a10f0..ecef3a8013b36 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/langs/en_dlg.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/langs/en_dlg.js @@ -1 +1 @@ -tinyMCE.addI18n('en.media_dlg',{list:"List",file:"File/URL",advanced:"Advanced",general:"General",title:"Insert/Edit Embedded Media","align_top_left":"Top Left","align_center":"Center","align_left":"Left","align_bottom":"Bottom","align_right":"Right","align_top":"Top","qt_stream_warn":"Streamed RTSP resources should be added to the QT Source field under the Advanced tab.\nYou should also add a non-streamed version to the Source field.",qtsrc:"QT Source",progress:"Progress",sound:"Sound",swstretchvalign:"Stretch V-Align",swstretchhalign:"Stretch H-Align",swstretchstyle:"Stretch Style",scriptcallbacks:"Script Callbacks","align_top_right":"Top Right",uimode:"UI Mode",rate:"Rate",playcount:"Play Count",defaultframe:"Default Frame",currentposition:"Current Position",currentmarker:"Current Marker",captioningid:"Captioning ID",baseurl:"Base URL",balance:"Balance",windowlessvideo:"Windowless Video",stretchtofit:"Stretch to Fit",mute:"Mute",invokeurls:"Invoke URLs",fullscreen:"Full Screen",enabled:"Enabled",autostart:"Auto Start",volume:"Volume",target:"Target",qtsrcchokespeed:"Choke Speed",href:"HREF",endtime:"End Time",starttime:"Start Time",enablejavascript:"Enable JavaScript",correction:"No Correction",targetcache:"Target Cache",playeveryframe:"Play Every Frame",kioskmode:"Kiosk Mode",controller:"Controller",menu:"Show Menu",loop:"Loop",play:"Auto Play",hspace:"H-Space",vspace:"V-Space","class_name":"Class",name:"Name",id:"ID",type:"Type",size:"Dimensions",preview:"Preview","constrain_proportions":"Constrain Proportions",controls:"Controls",numloop:"Num Loops",console:"Console",cache:"Cache",autohref:"Auto HREF",liveconnect:"SWLiveConnect",flashvars:"Flash Vars",base:"Base",bgcolor:"Background",wmode:"WMode",salign:"SAlign",align:"Align",scale:"Scale",quality:"Quality",shuffle:"Shuffle",prefetch:"Prefetch",nojava:"No Java",maintainaspect:"Maintain Aspect",imagestatus:"Image Status",center:"Center",autogotourl:"Auto Goto URL","shockwave_options":"Shockwave Options","rmp_options":"Real Media Player Options","wmp_options":"Windows Media Player Options","qt_options":"QuickTime Options","flash_options":"Flash Options",hidden:"Hidden","align_bottom_left":"Bottom Left","align_bottom_right":"Bottom Right","html5_video_options":"HTML5 Video Options",altsource1:"Alternative source 1",altsource2:"Alternative source 2",preload:"Preload",poster:"Poster",source:"Source","html5_audio_options":"Audio Options","preload_none":"Don\'t Preload","preload_metadata":"Preload video metadata","preload_auto":"Let user\'s browser decide", "embedded_audio_options":"Embedded Audio Options"}); \ No newline at end of file +tinyMCE.addI18n('en.media_dlg',{list:"List",file:"File/URL",advanced:"Advanced",general:"General",title:"Insert/Edit Embedded Media","align_top_left":"Top Left","align_center":"Center","align_left":"Left","align_bottom":"Bottom","align_right":"Right","align_top":"Top","qt_stream_warn":"Streamed RTSP resources should be added to the QT Source field under the Advanced tab.\nYou should also add a non-streamed version to the Source field.",qtsrc:"QT Source",progress:"Progress",sound:"Sound",swstretchvalign:"Stretch V-Align",swstretchhalign:"Stretch H-Align",swstretchstyle:"Stretch Style",scriptcallbacks:"Script Callbacks","align_top_right":"Top Right",uimode:"UI Mode",rate:"Rate",playcount:"Play Count",defaultframe:"Default Frame",currentposition:"Current Position",currentmarker:"Current Marker",captioningid:"Captioning ID",baseurl:"Base URL",balance:"Balance",windowlessvideo:"Windowless Video",stretchtofit:"Stretch to Fit",mute:"Mute",invokeurls:"Invoke URLs",fullscreen:"Full Screen",enabled:"Enabled",autostart:"Auto Start",volume:"Volume",target:"Target",qtsrcchokespeed:"Choke Speed",href:"HREF",endtime:"End Time",starttime:"Start Time",enablejavascript:"Enable JavaScript",correction:"No Correction",targetcache:"Target Cache",playeveryframe:"Play Every Frame",kioskmode:"Kiosk Mode",controller:"Controller",menu:"Show Menu",loop:"Loop",play:"Auto Play",hspace:"H-Space",vspace:"V-Space","class_name":"Class",name:"Name",id:"ID",type:"Type",size:"Dimensions",preview:"Preview","constrain_proportions":"Constrain Proportions",controls:"Controls",numloop:"Num Loops",console:"Console",cache:"Cache",autohref:"Auto HREF",liveconnect:"SWLiveConnect",flashvars:"Flash Vars",base:"Base",bgcolor:"Background",wmode:"WMode",salign:"SAlign",align:"Align",scale:"Scale",quality:"Quality",shuffle:"Shuffle",prefetch:"Prefetch",nojava:"No Java",maintainaspect:"Maintain Aspect",imagestatus:"Image Status",center:"Center",autogotourl:"Auto Goto URL","shockwave_options":"Shockwave Options","rmp_options":"Real Media Player Options","wmp_options":"Windows Media Player Options","qt_options":"QuickTime Options","flash_options":"Flash Options",hidden:"Hidden","align_bottom_left":"Bottom Left","align_bottom_right":"Bottom Right","html5_video_options":"HTML5 Video Options",altsource1:"Alternative source 1",altsource2:"Alternative source 2",preload:"Preload",poster:"Poster",source:"Source","html5_audio_options":"Audio Options","preload_none":"Don\'t Preload","preload_metadata":"Preload video metadata","preload_auto":"Let user\'s browser decide", "embedded_audio_options":"Embedded Audio Options", video:"HTML5 Video", audio:"HTML5 Audio", flash:"Flash", quicktime:"QuickTime", shockwave:"Shockwave", windowsmedia:"Windows Media", realmedia:"Real Media", iframe:"Iframe", embeddedaudio:"Embedded Audio" }); diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/media.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/media.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/media/media.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/media.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/moxieplayer.swf b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/moxieplayer.swf new file mode 100644 index 0000000000000..585d772d6d3c2 Binary files /dev/null and b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/media/moxieplayer.swf differ diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/dialog.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/dialog.php similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/dialog.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/dialog.php diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/img/moodleemoticon.gif b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/img/moodleemoticon.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/img/moodleemoticon.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/img/moodleemoticon.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/js/dialog.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/js/dialog.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodleemoticon/js/dialog.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodleemoticon/js/dialog.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/css/media.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/css/media.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/css/media.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/css/media.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/img/icon.gif b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/img/icon.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/img/icon.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/img/icon.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/js/media.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/js/media.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/js/media.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/js/media.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/moodlemedia.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/moodlemedia.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlemedia/moodlemedia.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlemedia/moodlemedia.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/img/ed_nolink.gif b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/img/ed_nolink.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/img/ed_nolink.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/img/ed_nolink.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/langs/en.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/langs/en.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/moodlenolink/langs/en.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/moodlenolink/langs/en.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/nonbreaking/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/nonbreaking/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/nonbreaking/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/nonbreaking/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/nonbreaking/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/nonbreaking/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/nonbreaking/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/nonbreaking/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/noneditable/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/noneditable/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/noneditable/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/noneditable/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/noneditable/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/noneditable/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/noneditable/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/noneditable/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/pagebreak/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/pagebreak/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/pagebreak/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/pagebreak/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/pagebreak/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/pagebreak/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/pagebreak/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/pagebreak/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/js/pastetext.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/js/pastetext.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/js/pastetext.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/js/pastetext.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/js/pasteword.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/js/pasteword.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/js/pasteword.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/js/pasteword.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/langs/en_dlg.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/langs/en_dlg.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/pastetext.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/pastetext.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/pastetext.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/pastetext.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/pasteword.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/pasteword.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/paste/pasteword.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/paste/pasteword.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/example.html b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/example.html similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/example.html rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/example.html diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/jscripts/embed.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/jscripts/embed.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/jscripts/embed.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/jscripts/embed.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/preview.html b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/preview.html similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/preview/preview.html rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/preview/preview.html diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/print/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/print/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/print/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/print/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/print/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/print/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/print/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/print/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/save/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/save/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/save/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/save/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/save/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/save/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/save/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/save/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/css/searchreplace.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/css/searchreplace.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/css/searchreplace.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/css/searchreplace.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/js/searchreplace.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/js/searchreplace.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/js/searchreplace.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/js/searchreplace.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/langs/en_dlg.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/langs/en_dlg.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/searchreplace.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/searchreplace.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/searchreplace/searchreplace.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/searchreplace/searchreplace.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/changelog.txt b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/changelog.txt similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/changelog.txt rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/changelog.txt diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/EnchantSpell.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/EnchantSpell.php similarity index 95% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/EnchantSpell.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/EnchantSpell.php index 910fc44b21971..cefc8cf2ce7a7 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/EnchantSpell.php +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/EnchantSpell.php @@ -6,7 +6,7 @@ * * @package MCManager.includes * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ class EnchantSpell extends SpellChecker { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/GoogleSpell.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/GoogleSpell.php similarity index 98% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/GoogleSpell.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/GoogleSpell.php index 4682e1a9763f8..bfc201ff78bf5 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/GoogleSpell.php +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/GoogleSpell.php @@ -4,7 +4,7 @@ * * @package MCManager.includes * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ class GoogleSpell extends SpellChecker { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpell.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/PSpell.php similarity index 95% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpell.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/PSpell.php index 2ab09da3e8bec..222653b08e7ee 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpell.php +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/PSpell.php @@ -4,7 +4,7 @@ * * @package MCManager.includes * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ class PSpell extends SpellChecker { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpellShell.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/PSpellShell.php similarity index 97% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpellShell.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/PSpellShell.php index 8ff1af890150b..3d6d4a9a26055 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpellShell.php +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/PSpellShell.php @@ -4,7 +4,7 @@ * * @package MCManager.includes * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ class PSpellShell extends SpellChecker { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/SpellChecker.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/SpellChecker.php similarity index 94% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/SpellChecker.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/SpellChecker.php index b6990742ec3f6..5d9205fe6e723 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/SpellChecker.php +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/SpellChecker.php @@ -4,7 +4,7 @@ * * @package MCManager.includes * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ class SpellChecker { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/utils/JSON.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/utils/JSON.php similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/utils/JSON.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/utils/JSON.php diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/utils/Logger.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/utils/Logger.php similarity index 98% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/utils/Logger.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/utils/Logger.php index 9a20d9bdcfc11..a1fb4cd09e062 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/utils/Logger.php +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/classes/utils/Logger.php @@ -4,7 +4,7 @@ * * @package MCFileManager.filesystems * @author Moxiecode - * @copyright Copyright � 2005, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved. */ // File type contstants diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/config.php b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/config.php similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/config.php rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/config.php diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/css/content.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/css/content.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/css/content.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/css/content.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/editor_plugin_src.js similarity index 99% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/editor_plugin_src.js index 24eec5a0147ef..0d7cc6eb97d11 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/editor_plugin_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/editor_plugin_src.js @@ -167,7 +167,7 @@ }, _getSeparators : function() { - var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c'); + var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c'); // Build word separator regexp for (i=0; i - + diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/tabfocus/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/tabfocus/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/tabfocus/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/tabfocus/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/tabfocus/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/tabfocus/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/tabfocus/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/tabfocus/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/cell.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/cell.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/cell.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/cell.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/css/cell.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/css/cell.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/css/cell.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/css/cell.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/css/row.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/css/row.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/css/row.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/css/row.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/css/table.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/css/table.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/css/table.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/css/table.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/editor_plugin.js similarity index 58% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/editor_plugin.js index 94e3c210f64b7..9acc09bcae6c4 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/editor_plugin.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/editor_plugin.js @@ -1 +1 @@ -(function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='
    '}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;iN){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(B,M){function F(Q){B.selection.setCursorLocation(Q,0)}function H(R,Q){return R.keyCode==z?Q.previousSibling:Q.nextSibling}function G(R,S){var Q=H(R,S);return Q!==null&&Q.tagName==="TR"?Q:null}function C(Q,R){return Q.dom.getParent(R,"table")}function O(Q){var R=C(B,Q);return H(M,R)}function A(Q){return Q.keyCode==z||Q.keyCode==I}function D(Q){var S=Q.selection.getNode();var R=Q.dom.getParent(S,"tr");return R!==null}function N(R){var Q=0;var S=R;while(S.previousSibling){S=S.previousSibling;Q=Q+a(S,"colspan")}return Q}function E(S,Q){var T=0;var R=0;e(S.children,function(U,V){T=T+a(U,"colspan");R=V;if(T>Q){return false}});return R}function w(S,T,V){var U=N(S.dom.getParent(T,"td,th"));var R=E(V,U);var Q=V.childNodes[R];F(Q)}function L(R,T){var Q=O(R);if(Q!==null){F(Q);return d.dom.Event.cancel(T)}else{var S=T.keyCode==z?R.firstChild:R.lastChild;F(S);return true}}var z=38;var I=40;if(A(M)&&D(B)){var J=B.selection.getNode();var P=B.dom.getParent(J,"tr");var K=G(M,P);if(K==null){return L(P,M)}else{w(B,J,K);d.dom.Event.cancel(M);return true}}}r.onKeyDown.add(v)}if(!d.isIE){function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){r.dom.add(r.getBody(),"p",null,'
    ')}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&z.childNodes.length==1&&z.firstChild.nodeName=="BR"){w.dom.remove(z)}});s();r.startContent=r.getContent({format:"raw"})}});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce); \ No newline at end of file +(function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='
    '}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;iN){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD,TH");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(C,N){var L=d.VK;var Q=N.keyCode;function O(Y,U,S){var T=Y?"previousSibling":"nextSibling";var Z=C.dom.getParent(U,"tr");var X=Z[T];if(X){z(C,U,X,Y);d.dom.Event.cancel(S);return true}else{var aa=C.dom.getParent(Z,"table");var W=Z.parentNode;var R=W.nodeName.toLowerCase();if(R==="tbody"||R===(Y?"tfoot":"thead")){var V=w(Y,aa,W,"tbody");if(V!==null){return K(Y,V,U,S)}}return M(Y,Z,T,aa,S)}}function w(V,T,U,X){var S=C.dom.select(">"+X,T);var R=S.indexOf(U);if(V&&R===0||!V&&R===S.length-1){return B(V,T)}else{if(R===-1){var W=U.tagName.toLowerCase()==="thead"?0:S.length-1;return S[W]}else{return S[R+(V?-1:1)]}}}function B(U,T){var S=U?"thead":"tfoot";var R=C.dom.select(">"+S,T);return R.length!==0?R[0]:null}function K(V,T,S,U){var R=J(T,V);R&&z(C,S,R,V);d.dom.Event.cancel(U);return true}function M(Y,U,R,X,W){var S=X[R];if(S){F(S);return true}else{var V=C.dom.getParent(X,"td,th");if(V){return O(Y,V,W)}else{var T=J(U,!Y);F(T);return d.dom.Event.cancel(W)}}}function J(S,R){return S&&S[R?"lastChild":"firstChild"]}function F(R){C.selection.setCursorLocation(R,0)}function A(){return Q==L.UP||Q==L.DOWN}function D(R){var T=R.selection.getNode();var S=R.dom.getParent(T,"tr");return S!==null}function P(S){var R=0;var T=S;while(T.previousSibling){T=T.previousSibling;R=R+a(T,"colspan")}return R}function E(T,R){var U=0;var S=0;e(T.children,function(V,W){U=U+a(V,"colspan");S=W;if(U>R){return false}});return S}function z(T,W,Y,V){var X=P(T.dom.getParent(W,"td,th"));var S=E(Y,X);var R=Y.childNodes[S];var U=J(R,V);F(U||R)}function H(R){var T=C.selection.getNode();var U=C.dom.getParent(T,"td,th");var S=C.dom.getParent(R,"td,th");return U&&U!==S&&I(U,S)}function I(S,R){return C.dom.getParent(S,"TABLE")===C.dom.getParent(R,"TABLE")}if(A()&&D(C)){var G=C.selection.getNode();setTimeout(function(){if(H(G)){O(!N.shiftKey&&Q===L.UP,G,N)}},0)}}r.onKeyDown.add(v)}if(!d.isIE){function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){r.dom.add(r.getBody(),"p",null,'
    ')}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&z.childNodes.length==1&&z.firstChild.nodeName=="BR"){w.dom.remove(z)}});if(d.isGecko){r.onKeyDown.add(function(z,B){if(B.keyCode===d.VK.ENTER&&B.shiftKey){var A=z.selection.getRng().startContainer;var C=q.getParent(A,"td,th");if(C){var w=z.getDoc().createTextNode("\uFEFF");q.insertAfter(w,A)}}})}s();r.startContent=r.getContent({format:"raw"})}});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/editor_plugin_src.js similarity index 88% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/editor_plugin_src.js index ccfe808f683cb..ed70f3d3ee54f 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/editor_plugin_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/editor_plugin_src.js @@ -988,7 +988,7 @@ rng.endOffset == 0 && currentCell && (n.nodeName=="TR" || n==tableParent); - tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell; + tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell; return allOfCellSelected || tableCellSelection; // return false; } @@ -1000,7 +1000,7 @@ var rng = ed.selection.getRng(); var n = ed.selection.getNode(); - var currentCell = ed.dom.getParent(rng.startContainer, 'TD'); + var currentCell = ed.dom.getParent(rng.startContainer, 'TD,TH'); if (!tableCellSelected(ed, rng, n, currentCell)) return; @@ -1012,7 +1012,7 @@ var end = currentCell.lastChild; while (end.lastChild) end = end.lastChild; - + // Select the entire table cell. Nothing outside of the table cell should be selected. rng.setEnd(end, end.nodeValue.length); ed.selection.setRng(rng); @@ -1074,31 +1074,85 @@ // Fix to allow navigating up and down in a table in WebKit browsers. if (tinymce.isWebKit) { function moveSelection(ed, e) { + var VK = tinymce.VK; + var key = e.keyCode; - function moveCursorToStartOfElement(n) { - ed.selection.setCursorLocation(n, 0); + function handle(upBool, sourceNode, event) { + var siblingDirection = upBool ? 'previousSibling' : 'nextSibling'; + var currentRow = ed.dom.getParent(sourceNode, 'tr'); + var siblingRow = currentRow[siblingDirection]; + + if (siblingRow) { + moveCursorToRow(ed, sourceNode, siblingRow, upBool); + tinymce.dom.Event.cancel(event); + return true; + } else { + var tableNode = ed.dom.getParent(currentRow, 'table'); + var middleNode = currentRow.parentNode; + var parentNodeName = middleNode.nodeName.toLowerCase(); + if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) { + var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody'); + if (targetParent !== null) { + return moveToRowInTarget(upBool, targetParent, sourceNode, event); + } + } + return escapeTable(upBool, currentRow, siblingDirection, tableNode, event); + } } - function getSibling(event, element) { - return event.keyCode == UP_ARROW ? element.previousSibling : element.nextSibling; + function getTargetParent(upBool, topNode, secondNode, nodeName) { + var tbodies = ed.dom.select('>' + nodeName, topNode); + var position = tbodies.indexOf(secondNode); + if (upBool && position === 0 || !upBool && position === tbodies.length - 1) { + return getFirstHeadOrFoot(upBool, topNode); + } else if (position === -1) { + var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1; + return tbodies[topOrBottom]; + } else { + return tbodies[position + (upBool ? -1 : 1)]; + } } - function getNextRow(e, row) { - var sibling = getSibling(e, row); - return sibling !== null && sibling.tagName === 'TR' ? sibling : null; + function getFirstHeadOrFoot(upBool, parent) { + var tagName = upBool ? 'thead' : 'tfoot'; + var headOrFoot = ed.dom.select('>' + tagName, parent); + return headOrFoot.length !== 0 ? headOrFoot[0] : null; } - function getTable(ed, currentRow) { - return ed.dom.getParent(currentRow, 'table'); + function moveToRowInTarget(upBool, targetParent, sourceNode, event) { + var targetRow = getChildForDirection(targetParent, upBool); + targetRow && moveCursorToRow(ed, sourceNode, targetRow, upBool); + tinymce.dom.Event.cancel(event); + return true; } - function getTableSibling(currentRow) { - var table = getTable(ed, currentRow); - return getSibling(e, table); + function escapeTable(upBool, currentRow, siblingDirection, table, event) { + var tableSibling = table[siblingDirection]; + if (tableSibling) { + moveCursorToStartOfElement(tableSibling); + return true; + } else { + var parentCell = ed.dom.getParent(table, 'td,th'); + if (parentCell) { + return handle(upBool, parentCell, event); + } else { + var backUpSibling = getChildForDirection(currentRow, !upBool); + moveCursorToStartOfElement(backUpSibling); + return tinymce.dom.Event.cancel(event); + } + } + } + + function getChildForDirection(parent, up) { + return parent && parent[up ? 'lastChild' : 'firstChild']; + } + + function moveCursorToStartOfElement(n) { + ed.selection.setCursorLocation(n, 0); } - function isVerticalMovement(event) { - return event.keyCode == UP_ARROW || event.keyCode == DOWN_ARROW; + function isVerticalMovement() { + return key == VK.UP || key == VK.DOWN; } function isInTable(ed) { @@ -1129,42 +1183,32 @@ return r; } - function moveCursorToRow(ed, node, row) { + function moveCursorToRow(ed, node, row, upBool) { var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th')); - var tgtColumnIndex = findColumn(row, srcColumnIndex) + var tgtColumnIndex = findColumn(row, srcColumnIndex); var tgtNode = row.childNodes[tgtColumnIndex]; - moveCursorToStartOfElement(tgtNode); + var rowCellTarget = getChildForDirection(tgtNode, upBool); + moveCursorToStartOfElement(rowCellTarget || tgtNode); } - function escapeTable(currentRow, e) { - var tableSiblingElement = getTableSibling(currentRow); - if (tableSiblingElement !== null) { - moveCursorToStartOfElement(tableSiblingElement); - return tinymce.dom.Event.cancel(e); - } else { - var element = e.keyCode == UP_ARROW ? currentRow.firstChild : currentRow.lastChild; - // rely on default behaviour to escape table after we are in the last cell of the last row - moveCursorToStartOfElement(element); - return true; - } + function shouldFixCaret(preBrowserNode) { + var newNode = ed.selection.getNode(); + var newParent = ed.dom.getParent(newNode, 'td,th'); + var oldParent = ed.dom.getParent(preBrowserNode, 'td,th'); + return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent) } - var UP_ARROW = 38; - var DOWN_ARROW = 40; - - if (isVerticalMovement(e) && isInTable(ed)) { - var node = ed.selection.getNode(); - var currentRow = ed.dom.getParent(node, 'tr'); - var nextRow = getNextRow(e, currentRow); + function checkSameParentTable(nodeOne, NodeTwo) { + return ed.dom.getParent(nodeOne, 'TABLE') === ed.dom.getParent(NodeTwo, 'TABLE'); + } - // If we're at the first or last row in the table, we should move the caret outside of the table - if (nextRow == null) { - return escapeTable(currentRow, e); - } else { - moveCursorToRow(ed, node, nextRow); - tinymce.dom.Event.cancel(e); - return true; - } + if (isVerticalMovement() && isInTable(ed)) { + var preBrowserNode = ed.selection.getNode(); + setTimeout(function() { + if (shouldFixCaret(preBrowserNode)) { + handle(!e.shiftKey && key === VK.UP, preBrowserNode, e); + } + }, 0); } } @@ -1223,6 +1267,24 @@ ed.dom.remove(last); }); + + /** + * Fixes bug in Gecko where shift-enter in table cell does not place caret on new line + */ + if (tinymce.isGecko) { + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) { + var node = ed.selection.getRng().startContainer; + var tableCell = dom.getParent(node, 'td,th'); + if (tableCell) { + var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF"); + dom.insertAfter(zeroSizedNbsp, node); + } + } + }); + } + + fixTableCaretPos(); ed.startContent = ed.getContent({format : 'raw'}); } diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/cell.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/cell.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/cell.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/cell.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/merge_cells.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/merge_cells.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/merge_cells.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/merge_cells.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/row.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/row.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/row.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/row.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/table.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/table.js similarity index 90% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/table.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/table.js index 77e9044fae2c2..2b18e3614668d 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/table/js/table.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/table/js/table.js @@ -60,7 +60,19 @@ function insertTable() { if (action == "update") { dom.setAttrib(elm, 'cellPadding', cellpadding, true); dom.setAttrib(elm, 'cellSpacing', cellspacing, true); - dom.setAttrib(elm, 'border', border); + + if (!isCssSize(border)) { + dom.setAttrib(elm, 'border', border); + } else { + dom.setAttrib(elm, 'border', ''); + } + + if (border == '') { + dom.setStyle(elm, 'border-width', ''); + dom.setStyle(elm, 'border', ''); + dom.setAttrib(elm, 'border', ''); + } + dom.setAttrib(elm, 'align', align); dom.setAttrib(elm, 'frame', frame); dom.setAttrib(elm, 'rules', rules); @@ -119,7 +131,7 @@ function insertTable() { if (bordercolor != "") { elm.style.borderColor = bordercolor; elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle; - elm.style.borderWidth = border == "" ? "1px" : border; + elm.style.borderWidth = cssSize(border); } else elm.style.borderColor = ''; @@ -132,7 +144,7 @@ function insertTable() { //elm.outerHTML = elm.outerHTML; inst.nodeChanged(); - inst.execCommand('mceEndUndoLevel'); + inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true}); // Repaint if dimensions changed if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight) @@ -146,7 +158,10 @@ function insertTable() { html += '{#table_dlg.align_right} - + diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/blank.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/blank.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/blank.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/blank.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/css/template.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/css/template.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/css/template.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/css/template.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/js/template.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/js/template.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/js/template.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/js/template.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/langs/en_dlg.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/langs/en_dlg.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/template.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/template.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/template/template.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/template/template.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/visualchars/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/visualchars/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/visualchars/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/visualchars/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/visualchars/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/visualchars/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/visualchars/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/visualchars/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/plugins/wordcount/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/wordcount/editor_plugin.js new file mode 100644 index 0000000000000..42ece2092f380 --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/wordcount/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'0')}}else{tinymce.DOM.add(k,"span",{},'0')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})(); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/wordcount/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/wordcount/editor_plugin_src.js similarity index 82% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/wordcount/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/wordcount/editor_plugin_src.js index 032a3f6774768..3fb8fffa0e672 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/wordcount/editor_plugin_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/wordcount/editor_plugin_src.js @@ -16,10 +16,12 @@ cleanre : null, init : function(ed, url) { - var t = this, last = 0; + var t = this, last = 0, VK = tinymce.VK; t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == ’ t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g); + t.update_rate = ed.getParam('wordcount_update_rate', 2000); + t.update_on_delete = ed.getParam('wordcount_update_on_delete', false); t.id = ed.id + '-word-count'; ed.onPostRender.add(function(ed, cm) { @@ -49,12 +51,18 @@ t._count(ed); }); - ed.onKeyUp.add(function(ed, e) { - if (e.keyCode == last) - return; + function checkKeys(key) { + return key !== last && (key === VK.ENTER || last === VK.SPACEBAR || checkDelOrBksp(last)); + } + + function checkDelOrBksp(key) { + return key === VK.DELETE || key === VK.BACKSPACE; + } - if (13 == e.keyCode || 8 == last || 46 == last) + ed.onKeyUp.add(function(ed, e) { + if (checkKeys(e.keyCode) || t.update_on_delete && checkDelOrBksp(e.keyCode)) { t._count(ed); + } last = e.keyCode; }); @@ -94,7 +102,7 @@ if (!ed.destroyed) { var tc = t._getCount(ed); tinymce.DOM.setHTML(t.id, tc.toString()); - setTimeout(function() {t.block = 0;}, 2000); + setTimeout(function() {t.block = 0;}, t.update_rate); } }, 1); }, diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/abbr.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/abbr.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/abbr.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/abbr.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/acronym.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/acronym.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/acronym.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/acronym.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/attributes.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/attributes.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/attributes.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/attributes.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/cite.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/cite.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/cite.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/cite.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/css/attributes.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/css/attributes.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/css/attributes.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/css/attributes.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/css/popup.css b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/css/popup.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/css/popup.css rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/css/popup.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/del.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/del.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/del.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/del.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/editor_plugin.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/editor_plugin.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/editor_plugin.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/editor_plugin.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/editor_plugin_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/editor_plugin_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/editor_plugin_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/editor_plugin_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/ins.htm b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/ins.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/ins.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/ins.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/abbr.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/abbr.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/abbr.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/abbr.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/acronym.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/acronym.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/acronym.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/acronym.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/attributes.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/attributes.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/attributes.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/attributes.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/cite.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/cite.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/cite.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/cite.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/del.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/del.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/del.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/del.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/element_common.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/element_common.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/element_common.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/element_common.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/ins.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/ins.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/js/ins.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/js/ins.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/langs/en_dlg.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/plugins/xhtmlxtras/langs/en_dlg.js rename to lib/editor/tinymce/tiny_mce/3.4.9/plugins/xhtmlxtras/langs/en_dlg.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/about.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/about.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/about.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/about.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/anchor.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/anchor.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/anchor.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/anchor.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/charmap.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/charmap.htm similarity index 93% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/charmap.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/charmap.htm index e91bb907a593c..e92a9a41ef298 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/charmap.htm +++ b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/charmap.htm @@ -5,7 +5,7 @@ - + @@ -46,6 +46,10 @@
    + + {#advanced_dlg.charmap_usage} + + diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/color_picker.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/color_picker.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/color_picker.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/color_picker.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/editor_template.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/editor_template.js new file mode 100644 index 0000000000000..d85b4952ed2db --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/editor_template.js @@ -0,0 +1 @@ +(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);j.forcedHighContrastMode=j.settings.detect_highcontrast&&l._isHighContrast();j.settings.skin=j.forcedHighContrastMode?"highcontrast":j.settings.skin;l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}if(j.settings.content_css!==false){j.contentCSS.push(j.baseURI.toAbsolute(k+"/skins/"+j.settings.skin+"/content.css"))}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l);j.onKeyUp.add(l._updateUndoStatus,l);j.onMouseUp.add(l._updateUndoStatus,l);j.dom.bind(j.dom.getRoot(),"dragend",function(){l._updateUndoStatus(j)})}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},_isHighContrast:function(){var i,j=d.add(d.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});i=(d.getStyle(j,"background-color",true)+"").toLowerCase().replace(/ /g,"");d.remove(j);return i!="rgb(171,239,86)"&&i!="#abef56"},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",attributes:{"class":n["class"]},selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(o){var p,n=[];f(l.items,function(q){n.push(q.value)});i.focus();i.undoManager.add();p=i.formatter.matchAll(n);if(!o||p[0]==o){if(p[0]){i.formatter.remove(p[0])}}else{i.formatter.apply(o)}i.undoManager.add();i.nodeChanged();return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r,selector:"*"});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});if(m&&m.value==l){k.select(null)}return false}});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}if(i["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:i["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,i.fontSize)}n.select(function(p){return i==p});if(o&&(o.value.fontSize==i.fontSize||o.value["class"]&&o.value["class"]==i["class"])){n.select(null)}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",onselect:function(l){j.editor.execCommand("FormatBlock",false,l);return false}});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;if(r.settings){r.settings.aria_label=w.aria_label+r.getLang("advanced.help_shortcut")}m=j=d.create("span",{role:"application","aria-labelledby":r.id+"_voice",id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});d.add(m,"span",{"class":"mceVoiceLabel",style:"display:none;",id:r.id+"_voice"},w.aria_label);if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{role:"presentation",id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},""),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;r.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){if(e.isWebKit){window.focus()}v.toolbarGroup.focus();return b.cancel(n)}else{if(n.keyCode===o){d.get(p.id+"_path_row").focus();return b.cancel(n)}}}});r.addShortcut("alt+0","","mceShortcuts",v);return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_ifr");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,m,k){var j=this.editor,l=this.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr");i=Math.max(l.theme_advanced_resizing_min_width||100,i);m=Math.max(l.theme_advanced_resizing_min_height||100,m);i=Math.min(l.theme_advanced_resizing_max_width||65535,i);m=Math.min(l.theme_advanced_resizing_max_height||65535,m);d.setStyle(n,"height","");d.setStyle(o,"height",m);if(l.theme_advanced_resize_horizontal){d.setStyle(n,"width","");d.setStyle(o,"width",i);if(i"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row",role:"group","aria-labelledby":p.id+"_path_voice"});if(w.theme_advanced_path){d.add(k,"span",{id:p.id+"_path_voice"},p.translate("advanced.path"));d.add(k,"span",{},": ")}else{d.add(k,"span",{}," ")}if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize",tabIndex:"-1"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","click",function(n){n.preventDefault()});b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){G.preventDefault();n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E)}function B(G){b.remove(d.doc,"mousemove",t);b.remove(p.getDoc(),"mousemove",r);b.remove(d.doc,"mouseup",s);b.remove(p.getDoc(),"mouseup",o);n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E,true)}D.preventDefault();C=D.screenX;z=D.screenY;x=d.get(v.editor.id+"_ifr");A=n=x.clientWidth;F=E=x.clientHeight;t=b.add(d.doc,"mousemove",y);r=b.add(p.getDoc(),"mousemove",y);s=b.add(d.doc,"mouseup",B);o=b.add(p.getDoc(),"mouseup",B)})})}j.deltaHeight-=21;k=m=null},_updateUndoStatus:function(j){var i=j.controlManager,k=j.undoManager;i.setDisabled("undo",!k.hasUndo()&&!k.typing);i.setDisabled("redo",!k.hasRedo())},_nodeChanged:function(m,r,D,q,E){var y=this,C,F=0,x,G,z=y.settings,w,k,u,B,l,j,i;e.each(y.stateControls,function(n){r.setActive(n,m.queryCommandState(y.controls[n][1]))});function o(p){var s,n=E.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s0){y.statusKeyboardNavigation=new e.ui.KeyboardNavigation({root:m.id+"_path_row",items:d.select("a",C),excludeFromTabOrder:true,onCancel:function(){m.focus()}},d)}}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:this.url+"/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:this.url+"/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:265+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var i=this.editor;i.windowManager.open({url:this.url+"/shortcuts.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:this.url+"/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:this.url+"/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:this.url+"/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:this.url+"/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/editor_template_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/editor_template_src.js similarity index 99% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/editor_template_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/editor_template_src.js index 4cbdb93b245a8..00b404a3d05c9 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/editor_template_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/editor_template_src.js @@ -386,7 +386,7 @@ return v == sv; }); - if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] == v['class'])) { + if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] && cur.value['class'] == v['class'])) { c.select(null); } @@ -593,7 +593,11 @@ if (evt.altKey) { if (evt.keyCode === DOM_VK_F10) { - window.focus(); + // Make sure focus is given to toolbar in Safari. + // We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame + if (tinymce.isWebKit) { + window.focus(); + } t.toolbarGroup.focus(); return Event.cancel(evt); } else if (evt.keyCode === DOM_VK_F11) { @@ -1221,7 +1225,7 @@ ed.windowManager.open({ url : this.url + '/charmap.htm', width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), - height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), + height : 265 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), inline : true }, { theme_url : this.url diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/image.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/image.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/image.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/image.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/colorpicker.jpg b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/colorpicker.jpg similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/colorpicker.jpg rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/colorpicker.jpg diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/flash.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/flash.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/flash.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/flash.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/icons.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/icons.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/icons.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/icons.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/iframe.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/iframe.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/iframe.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/iframe.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/pagebreak.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/pagebreak.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/pagebreak.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/pagebreak.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/quicktime.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/quicktime.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/quicktime.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/quicktime.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/realmedia.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/realmedia.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/realmedia.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/realmedia.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/shockwave.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/shockwave.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/shockwave.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/shockwave.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/trans.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/trans.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/trans.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/trans.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/video.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/video.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/video.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/video.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/windowsmedia.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/windowsmedia.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/img/windowsmedia.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/img/windowsmedia.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/about.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/about.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/about.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/about.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/anchor.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/anchor.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/anchor.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/anchor.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/charmap.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/charmap.js similarity index 97% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/charmap.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/charmap.js index 78bc080e182b5..cbb4172bacbbc 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/charmap.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/charmap.js @@ -281,13 +281,21 @@ tinyMCEPopup.onInit.add(function() { function addKeyboardNavigation(){ var tableElm, cells, settings; - cells = tinyMCEPopup.dom.select(".charmaplink", "charmapgroup"); + cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup"); settings ={ root: "charmapgroup", items: cells }; - + cells[0].tabindex=0; + tinyMCEPopup.dom.addClass(cells[0], "mceFocus"); + if (tinymce.isGecko) { + cells[0].focus(); + } else { + setTimeout(function(){ + cells[0].focus(); + }, 100); + } tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom); } @@ -306,7 +314,7 @@ function renderCharMapHTML() { previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');'; html += '' + '' - + '' + + '' + charmap[i][1] + ''; if ((cols+1) % charsPerRow == 0) diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/color_picker.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/color_picker.js similarity index 98% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/color_picker.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/color_picker.js index cdf8c4c0c4c2f..3cbf32c4f2fcf 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/color_picker.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/color_picker.js @@ -1,6 +1,6 @@ tinyMCEPopup.requireLangPack(); -var detail = 50, strhex = "0123456789ABCDEF", i, isMouseDown = false, isMouseOver = false; +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; var colors = [ "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", @@ -266,10 +266,10 @@ function dechex(n) { } function computeColor(e) { - var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB, pos = tinyMCEPopup.dom.getPos(e.target); - x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); - y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - pos.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - pos.y : 0); partWidth = document.getElementById('colors').width / 6; partDetail = detail / 2; diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/image.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/image.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/image.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/image.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/link.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/link.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/link.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/link.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/source_editor.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/source_editor.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/js/source_editor.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/js/source_editor.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/langs/en.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/langs/en.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/langs/en.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/langs/en.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/langs/en_dlg.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/langs/en_dlg.js new file mode 100644 index 0000000000000..42c9a13c85243 --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/langs/en_dlg.js @@ -0,0 +1 @@ +tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","":""}); diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/link.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/link.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/link.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/link.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/shortcuts.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/shortcuts.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/shortcuts.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/shortcuts.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/content.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/content.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/content.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/content.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/dialog.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/dialog.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/dialog.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/dialog.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/buttons.png b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/buttons.png similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/buttons.png rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/buttons.png diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/items.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/items.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/items.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/items.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/menu_arrow.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/menu_arrow.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/menu_arrow.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/menu_arrow.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/menu_check.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/menu_check.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/menu_check.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/menu_check.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/progress.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/progress.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/progress.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/progress.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/tabs.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/tabs.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/img/tabs.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/img/tabs.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/ui.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/ui.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/default/ui.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/default/ui.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/highcontrast/content.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/highcontrast/content.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/highcontrast/content.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/highcontrast/content.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/highcontrast/dialog.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/highcontrast/dialog.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/highcontrast/dialog.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/highcontrast/dialog.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/highcontrast/ui.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/highcontrast/ui.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/highcontrast/ui.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/highcontrast/ui.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/content.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/content.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/content.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/content.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/dialog.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/dialog.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/dialog.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/dialog.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/img/button_bg.png b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/img/button_bg.png similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/img/button_bg.png rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/img/button_bg.png diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/img/button_bg_black.png b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/img/button_bg_black.png similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/img/button_bg_black.png rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/img/button_bg_black.png diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/img/button_bg_silver.png b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/img/button_bg_silver.png similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/img/button_bg_silver.png rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/img/button_bg_silver.png diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/ui.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/ui.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/ui.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/ui.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/ui_black.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/ui_black.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/ui_black.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/ui_black.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/ui_silver.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/ui_silver.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/skins/o2k7/ui_silver.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/skins/o2k7/ui_silver.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/source_editor.htm b/lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/source_editor.htm similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/advanced/source_editor.htm rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/advanced/source_editor.htm diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/editor_template.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/editor_template.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/editor_template.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/editor_template.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/editor_template_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/editor_template_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/editor_template_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/editor_template_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/img/icons.gif b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/img/icons.gif similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/img/icons.gif rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/img/icons.gif diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/langs/en.js b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/langs/en.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/langs/en.js rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/langs/en.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/default/content.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/default/content.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/default/content.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/default/content.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/default/ui.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/default/ui.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/default/ui.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/default/ui.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/o2k7/content.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/o2k7/content.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/o2k7/content.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/o2k7/content.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/o2k7/img/button_bg.png b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/o2k7/img/button_bg.png similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/o2k7/img/button_bg.png rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/o2k7/img/button_bg.png diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/o2k7/ui.css b/lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/o2k7/ui.css similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/themes/simple/skins/o2k7/ui.css rename to lib/editor/tinymce/tiny_mce/3.4.9/themes/simple/skins/o2k7/ui.css diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce.js new file mode 100644 index 0000000000000..86dc3f503a58c --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce.js @@ -0,0 +1 @@ +(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m0?d:[g.scope]);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,i,d,c,h;e=tinymce.trim(e);g=f.settings=g||{};if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^[\w-]*:?\/\//.test(e)){h=g.base_uri?g.base_uri.path:new tinymce.util.URI(location.href).directory;e=((g.base_uri&&g.base_uri.protocol)||"http")+"://mce_host"+f.toAbsPath(h,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){if(o.hasOwnProperty(i)){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={DELETE:46,BACKSPACE:8,ENTER:13,TAB:9,SPACEBAR:32,UP:38,DOWN:40,modifierPressed:function(b){return b.shiftKey||b.ctrlKey||b.altKey}}})(tinymce);(function(l){var j=l.VK,k=j.BACKSPACE,h=j.DELETE;function c(n){var p=n.dom,o=n.selection;n.onKeyDown.add(function(r,v){var q,x,t,u,s;s=v.keyCode==h;if((s||v.keyCode==k)&&!j.modifierPressed(v)){v.preventDefault();q=o.getRng();x=p.getParent(q.startContainer,p.isBlock);if(s){x=p.getNext(x,p.isBlock)}if(x){t=x.firstChild;while(t&&t.nodeType==3&&t.nodeValue.length==0){t=t.nextSibling}if(t&&t.nodeName==="SPAN"){u=t.cloneNode(false)}}r.getDoc().execCommand(s?"ForwardDelete":"Delete",false,null);x=p.getParent(q.startContainer,p.isBlock);l.each(p.select("span.Apple-style-span,font.Apple-style-span",x),function(y){var z=o.getBookmark();if(u){p.replace(u.cloneNode(false),y,true)}else{p.remove(y,true)}o.moveToBookmark(z)})}})}function d(n){function o(r){var q=n.dom.create("body");var s=r.cloneContents();q.appendChild(s);return n.selection.serializer.serialize(q,{format:"html"})}function p(q){var s=o(q);var t=n.dom.createRng();t.selectNode(n.getBody());var r=o(t);return s===r}n.onKeyDown.addToTop(function(r,t){var s=t.keyCode;if(s==h||s==k){var q=r.selection.getRng(true);if(!q.collapsed&&p(q)){r.setContent("",{format:"raw"});r.nodeChanged();t.preventDefault()}}})}function b(n){n.dom.bind(n.getDoc(),"focusin",function(){n.selection.setRng(n.selection.getRng())})}function e(n){n.onKeyDown.add(function(o,r){if(r.keyCode===k){if(o.selection.isCollapsed()&&o.selection.getRng(true).startOffset===0){var q=o.selection.getNode();var p=q.previousSibling;if(p&&p.nodeName&&p.nodeName.toLowerCase()==="hr"){o.dom.remove(p);l.dom.Event.cancel(r)}}}})}function g(n){if(!Range.prototype.getClientRects){n.onMouseDown.add(function(p,q){if(q.target.nodeName==="HTML"){var o=p.getBody();o.blur();setTimeout(function(){o.focus()},0)}})}}function f(n){n.onClick.add(function(o,p){p=p.target;if(/^(IMG|HR)$/.test(p.nodeName)){o.selection.getSel().setBaseAndExtent(p,0,p,1)}if(p.nodeName=="A"&&o.dom.hasClass(p,"mceItemAnchor")){o.selection.select(p)}o.nodeChanged()})}function i(n){n.onKeyDown.add(function(o,p){function q(r){var s=r.selection.getNode();var t="h1,h2,h3,h4,h5,h6";return r.dom.is(s,t)||r.dom.getParent(s,t)!==null}if(p.keyCode===j.ENTER&&!j.modifierPressed(p)&&q(o)){setTimeout(function(){var r=o.selection.getNode();if(o.dom.is(r,"p")){o.dom.setAttrib(r,"style",null);o.execCommand("mceCleanup")}},0)}})}function m(n){var p,o;n.dom.bind(n.getDoc(),"selectionchange",function(){if(o){clearTimeout(o);o=0}o=window.setTimeout(function(){var q=n.selection.getRng();if(!p||!l.dom.RangeUtils.compareRanges(q,p)){n.nodeChanged();p=q}},50)})}function a(n){document.body.setAttribute("role","application")}l.create("tinymce.util.Quirks",{Quirks:function(n){if(l.isWebKit){c(n);d(n);b(n);f(n);if(l.isIDevice){m(n)}}if(l.isIE){e(n);d(n);a(n);i(n)}if(l.isGecko){e(n);g(n)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";l=d(l,",",d(l.toUpperCase()));h=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,audio,object"),g);b=d("pre,script,style,textarea");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(r){var A=this,n={},o={},y=[],q,p;r=r||{};if(r.verify_html===false){r.valid_elements="*[*]"}if(r.valid_styles){q={};k(r.valid_styles,function(C,B){q[B]=m.explode(C)})}p=r.whitespace_elements?d(r.whitespace_elements):b;function z(B){return new RegExp("^"+B.replace(/([?+*])/g,".$1")+"$")}function t(I){var H,D,W,S,X,C,F,R,U,N,V,Z,L,G,T,B,P,E,Y,aa,M,Q,K=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,O=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,J=/[*?+]/;if(I){I=i(I);if(n["@"]){P=n["@"].attributes;E=n["@"].attributesOrder}for(H=0,D=I.length;H=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},select:function(l,k){var j=this;return h.dom.Sizzle(l,j.get(k)||j.get(j.settings.root_element)||j.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(a.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return h.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(q){var p=k.settings;var n=q.getAttribute(m);if(j!==null){switch(m){case"style":if(!e(j,"string")){f(j,function(r,s){k.setStyle(q,s,r)});return}if(p.keep_values){if(j&&!k._isRes(j)){q.setAttribute("data-mce-style",j,2)}else{q.removeAttribute("data-mce-style",2)}}q.style.cssText=j;break;case"class":q.className=j||"";break;case"src":case"href":if(p.keep_values){if(p.url_converter){j=p.url_converter.call(p.url_converter_scope||k,j,m,q)}k.setAttrib(q,"data-mce-"+m,j,2)}break;case"shape":q.setAttribute("data-mce-style",j);break}}if(e(j)&&j!==null&&j.length!==0){q.setAttribute(m,""+j,2)}else{q.removeAttribute(m,2)}if(tinyMCE.activeEditor&&n!=j){var o=tinyMCE.activeEditor;o.onSetAttrib.dispatch(o,q,m,j)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(o,p,l){var j,k=this,m;o=k.get(o);if(!o||o.nodeType!==1){return l===m?false:l}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(p)){j=o.getAttribute("data-mce-"+p);if(j){return j}}if(b&&k.props[p]){j=o[k.props[p]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=o.getAttribute(p,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(p)){if(o[k.props[p]]===true&&j===""){return p}return j?p:""}if(o.nodeName==="FORM"&&o.getAttributeNode(p)){return o.getAttributeNode(p).nodeValue}if(p==="style"){j=j||o.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),o.nodeName);if(k.settings.keep_values&&!k._isRes(j)){o.setAttribute("data-mce-style",j)}}}if(d&&p==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(p){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return p}return l;case"shape":j=j.toLowerCase();break;default:if(p.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==m&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
    "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
    "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p;m=m.firstChild;if(m){j=new h.dom.TreeWalker(m);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){p=m.parentNode;if(l==="br"&&r.isBlock(p)&&p.firstChild===m&&p.lastChild===m){continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if(q==8){return false}if((q===3&&!i.test(m.nodeValue))){return false}}while(m=j.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(x){var u,t=x.childNodes,v=x.nodeType;function y(B){var A=B.previousSibling&&B.previousSibling.nodeName=="SPAN";var z=B.nextSibling&&B.nextSibling.nodeName=="SPAN";return A&&z}if(v==1&&x.getAttribute("data-mce-type")=="bookmark"){return}for(u=t.length-1;u>=0;u--){k(t[u])}if(v!=9){if(v==3&&x.nodeValue.length>0){var r=h.trim(x.nodeValue).length;if(!s.isBlock(x.parentNode)||r>0||r==0&&y(x)){return}}else{if(v==1){t=x.childNodes;if(t.length==1&&t[0]&&t[0].nodeType==1&&t[0].getAttribute("data-mce-type")=="bookmark"){x.parentNode.insertBefore(t[0],x)}if(t.length||/^(br|hr|input|img)$/i.test(x.nodeName)){return}}}s.remove(x)}return x}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p&&t.nodeType!==9){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1&&p==q-1){if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return re[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="

    ";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="
    ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.readyState==="complete"){g._pageInit(i);return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='_';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('_'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
    ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.rangeCount>0?h.getRangeAt(0):null}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(o,g){var m=this,j=m.dom,l,k,h,i=[];l=j.getParent(o||m.getStart(),j.isBlock);k=j.getParent(g||m.getEnd(),j.isBlock);if(l){i.push(l)}if(l&&k&&l!=k){h=l;var f=new c.dom.TreeWalker(l,j.getRoot());while((h=f.next())&&h!=k){if(j.isBlock(h)){i.push(h)}}}if(k&&l!=k){i.push(k)}return i},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;i=true;break}if(/^(BR|IMG)$/.test(l.nodeName)){o=m.nodeIndex(l);k=l.parentNode;if(l.nodeName=="IMG"&&!p){o++}i=true;break}}while(l=(p?n.next():n.prev()))}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(!f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";e.remove_trailing_brs="remove_trailing_brs" in e?e.remove_trailing_brs:true;h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF|\u200B/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,s){var i=d.startContainer,l=d.startOffset,t=d.endContainer,m=d.endOffset,j,g,o,h,r,q,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(u){s([u])});return}function f(u){var v;v=u[0];if(v.nodeType===3&&v===i&&l>=v.nodeValue.length){u.splice(0,1)}v=u[u.length-1];if(m===0&&u.length>0&&v===t&&v.nodeType===3){u.splice(u.length-1,1)}return u}function p(x,v,u){var y=[];for(;x&&x!=u;x=x[v]){y.push(x)}return y}function n(v,u){do{if(v.parentNode==u){return v}v=v.parentNode}while(v)}function k(x,v,y){var u=y?"nextSibling":"previousSibling";for(h=x,r=h.parentNode;h&&h!=v;h=r){r=h.parentNode;q=p(h==x?h:h[u],u);if(q.length){if(!y){q.reverse()}s(f(q))}}}if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[l]}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[Math.min(m-1,t.childNodes.length-1)]}if(i==t){return s(f([i]))}j=c.findCommonAncestor(i,t);for(h=i;h;h=h.parentNode){if(h===t){return k(i,j,true)}if(h===j){break}}for(h=t;h;h=h.parentNode){if(h===i){return k(t,j)}if(h===j){break}}g=n(i,j)||i;o=n(t,j)||t;k(i,g,true);q=p(g==i?g:g.nextSibling,"nextSibling",o==t?o.nextSibling:o);if(q.length){s(f(q))}k(t,o)};this.split=function(e){var h=e.startContainer,d=e.startOffset,i=e.endContainer,g=e.endOffset;function f(j,k){return j.splitText(k)}if(h==i&&h.nodeType==3){if(d>0&&dd){g=g-d;h=i=f(i,g).previousSibling;g=i.nodeValue.length;d=0}else{g=0}}}else{if(h.nodeType==3&&d>0&&d0&&g=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.get("menu_"+g.id);h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var d=this,e=d.settings,c;if(b.isIE&&d.editor){b.dom.Event.add(d.id,"mousedown",function(f){var g=d.editor.selection.getNode().nodeName;c=g==="IMG"?d.editor.selection.getBookmark():null})}b.dom.Event.add(d.id,"click",function(f){if(!d.isDisabled()){if(b.isIE&&d.editor&&c!==null){d.editor.selection.moveToBookmark(c)}return e.onclick.call(e.scope,f)}});b.dom.Event.add(d.id,"keyup",function(f){if(!d.isDisabled()&&f.keyCode==b.VK.SPACEBAR){return e.onclick.call(e.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(m){m=m.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");var i={href:"javascript:;",style:{backgroundColor:"#"+m},title:p.editor.getLang("colors."+m,m),"data-mce-color":"#"+m};if(!d.isIE){i.role="option"}g=c.add(g,"a",i);if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+m;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){return;var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:q.convertURL,url_converter_scope:q,ie7_compat:true},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=n.baseURI;q.contentCSS=[];q.execCallback("setup",q)},render:function(u){var v=this,x=v.settings,y=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}tinyMCE.settings=x;if(!v.getElement()){return}if(n.isIDevice&&!n.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&x.hidden_input&&o.getParent(y,"form")){o.insertAfter(o.create("input",{type:"hidden",name:y}),y)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(x.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(x.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(x.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(x.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){n.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(x.language&&x.language_load!==false){q.add(n.baseURL+"/../../extra/strings.php?elanguage="+x.language+"ðeme="+x.theme)}if(x.theme&&x.theme.charAt(0)!="-"&&!h.urls[x.theme]){h.load(x.theme,"themes/"+x.theme+"/editor_template"+n.suffix+".js")}i(g(x.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(A){var z={prefix:"plugins/",resource:A,suffix:"/editor_plugin"+n.suffix+".js"};var A=c.createUrl(z,A);c.load(A.resource,A)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+n.suffix+".js"})}}});q.loadQueue(function(){if(!v.removed){v.init()}})}r()},init:function(){var v,I=this,J=I.settings,F,B,E=I.getElement(),r,q,G,z,D,H,A,x=[];n.add(I);J.aria_label=J.aria_label||o.getAttrib(E,"aria-label",I.getLang("aria.rich_text_area"));if(J.theme){J.theme=J.theme.replace(/-/,"");r=h.get(J.theme);I.theme=new r();if(I.theme.init&&J.init_theme){I.theme.init(I,h.urls[J.theme]||n.documentBaseURL.replace(/\/$/,""))}}function C(K){var L=c.get(K),t=c.urls[K]||n.documentBaseURL.replace(/\/$/,""),s;if(L&&n.inArray(x,K)===-1){i(c.dependencies(K),function(u){C(u)});s=new L(I,t);I.plugins[K]=s;if(s.init){s.init(I,t);x.push(K)}}}i(g(J.plugins.replace(/\-/g,"")),C);if(J.popup_css!==false){if(J.popup_css){J.popup_css=I.documentBaseURI.toAbsolute(J.popup_css)}else{J.popup_css=I.baseURI.toAbsolute("themes/"+J.theme+"/skins/"+J.skin+"/dialog.css")}}if(J.popup_css_add){J.popup_css+=","+I.documentBaseURI.toAbsolute(J.popup_css_add)}I.controlManager=new n.ControlManager(I);if(J.custom_undo_redo){I.onBeforeExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.beforeChange()}});I.onExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.add()}})}I.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){I.nodeChanged()}});if(a){function y(s,t){if(!t||!t.initial){I.execCommand("mceRepaint")}}I.onUndo.add(y);I.onRedo.add(y);I.onSetContent.add(y)}I.onBeforeRenderUI.dispatch(I,I.controlManager);if(J.render_ui){F=J.width||E.style.width||E.offsetWidth;B=J.height||E.style.height||E.offsetHeight;I.orgDisplay=E.style.display;H=/^[0-9\.]+(|px)$/i;if(H.test(""+F)){F=Math.max(parseInt(F)+(r.deltaWidth||0),100)}if(H.test(""+B)){B=Math.max(parseInt(B)+(r.deltaHeight||0),J.theme_advanced_resizing_min_height||100)}r=I.theme.renderUI({targetNode:E,width:F,height:B,deltaWidth:J.delta_width,deltaHeight:J.delta_height});I.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:F,height:B});if(J.content_css){n.each(g(J.content_css),function(s){I.contentCSS.push(I.documentBaseURI.toAbsolute(s))})}B=(r.iframeHeight||B)+(typeof(B)=="number"?(r.deltaHeight||0):"");if(B<(J.theme_advanced_resizing_min_height||100)){B=J.theme_advanced_resizing_min_height||100}I.iframeHTML=J.doctype+'';if(J.document_base_url!=n.documentBaseURL){I.iframeHTML+=''}if(J.ie7_compat){I.iframeHTML+=''}else{I.iframeHTML+=''}I.iframeHTML+='';for(A=0;A'}I.contentCSS=[];z=J.body_id||"tinymce";if(z.indexOf("=")!=-1){z=I.getParam("body_id","","hash");z=z[I.id]||z}D=J.body_class||"";if(D.indexOf("=")!=-1){D=I.getParam("body_class","","hash");D=D[I.id]||""}I.iframeHTML+='
    ";if(n.relaxedDomain&&(b||(n.isOpera&&parseFloat(opera.version())<11))){G='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+I.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}v=o.add(r.iframeContainer,"iframe",{id:I.id+"_ifr",src:G||'javascript:""',frameBorder:"0",allowTransparency:"true",title:J.aria_label,style:{width:"100%",height:B,display:"block"}});I.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=I.orgDisplay;o.get(I.id).style.display="none";o.setAttrib(I.id,"aria-hidden",true);if(!n.relaxedDomain||!G){I.setupIframe()}E=v=r=null},setupIframe:function(){var r=this,x=r.settings,y=o.get(r.id),z=r.getDoc(),v,q;if(!b||!n.relaxedDomain){z.open();z.write(r.iframeHTML);z.close();if(n.relaxedDomain){z.domain=n.relaxedDomain}}q=r.getBody();q.disabled=true;if(!x.readonly){q.contentEditable=true}q.disabled=false;r.schema=new n.html.Schema(x);r.dom=new n.dom.DOMUtils(r.getDoc(),{keep_values:true,url_converter:r.convertURL,url_converter_scope:r,hex_colors:x.force_hex_style_colors,class_filter:x.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:r.schema});r.parser=new n.html.DomParser(x,r.schema);if(!r.settings.allow_html_in_named_anchor){r.parser.addAttributeFilter("name",function(s,t){var B=s.length,D,A,C,E;while(B--){E=s[B];if(E.name==="a"&&E.firstChild){C=E.parent;D=E.lastChild;do{A=D.prev;C.insert(D,E);D=A}while(D)}}})}r.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,C,E=r.dom,D,B;while(A--){C=s[A];D=C.attr(t);B="data-mce-"+t;if(!C.attributes.map[B]){if(t==="style"){C.attr(B,E.serializeStyle(E.parseStyle(D),C.name))}else{C.attr(B,r.convertURL(D,t,C.name))}}}});r.parser.addNodeFilter("script",function(s,t){var A=s.length,B;while(A--){B=s[A];B.attr("type","mce-"+(B.attr("type")||"text/javascript"))}});r.parser.addNodeFilter("#cdata",function(s,t){var A=s.length,B;while(A--){B=s[A];B.type=8;B.name="#comment";B.value="[CDATA["+B.value+"]]"}});r.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=r.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new n.html.Node("br",1)).shortEnded=true}}});r.serializer=new n.dom.Serializer(x,r.dom,r.schema);r.selection=new n.dom.Selection(r.dom,r.getWin(),r.serializer);r.formatter=new n.Formatter(this);r.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(A,s,t){i(t,function(C,B){r.dom.setAttrib(A,B,C)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){r.formatter.register(s,{block:s,remove:"all"})});r.formatter.register(r.settings.formats);r.undoManager=new n.UndoManager(r);r.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return r.onChange.dispatch(r,s,t)}});r.undoManager.onUndo.add(function(t,s){return r.onUndo.dispatch(r,s,t)});r.undoManager.onRedo.add(function(t,s){return r.onRedo.dispatch(r,s,t)});r.forceBlocks=new n.ForceBlocks(r,{forced_root_block:x.forced_root_block});r.editorCommands=new n.EditorCommands(r);r.serializer.onPreProcess.add(function(s,t){return r.onPreProcess.dispatch(r,t,s)});r.serializer.onPostProcess.add(function(s,t){return r.onPostProcess.dispatch(r,t,s)});r.onPreInit.dispatch(r);if(!x.gecko_spellcheck){r.getBody().spellcheck=0}if(!x.readonly){r._addEvents()}r.controlManager.onPostRender.dispatch(r,r.controlManager);r.onPostRender.dispatch(r);r.quirks=new n.util.Quirks(this);if(x.directionality){r.getBody().dir=x.directionality}if(x.nowrap){r.getBody().style.whiteSpace="nowrap"}if(x.handle_node_change_callback){r.onNodeChange.add(function(t,s,A){r.execCallback("handle_node_change_callback",r.id,A,-1,-1,true,r.selection.isCollapsed())})}if(x.save_callback){r.onSaveContent.add(function(s,A){var t=r.execCallback("save_callback",r.id,A.content,r.getBody());if(t){A.content=t}})}if(x.onchange_callback){r.onChange.add(function(t,s){r.execCallback("onchange_callback",r,s)})}if(x.protect){r.onBeforeSetContent.add(function(s,t){if(x.protect){i(x.protect,function(A){t.content=t.content.replace(A,function(B){return""})})}})}if(x.convert_newlines_to_brs){r.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
    ")}})}if(x.preformatted){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
    '+t.content+"
    "}})}if(x.verify_css_classes){r.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!r.classesRE){t=r.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});r.classesRE=new RegExp("("+B+")","gi")}}return !r.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||r.classesRE.test(A)?A:""}return A}}if(x.cleanup_callback){r.onBeforeSetContent.add(function(s,t){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)});r.onPreProcess.add(function(s,t){if(t.set){r.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){r.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});r.onPostProcess.add(function(s,t){if(t.set){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=r.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(x.save_callback){r.onGetContent.add(function(s,t){if(t.save){t.content=r.execCallback("save_callback",r.id,t.content,r.getBody())}})}if(x.handle_event_callback){r.onEvent.add(function(s,t,A){if(r.execCallback("handle_event_callback",t,s,A)===false){k.cancel(t)}})}r.onSetContent.add(function(){r.addVisual(r.getBody())});if(x.padd_empty_editor){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}if(a){function u(s,t){i(s.dom.select("a"),function(B){var A=B.parentNode;if(s.dom.isBlock(A)&&A.lastChild===B){s.dom.add(A,"br",{"data-mce-bogus":1})}})}r.onExecCommand.add(function(s,t){if(t==="CreateLink"){u(s)}});r.onSetContent.add(r.selection.onSetContent.add(u))}r.load({initial:true,format:"html"});r.startContent=r.getContent({format:"raw"});r.undoManager.add();r.initialized=true;r.onInit.dispatch(r);r.execCallback("setupcontent_callback",r.id,r.getBody(),r.getDoc());r.execCallback("init_instance_callback",r);r.focus(true);r.nodeChanged({initial:1});i(r.contentCSS,function(s){r.dom.loadCSS(s)});if(x.auto_focus){setTimeout(function(){var s=n.get(x.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}y=null},focus:function(v){var z,r=this,u=r.selection,y=r.settings.content_editable,s,q,x=r.getDoc();if(!v){s=u.getRng();if(s.item){q=s.item(0)}r._refreshContentEditable();if(!y){r.getWin().focus()}if(n.isGecko){r.getBody().focus()}if(q&&q.ownerDocument==x){s=x.body.createControlRange();s.addElement(q);s.select()}}if(n.activeEditor!=r){if((z=n.activeEditor)!=null){z.onDeactivate.dispatch(z,r)}r.onActivate.dispatch(r,z)}n._setActive(r)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=n.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return n.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(x,s,q){var t=n.trim,r=d(this.settings[x])?this.settings[x]:s,u;if(q==="hash"){u={};if(d(r,"string")){i(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(y){y=y.split("=");if(y.length>1){u[t(y[0])]=t(y[1])}else{u[t(y[0])]=t(y)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getStart()||q.getBody();if(q.initialized){u=u||{};v=b&&v.ownerDocument!=q.getDoc()?q.getBody():v;u.parents=[];q.dom.getParent(v,function(s){if(s.nodeName=="BODY"){return true}u.parents.push(s)});q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(q,s,r){this.execCommands[q]={func:s,scope:r||this}},addQueryStateHandler:function(q,s,r){this.queryStateCommands[q]={func:s,scope:r||this}},addQueryValueHandler:function(q,s,r){this.queryValueCommands[q]={func:s,scope:r||this}},addShortcut:function(s,v,q,u){var r=this,x;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){x=q;q=function(){r.execCommand(x,false,null)}}if(d(q,"object")){x=q;q=function(){r.execCommand(x[0],x[1],x[2])}}i(g(s),function(t){var y={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(z){switch(z){case"alt":case"ctrl":case"shift":y[z]=true;break;default:y.charCode=z.charCodeAt(0);y.keyCode=z.toUpperCase().charCodeAt(0)}});r.shortcuts[(y.ctrl?"ctrl":"")+","+(y.alt?"alt":"")+","+(y.shift?"shift":"")+","+y.keyCode]=y});return true},execCommand:function(y,x,A,q){var u=this,v=0,z,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(y)&&(!q||!q.skip_focus)){u.focus()}q=f({},q);u.onBeforeExecCommand.dispatch(u,y,x,A,q);if(q.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(z=u.execCommands[y]){r=z.func.call(z.scope,x,A);if(r!==true){u.onExecCommand.dispatch(u,y,x,A,q);return r}}i(u.plugins,function(s){if(s.execCommand&&s.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(u.editorCommands.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}u.getDoc().execCommand(y,x,A);u.onExecCommand.dispatch(u,y,x,A,q)},queryCommandState:function(v){var r=this,x,u;if(r._isHidden()){return}if(x=r.queryStateCommands[v]){u=x.func.call(x.scope);if(u!==true){return u}}x=r.editorCommands.queryCommandState(v);if(x!==-1){return x}try{return this.getDoc().queryCommandState(v)}catch(q){}},queryCommandValue:function(x){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[x]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(x);if(d(v)){return v}try{return this.getDoc().queryCommandValue(x)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=false;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){i(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(v,t){var s=this,r,q=s.getBody(),u;t=t||{};t.format=t.format||"html";t.set=true;t.content=v;if(!t.no_events){s.onBeforeSetContent.dispatch(s,t)}v=t.content;if(!n.isIE&&(v.length===0||/^\s+$/.test(v))){u=s.settings.forced_root_block;if(u){v="<"+u+'>
    "}else{v='
    '}q.innerHTML=v;s.selection.select(q,true);s.selection.collapse(true);return}if(t.format!=="raw"){v=new n.html.Serializer({},s.schema).serialize(s.parser.parse(v))}t.content=n.trim(v);s.dom.setHTML(q,t.content);if(!t.no_events){s.onSetContent.dispatch(s,t)}s.selection.normalize();return t.content},getContent:function(r){var q=this,s;r=r||{};r.format=r.format||"html";r.get=true;if(!r.no_events){q.onBeforeGetContent.dispatch(q,r)}if(r.format=="raw"){s=q.getBody().innerHTML}else{s=q.serializer.serialize(q.getBody(),r)}r.content=n.trim(s);if(!r.no_events){q.onGetContent.dispatch(q,r)}return r.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,y,x){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,x,true,y)}if(!v.convert_urls||(x&&x.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}i(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];n.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var D=this,u,E=D.settings,r=D.dom,y={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function q(t,F){var s=t.type;if(D.removed){return}if(D.onEvent.dispatch(D,t,F)!==false){D[y[t.fakeType||t.type]].dispatch(D,t,F)}}i(y,function(t,s){switch(s){case"contextmenu":r.bind(D.getDoc(),s,q);break;case"paste":r.bind(D.getBody(),s,function(F){q(F)});break;case"submit":case"reset":r.bind(D.getElement().form||o.getParent(D.id,"form"),s,q);break;default:r.bind(E.content_editable?D.getBody():D.getDoc(),s,q)}});r.bind(E.content_editable?D.getBody():(a?D.getDoc():D.getWin()),"focus",function(s){D.focus(true)});if(n.isGecko){r.bind(D.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=D.documentBaseURI.toAbsolute(s)}})}if(a){function v(){var G=this,I=G.getDoc(),H=G.settings;if(a&&!H.readonly){G._refreshContentEditable();try{I.execCommand("styleWithCSS",0,false)}catch(F){if(!G._isHidden()){try{I.execCommand("useCSS",0,true)}catch(F){}}}if(!H.table_inline_editing){try{I.execCommand("enableInlineTableEditing",false,false)}catch(F){}}if(!H.object_resizing){try{I.execCommand("enableObjectResizing",false,false)}catch(F){}}}}D.onBeforeExecCommand.add(v);D.onMouseDown.add(v)}D.onMouseUp.add(D.nodeChanged);D.onKeyUp.add(function(s,t){var F=t.keyCode;if((F>=33&&F<=36)||(F>=37&&F<=40)||F==13||F==45||F==46||F==8||(n.isMac&&(F==91||F==93))||t.ctrlKey){D.nodeChanged()}});D.onKeyDown.add(function(t,F){if(F.keyCode!=j.BACKSPACE){return}var s=t.selection.getRng();if(!s.collapsed){return}var H=s.startContainer;var G=s.startOffset;while(H&&H.nodeType&&H.nodeType!=1&&H.parentNode){H=H.parentNode}if(H&&H.parentNode&&H.parentNode.tagName==="BLOCKQUOTE"&&H.parentNode.firstChild==H&&G==0){t.formatter.toggle("blockquote",null,H.parentNode);s.setStart(H,0);s.setEnd(H,0);t.selection.setRng(s);t.selection.collapse(false)}});D.onReset.add(function(){D.setContent(D.startContent,{format:"raw"})});if(E.custom_shortcuts){if(E.custom_undo_redo_keyboard_shortcuts){D.addShortcut("ctrl+z",D.getLang("undo_desc"),"Undo");D.addShortcut("ctrl+y",D.getLang("redo_desc"),"Redo")}D.addShortcut("ctrl+b",D.getLang("bold_desc"),"Bold");D.addShortcut("ctrl+i",D.getLang("italic_desc"),"Italic");D.addShortcut("ctrl+u",D.getLang("underline_desc"),"Underline");for(u=1;u<=6;u++){D.addShortcut("ctrl+"+u,"",["FormatBlock",false,"h"+u])}D.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);D.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);D.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function x(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(D.shortcuts,function(F){if(n.isMac&&F.ctrl!=t.metaKey){return}else{if(!n.isMac&&F.ctrl!=t.ctrlKey){return}}if(F.alt!=t.altKey){return}if(F.shift!=t.shiftKey){return}if(t.keyCode==F.keyCode||(t.charCode&&t.charCode==F.charCode)){s=F;return false}});return s}D.onKeyUp.add(function(s,t){var F=x(t);if(F){return k.cancel(t)}});D.onKeyPress.add(function(s,t){var F=x(t);if(F){return k.cancel(t)}});D.onKeyDown.add(function(s,t){var F=x(t);if(F){F.func.call(F.scope);return k.cancel(t)}})}if(n.isIE){r.bind(D.getDoc(),"controlselect",function(F){var t=D.resizeInfo,s;F=F.target;if(F.nodeName!=="IMG"){return}if(t){r.unbind(t.node,t.ev,t.cb)}if(!r.hasClass(F,"mceItemNoResize")){ev="resizeend";s=r.bind(F,ev,function(H){var G;H=H.target;if(G=r.getStyle(H,"width")){r.setAttrib(H,"width",G.replace(/[^0-9%]+/g,""));r.setStyle(H,"width","")}if(G=r.getStyle(H,"height")){r.setAttrib(H,"height",G.replace(/[^0-9%]+/g,""));r.setStyle(H,"height","")}})}else{ev="resizestart";s=r.bind(F,"resizestart",k.cancel,k)}t=D.resizeInfo={node:F,ev:ev,cb:s}})}if(n.isOpera){D.onClick.add(function(s,t){k.prevent(t)})}if(E.custom_undo_redo){function A(){D.undoManager.typing=false;D.undoManager.add()}var z=n.isGecko?"blur":"focusout";r.bind(D.getDoc(),z,function(s){if(!D.removed&&D.undoManager.typing){A()}});D.dom.bind(D.dom.getRoot(),"dragend",function(s){A()});D.onKeyUp.add(function(s,F){var t=F.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||F.ctrlKey){A()}});D.onKeyDown.add(function(s,G){var F=G.keyCode,t;if(F==8){t=D.getDoc().selection;if(t&&t.createRange&&t.createRange().item){D.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));A();return k.cancel(G)}}if((F>=33&&F<=36)||(F>=37&&F<=40)||F==13||F==45){if(n.isIE&&F==13){D.undoManager.beforeChange()}if(D.undoManager.typing){A()}return}if((F<16||F>20)&&F!=224&&F!=91&&!D.undoManager.typing){D.undoManager.beforeChange();D.undoManager.typing=true;D.undoManager.add()}});D.onMouseDown.add(function(){if(D.undoManager.typing){A()}})}if(n.isGecko){function C(){var s=D.dom.getAttribs(D.selection.getStart().cloneNode(false));return function(){var t=D.selection.getStart();if(t!==D.getBody()){D.dom.setAttrib(t,"style",null);i(s,function(F){t.setAttributeNode(F.cloneNode(true))})}}}function B(){var t=D.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}D.onKeyPress.add(function(s,F){var t;if((F.keyCode==8||F.keyCode==46)&&B()){t=C();D.getDoc().execCommand("delete",false,null);t();return k.cancel(F)}});D.dom.bind(D.getDoc(),"cut",function(t){var s;if(B()){s=C();D.onKeyUp.addToTop(k.cancel,k);setTimeout(function(){s();D.onKeyUp.remove(k.cancel,k)},0)}})}},_refreshContentEditable:function(){var r=this,q,s;if(r._isHidden()){q=r.getBody();s=q.parentNode;s.removeChild(q);s.appendChild(q);q.focus()}},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(z){var x="align"+z.substring(7);var v=p.isCollapsed()?[p.getNode()]:p.getSelectedBlocks();var y=c.map(v,function(A){return !!q.matchNode(A,x)});return c.inArray(y,a)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e0||this.typing},hasRedo:function(){return e');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
    ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"
    ");T=v.dom.add(O,V.element,null,"
    ")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"
    ")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}if(!R.body.hasChildNodes()){R.body.appendChild(M.create("br"))}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
    ";return r[0]}else{y.innerHTML=b?"\u00a0":"
    "}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(BL.y+L.h){v.getWin().scrollTo(0,B1||ab==at){return ab}}}var al=V.selection.getRng();var ap=al.startContainer;var ak=al.endContainer;if(ap!=ak&&al.endOffset==0){var ao=am(ap,ak);var an=ao.nodeType==3?ao.length:ao.childNodes.length;al.setEnd(ao,an)}return al}function Y(an,at,aq,ap,al){var ak=[],am=-1,ar,av=-1,ao=-1,au;P(an.childNodes,function(ax,aw){if(ax.nodeName==="UL"||ax.nodeName==="OL"){am=aw;ar=ax;return false}});P(an.childNodes,function(ax,aw){if(ax.nodeName==="SPAN"&&c.getAttrib(ax,"data-mce-type")=="bookmark"){if(ax.id==at.id+"_start"){av=aw}else{if(ax.id==at.id+"_end"){ao=aw}}}});if(am<=0||(avam)){P(a.grep(an.childNodes),al);return 0}else{au=aq.cloneNode(S);P(a.grep(an.childNodes),function(ax,aw){if((avam&&aw>am)){ak.push(ax);ax.parentNode.removeChild(ax)}});if(avam){an.insertBefore(au,ar.nextSibling)}}ap.push(au);P(ak,function(aw){au.appendChild(aw)});return au}}function ai(al,an,ap){var ak=[],ao,am;ao=ah.inline||ah.block;am=c.create(ao);W(am);K.walk(al,function(aq){var ar;function at(au){var ax=au.nodeName.toLowerCase(),aw=au.parentNode.nodeName.toLowerCase(),av;if(g(ax,"br")){ar=0;if(ah.block){c.remove(au)}return}if(ah.wrapper&&x(au,Z,ag)){ar=0;return}if(ah.block&&!ah.wrapper&&G(ax)){au=c.rename(au,ao);W(au);ak.push(au);ar=0;return}if(ah.selector){P(ac,function(ay){if("collapsed" in ay&&ay.collapsed!==ad){return}if(c.is(au,ay.selector)&&!b(au)){W(au,ay);av=true}});if(!ah.inline||av){ar=0;return}}if(d(ao,ax)&&d(aw,ao)&&!(!ap&&au.nodeType===3&&au.nodeValue.length===1&&au.nodeValue.charCodeAt(0)===65279)&&!b(au)){if(!ar){ar=am.cloneNode(S);au.parentNode.insertBefore(ar,au);ak.push(ar)}ar.appendChild(au)}else{if(ax=="li"&&an){ar=Y(au,an,am,ak,at)}else{ar=0;P(a.grep(au.childNodes),at);ar=0}}}P(aq,at)});if(ah.wrap_links===false){P(ak,function(aq){function ar(aw){var av,au,at;if(aw.nodeName==="A"){au=am.cloneNode(S);ak.push(au);at=a.grep(aw.childNodes);for(av=0;av1||!F(at))&&aq===0){c.remove(at,1);return}if(ah.inline||ah.wrapper){if(!ah.exact&&aq===1){at=ar(at)}P(ac,function(av){P(c.select(av.inline,at),function(ax){var aw;if(av.wrap_links===false){aw=ax.parentNode;do{if(aw.nodeName==="A"){return}}while(aw=aw.parentNode)}U(av,ag,ax,av.exact?ax:null)})});if(x(at.parentNode,Z,ag)){c.remove(at,1);at=0;return B}if(ah.merge_with_parents){c.getParent(at.parentNode,function(av){if(x(av,Z,ag)){c.remove(at,1);at=0;return B}})}if(at&&ah.merge_siblings!==false){at=u(C(at),at);at=u(at,C(at,B))}}})}if(ah){if(ab){if(ab.nodeType){X=c.createRng();X.setStartBefore(ab);X.setEndAfter(ab);ai(o(X,ac),null,true)}else{ai(ab,null,true)}}else{if(!ad||!ah.inline||c.select("td.mceSelected,th.mceSelected").length){var aj=V.selection.getNode();V.selection.setRng(aa());af=q.getBookmark();ai(o(q.getRng(B),ac),af);if(ah.styles&&(ah.styles.color||ah.styles.textDecoration)){a.walk(aj,I,"childNodes");I(aj)}q.moveToBookmark(af);N(q.getRng(B));V.nodeChanged()}else{Q("apply",Z,ag)}}}}function A(Y,ag,aa){var ab=R(Y),ai=ab[0],af,ae,X;function Z(an){var am,al,ak;am=a.grep(an.childNodes);for(al=0,ak=ab.length;al=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\t \r\n]+|)$/.test(W.nodeValue)}function O(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ai,Z){var Y=W.startContainer,ad=W.startOffset,al=W.endContainer,af=W.endOffset,ak,ah,ac,ag;function aj(ar){var am,ap,aq,ao,an;am=ap=ar?Y:al;an=ar?"previousSibling":"nextSibling";root=c.getRoot();if(am.nodeType==3&&!f(am)){if(ar?ad>0:afah?ah:ad];if(Y.nodeType==3){ad=0}}if(al.nodeType==1&&al.hasChildNodes()){ah=al.childNodes.length-1;al=al.childNodes[af>ah?ah:af-1];if(al.nodeType==3){af=al.nodeValue.length}}if(H(Y.parentNode)||H(Y)){Y=H(Y)?Y:Y.parentNode;Y=Y.nextSibling||Y;if(Y.nodeType==3){ad=0}}if(H(al.parentNode)||H(al)){al=H(al)?al:al.parentNode;al=al.previousSibling||al;if(al.nodeType==3){af=al.length}}if(ai[0].inline){if(W.collapsed){function ae(an,ar,au){var aq,ao,at,am;function ap(aw,ay){var az,av,ax=aw.nodeValue;if(typeof(ay)=="undefined"){ay=au?ax.length:0}if(au){az=ax.lastIndexOf(" ",ay);av=ax.lastIndexOf("\u00a0",ay);az=az>av?az:av;if(az!==-1&&!Z){az++}}else{az=ax.indexOf(" ",ay);av=ax.indexOf("\u00a0",ay);az=az!==-1&&(av===-1||az0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){al=ac.node;al.splitText(ac.offset-1)}else{if(ac.node.previousSibling){}}}}}if(ai[0].inline||ai[0].block_expand){if(!ai[0].inline||(Y.nodeType!=3||ad===0)){Y=aj(true)}if(!ai[0].inline||(al.nodeType!=3||af===al.nodeValue.length)){al=aj()}}if(ai[0].selector&&ai[0].expand!==S&&!ai[0].inline){function aa(an,am){var ao,ap,ar,aq;if(an.nodeType==3&&an.nodeValue.length==0&&an[am]){an=an[am]}ao=m(an);for(ap=0;apY?Y:aa]}if(W.nodeType===3&&ab&&aa>=W.nodeValue.length){W=new t(W,V.getBody()).next()||W}if(W.nodeType===3&&!ab&&aa==0){W=new t(W,V.getBody()).prev()||W}return W}function Q(af,W,ad){var ai,ag="_mce_caret",X=V.settings.caret_debug;ai=a.isGecko?"\u200B":E;function Y(ak){var aj=c.create("span",{id:ag,"data-mce-bogus":true,style:X?"color:red":""});if(ak){aj.appendChild(V.getDoc().createTextNode(ai))}return aj}function ae(ak,aj){while(ak){if((ak.nodeType===3&&ak.nodeValue!==ai)||ak.childNodes.length>1){return false}if(aj&&ak.nodeType===1){aj.push(ak)}ak=ak.firstChild}return true}function ab(aj){while(aj){if(aj.id===ag){return aj}aj=aj.parentNode}}function aa(aj){var ak;if(aj){ak=new t(aj,aj);for(aj=ak.current();aj;aj=ak.next()){if(aj.nodeType===3){return aj}}}}function Z(al,ak){var am,aj;if(!al){al=ab(q.getStart());if(!al){while(al=c.get(ag)){Z(al,false)}}}else{aj=q.getRng(true);if(ae(al)){if(ak!==false){aj.setStartBefore(al);aj.setEndBefore(al)}c.remove(al)}else{am=aa(al);if(am.nodeValue.charAt(0)===E){am=am.deleteData(0,1)}c.remove(al,1)}q.setRng(aj)}}function ac(){var al,aj,ap,ao,am,ak,an;al=q.getRng(true);ao=al.startOffset;ak=al.startContainer;an=ak.nodeValue;aj=ab(q.getStart());if(aj){ap=aa(aj)}if(an&&ao>0&&ao=0;an--){al.appendChild(ar[an].cloneNode(false));al=al.firstChild}al.appendChild(c.doc.createTextNode(ai));al=al.firstChild;c.insertAfter(aq,at);q.setCursorLocation(al,1)}}if(!self._hasCaretEvents){V.onBeforeGetContent.addToTop(function(){var aj=[],ak;if(ae(ab(q.getStart()),aj)){ak=aj.length;while(ak--){c.setAttrib(aj[ak],"data-mce-bogus","1")}}});a.each("onMouseUp onKeyUp".split(" "),function(aj){V[aj].addToTop(function(){Z()})});V.onKeyDown.addToTop(function(aj,al){var ak=al.keyCode;if(ak==8||ak==37||ak==39){Z(ab(q.getStart()))}});self._hasCaretEvents=true}if(af=="apply"){ac()}else{ah()}}function N(X){var W=X.startContainer,ac=X.startOffset,ab,aa,Y,Z;if(W.nodeType==3&&ac>=W.nodeValue.length-1){W=W.parentNode;ac=s(W)+1}if(W.nodeType==1){Y=W.childNodes;W=Y[Math.min(ac,Y.length-1)];ab=new t(W);if(ac>Y.length-1){ab.next()}for(aa=ab.current();aa;aa=ab.next()){if(aa.nodeType==3&&!f(aa)){Z=c.create("a",null,E);aa.parentNode.insertBefore(Z,aa);X.setStart(aa,0);q.setRng(X);c.remove(Z);return}}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_legacy_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_dev.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_dev.js similarity index 98% rename from lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_dev.js rename to lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_dev.js index 084456b0b1ea1..730c7aea3d761 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_dev.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_dev.js @@ -55,8 +55,9 @@ }; // Firebug - if (query.debug) + if (query.debug && !("console" in window)) { include('firebug/firebug-lite.js'); + } // Core ns include('tinymce.js'); diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_jquery.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_jquery.js new file mode 100644 index 0000000000000..3222bbc619028 --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_jquery.js @@ -0,0 +1 @@ +(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m0?d:[g.scope]);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,i,d,c,h;e=tinymce.trim(e);g=f.settings=g||{};if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^[\w-]*:?\/\//.test(e)){h=g.base_uri?g.base_uri.path:new tinymce.util.URI(location.href).directory;e=((g.base_uri&&g.base_uri.protocol)||"http")+"://mce_host"+f.toAbsPath(h,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){if(o.hasOwnProperty(i)){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={DELETE:46,BACKSPACE:8,ENTER:13,TAB:9,SPACEBAR:32,UP:38,DOWN:40,modifierPressed:function(b){return b.shiftKey||b.ctrlKey||b.altKey}}})(tinymce);(function(l){var j=l.VK,k=j.BACKSPACE,h=j.DELETE;function c(n){var p=n.dom,o=n.selection;n.onKeyDown.add(function(r,v){var q,x,t,u,s;s=v.keyCode==h;if((s||v.keyCode==k)&&!j.modifierPressed(v)){v.preventDefault();q=o.getRng();x=p.getParent(q.startContainer,p.isBlock);if(s){x=p.getNext(x,p.isBlock)}if(x){t=x.firstChild;while(t&&t.nodeType==3&&t.nodeValue.length==0){t=t.nextSibling}if(t&&t.nodeName==="SPAN"){u=t.cloneNode(false)}}r.getDoc().execCommand(s?"ForwardDelete":"Delete",false,null);x=p.getParent(q.startContainer,p.isBlock);l.each(p.select("span.Apple-style-span,font.Apple-style-span",x),function(y){var z=o.getBookmark();if(u){p.replace(u.cloneNode(false),y,true)}else{p.remove(y,true)}o.moveToBookmark(z)})}})}function d(n){function o(r){var q=n.dom.create("body");var s=r.cloneContents();q.appendChild(s);return n.selection.serializer.serialize(q,{format:"html"})}function p(q){var s=o(q);var t=n.dom.createRng();t.selectNode(n.getBody());var r=o(t);return s===r}n.onKeyDown.addToTop(function(r,t){var s=t.keyCode;if(s==h||s==k){var q=r.selection.getRng(true);if(!q.collapsed&&p(q)){r.setContent("",{format:"raw"});r.nodeChanged();t.preventDefault()}}})}function b(n){n.dom.bind(n.getDoc(),"focusin",function(){n.selection.setRng(n.selection.getRng())})}function e(n){n.onKeyDown.add(function(o,r){if(r.keyCode===k){if(o.selection.isCollapsed()&&o.selection.getRng(true).startOffset===0){var q=o.selection.getNode();var p=q.previousSibling;if(p&&p.nodeName&&p.nodeName.toLowerCase()==="hr"){o.dom.remove(p);l.dom.Event.cancel(r)}}}})}function g(n){if(!Range.prototype.getClientRects){n.onMouseDown.add(function(p,q){if(q.target.nodeName==="HTML"){var o=p.getBody();o.blur();setTimeout(function(){o.focus()},0)}})}}function f(n){n.onClick.add(function(o,p){p=p.target;if(/^(IMG|HR)$/.test(p.nodeName)){o.selection.getSel().setBaseAndExtent(p,0,p,1)}if(p.nodeName=="A"&&o.dom.hasClass(p,"mceItemAnchor")){o.selection.select(p)}o.nodeChanged()})}function i(n){n.onKeyDown.add(function(o,p){function q(r){var s=r.selection.getNode();var t="h1,h2,h3,h4,h5,h6";return r.dom.is(s,t)||r.dom.getParent(s,t)!==null}if(p.keyCode===j.ENTER&&!j.modifierPressed(p)&&q(o)){setTimeout(function(){var r=o.selection.getNode();if(o.dom.is(r,"p")){o.dom.setAttrib(r,"style",null);o.execCommand("mceCleanup")}},0)}})}function m(n){var p,o;n.dom.bind(n.getDoc(),"selectionchange",function(){if(o){clearTimeout(o);o=0}o=window.setTimeout(function(){var q=n.selection.getRng();if(!p||!l.dom.RangeUtils.compareRanges(q,p)){n.nodeChanged();p=q}},50)})}function a(n){document.body.setAttribute("role","application")}l.create("tinymce.util.Quirks",{Quirks:function(n){if(l.isWebKit){c(n);d(n);b(n);f(n);if(l.isIDevice){m(n)}}if(l.isIE){e(n);d(n);a(n);i(n)}if(l.isGecko){e(n);g(n)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";l=d(l,",",d(l.toUpperCase()));h=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,audio,object"),g);b=d("pre,script,style,textarea");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(r){var A=this,n={},o={},y=[],q,p;r=r||{};if(r.verify_html===false){r.valid_elements="*[*]"}if(r.valid_styles){q={};k(r.valid_styles,function(C,B){q[B]=m.explode(C)})}p=r.whitespace_elements?d(r.whitespace_elements):b;function z(B){return new RegExp("^"+B.replace(/([?+*])/g,".$1")+"$")}function t(I){var H,D,W,S,X,C,F,R,U,N,V,Z,L,G,T,B,P,E,Y,aa,M,Q,K=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,O=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,J=/[*?+]/;if(I){I=i(I);if(n["@"]){P=n["@"].attributes;E=n["@"].attributesOrder}for(H=0,D=I.length;H=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(q){var p=k.settings;var n=q.getAttribute(m);if(j!==null){switch(m){case"style":if(!e(j,"string")){f(j,function(r,s){k.setStyle(q,s,r)});return}if(p.keep_values){if(j&&!k._isRes(j)){q.setAttribute("data-mce-style",j,2)}else{q.removeAttribute("data-mce-style",2)}}q.style.cssText=j;break;case"class":q.className=j||"";break;case"src":case"href":if(p.keep_values){if(p.url_converter){j=p.url_converter.call(p.url_converter_scope||k,j,m,q)}k.setAttrib(q,"data-mce-"+m,j,2)}break;case"shape":q.setAttribute("data-mce-style",j);break}}if(e(j)&&j!==null&&j.length!==0){q.setAttribute(m,""+j,2)}else{q.removeAttribute(m,2)}if(tinyMCE.activeEditor&&n!=j){var o=tinyMCE.activeEditor;o.onSetAttrib.dispatch(o,q,m,j)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(o,p,l){var j,k=this,m;o=k.get(o);if(!o||o.nodeType!==1){return l===m?false:l}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(p)){j=o.getAttribute("data-mce-"+p);if(j){return j}}if(b&&k.props[p]){j=o[k.props[p]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=o.getAttribute(p,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(p)){if(o[k.props[p]]===true&&j===""){return p}return j?p:""}if(o.nodeName==="FORM"&&o.getAttributeNode(p)){return o.getAttributeNode(p).nodeValue}if(p==="style"){j=j||o.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),o.nodeName);if(k.settings.keep_values&&!k._isRes(j)){o.setAttribute("data-mce-style",j)}}}if(d&&p==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(p){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return p}return l;case"shape":j=j.toLowerCase();break;default:if(p.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==m&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
    "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
    "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p;m=m.firstChild;if(m){j=new h.dom.TreeWalker(m);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){p=m.parentNode;if(l==="br"&&r.isBlock(p)&&p.firstChild===m&&p.lastChild===m){continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if(q==8){return false}if((q===3&&!i.test(m.nodeValue))){return false}}while(m=j.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(x){var u,t=x.childNodes,v=x.nodeType;function y(B){var A=B.previousSibling&&B.previousSibling.nodeName=="SPAN";var z=B.nextSibling&&B.nextSibling.nodeName=="SPAN";return A&&z}if(v==1&&x.getAttribute("data-mce-type")=="bookmark"){return}for(u=t.length-1;u>=0;u--){k(t[u])}if(v!=9){if(v==3&&x.nodeValue.length>0){var r=h.trim(x.nodeValue).length;if(!s.isBlock(x.parentNode)||r>0||r==0&&y(x)){return}}else{if(v==1){t=x.childNodes;if(t.length==1&&t[0]&&t[0].nodeType==1&&t[0].getAttribute("data-mce-type")=="bookmark"){x.parentNode.insertBefore(t[0],x)}if(t.length||/^(br|hr|input|img)$/i.test(x.nodeName)){return}}}s.remove(x)}return x}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p&&t.nodeType!==9){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1&&p==q-1){if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.readyState==="complete"){g._pageInit(i);return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='_';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('_'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
    ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.rangeCount>0?h.getRangeAt(0):null}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(o,g){var m=this,j=m.dom,l,k,h,i=[];l=j.getParent(o||m.getStart(),j.isBlock);k=j.getParent(g||m.getEnd(),j.isBlock);if(l){i.push(l)}if(l&&k&&l!=k){h=l;var f=new c.dom.TreeWalker(l,j.getRoot());while((h=f.next())&&h!=k){if(j.isBlock(h)){i.push(h)}}}if(k&&l!=k){i.push(k)}return i},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;i=true;break}if(/^(BR|IMG)$/.test(l.nodeName)){o=m.nodeIndex(l);k=l.parentNode;if(l.nodeName=="IMG"&&!p){o++}i=true;break}}while(l=(p?n.next():n.prev()))}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(!f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";e.remove_trailing_brs="remove_trailing_brs" in e?e.remove_trailing_brs:true;h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF|\u200B/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,s){var i=d.startContainer,l=d.startOffset,t=d.endContainer,m=d.endOffset,j,g,o,h,r,q,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(u){s([u])});return}function f(u){var v;v=u[0];if(v.nodeType===3&&v===i&&l>=v.nodeValue.length){u.splice(0,1)}v=u[u.length-1];if(m===0&&u.length>0&&v===t&&v.nodeType===3){u.splice(u.length-1,1)}return u}function p(x,v,u){var y=[];for(;x&&x!=u;x=x[v]){y.push(x)}return y}function n(v,u){do{if(v.parentNode==u){return v}v=v.parentNode}while(v)}function k(x,v,y){var u=y?"nextSibling":"previousSibling";for(h=x,r=h.parentNode;h&&h!=v;h=r){r=h.parentNode;q=p(h==x?h:h[u],u);if(q.length){if(!y){q.reverse()}s(f(q))}}}if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[l]}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[Math.min(m-1,t.childNodes.length-1)]}if(i==t){return s(f([i]))}j=c.findCommonAncestor(i,t);for(h=i;h;h=h.parentNode){if(h===t){return k(i,j,true)}if(h===j){break}}for(h=t;h;h=h.parentNode){if(h===i){return k(t,j)}if(h===j){break}}g=n(i,j)||i;o=n(t,j)||t;k(i,g,true);q=p(g==i?g:g.nextSibling,"nextSibling",o==t?o.nextSibling:o);if(q.length){s(f(q))}k(t,o)};this.split=function(e){var h=e.startContainer,d=e.startOffset,i=e.endContainer,g=e.endOffset;function f(j,k){return j.splitText(k)}if(h==i&&h.nodeType==3){if(d>0&&dd){g=g-d;h=i=f(i,g).previousSibling;g=i.nodeValue.length;d=0}else{g=0}}}else{if(h.nodeType==3&&d>0&&d0&&g=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.get("menu_"+g.id);h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var d=this,e=d.settings,c;if(b.isIE&&d.editor){b.dom.Event.add(d.id,"mousedown",function(f){var g=d.editor.selection.getNode().nodeName;c=g==="IMG"?d.editor.selection.getBookmark():null})}b.dom.Event.add(d.id,"click",function(f){if(!d.isDisabled()){if(b.isIE&&d.editor&&c!==null){d.editor.selection.moveToBookmark(c)}return e.onclick.call(e.scope,f)}});b.dom.Event.add(d.id,"keyup",function(f){if(!d.isDisabled()&&f.keyCode==b.VK.SPACEBAR){return e.onclick.call(e.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(m){m=m.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");var i={href:"javascript:;",style:{backgroundColor:"#"+m},title:p.editor.getLang("colors."+m,m),"data-mce-color":"#"+m};if(!d.isIE){i.role="option"}g=c.add(g,"a",i);if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+m;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){return;var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);if(j.adapter){j.adapter.patchEditor(m)}return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:q.convertURL,url_converter_scope:q,ie7_compat:true},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=n.baseURI;q.contentCSS=[];q.execCallback("setup",q)},render:function(u){var v=this,x=v.settings,y=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}tinyMCE.settings=x;if(!v.getElement()){return}if(n.isIDevice&&!n.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&x.hidden_input&&o.getParent(y,"form")){o.insertAfter(o.create("input",{type:"hidden",name:y}),y)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(x.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(x.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(x.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(x.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){n.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(x.language&&x.language_load!==false){q.add(n.baseURL+"/../../extra/strings.php?elanguage="+x.language+"ðeme="+x.theme)}if(x.theme&&x.theme.charAt(0)!="-"&&!h.urls[x.theme]){h.load(x.theme,"themes/"+x.theme+"/editor_template"+n.suffix+".js")}i(g(x.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(A){var z={prefix:"plugins/",resource:A,suffix:"/editor_plugin"+n.suffix+".js"};var A=c.createUrl(z,A);c.load(A.resource,A)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+n.suffix+".js"})}}});q.loadQueue(function(){if(!v.removed){v.init()}})}r()},init:function(){var v,I=this,J=I.settings,F,B,E=I.getElement(),r,q,G,z,D,H,A,x=[];n.add(I);J.aria_label=J.aria_label||o.getAttrib(E,"aria-label",I.getLang("aria.rich_text_area"));if(J.theme){J.theme=J.theme.replace(/-/,"");r=h.get(J.theme);I.theme=new r();if(I.theme.init&&J.init_theme){I.theme.init(I,h.urls[J.theme]||n.documentBaseURL.replace(/\/$/,""))}}function C(K){var L=c.get(K),t=c.urls[K]||n.documentBaseURL.replace(/\/$/,""),s;if(L&&n.inArray(x,K)===-1){i(c.dependencies(K),function(u){C(u)});s=new L(I,t);I.plugins[K]=s;if(s.init){s.init(I,t);x.push(K)}}}i(g(J.plugins.replace(/\-/g,"")),C);if(J.popup_css!==false){if(J.popup_css){J.popup_css=I.documentBaseURI.toAbsolute(J.popup_css)}else{J.popup_css=I.baseURI.toAbsolute("themes/"+J.theme+"/skins/"+J.skin+"/dialog.css")}}if(J.popup_css_add){J.popup_css+=","+I.documentBaseURI.toAbsolute(J.popup_css_add)}I.controlManager=new n.ControlManager(I);if(J.custom_undo_redo){I.onBeforeExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.beforeChange()}});I.onExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.add()}})}I.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){I.nodeChanged()}});if(a){function y(s,t){if(!t||!t.initial){I.execCommand("mceRepaint")}}I.onUndo.add(y);I.onRedo.add(y);I.onSetContent.add(y)}I.onBeforeRenderUI.dispatch(I,I.controlManager);if(J.render_ui){F=J.width||E.style.width||E.offsetWidth;B=J.height||E.style.height||E.offsetHeight;I.orgDisplay=E.style.display;H=/^[0-9\.]+(|px)$/i;if(H.test(""+F)){F=Math.max(parseInt(F)+(r.deltaWidth||0),100)}if(H.test(""+B)){B=Math.max(parseInt(B)+(r.deltaHeight||0),J.theme_advanced_resizing_min_height||100)}r=I.theme.renderUI({targetNode:E,width:F,height:B,deltaWidth:J.delta_width,deltaHeight:J.delta_height});I.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:F,height:B});if(J.content_css){n.each(g(J.content_css),function(s){I.contentCSS.push(I.documentBaseURI.toAbsolute(s))})}B=(r.iframeHeight||B)+(typeof(B)=="number"?(r.deltaHeight||0):"");if(B<(J.theme_advanced_resizing_min_height||100)){B=J.theme_advanced_resizing_min_height||100}I.iframeHTML=J.doctype+'';if(J.document_base_url!=n.documentBaseURL){I.iframeHTML+=''}if(J.ie7_compat){I.iframeHTML+=''}else{I.iframeHTML+=''}I.iframeHTML+='';for(A=0;A'}I.contentCSS=[];z=J.body_id||"tinymce";if(z.indexOf("=")!=-1){z=I.getParam("body_id","","hash");z=z[I.id]||z}D=J.body_class||"";if(D.indexOf("=")!=-1){D=I.getParam("body_class","","hash");D=D[I.id]||""}I.iframeHTML+='
    ";if(n.relaxedDomain&&(b||(n.isOpera&&parseFloat(opera.version())<11))){G='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+I.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}v=o.add(r.iframeContainer,"iframe",{id:I.id+"_ifr",src:G||'javascript:""',frameBorder:"0",allowTransparency:"true",title:J.aria_label,style:{width:"100%",height:B,display:"block"}});I.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=I.orgDisplay;o.get(I.id).style.display="none";o.setAttrib(I.id,"aria-hidden",true);if(!n.relaxedDomain||!G){I.setupIframe()}E=v=r=null},setupIframe:function(){var r=this,x=r.settings,y=o.get(r.id),z=r.getDoc(),v,q;if(!b||!n.relaxedDomain){z.open();z.write(r.iframeHTML);z.close();if(n.relaxedDomain){z.domain=n.relaxedDomain}}q=r.getBody();q.disabled=true;if(!x.readonly){q.contentEditable=true}q.disabled=false;r.schema=new n.html.Schema(x);r.dom=new n.dom.DOMUtils(r.getDoc(),{keep_values:true,url_converter:r.convertURL,url_converter_scope:r,hex_colors:x.force_hex_style_colors,class_filter:x.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:r.schema});r.parser=new n.html.DomParser(x,r.schema);if(!r.settings.allow_html_in_named_anchor){r.parser.addAttributeFilter("name",function(s,t){var B=s.length,D,A,C,E;while(B--){E=s[B];if(E.name==="a"&&E.firstChild){C=E.parent;D=E.lastChild;do{A=D.prev;C.insert(D,E);D=A}while(D)}}})}r.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,C,E=r.dom,D,B;while(A--){C=s[A];D=C.attr(t);B="data-mce-"+t;if(!C.attributes.map[B]){if(t==="style"){C.attr(B,E.serializeStyle(E.parseStyle(D),C.name))}else{C.attr(B,r.convertURL(D,t,C.name))}}}});r.parser.addNodeFilter("script",function(s,t){var A=s.length,B;while(A--){B=s[A];B.attr("type","mce-"+(B.attr("type")||"text/javascript"))}});r.parser.addNodeFilter("#cdata",function(s,t){var A=s.length,B;while(A--){B=s[A];B.type=8;B.name="#comment";B.value="[CDATA["+B.value+"]]"}});r.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=r.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new n.html.Node("br",1)).shortEnded=true}}});r.serializer=new n.dom.Serializer(x,r.dom,r.schema);r.selection=new n.dom.Selection(r.dom,r.getWin(),r.serializer);r.formatter=new n.Formatter(this);r.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(A,s,t){i(t,function(C,B){r.dom.setAttrib(A,B,C)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){r.formatter.register(s,{block:s,remove:"all"})});r.formatter.register(r.settings.formats);r.undoManager=new n.UndoManager(r);r.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return r.onChange.dispatch(r,s,t)}});r.undoManager.onUndo.add(function(t,s){return r.onUndo.dispatch(r,s,t)});r.undoManager.onRedo.add(function(t,s){return r.onRedo.dispatch(r,s,t)});r.forceBlocks=new n.ForceBlocks(r,{forced_root_block:x.forced_root_block});r.editorCommands=new n.EditorCommands(r);r.serializer.onPreProcess.add(function(s,t){return r.onPreProcess.dispatch(r,t,s)});r.serializer.onPostProcess.add(function(s,t){return r.onPostProcess.dispatch(r,t,s)});r.onPreInit.dispatch(r);if(!x.gecko_spellcheck){r.getBody().spellcheck=0}if(!x.readonly){r._addEvents()}r.controlManager.onPostRender.dispatch(r,r.controlManager);r.onPostRender.dispatch(r);r.quirks=new n.util.Quirks(this);if(x.directionality){r.getBody().dir=x.directionality}if(x.nowrap){r.getBody().style.whiteSpace="nowrap"}if(x.handle_node_change_callback){r.onNodeChange.add(function(t,s,A){r.execCallback("handle_node_change_callback",r.id,A,-1,-1,true,r.selection.isCollapsed())})}if(x.save_callback){r.onSaveContent.add(function(s,A){var t=r.execCallback("save_callback",r.id,A.content,r.getBody());if(t){A.content=t}})}if(x.onchange_callback){r.onChange.add(function(t,s){r.execCallback("onchange_callback",r,s)})}if(x.protect){r.onBeforeSetContent.add(function(s,t){if(x.protect){i(x.protect,function(A){t.content=t.content.replace(A,function(B){return""})})}})}if(x.convert_newlines_to_brs){r.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
    ")}})}if(x.preformatted){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
    '+t.content+"
    "}})}if(x.verify_css_classes){r.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!r.classesRE){t=r.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});r.classesRE=new RegExp("("+B+")","gi")}}return !r.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||r.classesRE.test(A)?A:""}return A}}if(x.cleanup_callback){r.onBeforeSetContent.add(function(s,t){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)});r.onPreProcess.add(function(s,t){if(t.set){r.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){r.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});r.onPostProcess.add(function(s,t){if(t.set){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=r.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(x.save_callback){r.onGetContent.add(function(s,t){if(t.save){t.content=r.execCallback("save_callback",r.id,t.content,r.getBody())}})}if(x.handle_event_callback){r.onEvent.add(function(s,t,A){if(r.execCallback("handle_event_callback",t,s,A)===false){k.cancel(t)}})}r.onSetContent.add(function(){r.addVisual(r.getBody())});if(x.padd_empty_editor){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}if(a){function u(s,t){i(s.dom.select("a"),function(B){var A=B.parentNode;if(s.dom.isBlock(A)&&A.lastChild===B){s.dom.add(A,"br",{"data-mce-bogus":1})}})}r.onExecCommand.add(function(s,t){if(t==="CreateLink"){u(s)}});r.onSetContent.add(r.selection.onSetContent.add(u))}r.load({initial:true,format:"html"});r.startContent=r.getContent({format:"raw"});r.undoManager.add();r.initialized=true;r.onInit.dispatch(r);r.execCallback("setupcontent_callback",r.id,r.getBody(),r.getDoc());r.execCallback("init_instance_callback",r);r.focus(true);r.nodeChanged({initial:1});i(r.contentCSS,function(s){r.dom.loadCSS(s)});if(x.auto_focus){setTimeout(function(){var s=n.get(x.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}y=null},focus:function(v){var z,r=this,u=r.selection,y=r.settings.content_editable,s,q,x=r.getDoc();if(!v){s=u.getRng();if(s.item){q=s.item(0)}r._refreshContentEditable();if(!y){r.getWin().focus()}if(n.isGecko){r.getBody().focus()}if(q&&q.ownerDocument==x){s=x.body.createControlRange();s.addElement(q);s.select()}}if(n.activeEditor!=r){if((z=n.activeEditor)!=null){z.onDeactivate.dispatch(z,r)}r.onActivate.dispatch(r,z)}n._setActive(r)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=n.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return n.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(x,s,q){var t=n.trim,r=d(this.settings[x])?this.settings[x]:s,u;if(q==="hash"){u={};if(d(r,"string")){i(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(y){y=y.split("=");if(y.length>1){u[t(y[0])]=t(y[1])}else{u[t(y[0])]=t(y)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getStart()||q.getBody();if(q.initialized){u=u||{};v=b&&v.ownerDocument!=q.getDoc()?q.getBody():v;u.parents=[];q.dom.getParent(v,function(s){if(s.nodeName=="BODY"){return true}u.parents.push(s)});q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(q,s,r){this.execCommands[q]={func:s,scope:r||this}},addQueryStateHandler:function(q,s,r){this.queryStateCommands[q]={func:s,scope:r||this}},addQueryValueHandler:function(q,s,r){this.queryValueCommands[q]={func:s,scope:r||this}},addShortcut:function(s,v,q,u){var r=this,x;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){x=q;q=function(){r.execCommand(x,false,null)}}if(d(q,"object")){x=q;q=function(){r.execCommand(x[0],x[1],x[2])}}i(g(s),function(t){var y={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(z){switch(z){case"alt":case"ctrl":case"shift":y[z]=true;break;default:y.charCode=z.charCodeAt(0);y.keyCode=z.toUpperCase().charCodeAt(0)}});r.shortcuts[(y.ctrl?"ctrl":"")+","+(y.alt?"alt":"")+","+(y.shift?"shift":"")+","+y.keyCode]=y});return true},execCommand:function(y,x,A,q){var u=this,v=0,z,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(y)&&(!q||!q.skip_focus)){u.focus()}q=f({},q);u.onBeforeExecCommand.dispatch(u,y,x,A,q);if(q.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(z=u.execCommands[y]){r=z.func.call(z.scope,x,A);if(r!==true){u.onExecCommand.dispatch(u,y,x,A,q);return r}}i(u.plugins,function(s){if(s.execCommand&&s.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(u.editorCommands.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}u.getDoc().execCommand(y,x,A);u.onExecCommand.dispatch(u,y,x,A,q)},queryCommandState:function(v){var r=this,x,u;if(r._isHidden()){return}if(x=r.queryStateCommands[v]){u=x.func.call(x.scope);if(u!==true){return u}}x=r.editorCommands.queryCommandState(v);if(x!==-1){return x}try{return this.getDoc().queryCommandState(v)}catch(q){}},queryCommandValue:function(x){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[x]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(x);if(d(v)){return v}try{return this.getDoc().queryCommandValue(x)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=false;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){i(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(v,t){var s=this,r,q=s.getBody(),u;t=t||{};t.format=t.format||"html";t.set=true;t.content=v;if(!t.no_events){s.onBeforeSetContent.dispatch(s,t)}v=t.content;if(!n.isIE&&(v.length===0||/^\s+$/.test(v))){u=s.settings.forced_root_block;if(u){v="<"+u+'>
    "}else{v='
    '}q.innerHTML=v;s.selection.select(q,true);s.selection.collapse(true);return}if(t.format!=="raw"){v=new n.html.Serializer({},s.schema).serialize(s.parser.parse(v))}t.content=n.trim(v);s.dom.setHTML(q,t.content);if(!t.no_events){s.onSetContent.dispatch(s,t)}s.selection.normalize();return t.content},getContent:function(r){var q=this,s;r=r||{};r.format=r.format||"html";r.get=true;if(!r.no_events){q.onBeforeGetContent.dispatch(q,r)}if(r.format=="raw"){s=q.getBody().innerHTML}else{s=q.serializer.serialize(q.getBody(),r)}r.content=n.trim(s);if(!r.no_events){q.onGetContent.dispatch(q,r)}return r.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,y,x){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,x,true,y)}if(!v.convert_urls||(x&&x.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}i(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];n.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var D=this,u,E=D.settings,r=D.dom,y={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function q(t,F){var s=t.type;if(D.removed){return}if(D.onEvent.dispatch(D,t,F)!==false){D[y[t.fakeType||t.type]].dispatch(D,t,F)}}i(y,function(t,s){switch(s){case"contextmenu":r.bind(D.getDoc(),s,q);break;case"paste":r.bind(D.getBody(),s,function(F){q(F)});break;case"submit":case"reset":r.bind(D.getElement().form||o.getParent(D.id,"form"),s,q);break;default:r.bind(E.content_editable?D.getBody():D.getDoc(),s,q)}});r.bind(E.content_editable?D.getBody():(a?D.getDoc():D.getWin()),"focus",function(s){D.focus(true)});if(n.isGecko){r.bind(D.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=D.documentBaseURI.toAbsolute(s)}})}if(a){function v(){var G=this,I=G.getDoc(),H=G.settings;if(a&&!H.readonly){G._refreshContentEditable();try{I.execCommand("styleWithCSS",0,false)}catch(F){if(!G._isHidden()){try{I.execCommand("useCSS",0,true)}catch(F){}}}if(!H.table_inline_editing){try{I.execCommand("enableInlineTableEditing",false,false)}catch(F){}}if(!H.object_resizing){try{I.execCommand("enableObjectResizing",false,false)}catch(F){}}}}D.onBeforeExecCommand.add(v);D.onMouseDown.add(v)}D.onMouseUp.add(D.nodeChanged);D.onKeyUp.add(function(s,t){var F=t.keyCode;if((F>=33&&F<=36)||(F>=37&&F<=40)||F==13||F==45||F==46||F==8||(n.isMac&&(F==91||F==93))||t.ctrlKey){D.nodeChanged()}});D.onKeyDown.add(function(t,F){if(F.keyCode!=j.BACKSPACE){return}var s=t.selection.getRng();if(!s.collapsed){return}var H=s.startContainer;var G=s.startOffset;while(H&&H.nodeType&&H.nodeType!=1&&H.parentNode){H=H.parentNode}if(H&&H.parentNode&&H.parentNode.tagName==="BLOCKQUOTE"&&H.parentNode.firstChild==H&&G==0){t.formatter.toggle("blockquote",null,H.parentNode);s.setStart(H,0);s.setEnd(H,0);t.selection.setRng(s);t.selection.collapse(false)}});D.onReset.add(function(){D.setContent(D.startContent,{format:"raw"})});if(E.custom_shortcuts){if(E.custom_undo_redo_keyboard_shortcuts){D.addShortcut("ctrl+z",D.getLang("undo_desc"),"Undo");D.addShortcut("ctrl+y",D.getLang("redo_desc"),"Redo")}D.addShortcut("ctrl+b",D.getLang("bold_desc"),"Bold");D.addShortcut("ctrl+i",D.getLang("italic_desc"),"Italic");D.addShortcut("ctrl+u",D.getLang("underline_desc"),"Underline");for(u=1;u<=6;u++){D.addShortcut("ctrl+"+u,"",["FormatBlock",false,"h"+u])}D.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);D.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);D.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function x(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(D.shortcuts,function(F){if(n.isMac&&F.ctrl!=t.metaKey){return}else{if(!n.isMac&&F.ctrl!=t.ctrlKey){return}}if(F.alt!=t.altKey){return}if(F.shift!=t.shiftKey){return}if(t.keyCode==F.keyCode||(t.charCode&&t.charCode==F.charCode)){s=F;return false}});return s}D.onKeyUp.add(function(s,t){var F=x(t);if(F){return k.cancel(t)}});D.onKeyPress.add(function(s,t){var F=x(t);if(F){return k.cancel(t)}});D.onKeyDown.add(function(s,t){var F=x(t);if(F){F.func.call(F.scope);return k.cancel(t)}})}if(n.isIE){r.bind(D.getDoc(),"controlselect",function(F){var t=D.resizeInfo,s;F=F.target;if(F.nodeName!=="IMG"){return}if(t){r.unbind(t.node,t.ev,t.cb)}if(!r.hasClass(F,"mceItemNoResize")){ev="resizeend";s=r.bind(F,ev,function(H){var G;H=H.target;if(G=r.getStyle(H,"width")){r.setAttrib(H,"width",G.replace(/[^0-9%]+/g,""));r.setStyle(H,"width","")}if(G=r.getStyle(H,"height")){r.setAttrib(H,"height",G.replace(/[^0-9%]+/g,""));r.setStyle(H,"height","")}})}else{ev="resizestart";s=r.bind(F,"resizestart",k.cancel,k)}t=D.resizeInfo={node:F,ev:ev,cb:s}})}if(n.isOpera){D.onClick.add(function(s,t){k.prevent(t)})}if(E.custom_undo_redo){function A(){D.undoManager.typing=false;D.undoManager.add()}var z=n.isGecko?"blur":"focusout";r.bind(D.getDoc(),z,function(s){if(!D.removed&&D.undoManager.typing){A()}});D.dom.bind(D.dom.getRoot(),"dragend",function(s){A()});D.onKeyUp.add(function(s,F){var t=F.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||F.ctrlKey){A()}});D.onKeyDown.add(function(s,G){var F=G.keyCode,t;if(F==8){t=D.getDoc().selection;if(t&&t.createRange&&t.createRange().item){D.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));A();return k.cancel(G)}}if((F>=33&&F<=36)||(F>=37&&F<=40)||F==13||F==45){if(n.isIE&&F==13){D.undoManager.beforeChange()}if(D.undoManager.typing){A()}return}if((F<16||F>20)&&F!=224&&F!=91&&!D.undoManager.typing){D.undoManager.beforeChange();D.undoManager.typing=true;D.undoManager.add()}});D.onMouseDown.add(function(){if(D.undoManager.typing){A()}})}if(n.isGecko){function C(){var s=D.dom.getAttribs(D.selection.getStart().cloneNode(false));return function(){var t=D.selection.getStart();if(t!==D.getBody()){D.dom.setAttrib(t,"style",null);i(s,function(F){t.setAttributeNode(F.cloneNode(true))})}}}function B(){var t=D.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}D.onKeyPress.add(function(s,F){var t;if((F.keyCode==8||F.keyCode==46)&&B()){t=C();D.getDoc().execCommand("delete",false,null);t();return k.cancel(F)}});D.dom.bind(D.getDoc(),"cut",function(t){var s;if(B()){s=C();D.onKeyUp.addToTop(k.cancel,k);setTimeout(function(){s();D.onKeyUp.remove(k.cancel,k)},0)}})}},_refreshContentEditable:function(){var r=this,q,s;if(r._isHidden()){q=r.getBody();s=q.parentNode;s.removeChild(q);s.appendChild(q);q.focus()}},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(z){var x="align"+z.substring(7);var v=p.isCollapsed()?[p.getNode()]:p.getSelectedBlocks();var y=c.map(v,function(A){return !!q.matchNode(A,x)});return c.inArray(y,a)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e0||this.typing},hasRedo:function(){return e');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
    ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"
    ");T=v.dom.add(O,V.element,null,"
    ")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"
    ")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}if(!R.body.hasChildNodes()){R.body.appendChild(M.create("br"))}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
    ";return r[0]}else{y.innerHTML=b?"\u00a0":"
    "}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(BL.y+L.h){v.getWin().scrollTo(0,B1||ab==at){return ab}}}var al=V.selection.getRng();var ap=al.startContainer;var ak=al.endContainer;if(ap!=ak&&al.endOffset==0){var ao=am(ap,ak);var an=ao.nodeType==3?ao.length:ao.childNodes.length;al.setEnd(ao,an)}return al}function Y(an,at,aq,ap,al){var ak=[],am=-1,ar,av=-1,ao=-1,au;P(an.childNodes,function(ax,aw){if(ax.nodeName==="UL"||ax.nodeName==="OL"){am=aw;ar=ax;return false}});P(an.childNodes,function(ax,aw){if(ax.nodeName==="SPAN"&&c.getAttrib(ax,"data-mce-type")=="bookmark"){if(ax.id==at.id+"_start"){av=aw}else{if(ax.id==at.id+"_end"){ao=aw}}}});if(am<=0||(avam)){P(a.grep(an.childNodes),al);return 0}else{au=aq.cloneNode(S);P(a.grep(an.childNodes),function(ax,aw){if((avam&&aw>am)){ak.push(ax);ax.parentNode.removeChild(ax)}});if(avam){an.insertBefore(au,ar.nextSibling)}}ap.push(au);P(ak,function(aw){au.appendChild(aw)});return au}}function ai(al,an,ap){var ak=[],ao,am;ao=ah.inline||ah.block;am=c.create(ao);W(am);K.walk(al,function(aq){var ar;function at(au){var ax=au.nodeName.toLowerCase(),aw=au.parentNode.nodeName.toLowerCase(),av;if(g(ax,"br")){ar=0;if(ah.block){c.remove(au)}return}if(ah.wrapper&&x(au,Z,ag)){ar=0;return}if(ah.block&&!ah.wrapper&&G(ax)){au=c.rename(au,ao);W(au);ak.push(au);ar=0;return}if(ah.selector){P(ac,function(ay){if("collapsed" in ay&&ay.collapsed!==ad){return}if(c.is(au,ay.selector)&&!b(au)){W(au,ay);av=true}});if(!ah.inline||av){ar=0;return}}if(d(ao,ax)&&d(aw,ao)&&!(!ap&&au.nodeType===3&&au.nodeValue.length===1&&au.nodeValue.charCodeAt(0)===65279)&&!b(au)){if(!ar){ar=am.cloneNode(S);au.parentNode.insertBefore(ar,au);ak.push(ar)}ar.appendChild(au)}else{if(ax=="li"&&an){ar=Y(au,an,am,ak,at)}else{ar=0;P(a.grep(au.childNodes),at);ar=0}}}P(aq,at)});if(ah.wrap_links===false){P(ak,function(aq){function ar(aw){var av,au,at;if(aw.nodeName==="A"){au=am.cloneNode(S);ak.push(au);at=a.grep(aw.childNodes);for(av=0;av1||!F(at))&&aq===0){c.remove(at,1);return}if(ah.inline||ah.wrapper){if(!ah.exact&&aq===1){at=ar(at)}P(ac,function(av){P(c.select(av.inline,at),function(ax){var aw;if(av.wrap_links===false){aw=ax.parentNode;do{if(aw.nodeName==="A"){return}}while(aw=aw.parentNode)}U(av,ag,ax,av.exact?ax:null)})});if(x(at.parentNode,Z,ag)){c.remove(at,1);at=0;return B}if(ah.merge_with_parents){c.getParent(at.parentNode,function(av){if(x(av,Z,ag)){c.remove(at,1);at=0;return B}})}if(at&&ah.merge_siblings!==false){at=u(C(at),at);at=u(at,C(at,B))}}})}if(ah){if(ab){if(ab.nodeType){X=c.createRng();X.setStartBefore(ab);X.setEndAfter(ab);ai(o(X,ac),null,true)}else{ai(ab,null,true)}}else{if(!ad||!ah.inline||c.select("td.mceSelected,th.mceSelected").length){var aj=V.selection.getNode();V.selection.setRng(aa());af=q.getBookmark();ai(o(q.getRng(B),ac),af);if(ah.styles&&(ah.styles.color||ah.styles.textDecoration)){a.walk(aj,I,"childNodes");I(aj)}q.moveToBookmark(af);N(q.getRng(B));V.nodeChanged()}else{Q("apply",Z,ag)}}}}function A(Y,ag,aa){var ab=R(Y),ai=ab[0],af,ae,X;function Z(an){var am,al,ak;am=a.grep(an.childNodes);for(al=0,ak=ab.length;al=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\t \r\n]+|)$/.test(W.nodeValue)}function O(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ai,Z){var Y=W.startContainer,ad=W.startOffset,al=W.endContainer,af=W.endOffset,ak,ah,ac,ag;function aj(ar){var am,ap,aq,ao,an;am=ap=ar?Y:al;an=ar?"previousSibling":"nextSibling";root=c.getRoot();if(am.nodeType==3&&!f(am)){if(ar?ad>0:afah?ah:ad];if(Y.nodeType==3){ad=0}}if(al.nodeType==1&&al.hasChildNodes()){ah=al.childNodes.length-1;al=al.childNodes[af>ah?ah:af-1];if(al.nodeType==3){af=al.nodeValue.length}}if(H(Y.parentNode)||H(Y)){Y=H(Y)?Y:Y.parentNode;Y=Y.nextSibling||Y;if(Y.nodeType==3){ad=0}}if(H(al.parentNode)||H(al)){al=H(al)?al:al.parentNode;al=al.previousSibling||al;if(al.nodeType==3){af=al.length}}if(ai[0].inline){if(W.collapsed){function ae(an,ar,au){var aq,ao,at,am;function ap(aw,ay){var az,av,ax=aw.nodeValue;if(typeof(ay)=="undefined"){ay=au?ax.length:0}if(au){az=ax.lastIndexOf(" ",ay);av=ax.lastIndexOf("\u00a0",ay);az=az>av?az:av;if(az!==-1&&!Z){az++}}else{az=ax.indexOf(" ",ay);av=ax.indexOf("\u00a0",ay);az=az!==-1&&(av===-1||az0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){al=ac.node;al.splitText(ac.offset-1)}else{if(ac.node.previousSibling){}}}}}if(ai[0].inline||ai[0].block_expand){if(!ai[0].inline||(Y.nodeType!=3||ad===0)){Y=aj(true)}if(!ai[0].inline||(al.nodeType!=3||af===al.nodeValue.length)){al=aj()}}if(ai[0].selector&&ai[0].expand!==S&&!ai[0].inline){function aa(an,am){var ao,ap,ar,aq;if(an.nodeType==3&&an.nodeValue.length==0&&an[am]){an=an[am]}ao=m(an);for(ap=0;apY?Y:aa]}if(W.nodeType===3&&ab&&aa>=W.nodeValue.length){W=new t(W,V.getBody()).next()||W}if(W.nodeType===3&&!ab&&aa==0){W=new t(W,V.getBody()).prev()||W}return W}function Q(af,W,ad){var ai,ag="_mce_caret",X=V.settings.caret_debug;ai=a.isGecko?"\u200B":E;function Y(ak){var aj=c.create("span",{id:ag,"data-mce-bogus":true,style:X?"color:red":""});if(ak){aj.appendChild(V.getDoc().createTextNode(ai))}return aj}function ae(ak,aj){while(ak){if((ak.nodeType===3&&ak.nodeValue!==ai)||ak.childNodes.length>1){return false}if(aj&&ak.nodeType===1){aj.push(ak)}ak=ak.firstChild}return true}function ab(aj){while(aj){if(aj.id===ag){return aj}aj=aj.parentNode}}function aa(aj){var ak;if(aj){ak=new t(aj,aj);for(aj=ak.current();aj;aj=ak.next()){if(aj.nodeType===3){return aj}}}}function Z(al,ak){var am,aj;if(!al){al=ab(q.getStart());if(!al){while(al=c.get(ag)){Z(al,false)}}}else{aj=q.getRng(true);if(ae(al)){if(ak!==false){aj.setStartBefore(al);aj.setEndBefore(al)}c.remove(al)}else{am=aa(al);if(am.nodeValue.charAt(0)===E){am=am.deleteData(0,1)}c.remove(al,1)}q.setRng(aj)}}function ac(){var al,aj,ap,ao,am,ak,an;al=q.getRng(true);ao=al.startOffset;ak=al.startContainer;an=ak.nodeValue;aj=ab(q.getStart());if(aj){ap=aa(aj)}if(an&&ao>0&&ao=0;an--){al.appendChild(ar[an].cloneNode(false));al=al.firstChild}al.appendChild(c.doc.createTextNode(ai));al=al.firstChild;c.insertAfter(aq,at);q.setCursorLocation(al,1)}}if(!self._hasCaretEvents){V.onBeforeGetContent.addToTop(function(){var aj=[],ak;if(ae(ab(q.getStart()),aj)){ak=aj.length;while(ak--){c.setAttrib(aj[ak],"data-mce-bogus","1")}}});a.each("onMouseUp onKeyUp".split(" "),function(aj){V[aj].addToTop(function(){Z()})});V.onKeyDown.addToTop(function(aj,al){var ak=al.keyCode;if(ak==8||ak==37||ak==39){Z(ab(q.getStart()))}});self._hasCaretEvents=true}if(af=="apply"){ac()}else{ah()}}function N(X){var W=X.startContainer,ac=X.startOffset,ab,aa,Y,Z;if(W.nodeType==3&&ac>=W.nodeValue.length-1){W=W.parentNode;ac=s(W)+1}if(W.nodeType==1){Y=W.childNodes;W=Y[Math.min(ac,Y.length-1)];ab=new t(W);if(ac>Y.length-1){ab.next()}for(aa=ab.current();aa;aa=ab.next()){if(aa.nodeType==3&&!f(aa)){Z=c.create("a",null,E);aa.parentNode.insertBefore(Z,aa);X.setStart(aa,0);q.setRng(X);c.remove(Z);return}}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_legacy_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_jquery_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_jquery_src.js similarity index 94% rename from lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_jquery_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_jquery_src.js index 4f8aa99530c36..e57786e1d4a34 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_jquery_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_jquery_src.js @@ -807,7 +807,7 @@ tinymce.create('tinymce.util.Dispatcher', { // And this is also more efficient for (i = 0; i 0 ? a : [c.scope]); if (s === false) break; @@ -849,7 +849,7 @@ tinymce.create('tinymce.util.Dispatcher', { // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something - u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); + u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { var s = u[i]; @@ -1170,8 +1170,11 @@ tinymce.create('tinymce.util.Dispatcher', { v = '{'; - for (i in o) - v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : ''; + for (i in o) { + if (o.hasOwnProperty(i)) { + v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : ''; + } + } return v + '}'; } @@ -1306,11 +1309,17 @@ tinymce.create('static tinymce.util.XHR', { }()); (function(tinymce){ tinymce.VK = { - DELETE:46, - BACKSPACE:8 - + DELETE: 46, + BACKSPACE: 8, + ENTER: 13, + TAB: 9, + SPACEBAR: 32, + UP: 38, + DOWN: 40, + modifierPressed: function (e) { + return e.shiftKey || e.ctrlKey || e.altKey; + } } - })(tinymce); (function(tinymce) { var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE; @@ -1322,7 +1331,7 @@ tinymce.create('static tinymce.util.XHR', { var rng, blockElm, node, clonedSpan, isDelete; isDelete = e.keyCode == DELETE; - if (isDelete || e.keyCode == BACKSPACE) { + if ((isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) { e.preventDefault(); rng = selection.getRng(); @@ -1338,7 +1347,7 @@ tinymce.create('static tinymce.util.XHR', { node = blockElm.firstChild; // Ignore empty text nodes - while (node.nodeType == 3 && node.nodeValue.length == 0) + while (node && node.nodeType == 3 && node.nodeValue.length == 0) node = node.nextSibling; if (node && node.nodeName === 'SPAN') { @@ -1346,7 +1355,7 @@ tinymce.create('static tinymce.util.XHR', { } } - // Do the backspace/delete actiopn + // Do the backspace/delete action ed.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null); // Find all odd apple-style-spans @@ -1368,17 +1377,36 @@ tinymce.create('static tinymce.util.XHR', { }; function emptyEditorWhenDeleting(ed) { - ed.onKeyUp.add(function(ed, e) { - var keyCode = e.keyCode; + function serializeRng(rng) { + var body = ed.dom.create("body"); + var contents = rng.cloneContents(); + body.appendChild(contents); + return ed.selection.serializer.serialize(body, {format: 'html'}); + } + + function allContentsSelected(rng) { + var selection = serializeRng(rng); + + var allRng = ed.dom.createRng(); + allRng.selectNode(ed.getBody()); + + var allSelection = serializeRng(allRng); + return selection === allSelection; + } + + ed.onKeyDown.addToTop(function(ed, e) { + var keyCode = e.keyCode; if (keyCode == DELETE || keyCode == BACKSPACE) { - if (ed.dom.isEmpty(ed.getBody())) { + var rng = ed.selection.getRng(true); + if (!rng.collapsed && allContentsSelected(rng)) { ed.setContent('', {format : 'raw'}); ed.nodeChanged(); - return; + e.preventDefault(); } } }); + }; function inputMethodFocus(ed) { @@ -1387,6 +1415,21 @@ tinymce.create('static tinymce.util.XHR', { }); }; + function removeHrOnBackspace(ed) { + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode === BACKSPACE) { + if (ed.selection.isCollapsed() && ed.selection.getRng(true).startOffset === 0) { + var node = ed.selection.getNode(); + var previousSibling = node.previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { + ed.dom.remove(previousSibling); + tinymce.dom.Event.cancel(e); + } + } + } + }) + } + function focusBody(ed) { // Fix for a focus bug in FF 3.x where the body element // wouldn't get proper focus if the user clicked on the HTML element @@ -1424,6 +1467,51 @@ tinymce.create('static tinymce.util.XHR', { }); }; + function removeStylesOnPTagsInheritedFromHeadingTag(ed) { + ed.onKeyDown.add(function(ed, event) { + function checkInHeadingTag(ed) { + var currentNode = ed.selection.getNode(); + var headingTags = 'h1,h2,h3,h4,h5,h6'; + return ed.dom.is(currentNode, headingTags) || ed.dom.getParent(currentNode, headingTags) !== null; + } + + if (event.keyCode === VK.ENTER && !VK.modifierPressed(event) && checkInHeadingTag(ed)) { + setTimeout(function() { + var currentNode = ed.selection.getNode(); + if (ed.dom.is(currentNode, 'p')) { + ed.dom.setAttrib(currentNode, 'style', null); + // While tiny's content is correct after this method call, the content shown is not representative of it and needs to be 'repainted' + ed.execCommand('mceCleanup'); + } + }, 0); + } + }); + } + function selectionChangeNodeChanged(ed) { + var lastRng, selectionTimer; + + ed.dom.bind(ed.getDoc(), 'selectionchange', function() { + if (selectionTimer) { + clearTimeout(selectionTimer); + selectionTimer = 0; + } + + selectionTimer = window.setTimeout(function() { + var rng = ed.selection.getRng(); + + // Compare the ranges to see if it was a real change or not + if (!lastRng || !tinymce.dom.RangeUtils.compareRanges(rng, lastRng)) { + ed.nodeChanged(); + lastRng = rng; + } + }, 50); + }); + } + + function ensureBodyHasRoleApplication(ed) { + document.body.setAttribute("role", "application"); + } + tinymce.create('tinymce.util.Quirks', { Quirks: function(ed) { // WebKit @@ -1432,15 +1520,24 @@ tinymce.create('static tinymce.util.XHR', { emptyEditorWhenDeleting(ed); inputMethodFocus(ed); selectControlElements(ed); + + // iOS + if (tinymce.isIDevice) { + selectionChangeNodeChanged(ed); + } } // IE if (tinymce.isIE) { + removeHrOnBackspace(ed); emptyEditorWhenDeleting(ed); + ensureBodyHasRoleApplication(ed); + removeStylesOnPTagsInheritedFromHeadingTag(ed) } // Gecko if (tinymce.isGecko) { + removeHrOnBackspace(ed); focusBody(ed); } } @@ -1448,8 +1545,8 @@ tinymce.create('static tinymce.util.XHR', { })(tinymce); (function(tinymce) { var namedEntities, baseEntities, reverseEntities, - attrsCharsRegExp = /[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, - textCharsRegExp = /[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + attrsCharsRegExp = /[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, rawCharsRegExp = /[<>&\"\']/g, entityRegExp = /&(#x|#)?([\w]+);/g, asciiMap = { @@ -2432,7 +2529,7 @@ tinymce.html.Styles = function(settings, schema) { '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI '(?:\\/([^>]+)>)|' + // End element - '(?:([^\\s\\/<>]+)\\s*((?:[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*)>)' + // Start element + '(?:([^\\s\\/<>]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/)>)' + // Start element ')', 'g'); attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g; @@ -2961,6 +3058,10 @@ tinymce.html.Styles = function(settings, schema) { } } + // Keep comments + if (node.type === 8) + return false; + // Keep non whitespace text nodes if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) return false; @@ -4099,52 +4200,59 @@ tinymce.html.Writer = function(settings) { return this.run(e, function(e) { var s = t.settings; + var originalValue = e.getAttribute(n); + if (v !== null) { + switch (n) { + case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); - switch (n) { - case "style": - if (!is(v, 'string')) { - each(v, function(v, n) { - t.setStyle(e, n, v); - }); - - return; - } + return; + } - // No mce_style for elements with these since they might get resized by the user - if (s.keep_values) { - if (v && !t._isRes(v)) - e.setAttribute('data-mce-style', v, 2); - else - e.removeAttribute('data-mce-style', 2); - } + // No mce_style for elements with these since they might get resized by the user + if (s.keep_values) { + if (v && !t._isRes(v)) + e.setAttribute('data-mce-style', v, 2); + else + e.removeAttribute('data-mce-style', 2); + } - e.style.cssText = v; - break; + e.style.cssText = v; + break; - case "class": - e.className = v || ''; // Fix IE null bug - break; + case "class": + e.className = v || ''; // Fix IE null bug + break; - case "src": - case "href": - if (s.keep_values) { - if (s.url_converter) - v = s.url_converter.call(s.url_converter_scope || t, v, n, e); + case "src": + case "href": + if (s.keep_values) { + if (s.url_converter) + v = s.url_converter.call(s.url_converter_scope || t, v, n, e); - t.setAttrib(e, 'data-mce-' + n, v, 2); - } + t.setAttrib(e, 'data-mce-' + n, v, 2); + } - break; + break; - case "shape": - e.setAttribute('data-mce-style', v); - break; + case "shape": + e.setAttribute('data-mce-style', v); + break; + } } - if (is(v) && v !== null && v.length !== 0) e.setAttribute(n, '' + v, 2); else e.removeAttribute(n, 2); + + // fire onChangeAttrib event for attributes that have changed + if (tinyMCE.activeEditor && originalValue != v) { + var ed = tinyMCE.activeEditor; + ed.onSetAttrib.dispatch(ed, e, n, v); + } }); }, @@ -4788,6 +4896,10 @@ tinymce.html.Writer = function(settings) { } } + // Keep comment nodes + if (type == 8) + return false; + // Keep non whitespace text nodes if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) return false; @@ -4850,6 +4962,12 @@ tinymce.html.Writer = function(settings) { function trim(node) { var i, children = node.childNodes, type = node.nodeType; + function surroundedBySpans(node) { + var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN'; + var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN'; + return previousIsSpan && nextIsSpan; + } + if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') return; @@ -4860,7 +4978,10 @@ tinymce.html.Writer = function(settings) { // Keep non whitespace text nodes if (type == 3 && node.nodeValue.length > 0) { // If parent element isn't a block or there isn't any useful contents for example "

    " - if (!t.isBlock(node.parentNode) || tinymce.trim(node.nodeValue).length > 0) + // Also keep text nodes with only spaces if surrounded by spans. + // eg. "

    a b

    " should keep space between a and b + var trimmedLength = tinymce.trim(node.nodeValue).length; + if (!t.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength == 0 && surroundedBySpans(node)) return; } else if (type == 1) { // If the only child is a bookmark then move it up @@ -4897,9 +5018,9 @@ tinymce.html.Writer = function(settings) { // Insert middle chunk if (re) - pa.replaceChild(re, e); - else - pa.insertBefore(e, pe); + pa.replaceChild(re, e); + else + pa.insertBefore(e, pe); // Insert after chunk pa.insertBefore(trim(aft), pe); @@ -5914,7 +6035,7 @@ tinymce.html.Writer = function(settings) { parent = node.parentNode; root = dom.getRoot().parentNode; - while (parent != root) { + while (parent != root && parent.nodeType !== 9) { children = parent.children; i = children.length; @@ -6325,6 +6446,12 @@ tinymce.html.Writer = function(settings) { return; } + // When loaded asynchronously, the DOM Content may already be loaded + if (doc.readyState === 'complete') { + t._pageInit(win); + return; + } + // Use IE method if (doc.attachEvent) { doc.attachEvent("onreadystatechange", function() { @@ -7123,7 +7250,8 @@ tinymce.html.Writer = function(settings) { } s.addRange(r); - t.selectedRange = s.getRangeAt(0); + // adding range isn't always successful so we need to check range count otherwise an exception can occur + t.selectedRange = s.rangeCount > 0 ? s.getRangeAt(0) : null; } } else { // Is W3C Range @@ -7219,7 +7347,8 @@ tinymce.html.Writer = function(settings) { if (sb && eb && sb != eb) { n = sb; - while ((n = n.nextSibling) && n != eb) { + var walker = new tinymce.dom.TreeWalker(sb, dom.getRoot()); + while ((n = walker.next()) && n != eb) { if (dom.isBlock(n)) bl.push(n); } @@ -7234,6 +7363,11 @@ tinymce.html.Writer = function(settings) { normalize : function() { var self = this, rng, normalized; + // TODO: + // Retain selection direction. + // Lean left/right on Gecko for inline elements. + // Run this on mouse up/key up when the user manually moves the selection + // Normalize only on non IE browsers for now if (tinymce.isIE) return; @@ -7268,18 +7402,24 @@ tinymce.html.Writer = function(settings) { if (node.nodeType === 3) { offset = start ? 0 : node.nodeValue.length - 1; container = node; + normalized = true; break; } - // Found a BR element that we can place the caret before - if (node.nodeName === 'BR') { + // Found a BR/IMG element that we can place the caret before + if (/^(BR|IMG)$/.test(node.nodeName)) { offset = dom.nodeIndex(node); container = node.parentNode; + + // Put caret after image when moving the end point + if (node.nodeName == "IMG" && !start) { + offset++; + } + + normalized = true; break; } } while (node = (start ? walker.next() : walker.prev())); - - normalized = true; } } } @@ -7294,7 +7434,7 @@ tinymce.html.Writer = function(settings) { // Normalize the end points normalizeEndPoint(true); - if (rng.collapsed) + if (!rng.collapsed) normalizeEndPoint(); // Set the selection if it was normalized @@ -7405,12 +7545,11 @@ tinymce.html.Writer = function(settings) { if (!settings.apply_source_formatting) settings.indent = false; - settings.remove_trailing_brs = true; - // Default DOM and Schema if they are undefined dom = dom || tinymce.DOM; schema = schema || new tinymce.html.Schema(settings); settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; onPreProcess = new tinymce.util.Dispatcher(self); @@ -7474,8 +7613,8 @@ tinymce.html.Writer = function(settings) { function trim(value) { return value.replace(/()/g, '\n') .replace(/^[\r\n]*|[\r\n]*$/g, '') - .replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g, ''); + .replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); }; while (i--) { @@ -7624,7 +7763,7 @@ tinymce.html.Writer = function(settings) { // Replace all BOM characters for now until we can find a better solution if (!args.cleanup) - args.content = args.content.replace(/\uFEFF/g, ''); + args.content = args.content.replace(/\uFEFF|\u200B/g, ''); // Post process if (!args.no_events) @@ -7916,6 +8055,24 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { return; } + function exclude(nodes) { + var node; + + // First node is excluded + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + + // Last node is excluded + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + + return nodes; + }; + function collectSiblings(node, name, end_node) { var siblings = []; @@ -7945,7 +8102,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { if (!next) siblings.reverse(); - callback(siblings); + callback(exclude(siblings)); } } }; @@ -7958,28 +8115,28 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)]; - // Find common ancestor and end points - ancestor = dom.findCommonAncestor(startContainer, endContainer); - // Same container if (startContainer == endContainer) - return callback([startContainer]); + return callback(exclude([startContainer])); + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(startContainer, endContainer); + // Process left side for (node = startContainer; node; node = node.parentNode) { - if (node == endContainer) + if (node === endContainer) return walkBoundary(startContainer, ancestor, true); - if (node == ancestor) + if (node === ancestor) break; } // Process right side for (node = endContainer; node; node = node.parentNode) { - if (node == startContainer) + if (node === startContainer) return walkBoundary(endContainer, ancestor); - if (node == ancestor) + if (node === ancestor) break; } @@ -7998,48 +8155,46 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { ); if (siblings.length) - callback(siblings); + callback(exclude(siblings)); // Walk right leaf walkBoundary(endContainer, endPoint); }; - /* this.split = function(rng) { + this.split = function(rng) { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; function splitText(node, offset) { - if (offset == node.nodeValue.length) - node.appendData(INVISIBLE_CHAR); - - node = node.splitText(offset); - - if (node.nodeValue === INVISIBLE_CHAR) - node.nodeValue = ''; - - return node; + return node.splitText(offset); }; // Handle single text node - if (startContainer == endContainer) { - if (startContainer.nodeType == 3) { - if (startOffset != 0) - startContainer = endContainer = splitText(startContainer, startOffset); - - if (endOffset - startOffset != startContainer.nodeValue.length) - splitText(startContainer, endOffset - startOffset); + if (startContainer == endContainer && startContainer.nodeType == 3) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } } } else { // Split startContainer text node if needed - if (startContainer.nodeType == 3 && startOffset != 0) { + if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) { startContainer = splitText(startContainer, startOffset); startOffset = 0; } // Split endContainer text node if needed - if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) { + if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) { endContainer = splitText(endContainer, endOffset).previousSibling; endOffset = endContainer.nodeValue.length; } @@ -8052,7 +8207,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { endOffset : endOffset }; }; -*/ + }; tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) { @@ -8753,7 +8908,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { // Internal functions _setupKeyboardNav : function(){ var contextMenu, menuItems, t=this; - contextMenu = DOM.select('#menu_' + t.id)[0]; + contextMenu = DOM.get('menu_' + t.id); menuItems = DOM.select('a[role=option]', 'menu_' + t.id); menuItems.splice(0,0,contextMenu); t.keyboardNav = new tinymce.ui.KeyboardNavigation({ @@ -8860,10 +9015,27 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { }, postRender : function() { - var t = this, s = t.settings; - + var t = this, s = t.settings, imgBookmark; + + // In IE a large image that occupies the entire editor area will be deselected when a button is clicked, so + // need to keep the selection in case the selection is lost + if (tinymce.isIE && t.editor) { + tinymce.dom.Event.add(t.id, 'mousedown', function(e) { + var nodeName = t.editor.selection.getNode().nodeName; + imgBookmark = nodeName === 'IMG' ? t.editor.selection.getBookmark() : null; + }); + } tinymce.dom.Event.add(t.id, 'click', function(e) { - if (!t.isDisabled()) + if (!t.isDisabled()) { + // restore the selection in case the selection is lost in IE + if (tinymce.isIE && t.editor && imgBookmark !== null) { + t.editor.selection.moveToBookmark(imgBookmark); + } + return s.onclick.call(s.scope, e); + } + }); + tinymce.dom.Event.add(t.id, 'keyup', function(e) { + if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR) return s.onclick.call(s.scope, e); }); } @@ -8898,7 +9070,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return t.selectByIndex(-1); // Is string or number make function selector - if (va && va.call) + if (va && typeof(va)=="function") f = va; else { f = function(v) { @@ -9174,7 +9346,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return t.selectByIndex(-1); // Is string or number make function selector - if (va && va.call) + if (va && typeof(va)=="function") f = va; else { f = function(v) { @@ -9565,15 +9737,21 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { } n = DOM.add(tr, 'td'); - n = DOM.add(n, 'a', { - role : 'option', + var settings = { href : 'javascript:;', style : { backgroundColor : '#' + c }, 'title': t.editor.getLang('colors.' + c, c), 'data-mce-color' : '#' + c - }); + }; + + // adding a proper ARIA role = button causes JAWS to read things incorrectly on IE. + if (!tinymce.isIE ) { + settings['role']= 'option'; + } + + n = DOM.add(n, 'a', settings); if (t.editor.forcedHighContrastMode) { n = DOM.add(n, 'canvas', { width: 16, height: 16, 'aria-hidden': 'true' }); @@ -10212,7 +10390,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, - inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode; + inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode, VK = tinymce.VK; tinymce.create('tinymce.Editor', { Editor : function(id, s) { @@ -10236,6 +10414,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { 'onPostRender', + 'onLoad', + 'onInit', 'onRemove', @@ -10298,7 +10478,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { 'onVisualAid', - 'onSetProgressState' + 'onSetProgressState', + + 'onSetAttrib' ], function(e) { t[e] = new Dispatcher(t); }); @@ -10332,6 +10514,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { visual_table_class : 'mceItemTable', visual : 1, font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large', + font_size_legacy_values : 'xx-small,small,medium,large,x-large,xx-large,300%', // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size apply_source_formatting : 1, directionality : 'ltr', forced_root_block : 'p', @@ -10641,6 +10824,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { t.iframeHTML += ''; } + t.contentCSS = []; + bi = s.body_id || 'tinymce'; if (bi.indexOf('=') != -1) { bi = t.getParam('body_id', '', 'hash'); @@ -10653,7 +10838,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { bc = bc[t.id] || ''; } - t.iframeHTML += '
    '; + t.iframeHTML += '
    '; // Domain relaxing enabled, then set document domain if (tinymce.relaxedDomain && (isIE || (tinymce.isOpera && parseFloat(opera.version()) < 11))) { @@ -10767,10 +10952,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Keep scripts from executing t.parser.addNodeFilter('script', function(nodes, name) { - var i = nodes.length; + var i = nodes.length, node; - while (i--) - nodes[i].attr('type', 'mce-text/javascript'); + while (i--) { + node = nodes[i]; + node.attr('type', 'mce-' + (node.attr('type') || 'text/javascript')); + } }); t.parser.addNodeFilter('#cdata', function(nodes, name) { @@ -11119,7 +11306,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } t._refreshContentEditable(); - selection.normalize(); // Is not content editable if (!ce) @@ -11319,9 +11505,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus)) t.focus(); - o = {}; - t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o); - if (o.terminate) + a = extend({}, a); + t.onBeforeExecCommand.dispatch(t, cmd, ui, val, a); + if (a.terminate) return false; // Command callback @@ -11891,30 +12077,32 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Add block quote deletion handler t.onKeyDown.add(function(ed, e) { - // Was the BACKSPACE key pressed? - if (e.keyCode != 8) + if (e.keyCode != VK.BACKSPACE) + return; + + var rng = ed.selection.getRng(); + if (!rng.collapsed) return; - var n = ed.selection.getRng().startContainer; - var offset = ed.selection.getRng().startOffset; + var n = rng.startContainer; + var offset = rng.startOffset; while (n && n.nodeType && n.nodeType != 1 && n.parentNode) n = n.parentNode; - + // Is the cursor at the beginning of a blockquote? if (n && n.parentNode && n.parentNode.tagName === 'BLOCKQUOTE' && n.parentNode.firstChild == n && offset == 0) { // Remove the blockquote ed.formatter.toggle('blockquote', null, n.parentNode); // Move the caret to the beginning of n - var rng = ed.selection.getRng(); rng.setStart(n, 0); rng.setEnd(n, 0); ed.selection.setRng(rng); ed.selection.collapse(false); } }); - + // Add reset handler @@ -12051,7 +12239,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { t.undoManager.add(); }; - dom.bind(t.getDoc(), 'focusout', function(e) { + var focusLostFunc = tinymce.isGecko ? 'blur' : 'focusout'; + dom.bind(t.getDoc(), focusLostFunc, function(e){ if (!t.removed && t.undoManager.typing) addUndo(); }); @@ -12111,21 +12300,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }); } - // Fire a nodeChanged when the selection is changed on WebKit this fixes selection issues on iOS5 - // It only fires the nodeChange event every 50ms since it would other wise update the UI when you type and it hogs the CPU - if (tinymce.isWebKit) { - dom.bind(t.getDoc(), 'selectionchange', function() { - if (t.selectionTimer) { - clearTimeout(t.selectionTimer); - t.selectionTimer = 0; - } - - t.selectionTimer = window.setTimeout(function() { - t.nodeChanged(); - }, 50); - }); - } - // Bug fix for FireFox keeping styles from end of selection instead of start. if (tinymce.isGecko) { function getAttributeApplyFunction() { @@ -12135,11 +12309,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var target = t.selection.getStart(); if (target !== t.getBody()) { - t.dom.removeAllAttribs(target); + t.dom.setAttrib(target, "style", null); - each(template, function(attr) { - target.setAttributeNode(attr.cloneNode(true)); - }); + each(template, function(attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); } }; } @@ -12450,6 +12624,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var parser, serializer, parentNode, rootNode, fragment, args, marker, nodeRect, viewPortRect, rng, node, node2, bookmarkHtml, viewportBodyElement; + //selection.normalize(); + // Setup parser and serializer parser = editor.parser; serializer = new tinymce.html.Serializer({}, editor.schema); @@ -12676,7 +12852,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { addCommands({ // Override justify commands 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) { - return isFormatMatch('align' + command.substring(7)); + var name = 'align' + command.substring(7); + // Use Formatter.matchNode instead of Formatter.match so that we don't match on parent node. This fixes bug where for both left + // and right align buttons can be active. This could occur when selected nodes have align right and the parent has align left. + var nodes = selection.isCollapsed() ? [selection.getNode()] : selection.getSelectedBlocks(); + var matches = tinymce.map(nodes, function(node) { + return !!formatter.matchNode(node, name); + }); + return tinymce.inArray(matches, TRUE) !== -1; }, 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) { @@ -13983,8 +14166,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { MCE_ATTR_RE = /^(src|href|style)$/, FALSE = false, TRUE = true, - undefined, - pendingFormats = {apply : [], remove : []}; + undefined; function isArray(obj) { return obj instanceof Array; @@ -13995,7 +14177,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function isCaretNode(node) { - return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline'); + return node.nodeType === 1 && node.id === '_mce_caret'; }; // Public functions @@ -14070,30 +14252,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function apply(name, vars, node) { var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed(); - function moveStart(rng) { - var container = rng.startContainer, - offset = rng.startOffset, - walker, node; - - // Move startContainer/startOffset in to a suitable node - if (container.nodeType == 1 || container.nodeValue === "") { - container = container.nodeType == 1 ? container.childNodes[offset] : container; - - // Might fail if the offset is behind the last element in it's container - if (container) { - walker = new TreeWalker(container, container.parentNode); - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { - rng.setStart(node, 0); - break; - } - } - } - } - - return rng; - }; - function setElementFormat(elm, fmt) { fmt = fmt || format; @@ -14200,7 +14358,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } }; - function applyRngStyle(rng, bookmark) { + function applyRngStyle(rng, bookmark, node_specific) { var newWrappers = [], wrapName, wrapElm; // Setup wrapper element @@ -14264,7 +14422,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Is it valid to wrap this item if (isValid(wrapName, nodeName) && isValid(parentName, wrapName) && - !(node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279)) { + !(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) { // Start wrapping if (!currentWrapElm) { // Wrap the node @@ -14419,12 +14577,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (format) { if (node) { - rng = dom.createRng(); - - rng.setStartBefore(node); - rng.setEndAfter(node); - - applyRngStyle(expandRng(rng, formatList)); + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(expandRng(rng, formatList), null, true); + } else { + applyRngStyle(node, null, true); + } } else { if (!isCollapsed || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) { // Obtain selection node before selection is unselected by applyRngStyle() @@ -14442,7 +14602,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } selection.moveToBookmark(bookmark); - selection.setRng(moveStart(selection.getRng(TRUE))); + moveStart(selection.getRng(TRUE)); ed.nodeChanged(); } else performCaretAction('apply', name, vars); @@ -14452,44 +14612,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function remove(name, vars, node) { var formatList = get(name), format = formatList[0], bookmark, i, rng; - function moveStart(rng) { - var container = rng.startContainer, - offset = rng.startOffset, - walker, node, nodes, tmpNode; - - // Convert text node into index if possible - if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) { - container = container.parentNode; - offset = nodeIndex(container) + 1; - } - - // Move startContainer/startOffset in to a suitable node - if (container.nodeType == 1) { - nodes = container.childNodes; - container = nodes[Math.min(offset, nodes.length - 1)]; - walker = new TreeWalker(container); - - // If offset is at end of the parent node walk to the next one - if (offset > nodes.length - 1) - walker.next(); - - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { - // IE has a "neat" feature where it moves the start node into the closest element - // we can avoid this by inserting an element before it and then remove it after we set the selection - tmpNode = dom.create('a', null, INVISIBLE_CHAR); - node.parentNode.insertBefore(tmpNode, node); - - // Set selection and remove tmpNode - rng.setStart(node, 0); - selection.setRng(rng); - dom.remove(tmpNode); - - return; - } - } - } - }; // Merges the styles for each node function process(node) { @@ -14638,10 +14760,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Handle node if (node) { - rng = dom.createRng(); - rng.setStartBefore(node); - rng.setEndAfter(node); - removeRngStyle(rng); + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + return; } @@ -14658,6 +14785,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { ed.nodeChanged(); } else performCaretAction('remove', name, vars); + + // When you remove formatting from a table cell in WebKit (cell, not the contents of a cell) there is a rendering issue with column width + if (tinymce.isWebKit) { + ed.execCommand('mceCleanup'); + } }; function toggle(name, vars, node) { @@ -14732,7 +14864,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function match(name, vars, node) { - var startNode, i; + var startNode; function matchParents(node) { // Find first node with similar format settings @@ -14748,21 +14880,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (node) return matchParents(node); - // Check pending formats - if (selection.isCollapsed()) { - for (i = pendingFormats.apply.length - 1; i >= 0; i--) { - if (pendingFormats.apply[i].name == name) - return true; - } - - for (i = pendingFormats.remove.length - 1; i >= 0; i--) { - if (pendingFormats.remove[i].name == name) - return false; - } - - return matchParents(selection.getNode()); - } - // Check selected node node = selection.getNode(); if (matchParents(node)) @@ -14781,33 +14898,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function matchAll(names, vars) { var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name; - // If the selection is collapsed then check pending formats - if (selection.isCollapsed()) { - for (ni = 0; ni < names.length; ni++) { - // If the name is to be removed, then stop it from being added - for (i = pendingFormats.remove.length - 1; i >= 0; i--) { - name = names[ni]; - - if (pendingFormats.remove[i].name == name) { - checkedMap[name] = true; - break; - } - } - } - - // If the format is to be applied - for (i = pendingFormats.apply.length - 1; i >= 0; i--) { - for (ni = 0; ni < names.length; ni++) { - name = names[ni]; - - if (!checkedMap[name] && pendingFormats.apply[i].name == name) { - checkedMap[name] = true; - matchedFormatNames.push(name); - } - } - } - } - // Check start of selection for formats startElement = selection.getStart(); dom.getParent(startElement, function(node) { @@ -14916,7 +15006,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function isWhiteSpaceNode(node) { - return node && node.nodeType === 3 && /^([\s\r\n]+|)$/.test(node.nodeValue); + return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue); }; function wrap(node, name, attrs) { @@ -14932,31 +15022,42 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, - endOffset = rng.endOffset, sibling, lastIdx, leaf; + endOffset = rng.endOffset, sibling, lastIdx, leaf, endPoint; // This function walks up the tree if there is no siblings before/after the node - function findParentContainer(container, child_name, sibling_name, root) { - var parent, child; - - root = root || dom.getRoot(); + function findParentContainer(start) { + var container, parent, child, sibling, siblingName; - for (;;) { - // Check if we can move up are we at root level or body level - parent = container.parentNode; + container = parent = start ? startContainer : endContainer; + siblingName = start ? 'previousSibling' : 'nextSibling'; + root = dom.getRoot(); - // Stop expanding on block elements or root depending on format - if (parent == root || (!format[0].block_expand && isBlock(parent))) + // If it's a text node and the offset is inside the text + if (container.nodeType == 3 && !isWhiteSpaceNode(container)) { + if (start ? startOffset > 0 : endOffset < container.nodeValue.length) { return container; + } + } - for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) { - if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) - return container; + for (;;) { + // Stop expanding on block elements + if (!format[0].block_expand && isBlock(parent)) + return parent; + + // Walk left/right + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling)) { + return parent; + } + } - if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling)) - return container; + // Check if we can move up are we at root level or body level + if (parent.parentNode == root) { + container = parent; + break; } - container = container.parentNode; + parent = parent.parentNode; } return container; @@ -14994,23 +15095,103 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } // Exclude bookmark nodes if possible - if (isBookmarkNode(startContainer.parentNode)) - startContainer = startContainer.parentNode; - - if (isBookmarkNode(startContainer)) + if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) { + startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; startContainer = startContainer.nextSibling || startContainer; - if (isBookmarkNode(endContainer.parentNode)) { - endOffset = dom.nodeIndex(endContainer); - endContainer = endContainer.parentNode; + if (startContainer.nodeType == 3) + startOffset = 0; } - if (isBookmarkNode(endContainer) && endContainer.previousSibling) { - endContainer = endContainer.previousSibling; - endOffset = endContainer.length; + if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) { + endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; + endContainer = endContainer.previousSibling || endContainer; + + if (endContainer.nodeType == 3) + endOffset = endContainer.length; } if (format[0].inline) { + if (rng.collapsed) { + function findWordEndPoint(container, offset, start) { + var walker, node, pos, lastTextNode; + + function findSpace(node, offset) { + var pos, pos2, str = node.nodeValue; + + if (typeof(offset) == "undefined") { + offset = start ? str.length : 0; + } + + if (start) { + pos = str.lastIndexOf(' ', offset); + pos2 = str.lastIndexOf('\u00a0', offset); + pos = pos > pos2 ? pos : pos2; + + // Include the space on remove to avoid tag soup + if (pos !== -1 && !remove) { + pos++; + } + } else { + pos = str.indexOf(' ', offset); + pos2 = str.indexOf('\u00a0', offset); + pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2; + } + + return pos; + }; + + if (container.nodeType === 3) { + pos = findSpace(container, offset); + + if (pos !== -1) { + return {container : container, offset : pos}; + } + + lastTextNode = container; + } + + // Walk the nodes inside the block + walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody()); + while (node = walker[start ? 'prev' : 'next']()) { + if (node.nodeType === 3) { + lastTextNode = node; + pos = findSpace(node); + + if (pos !== -1) { + return {container : node, offset : pos}; + } + } else if (isBlock(node)) { + break; + } + } + + if (lastTextNode) { + if (start) { + offset = 0; + } else { + offset = lastTextNode.length; + } + + return {container: lastTextNode, offset: offset}; + } + } + + // Expand left to closest word boundery + endPoint = findWordEndPoint(startContainer, startOffset, true); + if (endPoint) { + startContainer = endPoint.container; + startOffset = endPoint.offset; + } + + // Expand right to closest word boundery + endPoint = findWordEndPoint(endContainer, endOffset); + if (endPoint) { + endContainer = endPoint.container; + endOffset = endPoint.offset; + } + } + // Avoid applying formatting to a trailing space. leaf = findLeaf(endContainer, endOffset); if (leaf.node) { @@ -15024,19 +15205,25 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { endContainer = leaf.node; endContainer.splitText(leaf.offset - 1); } else if (leaf.node.previousSibling) { - endContainer = leaf.node.previousSibling; + // TODO: Figure out why this is in here + //endContainer = leaf.node.previousSibling; } } } } - + // Move start/end point up the tree if the leaves are sharp and if we are in different containers // Example * becomes !: !

    *texttext*

    ! // This will reduce the number of wrapper elements that needs to be created // Move start point up the tree if (format[0].inline || format[0].block_expand) { - startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling'); - endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling'); + if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) { + startContainer = findParentContainer(true); + } + + if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(); + } } // Expand start/end container to matching selector @@ -15110,10 +15297,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Non block element then try to expand up the leaf if (format[0].block) { if (!isBlock(startContainer)) - startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling'); + startContainer = findParentContainer(true); if (!isBlock(endContainer)) - endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling'); + endContainer = findParentContainer(); } } @@ -15406,7 +15593,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function getContainer(rng, start) { - var container, offset, lastIdx; + var container, offset, lastIdx, walker; container = rng[start ? 'startContainer' : 'endContainer']; offset = rng[start ? 'startOffset' : 'endOffset']; @@ -15420,149 +15607,325 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { container = container.childNodes[offset > lastIdx ? lastIdx : offset]; } + // If start text node is excluded then walk to the next node + if (container.nodeType === 3 && start && offset >= container.nodeValue.length) { + container = new TreeWalker(container, ed.getBody()).next() || container; + } + + // If end text node is excluded then walk to the previous node + if (container.nodeType === 3 && !start && offset == 0) { + container = new TreeWalker(container, ed.getBody()).prev() || container; + } + return container; }; function performCaretAction(type, name, vars) { - var i, currentPendingFormats = pendingFormats[type], - otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply']; + var invisibleChar, caretContainerId = '_mce_caret', debug = ed.settings.caret_debug; + + // Setup invisible character use zero width space on Gecko since it doesn't change the heigt of the container + invisibleChar = tinymce.isGecko ? '\u200B' : INVISIBLE_CHAR; + + // Creates a caret container bogus element + function createCaretContainer(fill) { + var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''}); + + if (fill) { + caretContainer.appendChild(ed.getDoc().createTextNode(invisibleChar)); + } + + return caretContainer; + }; - function hasPending() { - return pendingFormats.apply.length || pendingFormats.remove.length; + function isCaretContainerEmpty(node, nodes) { + while (node) { + if ((node.nodeType === 3 && node.nodeValue !== invisibleChar) || node.childNodes.length > 1) { + return false; + } + + // Collect nodes + if (nodes && node.nodeType === 1) { + nodes.push(node); + } + + node = node.firstChild; + } + + return true; }; + + // Returns any parent caret container element + function getParentCaretContainer(node) { + while (node) { + if (node.id === caretContainerId) { + return node; + } - function resetPending() { - pendingFormats.apply = []; - pendingFormats.remove = []; + node = node.parentNode; + } }; - function perform(caret_node) { - // Apply pending formats - each(pendingFormats.apply.reverse(), function(item) { - apply(item.name, item.vars, caret_node); + // Finds the first text node in the specified node + function findFirstTextNode(node) { + var walker; - // Colored nodes should be underlined so that the color of the underline matches the text color. - if (item.name === 'forecolor' && item.vars.value) - processUnderlineAndColor(caret_node.parentNode); - }); + if (node) { + walker = new TreeWalker(node, node); - // Remove pending formats - each(pendingFormats.remove.reverse(), function(item) { - remove(item.name, item.vars, caret_node); - }); + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3) { + return node; + } + } + } + }; + + // Removes the caret container for the specified node or all on the current document + function removeCaretContainer(node, move_caret) { + var child, rng; + + if (!node) { + node = getParentCaretContainer(selection.getStart()); - dom.remove(caret_node, 1); - resetPending(); + if (!node) { + while (node = dom.get(caretContainerId)) { + removeCaretContainer(node, false); + } + } + } else { + rng = selection.getRng(true); + + if (isCaretContainerEmpty(node)) { + if (move_caret !== false) { + rng.setStartBefore(node); + rng.setEndBefore(node); + } + + dom.remove(node); + } else { + child = findFirstTextNode(node); + + if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) { + child = child.deleteData(0, 1); + } + + dom.remove(node, 1); + } + + selection.setRng(rng); + } + }; + + // Applies formatting to the caret postion + function applyCaretFormat() { + var rng, caretContainer, textNode, offset, bookmark, container, text; + + rng = selection.getRng(true); + offset = rng.startOffset; + container = rng.startContainer; + text = container.nodeValue; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + + // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character + if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name)); + rng = rangeUtils.split(rng); + + // Apply the format to the range + apply(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== invisibleChar) { + caretContainer = createCaretContainer(true); + textNode = caretContainer.firstChild; + + rng.insertNode(caretContainer); + offset = 1; + + apply(name, vars, caretContainer); + } else { + apply(name, vars, caretContainer); + } + + // Move selection to text node + selection.setCursorLocation(textNode, offset); + } }; - // Check if it already exists then ignore it - for (i = currentPendingFormats.length - 1; i >= 0; i--) { - if (currentPendingFormats[i].name == name) + function removeCaretFormat() { + var rng = selection.getRng(true), container, offset, bookmark, + hasContentAfter, node, formatNode, parents = [], i, caretContainer; + + container = rng.startContainer; + offset = rng.startOffset; + node = container; + + if (container.nodeType == 3) { + if (offset != container.nodeValue.length || container.nodeValue === invisibleChar) { + hasContentAfter = true; + } + + node = node.parentNode; + } + + while (node) { + if (matchNode(node, name, vars)) { + formatNode = node; + break; + } + + if (node.nextSibling) { + hasContentAfter = true; + } + + parents.push(node); + node = node.parentNode; + } + + // Node doesn't have the specified format + if (!formatNode) { return; - } + } - currentPendingFormats.push({name : name, vars : vars}); + // Is there contents after the caret then remove the format on the element + if (hasContentAfter) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); - // Check if it's in the other type, then remove it - for (i = otherPendingFormats.length - 1; i >= 0; i--) { - if (otherPendingFormats[i].name == name) - otherPendingFormats.splice(i, 1); - } + // Collapse bookmark range (WebKit) + rng.collapse(true); - // Pending apply or remove formats - if (hasPending()) { - ed.getDoc().execCommand('FontName', false, 'mceinline'); - pendingFormats.lastRng = selection.getRng(); + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name), true); + rng = rangeUtils.split(rng); - // IE will convert the current word - each(dom.select('font,span'), function(node) { - var bookmark; + // Remove the format from the range + remove(name, vars, rng); - if (isCaretNode(node)) { - bookmark = selection.getBookmark(); - perform(node); - selection.moveToBookmark(bookmark); - ed.nodeChanged(); + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + caretContainer = createCaretContainer(); + + node = caretContainer; + for (i = parents.length - 1; i >= 0; i--) { + node.appendChild(parents[i].cloneNode(false)); + node = node.firstChild; + } + + // Insert invisible character into inner most format element + node.appendChild(dom.doc.createTextNode(invisibleChar)); + node = node.firstChild; + + // Insert caret container after the formated node + dom.insertAfter(caretContainer, formatNode); + + // Move selection to text node + selection.setCursorLocation(node, 1); + } + }; + + // Only bind the caret events once + if (!self._hasCaretEvents) { + // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements + ed.onBeforeGetContent.addToTop(function() { + var nodes = [], i; + + if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) { + // Mark children + i = nodes.length; + while (i--) { + dom.setAttrib(nodes[i], 'data-mce-bogus', '1'); + } } }); - // Only register listeners once if we need to - if (!pendingFormats.isListening && hasPending()) { - pendingFormats.isListening = true; - function performPendingFormat(node, textNode) { - var rng = dom.createRng(); - perform(node); + // Remove caret container on mouse up and on key up + tinymce.each('onMouseUp onKeyUp'.split(' '), function(name) { + ed[name].addToTop(function() { + removeCaretContainer(); + }); + }); - rng.setStart(textNode, textNode.nodeValue.length); - rng.setEnd(textNode, textNode.nodeValue.length); - selection.setRng(rng); - ed.nodeChanged(); + // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys + ed.onKeyDown.addToTop(function(ed, e) { + var keyCode = e.keyCode; + + if (keyCode == 8 || keyCode == 37 || keyCode == 39) { + removeCaretContainer(getParentCaretContainer(selection.getStart())); } - var enterKeyPressed = false; + }); - each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) { - ed[event].addToTop(function(ed, e) { - if (e.keyCode==13 && !e.shiftKey) { - enterKeyPressed = true; - return; - } - // Do we have pending formats and is the selection moved has moved - if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) { - var foundCaret = false; - each(dom.select('font,span'), function(node) { - var textNode, rng; - - // Look for marker - if (isCaretNode(node)) { - foundCaret = true; - textNode = node.firstChild; - - // Find the first text node within node - while (textNode && textNode.nodeType != 3) - textNode = textNode.firstChild; - - if (textNode) - performPendingFormat(node, textNode); - else - dom.remove(node); - } - }); - - // no caret - so we are - if (enterKeyPressed && !foundCaret) { - var node = selection.getNode(); - var textNode = node; - - // Find the first text node within node - while (textNode && textNode.nodeType != 3) - textNode = textNode.firstChild; - if (textNode) { - node=textNode.parentNode; - while (!isBlock(node)){ - node=node.parentNode; - } - performPendingFormat(node, textNode); - } - } + self._hasCaretEvents = true; + } - // Always unbind and clear pending styles on keyup - if (e.type == 'keyup' || e.type == 'mouseup') { - resetPending(); - enterKeyPressed=false; - } - } - }); - }); + // Do apply or remove caret format + if (type == "apply") { + applyCaretFormat(); + } else { + removeCaretFormat(); + } + }; + + function moveStart(rng) { + var container = rng.startContainer, + offset = rng.startOffset, + walker, node, nodes, tmpNode; + + // Convert text node into index if possible + if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) { + container = container.parentNode; + offset = nodeIndex(container) + 1; + } + + // Move startContainer/startOffset in to a suitable node + if (container.nodeType == 1) { + nodes = container.childNodes; + container = nodes[Math.min(offset, nodes.length - 1)]; + walker = new TreeWalker(container); + + // If offset is at end of the parent node walk to the next one + if (offset > nodes.length - 1) + walker.next(); + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { + // IE has a "neat" feature where it moves the start node into the closest element + // we can avoid this by inserting an element before it and then remove it after we set the selection + tmpNode = dom.create('a', null, INVISIBLE_CHAR); + node.parentNode.insertBefore(tmpNode, node); + + // Set selection and remove tmpNode + rng.setStart(node, 0); + selection.setRng(rng); + dom.remove(tmpNode); + + return; + } } } }; + }; })(tinymce); tinymce.onAddEditor.add(function(tinymce, ed) { var filters, fontSizes, dom, settings = ed.settings; if (settings.inline_styles) { - fontSizes = tinymce.explode(settings.font_size_style_values); + fontSizes = tinymce.explode(settings.font_size_legacy_values); function replaceWithSpan(node, styles) { tinymce.each(styles, function(value, name) { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_popup.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_popup.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_popup.js rename to lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_popup.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_popup_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_popup_src.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_popup_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_popup_src.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_prototype.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_prototype.js new file mode 100644 index 0000000000000..37f27cbdd7da8 --- /dev/null +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_prototype.js @@ -0,0 +1 @@ +(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m0?d:[g.scope]);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,i,d,c,h;e=tinymce.trim(e);g=f.settings=g||{};if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^[\w-]*:?\/\//.test(e)){h=g.base_uri?g.base_uri.path:new tinymce.util.URI(location.href).directory;e=((g.base_uri&&g.base_uri.protocol)||"http")+"://mce_host"+f.toAbsPath(h,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){if(o.hasOwnProperty(i)){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={DELETE:46,BACKSPACE:8,ENTER:13,TAB:9,SPACEBAR:32,UP:38,DOWN:40,modifierPressed:function(b){return b.shiftKey||b.ctrlKey||b.altKey}}})(tinymce);(function(l){var j=l.VK,k=j.BACKSPACE,h=j.DELETE;function c(n){var p=n.dom,o=n.selection;n.onKeyDown.add(function(r,v){var q,x,t,u,s;s=v.keyCode==h;if((s||v.keyCode==k)&&!j.modifierPressed(v)){v.preventDefault();q=o.getRng();x=p.getParent(q.startContainer,p.isBlock);if(s){x=p.getNext(x,p.isBlock)}if(x){t=x.firstChild;while(t&&t.nodeType==3&&t.nodeValue.length==0){t=t.nextSibling}if(t&&t.nodeName==="SPAN"){u=t.cloneNode(false)}}r.getDoc().execCommand(s?"ForwardDelete":"Delete",false,null);x=p.getParent(q.startContainer,p.isBlock);l.each(p.select("span.Apple-style-span,font.Apple-style-span",x),function(y){var z=o.getBookmark();if(u){p.replace(u.cloneNode(false),y,true)}else{p.remove(y,true)}o.moveToBookmark(z)})}})}function d(n){function o(r){var q=n.dom.create("body");var s=r.cloneContents();q.appendChild(s);return n.selection.serializer.serialize(q,{format:"html"})}function p(q){var s=o(q);var t=n.dom.createRng();t.selectNode(n.getBody());var r=o(t);return s===r}n.onKeyDown.addToTop(function(r,t){var s=t.keyCode;if(s==h||s==k){var q=r.selection.getRng(true);if(!q.collapsed&&p(q)){r.setContent("",{format:"raw"});r.nodeChanged();t.preventDefault()}}})}function b(n){n.dom.bind(n.getDoc(),"focusin",function(){n.selection.setRng(n.selection.getRng())})}function e(n){n.onKeyDown.add(function(o,r){if(r.keyCode===k){if(o.selection.isCollapsed()&&o.selection.getRng(true).startOffset===0){var q=o.selection.getNode();var p=q.previousSibling;if(p&&p.nodeName&&p.nodeName.toLowerCase()==="hr"){o.dom.remove(p);l.dom.Event.cancel(r)}}}})}function g(n){if(!Range.prototype.getClientRects){n.onMouseDown.add(function(p,q){if(q.target.nodeName==="HTML"){var o=p.getBody();o.blur();setTimeout(function(){o.focus()},0)}})}}function f(n){n.onClick.add(function(o,p){p=p.target;if(/^(IMG|HR)$/.test(p.nodeName)){o.selection.getSel().setBaseAndExtent(p,0,p,1)}if(p.nodeName=="A"&&o.dom.hasClass(p,"mceItemAnchor")){o.selection.select(p)}o.nodeChanged()})}function i(n){n.onKeyDown.add(function(o,p){function q(r){var s=r.selection.getNode();var t="h1,h2,h3,h4,h5,h6";return r.dom.is(s,t)||r.dom.getParent(s,t)!==null}if(p.keyCode===j.ENTER&&!j.modifierPressed(p)&&q(o)){setTimeout(function(){var r=o.selection.getNode();if(o.dom.is(r,"p")){o.dom.setAttrib(r,"style",null);o.execCommand("mceCleanup")}},0)}})}function m(n){var p,o;n.dom.bind(n.getDoc(),"selectionchange",function(){if(o){clearTimeout(o);o=0}o=window.setTimeout(function(){var q=n.selection.getRng();if(!p||!l.dom.RangeUtils.compareRanges(q,p)){n.nodeChanged();p=q}},50)})}function a(n){document.body.setAttribute("role","application")}l.create("tinymce.util.Quirks",{Quirks:function(n){if(l.isWebKit){c(n);d(n);b(n);f(n);if(l.isIDevice){m(n)}}if(l.isIE){e(n);d(n);a(n);i(n)}if(l.isGecko){e(n);g(n)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";l=d(l,",",d(l.toUpperCase()));h=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,audio,object"),g);b=d("pre,script,style,textarea");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(r){var A=this,n={},o={},y=[],q,p;r=r||{};if(r.verify_html===false){r.valid_elements="*[*]"}if(r.valid_styles){q={};k(r.valid_styles,function(C,B){q[B]=m.explode(C)})}p=r.whitespace_elements?d(r.whitespace_elements):b;function z(B){return new RegExp("^"+B.replace(/([?+*])/g,".$1")+"$")}function t(I){var H,D,W,S,X,C,F,R,U,N,V,Z,L,G,T,B,P,E,Y,aa,M,Q,K=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,O=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,J=/[*?+]/;if(I){I=i(I);if(n["@"]){P=n["@"].attributes;E=n["@"].attributesOrder}for(H=0,D=I.length;H=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},select:function(l,k){var j=this;return h.dom.Sizzle(l,j.get(k)||j.get(j.settings.root_element)||j.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(a.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return h.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(q){var p=k.settings;var n=q.getAttribute(m);if(j!==null){switch(m){case"style":if(!e(j,"string")){f(j,function(r,s){k.setStyle(q,s,r)});return}if(p.keep_values){if(j&&!k._isRes(j)){q.setAttribute("data-mce-style",j,2)}else{q.removeAttribute("data-mce-style",2)}}q.style.cssText=j;break;case"class":q.className=j||"";break;case"src":case"href":if(p.keep_values){if(p.url_converter){j=p.url_converter.call(p.url_converter_scope||k,j,m,q)}k.setAttrib(q,"data-mce-"+m,j,2)}break;case"shape":q.setAttribute("data-mce-style",j);break}}if(e(j)&&j!==null&&j.length!==0){q.setAttribute(m,""+j,2)}else{q.removeAttribute(m,2)}if(tinyMCE.activeEditor&&n!=j){var o=tinyMCE.activeEditor;o.onSetAttrib.dispatch(o,q,m,j)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(o,p,l){var j,k=this,m;o=k.get(o);if(!o||o.nodeType!==1){return l===m?false:l}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(p)){j=o.getAttribute("data-mce-"+p);if(j){return j}}if(b&&k.props[p]){j=o[k.props[p]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=o.getAttribute(p,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(p)){if(o[k.props[p]]===true&&j===""){return p}return j?p:""}if(o.nodeName==="FORM"&&o.getAttributeNode(p)){return o.getAttributeNode(p).nodeValue}if(p==="style"){j=j||o.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),o.nodeName);if(k.settings.keep_values&&!k._isRes(j)){o.setAttribute("data-mce-style",j)}}}if(d&&p==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(p){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return p}return l;case"shape":j=j.toLowerCase();break;default:if(p.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==m&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
    "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
    "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p;m=m.firstChild;if(m){j=new h.dom.TreeWalker(m);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){p=m.parentNode;if(l==="br"&&r.isBlock(p)&&p.firstChild===m&&p.lastChild===m){continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if(q==8){return false}if((q===3&&!i.test(m.nodeValue))){return false}}while(m=j.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(x){var u,t=x.childNodes,v=x.nodeType;function y(B){var A=B.previousSibling&&B.previousSibling.nodeName=="SPAN";var z=B.nextSibling&&B.nextSibling.nodeName=="SPAN";return A&&z}if(v==1&&x.getAttribute("data-mce-type")=="bookmark"){return}for(u=t.length-1;u>=0;u--){k(t[u])}if(v!=9){if(v==3&&x.nodeValue.length>0){var r=h.trim(x.nodeValue).length;if(!s.isBlock(x.parentNode)||r>0||r==0&&y(x)){return}}else{if(v==1){t=x.childNodes;if(t.length==1&&t[0]&&t[0].nodeType==1&&t[0].getAttribute("data-mce-type")=="bookmark"){x.parentNode.insertBefore(t[0],x)}if(t.length||/^(br|hr|input|img)$/i.test(x.nodeName)){return}}}s.remove(x)}return x}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p&&t.nodeType!==9){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1&&p==q-1){if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return re[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="

    ";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="
    ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.readyState==="complete"){g._pageInit(i);return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='_';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('_'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
    ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.rangeCount>0?h.getRangeAt(0):null}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(o,g){var m=this,j=m.dom,l,k,h,i=[];l=j.getParent(o||m.getStart(),j.isBlock);k=j.getParent(g||m.getEnd(),j.isBlock);if(l){i.push(l)}if(l&&k&&l!=k){h=l;var f=new c.dom.TreeWalker(l,j.getRoot());while((h=f.next())&&h!=k){if(j.isBlock(h)){i.push(h)}}}if(k&&l!=k){i.push(k)}return i},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;i=true;break}if(/^(BR|IMG)$/.test(l.nodeName)){o=m.nodeIndex(l);k=l.parentNode;if(l.nodeName=="IMG"&&!p){o++}i=true;break}}while(l=(p?n.next():n.prev()))}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(!f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";e.remove_trailing_brs="remove_trailing_brs" in e?e.remove_trailing_brs:true;h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF|\u200B/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,s){var i=d.startContainer,l=d.startOffset,t=d.endContainer,m=d.endOffset,j,g,o,h,r,q,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(u){s([u])});return}function f(u){var v;v=u[0];if(v.nodeType===3&&v===i&&l>=v.nodeValue.length){u.splice(0,1)}v=u[u.length-1];if(m===0&&u.length>0&&v===t&&v.nodeType===3){u.splice(u.length-1,1)}return u}function p(x,v,u){var y=[];for(;x&&x!=u;x=x[v]){y.push(x)}return y}function n(v,u){do{if(v.parentNode==u){return v}v=v.parentNode}while(v)}function k(x,v,y){var u=y?"nextSibling":"previousSibling";for(h=x,r=h.parentNode;h&&h!=v;h=r){r=h.parentNode;q=p(h==x?h:h[u],u);if(q.length){if(!y){q.reverse()}s(f(q))}}}if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[l]}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[Math.min(m-1,t.childNodes.length-1)]}if(i==t){return s(f([i]))}j=c.findCommonAncestor(i,t);for(h=i;h;h=h.parentNode){if(h===t){return k(i,j,true)}if(h===j){break}}for(h=t;h;h=h.parentNode){if(h===i){return k(t,j)}if(h===j){break}}g=n(i,j)||i;o=n(t,j)||t;k(i,g,true);q=p(g==i?g:g.nextSibling,"nextSibling",o==t?o.nextSibling:o);if(q.length){s(f(q))}k(t,o)};this.split=function(e){var h=e.startContainer,d=e.startOffset,i=e.endContainer,g=e.endOffset;function f(j,k){return j.splitText(k)}if(h==i&&h.nodeType==3){if(d>0&&dd){g=g-d;h=i=f(i,g).previousSibling;g=i.nodeValue.length;d=0}else{g=0}}}else{if(h.nodeType==3&&d>0&&d0&&g=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.get("menu_"+g.id);h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var d=this,e=d.settings,c;if(b.isIE&&d.editor){b.dom.Event.add(d.id,"mousedown",function(f){var g=d.editor.selection.getNode().nodeName;c=g==="IMG"?d.editor.selection.getBookmark():null})}b.dom.Event.add(d.id,"click",function(f){if(!d.isDisabled()){if(b.isIE&&d.editor&&c!==null){d.editor.selection.moveToBookmark(c)}return e.onclick.call(e.scope,f)}});b.dom.Event.add(d.id,"keyup",function(f){if(!d.isDisabled()&&f.keyCode==b.VK.SPACEBAR){return e.onclick.call(e.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(m){m=m.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");var i={href:"javascript:;",style:{backgroundColor:"#"+m},title:p.editor.getLang("colors."+m,m),"data-mce-color":"#"+m};if(!d.isIE){i.role="option"}g=c.add(g,"a",i);if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+m;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){return;var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:q.convertURL,url_converter_scope:q,ie7_compat:true},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=n.baseURI;q.contentCSS=[];q.execCallback("setup",q)},render:function(u){var v=this,x=v.settings,y=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}tinyMCE.settings=x;if(!v.getElement()){return}if(n.isIDevice&&!n.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&x.hidden_input&&o.getParent(y,"form")){o.insertAfter(o.create("input",{type:"hidden",name:y}),y)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(x.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(x.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(x.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(x.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){n.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(x.language&&x.language_load!==false){q.add(n.baseURL+"/../../extra/strings.php?elanguage="+x.language+"ðeme="+x.theme)}if(x.theme&&x.theme.charAt(0)!="-"&&!h.urls[x.theme]){h.load(x.theme,"themes/"+x.theme+"/editor_template"+n.suffix+".js")}i(g(x.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(A){var z={prefix:"plugins/",resource:A,suffix:"/editor_plugin"+n.suffix+".js"};var A=c.createUrl(z,A);c.load(A.resource,A)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+n.suffix+".js"})}}});q.loadQueue(function(){if(!v.removed){v.init()}})}r()},init:function(){var v,I=this,J=I.settings,F,B,E=I.getElement(),r,q,G,z,D,H,A,x=[];n.add(I);J.aria_label=J.aria_label||o.getAttrib(E,"aria-label",I.getLang("aria.rich_text_area"));if(J.theme){J.theme=J.theme.replace(/-/,"");r=h.get(J.theme);I.theme=new r();if(I.theme.init&&J.init_theme){I.theme.init(I,h.urls[J.theme]||n.documentBaseURL.replace(/\/$/,""))}}function C(K){var L=c.get(K),t=c.urls[K]||n.documentBaseURL.replace(/\/$/,""),s;if(L&&n.inArray(x,K)===-1){i(c.dependencies(K),function(u){C(u)});s=new L(I,t);I.plugins[K]=s;if(s.init){s.init(I,t);x.push(K)}}}i(g(J.plugins.replace(/\-/g,"")),C);if(J.popup_css!==false){if(J.popup_css){J.popup_css=I.documentBaseURI.toAbsolute(J.popup_css)}else{J.popup_css=I.baseURI.toAbsolute("themes/"+J.theme+"/skins/"+J.skin+"/dialog.css")}}if(J.popup_css_add){J.popup_css+=","+I.documentBaseURI.toAbsolute(J.popup_css_add)}I.controlManager=new n.ControlManager(I);if(J.custom_undo_redo){I.onBeforeExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.beforeChange()}});I.onExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.add()}})}I.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){I.nodeChanged()}});if(a){function y(s,t){if(!t||!t.initial){I.execCommand("mceRepaint")}}I.onUndo.add(y);I.onRedo.add(y);I.onSetContent.add(y)}I.onBeforeRenderUI.dispatch(I,I.controlManager);if(J.render_ui){F=J.width||E.style.width||E.offsetWidth;B=J.height||E.style.height||E.offsetHeight;I.orgDisplay=E.style.display;H=/^[0-9\.]+(|px)$/i;if(H.test(""+F)){F=Math.max(parseInt(F)+(r.deltaWidth||0),100)}if(H.test(""+B)){B=Math.max(parseInt(B)+(r.deltaHeight||0),J.theme_advanced_resizing_min_height||100)}r=I.theme.renderUI({targetNode:E,width:F,height:B,deltaWidth:J.delta_width,deltaHeight:J.delta_height});I.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:F,height:B});if(J.content_css){n.each(g(J.content_css),function(s){I.contentCSS.push(I.documentBaseURI.toAbsolute(s))})}B=(r.iframeHeight||B)+(typeof(B)=="number"?(r.deltaHeight||0):"");if(B<(J.theme_advanced_resizing_min_height||100)){B=J.theme_advanced_resizing_min_height||100}I.iframeHTML=J.doctype+'';if(J.document_base_url!=n.documentBaseURL){I.iframeHTML+=''}if(J.ie7_compat){I.iframeHTML+=''}else{I.iframeHTML+=''}I.iframeHTML+='';for(A=0;A'}I.contentCSS=[];z=J.body_id||"tinymce";if(z.indexOf("=")!=-1){z=I.getParam("body_id","","hash");z=z[I.id]||z}D=J.body_class||"";if(D.indexOf("=")!=-1){D=I.getParam("body_class","","hash");D=D[I.id]||""}I.iframeHTML+='
    ";if(n.relaxedDomain&&(b||(n.isOpera&&parseFloat(opera.version())<11))){G='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+I.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}v=o.add(r.iframeContainer,"iframe",{id:I.id+"_ifr",src:G||'javascript:""',frameBorder:"0",allowTransparency:"true",title:J.aria_label,style:{width:"100%",height:B,display:"block"}});I.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=I.orgDisplay;o.get(I.id).style.display="none";o.setAttrib(I.id,"aria-hidden",true);if(!n.relaxedDomain||!G){I.setupIframe()}E=v=r=null},setupIframe:function(){var r=this,x=r.settings,y=o.get(r.id),z=r.getDoc(),v,q;if(!b||!n.relaxedDomain){z.open();z.write(r.iframeHTML);z.close();if(n.relaxedDomain){z.domain=n.relaxedDomain}}q=r.getBody();q.disabled=true;if(!x.readonly){q.contentEditable=true}q.disabled=false;r.schema=new n.html.Schema(x);r.dom=new n.dom.DOMUtils(r.getDoc(),{keep_values:true,url_converter:r.convertURL,url_converter_scope:r,hex_colors:x.force_hex_style_colors,class_filter:x.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:r.schema});r.parser=new n.html.DomParser(x,r.schema);if(!r.settings.allow_html_in_named_anchor){r.parser.addAttributeFilter("name",function(s,t){var B=s.length,D,A,C,E;while(B--){E=s[B];if(E.name==="a"&&E.firstChild){C=E.parent;D=E.lastChild;do{A=D.prev;C.insert(D,E);D=A}while(D)}}})}r.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,C,E=r.dom,D,B;while(A--){C=s[A];D=C.attr(t);B="data-mce-"+t;if(!C.attributes.map[B]){if(t==="style"){C.attr(B,E.serializeStyle(E.parseStyle(D),C.name))}else{C.attr(B,r.convertURL(D,t,C.name))}}}});r.parser.addNodeFilter("script",function(s,t){var A=s.length,B;while(A--){B=s[A];B.attr("type","mce-"+(B.attr("type")||"text/javascript"))}});r.parser.addNodeFilter("#cdata",function(s,t){var A=s.length,B;while(A--){B=s[A];B.type=8;B.name="#comment";B.value="[CDATA["+B.value+"]]"}});r.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=r.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new n.html.Node("br",1)).shortEnded=true}}});r.serializer=new n.dom.Serializer(x,r.dom,r.schema);r.selection=new n.dom.Selection(r.dom,r.getWin(),r.serializer);r.formatter=new n.Formatter(this);r.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(A,s,t){i(t,function(C,B){r.dom.setAttrib(A,B,C)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){r.formatter.register(s,{block:s,remove:"all"})});r.formatter.register(r.settings.formats);r.undoManager=new n.UndoManager(r);r.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return r.onChange.dispatch(r,s,t)}});r.undoManager.onUndo.add(function(t,s){return r.onUndo.dispatch(r,s,t)});r.undoManager.onRedo.add(function(t,s){return r.onRedo.dispatch(r,s,t)});r.forceBlocks=new n.ForceBlocks(r,{forced_root_block:x.forced_root_block});r.editorCommands=new n.EditorCommands(r);r.serializer.onPreProcess.add(function(s,t){return r.onPreProcess.dispatch(r,t,s)});r.serializer.onPostProcess.add(function(s,t){return r.onPostProcess.dispatch(r,t,s)});r.onPreInit.dispatch(r);if(!x.gecko_spellcheck){r.getBody().spellcheck=0}if(!x.readonly){r._addEvents()}r.controlManager.onPostRender.dispatch(r,r.controlManager);r.onPostRender.dispatch(r);r.quirks=new n.util.Quirks(this);if(x.directionality){r.getBody().dir=x.directionality}if(x.nowrap){r.getBody().style.whiteSpace="nowrap"}if(x.handle_node_change_callback){r.onNodeChange.add(function(t,s,A){r.execCallback("handle_node_change_callback",r.id,A,-1,-1,true,r.selection.isCollapsed())})}if(x.save_callback){r.onSaveContent.add(function(s,A){var t=r.execCallback("save_callback",r.id,A.content,r.getBody());if(t){A.content=t}})}if(x.onchange_callback){r.onChange.add(function(t,s){r.execCallback("onchange_callback",r,s)})}if(x.protect){r.onBeforeSetContent.add(function(s,t){if(x.protect){i(x.protect,function(A){t.content=t.content.replace(A,function(B){return""})})}})}if(x.convert_newlines_to_brs){r.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
    ")}})}if(x.preformatted){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
    '+t.content+"
    "}})}if(x.verify_css_classes){r.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!r.classesRE){t=r.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});r.classesRE=new RegExp("("+B+")","gi")}}return !r.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||r.classesRE.test(A)?A:""}return A}}if(x.cleanup_callback){r.onBeforeSetContent.add(function(s,t){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)});r.onPreProcess.add(function(s,t){if(t.set){r.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){r.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});r.onPostProcess.add(function(s,t){if(t.set){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=r.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(x.save_callback){r.onGetContent.add(function(s,t){if(t.save){t.content=r.execCallback("save_callback",r.id,t.content,r.getBody())}})}if(x.handle_event_callback){r.onEvent.add(function(s,t,A){if(r.execCallback("handle_event_callback",t,s,A)===false){k.cancel(t)}})}r.onSetContent.add(function(){r.addVisual(r.getBody())});if(x.padd_empty_editor){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}if(a){function u(s,t){i(s.dom.select("a"),function(B){var A=B.parentNode;if(s.dom.isBlock(A)&&A.lastChild===B){s.dom.add(A,"br",{"data-mce-bogus":1})}})}r.onExecCommand.add(function(s,t){if(t==="CreateLink"){u(s)}});r.onSetContent.add(r.selection.onSetContent.add(u))}r.load({initial:true,format:"html"});r.startContent=r.getContent({format:"raw"});r.undoManager.add();r.initialized=true;r.onInit.dispatch(r);r.execCallback("setupcontent_callback",r.id,r.getBody(),r.getDoc());r.execCallback("init_instance_callback",r);r.focus(true);r.nodeChanged({initial:1});i(r.contentCSS,function(s){r.dom.loadCSS(s)});if(x.auto_focus){setTimeout(function(){var s=n.get(x.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}y=null},focus:function(v){var z,r=this,u=r.selection,y=r.settings.content_editable,s,q,x=r.getDoc();if(!v){s=u.getRng();if(s.item){q=s.item(0)}r._refreshContentEditable();if(!y){r.getWin().focus()}if(n.isGecko){r.getBody().focus()}if(q&&q.ownerDocument==x){s=x.body.createControlRange();s.addElement(q);s.select()}}if(n.activeEditor!=r){if((z=n.activeEditor)!=null){z.onDeactivate.dispatch(z,r)}r.onActivate.dispatch(r,z)}n._setActive(r)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=n.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return n.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(x,s,q){var t=n.trim,r=d(this.settings[x])?this.settings[x]:s,u;if(q==="hash"){u={};if(d(r,"string")){i(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(y){y=y.split("=");if(y.length>1){u[t(y[0])]=t(y[1])}else{u[t(y[0])]=t(y)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getStart()||q.getBody();if(q.initialized){u=u||{};v=b&&v.ownerDocument!=q.getDoc()?q.getBody():v;u.parents=[];q.dom.getParent(v,function(s){if(s.nodeName=="BODY"){return true}u.parents.push(s)});q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(q,s,r){this.execCommands[q]={func:s,scope:r||this}},addQueryStateHandler:function(q,s,r){this.queryStateCommands[q]={func:s,scope:r||this}},addQueryValueHandler:function(q,s,r){this.queryValueCommands[q]={func:s,scope:r||this}},addShortcut:function(s,v,q,u){var r=this,x;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){x=q;q=function(){r.execCommand(x,false,null)}}if(d(q,"object")){x=q;q=function(){r.execCommand(x[0],x[1],x[2])}}i(g(s),function(t){var y={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(z){switch(z){case"alt":case"ctrl":case"shift":y[z]=true;break;default:y.charCode=z.charCodeAt(0);y.keyCode=z.toUpperCase().charCodeAt(0)}});r.shortcuts[(y.ctrl?"ctrl":"")+","+(y.alt?"alt":"")+","+(y.shift?"shift":"")+","+y.keyCode]=y});return true},execCommand:function(y,x,A,q){var u=this,v=0,z,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(y)&&(!q||!q.skip_focus)){u.focus()}q=f({},q);u.onBeforeExecCommand.dispatch(u,y,x,A,q);if(q.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(z=u.execCommands[y]){r=z.func.call(z.scope,x,A);if(r!==true){u.onExecCommand.dispatch(u,y,x,A,q);return r}}i(u.plugins,function(s){if(s.execCommand&&s.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(u.editorCommands.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}u.getDoc().execCommand(y,x,A);u.onExecCommand.dispatch(u,y,x,A,q)},queryCommandState:function(v){var r=this,x,u;if(r._isHidden()){return}if(x=r.queryStateCommands[v]){u=x.func.call(x.scope);if(u!==true){return u}}x=r.editorCommands.queryCommandState(v);if(x!==-1){return x}try{return this.getDoc().queryCommandState(v)}catch(q){}},queryCommandValue:function(x){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[x]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(x);if(d(v)){return v}try{return this.getDoc().queryCommandValue(x)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=false;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){i(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(v,t){var s=this,r,q=s.getBody(),u;t=t||{};t.format=t.format||"html";t.set=true;t.content=v;if(!t.no_events){s.onBeforeSetContent.dispatch(s,t)}v=t.content;if(!n.isIE&&(v.length===0||/^\s+$/.test(v))){u=s.settings.forced_root_block;if(u){v="<"+u+'>
    "}else{v='
    '}q.innerHTML=v;s.selection.select(q,true);s.selection.collapse(true);return}if(t.format!=="raw"){v=new n.html.Serializer({},s.schema).serialize(s.parser.parse(v))}t.content=n.trim(v);s.dom.setHTML(q,t.content);if(!t.no_events){s.onSetContent.dispatch(s,t)}s.selection.normalize();return t.content},getContent:function(r){var q=this,s;r=r||{};r.format=r.format||"html";r.get=true;if(!r.no_events){q.onBeforeGetContent.dispatch(q,r)}if(r.format=="raw"){s=q.getBody().innerHTML}else{s=q.serializer.serialize(q.getBody(),r)}r.content=n.trim(s);if(!r.no_events){q.onGetContent.dispatch(q,r)}return r.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,y,x){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,x,true,y)}if(!v.convert_urls||(x&&x.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}i(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];n.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var D=this,u,E=D.settings,r=D.dom,y={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function q(t,F){var s=t.type;if(D.removed){return}if(D.onEvent.dispatch(D,t,F)!==false){D[y[t.fakeType||t.type]].dispatch(D,t,F)}}i(y,function(t,s){switch(s){case"contextmenu":r.bind(D.getDoc(),s,q);break;case"paste":r.bind(D.getBody(),s,function(F){q(F)});break;case"submit":case"reset":r.bind(D.getElement().form||o.getParent(D.id,"form"),s,q);break;default:r.bind(E.content_editable?D.getBody():D.getDoc(),s,q)}});r.bind(E.content_editable?D.getBody():(a?D.getDoc():D.getWin()),"focus",function(s){D.focus(true)});if(n.isGecko){r.bind(D.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=D.documentBaseURI.toAbsolute(s)}})}if(a){function v(){var G=this,I=G.getDoc(),H=G.settings;if(a&&!H.readonly){G._refreshContentEditable();try{I.execCommand("styleWithCSS",0,false)}catch(F){if(!G._isHidden()){try{I.execCommand("useCSS",0,true)}catch(F){}}}if(!H.table_inline_editing){try{I.execCommand("enableInlineTableEditing",false,false)}catch(F){}}if(!H.object_resizing){try{I.execCommand("enableObjectResizing",false,false)}catch(F){}}}}D.onBeforeExecCommand.add(v);D.onMouseDown.add(v)}D.onMouseUp.add(D.nodeChanged);D.onKeyUp.add(function(s,t){var F=t.keyCode;if((F>=33&&F<=36)||(F>=37&&F<=40)||F==13||F==45||F==46||F==8||(n.isMac&&(F==91||F==93))||t.ctrlKey){D.nodeChanged()}});D.onKeyDown.add(function(t,F){if(F.keyCode!=j.BACKSPACE){return}var s=t.selection.getRng();if(!s.collapsed){return}var H=s.startContainer;var G=s.startOffset;while(H&&H.nodeType&&H.nodeType!=1&&H.parentNode){H=H.parentNode}if(H&&H.parentNode&&H.parentNode.tagName==="BLOCKQUOTE"&&H.parentNode.firstChild==H&&G==0){t.formatter.toggle("blockquote",null,H.parentNode);s.setStart(H,0);s.setEnd(H,0);t.selection.setRng(s);t.selection.collapse(false)}});D.onReset.add(function(){D.setContent(D.startContent,{format:"raw"})});if(E.custom_shortcuts){if(E.custom_undo_redo_keyboard_shortcuts){D.addShortcut("ctrl+z",D.getLang("undo_desc"),"Undo");D.addShortcut("ctrl+y",D.getLang("redo_desc"),"Redo")}D.addShortcut("ctrl+b",D.getLang("bold_desc"),"Bold");D.addShortcut("ctrl+i",D.getLang("italic_desc"),"Italic");D.addShortcut("ctrl+u",D.getLang("underline_desc"),"Underline");for(u=1;u<=6;u++){D.addShortcut("ctrl+"+u,"",["FormatBlock",false,"h"+u])}D.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);D.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);D.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function x(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(D.shortcuts,function(F){if(n.isMac&&F.ctrl!=t.metaKey){return}else{if(!n.isMac&&F.ctrl!=t.ctrlKey){return}}if(F.alt!=t.altKey){return}if(F.shift!=t.shiftKey){return}if(t.keyCode==F.keyCode||(t.charCode&&t.charCode==F.charCode)){s=F;return false}});return s}D.onKeyUp.add(function(s,t){var F=x(t);if(F){return k.cancel(t)}});D.onKeyPress.add(function(s,t){var F=x(t);if(F){return k.cancel(t)}});D.onKeyDown.add(function(s,t){var F=x(t);if(F){F.func.call(F.scope);return k.cancel(t)}})}if(n.isIE){r.bind(D.getDoc(),"controlselect",function(F){var t=D.resizeInfo,s;F=F.target;if(F.nodeName!=="IMG"){return}if(t){r.unbind(t.node,t.ev,t.cb)}if(!r.hasClass(F,"mceItemNoResize")){ev="resizeend";s=r.bind(F,ev,function(H){var G;H=H.target;if(G=r.getStyle(H,"width")){r.setAttrib(H,"width",G.replace(/[^0-9%]+/g,""));r.setStyle(H,"width","")}if(G=r.getStyle(H,"height")){r.setAttrib(H,"height",G.replace(/[^0-9%]+/g,""));r.setStyle(H,"height","")}})}else{ev="resizestart";s=r.bind(F,"resizestart",k.cancel,k)}t=D.resizeInfo={node:F,ev:ev,cb:s}})}if(n.isOpera){D.onClick.add(function(s,t){k.prevent(t)})}if(E.custom_undo_redo){function A(){D.undoManager.typing=false;D.undoManager.add()}var z=n.isGecko?"blur":"focusout";r.bind(D.getDoc(),z,function(s){if(!D.removed&&D.undoManager.typing){A()}});D.dom.bind(D.dom.getRoot(),"dragend",function(s){A()});D.onKeyUp.add(function(s,F){var t=F.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||F.ctrlKey){A()}});D.onKeyDown.add(function(s,G){var F=G.keyCode,t;if(F==8){t=D.getDoc().selection;if(t&&t.createRange&&t.createRange().item){D.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));A();return k.cancel(G)}}if((F>=33&&F<=36)||(F>=37&&F<=40)||F==13||F==45){if(n.isIE&&F==13){D.undoManager.beforeChange()}if(D.undoManager.typing){A()}return}if((F<16||F>20)&&F!=224&&F!=91&&!D.undoManager.typing){D.undoManager.beforeChange();D.undoManager.typing=true;D.undoManager.add()}});D.onMouseDown.add(function(){if(D.undoManager.typing){A()}})}if(n.isGecko){function C(){var s=D.dom.getAttribs(D.selection.getStart().cloneNode(false));return function(){var t=D.selection.getStart();if(t!==D.getBody()){D.dom.setAttrib(t,"style",null);i(s,function(F){t.setAttributeNode(F.cloneNode(true))})}}}function B(){var t=D.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}D.onKeyPress.add(function(s,F){var t;if((F.keyCode==8||F.keyCode==46)&&B()){t=C();D.getDoc().execCommand("delete",false,null);t();return k.cancel(F)}});D.dom.bind(D.getDoc(),"cut",function(t){var s;if(B()){s=C();D.onKeyUp.addToTop(k.cancel,k);setTimeout(function(){s();D.onKeyUp.remove(k.cancel,k)},0)}})}},_refreshContentEditable:function(){var r=this,q,s;if(r._isHidden()){q=r.getBody();s=q.parentNode;s.removeChild(q);s.appendChild(q);q.focus()}},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(z){var x="align"+z.substring(7);var v=p.isCollapsed()?[p.getNode()]:p.getSelectedBlocks();var y=c.map(v,function(A){return !!q.matchNode(A,x)});return c.inArray(y,a)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e0||this.typing},hasRedo:function(){return e');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
    ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"
    ");T=v.dom.add(O,V.element,null,"
    ")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"
    ")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}if(!R.body.hasChildNodes()){R.body.appendChild(M.create("br"))}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
    ";return r[0]}else{y.innerHTML=b?"\u00a0":"
    "}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(BL.y+L.h){v.getWin().scrollTo(0,B1||ab==at){return ab}}}var al=V.selection.getRng();var ap=al.startContainer;var ak=al.endContainer;if(ap!=ak&&al.endOffset==0){var ao=am(ap,ak);var an=ao.nodeType==3?ao.length:ao.childNodes.length;al.setEnd(ao,an)}return al}function Y(an,at,aq,ap,al){var ak=[],am=-1,ar,av=-1,ao=-1,au;P(an.childNodes,function(ax,aw){if(ax.nodeName==="UL"||ax.nodeName==="OL"){am=aw;ar=ax;return false}});P(an.childNodes,function(ax,aw){if(ax.nodeName==="SPAN"&&c.getAttrib(ax,"data-mce-type")=="bookmark"){if(ax.id==at.id+"_start"){av=aw}else{if(ax.id==at.id+"_end"){ao=aw}}}});if(am<=0||(avam)){P(a.grep(an.childNodes),al);return 0}else{au=aq.cloneNode(S);P(a.grep(an.childNodes),function(ax,aw){if((avam&&aw>am)){ak.push(ax);ax.parentNode.removeChild(ax)}});if(avam){an.insertBefore(au,ar.nextSibling)}}ap.push(au);P(ak,function(aw){au.appendChild(aw)});return au}}function ai(al,an,ap){var ak=[],ao,am;ao=ah.inline||ah.block;am=c.create(ao);W(am);K.walk(al,function(aq){var ar;function at(au){var ax=au.nodeName.toLowerCase(),aw=au.parentNode.nodeName.toLowerCase(),av;if(g(ax,"br")){ar=0;if(ah.block){c.remove(au)}return}if(ah.wrapper&&x(au,Z,ag)){ar=0;return}if(ah.block&&!ah.wrapper&&G(ax)){au=c.rename(au,ao);W(au);ak.push(au);ar=0;return}if(ah.selector){P(ac,function(ay){if("collapsed" in ay&&ay.collapsed!==ad){return}if(c.is(au,ay.selector)&&!b(au)){W(au,ay);av=true}});if(!ah.inline||av){ar=0;return}}if(d(ao,ax)&&d(aw,ao)&&!(!ap&&au.nodeType===3&&au.nodeValue.length===1&&au.nodeValue.charCodeAt(0)===65279)&&!b(au)){if(!ar){ar=am.cloneNode(S);au.parentNode.insertBefore(ar,au);ak.push(ar)}ar.appendChild(au)}else{if(ax=="li"&&an){ar=Y(au,an,am,ak,at)}else{ar=0;P(a.grep(au.childNodes),at);ar=0}}}P(aq,at)});if(ah.wrap_links===false){P(ak,function(aq){function ar(aw){var av,au,at;if(aw.nodeName==="A"){au=am.cloneNode(S);ak.push(au);at=a.grep(aw.childNodes);for(av=0;av1||!F(at))&&aq===0){c.remove(at,1);return}if(ah.inline||ah.wrapper){if(!ah.exact&&aq===1){at=ar(at)}P(ac,function(av){P(c.select(av.inline,at),function(ax){var aw;if(av.wrap_links===false){aw=ax.parentNode;do{if(aw.nodeName==="A"){return}}while(aw=aw.parentNode)}U(av,ag,ax,av.exact?ax:null)})});if(x(at.parentNode,Z,ag)){c.remove(at,1);at=0;return B}if(ah.merge_with_parents){c.getParent(at.parentNode,function(av){if(x(av,Z,ag)){c.remove(at,1);at=0;return B}})}if(at&&ah.merge_siblings!==false){at=u(C(at),at);at=u(at,C(at,B))}}})}if(ah){if(ab){if(ab.nodeType){X=c.createRng();X.setStartBefore(ab);X.setEndAfter(ab);ai(o(X,ac),null,true)}else{ai(ab,null,true)}}else{if(!ad||!ah.inline||c.select("td.mceSelected,th.mceSelected").length){var aj=V.selection.getNode();V.selection.setRng(aa());af=q.getBookmark();ai(o(q.getRng(B),ac),af);if(ah.styles&&(ah.styles.color||ah.styles.textDecoration)){a.walk(aj,I,"childNodes");I(aj)}q.moveToBookmark(af);N(q.getRng(B));V.nodeChanged()}else{Q("apply",Z,ag)}}}}function A(Y,ag,aa){var ab=R(Y),ai=ab[0],af,ae,X;function Z(an){var am,al,ak;am=a.grep(an.childNodes);for(al=0,ak=ab.length;al=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\t \r\n]+|)$/.test(W.nodeValue)}function O(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ai,Z){var Y=W.startContainer,ad=W.startOffset,al=W.endContainer,af=W.endOffset,ak,ah,ac,ag;function aj(ar){var am,ap,aq,ao,an;am=ap=ar?Y:al;an=ar?"previousSibling":"nextSibling";root=c.getRoot();if(am.nodeType==3&&!f(am)){if(ar?ad>0:afah?ah:ad];if(Y.nodeType==3){ad=0}}if(al.nodeType==1&&al.hasChildNodes()){ah=al.childNodes.length-1;al=al.childNodes[af>ah?ah:af-1];if(al.nodeType==3){af=al.nodeValue.length}}if(H(Y.parentNode)||H(Y)){Y=H(Y)?Y:Y.parentNode;Y=Y.nextSibling||Y;if(Y.nodeType==3){ad=0}}if(H(al.parentNode)||H(al)){al=H(al)?al:al.parentNode;al=al.previousSibling||al;if(al.nodeType==3){af=al.length}}if(ai[0].inline){if(W.collapsed){function ae(an,ar,au){var aq,ao,at,am;function ap(aw,ay){var az,av,ax=aw.nodeValue;if(typeof(ay)=="undefined"){ay=au?ax.length:0}if(au){az=ax.lastIndexOf(" ",ay);av=ax.lastIndexOf("\u00a0",ay);az=az>av?az:av;if(az!==-1&&!Z){az++}}else{az=ax.indexOf(" ",ay);av=ax.indexOf("\u00a0",ay);az=az!==-1&&(av===-1||az0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){al=ac.node;al.splitText(ac.offset-1)}else{if(ac.node.previousSibling){}}}}}if(ai[0].inline||ai[0].block_expand){if(!ai[0].inline||(Y.nodeType!=3||ad===0)){Y=aj(true)}if(!ai[0].inline||(al.nodeType!=3||af===al.nodeValue.length)){al=aj()}}if(ai[0].selector&&ai[0].expand!==S&&!ai[0].inline){function aa(an,am){var ao,ap,ar,aq;if(an.nodeType==3&&an.nodeValue.length==0&&an[am]){an=an[am]}ao=m(an);for(ap=0;apY?Y:aa]}if(W.nodeType===3&&ab&&aa>=W.nodeValue.length){W=new t(W,V.getBody()).next()||W}if(W.nodeType===3&&!ab&&aa==0){W=new t(W,V.getBody()).prev()||W}return W}function Q(af,W,ad){var ai,ag="_mce_caret",X=V.settings.caret_debug;ai=a.isGecko?"\u200B":E;function Y(ak){var aj=c.create("span",{id:ag,"data-mce-bogus":true,style:X?"color:red":""});if(ak){aj.appendChild(V.getDoc().createTextNode(ai))}return aj}function ae(ak,aj){while(ak){if((ak.nodeType===3&&ak.nodeValue!==ai)||ak.childNodes.length>1){return false}if(aj&&ak.nodeType===1){aj.push(ak)}ak=ak.firstChild}return true}function ab(aj){while(aj){if(aj.id===ag){return aj}aj=aj.parentNode}}function aa(aj){var ak;if(aj){ak=new t(aj,aj);for(aj=ak.current();aj;aj=ak.next()){if(aj.nodeType===3){return aj}}}}function Z(al,ak){var am,aj;if(!al){al=ab(q.getStart());if(!al){while(al=c.get(ag)){Z(al,false)}}}else{aj=q.getRng(true);if(ae(al)){if(ak!==false){aj.setStartBefore(al);aj.setEndBefore(al)}c.remove(al)}else{am=aa(al);if(am.nodeValue.charAt(0)===E){am=am.deleteData(0,1)}c.remove(al,1)}q.setRng(aj)}}function ac(){var al,aj,ap,ao,am,ak,an;al=q.getRng(true);ao=al.startOffset;ak=al.startContainer;an=ak.nodeValue;aj=ab(q.getStart());if(aj){ap=aa(aj)}if(an&&ao>0&&ao=0;an--){al.appendChild(ar[an].cloneNode(false));al=al.firstChild}al.appendChild(c.doc.createTextNode(ai));al=al.firstChild;c.insertAfter(aq,at);q.setCursorLocation(al,1)}}if(!self._hasCaretEvents){V.onBeforeGetContent.addToTop(function(){var aj=[],ak;if(ae(ab(q.getStart()),aj)){ak=aj.length;while(ak--){c.setAttrib(aj[ak],"data-mce-bogus","1")}}});a.each("onMouseUp onKeyUp".split(" "),function(aj){V[aj].addToTop(function(){Z()})});V.onKeyDown.addToTop(function(aj,al){var ak=al.keyCode;if(ak==8||ak==37||ak==39){Z(ab(q.getStart()))}});self._hasCaretEvents=true}if(af=="apply"){ac()}else{ah()}}function N(X){var W=X.startContainer,ac=X.startOffset,ab,aa,Y,Z;if(W.nodeType==3&&ac>=W.nodeValue.length-1){W=W.parentNode;ac=s(W)+1}if(W.nodeType==1){Y=W.childNodes;W=Y[Math.min(ac,Y.length-1)];ab=new t(W);if(ac>Y.length-1){ab.next()}for(aa=ab.current();aa;aa=ab.next()){if(aa.nodeType==3&&!f(aa)){Z=c.create("a",null,E);aa.parentNode.insertBefore(Z,aa);X.setStart(aa,0);q.setRng(X);c.remove(Z);return}}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_legacy_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_prototype_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_prototype_src.js similarity index 94% rename from lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_prototype_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_prototype_src.js index 4037560feb679..92049e3642319 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_prototype_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_prototype_src.js @@ -559,7 +559,7 @@ tinymce.create('tinymce.util.Dispatcher', { // And this is also more efficient for (i = 0; i 0 ? a : [c.scope]); if (s === false) break; @@ -601,7 +601,7 @@ tinymce.create('tinymce.util.Dispatcher', { // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something - u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); + u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { var s = u[i]; @@ -922,8 +922,11 @@ tinymce.create('tinymce.util.Dispatcher', { v = '{'; - for (i in o) - v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : ''; + for (i in o) { + if (o.hasOwnProperty(i)) { + v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : ''; + } + } return v + '}'; } @@ -1058,11 +1061,17 @@ tinymce.create('static tinymce.util.XHR', { }()); (function(tinymce){ tinymce.VK = { - DELETE:46, - BACKSPACE:8 - + DELETE: 46, + BACKSPACE: 8, + ENTER: 13, + TAB: 9, + SPACEBAR: 32, + UP: 38, + DOWN: 40, + modifierPressed: function (e) { + return e.shiftKey || e.ctrlKey || e.altKey; + } } - })(tinymce); (function(tinymce) { var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE; @@ -1074,7 +1083,7 @@ tinymce.create('static tinymce.util.XHR', { var rng, blockElm, node, clonedSpan, isDelete; isDelete = e.keyCode == DELETE; - if (isDelete || e.keyCode == BACKSPACE) { + if ((isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) { e.preventDefault(); rng = selection.getRng(); @@ -1090,7 +1099,7 @@ tinymce.create('static tinymce.util.XHR', { node = blockElm.firstChild; // Ignore empty text nodes - while (node.nodeType == 3 && node.nodeValue.length == 0) + while (node && node.nodeType == 3 && node.nodeValue.length == 0) node = node.nextSibling; if (node && node.nodeName === 'SPAN') { @@ -1098,7 +1107,7 @@ tinymce.create('static tinymce.util.XHR', { } } - // Do the backspace/delete actiopn + // Do the backspace/delete action ed.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null); // Find all odd apple-style-spans @@ -1120,17 +1129,36 @@ tinymce.create('static tinymce.util.XHR', { }; function emptyEditorWhenDeleting(ed) { - ed.onKeyUp.add(function(ed, e) { - var keyCode = e.keyCode; + function serializeRng(rng) { + var body = ed.dom.create("body"); + var contents = rng.cloneContents(); + body.appendChild(contents); + return ed.selection.serializer.serialize(body, {format: 'html'}); + } + + function allContentsSelected(rng) { + var selection = serializeRng(rng); + + var allRng = ed.dom.createRng(); + allRng.selectNode(ed.getBody()); + + var allSelection = serializeRng(allRng); + return selection === allSelection; + } + + ed.onKeyDown.addToTop(function(ed, e) { + var keyCode = e.keyCode; if (keyCode == DELETE || keyCode == BACKSPACE) { - if (ed.dom.isEmpty(ed.getBody())) { + var rng = ed.selection.getRng(true); + if (!rng.collapsed && allContentsSelected(rng)) { ed.setContent('', {format : 'raw'}); ed.nodeChanged(); - return; + e.preventDefault(); } } }); + }; function inputMethodFocus(ed) { @@ -1139,6 +1167,21 @@ tinymce.create('static tinymce.util.XHR', { }); }; + function removeHrOnBackspace(ed) { + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode === BACKSPACE) { + if (ed.selection.isCollapsed() && ed.selection.getRng(true).startOffset === 0) { + var node = ed.selection.getNode(); + var previousSibling = node.previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { + ed.dom.remove(previousSibling); + tinymce.dom.Event.cancel(e); + } + } + } + }) + } + function focusBody(ed) { // Fix for a focus bug in FF 3.x where the body element // wouldn't get proper focus if the user clicked on the HTML element @@ -1176,6 +1219,51 @@ tinymce.create('static tinymce.util.XHR', { }); }; + function removeStylesOnPTagsInheritedFromHeadingTag(ed) { + ed.onKeyDown.add(function(ed, event) { + function checkInHeadingTag(ed) { + var currentNode = ed.selection.getNode(); + var headingTags = 'h1,h2,h3,h4,h5,h6'; + return ed.dom.is(currentNode, headingTags) || ed.dom.getParent(currentNode, headingTags) !== null; + } + + if (event.keyCode === VK.ENTER && !VK.modifierPressed(event) && checkInHeadingTag(ed)) { + setTimeout(function() { + var currentNode = ed.selection.getNode(); + if (ed.dom.is(currentNode, 'p')) { + ed.dom.setAttrib(currentNode, 'style', null); + // While tiny's content is correct after this method call, the content shown is not representative of it and needs to be 'repainted' + ed.execCommand('mceCleanup'); + } + }, 0); + } + }); + } + function selectionChangeNodeChanged(ed) { + var lastRng, selectionTimer; + + ed.dom.bind(ed.getDoc(), 'selectionchange', function() { + if (selectionTimer) { + clearTimeout(selectionTimer); + selectionTimer = 0; + } + + selectionTimer = window.setTimeout(function() { + var rng = ed.selection.getRng(); + + // Compare the ranges to see if it was a real change or not + if (!lastRng || !tinymce.dom.RangeUtils.compareRanges(rng, lastRng)) { + ed.nodeChanged(); + lastRng = rng; + } + }, 50); + }); + } + + function ensureBodyHasRoleApplication(ed) { + document.body.setAttribute("role", "application"); + } + tinymce.create('tinymce.util.Quirks', { Quirks: function(ed) { // WebKit @@ -1184,15 +1272,24 @@ tinymce.create('static tinymce.util.XHR', { emptyEditorWhenDeleting(ed); inputMethodFocus(ed); selectControlElements(ed); + + // iOS + if (tinymce.isIDevice) { + selectionChangeNodeChanged(ed); + } } // IE if (tinymce.isIE) { + removeHrOnBackspace(ed); emptyEditorWhenDeleting(ed); + ensureBodyHasRoleApplication(ed); + removeStylesOnPTagsInheritedFromHeadingTag(ed) } // Gecko if (tinymce.isGecko) { + removeHrOnBackspace(ed); focusBody(ed); } } @@ -1200,8 +1297,8 @@ tinymce.create('static tinymce.util.XHR', { })(tinymce); (function(tinymce) { var namedEntities, baseEntities, reverseEntities, - attrsCharsRegExp = /[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, - textCharsRegExp = /[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + attrsCharsRegExp = /[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, rawCharsRegExp = /[<>&\"\']/g, entityRegExp = /&(#x|#)?([\w]+);/g, asciiMap = { @@ -2184,7 +2281,7 @@ tinymce.html.Styles = function(settings, schema) { '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI '(?:\\/([^>]+)>)|' + // End element - '(?:([^\\s\\/<>]+)\\s*((?:[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*)>)' + // Start element + '(?:([^\\s\\/<>]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/)>)' + // Start element ')', 'g'); attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g; @@ -2713,6 +2810,10 @@ tinymce.html.Styles = function(settings, schema) { } } + // Keep comments + if (node.type === 8) + return false; + // Keep non whitespace text nodes if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) return false; @@ -3884,52 +3985,59 @@ tinymce.html.Writer = function(settings) { return this.run(e, function(e) { var s = t.settings; + var originalValue = e.getAttribute(n); + if (v !== null) { + switch (n) { + case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); - switch (n) { - case "style": - if (!is(v, 'string')) { - each(v, function(v, n) { - t.setStyle(e, n, v); - }); - - return; - } + return; + } - // No mce_style for elements with these since they might get resized by the user - if (s.keep_values) { - if (v && !t._isRes(v)) - e.setAttribute('data-mce-style', v, 2); - else - e.removeAttribute('data-mce-style', 2); - } + // No mce_style for elements with these since they might get resized by the user + if (s.keep_values) { + if (v && !t._isRes(v)) + e.setAttribute('data-mce-style', v, 2); + else + e.removeAttribute('data-mce-style', 2); + } - e.style.cssText = v; - break; + e.style.cssText = v; + break; - case "class": - e.className = v || ''; // Fix IE null bug - break; + case "class": + e.className = v || ''; // Fix IE null bug + break; - case "src": - case "href": - if (s.keep_values) { - if (s.url_converter) - v = s.url_converter.call(s.url_converter_scope || t, v, n, e); + case "src": + case "href": + if (s.keep_values) { + if (s.url_converter) + v = s.url_converter.call(s.url_converter_scope || t, v, n, e); - t.setAttrib(e, 'data-mce-' + n, v, 2); - } + t.setAttrib(e, 'data-mce-' + n, v, 2); + } - break; + break; - case "shape": - e.setAttribute('data-mce-style', v); - break; + case "shape": + e.setAttribute('data-mce-style', v); + break; + } } - if (is(v) && v !== null && v.length !== 0) e.setAttribute(n, '' + v, 2); else e.removeAttribute(n, 2); + + // fire onChangeAttrib event for attributes that have changed + if (tinyMCE.activeEditor && originalValue != v) { + var ed = tinyMCE.activeEditor; + ed.onSetAttrib.dispatch(ed, e, n, v); + } }); }, @@ -4573,6 +4681,10 @@ tinymce.html.Writer = function(settings) { } } + // Keep comment nodes + if (type == 8) + return false; + // Keep non whitespace text nodes if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) return false; @@ -4635,6 +4747,12 @@ tinymce.html.Writer = function(settings) { function trim(node) { var i, children = node.childNodes, type = node.nodeType; + function surroundedBySpans(node) { + var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN'; + var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN'; + return previousIsSpan && nextIsSpan; + } + if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') return; @@ -4645,7 +4763,10 @@ tinymce.html.Writer = function(settings) { // Keep non whitespace text nodes if (type == 3 && node.nodeValue.length > 0) { // If parent element isn't a block or there isn't any useful contents for example "

    " - if (!t.isBlock(node.parentNode) || tinymce.trim(node.nodeValue).length > 0) + // Also keep text nodes with only spaces if surrounded by spans. + // eg. "

    a b

    " should keep space between a and b + var trimmedLength = tinymce.trim(node.nodeValue).length; + if (!t.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength == 0 && surroundedBySpans(node)) return; } else if (type == 1) { // If the only child is a bookmark then move it up @@ -4682,9 +4803,9 @@ tinymce.html.Writer = function(settings) { // Insert middle chunk if (re) - pa.replaceChild(re, e); - else - pa.insertBefore(e, pe); + pa.replaceChild(re, e); + else + pa.insertBefore(e, pe); // Insert after chunk pa.insertBefore(trim(aft), pe); @@ -5699,7 +5820,7 @@ tinymce.html.Writer = function(settings) { parent = node.parentNode; root = dom.getRoot().parentNode; - while (parent != root) { + while (parent != root && parent.nodeType !== 9) { children = parent.children; i = children.length; @@ -7180,6 +7301,12 @@ window.tinymce.dom.Sizzle = Sizzle; return; } + // When loaded asynchronously, the DOM Content may already be loaded + if (doc.readyState === 'complete') { + t._pageInit(win); + return; + } + // Use IE method if (doc.attachEvent) { doc.attachEvent("onreadystatechange", function() { @@ -7978,7 +8105,8 @@ window.tinymce.dom.Sizzle = Sizzle; } s.addRange(r); - t.selectedRange = s.getRangeAt(0); + // adding range isn't always successful so we need to check range count otherwise an exception can occur + t.selectedRange = s.rangeCount > 0 ? s.getRangeAt(0) : null; } } else { // Is W3C Range @@ -8074,7 +8202,8 @@ window.tinymce.dom.Sizzle = Sizzle; if (sb && eb && sb != eb) { n = sb; - while ((n = n.nextSibling) && n != eb) { + var walker = new tinymce.dom.TreeWalker(sb, dom.getRoot()); + while ((n = walker.next()) && n != eb) { if (dom.isBlock(n)) bl.push(n); } @@ -8089,6 +8218,11 @@ window.tinymce.dom.Sizzle = Sizzle; normalize : function() { var self = this, rng, normalized; + // TODO: + // Retain selection direction. + // Lean left/right on Gecko for inline elements. + // Run this on mouse up/key up when the user manually moves the selection + // Normalize only on non IE browsers for now if (tinymce.isIE) return; @@ -8123,18 +8257,24 @@ window.tinymce.dom.Sizzle = Sizzle; if (node.nodeType === 3) { offset = start ? 0 : node.nodeValue.length - 1; container = node; + normalized = true; break; } - // Found a BR element that we can place the caret before - if (node.nodeName === 'BR') { + // Found a BR/IMG element that we can place the caret before + if (/^(BR|IMG)$/.test(node.nodeName)) { offset = dom.nodeIndex(node); container = node.parentNode; + + // Put caret after image when moving the end point + if (node.nodeName == "IMG" && !start) { + offset++; + } + + normalized = true; break; } } while (node = (start ? walker.next() : walker.prev())); - - normalized = true; } } } @@ -8149,7 +8289,7 @@ window.tinymce.dom.Sizzle = Sizzle; // Normalize the end points normalizeEndPoint(true); - if (rng.collapsed) + if (!rng.collapsed) normalizeEndPoint(); // Set the selection if it was normalized @@ -8260,12 +8400,11 @@ window.tinymce.dom.Sizzle = Sizzle; if (!settings.apply_source_formatting) settings.indent = false; - settings.remove_trailing_brs = true; - // Default DOM and Schema if they are undefined dom = dom || tinymce.DOM; schema = schema || new tinymce.html.Schema(settings); settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; onPreProcess = new tinymce.util.Dispatcher(self); @@ -8329,8 +8468,8 @@ window.tinymce.dom.Sizzle = Sizzle; function trim(value) { return value.replace(/()/g, '\n') .replace(/^[\r\n]*|[\r\n]*$/g, '') - .replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g, ''); + .replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); }; while (i--) { @@ -8479,7 +8618,7 @@ window.tinymce.dom.Sizzle = Sizzle; // Replace all BOM characters for now until we can find a better solution if (!args.cleanup) - args.content = args.content.replace(/\uFEFF/g, ''); + args.content = args.content.replace(/\uFEFF|\u200B/g, ''); // Post process if (!args.no_events) @@ -8771,6 +8910,24 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { return; } + function exclude(nodes) { + var node; + + // First node is excluded + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + + // Last node is excluded + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + + return nodes; + }; + function collectSiblings(node, name, end_node) { var siblings = []; @@ -8800,7 +8957,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { if (!next) siblings.reverse(); - callback(siblings); + callback(exclude(siblings)); } } }; @@ -8813,28 +8970,28 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)]; - // Find common ancestor and end points - ancestor = dom.findCommonAncestor(startContainer, endContainer); - // Same container if (startContainer == endContainer) - return callback([startContainer]); + return callback(exclude([startContainer])); + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(startContainer, endContainer); + // Process left side for (node = startContainer; node; node = node.parentNode) { - if (node == endContainer) + if (node === endContainer) return walkBoundary(startContainer, ancestor, true); - if (node == ancestor) + if (node === ancestor) break; } // Process right side for (node = endContainer; node; node = node.parentNode) { - if (node == startContainer) + if (node === startContainer) return walkBoundary(endContainer, ancestor); - if (node == ancestor) + if (node === ancestor) break; } @@ -8853,48 +9010,46 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { ); if (siblings.length) - callback(siblings); + callback(exclude(siblings)); // Walk right leaf walkBoundary(endContainer, endPoint); }; - /* this.split = function(rng) { + this.split = function(rng) { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; function splitText(node, offset) { - if (offset == node.nodeValue.length) - node.appendData(INVISIBLE_CHAR); - - node = node.splitText(offset); - - if (node.nodeValue === INVISIBLE_CHAR) - node.nodeValue = ''; - - return node; + return node.splitText(offset); }; // Handle single text node - if (startContainer == endContainer) { - if (startContainer.nodeType == 3) { - if (startOffset != 0) - startContainer = endContainer = splitText(startContainer, startOffset); - - if (endOffset - startOffset != startContainer.nodeValue.length) - splitText(startContainer, endOffset - startOffset); + if (startContainer == endContainer && startContainer.nodeType == 3) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } } } else { // Split startContainer text node if needed - if (startContainer.nodeType == 3 && startOffset != 0) { + if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) { startContainer = splitText(startContainer, startOffset); startOffset = 0; } // Split endContainer text node if needed - if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) { + if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) { endContainer = splitText(endContainer, endOffset).previousSibling; endOffset = endContainer.nodeValue.length; } @@ -8907,7 +9062,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { endOffset : endOffset }; }; -*/ + }; tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) { @@ -9608,7 +9763,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { // Internal functions _setupKeyboardNav : function(){ var contextMenu, menuItems, t=this; - contextMenu = DOM.select('#menu_' + t.id)[0]; + contextMenu = DOM.get('menu_' + t.id); menuItems = DOM.select('a[role=option]', 'menu_' + t.id); menuItems.splice(0,0,contextMenu); t.keyboardNav = new tinymce.ui.KeyboardNavigation({ @@ -9715,10 +9870,27 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { }, postRender : function() { - var t = this, s = t.settings; - + var t = this, s = t.settings, imgBookmark; + + // In IE a large image that occupies the entire editor area will be deselected when a button is clicked, so + // need to keep the selection in case the selection is lost + if (tinymce.isIE && t.editor) { + tinymce.dom.Event.add(t.id, 'mousedown', function(e) { + var nodeName = t.editor.selection.getNode().nodeName; + imgBookmark = nodeName === 'IMG' ? t.editor.selection.getBookmark() : null; + }); + } tinymce.dom.Event.add(t.id, 'click', function(e) { - if (!t.isDisabled()) + if (!t.isDisabled()) { + // restore the selection in case the selection is lost in IE + if (tinymce.isIE && t.editor && imgBookmark !== null) { + t.editor.selection.moveToBookmark(imgBookmark); + } + return s.onclick.call(s.scope, e); + } + }); + tinymce.dom.Event.add(t.id, 'keyup', function(e) { + if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR) return s.onclick.call(s.scope, e); }); } @@ -9753,7 +9925,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return t.selectByIndex(-1); // Is string or number make function selector - if (va && va.call) + if (va && typeof(va)=="function") f = va; else { f = function(v) { @@ -10029,7 +10201,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return t.selectByIndex(-1); // Is string or number make function selector - if (va && va.call) + if (va && typeof(va)=="function") f = va; else { f = function(v) { @@ -10420,15 +10592,21 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { } n = DOM.add(tr, 'td'); - n = DOM.add(n, 'a', { - role : 'option', + var settings = { href : 'javascript:;', style : { backgroundColor : '#' + c }, 'title': t.editor.getLang('colors.' + c, c), 'data-mce-color' : '#' + c - }); + }; + + // adding a proper ARIA role = button causes JAWS to read things incorrectly on IE. + if (!tinymce.isIE ) { + settings['role']= 'option'; + } + + n = DOM.add(n, 'a', settings); if (t.editor.forcedHighContrastMode) { n = DOM.add(n, 'canvas', { width: 16, height: 16, 'aria-hidden': 'true' }); @@ -11062,7 +11240,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, - inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode; + inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode, VK = tinymce.VK; tinymce.create('tinymce.Editor', { Editor : function(id, s) { @@ -11086,6 +11264,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { 'onPostRender', + 'onLoad', + 'onInit', 'onRemove', @@ -11148,7 +11328,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { 'onVisualAid', - 'onSetProgressState' + 'onSetProgressState', + + 'onSetAttrib' ], function(e) { t[e] = new Dispatcher(t); }); @@ -11182,6 +11364,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { visual_table_class : 'mceItemTable', visual : 1, font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large', + font_size_legacy_values : 'xx-small,small,medium,large,x-large,xx-large,300%', // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size apply_source_formatting : 1, directionality : 'ltr', forced_root_block : 'p', @@ -11491,6 +11674,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { t.iframeHTML += ''; } + t.contentCSS = []; + bi = s.body_id || 'tinymce'; if (bi.indexOf('=') != -1) { bi = t.getParam('body_id', '', 'hash'); @@ -11503,7 +11688,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { bc = bc[t.id] || ''; } - t.iframeHTML += '
    '; + t.iframeHTML += '
    '; // Domain relaxing enabled, then set document domain if (tinymce.relaxedDomain && (isIE || (tinymce.isOpera && parseFloat(opera.version()) < 11))) { @@ -11617,10 +11802,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Keep scripts from executing t.parser.addNodeFilter('script', function(nodes, name) { - var i = nodes.length; + var i = nodes.length, node; - while (i--) - nodes[i].attr('type', 'mce-text/javascript'); + while (i--) { + node = nodes[i]; + node.attr('type', 'mce-' + (node.attr('type') || 'text/javascript')); + } }); t.parser.addNodeFilter('#cdata', function(nodes, name) { @@ -11969,7 +12156,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } t._refreshContentEditable(); - selection.normalize(); // Is not content editable if (!ce) @@ -12169,9 +12355,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus)) t.focus(); - o = {}; - t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o); - if (o.terminate) + a = extend({}, a); + t.onBeforeExecCommand.dispatch(t, cmd, ui, val, a); + if (a.terminate) return false; // Command callback @@ -12741,30 +12927,32 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Add block quote deletion handler t.onKeyDown.add(function(ed, e) { - // Was the BACKSPACE key pressed? - if (e.keyCode != 8) + if (e.keyCode != VK.BACKSPACE) return; - var n = ed.selection.getRng().startContainer; - var offset = ed.selection.getRng().startOffset; + var rng = ed.selection.getRng(); + if (!rng.collapsed) + return; + + var n = rng.startContainer; + var offset = rng.startOffset; while (n && n.nodeType && n.nodeType != 1 && n.parentNode) n = n.parentNode; - + // Is the cursor at the beginning of a blockquote? if (n && n.parentNode && n.parentNode.tagName === 'BLOCKQUOTE' && n.parentNode.firstChild == n && offset == 0) { // Remove the blockquote ed.formatter.toggle('blockquote', null, n.parentNode); // Move the caret to the beginning of n - var rng = ed.selection.getRng(); rng.setStart(n, 0); rng.setEnd(n, 0); ed.selection.setRng(rng); ed.selection.collapse(false); } }); - + // Add reset handler @@ -12901,7 +13089,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { t.undoManager.add(); }; - dom.bind(t.getDoc(), 'focusout', function(e) { + var focusLostFunc = tinymce.isGecko ? 'blur' : 'focusout'; + dom.bind(t.getDoc(), focusLostFunc, function(e){ if (!t.removed && t.undoManager.typing) addUndo(); }); @@ -12961,21 +13150,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }); } - // Fire a nodeChanged when the selection is changed on WebKit this fixes selection issues on iOS5 - // It only fires the nodeChange event every 50ms since it would other wise update the UI when you type and it hogs the CPU - if (tinymce.isWebKit) { - dom.bind(t.getDoc(), 'selectionchange', function() { - if (t.selectionTimer) { - clearTimeout(t.selectionTimer); - t.selectionTimer = 0; - } - - t.selectionTimer = window.setTimeout(function() { - t.nodeChanged(); - }, 50); - }); - } - // Bug fix for FireFox keeping styles from end of selection instead of start. if (tinymce.isGecko) { function getAttributeApplyFunction() { @@ -12985,11 +13159,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var target = t.selection.getStart(); if (target !== t.getBody()) { - t.dom.removeAllAttribs(target); + t.dom.setAttrib(target, "style", null); - each(template, function(attr) { - target.setAttributeNode(attr.cloneNode(true)); - }); + each(template, function(attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); } }; } @@ -13300,6 +13474,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var parser, serializer, parentNode, rootNode, fragment, args, marker, nodeRect, viewPortRect, rng, node, node2, bookmarkHtml, viewportBodyElement; + //selection.normalize(); + // Setup parser and serializer parser = editor.parser; serializer = new tinymce.html.Serializer({}, editor.schema); @@ -13526,7 +13702,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { addCommands({ // Override justify commands 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) { - return isFormatMatch('align' + command.substring(7)); + var name = 'align' + command.substring(7); + // Use Formatter.matchNode instead of Formatter.match so that we don't match on parent node. This fixes bug where for both left + // and right align buttons can be active. This could occur when selected nodes have align right and the parent has align left. + var nodes = selection.isCollapsed() ? [selection.getNode()] : selection.getSelectedBlocks(); + var matches = tinymce.map(nodes, function(node) { + return !!formatter.matchNode(node, name); + }); + return tinymce.inArray(matches, TRUE) !== -1; }, 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) { @@ -14833,8 +15016,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { MCE_ATTR_RE = /^(src|href|style)$/, FALSE = false, TRUE = true, - undefined, - pendingFormats = {apply : [], remove : []}; + undefined; function isArray(obj) { return obj instanceof Array; @@ -14845,7 +15027,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function isCaretNode(node) { - return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline'); + return node.nodeType === 1 && node.id === '_mce_caret'; }; // Public functions @@ -14920,30 +15102,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function apply(name, vars, node) { var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed(); - function moveStart(rng) { - var container = rng.startContainer, - offset = rng.startOffset, - walker, node; - - // Move startContainer/startOffset in to a suitable node - if (container.nodeType == 1 || container.nodeValue === "") { - container = container.nodeType == 1 ? container.childNodes[offset] : container; - - // Might fail if the offset is behind the last element in it's container - if (container) { - walker = new TreeWalker(container, container.parentNode); - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { - rng.setStart(node, 0); - break; - } - } - } - } - - return rng; - }; - function setElementFormat(elm, fmt) { fmt = fmt || format; @@ -15050,7 +15208,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } }; - function applyRngStyle(rng, bookmark) { + function applyRngStyle(rng, bookmark, node_specific) { var newWrappers = [], wrapName, wrapElm; // Setup wrapper element @@ -15114,7 +15272,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Is it valid to wrap this item if (isValid(wrapName, nodeName) && isValid(parentName, wrapName) && - !(node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279)) { + !(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) { // Start wrapping if (!currentWrapElm) { // Wrap the node @@ -15269,12 +15427,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (format) { if (node) { - rng = dom.createRng(); - - rng.setStartBefore(node); - rng.setEndAfter(node); - - applyRngStyle(expandRng(rng, formatList)); + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(expandRng(rng, formatList), null, true); + } else { + applyRngStyle(node, null, true); + } } else { if (!isCollapsed || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) { // Obtain selection node before selection is unselected by applyRngStyle() @@ -15292,7 +15452,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } selection.moveToBookmark(bookmark); - selection.setRng(moveStart(selection.getRng(TRUE))); + moveStart(selection.getRng(TRUE)); ed.nodeChanged(); } else performCaretAction('apply', name, vars); @@ -15302,44 +15462,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function remove(name, vars, node) { var formatList = get(name), format = formatList[0], bookmark, i, rng; - function moveStart(rng) { - var container = rng.startContainer, - offset = rng.startOffset, - walker, node, nodes, tmpNode; - - // Convert text node into index if possible - if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) { - container = container.parentNode; - offset = nodeIndex(container) + 1; - } - - // Move startContainer/startOffset in to a suitable node - if (container.nodeType == 1) { - nodes = container.childNodes; - container = nodes[Math.min(offset, nodes.length - 1)]; - walker = new TreeWalker(container); - - // If offset is at end of the parent node walk to the next one - if (offset > nodes.length - 1) - walker.next(); - - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { - // IE has a "neat" feature where it moves the start node into the closest element - // we can avoid this by inserting an element before it and then remove it after we set the selection - tmpNode = dom.create('a', null, INVISIBLE_CHAR); - node.parentNode.insertBefore(tmpNode, node); - - // Set selection and remove tmpNode - rng.setStart(node, 0); - selection.setRng(rng); - dom.remove(tmpNode); - - return; - } - } - } - }; // Merges the styles for each node function process(node) { @@ -15488,10 +15610,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Handle node if (node) { - rng = dom.createRng(); - rng.setStartBefore(node); - rng.setEndAfter(node); - removeRngStyle(rng); + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + return; } @@ -15508,6 +15635,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { ed.nodeChanged(); } else performCaretAction('remove', name, vars); + + // When you remove formatting from a table cell in WebKit (cell, not the contents of a cell) there is a rendering issue with column width + if (tinymce.isWebKit) { + ed.execCommand('mceCleanup'); + } }; function toggle(name, vars, node) { @@ -15582,7 +15714,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function match(name, vars, node) { - var startNode, i; + var startNode; function matchParents(node) { // Find first node with similar format settings @@ -15598,21 +15730,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (node) return matchParents(node); - // Check pending formats - if (selection.isCollapsed()) { - for (i = pendingFormats.apply.length - 1; i >= 0; i--) { - if (pendingFormats.apply[i].name == name) - return true; - } - - for (i = pendingFormats.remove.length - 1; i >= 0; i--) { - if (pendingFormats.remove[i].name == name) - return false; - } - - return matchParents(selection.getNode()); - } - // Check selected node node = selection.getNode(); if (matchParents(node)) @@ -15631,33 +15748,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function matchAll(names, vars) { var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name; - // If the selection is collapsed then check pending formats - if (selection.isCollapsed()) { - for (ni = 0; ni < names.length; ni++) { - // If the name is to be removed, then stop it from being added - for (i = pendingFormats.remove.length - 1; i >= 0; i--) { - name = names[ni]; - - if (pendingFormats.remove[i].name == name) { - checkedMap[name] = true; - break; - } - } - } - - // If the format is to be applied - for (i = pendingFormats.apply.length - 1; i >= 0; i--) { - for (ni = 0; ni < names.length; ni++) { - name = names[ni]; - - if (!checkedMap[name] && pendingFormats.apply[i].name == name) { - checkedMap[name] = true; - matchedFormatNames.push(name); - } - } - } - } - // Check start of selection for formats startElement = selection.getStart(); dom.getParent(startElement, function(node) { @@ -15766,7 +15856,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function isWhiteSpaceNode(node) { - return node && node.nodeType === 3 && /^([\s\r\n]+|)$/.test(node.nodeValue); + return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue); }; function wrap(node, name, attrs) { @@ -15782,31 +15872,42 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, - endOffset = rng.endOffset, sibling, lastIdx, leaf; + endOffset = rng.endOffset, sibling, lastIdx, leaf, endPoint; // This function walks up the tree if there is no siblings before/after the node - function findParentContainer(container, child_name, sibling_name, root) { - var parent, child; + function findParentContainer(start) { + var container, parent, child, sibling, siblingName; - root = root || dom.getRoot(); + container = parent = start ? startContainer : endContainer; + siblingName = start ? 'previousSibling' : 'nextSibling'; + root = dom.getRoot(); - for (;;) { - // Check if we can move up are we at root level or body level - parent = container.parentNode; - - // Stop expanding on block elements or root depending on format - if (parent == root || (!format[0].block_expand && isBlock(parent))) + // If it's a text node and the offset is inside the text + if (container.nodeType == 3 && !isWhiteSpaceNode(container)) { + if (start ? startOffset > 0 : endOffset < container.nodeValue.length) { return container; + } + } - for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) { - if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) - return container; + for (;;) { + // Stop expanding on block elements + if (!format[0].block_expand && isBlock(parent)) + return parent; + + // Walk left/right + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling)) { + return parent; + } + } - if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling)) - return container; + // Check if we can move up are we at root level or body level + if (parent.parentNode == root) { + container = parent; + break; } - container = container.parentNode; + parent = parent.parentNode; } return container; @@ -15844,23 +15945,103 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } // Exclude bookmark nodes if possible - if (isBookmarkNode(startContainer.parentNode)) - startContainer = startContainer.parentNode; - - if (isBookmarkNode(startContainer)) + if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) { + startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; startContainer = startContainer.nextSibling || startContainer; - if (isBookmarkNode(endContainer.parentNode)) { - endOffset = dom.nodeIndex(endContainer); - endContainer = endContainer.parentNode; + if (startContainer.nodeType == 3) + startOffset = 0; } - if (isBookmarkNode(endContainer) && endContainer.previousSibling) { - endContainer = endContainer.previousSibling; - endOffset = endContainer.length; + if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) { + endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; + endContainer = endContainer.previousSibling || endContainer; + + if (endContainer.nodeType == 3) + endOffset = endContainer.length; } if (format[0].inline) { + if (rng.collapsed) { + function findWordEndPoint(container, offset, start) { + var walker, node, pos, lastTextNode; + + function findSpace(node, offset) { + var pos, pos2, str = node.nodeValue; + + if (typeof(offset) == "undefined") { + offset = start ? str.length : 0; + } + + if (start) { + pos = str.lastIndexOf(' ', offset); + pos2 = str.lastIndexOf('\u00a0', offset); + pos = pos > pos2 ? pos : pos2; + + // Include the space on remove to avoid tag soup + if (pos !== -1 && !remove) { + pos++; + } + } else { + pos = str.indexOf(' ', offset); + pos2 = str.indexOf('\u00a0', offset); + pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2; + } + + return pos; + }; + + if (container.nodeType === 3) { + pos = findSpace(container, offset); + + if (pos !== -1) { + return {container : container, offset : pos}; + } + + lastTextNode = container; + } + + // Walk the nodes inside the block + walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody()); + while (node = walker[start ? 'prev' : 'next']()) { + if (node.nodeType === 3) { + lastTextNode = node; + pos = findSpace(node); + + if (pos !== -1) { + return {container : node, offset : pos}; + } + } else if (isBlock(node)) { + break; + } + } + + if (lastTextNode) { + if (start) { + offset = 0; + } else { + offset = lastTextNode.length; + } + + return {container: lastTextNode, offset: offset}; + } + } + + // Expand left to closest word boundery + endPoint = findWordEndPoint(startContainer, startOffset, true); + if (endPoint) { + startContainer = endPoint.container; + startOffset = endPoint.offset; + } + + // Expand right to closest word boundery + endPoint = findWordEndPoint(endContainer, endOffset); + if (endPoint) { + endContainer = endPoint.container; + endOffset = endPoint.offset; + } + } + // Avoid applying formatting to a trailing space. leaf = findLeaf(endContainer, endOffset); if (leaf.node) { @@ -15874,19 +16055,25 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { endContainer = leaf.node; endContainer.splitText(leaf.offset - 1); } else if (leaf.node.previousSibling) { - endContainer = leaf.node.previousSibling; + // TODO: Figure out why this is in here + //endContainer = leaf.node.previousSibling; } } } } - + // Move start/end point up the tree if the leaves are sharp and if we are in different containers // Example * becomes !: !

    *texttext*

    ! // This will reduce the number of wrapper elements that needs to be created // Move start point up the tree if (format[0].inline || format[0].block_expand) { - startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling'); - endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling'); + if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) { + startContainer = findParentContainer(true); + } + + if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(); + } } // Expand start/end container to matching selector @@ -15960,10 +16147,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Non block element then try to expand up the leaf if (format[0].block) { if (!isBlock(startContainer)) - startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling'); + startContainer = findParentContainer(true); if (!isBlock(endContainer)) - endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling'); + endContainer = findParentContainer(); } } @@ -16256,7 +16443,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function getContainer(rng, start) { - var container, offset, lastIdx; + var container, offset, lastIdx, walker; container = rng[start ? 'startContainer' : 'endContainer']; offset = rng[start ? 'startOffset' : 'endOffset']; @@ -16270,149 +16457,325 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { container = container.childNodes[offset > lastIdx ? lastIdx : offset]; } + // If start text node is excluded then walk to the next node + if (container.nodeType === 3 && start && offset >= container.nodeValue.length) { + container = new TreeWalker(container, ed.getBody()).next() || container; + } + + // If end text node is excluded then walk to the previous node + if (container.nodeType === 3 && !start && offset == 0) { + container = new TreeWalker(container, ed.getBody()).prev() || container; + } + return container; }; function performCaretAction(type, name, vars) { - var i, currentPendingFormats = pendingFormats[type], - otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply']; + var invisibleChar, caretContainerId = '_mce_caret', debug = ed.settings.caret_debug; + + // Setup invisible character use zero width space on Gecko since it doesn't change the heigt of the container + invisibleChar = tinymce.isGecko ? '\u200B' : INVISIBLE_CHAR; + + // Creates a caret container bogus element + function createCaretContainer(fill) { + var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''}); + + if (fill) { + caretContainer.appendChild(ed.getDoc().createTextNode(invisibleChar)); + } - function hasPending() { - return pendingFormats.apply.length || pendingFormats.remove.length; + return caretContainer; }; - function resetPending() { - pendingFormats.apply = []; - pendingFormats.remove = []; + function isCaretContainerEmpty(node, nodes) { + while (node) { + if ((node.nodeType === 3 && node.nodeValue !== invisibleChar) || node.childNodes.length > 1) { + return false; + } + + // Collect nodes + if (nodes && node.nodeType === 1) { + nodes.push(node); + } + + node = node.firstChild; + } + + return true; }; + + // Returns any parent caret container element + function getParentCaretContainer(node) { + while (node) { + if (node.id === caretContainerId) { + return node; + } - function perform(caret_node) { - // Apply pending formats - each(pendingFormats.apply.reverse(), function(item) { - apply(item.name, item.vars, caret_node); + node = node.parentNode; + } + }; - // Colored nodes should be underlined so that the color of the underline matches the text color. - if (item.name === 'forecolor' && item.vars.value) - processUnderlineAndColor(caret_node.parentNode); - }); + // Finds the first text node in the specified node + function findFirstTextNode(node) { + var walker; - // Remove pending formats - each(pendingFormats.remove.reverse(), function(item) { - remove(item.name, item.vars, caret_node); - }); + if (node) { + walker = new TreeWalker(node, node); - dom.remove(caret_node, 1); - resetPending(); + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3) { + return node; + } + } + } }; - // Check if it already exists then ignore it - for (i = currentPendingFormats.length - 1; i >= 0; i--) { - if (currentPendingFormats[i].name == name) + // Removes the caret container for the specified node or all on the current document + function removeCaretContainer(node, move_caret) { + var child, rng; + + if (!node) { + node = getParentCaretContainer(selection.getStart()); + + if (!node) { + while (node = dom.get(caretContainerId)) { + removeCaretContainer(node, false); + } + } + } else { + rng = selection.getRng(true); + + if (isCaretContainerEmpty(node)) { + if (move_caret !== false) { + rng.setStartBefore(node); + rng.setEndBefore(node); + } + + dom.remove(node); + } else { + child = findFirstTextNode(node); + + if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) { + child = child.deleteData(0, 1); + } + + dom.remove(node, 1); + } + + selection.setRng(rng); + } + }; + + // Applies formatting to the caret postion + function applyCaretFormat() { + var rng, caretContainer, textNode, offset, bookmark, container, text; + + rng = selection.getRng(true); + offset = rng.startOffset; + container = rng.startContainer; + text = container.nodeValue; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + + // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character + if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name)); + rng = rangeUtils.split(rng); + + // Apply the format to the range + apply(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== invisibleChar) { + caretContainer = createCaretContainer(true); + textNode = caretContainer.firstChild; + + rng.insertNode(caretContainer); + offset = 1; + + apply(name, vars, caretContainer); + } else { + apply(name, vars, caretContainer); + } + + // Move selection to text node + selection.setCursorLocation(textNode, offset); + } + }; + + function removeCaretFormat() { + var rng = selection.getRng(true), container, offset, bookmark, + hasContentAfter, node, formatNode, parents = [], i, caretContainer; + + container = rng.startContainer; + offset = rng.startOffset; + node = container; + + if (container.nodeType == 3) { + if (offset != container.nodeValue.length || container.nodeValue === invisibleChar) { + hasContentAfter = true; + } + + node = node.parentNode; + } + + while (node) { + if (matchNode(node, name, vars)) { + formatNode = node; + break; + } + + if (node.nextSibling) { + hasContentAfter = true; + } + + parents.push(node); + node = node.parentNode; + } + + // Node doesn't have the specified format + if (!formatNode) { return; - } + } - currentPendingFormats.push({name : name, vars : vars}); + // Is there contents after the caret then remove the format on the element + if (hasContentAfter) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); - // Check if it's in the other type, then remove it - for (i = otherPendingFormats.length - 1; i >= 0; i--) { - if (otherPendingFormats[i].name == name) - otherPendingFormats.splice(i, 1); - } + // Collapse bookmark range (WebKit) + rng.collapse(true); - // Pending apply or remove formats - if (hasPending()) { - ed.getDoc().execCommand('FontName', false, 'mceinline'); - pendingFormats.lastRng = selection.getRng(); + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name), true); + rng = rangeUtils.split(rng); - // IE will convert the current word - each(dom.select('font,span'), function(node) { - var bookmark; + // Remove the format from the range + remove(name, vars, rng); - if (isCaretNode(node)) { - bookmark = selection.getBookmark(); - perform(node); - selection.moveToBookmark(bookmark); - ed.nodeChanged(); + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + caretContainer = createCaretContainer(); + + node = caretContainer; + for (i = parents.length - 1; i >= 0; i--) { + node.appendChild(parents[i].cloneNode(false)); + node = node.firstChild; + } + + // Insert invisible character into inner most format element + node.appendChild(dom.doc.createTextNode(invisibleChar)); + node = node.firstChild; + + // Insert caret container after the formated node + dom.insertAfter(caretContainer, formatNode); + + // Move selection to text node + selection.setCursorLocation(node, 1); + } + }; + + // Only bind the caret events once + if (!self._hasCaretEvents) { + // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements + ed.onBeforeGetContent.addToTop(function() { + var nodes = [], i; + + if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) { + // Mark children + i = nodes.length; + while (i--) { + dom.setAttrib(nodes[i], 'data-mce-bogus', '1'); + } } }); - // Only register listeners once if we need to - if (!pendingFormats.isListening && hasPending()) { - pendingFormats.isListening = true; - function performPendingFormat(node, textNode) { - var rng = dom.createRng(); - perform(node); + // Remove caret container on mouse up and on key up + tinymce.each('onMouseUp onKeyUp'.split(' '), function(name) { + ed[name].addToTop(function() { + removeCaretContainer(); + }); + }); - rng.setStart(textNode, textNode.nodeValue.length); - rng.setEnd(textNode, textNode.nodeValue.length); - selection.setRng(rng); - ed.nodeChanged(); + // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys + ed.onKeyDown.addToTop(function(ed, e) { + var keyCode = e.keyCode; + + if (keyCode == 8 || keyCode == 37 || keyCode == 39) { + removeCaretContainer(getParentCaretContainer(selection.getStart())); } - var enterKeyPressed = false; + }); - each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) { - ed[event].addToTop(function(ed, e) { - if (e.keyCode==13 && !e.shiftKey) { - enterKeyPressed = true; - return; - } - // Do we have pending formats and is the selection moved has moved - if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) { - var foundCaret = false; - each(dom.select('font,span'), function(node) { - var textNode, rng; - - // Look for marker - if (isCaretNode(node)) { - foundCaret = true; - textNode = node.firstChild; - - // Find the first text node within node - while (textNode && textNode.nodeType != 3) - textNode = textNode.firstChild; - - if (textNode) - performPendingFormat(node, textNode); - else - dom.remove(node); - } - }); - - // no caret - so we are - if (enterKeyPressed && !foundCaret) { - var node = selection.getNode(); - var textNode = node; - - // Find the first text node within node - while (textNode && textNode.nodeType != 3) - textNode = textNode.firstChild; - if (textNode) { - node=textNode.parentNode; - while (!isBlock(node)){ - node=node.parentNode; - } - performPendingFormat(node, textNode); - } - } + self._hasCaretEvents = true; + } - // Always unbind and clear pending styles on keyup - if (e.type == 'keyup' || e.type == 'mouseup') { - resetPending(); - enterKeyPressed=false; - } - } - }); - }); + // Do apply or remove caret format + if (type == "apply") { + applyCaretFormat(); + } else { + removeCaretFormat(); + } + }; + + function moveStart(rng) { + var container = rng.startContainer, + offset = rng.startOffset, + walker, node, nodes, tmpNode; + + // Convert text node into index if possible + if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) { + container = container.parentNode; + offset = nodeIndex(container) + 1; + } + + // Move startContainer/startOffset in to a suitable node + if (container.nodeType == 1) { + nodes = container.childNodes; + container = nodes[Math.min(offset, nodes.length - 1)]; + walker = new TreeWalker(container); + + // If offset is at end of the parent node walk to the next one + if (offset > nodes.length - 1) + walker.next(); + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { + // IE has a "neat" feature where it moves the start node into the closest element + // we can avoid this by inserting an element before it and then remove it after we set the selection + tmpNode = dom.create('a', null, INVISIBLE_CHAR); + node.parentNode.insertBefore(tmpNode, node); + + // Set selection and remove tmpNode + rng.setStart(node, 0); + selection.setRng(rng); + dom.remove(tmpNode); + + return; + } } } }; + }; })(tinymce); tinymce.onAddEditor.add(function(tinymce, ed) { var filters, fontSizes, dom, settings = ed.settings; if (settings.inline_styles) { - fontSizes = tinymce.explode(settings.font_size_style_values); + fontSizes = tinymce.explode(settings.font_size_legacy_values); function replaceWithSpan(node, styles) { tinymce.each(styles, function(value, name) { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_src.js b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_src.js similarity index 94% rename from lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_src.js rename to lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_src.js index 94ac101690ee8..710eb670db752 100644 --- a/lib/editor/tinymce/tiny_mce/3.4.6/tiny_mce_src.js +++ b/lib/editor/tinymce/tiny_mce/3.4.9/tiny_mce_src.js @@ -532,7 +532,7 @@ tinymce.create('tinymce.util.Dispatcher', { // And this is also more efficient for (i = 0; i 0 ? a : [c.scope]); if (s === false) break; @@ -574,7 +574,7 @@ tinymce.create('tinymce.util.Dispatcher', { // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something - u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); + u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { var s = u[i]; @@ -895,8 +895,11 @@ tinymce.create('tinymce.util.Dispatcher', { v = '{'; - for (i in o) - v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : ''; + for (i in o) { + if (o.hasOwnProperty(i)) { + v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : ''; + } + } return v + '}'; } @@ -1031,11 +1034,17 @@ tinymce.create('static tinymce.util.XHR', { }()); (function(tinymce){ tinymce.VK = { - DELETE:46, - BACKSPACE:8 - + DELETE: 46, + BACKSPACE: 8, + ENTER: 13, + TAB: 9, + SPACEBAR: 32, + UP: 38, + DOWN: 40, + modifierPressed: function (e) { + return e.shiftKey || e.ctrlKey || e.altKey; + } } - })(tinymce); (function(tinymce) { var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE; @@ -1047,7 +1056,7 @@ tinymce.create('static tinymce.util.XHR', { var rng, blockElm, node, clonedSpan, isDelete; isDelete = e.keyCode == DELETE; - if (isDelete || e.keyCode == BACKSPACE) { + if ((isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) { e.preventDefault(); rng = selection.getRng(); @@ -1063,7 +1072,7 @@ tinymce.create('static tinymce.util.XHR', { node = blockElm.firstChild; // Ignore empty text nodes - while (node.nodeType == 3 && node.nodeValue.length == 0) + while (node && node.nodeType == 3 && node.nodeValue.length == 0) node = node.nextSibling; if (node && node.nodeName === 'SPAN') { @@ -1071,7 +1080,7 @@ tinymce.create('static tinymce.util.XHR', { } } - // Do the backspace/delete actiopn + // Do the backspace/delete action ed.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null); // Find all odd apple-style-spans @@ -1093,17 +1102,36 @@ tinymce.create('static tinymce.util.XHR', { }; function emptyEditorWhenDeleting(ed) { - ed.onKeyUp.add(function(ed, e) { - var keyCode = e.keyCode; + function serializeRng(rng) { + var body = ed.dom.create("body"); + var contents = rng.cloneContents(); + body.appendChild(contents); + return ed.selection.serializer.serialize(body, {format: 'html'}); + } + + function allContentsSelected(rng) { + var selection = serializeRng(rng); + + var allRng = ed.dom.createRng(); + allRng.selectNode(ed.getBody()); + + var allSelection = serializeRng(allRng); + return selection === allSelection; + } + + ed.onKeyDown.addToTop(function(ed, e) { + var keyCode = e.keyCode; if (keyCode == DELETE || keyCode == BACKSPACE) { - if (ed.dom.isEmpty(ed.getBody())) { + var rng = ed.selection.getRng(true); + if (!rng.collapsed && allContentsSelected(rng)) { ed.setContent('', {format : 'raw'}); ed.nodeChanged(); - return; + e.preventDefault(); } } }); + }; function inputMethodFocus(ed) { @@ -1112,6 +1140,21 @@ tinymce.create('static tinymce.util.XHR', { }); }; + function removeHrOnBackspace(ed) { + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode === BACKSPACE) { + if (ed.selection.isCollapsed() && ed.selection.getRng(true).startOffset === 0) { + var node = ed.selection.getNode(); + var previousSibling = node.previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { + ed.dom.remove(previousSibling); + tinymce.dom.Event.cancel(e); + } + } + } + }) + } + function focusBody(ed) { // Fix for a focus bug in FF 3.x where the body element // wouldn't get proper focus if the user clicked on the HTML element @@ -1149,6 +1192,51 @@ tinymce.create('static tinymce.util.XHR', { }); }; + function removeStylesOnPTagsInheritedFromHeadingTag(ed) { + ed.onKeyDown.add(function(ed, event) { + function checkInHeadingTag(ed) { + var currentNode = ed.selection.getNode(); + var headingTags = 'h1,h2,h3,h4,h5,h6'; + return ed.dom.is(currentNode, headingTags) || ed.dom.getParent(currentNode, headingTags) !== null; + } + + if (event.keyCode === VK.ENTER && !VK.modifierPressed(event) && checkInHeadingTag(ed)) { + setTimeout(function() { + var currentNode = ed.selection.getNode(); + if (ed.dom.is(currentNode, 'p')) { + ed.dom.setAttrib(currentNode, 'style', null); + // While tiny's content is correct after this method call, the content shown is not representative of it and needs to be 'repainted' + ed.execCommand('mceCleanup'); + } + }, 0); + } + }); + } + function selectionChangeNodeChanged(ed) { + var lastRng, selectionTimer; + + ed.dom.bind(ed.getDoc(), 'selectionchange', function() { + if (selectionTimer) { + clearTimeout(selectionTimer); + selectionTimer = 0; + } + + selectionTimer = window.setTimeout(function() { + var rng = ed.selection.getRng(); + + // Compare the ranges to see if it was a real change or not + if (!lastRng || !tinymce.dom.RangeUtils.compareRanges(rng, lastRng)) { + ed.nodeChanged(); + lastRng = rng; + } + }, 50); + }); + } + + function ensureBodyHasRoleApplication(ed) { + document.body.setAttribute("role", "application"); + } + tinymce.create('tinymce.util.Quirks', { Quirks: function(ed) { // WebKit @@ -1157,15 +1245,24 @@ tinymce.create('static tinymce.util.XHR', { emptyEditorWhenDeleting(ed); inputMethodFocus(ed); selectControlElements(ed); + + // iOS + if (tinymce.isIDevice) { + selectionChangeNodeChanged(ed); + } } // IE if (tinymce.isIE) { + removeHrOnBackspace(ed); emptyEditorWhenDeleting(ed); + ensureBodyHasRoleApplication(ed); + removeStylesOnPTagsInheritedFromHeadingTag(ed) } // Gecko if (tinymce.isGecko) { + removeHrOnBackspace(ed); focusBody(ed); } } @@ -1173,8 +1270,8 @@ tinymce.create('static tinymce.util.XHR', { })(tinymce); (function(tinymce) { var namedEntities, baseEntities, reverseEntities, - attrsCharsRegExp = /[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, - textCharsRegExp = /[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + attrsCharsRegExp = /[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, rawCharsRegExp = /[<>&\"\']/g, entityRegExp = /&(#x|#)?([\w]+);/g, asciiMap = { @@ -2157,7 +2254,7 @@ tinymce.html.Styles = function(settings, schema) { '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI '(?:\\/([^>]+)>)|' + // End element - '(?:([^\\s\\/<>]+)\\s*((?:[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*)>)' + // Start element + '(?:([^\\s\\/<>]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/)>)' + // Start element ')', 'g'); attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g; @@ -2686,6 +2783,10 @@ tinymce.html.Styles = function(settings, schema) { } } + // Keep comments + if (node.type === 8) + return false; + // Keep non whitespace text nodes if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) return false; @@ -3857,52 +3958,59 @@ tinymce.html.Writer = function(settings) { return this.run(e, function(e) { var s = t.settings; + var originalValue = e.getAttribute(n); + if (v !== null) { + switch (n) { + case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); - switch (n) { - case "style": - if (!is(v, 'string')) { - each(v, function(v, n) { - t.setStyle(e, n, v); - }); - - return; - } + return; + } - // No mce_style for elements with these since they might get resized by the user - if (s.keep_values) { - if (v && !t._isRes(v)) - e.setAttribute('data-mce-style', v, 2); - else - e.removeAttribute('data-mce-style', 2); - } + // No mce_style for elements with these since they might get resized by the user + if (s.keep_values) { + if (v && !t._isRes(v)) + e.setAttribute('data-mce-style', v, 2); + else + e.removeAttribute('data-mce-style', 2); + } - e.style.cssText = v; - break; + e.style.cssText = v; + break; - case "class": - e.className = v || ''; // Fix IE null bug - break; + case "class": + e.className = v || ''; // Fix IE null bug + break; - case "src": - case "href": - if (s.keep_values) { - if (s.url_converter) - v = s.url_converter.call(s.url_converter_scope || t, v, n, e); + case "src": + case "href": + if (s.keep_values) { + if (s.url_converter) + v = s.url_converter.call(s.url_converter_scope || t, v, n, e); - t.setAttrib(e, 'data-mce-' + n, v, 2); - } + t.setAttrib(e, 'data-mce-' + n, v, 2); + } - break; + break; - case "shape": - e.setAttribute('data-mce-style', v); - break; + case "shape": + e.setAttribute('data-mce-style', v); + break; + } } - if (is(v) && v !== null && v.length !== 0) e.setAttribute(n, '' + v, 2); else e.removeAttribute(n, 2); + + // fire onChangeAttrib event for attributes that have changed + if (tinyMCE.activeEditor && originalValue != v) { + var ed = tinyMCE.activeEditor; + ed.onSetAttrib.dispatch(ed, e, n, v); + } }); }, @@ -4546,6 +4654,10 @@ tinymce.html.Writer = function(settings) { } } + // Keep comment nodes + if (type == 8) + return false; + // Keep non whitespace text nodes if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) return false; @@ -4608,6 +4720,12 @@ tinymce.html.Writer = function(settings) { function trim(node) { var i, children = node.childNodes, type = node.nodeType; + function surroundedBySpans(node) { + var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN'; + var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN'; + return previousIsSpan && nextIsSpan; + } + if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') return; @@ -4618,7 +4736,10 @@ tinymce.html.Writer = function(settings) { // Keep non whitespace text nodes if (type == 3 && node.nodeValue.length > 0) { // If parent element isn't a block or there isn't any useful contents for example "

    " - if (!t.isBlock(node.parentNode) || tinymce.trim(node.nodeValue).length > 0) + // Also keep text nodes with only spaces if surrounded by spans. + // eg. "

    a b

    " should keep space between a and b + var trimmedLength = tinymce.trim(node.nodeValue).length; + if (!t.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength == 0 && surroundedBySpans(node)) return; } else if (type == 1) { // If the only child is a bookmark then move it up @@ -4655,9 +4776,9 @@ tinymce.html.Writer = function(settings) { // Insert middle chunk if (re) - pa.replaceChild(re, e); - else - pa.insertBefore(e, pe); + pa.replaceChild(re, e); + else + pa.insertBefore(e, pe); // Insert after chunk pa.insertBefore(trim(aft), pe); @@ -5672,7 +5793,7 @@ tinymce.html.Writer = function(settings) { parent = node.parentNode; root = dom.getRoot().parentNode; - while (parent != root) { + while (parent != root && parent.nodeType !== 9) { children = parent.children; i = children.length; @@ -7153,6 +7274,12 @@ window.tinymce.dom.Sizzle = Sizzle; return; } + // When loaded asynchronously, the DOM Content may already be loaded + if (doc.readyState === 'complete') { + t._pageInit(win); + return; + } + // Use IE method if (doc.attachEvent) { doc.attachEvent("onreadystatechange", function() { @@ -7951,7 +8078,8 @@ window.tinymce.dom.Sizzle = Sizzle; } s.addRange(r); - t.selectedRange = s.getRangeAt(0); + // adding range isn't always successful so we need to check range count otherwise an exception can occur + t.selectedRange = s.rangeCount > 0 ? s.getRangeAt(0) : null; } } else { // Is W3C Range @@ -8047,7 +8175,8 @@ window.tinymce.dom.Sizzle = Sizzle; if (sb && eb && sb != eb) { n = sb; - while ((n = n.nextSibling) && n != eb) { + var walker = new tinymce.dom.TreeWalker(sb, dom.getRoot()); + while ((n = walker.next()) && n != eb) { if (dom.isBlock(n)) bl.push(n); } @@ -8062,6 +8191,11 @@ window.tinymce.dom.Sizzle = Sizzle; normalize : function() { var self = this, rng, normalized; + // TODO: + // Retain selection direction. + // Lean left/right on Gecko for inline elements. + // Run this on mouse up/key up when the user manually moves the selection + // Normalize only on non IE browsers for now if (tinymce.isIE) return; @@ -8096,18 +8230,24 @@ window.tinymce.dom.Sizzle = Sizzle; if (node.nodeType === 3) { offset = start ? 0 : node.nodeValue.length - 1; container = node; + normalized = true; break; } - // Found a BR element that we can place the caret before - if (node.nodeName === 'BR') { + // Found a BR/IMG element that we can place the caret before + if (/^(BR|IMG)$/.test(node.nodeName)) { offset = dom.nodeIndex(node); container = node.parentNode; + + // Put caret after image when moving the end point + if (node.nodeName == "IMG" && !start) { + offset++; + } + + normalized = true; break; } } while (node = (start ? walker.next() : walker.prev())); - - normalized = true; } } } @@ -8122,7 +8262,7 @@ window.tinymce.dom.Sizzle = Sizzle; // Normalize the end points normalizeEndPoint(true); - if (rng.collapsed) + if (!rng.collapsed) normalizeEndPoint(); // Set the selection if it was normalized @@ -8233,12 +8373,11 @@ window.tinymce.dom.Sizzle = Sizzle; if (!settings.apply_source_formatting) settings.indent = false; - settings.remove_trailing_brs = true; - // Default DOM and Schema if they are undefined dom = dom || tinymce.DOM; schema = schema || new tinymce.html.Schema(settings); settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; onPreProcess = new tinymce.util.Dispatcher(self); @@ -8302,8 +8441,8 @@ window.tinymce.dom.Sizzle = Sizzle; function trim(value) { return value.replace(/()/g, '\n') .replace(/^[\r\n]*|[\r\n]*$/g, '') - .replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g, ''); + .replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); }; while (i--) { @@ -8452,7 +8591,7 @@ window.tinymce.dom.Sizzle = Sizzle; // Replace all BOM characters for now until we can find a better solution if (!args.cleanup) - args.content = args.content.replace(/\uFEFF/g, ''); + args.content = args.content.replace(/\uFEFF|\u200B/g, ''); // Post process if (!args.no_events) @@ -8744,6 +8883,24 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { return; } + function exclude(nodes) { + var node; + + // First node is excluded + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + + // Last node is excluded + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + + return nodes; + }; + function collectSiblings(node, name, end_node) { var siblings = []; @@ -8773,7 +8930,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { if (!next) siblings.reverse(); - callback(siblings); + callback(exclude(siblings)); } } }; @@ -8786,28 +8943,28 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)]; - // Find common ancestor and end points - ancestor = dom.findCommonAncestor(startContainer, endContainer); - // Same container if (startContainer == endContainer) - return callback([startContainer]); + return callback(exclude([startContainer])); + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(startContainer, endContainer); + // Process left side for (node = startContainer; node; node = node.parentNode) { - if (node == endContainer) + if (node === endContainer) return walkBoundary(startContainer, ancestor, true); - if (node == ancestor) + if (node === ancestor) break; } // Process right side for (node = endContainer; node; node = node.parentNode) { - if (node == startContainer) + if (node === startContainer) return walkBoundary(endContainer, ancestor); - if (node == ancestor) + if (node === ancestor) break; } @@ -8826,48 +8983,46 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { ); if (siblings.length) - callback(siblings); + callback(exclude(siblings)); // Walk right leaf walkBoundary(endContainer, endPoint); }; - /* this.split = function(rng) { + this.split = function(rng) { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; function splitText(node, offset) { - if (offset == node.nodeValue.length) - node.appendData(INVISIBLE_CHAR); - - node = node.splitText(offset); - - if (node.nodeValue === INVISIBLE_CHAR) - node.nodeValue = ''; - - return node; + return node.splitText(offset); }; // Handle single text node - if (startContainer == endContainer) { - if (startContainer.nodeType == 3) { - if (startOffset != 0) - startContainer = endContainer = splitText(startContainer, startOffset); - - if (endOffset - startOffset != startContainer.nodeValue.length) - splitText(startContainer, endOffset - startOffset); + if (startContainer == endContainer && startContainer.nodeType == 3) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } } } else { // Split startContainer text node if needed - if (startContainer.nodeType == 3 && startOffset != 0) { + if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) { startContainer = splitText(startContainer, startOffset); startOffset = 0; } // Split endContainer text node if needed - if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) { + if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) { endContainer = splitText(endContainer, endOffset).previousSibling; endOffset = endContainer.nodeValue.length; } @@ -8880,7 +9035,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) { endOffset : endOffset }; }; -*/ + }; tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) { @@ -9581,7 +9736,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { // Internal functions _setupKeyboardNav : function(){ var contextMenu, menuItems, t=this; - contextMenu = DOM.select('#menu_' + t.id)[0]; + contextMenu = DOM.get('menu_' + t.id); menuItems = DOM.select('a[role=option]', 'menu_' + t.id); menuItems.splice(0,0,contextMenu); t.keyboardNav = new tinymce.ui.KeyboardNavigation({ @@ -9688,10 +9843,27 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { }, postRender : function() { - var t = this, s = t.settings; - + var t = this, s = t.settings, imgBookmark; + + // In IE a large image that occupies the entire editor area will be deselected when a button is clicked, so + // need to keep the selection in case the selection is lost + if (tinymce.isIE && t.editor) { + tinymce.dom.Event.add(t.id, 'mousedown', function(e) { + var nodeName = t.editor.selection.getNode().nodeName; + imgBookmark = nodeName === 'IMG' ? t.editor.selection.getBookmark() : null; + }); + } tinymce.dom.Event.add(t.id, 'click', function(e) { - if (!t.isDisabled()) + if (!t.isDisabled()) { + // restore the selection in case the selection is lost in IE + if (tinymce.isIE && t.editor && imgBookmark !== null) { + t.editor.selection.moveToBookmark(imgBookmark); + } + return s.onclick.call(s.scope, e); + } + }); + tinymce.dom.Event.add(t.id, 'keyup', function(e) { + if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR) return s.onclick.call(s.scope, e); }); } @@ -9726,7 +9898,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return t.selectByIndex(-1); // Is string or number make function selector - if (va && va.call) + if (va && typeof(va)=="function") f = va; else { f = function(v) { @@ -10002,7 +10174,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return t.selectByIndex(-1); // Is string or number make function selector - if (va && va.call) + if (va && typeof(va)=="function") f = va; else { f = function(v) { @@ -10393,15 +10565,21 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { } n = DOM.add(tr, 'td'); - n = DOM.add(n, 'a', { - role : 'option', + var settings = { href : 'javascript:;', style : { backgroundColor : '#' + c }, 'title': t.editor.getLang('colors.' + c, c), 'data-mce-color' : '#' + c - }); + }; + + // adding a proper ARIA role = button causes JAWS to read things incorrectly on IE. + if (!tinymce.isIE ) { + settings['role']= 'option'; + } + + n = DOM.add(n, 'a', settings); if (t.editor.forcedHighContrastMode) { n = DOM.add(n, 'canvas', { width: 16, height: 16, 'aria-hidden': 'true' }); @@ -11035,7 +11213,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, - inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode; + inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode, VK = tinymce.VK; tinymce.create('tinymce.Editor', { Editor : function(id, s) { @@ -11059,6 +11237,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { 'onPostRender', + 'onLoad', + 'onInit', 'onRemove', @@ -11121,7 +11301,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { 'onVisualAid', - 'onSetProgressState' + 'onSetProgressState', + + 'onSetAttrib' ], function(e) { t[e] = new Dispatcher(t); }); @@ -11155,6 +11337,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { visual_table_class : 'mceItemTable', visual : 1, font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large', + font_size_legacy_values : 'xx-small,small,medium,large,x-large,xx-large,300%', // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size apply_source_formatting : 1, directionality : 'ltr', forced_root_block : 'p', @@ -11464,6 +11647,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { t.iframeHTML += ''; } + t.contentCSS = []; + bi = s.body_id || 'tinymce'; if (bi.indexOf('=') != -1) { bi = t.getParam('body_id', '', 'hash'); @@ -11476,7 +11661,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { bc = bc[t.id] || ''; } - t.iframeHTML += '
    '; + t.iframeHTML += '
    '; // Domain relaxing enabled, then set document domain if (tinymce.relaxedDomain && (isIE || (tinymce.isOpera && parseFloat(opera.version()) < 11))) { @@ -11590,10 +11775,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Keep scripts from executing t.parser.addNodeFilter('script', function(nodes, name) { - var i = nodes.length; + var i = nodes.length, node; - while (i--) - nodes[i].attr('type', 'mce-text/javascript'); + while (i--) { + node = nodes[i]; + node.attr('type', 'mce-' + (node.attr('type') || 'text/javascript')); + } }); t.parser.addNodeFilter('#cdata', function(nodes, name) { @@ -11942,7 +12129,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } t._refreshContentEditable(); - selection.normalize(); // Is not content editable if (!ce) @@ -12142,9 +12328,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus)) t.focus(); - o = {}; - t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o); - if (o.terminate) + a = extend({}, a); + t.onBeforeExecCommand.dispatch(t, cmd, ui, val, a); + if (a.terminate) return false; // Command callback @@ -12714,30 +12900,32 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Add block quote deletion handler t.onKeyDown.add(function(ed, e) { - // Was the BACKSPACE key pressed? - if (e.keyCode != 8) + if (e.keyCode != VK.BACKSPACE) return; - var n = ed.selection.getRng().startContainer; - var offset = ed.selection.getRng().startOffset; + var rng = ed.selection.getRng(); + if (!rng.collapsed) + return; + + var n = rng.startContainer; + var offset = rng.startOffset; while (n && n.nodeType && n.nodeType != 1 && n.parentNode) n = n.parentNode; - + // Is the cursor at the beginning of a blockquote? if (n && n.parentNode && n.parentNode.tagName === 'BLOCKQUOTE' && n.parentNode.firstChild == n && offset == 0) { // Remove the blockquote ed.formatter.toggle('blockquote', null, n.parentNode); // Move the caret to the beginning of n - var rng = ed.selection.getRng(); rng.setStart(n, 0); rng.setEnd(n, 0); ed.selection.setRng(rng); ed.selection.collapse(false); } }); - + // Add reset handler @@ -12874,7 +13062,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { t.undoManager.add(); }; - dom.bind(t.getDoc(), 'focusout', function(e) { + var focusLostFunc = tinymce.isGecko ? 'blur' : 'focusout'; + dom.bind(t.getDoc(), focusLostFunc, function(e){ if (!t.removed && t.undoManager.typing) addUndo(); }); @@ -12934,21 +13123,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }); } - // Fire a nodeChanged when the selection is changed on WebKit this fixes selection issues on iOS5 - // It only fires the nodeChange event every 50ms since it would other wise update the UI when you type and it hogs the CPU - if (tinymce.isWebKit) { - dom.bind(t.getDoc(), 'selectionchange', function() { - if (t.selectionTimer) { - clearTimeout(t.selectionTimer); - t.selectionTimer = 0; - } - - t.selectionTimer = window.setTimeout(function() { - t.nodeChanged(); - }, 50); - }); - } - // Bug fix for FireFox keeping styles from end of selection instead of start. if (tinymce.isGecko) { function getAttributeApplyFunction() { @@ -12958,11 +13132,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var target = t.selection.getStart(); if (target !== t.getBody()) { - t.dom.removeAllAttribs(target); + t.dom.setAttrib(target, "style", null); - each(template, function(attr) { - target.setAttributeNode(attr.cloneNode(true)); - }); + each(template, function(attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); } }; } @@ -13273,6 +13447,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var parser, serializer, parentNode, rootNode, fragment, args, marker, nodeRect, viewPortRect, rng, node, node2, bookmarkHtml, viewportBodyElement; + //selection.normalize(); + // Setup parser and serializer parser = editor.parser; serializer = new tinymce.html.Serializer({}, editor.schema); @@ -13499,7 +13675,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { addCommands({ // Override justify commands 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) { - return isFormatMatch('align' + command.substring(7)); + var name = 'align' + command.substring(7); + // Use Formatter.matchNode instead of Formatter.match so that we don't match on parent node. This fixes bug where for both left + // and right align buttons can be active. This could occur when selected nodes have align right and the parent has align left. + var nodes = selection.isCollapsed() ? [selection.getNode()] : selection.getSelectedBlocks(); + var matches = tinymce.map(nodes, function(node) { + return !!formatter.matchNode(node, name); + }); + return tinymce.inArray(matches, TRUE) !== -1; }, 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) { @@ -14806,8 +14989,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { MCE_ATTR_RE = /^(src|href|style)$/, FALSE = false, TRUE = true, - undefined, - pendingFormats = {apply : [], remove : []}; + undefined; function isArray(obj) { return obj instanceof Array; @@ -14818,7 +15000,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function isCaretNode(node) { - return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline'); + return node.nodeType === 1 && node.id === '_mce_caret'; }; // Public functions @@ -14893,30 +15075,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function apply(name, vars, node) { var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed(); - function moveStart(rng) { - var container = rng.startContainer, - offset = rng.startOffset, - walker, node; - - // Move startContainer/startOffset in to a suitable node - if (container.nodeType == 1 || container.nodeValue === "") { - container = container.nodeType == 1 ? container.childNodes[offset] : container; - - // Might fail if the offset is behind the last element in it's container - if (container) { - walker = new TreeWalker(container, container.parentNode); - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { - rng.setStart(node, 0); - break; - } - } - } - } - - return rng; - }; - function setElementFormat(elm, fmt) { fmt = fmt || format; @@ -15023,7 +15181,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } }; - function applyRngStyle(rng, bookmark) { + function applyRngStyle(rng, bookmark, node_specific) { var newWrappers = [], wrapName, wrapElm; // Setup wrapper element @@ -15087,7 +15245,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Is it valid to wrap this item if (isValid(wrapName, nodeName) && isValid(parentName, wrapName) && - !(node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279)) { + !(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) { // Start wrapping if (!currentWrapElm) { // Wrap the node @@ -15242,12 +15400,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (format) { if (node) { - rng = dom.createRng(); - - rng.setStartBefore(node); - rng.setEndAfter(node); - - applyRngStyle(expandRng(rng, formatList)); + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(expandRng(rng, formatList), null, true); + } else { + applyRngStyle(node, null, true); + } } else { if (!isCollapsed || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) { // Obtain selection node before selection is unselected by applyRngStyle() @@ -15265,7 +15425,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } selection.moveToBookmark(bookmark); - selection.setRng(moveStart(selection.getRng(TRUE))); + moveStart(selection.getRng(TRUE)); ed.nodeChanged(); } else performCaretAction('apply', name, vars); @@ -15275,44 +15435,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function remove(name, vars, node) { var formatList = get(name), format = formatList[0], bookmark, i, rng; - function moveStart(rng) { - var container = rng.startContainer, - offset = rng.startOffset, - walker, node, nodes, tmpNode; - - // Convert text node into index if possible - if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) { - container = container.parentNode; - offset = nodeIndex(container) + 1; - } - - // Move startContainer/startOffset in to a suitable node - if (container.nodeType == 1) { - nodes = container.childNodes; - container = nodes[Math.min(offset, nodes.length - 1)]; - walker = new TreeWalker(container); - - // If offset is at end of the parent node walk to the next one - if (offset > nodes.length - 1) - walker.next(); - - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { - // IE has a "neat" feature where it moves the start node into the closest element - // we can avoid this by inserting an element before it and then remove it after we set the selection - tmpNode = dom.create('a', null, INVISIBLE_CHAR); - node.parentNode.insertBefore(tmpNode, node); - - // Set selection and remove tmpNode - rng.setStart(node, 0); - selection.setRng(rng); - dom.remove(tmpNode); - - return; - } - } - } - }; // Merges the styles for each node function process(node) { @@ -15461,10 +15583,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Handle node if (node) { - rng = dom.createRng(); - rng.setStartBefore(node); - rng.setEndAfter(node); - removeRngStyle(rng); + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + return; } @@ -15481,6 +15608,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { ed.nodeChanged(); } else performCaretAction('remove', name, vars); + + // When you remove formatting from a table cell in WebKit (cell, not the contents of a cell) there is a rendering issue with column width + if (tinymce.isWebKit) { + ed.execCommand('mceCleanup'); + } }; function toggle(name, vars, node) { @@ -15555,7 +15687,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function match(name, vars, node) { - var startNode, i; + var startNode; function matchParents(node) { // Find first node with similar format settings @@ -15571,21 +15703,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (node) return matchParents(node); - // Check pending formats - if (selection.isCollapsed()) { - for (i = pendingFormats.apply.length - 1; i >= 0; i--) { - if (pendingFormats.apply[i].name == name) - return true; - } - - for (i = pendingFormats.remove.length - 1; i >= 0; i--) { - if (pendingFormats.remove[i].name == name) - return false; - } - - return matchParents(selection.getNode()); - } - // Check selected node node = selection.getNode(); if (matchParents(node)) @@ -15604,33 +15721,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { function matchAll(names, vars) { var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name; - // If the selection is collapsed then check pending formats - if (selection.isCollapsed()) { - for (ni = 0; ni < names.length; ni++) { - // If the name is to be removed, then stop it from being added - for (i = pendingFormats.remove.length - 1; i >= 0; i--) { - name = names[ni]; - - if (pendingFormats.remove[i].name == name) { - checkedMap[name] = true; - break; - } - } - } - - // If the format is to be applied - for (i = pendingFormats.apply.length - 1; i >= 0; i--) { - for (ni = 0; ni < names.length; ni++) { - name = names[ni]; - - if (!checkedMap[name] && pendingFormats.apply[i].name == name) { - checkedMap[name] = true; - matchedFormatNames.push(name); - } - } - } - } - // Check start of selection for formats startElement = selection.getStart(); dom.getParent(startElement, function(node) { @@ -15739,7 +15829,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function isWhiteSpaceNode(node) { - return node && node.nodeType === 3 && /^([\s\r\n]+|)$/.test(node.nodeValue); + return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue); }; function wrap(node, name, attrs) { @@ -15755,31 +15845,42 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, - endOffset = rng.endOffset, sibling, lastIdx, leaf; + endOffset = rng.endOffset, sibling, lastIdx, leaf, endPoint; // This function walks up the tree if there is no siblings before/after the node - function findParentContainer(container, child_name, sibling_name, root) { - var parent, child; + function findParentContainer(start) { + var container, parent, child, sibling, siblingName; - root = root || dom.getRoot(); + container = parent = start ? startContainer : endContainer; + siblingName = start ? 'previousSibling' : 'nextSibling'; + root = dom.getRoot(); - for (;;) { - // Check if we can move up are we at root level or body level - parent = container.parentNode; - - // Stop expanding on block elements or root depending on format - if (parent == root || (!format[0].block_expand && isBlock(parent))) + // If it's a text node and the offset is inside the text + if (container.nodeType == 3 && !isWhiteSpaceNode(container)) { + if (start ? startOffset > 0 : endOffset < container.nodeValue.length) { return container; + } + } - for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) { - if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) - return container; + for (;;) { + // Stop expanding on block elements + if (!format[0].block_expand && isBlock(parent)) + return parent; + + // Walk left/right + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling)) { + return parent; + } + } - if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling)) - return container; + // Check if we can move up are we at root level or body level + if (parent.parentNode == root) { + container = parent; + break; } - container = container.parentNode; + parent = parent.parentNode; } return container; @@ -15817,23 +15918,103 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { } // Exclude bookmark nodes if possible - if (isBookmarkNode(startContainer.parentNode)) - startContainer = startContainer.parentNode; - - if (isBookmarkNode(startContainer)) + if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) { + startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; startContainer = startContainer.nextSibling || startContainer; - if (isBookmarkNode(endContainer.parentNode)) { - endOffset = dom.nodeIndex(endContainer); - endContainer = endContainer.parentNode; + if (startContainer.nodeType == 3) + startOffset = 0; } - if (isBookmarkNode(endContainer) && endContainer.previousSibling) { - endContainer = endContainer.previousSibling; - endOffset = endContainer.length; + if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) { + endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; + endContainer = endContainer.previousSibling || endContainer; + + if (endContainer.nodeType == 3) + endOffset = endContainer.length; } if (format[0].inline) { + if (rng.collapsed) { + function findWordEndPoint(container, offset, start) { + var walker, node, pos, lastTextNode; + + function findSpace(node, offset) { + var pos, pos2, str = node.nodeValue; + + if (typeof(offset) == "undefined") { + offset = start ? str.length : 0; + } + + if (start) { + pos = str.lastIndexOf(' ', offset); + pos2 = str.lastIndexOf('\u00a0', offset); + pos = pos > pos2 ? pos : pos2; + + // Include the space on remove to avoid tag soup + if (pos !== -1 && !remove) { + pos++; + } + } else { + pos = str.indexOf(' ', offset); + pos2 = str.indexOf('\u00a0', offset); + pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2; + } + + return pos; + }; + + if (container.nodeType === 3) { + pos = findSpace(container, offset); + + if (pos !== -1) { + return {container : container, offset : pos}; + } + + lastTextNode = container; + } + + // Walk the nodes inside the block + walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody()); + while (node = walker[start ? 'prev' : 'next']()) { + if (node.nodeType === 3) { + lastTextNode = node; + pos = findSpace(node); + + if (pos !== -1) { + return {container : node, offset : pos}; + } + } else if (isBlock(node)) { + break; + } + } + + if (lastTextNode) { + if (start) { + offset = 0; + } else { + offset = lastTextNode.length; + } + + return {container: lastTextNode, offset: offset}; + } + } + + // Expand left to closest word boundery + endPoint = findWordEndPoint(startContainer, startOffset, true); + if (endPoint) { + startContainer = endPoint.container; + startOffset = endPoint.offset; + } + + // Expand right to closest word boundery + endPoint = findWordEndPoint(endContainer, endOffset); + if (endPoint) { + endContainer = endPoint.container; + endOffset = endPoint.offset; + } + } + // Avoid applying formatting to a trailing space. leaf = findLeaf(endContainer, endOffset); if (leaf.node) { @@ -15847,19 +16028,25 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { endContainer = leaf.node; endContainer.splitText(leaf.offset - 1); } else if (leaf.node.previousSibling) { - endContainer = leaf.node.previousSibling; + // TODO: Figure out why this is in here + //endContainer = leaf.node.previousSibling; } } } } - + // Move start/end point up the tree if the leaves are sharp and if we are in different containers // Example * becomes !: !

    *texttext*

    ! // This will reduce the number of wrapper elements that needs to be created // Move start point up the tree if (format[0].inline || format[0].block_expand) { - startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling'); - endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling'); + if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) { + startContainer = findParentContainer(true); + } + + if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(); + } } // Expand start/end container to matching selector @@ -15933,10 +16120,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { // Non block element then try to expand up the leaf if (format[0].block) { if (!isBlock(startContainer)) - startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling'); + startContainer = findParentContainer(true); if (!isBlock(endContainer)) - endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling'); + endContainer = findParentContainer(); } } @@ -16229,7 +16416,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }; function getContainer(rng, start) { - var container, offset, lastIdx; + var container, offset, lastIdx, walker; container = rng[start ? 'startContainer' : 'endContainer']; offset = rng[start ? 'startOffset' : 'endOffset']; @@ -16243,149 +16430,325 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { container = container.childNodes[offset > lastIdx ? lastIdx : offset]; } + // If start text node is excluded then walk to the next node + if (container.nodeType === 3 && start && offset >= container.nodeValue.length) { + container = new TreeWalker(container, ed.getBody()).next() || container; + } + + // If end text node is excluded then walk to the previous node + if (container.nodeType === 3 && !start && offset == 0) { + container = new TreeWalker(container, ed.getBody()).prev() || container; + } + return container; }; function performCaretAction(type, name, vars) { - var i, currentPendingFormats = pendingFormats[type], - otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply']; + var invisibleChar, caretContainerId = '_mce_caret', debug = ed.settings.caret_debug; + + // Setup invisible character use zero width space on Gecko since it doesn't change the heigt of the container + invisibleChar = tinymce.isGecko ? '\u200B' : INVISIBLE_CHAR; + + // Creates a caret container bogus element + function createCaretContainer(fill) { + var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''}); + + if (fill) { + caretContainer.appendChild(ed.getDoc().createTextNode(invisibleChar)); + } - function hasPending() { - return pendingFormats.apply.length || pendingFormats.remove.length; + return caretContainer; }; - function resetPending() { - pendingFormats.apply = []; - pendingFormats.remove = []; + function isCaretContainerEmpty(node, nodes) { + while (node) { + if ((node.nodeType === 3 && node.nodeValue !== invisibleChar) || node.childNodes.length > 1) { + return false; + } + + // Collect nodes + if (nodes && node.nodeType === 1) { + nodes.push(node); + } + + node = node.firstChild; + } + + return true; }; + + // Returns any parent caret container element + function getParentCaretContainer(node) { + while (node) { + if (node.id === caretContainerId) { + return node; + } - function perform(caret_node) { - // Apply pending formats - each(pendingFormats.apply.reverse(), function(item) { - apply(item.name, item.vars, caret_node); + node = node.parentNode; + } + }; - // Colored nodes should be underlined so that the color of the underline matches the text color. - if (item.name === 'forecolor' && item.vars.value) - processUnderlineAndColor(caret_node.parentNode); - }); + // Finds the first text node in the specified node + function findFirstTextNode(node) { + var walker; - // Remove pending formats - each(pendingFormats.remove.reverse(), function(item) { - remove(item.name, item.vars, caret_node); - }); + if (node) { + walker = new TreeWalker(node, node); - dom.remove(caret_node, 1); - resetPending(); + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3) { + return node; + } + } + } }; - // Check if it already exists then ignore it - for (i = currentPendingFormats.length - 1; i >= 0; i--) { - if (currentPendingFormats[i].name == name) + // Removes the caret container for the specified node or all on the current document + function removeCaretContainer(node, move_caret) { + var child, rng; + + if (!node) { + node = getParentCaretContainer(selection.getStart()); + + if (!node) { + while (node = dom.get(caretContainerId)) { + removeCaretContainer(node, false); + } + } + } else { + rng = selection.getRng(true); + + if (isCaretContainerEmpty(node)) { + if (move_caret !== false) { + rng.setStartBefore(node); + rng.setEndBefore(node); + } + + dom.remove(node); + } else { + child = findFirstTextNode(node); + + if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) { + child = child.deleteData(0, 1); + } + + dom.remove(node, 1); + } + + selection.setRng(rng); + } + }; + + // Applies formatting to the caret postion + function applyCaretFormat() { + var rng, caretContainer, textNode, offset, bookmark, container, text; + + rng = selection.getRng(true); + offset = rng.startOffset; + container = rng.startContainer; + text = container.nodeValue; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + + // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character + if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name)); + rng = rangeUtils.split(rng); + + // Apply the format to the range + apply(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== invisibleChar) { + caretContainer = createCaretContainer(true); + textNode = caretContainer.firstChild; + + rng.insertNode(caretContainer); + offset = 1; + + apply(name, vars, caretContainer); + } else { + apply(name, vars, caretContainer); + } + + // Move selection to text node + selection.setCursorLocation(textNode, offset); + } + }; + + function removeCaretFormat() { + var rng = selection.getRng(true), container, offset, bookmark, + hasContentAfter, node, formatNode, parents = [], i, caretContainer; + + container = rng.startContainer; + offset = rng.startOffset; + node = container; + + if (container.nodeType == 3) { + if (offset != container.nodeValue.length || container.nodeValue === invisibleChar) { + hasContentAfter = true; + } + + node = node.parentNode; + } + + while (node) { + if (matchNode(node, name, vars)) { + formatNode = node; + break; + } + + if (node.nextSibling) { + hasContentAfter = true; + } + + parents.push(node); + node = node.parentNode; + } + + // Node doesn't have the specified format + if (!formatNode) { return; - } + } - currentPendingFormats.push({name : name, vars : vars}); + // Is there contents after the caret then remove the format on the element + if (hasContentAfter) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); - // Check if it's in the other type, then remove it - for (i = otherPendingFormats.length - 1; i >= 0; i--) { - if (otherPendingFormats[i].name == name) - otherPendingFormats.splice(i, 1); - } + // Collapse bookmark range (WebKit) + rng.collapse(true); - // Pending apply or remove formats - if (hasPending()) { - ed.getDoc().execCommand('FontName', false, 'mceinline'); - pendingFormats.lastRng = selection.getRng(); + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name), true); + rng = rangeUtils.split(rng); - // IE will convert the current word - each(dom.select('font,span'), function(node) { - var bookmark; + // Remove the format from the range + remove(name, vars, rng); - if (isCaretNode(node)) { - bookmark = selection.getBookmark(); - perform(node); - selection.moveToBookmark(bookmark); - ed.nodeChanged(); + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + caretContainer = createCaretContainer(); + + node = caretContainer; + for (i = parents.length - 1; i >= 0; i--) { + node.appendChild(parents[i].cloneNode(false)); + node = node.firstChild; + } + + // Insert invisible character into inner most format element + node.appendChild(dom.doc.createTextNode(invisibleChar)); + node = node.firstChild; + + // Insert caret container after the formated node + dom.insertAfter(caretContainer, formatNode); + + // Move selection to text node + selection.setCursorLocation(node, 1); + } + }; + + // Only bind the caret events once + if (!self._hasCaretEvents) { + // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements + ed.onBeforeGetContent.addToTop(function() { + var nodes = [], i; + + if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) { + // Mark children + i = nodes.length; + while (i--) { + dom.setAttrib(nodes[i], 'data-mce-bogus', '1'); + } } }); - // Only register listeners once if we need to - if (!pendingFormats.isListening && hasPending()) { - pendingFormats.isListening = true; - function performPendingFormat(node, textNode) { - var rng = dom.createRng(); - perform(node); + // Remove caret container on mouse up and on key up + tinymce.each('onMouseUp onKeyUp'.split(' '), function(name) { + ed[name].addToTop(function() { + removeCaretContainer(); + }); + }); - rng.setStart(textNode, textNode.nodeValue.length); - rng.setEnd(textNode, textNode.nodeValue.length); - selection.setRng(rng); - ed.nodeChanged(); + // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys + ed.onKeyDown.addToTop(function(ed, e) { + var keyCode = e.keyCode; + + if (keyCode == 8 || keyCode == 37 || keyCode == 39) { + removeCaretContainer(getParentCaretContainer(selection.getStart())); } - var enterKeyPressed = false; + }); - each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) { - ed[event].addToTop(function(ed, e) { - if (e.keyCode==13 && !e.shiftKey) { - enterKeyPressed = true; - return; - } - // Do we have pending formats and is the selection moved has moved - if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) { - var foundCaret = false; - each(dom.select('font,span'), function(node) { - var textNode, rng; - - // Look for marker - if (isCaretNode(node)) { - foundCaret = true; - textNode = node.firstChild; - - // Find the first text node within node - while (textNode && textNode.nodeType != 3) - textNode = textNode.firstChild; - - if (textNode) - performPendingFormat(node, textNode); - else - dom.remove(node); - } - }); - - // no caret - so we are - if (enterKeyPressed && !foundCaret) { - var node = selection.getNode(); - var textNode = node; - - // Find the first text node within node - while (textNode && textNode.nodeType != 3) - textNode = textNode.firstChild; - if (textNode) { - node=textNode.parentNode; - while (!isBlock(node)){ - node=node.parentNode; - } - performPendingFormat(node, textNode); - } - } + self._hasCaretEvents = true; + } - // Always unbind and clear pending styles on keyup - if (e.type == 'keyup' || e.type == 'mouseup') { - resetPending(); - enterKeyPressed=false; - } - } - }); - }); + // Do apply or remove caret format + if (type == "apply") { + applyCaretFormat(); + } else { + removeCaretFormat(); + } + }; + + function moveStart(rng) { + var container = rng.startContainer, + offset = rng.startOffset, + walker, node, nodes, tmpNode; + + // Convert text node into index if possible + if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) { + container = container.parentNode; + offset = nodeIndex(container) + 1; + } + + // Move startContainer/startOffset in to a suitable node + if (container.nodeType == 1) { + nodes = container.childNodes; + container = nodes[Math.min(offset, nodes.length - 1)]; + walker = new TreeWalker(container); + + // If offset is at end of the parent node walk to the next one + if (offset > nodes.length - 1) + walker.next(); + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { + // IE has a "neat" feature where it moves the start node into the closest element + // we can avoid this by inserting an element before it and then remove it after we set the selection + tmpNode = dom.create('a', null, INVISIBLE_CHAR); + node.parentNode.insertBefore(tmpNode, node); + + // Set selection and remove tmpNode + rng.setStart(node, 0); + selection.setRng(rng); + dom.remove(tmpNode); + + return; + } } } }; + }; })(tinymce); tinymce.onAddEditor.add(function(tinymce, ed) { var filters, fontSizes, dom, settings = ed.settings; if (settings.inline_styles) { - fontSizes = tinymce.explode(settings.font_size_style_values); + fontSizes = tinymce.explode(settings.font_size_legacy_values); function replaceWithSpan(node, styles) { tinymce.each(styles, function(value, name) { diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/utils/editable_selects.js b/lib/editor/tinymce/tiny_mce/3.4.9/utils/editable_selects.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/utils/editable_selects.js rename to lib/editor/tinymce/tiny_mce/3.4.9/utils/editable_selects.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/utils/form_utils.js b/lib/editor/tinymce/tiny_mce/3.4.9/utils/form_utils.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/utils/form_utils.js rename to lib/editor/tinymce/tiny_mce/3.4.9/utils/form_utils.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/utils/mctabs.js b/lib/editor/tinymce/tiny_mce/3.4.9/utils/mctabs.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/utils/mctabs.js rename to lib/editor/tinymce/tiny_mce/3.4.9/utils/mctabs.js diff --git a/lib/editor/tinymce/tiny_mce/3.4.6/utils/validate.js b/lib/editor/tinymce/tiny_mce/3.4.9/utils/validate.js similarity index 100% rename from lib/editor/tinymce/tiny_mce/3.4.6/utils/validate.js rename to lib/editor/tinymce/tiny_mce/3.4.9/utils/validate.js diff --git a/lib/editor/tinymce/version.php b/lib/editor/tinymce/version.php index a7383bcba265c..318d64136a409 100644 --- a/lib/editor/tinymce/version.php +++ b/lib/editor/tinymce/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2012030300; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2011112900; // Requires this Moodle version $plugin->component = 'editor_tinymce'; // Full name of the plugin (used for diagnostics) -$plugin->release = '3.4.6'; +$plugin->release = '3.4.9'; diff --git a/lib/enrollib.php b/lib/enrollib.php index 62e791ae2e563..7fd29e68f08d0 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -476,8 +476,10 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) { $usersnode->trim_if_empty(); if ($course->id != SITEID) { - // Unenrol link - if (is_enrolled($coursecontext)) { + if (isguestuser() or !isloggedin()) { + // guest account can not be enrolled - no links for them + } else if (is_enrolled($coursecontext)) { + // unenrol link if possible foreach ($instances as $instance) { if (!isset($plugins[$instance->enrol])) { continue; @@ -491,6 +493,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) { } } } else { + // enrol link if possible if (is_viewing($coursecontext)) { // better not show any enrol link, this is intended for managers and inspectors } else { diff --git a/lib/eventslib.php b/lib/eventslib.php index 6ceaf5e0059dd..28374889be951 100644 --- a/lib/eventslib.php +++ b/lib/eventslib.php @@ -1,5 +1,4 @@ count_records_sql($sql, array($eventname)); -} +} \ No newline at end of file diff --git a/lib/excellib.class.php b/lib/excellib.class.php index 8b1262daa3518..44315ca08d9e2 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -143,8 +143,7 @@ function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) { // With $latin_output = false, it does not cope at all. // With $latin_output = true it is supposed to work, but in our experience, // it doesn't. Therefore, truncate in all circumstances. - $textlib = textlib_get_instance(); - $name = $textlib->substr($name, 0, 31); + $name = textlib::substr($name, 0, 31); } /// Internally, add one sheet to the workbook @@ -167,13 +166,11 @@ function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) { function write_string($row, $col, $str, $format=null) { /// Calculate the internal PEAR format $format = $this->MoodleExcelFormat2PearExcelFormat($format); - /// Loading the textlib singleton instance. We are going to need it. - $textlib = textlib_get_instance(); /// Convert the text from its original encoding to UTF-16LE if (!$this->latin_output) { /// Only if don't want to use latin (win1252) stronger output - $str = $textlib->convert($str, 'utf-8', 'utf-16le'); + $str = textlib::convert($str, 'utf-8', 'utf-16le'); } else { /// else, convert to latin (win1252) - $str = $textlib->convert($str, 'utf-8', 'windows-1252'); + $str = textlib::convert($str, 'utf-8', 'windows-1252'); } /// Add the string safely to the PEAR Worksheet $this->pear_excel_worksheet->writeString($row, $col, $str, $format); diff --git a/lib/filebrowser/file_browser.php b/lib/filebrowser/file_browser.php index 298811a0d084c..2b1a83d1d1d13 100644 --- a/lib/filebrowser/file_browser.php +++ b/lib/filebrowser/file_browser.php @@ -1,5 +1,4 @@ libdir/filebrowser/file_info_context_module.php"); /** - * This class provides the main entry point for other code wishing to get - * information about files. + * This class provides the main entry point for other code wishing to get information about files. * * The whole file storage for a Moodle site can be seen as a huge virtual tree. * The spine of the tree is the tree of contexts (system, course-categories, @@ -56,22 +53,23 @@ * * Always use this abstraction when you need to access module files from core code. * - * @package core - * @subpackage filebrowser - * @copyright 2008 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_files + * @category files + * @copyright 2008 Petr Skoda (http://skodak.org) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_browser { /** * Looks up file_info instance - * @param object $context - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return file_info instance or null if not found or access not allowed + * + * @param stdClass $context context object + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed */ public function get_file_info($context = NULL, $component = NULL, $filearea = NULL, $itemid = NULL, $filepath = NULL, $filename = NULL) { if (!$context) { @@ -95,12 +93,13 @@ public function get_file_info($context = NULL, $component = NULL, $filearea = NU /** * Returns info about the files at System context - * @param object $context - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename + * + * @param object $context context object + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name * @return file_info instance or null if not found or access not allowed */ private function get_file_info_context_system($context, $component, $filearea, $itemid, $filepath, $filename) { @@ -111,13 +110,14 @@ private function get_file_info_context_system($context, $component, $filearea, $ /** * Returns info about the files at User context - * @param object $context - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return file_info instance or null if not found or access not allowed + * + * @param stdClass $context context object + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed */ private function get_file_info_context_user($context, $component, $filearea, $itemid, $filepath, $filename) { global $DB, $USER; @@ -142,13 +142,14 @@ private function get_file_info_context_user($context, $component, $filearea, $it /** * Returns info about the files at Course category context - * @param object $context - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return file_info instance or null if not found or access not allowed + * + * @param stdClass $context context object + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed */ private function get_file_info_context_coursecat($context, $component, $filearea, $itemid, $filepath, $filename) { global $DB; @@ -163,13 +164,14 @@ private function get_file_info_context_coursecat($context, $component, $filearea /** * Returns info about the files at Course category context - * @param object $context - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return file_info instance or null if not found or access not allowed + * + * @param stdClass $context context object + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed */ private function get_file_info_context_course($context, $component, $filearea, $itemid, $filepath, $filename) { global $DB, $COURSE; @@ -186,13 +188,14 @@ private function get_file_info_context_course($context, $component, $filearea, $ /** * Returns info about the files at Course category context - * @param object $context - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return file_info instance or null if not found or access not allowed + * + * @param stdClass $context context object + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed */ private function get_file_info_context_module($context, $component, $filearea, $itemid, $filepath, $filename) { global $COURSE, $DB, $CFG; diff --git a/lib/filebrowser/file_info.php b/lib/filebrowser/file_info.php index 52ba8b1fc6af8..44069114762f9 100644 --- a/lib/filebrowser/file_info.php +++ b/lib/filebrowser/file_info.php @@ -1,5 +1,4 @@ browser = $browser; $this->context = $context; @@ -50,6 +55,7 @@ public function __construct($browser, $context) { * Returns list of standard virtual file/directory identification. * The difference from stored_file parameters is that null values * are allowed in all fields + * * @return array with keys contextid, component, filearea, itemid, filepath and filename */ public function get_params() { @@ -63,30 +69,35 @@ public function get_params() { /** * Returns localised visible name. + * * @return string */ public abstract function get_visible_name(); /** - * Is directory? + * Whether or not this is a directory + * * @return bool */ public abstract function is_directory(); /** * Returns list of children. + * * @return array of file_info instances */ public abstract function get_children(); /** * Returns parent file_info instance + * * @return file_info or null for root */ public abstract function get_parent(); /** * Returns array of url encoded params. + * * @return array with numeric keys */ public function get_params_rawencoded() { @@ -104,8 +115,9 @@ public function get_params_rawencoded() { /** * Returns file download url - * @param bool $forcedownload - * @param bool $htts force https + * + * @param bool $forcedownload whether or not force download + * @param bool $https whether or not force https * @return string url */ public function get_url($forcedownload=false, $https=false) { @@ -113,7 +125,8 @@ public function get_url($forcedownload=false, $https=false) { } /** - * Can I read content of this file or enter directory? + * Whether or not I can read content of this file or enter directory + * * @return bool */ public function is_readable() { @@ -121,7 +134,8 @@ public function is_readable() { } /** - * Can I add new files or directories? + * Whether or not new files or directories can be added + * * @return bool */ public function is_writable() { @@ -143,6 +157,7 @@ public function is_empty_area() { /** * Returns file size in bytes, null for directories + * * @return int bytes or null if not known */ public function get_filesize() { @@ -151,6 +166,7 @@ public function get_filesize() { /** * Returns mimetype + * * @return string mimetype or null if not known */ public function get_mimetype() { @@ -159,6 +175,7 @@ public function get_mimetype() { /** * Returns time created unix timestamp if known + * * @return int timestamp or null */ public function get_timecreated() { @@ -167,6 +184,7 @@ public function get_timecreated() { /** * Returns time modified unix timestamp if known + * * @return int timestamp or null */ public function get_timemodified() { @@ -183,6 +201,7 @@ public function get_license() { /** * Returns the author name of the file + * * @return string author name or null */ public function get_author() { @@ -191,6 +210,7 @@ public function get_author() { /** * Returns the source of the file + * * @return string a source url or null */ public function get_source() { @@ -199,6 +219,7 @@ public function get_source() { /** * Returns the sort order of the file + * * @return int */ public function get_sortorder() { @@ -208,8 +229,9 @@ public function get_sortorder() { /** * Create new directory, may throw exception - make sure * params are valid. + * * @param string $newdirname name of new directory - * @param int id of author, default $USER->id + * @param int $userid id of author, default $USER->id * @return file_info new directory */ public function create_directory($newdirname, $userid = NULL) { @@ -219,9 +241,10 @@ public function create_directory($newdirname, $userid = NULL) { /** * Create new file from string - make sure * params are valid. + * * @param string $newfilename name of new file * @param string $content of file - * @param int id of author, default $USER->id + * @param int $userid id of author, default $USER->id * @return file_info new file */ public function create_file_from_string($newfilename, $content, $userid = NULL) { @@ -231,9 +254,10 @@ public function create_file_from_string($newfilename, $content, $userid = NULL) /** * Create new file from pathname - make sure * params are valid. + * * @param string $newfilename name of new file * @param string $pathname location of file - * @param int id of author, default $USER->id + * @param int $userid id of author, default $USER->id * @return file_info new file */ public function create_file_from_pathname($newfilename, $pathname, $userid = NULL) { @@ -243,9 +267,10 @@ public function create_file_from_pathname($newfilename, $pathname, $userid = NUL /** * Create new file from stored file - make sure * params are valid. + * * @param string $newfilename name of new file - * @param mixed dile id or stored_file of file - * @param int id of author, default $USER->id + * @param int|stored_file $fid id or stored_file of file + * @param int $userid id of author, default $USER->id * @return file_info new file */ public function create_file_from_storedfile($newfilename, $fid, $userid = NULL) { @@ -254,6 +279,7 @@ public function create_file_from_storedfile($newfilename, $fid, $userid = NULL) /** * Delete file, make sure file is deletable first. + * * @return bool success */ public function delete() { @@ -262,12 +288,13 @@ public function delete() { /** * Copy content of this file to local storage, overriding current file if needed. - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename + * + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name * @return boolean success */ public function copy_to_storage($contextid, $component, $filearea, $itemid, $filepath, $filename) { @@ -276,6 +303,8 @@ public function copy_to_storage($contextid, $component, $filearea, $itemid, $fil /** * Copy content of this file to local storage, overriding current file if needed. + * + * @todo MDL-31068 implement move() rename() unzip() zip() * @param string $pathname real local full file name * @return boolean success */ diff --git a/lib/filebrowser/file_info_context_course.php b/lib/filebrowser/file_info_context_course.php index 14f5283f380cd..658daa5e41c03 100644 --- a/lib/filebrowser/file_info_context_course.php +++ b/lib/filebrowser/file_info_context_course.php @@ -1,5 +1,4 @@ course = $course; @@ -46,11 +51,12 @@ public function __construct($browser, $context, $course) { /** * Return information about this specific context level * - * @param $component - * @param $filearea - * @param $itemid - * @param $filepath - * @param $filename + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed */ public function get_file_info($component, $filearea, $itemid, $filepath, $filename) { // try to emulate require_login() tests here @@ -80,6 +86,14 @@ public function get_file_info($component, $filearea, $itemid, $filepath, $filena return null; } + /** + * Gets a stored file for the course summary filearea directory + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed + */ protected function get_area_course_summary($itemid, $filepath, $filename) { global $CFG; @@ -106,7 +120,14 @@ protected function get_area_course_summary($itemid, $filepath, $filename) { return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, get_string('areacourseintro', 'repository'), false, true, true, false); } - + /** + * Gets a stored file for the course section filearea directory + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed + */ protected function get_area_course_section($itemid, $filepath, $filename) { global $CFG, $DB; @@ -139,7 +160,14 @@ protected function get_area_course_section($itemid, $filepath, $filename) { return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, $section->section, true, true, true, false); } - + /** + * Gets a stored file for the course legacy filearea directory + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed + */ protected function get_area_course_legacy($itemid, $filepath, $filename) { if (!has_capability('moodle/course:managefiles', $this->context)) { return null; @@ -169,6 +197,14 @@ protected function get_area_course_legacy($itemid, $filepath, $filename) { return new file_info_area_course_legacy($this->browser, $this->context, $storedfile); } + /** + * Gets a stored file for the backup course filearea directory + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed + */ protected function get_area_backup_course($itemid, $filepath, $filename) { global $CFG; @@ -202,10 +238,10 @@ protected function get_area_backup_course($itemid, $filepath, $filename) { /** * Gets a stored file for the automated backup filearea directory * - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return file_info_context_course + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null */ protected function get_area_backup_automated($itemid, $filepath, $filename) { global $CFG; @@ -237,6 +273,14 @@ protected function get_area_backup_automated($itemid, $filepath, $filename) { return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, get_string('automatedbackup', 'repository'), true, $downloadable, $uploadable, false); } + /** + * Gets a stored file for the backup section filearea directory + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null file_info instance or null if not found or access not allowed + */ protected function get_area_backup_section($itemid, $filepath, $filename) { global $CFG, $DB; @@ -273,12 +317,18 @@ protected function get_area_backup_section($itemid, $filepath, $filename) { return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, $section->id, true, $downloadable, $uploadable, false); } + /** + * Returns localised visible name. + * + * @return string + */ public function get_visible_name() { return ($this->course->id == SITEID) ? get_string('frontpage', 'admin') : format_string($this->course->fullname, true, array('context'=>$this->context)); } /** - * Can I add new files or directories? + * Whether or not new files or directories can be added + * * @return bool */ public function is_writable() { @@ -286,7 +336,8 @@ public function is_writable() { } /** - * Is directory? + * Whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -295,6 +346,7 @@ public function is_directory() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -336,6 +388,8 @@ public function get_children() { /** * Returns parent file_info instance + * + * @todo error checking if get_parent_contextid() returns false * @return file_info or null for root */ public function get_parent() { @@ -350,12 +404,18 @@ public function get_parent() { /** * Subclass of file_info_stored for files in the course files area. * - * @package core - * @subpackage filebrowser - * @copyright 2008 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_files + * @copyright 2008 Petr Skoda (http://skodak.org) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_info_area_course_legacy extends file_info_stored { + /** + * Constructor + * + * @param file_browser $browser file browser instance + * @param stdClass $context context object + * @param stored_file $storedfile stored_file instance + */ public function __construct($browser, $context, $storedfile) { global $CFG; $urlbase = $CFG->wwwroot.'/file.php'; @@ -364,8 +424,9 @@ public function __construct($browser, $context, $storedfile) { /** * Returns file download url - * @param bool $forcedownload - * @param bool $htts force https + * + * @param bool $forcedownload whether or not force download + * @param bool $https whether or not force https * @return string url */ public function get_url($forcedownload=false, $https=false) { @@ -388,6 +449,7 @@ public function get_url($forcedownload=false, $https=false) { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -408,17 +470,26 @@ public function get_children() { } /** - * Represents a course category context in the tree navigated by @see{file_browser}. + * Represents a course category context in the tree navigated by {@link file_browser}. * - * @package core - * @subpackage filebrowser + * @package core_files * @copyright 2008 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_info_area_course_section extends file_info { + /** @var stdClass course object */ protected $course; + /** @var file_info_context_course course file info object */ protected $courseinfo; + /** + * Constructor + * + * @param file_browser $browser file browser instance + * @param stdClass $context context object + * @param stdClass $course course object + * @param file_info_context_course $courseinfo file info instance + */ public function __construct($browser, $context, $course, file_info_context_course $courseinfo) { parent::__construct($browser, $context); $this->course = $course; @@ -429,6 +500,7 @@ public function __construct($browser, $context, $course, file_info_context_cours * Returns list of standard virtual file/directory identification. * The difference from stored_file parameters is that null values * are allowed in all fields + * * @return array with keys contextid, filearea, itemid, filepath and filename */ public function get_params() { @@ -442,6 +514,7 @@ public function get_params() { /** * Returns localised visible name. + * * @return string */ public function get_visible_name() { @@ -452,7 +525,8 @@ public function get_visible_name() { } /** - * Can I add new files or directories? + * Return whether or not new files or directories can be added + * * @return bool */ public function is_writable() { @@ -460,7 +534,7 @@ public function is_writable() { } /** - * Is this empty area? + * Return whether or not this is a empty area * * @return bool */ @@ -470,7 +544,8 @@ public function is_empty_area() { } /** - * Is directory? + * Return whether or not this is a empty area + * * @return bool */ public function is_directory() { @@ -479,6 +554,7 @@ public function is_directory() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -498,7 +574,8 @@ public function get_children() { /** * Returns parent file_info instance - * @return file_info or null for root + * + * @return file_info|null file_info or null for root */ public function get_parent() { return $this->courseinfo; @@ -509,15 +586,24 @@ public function get_parent() { /** * Implementation of course section backup area * - * @package core - * @subpackage filebrowser + * @package core_files * @copyright 2008 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_info_area_backup_section extends file_info { + /** @var stdClass course object */ protected $course; + /** @var file_info_context_course course file info object */ protected $courseinfo; + /** + * Constructor + * + * @param file_browser $browser file browser instance + * @param stdClass $context context object + * @param stdClass $course course object + * @param file_info_context_course $courseinfo file info instance + */ public function __construct($browser, $context, $course, file_info_context_course $courseinfo) { parent::__construct($browser, $context); $this->course = $course; @@ -528,6 +614,7 @@ public function __construct($browser, $context, $course, file_info_context_cours * Returns list of standard virtual file/directory identification. * The difference from stored_file parameters is that null values * are allowed in all fields + * * @return array with keys contextid, component, filearea, itemid, filepath and filename */ public function get_params() { @@ -541,6 +628,7 @@ public function get_params() { /** * Returns localised visible name. + * * @return string */ public function get_visible_name() { @@ -548,7 +636,8 @@ public function get_visible_name() { } /** - * Can I add new files or directories? + * Return whether or not new files and directories can be added + * * @return bool */ public function is_writable() { @@ -556,7 +645,7 @@ public function is_writable() { } /** - * Is this empty area? + * Whether or not this is an empty area * * @return bool */ @@ -566,7 +655,8 @@ public function is_empty_area() { } /** - * Is directory? + * Return whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -575,6 +665,7 @@ public function is_directory() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -594,11 +685,10 @@ public function get_children() { /** * Returns parent file_info instance + * * @return file_info or null for root */ public function get_parent() { return $this->browser->get_file_info($this->context); } } - - diff --git a/lib/filebrowser/file_info_context_coursecat.php b/lib/filebrowser/file_info_context_coursecat.php index 044c1eee9125c..99b6d1fc2406c 100644 --- a/lib/filebrowser/file_info_context_coursecat.php +++ b/lib/filebrowser/file_info_context_coursecat.php @@ -1,5 +1,4 @@ category = $category; @@ -46,11 +51,12 @@ public function __construct($browser, $context, $category) { /** * Return information about this specific context level * - * @param $component - * @param $filearea - * @param $itemid - * @param $filepath - * @param $filename + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return fileinfo|null */ public function get_file_info($component, $filearea, $itemid, $filepath, $filename) { global $DB; @@ -80,6 +86,14 @@ public function get_file_info($component, $filearea, $itemid, $filepath, $filena return null; } + /** + * Return a file from course category description area + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return fileinfo|null + */ protected function get_area_coursecat_description($itemid, $filepath, $filename) { global $CFG; @@ -110,6 +124,7 @@ protected function get_area_coursecat_description($itemid, $filepath, $filename) /** * Returns localised visible name. + * * @return string */ public function get_visible_name() { @@ -117,7 +132,8 @@ public function get_visible_name() { } /** - * Can I add new files or directories? + * Whether or not new files or directories can be added + * * @return bool */ public function is_writable() { @@ -125,7 +141,8 @@ public function is_writable() { } /** - * Is directory? + * Whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -134,6 +151,7 @@ public function is_directory() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -172,7 +190,8 @@ public function get_children() { /** * Returns parent file_info instance - * @return file_info or null for root + * + * @return file_info|null fileinfo instance or null for root directory */ public function get_parent() { $cid = get_parent_contextid($this->context); diff --git a/lib/filebrowser/file_info_context_module.php b/lib/filebrowser/file_info_context_module.php index a8149c677ac94..0357ee34cde17 100644 --- a/lib/filebrowser/file_info_context_module.php +++ b/lib/filebrowser/file_info_context_module.php @@ -1,5 +1,4 @@ browser, $this->context, $storedfile, $urlbase, get_string('moduleintro'), false, true, true, false); } + /** + * Get a file from module backup area + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null + */ protected function get_area_backup($itemid, $filepath, $filename) { global $CFG; @@ -172,6 +199,7 @@ protected function get_area_backup($itemid, $filepath, $filename) { /** * Returns localised visible name. + * * @return string */ public function get_visible_name() { @@ -179,7 +207,8 @@ public function get_visible_name() { } /** - * Can I add new files or directories? + * Whether or not files or directories can be added + * * @return bool */ public function is_writable() { @@ -187,7 +216,7 @@ public function is_writable() { } /** - * Is this empty area? + * Whether or not this is an emtpy area * * @return bool */ @@ -215,7 +244,8 @@ public function is_empty_area() { } /** - * Is directory? + * Whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -224,6 +254,7 @@ public function is_directory() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -247,7 +278,8 @@ public function get_children() { /** * Returns parent file_info instance - * @return file_info or null for root + * + * @return file_info|null file_info or null for root */ public function get_parent() { $pcid = get_parent_contextid($this->context); diff --git a/lib/filebrowser/file_info_context_system.php b/lib/filebrowser/file_info_context_system.php index a3908ef755bef..c7583735eaa76 100644 --- a/lib/filebrowser/file_info_context_system.php +++ b/lib/filebrowser/file_info_context_system.php @@ -1,5 +1,4 @@ user = $user; @@ -46,11 +51,12 @@ public function __construct($browser, $context, $user) { /** * Return information about this specific context level * - * @param $component - * @param $filearea - * @param $itemid - * @param $filepath - * @param $filename + * @param string $component componet + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null */ public function get_file_info($component, $filearea, $itemid, $filepath, $filename) { global $USER; @@ -76,6 +82,15 @@ public function get_file_info($component, $filearea, $itemid, $filepath, $filena return null; } + /** + * Get a file from user private area + * + * @todo MDL-31070 this method should respect $CFG->userquota + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null + */ protected function get_area_user_private($itemid, $filepath, $filename) { global $USER, $CFG; @@ -110,6 +125,14 @@ protected function get_area_user_private($itemid, $filepath, $filename) { return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, get_string('areauserpersonal', 'repository'), false, true, true, false); } + /** + * Get a file from user profile area + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null + */ protected function get_area_user_profile($itemid, $filepath, $filename) { global $CFG; @@ -140,10 +163,18 @@ protected function get_area_user_profile($itemid, $filepath, $filename) { } } $urlbase = $CFG->wwwroot.'/pluginfile.php'; - return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, + return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, get_string('areauserprofile', 'repository'), false, $readaccess, $writeaccess, false); } + /** + * Get a file from user draft area + * + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null + */ protected function get_area_user_draft($itemid, $filepath, $filename) { global $USER, $CFG; @@ -174,6 +205,15 @@ protected function get_area_user_draft($itemid, $filepath, $filename) { return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, get_string('areauserdraft', 'repository'), true, true, true, true); } + /** + * Get a file from user backup area + * + * @todo MDL-31091 maybe we need new caability for access control + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info|null + */ protected function get_area_user_backup($itemid, $filepath, $filename) { global $USER, $CFG; @@ -206,6 +246,7 @@ protected function get_area_user_backup($itemid, $filepath, $filename) { /** * Returns localised visible name. + * * @return string */ public function get_visible_name() { @@ -213,7 +254,8 @@ public function get_visible_name() { } /** - * Can I add new files or directories? + * Whether or not new files or directories can be added + * * @return bool */ public function is_writable() { @@ -221,7 +263,8 @@ public function is_writable() { } /** - * Is directory? + * Whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -230,6 +273,7 @@ public function is_directory() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -253,7 +297,8 @@ public function get_children() { /** * Returns parent file_info instance - * @return file_info or null for root + * + * @return file_info|null file_info instance or null for root */ public function get_parent() { return $this->browser->get_file_info(); diff --git a/lib/filebrowser/file_info_stored.php b/lib/filebrowser/file_info_stored.php index 104511948c933..787787ee6a068 100644 --- a/lib/filebrowser/file_info_stored.php +++ b/lib/filebrowser/file_info_stored.php @@ -1,5 +1,4 @@ wwwroot/.'pluginfile.php' * @param string $topvisiblename the human readable name of this area * @param int|bool $itemidused false if itemid always 0 and not included in URL @@ -74,6 +77,7 @@ public function __construct(file_browser $browser, $context, $storedfile, $urlba * Returns list of standard virtual file/directory identification. * The difference from stored_file parameters is that null values * are allowed in all fields + * * @return array with keys contextid, component, filearea, itemid, filepath and filename */ public function get_params() { @@ -87,6 +91,7 @@ public function get_params() { /** * Returns localised visible name. + * * @return string */ public function get_visible_name() { @@ -110,8 +115,9 @@ public function get_visible_name() { /** * Returns file download url - * @param bool $forcedownload - * @param bool $htts force https + * + * @param bool $forcedownload Whether or not force download + * @param bool $https whether or not force https * @return string url */ public function get_url($forcedownload=false, $https=false) { @@ -140,7 +146,8 @@ public function get_url($forcedownload=false, $https=false) { } /** - * Can I read content of this file or enter directory? + * Whether or not I can read content of this file or enter directory + * * @return bool */ public function is_readable() { @@ -148,7 +155,8 @@ public function is_readable() { } /** - * Can I add new files or directories? + * Whether or not new files or directories can be added + * * @return bool */ public function is_writable() { @@ -156,7 +164,7 @@ public function is_writable() { } /** - * Is this top of empty area? + * Whether or not this is an empty area * * @return bool */ @@ -172,6 +180,7 @@ public function is_empty_area() { /** * Returns file size in bytes, null for directories + * * @return int bytes or null if not known */ public function get_filesize() { @@ -180,6 +189,7 @@ public function get_filesize() { /** * Returns mimetype + * * @return string mimetype or null if not known */ public function get_mimetype() { @@ -188,6 +198,7 @@ public function get_mimetype() { /** * Returns time created unix timestamp if known + * * @return int timestamp or null */ public function get_timecreated() { @@ -196,6 +207,7 @@ public function get_timecreated() { /** * Returns time modified unix timestamp if known + * * @return int timestamp or null */ public function get_timemodified() { @@ -203,7 +215,8 @@ public function get_timemodified() { } /** - * Is directory? + * Whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -212,6 +225,7 @@ public function is_directory() { /** * Returns the license type of the file + * * @return string license short name or null */ public function get_license() { @@ -220,6 +234,7 @@ public function get_license() { /** * Returns the author name of the file + * * @return string author name or null */ public function get_author() { @@ -228,6 +243,7 @@ public function get_author() { /** * Returns the source of the file + * * @return string a source url or null */ public function get_source() { @@ -236,6 +252,7 @@ public function get_source() { /** * Returns the sort order of the file + * * @return int */ public function get_sortorder() { @@ -244,6 +261,7 @@ public function get_sortorder() { /** * Returns list of children. + * * @return array of file_info instances */ public function get_children() { @@ -266,7 +284,8 @@ public function get_children() { /** * Returns parent file_info instance - * @return file_info or null for root + * + * @return file_info|null file_info instance or null for root */ public function get_parent() { if ($this->lf->get_filepath() === '/' and $this->lf->is_directory()) { @@ -296,9 +315,10 @@ public function get_parent() { /** * Create new directory, may throw exception - make sure * params are valid. + * * @param string $newdirname name of new directory - * @param int id of author, default $USER->id - * @return file_info new directory + * @param int $userid id of author, default $USER->id + * @return file_info|null new directory's file_info instance or null if failed */ public function create_directory($newdirname, $userid = NULL) { if (!$this->is_writable() or !$this->lf->is_directory()) { @@ -324,10 +344,11 @@ public function create_directory($newdirname, $userid = NULL) { /** * Create new file from string - make sure * params are valid. + * * @param string $newfilename name of new file * @param string $content of file - * @param int id of author, default $USER->id - * @return file_info new file + * @param int $userid id of author, default $USER->id + * @return file_info|null new file's file_info instance or null if failed */ public function create_file_from_string($newfilename, $content, $userid = NULL) { if (!$this->is_writable() or !$this->lf->is_directory()) { @@ -370,10 +391,11 @@ public function create_file_from_string($newfilename, $content, $userid = NULL) /** * Create new file from pathname - make sure * params are valid. + * * @param string $newfilename name of new file * @param string $pathname location of file - * @param int id of author, default $USER->id - * @return file_info new file + * @param int $userid id of author, default $USER->id + * @return file_info|null new file's file_info instance or null if failed */ public function create_file_from_pathname($newfilename, $pathname, $userid = NULL) { if (!$this->is_writable() or !$this->lf->is_directory()) { @@ -416,10 +438,11 @@ public function create_file_from_pathname($newfilename, $pathname, $userid = NUL /** * Create new file from stored file - make sure * params are valid. + * * @param string $newfilename name of new file - * @param mixed file id or stored_file of file - * @param int id of author, default $USER->id - * @return file_info new file + * @param int|stored_file $fid file id or stored_file of file + * @param int $userid id of author, default $USER->id + * @return file_info|null new file's file_info instance or null if failed */ public function create_file_from_storedfile($newfilename, $fid, $userid = NULL) { if (!$this->is_writable() or $this->lf->get_filename() !== '.') { @@ -461,6 +484,7 @@ public function create_file_from_storedfile($newfilename, $fid, $userid = NULL) /** * Delete file, make sure file is deletable first. + * * @return bool success */ public function delete() { @@ -484,12 +508,14 @@ public function delete() { /** * Copy content of this file to local storage, overriding current file if needed. - * @param int $contextid - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return boolean success + * + * @param int $contextid context ID + * @param string $component file component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return bool success */ public function copy_to_storage($contextid, $component, $filearea, $itemid, $filepath, $filename) { if (!$this->is_readable() or $this->is_directory()) { @@ -508,8 +534,9 @@ public function copy_to_storage($contextid, $component, $filearea, $itemid, $fil /** * Copy content of this file to local storage, overriding current file if needed. + * * @param string $pathname real local full file name - * @return boolean success + * @return bool success */ public function copy_to_pathname($pathname) { if (!$this->is_readable() or $this->is_directory()) { diff --git a/lib/filebrowser/virtual_root_file.php b/lib/filebrowser/virtual_root_file.php index 6170d6727f633..f8187d20c2484 100644 --- a/lib/filebrowser/virtual_root_file.php +++ b/lib/filebrowser/virtual_root_file.php @@ -1,5 +1,4 @@ contextid = $contextid; @@ -53,7 +58,8 @@ public function __construct($contextid, $component, $filearea, $itemid) { } /** - * Is this a directory? + * Whether or not this is a directory + * * @return bool */ public function is_directory() { @@ -62,6 +68,7 @@ public function is_directory() { /** * Delete file + * * @return success */ public function delete() { @@ -80,7 +87,8 @@ public function add_to_curl_request(&$curlrequest, $key) { /** * Returns file handle - read only mode, no writing allowed into pool files! - * @return file handle + * + * @return resource file handle */ public function get_content_file_handle() { return null; @@ -88,7 +96,8 @@ public function get_content_file_handle() { /** * Dumps file content to page - * @return file handle + * + * @return resource file handle */ public function readfile() { return; @@ -96,6 +105,7 @@ public function readfile() { /** * Returns file content as string + * * @return string content */ public function get_content() { @@ -104,6 +114,7 @@ public function get_content() { /** * Copy content of file to given pathname + * * @param string $pathname real path to new file * @return bool success */ @@ -113,7 +124,8 @@ public function copy_content_to($pathname) { /** * List contents of archive - * @param object $file_packer + * + * @param file_packer $packer file packer instance * @return array of file infos */ public function list_files(file_packer $packer) { @@ -122,7 +134,8 @@ public function list_files(file_packer $packer) { /** * Extract file to given file path (real OS filesystem), existing files are overwrited - * @param object $file_packer + * + * @param file_packer $packer file packer instance * @param string $pathname target directory * @return mixed list of processed files; false if error */ @@ -132,13 +145,14 @@ public function extract_to_pathname(file_packer $packer, $pathname) { /** * Extract file to given file path (real OS filesystem), existing files are overwrited - * @param object $file_packer - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $pathbase - * @param int $userid + * + * @param file_packer $packer file packer instance + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $pathbase path base + * @param int $userid user ID * @return mixed list of processed files; false if error */ public function extract_to_storage(file_packer $packer, $contextid, $component, $filearea, $itemid, $pathbase, $userid = NULL) { @@ -147,7 +161,8 @@ public function extract_to_storage(file_packer $packer, $contextid, $component, /** * Add file/directory into archive - * @param object $filearch + * + * @param file_archive $filearch file archive instance * @param string $archivepath pathname in archive * @return bool success */ @@ -157,84 +172,180 @@ public function archive_file(file_archive $filearch, $archivepath) { /** * Returns parent directory - * @return object stored_file + * + * @return stored_file */ public function get_parent_directory() { return null; } + /** + * Returns context ID + * + * @return int context ID + */ public function get_contextid() { return $this->contextid; } + /** + * Returns file component + * + * @return string component + */ public function get_component() { return $this->component; } + /** + * Returns file area + * + * @return string filearea + */ public function get_filearea() { return $this->filearea; } + /** + * Returns file itemid + * + * @return int itemid + */ public function get_itemid() { return $this->itemid; } + /** + * Returns file path + * + * @return string filepath + */ public function get_filepath() { return '/'; } + /** + * Returns file name + * + * @return string filename + */ public function get_filename() { return '.'; } + /** + * Returns user ID + * + * @return int userid + */ public function get_userid() { return null; } + /** + * Returns file size + * + * @return int filesize + */ public function get_filesize() { return 0; } + /** + * Returns mimetype + * + * @return string mimetype + */ public function get_mimetype() { return null; } + /** + * Returns time created + * + * @return int + */ public function get_timecreated() { return 0; } + /** + * Returns time modified + * + * @return int + */ public function get_timemodified() { return 0; } + /** + * Returns status + * + * @return int + */ public function get_status() { return 0; } + /** + * Returns ID + * + * @return int + */ public function get_id() { return 0; } + /** + * Returns sha1 hash code + * + * @return string + */ public function get_contenthash() { return sha1(''); } + /** + * Returns path name hash + * + * @return string + */ public function get_pathnamehash() { return sha1('/'.$this->get_contextid().'/'.$this->get_component().'/'.$this->get_filearea().'/'.$this->get_itemid().$this->get_filepath().$this->get_filename()); } + /** + * Returns license + * + * @return string + */ public function get_license() { return null; } + /** + * Returns file's author + * + * @return string + */ public function get_author() { return null; } + /** + * Returns file source + * + * @return string + */ public function get_source() { return null; } + /** + * Returns file sort order + * + * @return int + */ public function get_sortorder() { return null; } diff --git a/lib/filelib.php b/lib/filelib.php index 1c3ddf3c8cdcf..43bc8ddd24263 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1,5 +1,4 @@ libdir/filestorage/file_exceptions.php"); @@ -39,7 +39,8 @@ * * @deprecated use moodle_url factory methods instead * - * @global object + * @todo MDL-31071 deprecate this function + * @global stdClass $CFG * @param string $urlbase * @param string $path /filearea/itemid/dir/dir/file.exe * @param bool $forcedownload @@ -84,14 +85,15 @@ function file_encode_url($urlbase, $path, $forcedownload=false, $https=false) { * In your mform definition, you must have an 'editor' element called foobar_editor. Then you call * your mform's set_data() supplying the object returned by this function. * - * @param object $data database field that holds the html text with embedded media + * @category files + * @param stdClass $data database field that holds the html text with embedded media * @param string $field the name of the database field that holds the html text with embedded media * @param array $options editor options (like maxifiles, maxbytes etc.) - * @param object $context context of the editor + * @param stdClass $context context of the editor * @param string $component * @param string $filearea file area name * @param int $itemid item id, required if item exists - * @return object modified data object + * @return stdClass modified data object */ function file_prepare_standard_editor($data, $field, array $options, $context=null, $component=null, $filearea=null, $itemid=null) { $options = (array)$options; @@ -178,14 +180,15 @@ function file_prepare_standard_editor($data, $field, array $options, $context=nu * function automatically adds $data properties foobar, foobarformat and * foobartrust, where foobar has URL to embedded files encoded. * - * @param object $data raw data submitted by the form + * @category files + * @param stdClass $data raw data submitted by the form * @param string $field name of the database field containing the html with embedded media files * @param array $options editor options (trusttext, subdirs, maxfiles, maxbytes etc.) - * @param object $context context, required for existing data - * @param string component + * @param stdClass $context context, required for existing data + * @param string $component file component * @param string $filearea file area name * @param int $itemid item id, required if item exists - * @return object modified data object + * @return stdClass modified data object */ function file_postupdate_standard_editor($data, $field, array $options, $context, $component=null, $filearea=null, $itemid=null) { $options = (array)$options; @@ -226,14 +229,15 @@ function file_postupdate_standard_editor($data, $field, array $options, $context /** * Saves text and files modified by Editor formslib element * - * @param object $data $database entry field + * @category files + * @param stdClass $data $database entry field * @param string $field name of data field * @param array $options various options - * @param object $context context - must already exist + * @param stdClass $context context - must already exist * @param string $component * @param string $filearea file area name * @param int $itemid must already exist, usually means data is in db - * @return object modified data obejct + * @return stdClass modified data obejct */ function file_prepare_standard_filemanager($data, $field, array $options, $context=null, $component=null, $filearea=null, $itemid=null) { $options = (array)$options; @@ -257,14 +261,16 @@ function file_prepare_standard_filemanager($data, $field, array $options, $conte /** * Saves files modified by File manager formslib element * - * @param object $data $database entry field + * @todo MDL-31073 review this function + * @category files + * @param stdClass $data $database entry field * @param string $field name of data field * @param array $options various options - * @param object $context context - must already exist + * @param stdClass $context context - must already exist * @param string $component * @param string $filearea file area name * @param int $itemid must already exist, usually means data is in db - * @return object modified data obejct + * @return stdClass modified data obejct */ function file_postupdate_standard_filemanager($data, $field, array $options, $context, $component, $filearea, $itemid) { $options = (array)$options; @@ -296,9 +302,11 @@ function file_postupdate_standard_filemanager($data, $field, array $options, $co } /** + * Generate a draft itemid * - * @global object - * @global object + * @category files + * @global moodle_database $DB + * @global stdClass $USER * @return int a random but available draft itemid that can be used to create a new draft * file area. */ @@ -326,16 +334,17 @@ function file_get_unused_draft_itemid() { * area will be created if one does not already exist. Normally you should * get $draftitemid by calling file_get_submitted_draft_itemid('elementname'); * - * @global object - * @global object - * @param int &$draftitemid the id of the draft area to use, or 0 to create a new one, in which case this parameter is updated. - * @param integer $contextid This parameter and the next two identify the file area to copy files from. + * @category files + * @global stdClass $CFG + * @global stdClass $USER + * @param int $draftitemid the id of the draft area to use, or 0 to create a new one, in which case this parameter is updated. + * @param int $contextid This parameter and the next two identify the file area to copy files from. * @param string $component * @param string $filearea helps indentify the file area. - * @param integer $itemid helps identify the file area. Can be null if there are no files yet. + * @param int $itemid helps identify the file area. Can be null if there are no files yet. * @param array $options text and file options ('subdirs'=>false, 'forcehttps'=>false) * @param string $text some html content that needs to have embedded links rewritten to point to the draft area. - * @return string if $text was passed in, the rewritten $text is returned. Otherwise NULL. + * @return string|null returns string if $text was passed in, the rewritten $text is returned. Otherwise NULL. */ function file_prepare_draft_area(&$draftitemid, $contextid, $component, $filearea, $itemid, array $options=null, $text=null) { global $CFG, $USER, $CFG; @@ -389,13 +398,14 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $component, $fileare /** * Convert encoded URLs in $text from the @@PLUGINFILE@@/... form to an actual URL. * - * @global object + * @category files + * @global stdClass $CFG * @param string $text The content that may contain ULRs in need of rewriting. * @param string $file The script that should be used to serve these files. pluginfile.php, draftfile.php, etc. - * @param integer $contextid This parameter and the next two identify the file area to use. + * @param int $contextid This parameter and the next two identify the file area to use. * @param string $component * @param string $filearea helps identify the file area. - * @param integer $itemid helps identify the file area. + * @param int $itemid helps identify the file area. * @param array $options text and file options ('forcehttps'=>false) * @return string the processed text. */ @@ -427,9 +437,9 @@ function file_rewrite_pluginfile_urls($text, $file, $contextid, $component, $fil /** * Returns information about files in a draft area. * - * @global object - * @global object - * @param integer $draftitemid the draft area item id. + * @global stdClass $CFG + * @global stdClass $USER + * @param int $draftitemid the draft area item id. * @return array with the following entries: * 'filecount' => number of files in the draft area. * (more information will be added as needed). @@ -455,6 +465,8 @@ function file_get_draft_area_info($draftitemid) { /** * Get used space of files + * @global moodle_database $DB + * @global stdClass $USER * @return int total bytes */ function file_get_user_used_space() { @@ -473,6 +485,7 @@ function file_get_user_used_space() { /** * Convert any string to a valid filepath + * @todo review this function * @param string $str * @return string path */ @@ -486,9 +499,11 @@ function file_correct_filepath($str) { //TODO: what is this? (skodak) /** * Generate a folder tree of draft area of current USER recursively - * @param int $itemid + * + * @todo MDL-31073 use normal return value instead, this does not fit the rest of api here (skodak) + * @param int $draftitemid * @param string $filepath - * @param mixed $data //TODO: use normal return value instead, this does not fit the rest of api here (skodak) + * @param mixed $data */ function file_get_drafarea_folders($draftitemid, $filepath, &$data) { global $USER, $OUTPUT, $CFG; @@ -520,7 +535,7 @@ function file_get_drafarea_folders($draftitemid, $filepath, &$data) { * used by file manager * @param int $draftitemid * @param string $filepath - * @return mixed + * @return stdClass */ function file_get_drafarea_files($draftitemid, $filepath = '/') { global $USER, $OUTPUT, $CFG; @@ -587,8 +602,9 @@ function file_get_drafarea_files($draftitemid, $filepath = '/') { /** * Returns draft area itemid for a given element. * + * @category files * @param string $elname name of formlib editor element, or a hidden form field that stores the draft area item id, etc. - * @return integer the itemid, or 0 if there is not one yet. + * @return int the itemid, or 0 if there is not one yet. */ function file_get_submitted_draft_itemid($elname) { // this is a nasty hack, ideally all new elements should use arrays here or there should be a new parameter @@ -619,19 +635,19 @@ function file_get_submitted_draft_itemid($elname) { * Saves files from a draft file area to a real one (merging the list of files). * Can rewrite URLs in some content at the same time if desired. * - * @global object - * @global object - * @param integer $draftitemid the id of the draft area to use. Normally obtained + * @category files + * @global stdClass $USER + * @param int $draftitemid the id of the draft area to use. Normally obtained * from file_get_submitted_draft_itemid('elementname') or similar. - * @param integer $contextid This parameter and the next two identify the file area to save to. + * @param int $contextid This parameter and the next two identify the file area to save to. * @param string $component * @param string $filearea indentifies the file area. - * @param integer $itemid helps identifies the file area. + * @param int $itemid helps identifies the file area. * @param array $options area options (subdirs=>false, maxfiles=-1, maxbytes=0) * @param string $text some html content that needs to have embedded links rewritten * to the @@PLUGINFILE@@ form for saving in the database. - * @param boolean $forcehttps force https urls. - * @return string if $text was passed in, the rewritten $text is returned. Otherwise NULL. + * @param bool $forcehttps force https urls. + * @return string|null if $text was passed in, the rewritten $text is returned. Otherwise NULL. */ function file_save_draft_area_files($draftitemid, $contextid, $component, $filearea, $itemid, array $options=null, $text=null, $forcehttps=false) { global $USER; @@ -752,6 +768,8 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea * Convert the draft file area URLs in some content to @@PLUGINFILE@@ tokens * ready to be saved in the database. Normally, this is done automatically by * {@link file_save_draft_area_files()}. + * + * @category files * @param string $text the content to process. * @param int $draftitemid the draft file area the content was using. * @param bool $forcehttps whether the content contains https URLs. Default false. @@ -787,15 +805,16 @@ function file_rewrite_urls_to_pluginfile($text, $draftitemid, $forcehttps = fals /** * Set file sort order - * @global object $DB - * @param integer $contextid the context id - * @param string $component + * + * @global moodle_database $DB + * @param int $contextid the context id + * @param string $component file component * @param string $filearea file area. - * @param integer $itemid itemid. + * @param int $itemid itemid. * @param string $filepath file path. * @param string $filename file name. - * @param integer $sortorer the sort order of file. - * @return boolean + * @param int $sortorder the sort order of file. + * @return bool */ function file_set_sortorder($contextid, $component, $filearea, $itemid, $filepath, $filename, $sortorder) { global $DB; @@ -811,12 +830,12 @@ function file_set_sortorder($contextid, $component, $filearea, $itemid, $filepat /** * reset file sort order number to 0 - * @global object $DB - * @param integer $contextid the context id + * @global moodle_database $DB + * @param int $contextid the context id * @param string $component * @param string $filearea file area. - * @param integer $itemid itemid. - * @return boolean + * @param int|bool $itemid itemid. + * @return bool */ function file_reset_sortorder($contextid, $component, $filearea, $itemid=false) { global $DB; @@ -923,13 +942,12 @@ function format_postdata_for_curlcall($postdata) { return $convertedpostdata; } - - - /** * Fetches content of file from Internet (using proxy if defined). Uses cURL extension if present. * Due to security concerns only downloads from http(s) sources are supported. * + * @todo MDL-31073 add version test for '7.10.5' + * @category files * @param string $url file url starting with http(s):// * @param array $headers http headers, null if none. If set, should be an * associative array of header name => value pairs. @@ -1160,6 +1178,10 @@ function download_file_content($url, $headers=null, $postdata=null, $fullrespons /** * internal implementation + * @param stdClass $received + * @param resource $ch + * @param mixed $header + * @return int header length */ function download_file_content_header_handler($received, $ch, $header) { $received->headers[] = $header; @@ -1168,6 +1190,9 @@ function download_file_content_header_handler($received, $ch, $header) { /** * internal implementation + * @param stdClass $received + * @param resource $ch + * @param mixed $data */ function download_file_content_write_handler($received, $ch, $data) { if (!$received->fh) { @@ -1185,6 +1210,9 @@ function download_file_content_write_handler($received, $ch, $data) { } /** + * Returns a list of information about file t ypes based on extensions + * + * @category files * @return array List of information about file types based on extensions. * Associative array of extension (lower-case) to associative array * from 'element name' to data. Current element names are 'type' and 'icon'. @@ -1372,6 +1400,7 @@ function get_mimetypes_array() { * use a default if no information is present about that particular * extension. * + * @category files * @param string $element Desired information (usually 'icon' * for icon filename or 'type' for MIME type) * @param string $filename Filename we're looking up @@ -1413,6 +1442,7 @@ function mimeinfo($element, $filename) { * Obtains information about a filetype based on the MIME type rather than * the other way around. * + * @category files * @param string $element Desired information (usually 'icon') * @param string $mimetype MIME type we're looking up * @return string Requested piece of information from array @@ -1434,9 +1464,10 @@ function mimeinfo_from_type($element, $mimetype) { /** * Get information about a filetype based on the icon file. * + * @category files * @param string $element Desired information (usually 'icon') * @param string $icon Icon file name without extension - * @param boolean $all return all matching entries (defaults to false - best (by ext)/last match) + * @param bool $all return all matching entries (defaults to false - best (by ext)/last match) * @return string Requested piece of information from array */ function mimeinfo_from_icon($element, $icon, $all=false) { @@ -1486,9 +1517,9 @@ function mimeinfo_from_icon($element, $icon, $all=false) { * echo ''.$mimetype.''; * * - * @todo When an $OUTPUT->icon method is available this function should be altered + * @category files + * @todo MDL-31074 When an $OUTPUT->icon method is available this function should be altered * to conform with that. - * * @param string $mimetype The mimetype to fetch an icon for * @param int $size The size of the icon. Not yet implemented * @return string The relative path to the icon @@ -1517,11 +1548,11 @@ function file_mimetype_icon($mimetype, $size = NULL) { * echo 'blah'; * * - * @todo When an $OUTPUT->icon method is available this function should be altered + * @todo MDL-31074 When an $OUTPUT->icon method is available this function should be altered * to conform with that. - * @todo Implement $size - * - * @param string filename The filename to get the icon for + * @todo MDL-31074 Implement $size + * @category files + * @param string $filename The filename to get the icon for * @param int $size The size of the icon. Defaults to null can also be 32 * @return string */ @@ -1558,9 +1589,10 @@ function get_mimetype_description($mimetype, $capitalise=false) { } /** - * Requested file is not found or not accessible + * Requested file is not found or not accessible, does not return, terminates script * - * @return does not return, terminates script + * @global stdClass $CFG + * @global stdClass $COURSE */ function send_file_not_found() { global $CFG, $COURSE; @@ -1572,8 +1604,7 @@ function send_file_not_found() { * Check output buffering settings before sending file. * Please note you should not send any other headers after calling this function. * - * @private to be called only from lib/filelib.php ! - * @return void + * To be called only from lib/filelib.php ! */ function prepare_file_content_sending() { // We needed to be able to send headers up until now @@ -1606,12 +1637,11 @@ function prepare_file_content_sending() { /** * Handles the sending of temporary file to user, download is forced. - * File is deleted after abort or successful sending. + * File is deleted after abort or successful sending, does not return, script terminated * * @param string $path path to file, preferably from moodledata/temp/something; or content of file itself * @param string $filename proposed file name when saving file - * @param bool $path is content of file - * @return does not return, script terminated + * @param bool $pathisstring If the path is string */ function send_temp_file($path, $filename, $pathisstring=false) { global $CFG; @@ -1664,6 +1694,8 @@ function send_temp_file($path, $filename, $pathisstring=false) { /** * Internal callback function used by send_temp_file() + * + * @param string $path */ function send_temp_file_finished($path) { if (file_exists($path)) { @@ -1675,9 +1707,10 @@ function send_temp_file_finished($path) { * Handles the sending of file data to the user's browser, including support for * byteranges etc. * - * @global object - * @global object - * @global object + * @category files + * @global stdClass $CFG + * @global stdClass $COURSE + * @global moodle_session $SESSION * @param string $path Path of file on disk (including real filename), or actual content of file as string * @param string $filename Filename to send * @param int $lifetime Number of seconds before the file should expire from caches (default 24 hours) @@ -1689,7 +1722,7 @@ function send_temp_file_finished($path) { * if this is passed as true, ignore_user_abort is called. if you don't want your processing to continue on cancel, * you must detect this case when control is returned using connection_aborted. Please not that session is closed * and should not be reopened. - * @return no return or void, script execution stopped unless $dontdie is true + * @return null script execution stopped unless $dontdie is true */ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathisstring=false, $forcedownload=false, $mimetype='', $dontdie=false) { global $CFG, $COURSE, $SESSION; @@ -1907,10 +1940,11 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss * Handles the sending of file data to the user's browser, including support for * byteranges etc. * - * @global object - * @global object - * @global object - * @param object $stored_file local file object + * @category files + * @global stdClass $CFG + * @global stdClass $COURSE + * @global moodle_session $SESSION + * @param stored_file $stored_file local file object * @param int $lifetime Number of seconds before the file should expire from caches (default 24 hours) * @param int $filter 0 (default)=no filtering, 1=all files, 2=html files only * @param bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin @@ -1919,7 +1953,7 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss * if this is passed as true, ignore_user_abort is called. if you don't want your processing to continue on cancel, * you must detect this case when control is returned using connection_aborted. Please not that session is closed * and should not be reopened. - * @return void no return or void, script execution stopped unless $dontdie is true + * @return null script execution stopped unless $dontdie is true */ function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownload=false, $filename=null, $dontdie=false) { global $CFG, $COURSE, $SESSION; @@ -2110,8 +2144,8 @@ function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownl * Retrieves an array of records from a CSV file and places * them into a given table structure * - * @global object - * @global object + * @global stdClass $CFG + * @global moodle_database $DB * @param string $file The path to a CSV file * @param string $table The table to retrieve columns from * @return bool|array Returns an array of CSV records or false @@ -2157,9 +2191,10 @@ function get_records_csv($file, $table) { } /** + * Create a file with CSV contents * - * @global object - * @global object + * @global stdClass $CFG + * @global moodle_database $DB * @param string $file The file to put the CSV content into * @param array $records An array of records to write to a CSV file * @param string $table The table to get columns from @@ -2271,10 +2306,11 @@ function fulldelete($location) { /** * Send requested byterange of file. * - * @param object $handle A file handle + * @param resource $handle A file handle * @param string $mimetype The mimetype for the output * @param array $ranges An array of ranges to send * @param string $filesize The size of the content if only one range is used + * @todo MDL-31088 check if "multipart/x-byteranges" is more compatible with current readers/browsers/servers */ function byteserving_send_file($handle, $mimetype, $ranges, $filesize) { $chunksize = 1*(1024*1024); // 1MB chunks - must be less than 2MB! @@ -2341,9 +2377,10 @@ function byteserving_send_file($handle, $mimetype, $ranges, $filesize) { * add includes (js and css) into uploaded files * before returning them, useful for themes and utf.js includes * - * @global object + * @global stdClass $CFG * @param string $text text to search and replace * @return string text with added head includes + * @todo MDL-21120 */ function file_modify_html_header($text) { // first look for tag @@ -2412,37 +2449,44 @@ function file_modify_html_header($text) { * $html = $c->put('http://example.com/', array('file'=>'/var/www/test.txt'); * * - * @package core - * @subpackage file - * @author Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License + * @package core_files + * @category files + * @copyright Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License */ - class curl { - /** @var bool */ + /** @var bool Caches http request contents */ public $cache = false; + /** @var bool Uses proxy */ public $proxy = false; - /** @var string */ + /** @var string library version */ public $version = '0.4 dev'; - /** @var array */ + /** @var array http's response */ public $response = array(); + /** @var array http header */ public $header = array(); - /** @var string */ + /** @var string cURL information */ public $info; + /** @var string error */ public $error; - /** @var array */ + /** @var array cURL options */ private $options; - /** @var string */ + /** @var string Proxy host */ private $proxy_host = ''; + /** @var string Proxy auth */ private $proxy_auth = ''; + /** @var string Proxy type */ private $proxy_type = ''; - /** @var bool */ + /** @var bool Debug mode on */ private $debug = false; + /** @var bool|string Path to cookie file */ private $cookie = false; /** - * @global object + * Constructor + * + * @global stdClass $CFG * @param array $options */ public function __construct($options = array()){ @@ -2545,7 +2589,6 @@ public function resetcookie() { * * @param array $options If array is null, this function will * reset the options to default value. - * */ public function setopt($options = array()) { if (is_array($options)) { @@ -2557,9 +2600,9 @@ public function setopt($options = array()) { } } } + /** * Reset http method - * */ public function cleanopt(){ unset($this->options['CURLOPT_HTTPGET']); @@ -2574,8 +2617,7 @@ public function cleanopt(){ /** * Set HTTP Request Header * - * @param array $headers - * + * @param array $header */ public function setHeader($header) { if (is_array($header)){ @@ -2586,6 +2628,7 @@ public function setHeader($header) { $this->header[] = $header; } } + /** * Set HTTP Response Header * @@ -2593,11 +2636,12 @@ public function setHeader($header) { public function getResponse(){ return $this->response; } + /** * private callback function * Formatting HTTP Response Header * - * @param mixed $ch Apparently not used + * @param resource $ch Apparently not used * @param string $header * @return int The strlen of the header */ @@ -2627,9 +2671,9 @@ private function formatHeader($ch, $header) /** * Set options for individual curl instance * - * @param object $curl A curl handle + * @param resource $curl A curl handle * @param array $options - * @return object The curl handle + * @return resource The curl handle */ private function apply_opt($curl, $options) { // Clean up @@ -2674,6 +2718,7 @@ private function apply_opt($curl, $options) { } return $curl; } + /** * Download multiple files in parallel * @@ -2696,7 +2741,8 @@ public function download($requests, $options = array()) { $options['RETURNTRANSFER'] = false; return $this->multi($requests, $options); } - /* + + /** * Mulit HTTP Requests * This function could run multi-requests in parallel. * @@ -2733,6 +2779,7 @@ protected function multi($requests, $options = array()) { curl_multi_close($main); return $results; } + /** * Single HTTP Request * @@ -2869,7 +2916,7 @@ public function put($url, $params = array(), $options = array()){ * HTTP DELETE method * * @param string $url - * @param array $params + * @param array $param * @param array $options * @return bool */ @@ -2881,6 +2928,7 @@ public function delete($url, $param = array(), $options = array()){ $ret = $this->request($url, $options); return $ret; } + /** * HTTP TRACE method * @@ -2893,6 +2941,7 @@ public function trace($url, $options = array()){ $ret = $this->request($url, $options); return $ret; } + /** * HTTP OPTIONS method * @@ -2905,6 +2954,12 @@ public function options($url, $options = array()){ $ret = $this->request($url, $options); return $ret; } + + /** + * Get curl information + * + * @return string + */ public function get_info() { return $this->info; } @@ -2921,19 +2976,19 @@ public function get_info() { * $ret = $c->get('http://www.google.com'); * * - * @package core - * @subpackage file - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_files + * @copyright Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class curl_cache { - /** @var string */ + /** @var string Path to cache directory */ public $dir = ''; + /** + * Constructor * - * @global object - * @param string @module which module is using curl_cache - * + * @global stdClass $CFG + * @param string $module which module is using curl_cache */ function __construct($module = 'repository'){ global $CFG; @@ -2961,8 +3016,8 @@ function __construct($module = 'repository'){ /** * Get cached value * - * @global object - * @global object + * @global stdClass $CFG + * @global stdClass $USER * @param mixed $param * @return bool|string */ @@ -3039,20 +3094,20 @@ public function refresh(){ } /** - * This class is used to parse lib/file/file_types.mm which help get file - * extensions by file types. + * This class is used to parse lib/file/file_types.mm which help get file extensions by file types. + * * The file_types.mm file can be edited by freemind in graphic environment. * - * @package core - * @subpackage file - * @copyright 2009 Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_files + * @category files + * @copyright 2009 Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class filetype_parser { /** * Check file_types.mm file, setup variables * - * @global object $CFG + * @global stdClass $CFG * @param string $file */ public function __construct($file = '') { @@ -3146,11 +3201,7 @@ public function get_extensions($types) { * * @param string $relativepath * @param bool $forcedownload - * - * @package core - * @subpackage file - * @copyright 2008 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @todo MDL-31088 file serving improments */ function file_pluginfile($relativepath, $forcedownload) { global $DB, $CFG, $USER; diff --git a/lib/filestorage/file_archive.php b/lib/filestorage/file_archive.php index 6f616892f2397..d27d2c6a6da78 100644 --- a/lib/filestorage/file_archive.php +++ b/lib/filestorage/file_archive.php @@ -1,5 +1,4 @@ encoding === 'utf-8') { return $localname; } - $textlib = textlib_get_instance(); - $converted = $textlib->convert($localname, 'utf-8', $this->encoding); - $original = $textlib->convert($converted, $this->encoding, 'utf-8'); + $converted = textlib::convert($localname, 'utf-8', $this->encoding); + $original = textlib::convert($converted, $this->encoding, 'utf-8'); if ($original === $localname) { $result = $converted; } else { // try ascii conversion - $converted2 = $textlib->specialtoascii($localname); - $converted2 = $textlib->convert($converted2, 'utf-8', $this->encoding); - $original2 = $textlib->convert($converted, $this->encoding, 'utf-8'); + $converted2 = textlib::specialtoascii($localname); + $converted2 = textlib::convert($converted2, 'utf-8', $this->encoding); + $original2 = textlib::convert($converted, $this->encoding, 'utf-8'); if ($original2 === $localname) { //this looks much better @@ -161,7 +167,7 @@ protected function mangle_pathname($localname) { * please note that it may fail really badly. * The resulting file name is cleaned. * - * @param string $localname in $this->encoding + * @param string $localname name of file in $this->encoding * @return string in utf-8 */ protected function unmangle_pathname($localname) { @@ -169,7 +175,7 @@ protected function unmangle_pathname($localname) { $result = ltrim($result, '/'); // no leading / if ($this->encoding !== 'utf-8') { - $result = textlib_get_instance()->convert($result, $this->encoding, 'utf-8'); + $result = textlib::convert($result, $this->encoding, 'utf-8'); } return clean_param($result, PARAM_PATH); diff --git a/lib/filestorage/file_exceptions.php b/lib/filestorage/file_exceptions.php index 49c45a63cfc59..93eef5b01641a 100644 --- a/lib/filestorage/file_exceptions.php +++ b/lib/filestorage/file_exceptions.php @@ -1,5 +1,4 @@ contextid = $contextid; @@ -64,12 +80,17 @@ function __construct($contextid, $component, $filearea, $itemid, $filepath, $fil /** * No file access exception. * - * @package core - * @subpackage filestorage - * @copyright 2008 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_files + * @category files + * @copyright 2008 Petr Skoda (http://skodak.org) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_access_exception extends file_exception { + /** + * Constructor + * + * @param string $debuginfo extra debug info + */ function __construct($debuginfo = NULL) { parent::__construct('nopermissions', NULL, $debuginfo); } @@ -78,12 +99,18 @@ function __construct($debuginfo = NULL) { /** * Hash file content problem exception. * - * @package core - * @subpackage filestorage - * @copyright 2008 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core_files + * @category files + * @copyright 2008 Petr Skoda (http://skodak.org) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_pool_content_exception extends file_exception { + /** + * Constructor + * + * @param string $contenthash content hash + * @param string $debuginfo extra debug info + */ function __construct($contenthash, $debuginfo = NULL) { parent::__construct('hashpoolproblem', $contenthash, $debuginfo); } diff --git a/lib/filestorage/file_packer.php b/lib/filestorage/file_packer.php index 99aa281fab05b..7982bf209e31a 100644 --- a/lib/filestorage/file_packer.php +++ b/lib/filestorage/file_packer.php @@ -1,5 +1,4 @@ ospathname or archivepath=>stored_file) - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return mixed false if error stored file instance if ok + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @param int $userid user ID + * @return stored_file|bool false if error stored file instance if ok */ public abstract function archive_to_storage($files, $contextid, $component, $filearea, $itemid, $filepath, $filename, $userid = NULL); /** * Archive files and store the result in os file + * * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file) * @param string $archivefile path to target zip file * @return bool success @@ -60,26 +60,31 @@ public abstract function archive_to_pathname($files, $archivefile); /** * Extract file to given file path (real OS filesystem), existing files are overwrited - * @param mixed $archivefile full pathname of zip file or stored_file instance + * + * @param stored_file|string $archivefile full pathname of zip file or stored_file instance * @param string $pathname target directory - * @return mixed list of processed files; false if error + * @return array|bool list of processed files; false if error */ public abstract function extract_to_pathname($archivefile, $pathname); /** * Extract file to given file path (real OS filesystem), existing files are overwrited - * @param mixed $archivefile full pathname of zip file or stored_file instance - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @return mixed list of processed files; false if error + * + * @param string|stored_file $archivefile full pathname of zip file or stored_file instance + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $pathbase file path + * @param int $userid user ID + * @return array|bool list of processed files; false if error */ public abstract function extract_to_storage($archivefile, $contextid, $component, $filearea, $itemid, $pathbase, $userid = NULL); /** * Returns array of info about all files in archive + * + * @param file_archive $archivefile * @return array of file infos */ public abstract function list_files($archivefile); diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index d61e10f41eaa0..a60b7c2944ed7 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -1,5 +1,4 @@ '.'"; - $length = textlib_get_instance()->strlen($filepath); + $length = textlib::strlen($filepath); $sql = "SELECT * FROM {files} @@ -374,7 +375,7 @@ public function get_directory_files($contextid, $component, $filearea, $itemid, $result = array(); $params = array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid, 'filepath'=>$filepath, 'dirid'=>$directory->get_id()); - $length = textlib_get_instance()->strlen($filepath); + $length = textlib::strlen($filepath); if ($includedirs) { $sql = "SELECT * @@ -412,10 +413,10 @@ public function get_directory_files($contextid, $component, $filearea, $itemid, /** * Delete all area files (optionally limited by itemid). * - * @param int $contextid - * @param string $component - * @param string $filearea (all areas in context if not specified) - * @param int $itemid (all files if not specified) + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area or all areas in context if not specified + * @param int $itemid item ID or all files if not specified * @return bool success */ public function delete_area_files($contextid, $component = false, $filearea = false, $itemid = false) { @@ -473,11 +474,13 @@ public function delete_area_files_select($contextid, $component, /** * Move all the files in a file area from one context to another. - * @param integer $oldcontextid the context the files are being moved from. - * @param integer $newcontextid the context the files are being moved to. + * + * @param int $oldcontextid the context the files are being moved from. + * @param int $newcontextid the context the files are being moved to. * @param string $component the plugin that these files belong to. * @param string $filearea the name of the file area. - * @return integer the number of files moved, for information. + * @param int $itemid file item ID + * @return int the number of files moved, for information. */ public function move_area_files_to_new_context($oldcontextid, $newcontextid, $component, $filearea, $itemid = false) { // Note, this code is based on some code that Petr wrote in @@ -503,12 +506,12 @@ public function move_area_files_to_new_context($oldcontextid, $newcontextid, $co /** * Recursively creates directory. * - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param int $userid the user ID * @return bool success */ public function create_directory($contextid, $component, $filearea, $itemid, $filepath, $userid = null) { @@ -589,8 +592,8 @@ public function create_directory($contextid, $component, $filearea, $itemid, $fi /** * Add new local file based on existing local file. * - * @param mixed $file_record object or array describing changes - * @param mixed $fileorid id or stored_file instance of the existing local file + * @param stdClass|array $file_record object or array describing changes + * @param stored_file|int $fileorid id or stored_file instance of the existing local file * @return stored_file instance of newly created file */ public function create_file_from_storedfile($file_record, $fileorid) { @@ -695,11 +698,11 @@ public function create_file_from_storedfile($file_record, $fileorid) { /** * Add new local file. * - * @param mixed $file_record object or array describing file - * @param string $path path to file or content of file - * @param array $options @see download_file_content() options + * @param stdClass|array $file_record object or array describing file + * @param string $url the URL to the file + * @param array $options {@link download_file_content()} options * @param bool $usetempfile use temporary file for download, may prevent out of memory problems - * @return stored_file instance + * @return stored_file */ public function create_file_from_url($file_record, $url, array $options = NULL, $usetempfile = false) { @@ -750,9 +753,9 @@ public function create_file_from_url($file_record, $url, array $options = NULL, /** * Add new local file. * - * @param mixed $file_record object or array describing file - * @param string $path path to file or content of file - * @return stored_file instance + * @param stdClass|array $file_record object or array describing file + * @param string $pathname path to file or content of file + * @return stored_file */ public function create_file_from_pathname($file_record, $pathname) { global $DB; @@ -864,9 +867,9 @@ public function create_file_from_pathname($file_record, $pathname) { /** * Add new local file. * - * @param mixed $file_record object or array describing file + * @param stdClass|array $file_record object or array describing file * @param string $content content of file - * @return stored_file instance + * @return stored_file */ public function create_file_from_string($file_record, $content) { global $DB; @@ -978,13 +981,13 @@ public function create_file_from_string($file_record, $content) { /** * Creates new image file from existing. * - * @param mixed $file_record object or array describing new file - * @param mixed file id or stored file object + * @param stdClass|array $file_record object or array describing new file + * @param int|stored_file $fid file id or stored file object * @param int $newwidth in pixels * @param int $newheight in pixels - * @param bool $keepaspectratio + * @param bool $keepaspectratio whether or not keep aspect ratio * @param int $quality depending on image type 0-100 for jpeg, 0-9 (0 means no compression) for png - * @return stored_file instance + * @return stored_file */ public function convert_image($file_record, $fid, $newwidth = NULL, $newheight = NULL, $keepaspectratio = true, $quality = NULL) { if (!function_exists('imagecreatefromstring')) { @@ -1189,7 +1192,7 @@ public function add_string_to_pool($content) { * * NOTE: must not be public, files in pool must not be modified * - * @param string $contenthash + * @param string $contenthash content hash * @return string expected file location */ protected function path_from_hash($contenthash) { @@ -1203,7 +1206,7 @@ protected function path_from_hash($contenthash) { * * NOTE: must not be public, files in pool must not be modified * - * @param string $contenthash + * @param string $contenthash content hash * @return string expected file location */ protected function trash_path_from_hash($contenthash) { @@ -1215,7 +1218,7 @@ protected function trash_path_from_hash($contenthash) { /** * Tries to recover missing content of file from trash. * - * @param object $file_record + * @param stored_file $file stored_file instance * @return bool success */ public function try_content_recovery($file) { @@ -1252,7 +1255,6 @@ public function try_content_recovery($file) { * DO NOT call directly - reserved for core!! * * @param string $contenthash - * @return void */ public function deleted_file_cleanup($contenthash) { global $DB; @@ -1285,8 +1287,6 @@ public function deleted_file_cleanup($contenthash) { /** * Cron cleanup job. - * - * @return void */ public function cron() { global $CFG, $DB; diff --git a/lib/filestorage/stored_file.php b/lib/filestorage/stored_file.php index 212179c1a3563..bc19c0ba78b8f 100644 --- a/lib/filestorage/stored_file.php +++ b/lib/filestorage/stored_file.php @@ -1,5 +1,4 @@ fs = $fs; @@ -133,8 +133,6 @@ public function get_content_file_handle() { /** * Dumps file content to page. - * - * @return void */ public function readfile() { $path = $this->get_content_file_location(); @@ -180,7 +178,7 @@ public function copy_content_to($pathname) { /** * List contents of archive. * - * @param file_packer $file_packer + * @param file_packer $packer file packer instance * @return array of file infos */ public function list_files(file_packer $packer) { @@ -191,7 +189,7 @@ public function list_files(file_packer $packer) { /** * Extract file to given file path (real OS filesystem), existing files are overwritten. * - * @param file_packer $file_packer + * @param file_packer $packer file packer instance * @param string $pathname target directory * @return array|bool list of processed files; false if error */ @@ -203,13 +201,13 @@ public function extract_to_pathname(file_packer $packer, $pathname) { /** * Extract file to given file path (real OS filesystem), existing files are overwritten. * - * @param file_packer $file_packer - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $pathbase - * @param int $userid + * @param file_packer $packer file packer instance + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $pathbase path base + * @param int $userid user ID * @return array|bool list of processed files; false if error */ public function extract_to_storage(file_packer $packer, $contextid, $component, $filearea, $itemid, $pathbase, $userid = NULL) { @@ -220,7 +218,7 @@ public function extract_to_storage(file_packer $packer, $contextid, $component, /** * Add file/directory into archive. * - * @param file_archive $filearch + * @param file_archive $filearch file archive instance * @param string $archivepath pathname in archive * @return bool success */ @@ -239,6 +237,7 @@ public function archive_file(file_archive $filearch, $archivepath) { /** * Returns information about image, * information is determined from the file content + * * @return mixed array with width, height and mimetype; false if not an image */ public function get_imageinfo() { diff --git a/lib/filestorage/zip_archive.php b/lib/filestorage/zip_archive.php index 17ef91501e976..9acd1d3484a67 100644 --- a/lib/filestorage/zip_archive.php +++ b/lib/filestorage/zip_archive.php @@ -1,5 +1,4 @@ za)) { @@ -128,8 +130,9 @@ public function get_stream($index) { /** * Returns file information - * @param int $index of file - * @return info object or false if error + * + * @param int $index index of file + * @return stdClass info object or false if error */ public function get_info($index) { if (!isset($this->za)) { @@ -165,6 +168,7 @@ public function get_info($index) { /** * Returns array of info about all files in archive + * * @return array of file infos */ public function list_files() { @@ -187,6 +191,7 @@ public function list_files() { /** * Returns number of files in archive + * * @return int number of files */ public function count() { @@ -199,6 +204,7 @@ public function count() { /** * Add file into archive + * * @param string $localname name of file in archive * @param string $pathname location of file * @return bool success @@ -230,7 +236,7 @@ public function add_file_from_pathname($localname, $pathname) { $this->close(); $res = $this->open($this->archivepathname, file_archive::OPEN, $this->encoding); if ($res !== true) { - print_error('cannotopenzip'); //TODO ?? + print_error('cannotopenzip'); } } } @@ -240,8 +246,9 @@ public function add_file_from_pathname($localname, $pathname) { /** * Add content of string into archive + * * @param string $localname name of file in archive - * @param string $contents + * @param string $contents contents * @return bool success */ public function add_file_from_string($localname, $contents) { @@ -258,11 +265,11 @@ public function add_file_from_string($localname, $contents) { } if ($this->usedmem > 2097151) { - /// this prevents running out of memory when adding many large files using strings + // this prevents running out of memory when adding many large files using strings $this->close(); $res = $this->open($this->archivepathname, file_archive::OPEN, $this->encoding); if ($res !== true) { - print_error('cannotopenzip'); //TODO ?? + print_error('cannotopenzip'); } } $this->usedmem += strlen($contents); @@ -273,7 +280,8 @@ public function add_file_from_string($localname, $contents) { /** * Add empty directory into archive - * @param string $local + * + * @param string $localname name of file in archive * @return bool success */ public function add_directory($localname) { @@ -293,7 +301,8 @@ public function add_directory($localname) { /** * Returns current file info - * @return object + * + * @return stdClass */ public function current() { if (!isset($this->za)) { @@ -305,6 +314,7 @@ public function current() { /** * Returns the index of current file + * * @return int current file index */ public function key() { @@ -313,7 +323,6 @@ public function key() { /** * Moves forward to next file - * @return void */ public function next() { $this->pos++; @@ -321,7 +330,6 @@ public function next() { /** * Rewinds back to the first file - * @return void */ public function rewind() { $this->pos = 0; @@ -329,7 +337,8 @@ public function rewind() { /** * Did we reach the end? - * @return boolean + * + * @return bool */ public function valid() { if (!isset($this->za)) { diff --git a/lib/filestorage/zip_packer.php b/lib/filestorage/zip_packer.php index a593d06f42055..2cae435113789 100644 --- a/lib/filestorage/zip_packer.php +++ b/lib/filestorage/zip_packer.php @@ -1,5 +1,4 @@ ospathname or archivepath/subdir=>stored_file or archivepath=>array('content_as_string')) - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return mixed false if error stored file instance if ok + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @param int $userid user ID + * @return stored_file|bool false if error stored file instance if ok */ public function archive_to_storage($files, $contextid, $component, $filearea, $itemid, $filepath, $filename, $userid = NULL) { global $CFG; @@ -85,6 +85,7 @@ public function archive_to_storage($files, $contextid, $component, $filearea, $i /** * Zip files and store the result in os file + * * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file or archivepath=>array('content_as_string')) * @param string $archivefile path to target zip file * @return bool success @@ -121,6 +122,13 @@ public function archive_to_pathname($files, $archivefile) { return $ziparch->close(); } + /** + * Perform archiving file from stored file + * + * @param zip_archive $ziparch zip archive instance + * @param string $archivepath file path to archive + * @param stored_file $file stored_file object + */ private function archive_stored($ziparch, $archivepath, $file) { $file->archive_file($ziparch, $archivepath); @@ -143,6 +151,13 @@ private function archive_stored($ziparch, $archivepath, $file) { } } + /** + * Perform archiving file from file path + * + * @param zip_archive $ziparch zip archive instance + * @param string $archivepath file path to archive + * @param string $file path name of the file + */ private function archive_pathname($ziparch, $archivepath, $file) { if (!file_exists($file)) { return; @@ -174,9 +189,11 @@ private function archive_pathname($ziparch, $archivepath, $file) { /** * Unzip file to given file path (real OS filesystem), existing files are overwrited - * @param mixed $archivefile full pathname of zip file or stored_file instance + * + * @todo MDL-31048 localise messages + * @param string|stored_file $archivefile full pathname of zip file or stored_file instance * @param string $pathname target directory - * @return mixed list of processed files; false if error + * @return bool|array list of processed files; false if error */ public function extract_to_pathname($archivefile, $pathname) { global $CFG; @@ -267,13 +284,16 @@ public function extract_to_pathname($archivefile, $pathname) { /** * Unzip file to given file path (real OS filesystem), existing files are overwrited - * @param mixed $archivefile full pathname of zip file or stored_file instance - * @param int $contextid - * @param string $component - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @return mixed list of processed files; false if error + * + * @todo MDL-31048 localise messages + * @param string|stored_file $archivefile full pathname of zip file or stored_file instance + * @param int $contextid context ID + * @param string $component component + * @param string $filearea file area + * @param int $itemid item ID + * @param string $pathbase file path + * @param int $userid user ID + * @return array|bool list of processed files; false if error */ public function extract_to_storage($archivefile, $contextid, $component, $filearea, $itemid, $pathbase, $userid = NULL) { global $CFG; @@ -414,6 +434,8 @@ public function extract_to_storage($archivefile, $contextid, $component, $filear /** * Returns array of info about all files in archive + * + * @param file_archive $archivefile * @return array of file infos */ public function list_files($archivefile) { diff --git a/lib/filterlib.php b/lib/filterlib.php index 3496f37951bcd..62e68c12f4305 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -855,6 +855,7 @@ function filter_get_active_in_context($context) { ) active LEFT JOIN {filter_config} fc ON fc.filter = active.filter AND fc.contextid = $context->id ORDER BY active.sortorder"; + //TODO: remove sql_cast_2signed() once we do not support upgrade from Moodle 2.2 $rs = $DB->get_recordset_sql($sql); // Masssage the data into the specified format to return. @@ -1347,13 +1348,13 @@ function filter_remove_duplicates($linkarray) { if ($filterobject->casesensitive) { $exists = in_array($filterobject->phrase, $concepts); } else { - $exists = in_array(moodle_strtolower($filterobject->phrase), $lconcepts); + $exists = in_array(textlib::strtolower($filterobject->phrase), $lconcepts); } if (!$exists) { $cleanlinks[] = $filterobject; $concepts[] = $filterobject->phrase; - $lconcepts[] = moodle_strtolower($filterobject->phrase); + $lconcepts[] = textlib::strtolower($filterobject->phrase); } } diff --git a/lib/form/dndupload.js b/lib/form/dndupload.js index b09e1a56ed0af..385440ab7a6f1 100644 --- a/lib/form/dndupload.js +++ b/lib/form/dndupload.js @@ -95,6 +95,15 @@ M.form_dndupload.init = function(Y, options) { // Needed to tell the filemanager to redraw when files uploaded // and to check how many files are already uploaded this.filemanager = options.filemanager; + // Add a callback to show the 'drag and drop enabled' message + // within the filemanager box once it has finished loading, + // if there are no files yet uploaded + this.filemanager.emptycallback = function(clientid) { + var el = Y.one('#dndenabled2-'+clientid); + if (el) { + el.setStyle('display', 'inline'); + } + } } else if (options.formcallback) { // Needed to tell the filepicker to update when a new @@ -294,21 +303,22 @@ M.form_dndupload.init = function(Y, options) { this.pageentercount = 0; this.hide_upload_ready(); this.hide_drop_target(); - this.show_progress_spinner(); var files = e._event.dataTransfer.files; if (this.filemanager) { var currentfilecount = this.filemanager.filecount; + if (((currentfilecount + files.length) > this.maxfiles) && (this.maxfiles != -1)) { + alert(M.util.get_string('maxfilesreached', 'moodle', this.maxfiles)); + return false; + } + this.show_progress_spinner(); for (var i=0, f; f=files[i]; i++) { - if (currentfilecount >= this.maxfiles && this.maxfiles != -1) { - alert(M.util.get_string('maxfilesreached', 'moodle', this.maxfiles)); - break; - } if (this.upload_file(f)) { currentfilecount++; } } } else { + this.show_progress_spinner(); if (files.length >= 1) { this.upload_file(files[0]); } diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index de89ff33ff878..915fe90627bd5 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -61,6 +61,7 @@ M.form_filemanager.init = function(Y, options) { this.currentpath = '/'; this.maxfiles = options.maxfiles; this.maxbytes = options.maxbytes; + this.emptycallback = null; // Used by drag and drop upload this.filepicker_options = options.filepicker?options.filepicker:{}; this.filepicker_options.client_id = this.client_id; @@ -144,7 +145,9 @@ M.form_filemanager.init = function(Y, options) { this.filecount++; this.check_buttons(); this.refresh(this.currentpath); - M.util.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } }, check_buttons: function() { var button_addfile = Y.one("#btnadd-"+this.client_id); @@ -214,7 +217,9 @@ M.form_filemanager.init = function(Y, options) { scope.mkdir_dialog.hide(); scope.refresh(filepath); Y.one('#fm-newname').set('value', ''); - M.util.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } } }); } @@ -264,7 +269,15 @@ M.form_filemanager.init = function(Y, options) { }, this); }, empty_filelist: function(container) { - container.set('innerHTML', '
    '+M.str.repository.nofilesattached+'
    '+this.upload_message()); + var content = '
    '+M.str.repository.nofilesattached; + content += ''; + content += '
    '; + content += this.upload_message(); + container.set('innerHTML', content); + if (this.emptycallback) { + this.emptycallback(this.client_id); + } }, upload_message: function() { var div = '
      -
    • Loading...
    • +
    • {$loading}
    diff --git a/lib/form/yui/checkboxcontroller/checkboxcontroller.js b/lib/form/yui/checkboxcontroller/checkboxcontroller.js new file mode 100644 index 0000000000000..abcbbbd84763a --- /dev/null +++ b/lib/form/yui/checkboxcontroller/checkboxcontroller.js @@ -0,0 +1,113 @@ +// 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 . + + +/** + * Group of date and time input element + * + * Contains class for a group of elements used to input a date and time. + * + * @package core_form + * @copyright 2012 Rajesh Taneja + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +YUI.add('moodle-form-checkboxcontroller', function(Y) { + var checkboxcontroller = function() { + checkboxcontroller.superclass.constructor.apply(this, arguments); + } + + Y.extend(checkboxcontroller, Y.Base, { + _controllervaluenode : null, + _checkboxclass : null, + + /* + * Initialize script if all params passed. + * + * @param object params values passed while initalizing script + */ + initializer : function(params) { + if (params && params.checkboxcontroller && + params.controllerbutton && + params.checkboxclass) { + // Id of controller node which keeps value in html. + this._controllervaluenode = '#id_'+params.checkboxcontroller; + + // Checkboxes class name by which checkboxes will be selected + this._checkboxclass = '.'+params.checkboxclass; + + // Replace submit button with link. + this.replaceButton('#id_'+params.controllerbutton); + } + }, + + /** + * Replace controller button with link and add event. + * + * @param string controllerbutton id of the controller button which needs to be replaced + */ + replaceButton : function(controllerbutton) { + var controllerbutton = Y.one(controllerbutton); + var linkname = controllerbutton.get('value'); + // Link node which will replace controller button + var link = Y.Node.create(''+linkname+''); + + // Attach onclick event to link + link.on('click', this.onClick, this); + // Hide controller button + controllerbutton.hide(); + // Insert link node + controllerbutton.get('parentNode').insert(link, controllerbutton.get('lastNode')); + }, + + /** + * Onclick event will be handled. + * + * @param Event e + */ + onClick : function(e) { + e.preventDefault(); + this.switchGroupState(); + }, + + /** + * Toggles checkboxes status belong to a group + */ + switchGroupState : function() { + if (this._checkboxclass) { + // Value which should be set on checkboxes + var newvalue = ''; + // Get controller node which keeps value + var controllervaluenode = Y.one(this._controllervaluenode); + // Get all checkboxes with + var checkboxes = Y.all(this._checkboxclass); + + // Toggle checkboxes in group, depending on conroller value + if (controllervaluenode.get('value') == 1) { + controllervaluenode.set('value', '0'); + } else { + controllervaluenode.set('value', '1'); + newvalue = 'checked'; + } + checkboxes.set('checked', newvalue); + } + } + }); + + M.form = M.form || {}; + + M.form.checkboxcontroller = function(params) { + return new checkboxcontroller(params); + } +}, '@VERSION@', {requires:['base', 'node', 'util']}); diff --git a/lib/formslib.php b/lib/formslib.php index 771d129571d7e..9fd09d963e807 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1058,7 +1058,12 @@ function repeat_elements($elementobjs, $repeats, $options, $repeathiddenname, * @param int $originalValue The original general state of the checkboxes before the user first clicks this element */ function add_checkbox_controller($groupid, $text = null, $attributes = null, $originalValue = 0) { - global $CFG; + global $CFG, $PAGE; + + // Name of the controller button + $checkboxcontrollername = 'nosubmit_checkbox_controller' . $groupid; + $checkboxcontrollerparam = 'checkbox_controller'. $groupid; + $checkboxgroupclass = 'checkboxgroup'.$groupid; // Set the default text if none was specified if (empty($text)) { @@ -1066,54 +1071,43 @@ function add_checkbox_controller($groupid, $text = null, $attributes = null, $or } $mform = $this->_form; - $select_value = optional_param('checkbox_controller'. $groupid, null, PARAM_INT); - - if ($select_value == 0 || is_null($select_value)) { - $new_select_value = 1; - } else { - $new_select_value = 0; + $selectvalue = optional_param($checkboxcontrollerparam, null, PARAM_INT); + $contollerbutton = optional_param($checkboxcontrollername, null, PARAM_ALPHAEXT); + + $newselectvalue = $selectvalue; + if (is_null($selectvalue)) { + $newselectvalue = $originalValue; + } else if (!is_null($contollerbutton)) { + $newselectvalue = (int) !$selectvalue; + } + // set checkbox state depending on orignal/submitted value by controoler button + if (!is_null($contollerbutton) || is_null($selectvalue)) { + foreach ($mform->_elements as $element) { + if (($element instanceof MoodleQuickForm_advcheckbox) && + $element->getAttribute('class') == $checkboxgroupclass) { + $mform->setConstants(array($element->getName() => $newselectvalue)); + } + } } - $mform->addElement('hidden', "checkbox_controller$groupid"); - $mform->setType("checkbox_controller$groupid", PARAM_INT); - $mform->setConstants(array("checkbox_controller$groupid" => $new_select_value)); - - $checkbox_controller_name = 'nosubmit_checkbox_controller' . $groupid; - $mform->registerNoSubmitButton($checkbox_controller_name); - - // Prepare Javascript for submit element - $js = "\n//addElement('hidden', $checkboxcontrollerparam, $newselectvalue, array('id' => "id_".$checkboxcontrollerparam)); + $mform->setType($checkboxcontrollerparam, PARAM_INT); + $mform->setConstants(array($checkboxcontrollerparam => $newselectvalue)); - $js .= "//]]>\n"; + $PAGE->requires->yui_module('moodle-form-checkboxcontroller', 'M.form.checkboxcontroller', + array( + array('groupid' => $groupid, + 'checkboxclass' => $checkboxgroupclass, + 'checkboxcontroller' => $checkboxcontrollerparam, + 'controllerbutton' => $checkboxcontrollername) + ) + ); - require_once("$CFG->libdir/form/submitlink.php"); - $submitlink = new MoodleQuickForm_submitlink($checkbox_controller_name, $attributes); - $submitlink->_js = $js; - $submitlink->_onclick = "html_quickform_toggle_checkboxes($groupid); return false;"; + require_once("$CFG->libdir/form/submit.php"); + $submitlink = new MoodleQuickForm_submit($checkboxcontrollername, $attributes); $mform->addElement($submitlink); - $mform->setDefault($checkbox_controller_name, $text); + $mform->registerNoSubmitButton($checkboxcontrollername); + $mform->setDefault($checkboxcontrollername, $text); } /** @@ -1331,7 +1325,7 @@ function setShowAdvanced($showadvancedNow = null){ } else { //if setShowAdvanced is called without any preference //make the default to not show advanced elements. $showadvancedNow = get_user_preferences( - moodle_strtolower($this->_formName.'_showadvanced', 0)); + textlib::strtolower($this->_formName.'_showadvanced', 0)); } } //value of hidden element @@ -2265,8 +2259,8 @@ function startForm(&$form){ $this->_hiddenHtml .= $form->_pageparams; } - $PAGE->requires->yui_module('moodle-core-formslib', - 'M.core.init_formslib', + $PAGE->requires->yui_module('moodle-core-formchangechecker', + 'M.core_formchangechecker.init', array(array( 'formid' => $form->getAttribute('id') )) diff --git a/lib/grade/constants.php b/lib/grade/constants.php index 7a4e5cafb4346..ba9fd82b1fd7e 100644 --- a/lib/grade/constants.php +++ b/lib/grade/constants.php @@ -112,11 +112,6 @@ */ define('GRADE_UPDATE_MULTIPLE', 2); -/** - * GRADE_UPDATE_DELETED - Grade item deleted (MDL-31362) - */ -define('GRADE_UPDATE_ITEM_DELETED', 3); - /** * GRADE_UPDATE_DELETED - Grade item cannot be updated as it is locked */ @@ -202,11 +197,6 @@ */ define('GRADE_REPORT_AGGREGATION_POSITION_LAST', 1); -// These constants dont seem to be in use (MDL-31363) -define('GRADE_REPORT_AGGREGATION_VIEW_FULL', 0); -define('GRADE_REPORT_AGGREGATION_VIEW_AGGREGATES_ONLY', 1); -define('GRADE_REPORT_AGGREGATION_VIEW_GRADES_ONLY', 2); - // What to do if category or course total contains a hidden item /** diff --git a/lib/gradelib.php b/lib/gradelib.php index b63464f4dc5c3..8de67cf103d7b 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -56,7 +56,7 @@ * @param int $itemnumber Most probably 0. Modules can use other numbers when having more than one grade for each user * @param mixed $grades Grade (object, array) or several grades (arrays of arrays or objects), NULL if updating grade_item definition only * @param mixed $itemdetails Object or array describing the grading item, NULL if no change - * @return int Returns GRADE_UPDATE_OK, GRADE_UPDATE_FAILED, GRADE_UPDATE_MULTIPLE, GRADE_UPDATE_ITEM_DELETED (MDL-31362) or GRADE_UPDATE_ITEM_LOCKED + * @return int Returns GRADE_UPDATE_OK, GRADE_UPDATE_FAILED, GRADE_UPDATE_MULTIPLE or GRADE_UPDATE_ITEM_LOCKED */ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance, $itemnumber, $grades=NULL, $itemdetails=NULL) { global $USER, $CFG, $DB; diff --git a/lib/graphlib.php b/lib/graphlib.php index d801378a3175e..c712fad514b5a 100644 --- a/lib/graphlib.php +++ b/lib/graphlib.php @@ -1247,8 +1247,7 @@ function print_TTF($message) { break; } // start of Moodle addition - $textlib = textlib_get_instance(); - $text = $textlib->utf8_to_entities($text, true, true); //does not work with hex entities! + $text = textlib::utf8_to_entities($text, true, true); //does not work with hex entities! // end of Moodle addition ImageTTFText($this->image, $points, $angle, $x, $y, $colour, $font, $text); } @@ -1353,8 +1352,7 @@ function get_boundaryBox($message) { // get boundary box and offsets for printing at an angle // start of Moodle addition - $textlib = textlib_get_instance(); - $text = $textlib->utf8_to_entities($text, true, true); //gd does not work with hex entities! + $text = textlib::utf8_to_entities($text, true, true); //gd does not work with hex entities! // end of Moodle addition $bounds = ImageTTFBBox($points, $angle, $font, $text); diff --git a/lib/html2text.php b/lib/html2text.php index e360b2c47d28c..afedac5fdf7e5 100644 --- a/lib/html2text.php +++ b/lib/html2text.php @@ -1,22 +1,38 @@ . -// -// Author(s): Jon Abernathy -// Copyright (c) 2005-2007 Jon Abernathy +/************************************************************************* + * * + * class.html2text.inc * + * * + ************************************************************************* + * * + * Converts HTML to formatted plain text * + * * + * Copyright (c) 2005-2007 Jon Abernathy * + * All rights reserved. * + * * + * This script 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 2 of the License, or * + * (at your option) any later version. * + * * + * The GNU General Public License can be found at * + * http://www.gnu.org/copyleft/gpl.html. * + * * + * This script 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. * + * * + * Author(s): Jon Abernathy * + * * + * Last modified: 08/08/07 * + * * + *************************************************************************/ + +if (!defined('RCMAIL_CHARSET')) { + define('RCMAIL_CHARSET', 'UTF-8'); +} /** * Takes HTML and converts it to formatted, plain text. @@ -87,15 +103,9 @@ * * *** End of the housecleaning updates. Updated 08/08/07. * - * @package moodlecore - * @copyright Jon Abernathy - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * @package moodlecore - * @copyright Jon Abernathy - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Jon Abernathy + * @version 1.0.0 + * @since PHP 4.0.2 */ class html2text { @@ -138,10 +148,8 @@ class html2text var $search = array( "/\r/", // Non-legal carriage return "/[\n\t]+/", // Newlines and tabs - '/[ ]{2,}/', // Runs of spaces, pre-handling '/]*>.*?<\/script>/i', // x"; + $this->assertIdentical('xx', purify_html($text)); + + $text = '
    xx
    '; + $this->assertIdentical('
    xx
    ', purify_html($text)); + + $text = '
    xx
    '; + $this->assertIdentical('
    xx
    ', purify_html($text)); + + $text = 'xx'; + $this->assertIdentical('xx', purify_html($text)); + + $text = 'xx'; + $this->assertIdentical('xx', purify_html($text)); + + $text = 'xx'; + $this->assertIdentical('xx', purify_html($text)); + + $text = 'xx'; + $this->assertIdentical('xx', purify_html($text)); + } } diff --git a/lib/simpletest/testmoodlelib.php b/lib/simpletest/testmoodlelib.php index 254b87093c385..0142a665aa047 100644 --- a/lib/simpletest/testmoodlelib.php +++ b/lib/simpletest/testmoodlelib.php @@ -953,6 +953,48 @@ function test_shorten_text() { $text = "

    123456789

    ";//a string with no convenient breaks $this->assertEqual("

    12345...

    ", shorten_text($text, 8)); + + // ==== this must work with UTF-8 too! ====== + + // text without tags + $text = "ŽluÅ¥ouÄký koníÄek pÅ™eskoÄil"; + $this->assertEqual($text, shorten_text($text)); // 30 chars by default + $this->assertEqual("ŽluÅ¥ouÄký koníÄe...", shorten_text($text, 19, true)); + $this->assertEqual("ŽluÅ¥ouÄký ...", shorten_text($text, 19, false)); + // And try it with 2-less (that are, in bytes, the middle of a sequence) + $this->assertEqual("ŽluÅ¥ouÄký koní...", shorten_text($text, 17, true)); + $this->assertEqual("ŽluÅ¥ouÄký ...", shorten_text($text, 17, false)); + + $text = "

    ŽluÅ¥ouÄký koníÄek pÅ™eskoÄil potůÄek

    "; + $this->assertEqual($text, shorten_text($text, 60)); + $this->assertEqual("

    ŽluÅ¥ouÄký koníÄek ...

    ", shorten_text($text, 21)); + $this->assertEqual("

    ŽluÅ¥ouÄký koníÄe...

    ", shorten_text($text, 19, true)); + $this->assertEqual("

    ŽluÅ¥ouÄký ...

    ", shorten_text($text, 19, false)); + // And try it with 2-less (that are, in bytes, the middle of a sequence) + $this->assertEqual("

    ŽluÅ¥ouÄký koní...

    ", shorten_text($text, 17, true)); + $this->assertEqual("

    ŽluÅ¥ouÄký ...

    ", shorten_text($text, 17, false)); + // And try over one tag (start/end), it does proper text len + $this->assertEqual("

    ŽluÅ¥ouÄký koníÄek pÅ™...

    ", shorten_text($text, 23, true)); + $this->assertEqual("

    ŽluÅ¥ouÄký koníÄek pÅ™eskoÄil pot...

    ", shorten_text($text, 34, true)); + // And in the middle of one tag + $this->assertEqual("

    ŽluÅ¥ouÄký koníÄek pÅ™eskoÄil...

    ", shorten_text($text, 30, true)); + + // Japanese + $text = '言語設定言語設定abcdefghijkl'; + $this->assertEqual($text, shorten_text($text)); // 30 chars by default + $this->assertEqual("言語設定言語...", shorten_text($text, 9, true)); + $this->assertEqual("言語設定言語...", shorten_text($text, 9, false)); + $this->assertEqual("言語設定言語設定ab...", shorten_text($text, 13, true)); + $this->assertEqual("言語設定言語設定...", shorten_text($text, 13, false)); + + // Chinese + $text = '简体中文简体中文abcdefghijkl'; + $this->assertEqual($text, shorten_text($text)); // 30 chars by default + $this->assertEqual("简体中文简体...", shorten_text($text, 9, true)); + $this->assertEqual("简体中文简体...", shorten_text($text, 9, false)); + $this->assertEqual("简体中文简体中文ab...", shorten_text($text, 13, true)); + $this->assertEqual("简体中文简体中文...", shorten_text($text, 13, false)); + } function test_usergetdate() { @@ -1400,15 +1442,13 @@ public function test_userdate() { $systemdefaulttimezone = date_default_timezone_get(); date_default_timezone_set('Australia/Perth'); - //get instance of textlib for strtolower - $textlib = textlib_get_instance(); foreach ($testvalues as $vals) { $USER->timezone = $vals['usertimezone']; $actualoutput = userdate($vals['time'], '%A, %d %B %Y, %I:%M %p', $vals['timezone']); //On different systems case of AM PM changes so compare case insenitive - $vals['expectedoutput'] = $textlib->strtolower($vals['expectedoutput']); - $actualoutput = $textlib->strtolower($actualoutput); + $vals['expectedoutput'] = textlib::strtolower($vals['expectedoutput']); + $actualoutput = textlib::strtolower($actualoutput); $this->assertEqual($vals['expectedoutput'], $actualoutput, "Expected: {$vals['expectedoutput']} => Actual: {$actualoutput}, @@ -1574,8 +1614,6 @@ public function test_make_timestamp() { $systemdefaulttimezone = date_default_timezone_get(); date_default_timezone_set('Australia/Perth'); - //get instance of textlib for strtolower - $textlib = textlib_get_instance(); //Test make_timestamp with all testvals and assert if anything wrong. foreach ($testvalues as $vals) { $USER->timezone = $vals['usertimezone']; @@ -1591,8 +1629,8 @@ public function test_make_timestamp() { ); //On different systems case of AM PM changes so compare case insenitive - $vals['expectedoutput'] = $textlib->strtolower($vals['expectedoutput']); - $actualoutput = $textlib->strtolower($actualoutput); + $vals['expectedoutput'] = textlib::strtolower($vals['expectedoutput']); + $actualoutput = textlib::strtolower($actualoutput); $this->assertEqual($vals['expectedoutput'], $actualoutput, "Expected: {$vals['expectedoutput']} => Actual: {$actualoutput}, @@ -1757,4 +1795,4 @@ public function test_get_string() { // Reset the language $COURSE->lang = $originallang; } -} \ No newline at end of file +} diff --git a/lib/simpletest/testpurifier.php b/lib/simpletest/testpurifier.php deleted file mode 100644 index e066d263dd7c2..0000000000000 --- a/lib/simpletest/testpurifier.php +++ /dev/null @@ -1,128 +0,0 @@ -. - -/** - * Unit tests for the HTMLPurifier integration - * - * @package core - * @subpackage simpletest - * @copyright 2011 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - - -class purifier_test extends UnitTestCase { - - public static $includecoverage = array('lib/htmlpurifier/HTMLPurifier.php'); - - private $cachetext = null; - - function setUp() { - global $CFG; - $this->cachetext = $CFG->cachetext; - $CFG->cachetext = 0; - } - - function tearDown() { - global $CFG; - $CFG->cachetext = $this->cachetext; - } - - /** - * Verify _blank target is allowed - * @return void - */ - public function test_allow_blank_target() { - $text = 'Some link'; - $result = format_text($text, FORMAT_HTML); - $this->assertIdentical($text, $result); - - $result = format_text('Some link', FORMAT_HTML); - $this->assertIdentical('Some link', $result); - } - - /** - * Verify our nolink tag accepted - * @return void - */ - public function test_nolink() { - // we can not use format text because nolink changes result - $text = '
    no filters
    '; - $result = purify_html($text, array()); - $this->assertIdentical($text, $result); - } - - /** - * Verify our tex tag accepted - * @return void - */ - public function test_tex() { - $text = 'a+b=c'; - $result = purify_html($text, array()); - $this->assertIdentical($text, $result); - } - - /** - * Verify our algebra tag accepted - * @return void - */ - public function test_algebra() { - $text = 'a+b=c'; - $result = purify_html($text, array()); - $this->assertIdentical($text, $result); - } - - /** - * Verify our hacky multilang works - * @return void - */ - public function test_multilang() { - $text = 'hmmmhm'; - $result = purify_html($text, array()); - $this->assertIdentical($text, $result); - - $text = 'hmmmhm'; - $result = purify_html($text, array()); - $this->assertIdentical($text, $result); - - $text = 'hmmm'; - $result = purify_html($text, array()); - $this->assertNotIdentical($text, $result); - } - - /** - * Tests the 'allowid' option for format_text. - */ - public function test_format_text_allowid() { - // Start off by not allowing ids (default) - $options = array( - 'nocache' => true - ); - $result = format_text('
    Frog
    ', FORMAT_HTML, $options); - $this->assertIdentical('
    Frog
    ', $result); - - // Now allow ids - $options['allowid'] = true; - $result = format_text('
    Frog
    ', FORMAT_HTML, $options); - $this->assertIdentical('
    Frog
    ', $result); - } - - - //TODO: add XSS smoke tests here -} - diff --git a/lib/simpletest/testtextlib.php b/lib/simpletest/testtextlib.php index 2b86475b1d57d..60306895d5d07 100644 --- a/lib/simpletest/testtextlib.php +++ b/lib/simpletest/testtextlib.php @@ -275,6 +275,11 @@ public function test_strtotitle() { } public function test_deprecated_textlib_get_instance() { + global $CFG; + + $debugging = $CFG->debug; + $CFG->debug = DEBUG_NORMAL; + $textlib = textlib_get_instance(); $this->assertIdentical($textlib->substr('abc', 1, 1), 'b'); $this->assertIdentical($textlib->strlen('abc'), 3); @@ -285,6 +290,8 @@ public function test_deprecated_textlib_get_instance() { $this->assertIdentical($textlib->strrpos('abcabc', 'a'), 3); $this->assertIdentical($textlib->specialtoascii('ábc'), 'abc'); $this->assertIdentical($textlib->strtotitle('abc ABC'), 'Abc Abc'); + + $CFG->debug = $debugging; } } diff --git a/lib/simpletest/testweblib.php b/lib/simpletest/testweblib.php index bdcdd5509deec..a1d985e9100de 100644 --- a/lib/simpletest/testweblib.php +++ b/lib/simpletest/testweblib.php @@ -62,16 +62,15 @@ function test_s() { } function test_format_text_email() { - $this->assertEqual("\n\nThis is a TEST", + $this->assertEqual("This is a TEST", format_text_email('

    This is a test

    ',FORMAT_HTML)); - $this->assertEqual("\n\nThis is a TEST", + $this->assertEqual("This is a TEST", format_text_email('

    This is a test

    ',FORMAT_HTML)); $this->assertEqual('& so is this', format_text_email('& so is this',FORMAT_HTML)); - $tl = textlib_get_instance(); - $this->assertEqual('Two bullets: '.$tl->code2utf8(8226).' *', + $this->assertEqual('Two bullets: '.textlib::code2utf8(8226).' *', format_text_email('Two bullets: • •',FORMAT_HTML)); - $this->assertEqual($tl->code2utf8(0x7fd2).$tl->code2utf8(0x7fd2), + $this->assertEqual(textlib::code2utf8(0x7fd2).textlib::code2utf8(0x7fd2), format_text_email('習習',FORMAT_HTML)); } @@ -100,6 +99,30 @@ function test_wikify_links() { $this->assertEqual(wikify_links('this is a link'), 'this is a link [ http://someaddress.com/query ]'); } + function test_moodle_url_round_trip() { + $strurl = 'http://moodle.org/course/view.php?id=5'; + $url = new moodle_url($strurl); + $this->assertEqual($strurl, $url->out(false)); + + $strurl = 'http://moodle.org/user/index.php?contextid=53&sifirst=M&silast=D'; + $url = new moodle_url($strurl); + $this->assertEqual($strurl, $url->out(false)); + } + + function test_moodle_url_round_trip_array_params() { + $strurl = 'http://example.com/?a%5B1%5D=1&a%5B2%5D=2'; + $url = new moodle_url($strurl); + $this->assertEqual($strurl, $url->out(false)); + + $url = new moodle_url('http://example.com/?a[1]=1&a[2]=2'); + $this->assertEqual($strurl, $url->out(false)); + + // For un-keyed array params, we expect 0..n keys to be returned + $strurl = 'http://example.com/?a%5B0%5D=0&a%5B1%5D=1'; + $url = new moodle_url('http://example.com/?a[]=0&a[]=1'); + $this->assertEqual($strurl, $url->out(false)); + } + function test_compare_url() { $url1 = new moodle_url('index.php', array('var1' => 1, 'var2' => 2)); $url2 = new moodle_url('index2.php', array('var1' => 1, 'var2' => 2, 'var3' => 3)); @@ -136,56 +159,6 @@ function test_out_as_local_url() { $url2->out_as_local_url(); } - public function test_html_to_text_simple() { - $this->assertEqual("\n\n_Hello_ WORLD!", html_to_text('

    Hello world!

    ')); - } - - public function test_html_to_text_image() { - $this->assertEqual('[edit]', html_to_text('edit')); - } - - public function test_html_to_text_image_with_backslash() { - $this->assertEqual('[\edit]', html_to_text('\edit')); - } - - public function test_html_to_text_nowrap() { - $long = "Here is a long string, more than 75 characters long, since by default html_to_text wraps text at 75 chars."; - $this->assertEqual($long, html_to_text($long, 0)); - } - - public function test_html_to_text_dont_screw_up_utf8() { - $this->assertEqual("\n\nAll the WORLD’S a stage.", html_to_text('

    All the world’s a stage.

    ')); - } - - public function test_html_to_text_trailing_whitespace() { - $this->assertEqual('With trailing whitespace and some more text', html_to_text("With trailing whitespace \nand some more text", 0)); - } - - public function test_html_to_text_0() { - $this->assertIdentical('0', html_to_text('0')); - } - - public function test_html_to_text_pre_parsing_problem() { - $strorig = 'Consider the following function:
    void FillMeUp(char* in_string) {'.
    -                   '
    int i = 0;
    while (in_string[i] != \'\0\') {
    in_string[i] = \'X\';
    i++;
    }
    '. - '}
    What would happen if a non-terminated string were input to this function?

    '; - - $strconv = 'Consider the following function: - -void FillMeUp(char* in_string) { - int i = 0; - while (in_string[i] != \'\0\') { - in_string[i] = \'X\'; - i++; - } -} -What would happen if a non-terminated string were input to this function? - -'; - - $this->assertIdentical($strconv, html_to_text($strorig)); - } - public function test_clean_text() { $text = "lala xx"; $this->assertEqual($text, clean_text($text, FORMAT_PLAIN)); diff --git a/lib/textlib.class.php b/lib/textlib.class.php index 6403504e51bf5..9f95a489507d0 100644 --- a/lib/textlib.class.php +++ b/lib/textlib.class.php @@ -24,20 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -/** - * Original singleton helper function, please use static methods instead, - * ex: textlib::convert() - * - * @deprecated since Moodle 2.1 MDL-29027 textlib contains static functions - * @todo MDL-31301 calling of textlib functions should be static. - * @see textlib - * @return textlib instance - */ -function textlib_get_instance() { - return new textlib(); -} - - /** * defines string api's for manipulating strings * diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index 456ce2711269c..f706bdeab890d 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -32,7 +32,7 @@ editor/tinymce/tiny_mce TinyMCE LGPL - 3.4.6 + 3.4.9 2.1+ @@ -67,7 +67,7 @@ htmlpurifier HTML Purifier LGPL - 4.3.0 + 4.4.0 2.1+ diff --git a/lib/tokeniserlib.php b/lib/tokeniserlib.php index a903cfe5179a4..b57c44ad51547 100644 --- a/lib/tokeniserlib.php +++ b/lib/tokeniserlib.php @@ -164,8 +164,6 @@ */ function tokenise_text($text, $stop_words = array(), $overlap_cjk = false, $join_numbers = false) { - $textlib = textlib_get_instance(); - // Multipliers for scores of words inside certain HTML tags. // Note: 'a' must be included for link ranking to work. $tags = array('h1' => 25, @@ -204,7 +202,7 @@ function tokenise_text($text, $stop_words = array(), $overlap_cjk = false, $join if ($tag) { // Increase or decrease score per word based on tag list($tagname) = explode(' ', $value, 2); - $tagname = $textlib->strtolower($tagname); + $tagname = textlib::strtolower($tagname); // Closing or opening tag? if ($tagname[0] == '/') { $tagname = substr($tagname, 1); @@ -243,7 +241,7 @@ function tokenise_text($text, $stop_words = array(), $overlap_cjk = false, $join $accum .= $word .' '; $num = is_numeric($word); // Check word length - if ($num || $textlib->strlen($word) >= MINIMUM_WORD_SIZE) { + if ($num || textlib::strlen($word) >= MINIMUM_WORD_SIZE) { // Normalize numbers if ($num && $join_numbers) { $word = (int)ltrim($word, '-0'); @@ -319,13 +317,11 @@ function tokenise_split($text, $stop_words, $overlap_cjk, $join_numbers) { */ function tokenise_simplify($text, $overlap_cjk, $join_numbers) { - $textlib = textlib_get_instance(); - // Decode entities to UTF-8 - $text = $textlib->entities_to_utf8($text, true); + $text = textlib::entities_to_utf8($text, true); // Lowercase - $text = $textlib->strtolower($text); + $text = textlib::strtolower($text); // Simple CJK handling if ($overlap_cjk) { @@ -377,10 +373,8 @@ function tokenise_simplify($text, $overlap_cjk, $join_numbers) { */ function tokenise_expand_cjk($matches) { - $textlib = textlib_get_instance(); - $str = $matches[0]; - $l = $textlib->strlen($str); + $l = textlib::strlen($str); // Passthrough short words if ($l <= MINIMUM_WORD_SIZE) { return ' '. $str .' '; @@ -391,7 +385,7 @@ function tokenise_expand_cjk($matches) { // Begin loop for ($i = 0; $i < $l; ++$i) { // Grab next character - $current = $textlib->substr($str, 0, 1); + $current = textlib::substr($str, 0, 1); $str = substr($str, strlen($current)); $chars[] = $current; if ($i >= MINIMUM_WORD_SIZE - 1) { @@ -408,6 +402,5 @@ function tokenise_expand_cjk($matches) { */ function tokenise_truncate_word(&$text) { - $textlib = textlib_get_instance(); - $text = $textlib->substr($text, 0, MAXIMUM_WORD_SIZE); + $text = textlib::substr($text, 0, MAXIMUM_WORD_SIZE); } diff --git a/lib/weblib.php b/lib/weblib.php index c97e06b9d9c13..7de357d4f5bfc 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -474,7 +474,13 @@ public function get_query_string($escaped = true, array $overrideparams = null) $params = $this->params; } foreach ($params as $key => $val) { - $arr[] = rawurlencode($key)."=".rawurlencode($val); + if (is_array($val)) { + foreach ($val as $index => $value) { + $arr[] = rawurlencode($key.'['.$index.']')."=".rawurlencode($value); + } + } else { + $arr[] = rawurlencode($key)."=".rawurlencode($val); + } } if ($escaped) { return implode('&', $arr); @@ -776,20 +782,17 @@ function data_submitted() { */ function break_up_long_words($string, $maxsize=20, $cutchar=' ') { -/// Loading the textlib singleton instance. We are going to need it. - $textlib = textlib_get_instance(); - /// First of all, save all the tags inside the text to skip them $tags = array(); filter_save_tags($string,$tags); /// Process the string adding the cut when necessary $output = ''; - $length = $textlib->strlen($string); + $length = textlib::strlen($string); $wordlength = 0; for ($i=0; $i<$length; $i++) { - $char = $textlib->substr($string, $i, 1); + $char = textlib::substr($string, $i, 1); if ($char == ' ' or $char == "\t" or $char == "\n" or $char == "\r" or $char == "<" or $char == ">") { $wordlength = 0; } else { @@ -1696,7 +1699,7 @@ function highlightfast($needle, $haystack) { return $haystack; } - $parts = explode(moodle_strtolower($needle), moodle_strtolower($haystack)); + $parts = explode(textlib::strtolower($needle), textlib::strtolower($haystack)); if (count($parts) === 1) { return $haystack; @@ -2721,7 +2724,7 @@ function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) { global $CFG, $USER, $UNITTEST; $forcedebug = false; - if (!empty($CFG->debugusers)) { + if (!empty($CFG->debugusers) && $USER) { $debugusers = explode(',', $CFG->debugusers); $forcedebug = in_array($USER->id, $debugusers); } diff --git a/lib/xmldb/xmldb.dtd b/lib/xmldb/xmldb.dtd index 0d20746a358d2..20bad535c7bee 100644 --- a/lib/xmldb/xmldb.dtd +++ b/lib/xmldb/xmldb.dtd @@ -1,9 +1,6 @@ - - - diff --git a/lib/xmldb/xmldb.xsd b/lib/xmldb/xmldb.xsd index a47f0d43e6f76..d30597eae9261 100644 --- a/lib/xmldb/xmldb.xsd +++ b/lib/xmldb/xmldb.xsd @@ -34,6 +34,7 @@ + @@ -62,10 +63,8 @@ + - - - diff --git a/lib/xmldb/xmldb_constants.php b/lib/xmldb/xmldb_constants.php index 1454ffca8e916..347f728671d16 100644 --- a/lib/xmldb/xmldb_constants.php +++ b/lib/xmldb/xmldb_constants.php @@ -60,7 +60,7 @@ define ('XMLDB_STATEMENT_CUSTOM', 4); //Custom Statements /// Some other useful Constants - define ('XMLDB_UNSIGNED', true); //If the field is going to be unsigned + define ('XMLDB_UNSIGNED', true); //If the field is going to be unsigned @deprecated since 2.3 define ('XMLDB_NOTNULL', true); //If the field is going to be not null define ('XMLDB_SEQUENCE', true); //If the field is going to be a sequence define ('XMLDB_INDEX_UNIQUE', true); //If the index is going to be unique diff --git a/lib/xmldb/xmldb_field.php b/lib/xmldb/xmldb_field.php index e272b51e86caa..cec73df60b4fe 100644 --- a/lib/xmldb/xmldb_field.php +++ b/lib/xmldb/xmldb_field.php @@ -30,7 +30,6 @@ class xmldb_field extends xmldb_object { var $type; var $length; - var $unsigned; var $notnull; var $default; var $sequence; @@ -53,7 +52,6 @@ class xmldb_field extends xmldb_object { function __construct($name, $type=null, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $default=null, $previous=null) { $this->type = NULL; $this->length = NULL; - $this->unsigned = true; $this->notnull = false; $this->default = NULL; $this->sequence = false; @@ -68,9 +66,6 @@ function __construct($name, $type=null, $precision=null, $unsigned=null, $notnul function setAttributes($type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $enum=null, $enumvalues=null, $default=null, $previous=null) { debugging('XMLDBField->setAttributes() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_field->set_attributes() instead.', DEBUG_DEVELOPER); - if ($enum) { - debugging('Also, ENUMs support has been dropped in Moodle 2.0. Your fields specs are incorrect because you are trying to introduce one new ENUM. Created DB estructures will ignore that.'); - } return $this->set_attributes($type, $precision, $unsigned, $notnull, $sequence, $default, $previous); } @@ -80,7 +75,7 @@ function setAttributes($type, $precision=null, $unsigned=null, $notnull=null, $s * Set all the attributes of one xmldb_field * * @param string type XMLDB_TYPE_INTEGER, XMLDB_TYPE_NUMBER, XMLDB_TYPE_CHAR, XMLDB_TYPE_TEXT, XMLDB_TYPE_BINARY - * @param string precision length for integers and chars, two-comma separated numbers for numbers and 'small', 'medium', 'big' for texts and binaries + * @param string precision length for integers and chars, two-comma separated numbers for numbers * @param string unsigned XMLDB_UNSIGNED or null (or false) * @param string notnull XMLDB_NOTNULL or null (or false) * @param string sequence XMLDB_SEQUENCE or null (or false) @@ -98,11 +93,15 @@ function set_attributes($type, $precision=null, $unsigned=null, $notnull=null, $ $this->decimals = trim($precisionarr[1]); } $this->precision = $type; - $this->unsigned = !empty($unsigned) ? true : false; $this->notnull = !empty($notnull) ? true : false; $this->sequence = !empty($sequence) ? true : false; $this->setDefault($default); + if ($this->type == XMLDB_TYPE_BINARY || $this->type == XMLDB_TYPE_TEXT) { + $this->length = null; + $this->decimals = null; + } + $this->previous = $previous; } @@ -136,9 +135,10 @@ function getNotNull() { /** * Get the unsigned + * @deprecated since moodle 2.3 */ function getUnsigned() { - return $this->unsigned; + return false; } /** @@ -178,9 +178,9 @@ function setDecimals($decimals) { /** * Set the field unsigned + * @deprecated since moodle 2.3 */ function setUnsigned($unsigned=true) { - $this->unsigned = $unsigned; } /** @@ -229,7 +229,7 @@ function arr2xmldb_field($xmlarr) { /// print_object ($GLOBALS['traverse_array']); //Debug /// $GLOBALS['traverse_array']=""; //Debug - /// Process table attributes (name, type, length, unsigned, + /// Process table attributes (name, type, length /// notnull, sequence, decimals, comment, previous, next) if (isset($xmlarr['@']['NAME'])) { $this->name = trim($xmlarr['@']['NAME']); @@ -271,37 +271,15 @@ function arr2xmldb_field($xmlarr) { $result = false; } } - /// Check for big, medium, small to be applied to text and binary + /// Remove length from text and binary if ($this->type == XMLDB_TYPE_TEXT || $this->type == XMLDB_TYPE_BINARY) { - if (!$length) { - $length == 'big'; - } - if ($length != 'big' && - $length != 'medium' && - $length != 'small') { - $this->errormsg = 'Incorrect LENGTH attribute for text and binary fields (only big, medium and small allowed)'; - $this->debug($this->errormsg); - $result = false; - } + $length = null; } /// Finally, set the length $this->length = $length; } - if (isset($xmlarr['@']['UNSIGNED'])) { - $unsigned = strtolower(trim($xmlarr['@']['UNSIGNED'])); - if ($unsigned == 'true') { - $this->unsigned = true; - } else if ($unsigned == 'false') { - $this->unsigned = false; - } else { - $this->errormsg = 'Incorrect UNSIGNED attribute (true/false allowed)'; - $this->debug($this->errormsg); - $result = false; - } - } - if (isset($xmlarr['@']['NOTNULL'])) { $notnull = strtolower(trim($xmlarr['@']['NOTNULL'])); if ($notnull == 'true') { @@ -375,15 +353,6 @@ function arr2xmldb_field($xmlarr) { $this->next = trim($xmlarr['@']['NEXT']); } - /// TODO: Drop this check in Moodle 2.1 - /// Detect if there is old enum information in the XML file - if (isset($xmlarr['@']['ENUM']) && isset($xmlarr['@']['ENUMVALUES'])) { - $this->hasenums = true; - if ($xmlarr['@']['ENUM'] == 'true') { - $this->hasenumsenabled = true; - } - } - /// Set some attributes if ($result) { $this->loaded = true; @@ -470,7 +439,7 @@ function calculateHash($recursive = false) { $this->hash = NULL; } else { $key = $this->name . $this->type . $this->length . - $this->unsigned . $this->notnull . $this->sequence . + $this->notnull . $this->sequence . $this->decimals . $this->comment; $this->hash = md5($key); } @@ -492,16 +461,6 @@ function xmlOutput() { $notnull = 'false'; } $o.= ' NOTNULL="' . $notnull . '"'; - if ($this->type == XMLDB_TYPE_INTEGER || - $this->type == XMLDB_TYPE_NUMBER || - $this->type == XMLDB_TYPE_FLOAT) { - if ($this->unsigned) { - $unsigned = 'true'; - } else { - $unsigned = 'false'; - } - $o.= ' UNSIGNED="' . $unsigned . '"'; - } if (!$this->sequence && $this->default !== NULL) { $o.= ' DEFAULT="' . $this->default . '"'; } @@ -586,36 +545,10 @@ function setFromADOField($adofield) { $this->length = $adofield->max_length; } if ($this->type == XMLDB_TYPE_TEXT) { - switch (strtolower($adofield->type)) { - case 'tinytext': - case 'text': - $this->length = 'small'; - break; - case 'mediumtext': - $this->length = 'medium'; - break; - case 'longtext': - $this->length = 'big'; - break; - default: - $this->length = 'small'; - } + $this->length = null; } if ($this->type == XMLDB_TYPE_BINARY) { - switch (strtolower($adofield->type)) { - case 'tinyblob': - case 'blob': - $this->length = 'small'; - break; - case 'mediumblob': - $this->length = 'medium'; - break; - case 'longblob': - $this->length = 'big'; - break; - default: - $this->length = 'small'; - } + $this->length = null; } /// Calculate the decimals of the field if ($adofield->max_length > 0 && @@ -624,13 +557,6 @@ function setFromADOField($adofield) { $this->type == XMLDB_TYPE_FLOAT)) { $this->decimals = $adofield->scale; } - /// Calculate the unsigned field - if ($adofield->unsigned && - ($this->type == XMLDB_TYPE_INTEGER || - $this->type == XMLDB_TYPE_NUMBER || - $this->type == XMLDB_TYPE_FLOAT)) { - $this->unsigned = true; - } /// Calculate the notnull field if ($adofield->not_null) { $this->notnull = true; @@ -642,8 +568,6 @@ function setFromADOField($adofield) { /// Calculate the sequence field if ($adofield->auto_increment) { $this->sequence = true; - /// Sequence fields are always unsigned - $this->unsigned = true; } /// Some more fields $this->loaded = true; @@ -696,14 +620,8 @@ function getPHP($includeprevious=true) { } else { $result .= 'null, '; } - /// Unsigned (only applicable to numbers) - $unsigned = $this->getUnsigned(); - if (!empty($unsigned) && - ($this->getType() == XMLDB_TYPE_INTEGER || $this->getType() == XMLDB_TYPE_NUMBER || $this->getType() == XMLDB_TYPE_FLOAT)) { - $result .= 'XMLDB_UNSIGNED' . ', '; - } else { - $result .= 'null, '; - } + /// Unsigned is not used any more since Moodle 2.3 + $result .= 'null, '; /// Not Null $notnull = $this->getNotnull(); if (!empty($notnull)) { @@ -761,20 +679,6 @@ function readableInfo() { $o .= ')'; } } - if ($this->type == XMLDB_TYPE_TEXT || - $this->type == XMLDB_TYPE_BINARY) { - $o .= ' (' . $this->length . ')'; - } - /// unsigned - if ($this->type == XMLDB_TYPE_INTEGER || - $this->type == XMLDB_TYPE_NUMBER || - $this->type == XMLDB_TYPE_FLOAT) { - if ($this->unsigned) { - $o .= ' unsigned'; - } else { - $o .= ' signed'; - } - } /// not null if ($this->notnull) { $o .= ' not null'; diff --git a/lib/xmldb/xmldb_table.php b/lib/xmldb/xmldb_table.php index ed77de8832332..2267a7558c279 100644 --- a/lib/xmldb/xmldb_table.php +++ b/lib/xmldb/xmldb_table.php @@ -709,9 +709,6 @@ function xmlOutput() { function addFieldInfo($name, $type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $enum=null, $enumvalues=null, $default=null, $previous=null) { debugging('XMLDBTable->addFieldInfo() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_table->add_field() instead', DEBUG_DEVELOPER); - if ($enum) { - debugging('Also, ENUMs support has been dropped in Moodle 2.0. Your fields specs are incorrect because you are trying to introduce one new ENUM. Created DB estructures will ignore that.'); - } return $this->add_field($name, $type, $precision, $unsigned, $notnull, $sequence, $default, $previous); @@ -724,7 +721,7 @@ function addFieldInfo($name, $type, $precision=null, $unsigned=null, $notnull=nu * * @param string name name of the field * @param string type XMLDB_TYPE_INTEGER, XMLDB_TYPE_NUMBER, XMLDB_TYPE_CHAR, XMLDB_TYPE_TEXT, XMLDB_TYPE_BINARY - * @param string precision length for integers and chars, two-comma separated numbers for numbers and 'small', 'medium', 'big' for texts and binaries + * @param string precision length for integers and chars, two-comma separated numbers for numbers * @param string unsigned XMLDB_UNSIGNED or null (or false) * @param string notnull XMLDB_NOTNULL or null (or false) * @param string sequence XMLDB_SEQUENCE or null (or false) diff --git a/lib/yui/formchangechecker/formchangechecker.js b/lib/yui/formchangechecker/formchangechecker.js new file mode 100644 index 0000000000000..dc819aaaf71d9 --- /dev/null +++ b/lib/yui/formchangechecker/formchangechecker.js @@ -0,0 +1,173 @@ +YUI.add('moodle-core-formchangechecker', + function(Y) { + // The CSS selectors we use + var CSS = { + }; + + var FORMCHANGECHECKERNAME = 'core-formchangechecker'; + + var FORMCHANGECHECKER = function() { + FORMCHANGECHECKER.superclass.constructor.apply(this, arguments); + } + + Y.extend(FORMCHANGECHECKER, Y.Base, { + /** + * Initialize the module + */ + initializer : function(config) { + var formid = 'form#' + this.get('formid'); + + // Add change events to the form elements + Y.all(formid + ' input').once('change', M.core_formchangechecker.set_form_changed, this); + Y.all(formid + ' textarea').once('change', M.core_formchangechecker.set_form_changed, this); + Y.all(formid + ' select').once('change', M.core_formchangechecker.set_form_changed, this); + + // Add a focus event to check for changes which are made without triggering a change event + Y.all(formid + ' input').on('focus', this.store_initial_value, this); + Y.all(formid + ' textarea').on('focus', this.store_initial_value, this); + Y.all(formid + ' select').on('focus', this.store_initial_value, this); + + // We need any submit buttons on the form to set the submitted flag + Y.one(formid).on('submit', M.core_formchangechecker.set_form_submitted, this); + + // YUI doesn't support onbeforeunload properly so we must use the DOM to set the onbeforeunload. As + // a result, the has_changed must stay in the DOM too + window.onbeforeunload = M.core_formchangechecker.report_form_dirty_state; + }, + + /** + * Store the initial value of the currently focussed element + * + * If an element has been focussed and changed but not yet blurred, the on change + * event won't be fired. We need to store it's initial value to compare it in the + * get_form_dirty_state function later. + */ + store_initial_value : function(e) { + if (M.core_formchangechecker.get_form_dirty_state()) { + // Clear the store_initial_value listeners as the form is already dirty so + // we no longer need to call this function + var formid = 'form#' + this.get('formid'); + + Y.all(formid + ' input').detach('focus', this.store_initial_value, this); + Y.all(formid + ' textarea').detach('focus', this.store_initial_value, this); + Y.all(formid + ' select').detach('focus', this.store_initial_value, this); + return; + } + + // Make a note of the current element so that it can be interrogated and + // compared in the get_form_dirty_state function + M.core_formchangechecker.stateinformation.focused_element = { + element : e.target, + initial_value : e.target.get('value') + } + } + }, + { + NAME : FORMCHANGECHECKERNAME, + ATTRS : { + formid : { + 'value' : '' + } + } + } + ); + + M.core_formchangechecker = M.core_formchangechecker || {}; + + // We might have multiple instances of the form change protector + M.core_formchangechecker.instances = M.core_formchangechecker.instances || []; + M.core_formchangechecker.init = function(config) { + var formchangechecker = new FORMCHANGECHECKER(config); + M.core_formchangechecker.instances.push(formchangechecker); + return formchangechecker; + } + + // Store state information + M.core_formchangechecker.stateinformation = []; + + /** + * Set the form changed state to true + */ + M.core_formchangechecker.set_form_changed = function() { + M.core_formchangechecker.stateinformation.formchanged = 1; + + // Once the form has been marked as dirty, we no longer need to keep track of form elements + // which haven't yet blurred + delete M.core_formchangechecker.stateinformation.focused_element; + } + + /** + * Set the form submitted state to true + */ + M.core_formchangechecker.set_form_submitted = function() { + M.core_formchangechecker.stateinformation.formsubmitted = 1; + } + + /** + * Attempt to determine whether the form has been modified in any way and + * is thus 'dirty' + * + * @return Integer 1 is the form is dirty; 0 if not + */ + M.core_formchangechecker.get_form_dirty_state = function() { + var state = M.core_formchangechecker.stateinformation; + + // If the form was submitted, then return a non-dirty state + if (state.formsubmitted) { + return 0; + } + + // If any fields have been marked dirty, return a dirty state + if (state.formchanged) { + return 1; + } + + // If a field has been focused and changed, but still has focus then the browser won't fire the + // onChange event. We check for this eventuality here + if (state.focused_element) { + if (state.focused_element.element.get('value') != state.focused_element.initial_value) { + return 1; + } + } + + // Handle TinyMCE editor instances + // We can't add a listener in the initializer as the editors may not have been created by that point + // so we do so here instead + if (typeof tinyMCE != 'undefined') { + for (var editor in tinyMCE.editors) { + if (tinyMCE.editors[editor].isDirty()) { + return 1; + } + } + } + + // If we reached here, then the form hasn't met any of the dirty conditions + return 0; + }; + + /** + * Return a suitable message if changes have been made to a form + */ + M.core_formchangechecker.report_form_dirty_state = function(e) { + if (!M.core_formchangechecker.get_form_dirty_state()) { + // the form is not dirty, so don't display any message + return; + } + + // This is the error message that we'll show to browsers which support it + var warningmessage = M.util.get_string('changesmadereallygoaway', 'moodle'); + + // Most browsers are happy with the returnValue being set on the event + // But some browsers do not consistently pass the event + if (e) { + e.returnValue = warningmessage; + } + + // But some require it to be returned instead + return warningmessage; + }; + }, + '@VERSION@', { + requires : ['base'] + } +); diff --git a/lib/yui/formslib/formslib.js b/lib/yui/formslib/formslib.js deleted file mode 100644 index 452b9e3dfcbe7..0000000000000 --- a/lib/yui/formslib/formslib.js +++ /dev/null @@ -1,59 +0,0 @@ -YUI.add('moodle-core-formslib', - function(Y) { - // The CSS selectors we use - var CSS = { - }; - - var FORMSLIBNAME = 'core-formslib'; - - var FORMSLIB = function() { - FORMSLIB.superclass.constructor.apply(this, arguments); - } - - Y.extend(FORMSLIB, Y.Base, { - /** - * Initialize the module - */ - initializer : function(config) { - var formid = 'form#' + this.get('formid'); - - // Add change events to the form elements - Y.all(formid + ' input').on('change', M.util.set_form_changed, this); - Y.all(formid + ' textarea').on('change', M.util.set_form_changed, this); - Y.all(formid + ' select').on('change', M.util.set_form_changed, this); - - // We need any submit buttons on the form to set the submitted flag - Y.one(formid).on('submit', M.util.set_form_submitted, this); - - // YUI doesn't support onbeforeunload properly so we must use the DOM to set the onbeforeunload. As - // a result, the has_changed must stay in the DOM too - window.onbeforeunload = M.util.report_form_dirty_state; - }, - - /** - * Unset the form dirty state and also set the form submitted flag to true - */ - unset_changed : function(e) { - M.util.set_form_changed(); - } - }, - { - NAME : FORMSLIBNAME, - ATTRS : { - formid : { - 'value' : '' - } - } - } - ); - - M.core = M.core || {}; - M.core.init_formslib = function(config) { - return new FORMSLIB(config); - } - - }, - '@VERSION@', { - requires : ['base'] - } -); diff --git a/login/forgot_password.php b/login/forgot_password.php index f5fc673d1c791..807cbc3ed57bb 100644 --- a/login/forgot_password.php +++ b/login/forgot_password.php @@ -126,7 +126,7 @@ // first try the username if (!empty($data->username)) { - $username = textlib_get_instance()->strtolower($data->username); // mimic the login page process, if they forget username they need to use email for reset + $username = textlib::strtolower($data->username); // mimic the login page process, if they forget username they need to use email for reset $user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0, 'suspended'=>0)); } else { diff --git a/login/forgot_password_form.php b/login/forgot_password_form.php index 1a6e441434b3a..fbbfec8de53f7 100644 --- a/login/forgot_password_form.php +++ b/login/forgot_password_form.php @@ -39,7 +39,7 @@ function definition() { $mform->setType('username', PARAM_RAW); $submitlabel = get_string('search'); - $mform->addElement('submit', 'submitbutton', $submitlabel); + $mform->addElement('submit', 'submitbuttonusername', $submitlabel); $mform->addElement('header', '', get_string('searchbyemail'), ''); @@ -47,7 +47,7 @@ function definition() { $mform->setType('email', PARAM_RAW); $submitlabel = get_string('search'); - $mform->addElement('submit', 'submitbutton', $submitlabel); + $mform->addElement('submit', 'submitbuttonemail', $submitlabel); } function validation($data, $files) { diff --git a/login/index.php b/login/index.php index faa3d9f4624ed..3f398a4c0fa16 100644 --- a/login/index.php +++ b/login/index.php @@ -113,7 +113,7 @@ if ($frm and isset($frm->username)) { // Login WITH cookies - $frm->username = trim(moodle_strtolower($frm->username)); + $frm->username = trim(textlib::strtolower($frm->username)); if (is_enabled_auth('none') ) { if ($frm->username !== clean_param($frm->username, PARAM_USERNAME)) { diff --git a/login/index_form.html b/login/index_form.html index 3455a544fe1c7..1765064cd10e7 100644 --- a/login/index_form.html +++ b/login/index_form.html @@ -47,12 +47,14 @@

    /> " /> +
    rememberusername) and $CFG->rememberusername == 2) { ?> -
    username) {echo 'checked="checked"';} ?> />
    -
    +
    + username) {echo 'checked="checked"';} ?> /> + +
    -
    diff --git a/login/signup_form.php b/login/signup_form.php index ed1e73cf34157..ec230c1be6bcd 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -129,7 +129,7 @@ function validation($data, $files) { $errors['username'] = get_string('usernameexists'); } else { //check allowed characters - if ($data['username'] !== moodle_strtolower($data['username'])) { + if ($data['username'] !== textlib::strtolower($data['username'])) { $errors['username'] = get_string('usernamelowercase'); } else { if ($data['username'] !== clean_param($data['username'], PARAM_USERNAME)) { @@ -182,6 +182,10 @@ function validation($data, $files) { $errors['recaptcha'] = get_string('missingrecaptchachallengefield'); } } + // Validate customisable profile fields. (profile_validation expects an object as the parameter with userid set) + $dataobject = (object)$data; + $dataobject->id = 0; + $errors += profile_validation($dataobject, $files); return $errors; diff --git a/login/token.php b/login/token.php index edcc829e7f0f6..adfe1d4175d28 100644 --- a/login/token.php +++ b/login/token.php @@ -35,7 +35,7 @@ if (!$CFG->enablewebservices) { throw new moodle_exception('enablewsdescription', 'webservice'); } -$username = trim(moodle_strtolower($username)); +$username = trim(textlib::strtolower($username)); if (is_restored_user($username)) { throw new moodle_exception('restoredaccountresetpassword', 'webservice'); } diff --git a/message/index.php b/message/index.php index 03995db3bb048..85c114e62c6b3 100644 --- a/message/index.php +++ b/message/index.php @@ -115,8 +115,14 @@ } unset($user2id); -//the current user isnt involved in this discussion at all -if ($user1->id != $USER->id && (!empty($user2) && $user2->id != $USER->id) && !has_capability('moodle/site:readallmessages', $context)) { +// Is the user involved in the conversation? +// Do they have the ability to read other user's conversations? +// There will always be a $user1 +// but $user2 may be null. For example, if viewing $user1's recent conversations +if ($user1->id != $USER->id + && (empty($user2) || $user2->id != $USER->id) + && !has_capability('moodle/site:readallmessages', $context)){ + print_error('accessdenied','admin'); } diff --git a/message/lib.php b/message/lib.php index 7eb339ea653df..c3801e1fc0cc4 100644 --- a/message/lib.php +++ b/message/lib.php @@ -470,7 +470,6 @@ function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $ */ function message_print_usergroup_selector($viewing, $courses, $coursecontexts, $countunreadtotal, $countblocked, $strunreadmessages) { $options = array(); - $textlib = textlib_get_instance(); // going to use textlib services if ($countunreadtotal>0) { //if there are unread messages $options[MESSAGE_VIEW_UNREAD_MESSAGES] = $strunreadmessages; @@ -489,8 +488,8 @@ function message_print_usergroup_selector($viewing, $courses, $coursecontexts, $ if (has_capability('moodle/course:viewparticipants', $coursecontexts[$course->id])) { //Not using short_text() as we want the end of the course name. Not the beginning. $shortname = format_string($course->shortname, true, array('context' => $coursecontexts[$course->id])); - if ($textlib->strlen($shortname) > MESSAGE_MAX_COURSE_NAME_LENGTH) { - $courses_options[MESSAGE_VIEW_COURSE.$course->id] = '...'.$textlib->substr($shortname, -MESSAGE_MAX_COURSE_NAME_LENGTH); + if (textlib::strlen($shortname) > MESSAGE_MAX_COURSE_NAME_LENGTH) { + $courses_options[MESSAGE_VIEW_COURSE.$course->id] = '...'.textlib::substr($shortname, -MESSAGE_MAX_COURSE_NAME_LENGTH); } else { $courses_options[MESSAGE_VIEW_COURSE.$course->id] = $shortname; } @@ -1529,6 +1528,11 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none' /// global $CFG, $USER, $DB; + // If user is searching all messages check they are allowed to before doing anything else + if ($courseid == SITEID && !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { + print_error('accessdenied','admin'); + } + /// If no userid sent then assume current user if ($userid == 0) $userid = $USER->id; @@ -2036,26 +2040,6 @@ function message_post_message($userfrom, $userto, $message, $format) { return message_send($eventdata); } - -/** - * Returns a list of all user ids who have used messaging in the site - * This was the simple way to code the SQL ... is it going to blow up - * on large datasets? - * - * @deprecated To be deleted in 2.2 MDL-31709 - * @return array - */ -function message_get_participants() { - global $CFG, $DB; - - return $DB->get_records_sql("SELECT useridfrom as id,1 FROM {message} - UNION SELECT useridto as id,1 FROM {message} - UNION SELECT useridfrom as id,1 FROM {message_read} - UNION SELECT useridto as id,1 FROM {message_read} - UNION SELECT userid as id,1 FROM {message_contacts} - UNION SELECT contactid as id,1 from {message_contacts}"); -} - /** * Print a row of contactlist displaying user picture, messages waiting and * block links etc diff --git a/mnet/service/enrol/db/install.xml b/mnet/service/enrol/db/install.xml index d32a01c49a667..92f5903cd6198 100644 --- a/mnet/service/enrol/db/install.xml +++ b/mnet/service/enrol/db/install.xml @@ -1,24 +1,24 @@ - - - - - + + + + - + - - - - + + + + @@ -30,12 +30,12 @@
    - - - - + + + + - + diff --git a/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php b/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php index bbd5a62cf6f17..f2e72686d8465 100644 --- a/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php +++ b/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php @@ -16,38 +16,41 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_assignment_activity_task class + * + * @package mod_assignment + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/assignment/backup/moodle2/backup_assignment_stepslib.php'); // Because it exists (must) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot.'/mod/assignment/backup/moodle2/backup_assignment_stepslib.php'); /** - * assignment backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Assignment instance */ class backup_assignment_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the assignment.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_assignment_activity_structure_step('assignment_structure', 'assignment.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/assignment/db/access.php b/mod/assignment/db/access.php index ab32ec445ddb2..3c39187673c22 100644 --- a/mod/assignment/db/access.php +++ b/mod/assignment/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Plugin capabilities + * + * @package mod_assignment + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/assignment/db/events.php b/mod/assignment/db/events.php index 7234b30e43053..265538273df09 100644 --- a/mod/assignment/db/events.php +++ b/mod/assignment/db/events.php @@ -1,30 +1,27 @@ . -/////////////////////////////////////////////////////////////////////////// -// Defines core event handlers // -/////////////////////////////////////////////////////////////////////////// -// // -// NOTICE OF COPYRIGHT // -// // -// Moodle - Modular Object-Oriented Dynamic Learning Environment // -// http://moodle.org // -// // -// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com // -// // -// This program 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. // -// // -// This program 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: // -// // -// http://www.gnu.org/copyleft/gpl.html // -// // -/////////////////////////////////////////////////////////////////////////// - +/** + * Definition of assignment event handlers + * + * @package mod_assignment + * @category event + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ $handlers = array(); diff --git a/mod/assignment/db/install.xml b/mod/assignment/db/install.xml index 26bf60ceaaa45..be9ea8176cb22 100644 --- a/mod/assignment/db/install.xml +++ b/mod/assignment/db/install.xml @@ -1,30 +1,30 @@ -
    - - + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -35,20 +35,20 @@
    - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 09152c7783b31..5b1fa8d4d20b6 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1411,6 +1411,7 @@ function display_submissions($message='') { $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); + $strview = get_string('view'); $grademenu = make_grades_menu($this->assignment->grade); if ($ausers !== false) { @@ -1527,6 +1528,9 @@ function display_submissions($message='') { } $buttontext = ($auser->status == 1) ? $strupdate : $strgrade; + if ($final_grade->locked or $final_grade->overridden) { + $buttontext = $strview; + } ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id='.$this->cm->id @@ -1882,13 +1886,29 @@ function get_submissions($sort='', $dir='DESC') { } /** - * Counts all real assignment submissions by ENROLLED students (not empty ones) + * Counts all complete (real) assignment submissions by enrolled students * - * @param int $groupid optional If nonzero then count is restricted to this group - * @return int The number of submissions + * @param int $groupid (optional) If nonzero then count is restricted to this group + * @return int The number of submissions */ function count_real_submissions($groupid=0) { - return assignment_count_real_submissions($this->cm, $groupid); + global $CFG; + global $DB; + + // Grab the context assocated with our course module + $context = get_context_instance(CONTEXT_MODULE, $this->cm->id); + + // Get ids of users enrolled in the given course. + list($enroledsql, $params) = get_enrolled_sql($context, 'mod/assignment:view', $groupid); + $params['assignmentid'] = $this->cm->instance; + + // Get ids of users enrolled in the given course. + return $DB->count_records_sql("SELECT COUNT('x') + FROM {assignment_submissions} s + LEFT JOIN {assignment} a ON a.id = s.assignment + INNER JOIN ($enroledsql) u ON u.id = s.userid + WHERE s.assignment = :assignmentid AND + s.timemodified > 0", $params); } /** @@ -3047,12 +3067,14 @@ function assignment_get_participants($assignmentid) { /** * Serves assignment submissions and other files. * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_assignment + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - just send the file */ function assignment_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { @@ -3472,44 +3494,38 @@ function assignment_get_unmailed_submissions($starttime, $endtime) { } /** - * Counts all real assignment submissions by ENROLLED students (not empty ones) + * Counts all complete (real) assignment submissions by enrolled students for the given course modeule. * - * There are also assignment type methods count_real_submissions() which in the default - * implementation simply call this function. - * @param $groupid int optional If nonzero then count is restricted to this group - * @return int The number of submissions + * @deprecated Since Moodle 2.2 MDL-abc - Please do not use this function any more. + * @param cm_info $cm The course module that we wish to perform the count on. + * @param int $groupid (optional) If nonzero then count is restricted to this group + * @return int The number of submissions */ function assignment_count_real_submissions($cm, $groupid=0) { global $CFG, $DB; - $context = get_context_instance(CONTEXT_MODULE, $cm->id); + // Grab the assignment type for the given course module + $assignmenttype = $DB->get_field($cm->modname, 'assignmenttype', array('id' => $cm->instance), MUST_EXIST); - // this is all the users with this capability set, in this context or higher - if ($users = get_enrolled_users($context, 'mod/assignment:view', $groupid, 'u.id')) { - $users = array_keys($users); - } + // Create the expected class file path and class name for the returned assignemnt type + $filename = "{$CFG->dirroot}/mod/assignment/type/{$assignmenttype}/assignment.class.php"; + $classname = "assignment_{$assignmenttype}"; - // if groupmembersonly used, remove users who are not in any group - if ($users and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) { - if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) { - $users = array_intersect($users, array_keys($groupingusers)); - } + // If the file exists and the class is not already loaded we require the class file + if (file_exists($filename) && !class_exists($classname)) { + require_once($filename); } - - if (empty($users)) { - return 0; + // If the required class is still not loaded then we revert to assignment base + if (!class_exists($classname)) { + $classname = 'assignment_base'; } + $instance = new $classname; - $userlists = implode(',', $users); - - return $DB->count_records_sql("SELECT COUNT('x') - FROM {assignment_submissions} - WHERE assignment = ? AND - timemodified > 0 AND - userid IN ($userlists)", array($cm->instance)); + // Attach the course module to the assignment type instance and then call the method for counting submissions + $instance->cm = $cm; + return $instance->count_real_submissions($groupid); } - /** * Return all assignment submissions by ENROLLED students (even empty) * @@ -3610,6 +3626,7 @@ function assignment_types() { function assignment_print_overview($courses, &$htmlarray) { global $USER, $CFG, $DB; + require_once($CFG->libdir.'/gradelib.php'); if (empty($courses) || !is_array($courses) || count($courses) == 0) { return array(); @@ -3678,6 +3695,9 @@ function assignment_print_overview($courses, &$htmlarray) { assignment $sqlassignmentids", array_merge(array($USER->id), $assignmentidparams)); foreach ($assignments as $assignment) { + $grading_info = grade_get_grades($assignment->course, 'mod', 'assignment', $assignment->id, $USER->id); + $final_grade = $grading_info->items[0]->grades[$USER->id]; + $str = '
    '.$strassignment. ': '. 'visible ? '':' class="dimmed"'). 'title="'.$strassignment.'" href="'.$CFG->wwwroot. @@ -3711,9 +3731,9 @@ function assignment_print_overview($courses, &$htmlarray) { $submission = $mysubmissions[$assignment->id]; - if ($submission->teacher == 0 && $submission->timemarked == 0) { + if ($submission->teacher == 0 && $submission->timemarked == 0 && !$final_grade->grade) { $str .= $strsubmitted . ', ' . $strnotgradedyet; - } else if ($submission->grade <= 0) { + } else if ($submission->grade <= 0 && !$final_grade->grade) { $str .= $strsubmitted . ', ' . $strreviewed; } else { $str .= $strsubmitted . ', ' . $strgraded; @@ -3950,10 +3970,12 @@ function assignment_pack_files($filesforzipping) { /** * Lists all file areas current user may browse * - * @param object $course - * @param object $cm - * @param object $context - * @return array + * @package mod_assignment + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @return array available file areas */ function assignment_get_file_areas($course, $cm, $context) { $areas = array(); diff --git a/mod/assignment/type/upload/assignment.class.php b/mod/assignment/type/upload/assignment.class.php index 16818c1134deb..117ebf4cb85d8 100644 --- a/mod/assignment/type/upload/assignment.class.php +++ b/mod/assignment/type/upload/assignment.class.php @@ -113,9 +113,6 @@ function view_feedback($submission=NULL) { $userid = $submission->userid; } - if (empty($submission->timemarked)) { /// Nothing to show, so print nothing - return; - } // Check the user can submit $canviewfeedback = ($userid == $USER->id && has_capability('mod/assignment:submit', $this->context, $USER->id, false)); // If not then check if the user still has the view cap and has a previous submission @@ -396,6 +393,33 @@ function process_feedback() { parent::process_feedback($mform); } + /** + * Counts all complete (real) assignment submissions by enrolled students. This overrides assignment_base::count_real_submissions(). + * This is necessary for advanced file uploads where we need to check that the data2 field is equal to "submitted" to determine + * if a submission is complete. + * + * @param int $groupid (optional) If nonzero then count is restricted to this group + * @return int The number of submissions + */ + function count_real_submissions($groupid=0) { + global $DB; + + // Grab the context assocated with our course module + $context = get_context_instance(CONTEXT_MODULE, $this->cm->id); + + // Get ids of users enrolled in the given course. + list($enroledsql, $params) = get_enrolled_sql($context, 'mod/assignment:view', $groupid); + $params['assignmentid'] = $this->cm->instance; + + // Get ids of users enrolled in the given course. + return $DB->count_records_sql("SELECT COUNT('x') + FROM {assignment_submissions} s + LEFT JOIN {assignment} a ON a.id = s.assignment + INNER JOIN ($enroledsql) u ON u.id = s.userid + WHERE s.assignment = :assignmentid AND + s.data2 = 'submitted'", $params); + } + function print_responsefiles($userid, $return=false) { global $CFG, $USER, $OUTPUT, $PAGE; @@ -422,7 +446,6 @@ function print_responsefiles($userid, $return=false) { echo $output; } - /** * Upload files * upload_file function requires moodle form instance and file manager options diff --git a/mod/assignment/type/uploadsingle/assignment.class.php b/mod/assignment/type/uploadsingle/assignment.class.php index bc2abe3796d42..08cd006846825 100644 --- a/mod/assignment/type/uploadsingle/assignment.class.php +++ b/mod/assignment/type/uploadsingle/assignment.class.php @@ -92,7 +92,6 @@ function view() { $this->view_footer(); } - function process_feedback() { if (!$feedback = data_submitted() or !confirm_sesskey()) { // No incoming data? return false; @@ -101,7 +100,34 @@ function process_feedback() { $offset = required_param('offset', PARAM_INT); $mform = $this->display_submission($offset, $userid, false); parent::process_feedback($mform); - } + } + + /** + * Counts all complete (real) assignment submissions by enrolled students. This overrides assignment_base::count_real_submissions(). + * This is necessary for simple file uploads where we need to check that the numfiles field is greater than zero to determine if a + * submission is complete. + * + * @param int $groupid (optional) If nonzero then count is restricted to this group + * @return int The number of submissions + */ + function count_real_submissions($groupid=0) { + global $DB; + + // Grab the context assocated with our course module + $context = get_context_instance(CONTEXT_MODULE, $this->cm->id); + + // Get ids of users enrolled in the given course. + list($enroledsql, $params) = get_enrolled_sql($context, 'mod/assignment:view', $groupid); + $params['assignmentid'] = $this->cm->instance; + + // Get ids of users enrolled in the given course. + return $DB->count_records_sql("SELECT COUNT('x') + FROM {assignment_submissions} s + LEFT JOIN {assignment} a ON a.id = s.assignment + INNER JOIN ($enroledsql) u ON u.id = s.userid + WHERE s.assignment = :assignmentid AND + s.numfiles > 0", $params); + } function print_responsefiles($userid, $return=false) { global $CFG, $USER, $OUTPUT, $PAGE; @@ -155,7 +181,6 @@ function view_upload_form() { echo $OUTPUT->box_end(); } - function upload($mform) { $action = required_param('action', PARAM_ALPHA); switch ($action) { @@ -434,4 +459,4 @@ function definition() { // buttons $this->add_action_buttons(false, get_string('uploadthisfile')); } -} \ No newline at end of file +} diff --git a/mod/chat/backup/moodle2/backup_chat_activity_task.class.php b/mod/chat/backup/moodle2/backup_chat_activity_task.class.php index 99703ce63f7f4..ca28c630da905 100644 --- a/mod/chat/backup/moodle2/backup_chat_activity_task.class.php +++ b/mod/chat/backup/moodle2/backup_chat_activity_task.class.php @@ -16,56 +16,41 @@ // along with Moodle. If not, see . /** - * This is the "graphical" structure of the chat mod: + * Defines backup_chat_activity_task class * - * chat - * (CL,pk->id) - * | - * | - * | - * chat_messages - * (UL,pk->id, fk->chatid) - * - * Meaning: pk->primary key field of the table - * fk->foreign key to link with parent - * nt->nested field (recursive data) - * CL->course level info - * UL->user level info - * - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_chat + * @category backup + * @copyright 2010 onwards Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/chat/backup/moodle2/backup_chat_stepslib.php'); // Because it exists (must) + +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/chat/backup/moodle2/backup_chat_stepslib.php'); /** - * chat backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Chat instance */ class backup_chat_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the chat.xml file */ protected function define_my_steps() { - // chat only has one structure step $this->add_step(new backup_chat_activity_structure_step('chat_structure', 'chat.xml')); } /** - * Code the transformations to perform in the chat activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts * - * @param string $content - * @return string + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/chat/db/access.php b/mod/chat/db/access.php index 893bb2c4f5a45..2d6e5d0217539 100644 --- a/mod/chat/db/access.php +++ b/mod/chat/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities - +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Plugin capabilities + * + * @package mod_chat + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/chat/db/events.php b/mod/chat/db/events.php index 9203d970273ca..a33062fff2212 100644 --- a/mod/chat/db/events.php +++ b/mod/chat/db/events.php @@ -1,5 +1,4 @@ - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /* List of handlers */ diff --git a/mod/chat/db/install.xml b/mod/chat/db/install.xml index df6e4b461030a..c83bcc41b2fba 100644 --- a/mod/chat/db/install.xml +++ b/mod/chat/db/install.xml @@ -1,21 +1,21 @@ -
    - - + + - - - - - - - + + + + + + + @@ -26,13 +26,13 @@
    - - - - - - - + + + + + + + @@ -46,13 +46,13 @@
    - - - - - - - + + + + + + + @@ -66,17 +66,17 @@
    - - - - + + + + - - - + + + - + diff --git a/mod/choice/backup/moodle2/backup_choice_activity_task.class.php b/mod/choice/backup/moodle2/backup_choice_activity_task.class.php index b18f89cd64725..5270fbfed0e23 100644 --- a/mod/choice/backup/moodle2/backup_choice_activity_task.class.php +++ b/mod/choice/backup/moodle2/backup_choice_activity_task.class.php @@ -16,39 +16,42 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_choice_activity_task class + * + * @package mod_choice + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/choice/backup/moodle2/backup_choice_stepslib.php'); // Because it exists (must) -require_once($CFG->dirroot . '/mod/choice/backup/moodle2/backup_choice_settingslib.php'); // Because it exists (optional) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/choice/backup/moodle2/backup_choice_stepslib.php'); +require_once($CFG->dirroot . '/mod/choice/backup/moodle2/backup_choice_settingslib.php'); /** - * choice backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Choice instance */ class backup_choice_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the choice.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_choice_activity_structure_step('choice_structure', 'choice.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/choice/db/access.php b/mod/choice/db/access.php index ee7923b34248d..cf3dfb8aee868 100644 --- a/mod/choice/db/access.php +++ b/mod/choice/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Plugin capabilities + * + * @package mod_choice + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/choice/db/install.xml b/mod/choice/db/install.xml index b60d4f44ae307..11a2b4e2884b7 100644 --- a/mod/choice/db/install.xml +++ b/mod/choice/db/install.xml @@ -1,28 +1,28 @@ -
    - - + + - - + + - - - - - - - - - + + + + + + + + + - + @@ -34,11 +34,11 @@
    - - - - - + + + + + @@ -48,12 +48,12 @@
    - - - + + + - - + + diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 6c247c27a69d6..576bb27adc5e6 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -587,29 +587,6 @@ function choice_delete_instance($id) { return $result; } -/** - * Returns the users with data in one choice - * (users with records in choice_responses, students) - * - * @todo: deprecated - to be deleted in 2.2 - * - * @param int $choiceid - * @return array - */ -function choice_get_participants($choiceid) { - global $DB; - - //Get students - $students = $DB->get_records_sql("SELECT DISTINCT u.id, u.id - FROM {user} u, - {choice_answers} a - WHERE a.choiceid = ? AND - u.id = a.userid", array($choiceid)); - - //Return students array (it contains an array of unique users) - return ($students); -} - /** * Returns text string which is the answer that matches the id * diff --git a/mod/data/backup/moodle2/backup_data_activity_task.class.php b/mod/data/backup/moodle2/backup_data_activity_task.class.php index e0802e75b5d49..f19222d64ac4e 100644 --- a/mod/data/backup/moodle2/backup_data_activity_task.class.php +++ b/mod/data/backup/moodle2/backup_data_activity_task.class.php @@ -16,38 +16,41 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_data_activity_task + * + * @package mod_data + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/data/backup/moodle2/backup_data_stepslib.php'); // Because it exists (must) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/data/backup/moodle2/backup_data_stepslib.php'); /** - * data backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Database instance */ class backup_data_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the data.xml file */ protected function define_my_steps() { - // Data only has one structure step $this->add_step(new backup_data_activity_structure_step('data_structure', 'data.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/data/db/access.php b/mod/data/db/access.php index 86fc8d49f9c29..87035f30b1c21 100644 --- a/mod/data/db/access.php +++ b/mod/data/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities - +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Plugin capabilities + * + * @package mod_data + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/data/db/install.xml b/mod/data/db/install.xml index 58f086eb7029d..b782df5e61816 100644 --- a/mod/data/db/install.xml +++ b/mod/data/db/install.xml @@ -1,44 +1,44 @@ -
    - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -49,21 +49,21 @@
    - - + + - - - - - - - - - - - + + + + + + + + + + + @@ -75,13 +75,13 @@
    - - - - - - - + + + + + + + @@ -90,9 +90,9 @@
    - - - + + + diff --git a/mod/data/edit.php b/mod/data/edit.php index e406dc2da8d2c..1f76f8e59f30e 100644 --- a/mod/data/edit.php +++ b/mod/data/edit.php @@ -93,8 +93,23 @@ } } -if ($rid) { // So do you have access? - if (!(has_capability('mod/data:manageentries', $context) or data_isowner($rid)) or !confirm_sesskey() ) { +if ($rid) { + // When editing an existing record, we require the session key + require_sesskey(); +} + +// Get Group information for permission testing and record creation +$currentgroup = groups_get_activity_group($cm); +$groupmode = groups_get_activity_groupmode($cm); + +if (!has_capability('mod/data:manageentries', $context)) { + if ($rid) { + // User is editing an existing record + if (!data_isowner($rid) || data_in_readonly_period($data)) { + print_error('noaccess','data'); + } + } else if (!data_user_can_add_entry($data, $currentgroup, $groupmode, $context)) { + // User is trying to create a new record print_error('noaccess','data'); } } @@ -136,20 +151,6 @@ $PAGE->set_title($data->name); $PAGE->set_heading($course->fullname); -/// Check to see if groups are being used here -$currentgroup = groups_get_activity_group($cm); -$groupmode = groups_get_activity_groupmode($cm); - -if ($currentgroup) { - $groupselect = " AND groupid = '$currentgroup'"; - $groupparam = "&groupid=$currentgroup"; -} else { - $groupselect = ""; - $groupparam = ""; - $currentgroup = 0; -} - - /// Process incoming data for adding/updating records if ($datarecord = data_submitted() and confirm_sesskey()) { @@ -189,21 +190,6 @@ redirect($CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$rid); } else { /// Add some new records - - if (!data_user_can_add_entry($data, $currentgroup, $groupmode, $context)) { - print_error('cannotadd', 'data'); - } - - /// Check if maximum number of entry as specified by this database is reached - /// Of course, you can't be stopped if you are an editting teacher! =) - - if (data_atmaxentries($data) and !has_capability('mod/data:manageentries',$context)){ - echo $OUTPUT->header(); - echo $OUTPUT->notification(get_string('atmaxentry','data')); - echo $OUTPUT->footer(); - exit; - } - ///Empty form checking - you can't submit an empty form! $emptyform = true; // assume the worst @@ -295,6 +281,8 @@ ******************************************/ if ($data->addtemplate){ $possiblefields = $DB->get_records('data_fields', array('dataid'=>$data->id), 'id'); + $patterns = array(); + $replacements = array(); ///then we generate strings to replace foreach ($possiblefields as $eachfield){ diff --git a/mod/data/field/textarea/field.class.php b/mod/data/field/textarea/field.class.php index 6f2db0c2045d4..a15dfb2e3ee0f 100644 --- a/mod/data/field/textarea/field.class.php +++ b/mod/data/field/textarea/field.class.php @@ -28,6 +28,27 @@ class data_field_textarea extends data_field_base { var $type = 'textarea'; + /** + * Returns options for embedded files + * + * @return array + */ + private function get_options() { + if (!isset($this->field->param5)) { + $this->field->param5 = 0; + } + $options = array(); + $options['trusttext'] = false; + $options['forcehttps'] = false; + $options['subdirs'] = false; + $options['maxfiles'] = -1; + $options['context'] = $this->context; + $options['maxbytes'] = $this->field->param5; + $options['changeformat'] = 0; + $options['noclean'] = false; + return $options; + } + function display_add_field($recordid=0) { global $CFG, $DB, $OUTPUT, $PAGE; @@ -37,27 +58,63 @@ function display_add_field($recordid=0) { $str = '
    '; editors_head_setup(); - - $options = array(); - $options['trusttext'] = false; - $options['forcehttps'] = false; - $options['subdirs'] = false; - $options['maxfiles'] = 0; - $options['maxbytes'] = 0; - $options['changeformat'] = 0; - $options['noclean'] = false; + $options = $this->get_options(); $itemid = $this->field->id; $field = 'field_'.$itemid; if ($recordid && $content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))){ - $text = $content->content; $format = $content->content1; - $text = clean_text($text, $format); - } else if (can_use_html_editor()) { - $format = FORMAT_HTML; + $text = clean_text($content->content, $format); + $text = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $text); } else { - $format = FORMAT_PLAIN; + $draftitemid = file_get_unused_draft_itemid(); + if (can_use_html_editor()) { + $format = FORMAT_HTML; + } else { + $format = FORMAT_PLAIN; + } + } + + // get filepicker info + // + $fpoptions = array(); + if ($options['maxfiles'] != 0 ) { + $args = new stdClass(); + // need these three to filter repositories list + $args->accepted_types = array('image'); + $args->return_types = (FILE_INTERNAL | FILE_EXTERNAL); + $args->context = $this->context; + $args->env = 'filepicker'; + // advimage plugin + $image_options = initialise_filepicker($args); + $image_options->context = $this->context; + $image_options->client_id = uniqid(); + $image_options->maxbytes = $options['maxbytes']; + $image_options->env = 'editor'; + $image_options->itemid = $draftitemid; + + // moodlemedia plugin + $args->accepted_types = array('video', 'audio'); + $media_options = initialise_filepicker($args); + $media_options->context = $this->context; + $media_options->client_id = uniqid(); + $media_options->maxbytes = $options['maxbytes']; + $media_options->env = 'editor'; + $media_options->itemid = $draftitemid; + + // advlink plugin + $args->accepted_types = '*'; + $link_options = initialise_filepicker($args); + $link_options->context = $this->context; + $link_options->client_id = uniqid(); + $link_options->maxbytes = $options['maxbytes']; + $link_options->env = 'editor'; + $link_options->itemid = $draftitemid; + + $fpoptions['image'] = $image_options; + $fpoptions['media'] = $media_options; + $fpoptions['link'] = $link_options; } $editor = editors_get_preferred_editor($format); @@ -66,7 +123,8 @@ function display_add_field($recordid=0) { foreach ($formats as $fid) { $formats[$fid] = $strformats[$fid]; } - $editor->use_editor($field, $options); + $editor->use_editor($field, $options, $fpoptions); + $str .= ''; $str .= '
    '; $str .= '
    + + +
    + + +
    diff --git a/mod/data/import_form.php b/mod/data/import_form.php index 7da41db8994f2..ce0bbeeec93ca 100644 --- a/mod/data/import_form.php +++ b/mod/data/import_form.php @@ -21,8 +21,7 @@ function definition() { $mform->addElement('text', 'fieldenclosure', get_string('fieldenclosure', 'data')); - $textlib = textlib_get_instance(); - $choices = $textlib->get_encodings(); + $choices = textlib::get_encodings(); $mform->addElement('select', 'encoding', get_string('encoding', 'admin'), $choices); $mform->setDefault('encoding', 'UTF-8'); diff --git a/mod/data/lib.php b/mod/data/lib.php index c8b52affdb231..ea2e303add680 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1249,6 +1249,9 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r return; } + // Check whether this activity is read-only at present + $readonly = data_in_readonly_period($data); + foreach ($records as $record) { // Might be just one for the single template // Replacing tags @@ -1264,7 +1267,7 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r // Replacing special tags (##Edit##, ##Delete##, ##More##) $patterns[]='##edit##'; $patterns[]='##delete##'; - if (has_capability('mod/data:manageentries', $context) or data_isowner($record->id)) { + if (has_capability('mod/data:manageentries', $context) || (!$readonly && data_isowner($record->id))) { $replacement[] = '
    '.get_string('edit').''; $replacement[] = 'strlen($search) < 2) { + if (textlib::strlen($search) < 2) { $search = ''; } $SESSION->dataprefs[$data->id]['search'] = $search; // Make it sticky diff --git a/mod/feedback/backup/moodle2/backup_feedback_activity_task.class.php b/mod/feedback/backup/moodle2/backup_feedback_activity_task.class.php index 7fd8ceb82fc91..3fd9bdaaeea0e 100644 --- a/mod/feedback/backup/moodle2/backup_feedback_activity_task.class.php +++ b/mod/feedback/backup/moodle2/backup_feedback_activity_task.class.php @@ -1,4 +1,5 @@ . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_feedback_activity_task class + * + * @package mod_feedback + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/feedback/backup/moodle2/backup_feedback_stepslib.php'); // Because it exists (must) -require_once($CFG->dirroot . '/mod/feedback/backup/moodle2/backup_feedback_settingslib.php'); // Because it exists (optional) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/feedback/backup/moodle2/backup_feedback_stepslib.php'); +require_once($CFG->dirroot . '/mod/feedback/backup/moodle2/backup_feedback_settingslib.php'); /** - * feedback backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Feedback instance */ class backup_feedback_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the feedback.xml file */ protected function define_my_steps() { // feedback only has one structure step @@ -46,8 +49,10 @@ protected function define_my_steps() { } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/feedback/db/access.php b/mod/feedback/db/access.php index 9921b2ae5ed9a..fa628d316b5cb 100644 --- a/mod/feedback/db/access.php +++ b/mod/feedback/db/access.php @@ -14,34 +14,15 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -// -// Capability definitions for the feedback module. -// -// The capabilities are loaded into the database table when the module is -// installed or updated. Whenever the capability definitions are updated, -// the module version number should be bumped up. -// -// The system has four possible values for a capability: -// CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set). -// -// -// CAPABILITY NAMING CONVENTION -// -// It is important that capability names are unique. The naming convention -// for capabilities that are specific to modules and blocks is as follows: -// [mod/block]/: -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities - +/** + * Plugin capabilities + * + * @package mod_feedback + * @copyright Andreas Grabs + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/feedback/db/install.xml b/mod/feedback/db/install.xml index 9aaba279aa4e0..694a2edc45fc8 100644 --- a/mod/feedback/db/install.xml +++ b/mod/feedback/db/install.xml @@ -1,28 +1,28 @@ - - - + + - - - - - - + + + + + + - - - - - - - + + + + + + + @@ -33,9 +33,9 @@
    - - - + + + @@ -47,17 +47,17 @@
    - - - + + + - + - - - - + + + + @@ -69,12 +69,12 @@
    - - - - - - + + + + + + @@ -86,13 +86,13 @@
    - - - + + + - - - + + + @@ -104,12 +104,12 @@
    - - - - - - + + + + + + @@ -121,12 +121,12 @@
    - - - - - - + + + + + + @@ -138,11 +138,11 @@
    - - - - - + + + + + @@ -155,9 +155,9 @@
    - - - + + + diff --git a/mod/feedback/import.php b/mod/feedback/import.php index e8a1c205a9878..896ccd86e50ba 100644 --- a/mod/feedback/import.php +++ b/mod/feedback/import.php @@ -286,7 +286,6 @@ function feedback_check_xml_utf8($text) { //encoding is given in $match[2] if (isset($match[0]) AND isset($match[1]) AND isset($match[2])) { $enc = $match[2]; - $textlib = textlib_get_instance(); - return $textlib->convert($text, $enc); + return textlib::convert($text, $enc); } } diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php index 2fc64cee31fa7..ae6cd7fe8030f 100644 --- a/mod/feedback/lib.php +++ b/mod/feedback/lib.php @@ -140,12 +140,14 @@ function feedback_update_instance($feedback) { * There are two situations in general where the files will be sent. * 1) filearea = item, 2) filearea = template * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_feedback + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - justsend the file */ function feedback_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/mod/folder/backup/moodle2/backup_folder_activity_task.class.php b/mod/folder/backup/moodle2/backup_folder_activity_task.class.php index 004382e70cff3..8c6e636055ed3 100644 --- a/mod/folder/backup/moodle2/backup_folder_activity_task.class.php +++ b/mod/folder/backup/moodle2/backup_folder_activity_task.class.php @@ -16,40 +16,41 @@ // along with Moodle. If not, see . /** - * @package mod - * @subpackage folder - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_folder_activity_task class + * + * @package mod_folder + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -require_once($CFG->dirroot . '/mod/folder/backup/moodle2/backup_folder_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/folder/backup/moodle2/backup_folder_stepslib.php'); /** - * folder backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Folder instance */ class backup_folder_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the folder.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_folder_activity_structure_step('folder_structure', 'folder.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/folder/db/access.php b/mod/folder/db/access.php index b6e3cfa9e4190..e6b2c10ee68a7 100644 --- a/mod/folder/db/access.php +++ b/mod/folder/db/access.php @@ -1,5 +1,4 @@ -
    - - + + - - - - + + + + diff --git a/mod/folder/lib.php b/mod/folder/lib.php index c7598c8fc8e59..e3f13d10ac25e 100644 --- a/mod/folder/lib.php +++ b/mod/folder/lib.php @@ -217,9 +217,12 @@ function folder_get_participants($folderid) { /** * Lists all browsable file areas - * @param object $course - * @param object $cm - * @param object $context + * + * @package mod_folder + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object * @return array */ function folder_get_file_areas($course, $cm, $context) { @@ -231,16 +234,19 @@ function folder_get_file_areas($course, $cm, $context) { /** * File browsing support for folder module content area. - * @param object $browser - * @param object $areas - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return object file_info instance or null if not found + * + * @package mod_folder + * @category files + * @param file_browser $browser file browser instance + * @param array $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info instance or null if not found */ function folder_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG; @@ -279,12 +285,14 @@ function folder_get_file_info($browser, $areas, $course, $cm, $context, $fileare /** * Serves the folder files. * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_folder + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - just send the file */ function folder_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/mod/forum/backup/moodle2/backup_forum_activity_task.class.php b/mod/forum/backup/moodle2/backup_forum_activity_task.class.php index ab6c15b3f13da..b9bca84c34011 100644 --- a/mod/forum/backup/moodle2/backup_forum_activity_task.class.php +++ b/mod/forum/backup/moodle2/backup_forum_activity_task.class.php @@ -16,39 +16,42 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_forum_activity_task class + * + * @package mod_forum + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/forum/backup/moodle2/backup_forum_stepslib.php'); // Because it exists (must) -require_once($CFG->dirroot . '/mod/forum/backup/moodle2/backup_forum_settingslib.php'); // Because it exists (optional) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/forum/backup/moodle2/backup_forum_stepslib.php'); +require_once($CFG->dirroot . '/mod/forum/backup/moodle2/backup_forum_settingslib.php'); /** - * forum backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Forum instance */ class backup_forum_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the forum.xml file */ protected function define_my_steps() { - // Forum only has one structure step $this->add_step(new backup_forum_activity_structure_step('forum structure', 'forum.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php, view.php and discuss.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/forum/db/access.php b/mod/forum/db/access.php index d88fe52d5cda6..2c5aa42a783c1 100644 --- a/mod/forum/db/access.php +++ b/mod/forum/db/access.php @@ -1,5 +1,4 @@ . /** - * Capability definitions for the forum module. - * - * The capabilities are loaded into the database table when the module is - * installed or updated. Whenever the capability definitions are updated, - * the module version number should be bumped up. - * - * The system has four possible values for a capability: - * CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set). - * - * CAPABILITY NAMING CONVENTION - * - * It is important that capability names are unique. The naming convention - * for capabilities that are specific to modules and blocks is as follows: - * [mod/block]/: + * Plugin capabilities * - * component_name should be the same as the directory name of the mod or block. - * - * Core moodle capabilities are defined thus: - * moodle/: - * - * Examples: mod/forum:viewpost - * block/recent_activity:view - * moodle/site:deleteuser - * - * The variable name for the capability definitions array is $capabilities - * - * @package mod-forum - * @copyright 2006 vyshane - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_forum + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'mod/forum:viewdiscussion' => array( diff --git a/mod/forum/db/events.php b/mod/forum/db/events.php index a6138e13b13fd..f11bd37aa3784 100644 --- a/mod/forum/db/events.php +++ b/mod/forum/db/events.php @@ -1,5 +1,4 @@ -
    - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -39,18 +39,18 @@
    - - - + + + - - - - - - - - + + + + + + + + @@ -62,20 +62,20 @@
    - - - - - - - + + + + + + + - - - + + + - - + + @@ -90,11 +90,11 @@
    - - - - - + + + + + @@ -107,9 +107,9 @@
    - - - + + + @@ -121,13 +121,13 @@
    - - - - - - - + + + + + + + @@ -140,9 +140,9 @@
    - - - + + + diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 4ca3785909b02..a3677dd15d975 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -365,6 +365,16 @@ function forum_get_completion_state($course,$cm,$userid,$type) { return $result; } +/** + * Create a message-id string to use in the custom headers of forum notification emails + * + * message-id is used by email clients to identify emails and to nest conversations + * + * @param int $postid The ID of the forum post we are notifying the user about + * @param int $usertoid The ID of the user being notified + * @param string $hostname The server's hostname + * @return string A unique message-id + */ function forum_get_email_message_id($postid, $usertoid, $hostname) { return '<'.hash('sha256',$postid.'to'.$usertoid.'@'.$hostname).'>'; } @@ -4008,9 +4018,11 @@ function forum_print_attachments($post, $cm, $type) { /** * Lists all browsable file areas * - * @param object $course - * @param object $cm - * @param object $context + * @package mod_forum + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object * @return array */ function forum_get_file_areas($course, $cm, $context) { @@ -4021,16 +4033,18 @@ function forum_get_file_areas($course, $cm, $context) { /** * File browsing support for forum module. * - * @param object $browser - * @param object $areas - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return object file_info instance or null if not found + * @package mod_forum + * @category files + * @param stdClass $browser file browser object + * @param stdClass $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module + * @param stdClass $context context module + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info instance or null if not found */ function forum_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG, $DB; @@ -4087,12 +4101,14 @@ function forum_get_file_info($browser, $areas, $course, $cm, $context, $filearea /** * Serves the forum attachments. Implements needed access control ;-) * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_forum + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - justsend the file */ function forum_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { @@ -4417,7 +4433,7 @@ function forum_delete_post($post, $children, $course, $cm, $forum, $skipcompleti $context = get_context_instance(CONTEXT_MODULE, $cm->id); - if ($children != 'ignore' && ($childposts = $DB->get_records('forum_posts', array('parent'=>$post->id)))) { + if ($children !== 'ignore' && ($childposts = $DB->get_records('forum_posts', array('parent'=>$post->id)))) { if ($children) { foreach ($childposts as $childpost) { forum_delete_post($childpost, true, $course, $cm, $forum, $skipcompletion); diff --git a/mod/glossary/backup/moodle2/backup_glossary_activity_task.class.php b/mod/glossary/backup/moodle2/backup_glossary_activity_task.class.php index b57fbb8593af8..89e0ce000b3a8 100644 --- a/mod/glossary/backup/moodle2/backup_glossary_activity_task.class.php +++ b/mod/glossary/backup/moodle2/backup_glossary_activity_task.class.php @@ -16,38 +16,41 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_glossary_activity_task class + * + * @package mod_glossary + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/glossary/backup/moodle2/backup_glossary_stepslib.php'); // Because it exists (must) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/glossary/backup/moodle2/backup_glossary_stepslib.php'); /** - * glossary backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Glossary instance */ class backup_glossary_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the glossary.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_glossary_activity_structure_step('glossary_structure', 'glossary.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/glossary/db/access.php b/mod/glossary/db/access.php index 13ca17081f46c..98b67fcb3f332 100644 --- a/mod/glossary/db/access.php +++ b/mod/glossary/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities - +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Plugin capabilities + * + * @package mod_glossary + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/glossary/db/install.xml b/mod/glossary/db/install.xml index 757f028904edf..a40359edda5fa 100644 --- a/mod/glossary/db/install.xml +++ b/mod/glossary/db/install.xml @@ -1,39 +1,39 @@ -
    - - + + - - - + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -44,22 +44,22 @@
    - - - + + + - - - + + + - - - - - - - - + + + + + + + + @@ -72,8 +72,8 @@
    - - + + @@ -83,10 +83,10 @@
    - - + + - + @@ -95,9 +95,9 @@
    - - - + + + @@ -107,11 +107,11 @@
    - + - - + + diff --git a/mod/glossary/edit_form.php b/mod/glossary/edit_form.php index ce8443e6762c7..5bdcefeeb8847 100644 --- a/mod/glossary/edit_form.php +++ b/mod/glossary/edit_form.php @@ -118,7 +118,7 @@ function validation($data, $files) { if ($DB->record_exists_select('glossary_entries', 'glossaryid = :glossaryid AND LOWER(concept) = :concept AND id != :id', array( 'glossaryid' => $glossary->id, - 'concept' => moodle_strtolower($data['concept']), + 'concept' => textlib::strtolower($data['concept']), 'id' => $id))) { $errors['concept'] = get_string('errconceptalreadyexists', 'glossary'); } @@ -129,7 +129,7 @@ function validation($data, $files) { if ($DB->record_exists_select('glossary_entries', 'glossaryid = :glossaryid AND LOWER(concept) = :concept', array( 'glossaryid' => $glossary->id, - 'concept' => moodle_strtolower($data['concept'])))) { + 'concept' => textlib::strtolower($data['concept'])))) { $errors['concept'] = get_string('errconceptalreadyexists', 'glossary'); } } diff --git a/mod/glossary/editcategories.php b/mod/glossary/editcategories.php index 3dc672f44b696..6a12d4d9d0090 100644 --- a/mod/glossary/editcategories.php +++ b/mod/glossary/editcategories.php @@ -72,7 +72,7 @@ $PAGE->navbar->add($strglossaries, new moodle_url('/mod/glossary/index.php', array('id'=>$course->id))); $PAGE->navbar->add(get_string("categories","glossary")); if (!empty($action)) { - $navaction = get_string($action). " " . moodle_strtolower(get_string("category","glossary")); + $navaction = get_string($action). " " . textlib::strtolower(get_string("category","glossary")); $PAGE->navbar->add($navaction); } $PAGE->set_title(format_string($glossary->name)); diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php index 5bc4edc8cd390..f4bf6e7fb6625 100644 --- a/mod/glossary/exportentry.php +++ b/mod/glossary/exportentry.php @@ -72,7 +72,7 @@ if ($DB->record_exists_select('glossary_entries', 'glossaryid = :glossaryid AND LOWER(concept) = :concept', array( 'glossaryid' => $mainglossary->id, - 'concept' => moodle_strtolower($entry->concept)))) { + 'concept' => textlib::strtolower($entry->concept)))) { $PAGE->set_title(format_string($glossary->name)); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); diff --git a/mod/glossary/import.php b/mod/glossary/import.php index 9a20c887070b6..1b12c6bac67ba 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -213,7 +213,7 @@ $dupentry = $DB->record_exists_select('glossary_entries', 'glossaryid = :glossaryid AND LOWER(concept) = :concept', array( 'glossaryid' => $glossary->id, - 'concept' => moodle_strtolower($newentry->concept))); + 'concept' => textlib::strtolower($newentry->concept))); } if ($dupentry) { $permissiongranted = 0; diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 4a24a76ac89bb..1242ea006824a 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -871,7 +871,7 @@ function glossary_get_entries_search($concept, $courseid) { $bypassteacher = 0; //This means YES } - $conceptlower = moodle_strtolower(trim($concept)); + $conceptlower = textlib::strtolower(trim($concept)); $params = array('courseid1'=>$courseid, 'courseid2'=>$courseid, 'conceptlower'=>$conceptlower, 'concept'=>$concept); @@ -1450,9 +1450,11 @@ function glossary_print_attachments($entry, $cm, $type=NULL, $align="left") { /** * Lists all browsable file areas * - * @param object $course - * @param object $cm - * @param object $context + * @package mod_glossary + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object * @return array */ function glossary_get_file_areas($course, $cm, $context) { @@ -1461,14 +1463,75 @@ function glossary_get_file_areas($course, $cm, $context) { } /** - * Serves the glossary attachments. Implements needed access control ;-) + * File browsing support for glossary module. * - * @param object $course - * @param object $cm - * @param object $context + * @param file_browser $browser + * @param array $areas + * @param stdClass $course + * @param cm_info $cm + * @param context $context * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @param int $itemid + * @param string $filepath + * @param string $filename + * @return file_info_stored file_info_stored instance or null if not found + */ +function mod_glossary_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { + global $CFG, $DB; + + if ($context->contextlevel != CONTEXT_MODULE) { + return null; + } + + if ($filearea === 'attachment' or $filearea === 'entry') { + if (!$entry = $DB->get_record('glossary_entries', array('id' => $itemid))) { + return null; + } + + if (!$glossary = $DB->get_record('glossary', array('id' => $cm->instance))) { + return null; + } + + if ($glossary->defaultapproval and !$entry->approved and !has_capability('mod/glossary:approve', $context)) { + return null; + } + + // this trickery here is because we need to support source glossary access + if ($entry->glossaryid == $cm->instance) { + $filecontext = $context; + } else if ($entry->sourceglossaryid == $cm->instance) { + if (!$maincm = get_coursemodule_from_instance('glossary', $entry->glossaryid)) { + return null; + } + $filecontext = get_context_instance(CONTEXT_MODULE, $maincm->id); + } else { + return null; + } + + $fs = get_file_storage(); + $filepath = is_null($filepath) ? '/' : $filepath; + $filename = is_null($filename) ? '.' : $filename; + if (!($storedfile = $fs->get_file($filecontext->id, 'mod_glossary', $filearea, $itemid, $filepath, $filename))) { + return null; + } + $urlbase = $CFG->wwwroot.'/pluginfile.php'; + return new file_info_stored($browser, $filecontext, $storedfile, $urlbase, $filearea, $itemid, true, true, false); + } + + return null; +} + +/** + * Serves the glossary attachments. Implements needed access control ;-) + * + * @package mod_glossary + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClsss $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - justsend the file */ function glossary_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { @@ -1884,9 +1947,9 @@ function glossary_print_sorting_links($cm, $mode, $sortkey = '',$sortorder = '') */ function glossary_sort_entries ( $entry0, $entry1 ) { - if ( moodle_strtolower(ltrim($entry0->concept)) < moodle_strtolower(ltrim($entry1->concept)) ) { + if ( textlib::strtolower(ltrim($entry0->concept)) < textlib::strtolower(ltrim($entry1->concept)) ) { return -1; - } elseif ( moodle_strtolower(ltrim($entry0->concept)) > moodle_strtolower(ltrim($entry1->concept)) ) { + } elseif ( textlib::strtolower(ltrim($entry0->concept)) > textlib::strtolower(ltrim($entry1->concept)) ) { return 1; } else { return 0; diff --git a/mod/glossary/print.php b/mod/glossary/print.php index 013c70e55832b..2d53a42ede64a 100644 --- a/mod/glossary/print.php +++ b/mod/glossary/print.php @@ -63,9 +63,6 @@ $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); -/// Loading the textlib singleton instance. We are going to need it. -$textlib = textlib_get_instance(); - if (!has_capability('mod/glossary:manageentries', $context) and !$glossary->allowprintview) { notice(get_string('printviewnotallowed', 'glossary')); } @@ -181,12 +178,12 @@ // Setting the pivot for the current entry $pivot = $entry->glossarypivot; - $upperpivot = $textlib->strtoupper($pivot); - $pivottoshow = $textlib->strtoupper(format_string($pivot, true, $fmtoptions)); + $upperpivot = textlib::strtoupper($pivot); + $pivottoshow = textlib::strtoupper(format_string($pivot, true, $fmtoptions)); // Reduce pivot to 1cc if necessary if ( !$fullpivot ) { - $upperpivot = $textlib->substr($upperpivot, 0, 1); - $pivottoshow = $textlib->substr($pivottoshow, 0, 1); + $upperpivot = textlib::substr($upperpivot, 0, 1); + $pivottoshow = textlib::substr($pivottoshow, 0, 1); } // If there's group break diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 43b7904e3a31f..a2cb2c1f97de2 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -11,7 +11,6 @@ /// Initialise some variables $sqlorderby = ''; $sqlsortkey = NULL; - $textlib = textlib_get_instance(); // For cases needing inner view $sqlwrapheader = ''; @@ -89,14 +88,14 @@ case GLOSSARY_AUTHOR_VIEW: $where = ''; - $params['hookup'] = $textlib->strtoupper($hook); + $params['hookup'] = textlib::strtoupper($hook); if ( $sqlsortkey == 'firstname' ) { $usernamefield = $DB->sql_fullname('u.firstname' , 'u.lastname'); } else { $usernamefield = $DB->sql_fullname('u.lastname' , 'u.firstname'); } - $where = "AND " . $DB->sql_substr("upper($usernamefield)", 1, $textlib->strlen($hook)) . " = :hookup"; + $where = "AND " . $DB->sql_substr("upper($usernamefield)", 1, textlib::strlen($hook)) . " = :hookup"; if ( $hook == 'ALL' ) { $where = ''; @@ -115,10 +114,10 @@ $printpivot = 0; $where = ''; - $params['hookup'] = $textlib->strtoupper($hook); + $params['hookup'] = textlib::strtoupper($hook); if ($hook != 'ALL' and $hook != 'SPECIAL') { - $where = "AND " . $DB->sql_substr("upper(concept)", 1, $textlib->strlen($hook)) . " = :hookup"; + $where = "AND " . $DB->sql_substr("upper(concept)", 1, textlib::strlen($hook)) . " = :hookup"; } $sqlselect = "SELECT ge.*, ge.concept AS glossarypivot"; @@ -176,7 +175,7 @@ if (substr($searchterm,0,1) == '+') { $searchterm = trim($searchterm, '+-'); - if ($textlib->strlen($searchterm) < 2) { + if (textlib::strlen($searchterm) < 2) { continue; } $searchterm = preg_quote($searchterm, '|'); @@ -185,7 +184,7 @@ } else if (substr($searchterm,0,1) == "-") { $searchterm = trim($searchterm, '+-'); - if ($textlib->strlen($searchterm) < 2) { + if (textlib::strlen($searchterm) < 2) { continue; } $searchterm = preg_quote($searchterm, '|'); @@ -193,7 +192,7 @@ $params['ss'.$i] = "(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)"; } else { - if ($textlib->strlen($searchterm) < 2) { + if (textlib::strlen($searchterm) < 2) { continue; } $searchcond[] = $DB->sql_like($concat, ":ss$i", false, true, $NOT); @@ -235,8 +234,8 @@ case 'letter': if ($hook != 'ALL' and $hook != 'SPECIAL') { - $params['hookup'] = $textlib->strtoupper($hook); - $where = "AND " . $DB->sql_substr("upper(concept)", 1, $textlib->strlen($hook)) . " = :hookup"; + $params['hookup'] = textlib::strtoupper($hook); + $where = "AND " . $DB->sql_substr("upper(concept)", 1, textlib::strlen($hook)) . " = :hookup"; } if ($hook == 'SPECIAL') { //Create appropiate IN contents diff --git a/mod/glossary/view.php b/mod/glossary/view.php index b57cec684641a..cd5a306d0a6dc 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -57,9 +57,6 @@ require_once($CFG->dirroot . '/comment/lib.php'); comment::init(); -/// Loading the textlib singleton instance. We are going to need it. -$textlib = textlib_get_instance(); - /// redirecting if adding a new entry if ($tab == GLOSSARY_ADDENTRY_VIEW ) { redirect("edit.php?cmid=$cm->id&mode=$mode"); @@ -425,12 +422,12 @@ // Setting the pivot for the current entry $pivot = $entry->glossarypivot; - $upperpivot = $textlib->strtoupper($pivot); - $pivottoshow = $textlib->strtoupper(format_string($pivot, true, $fmtoptions)); + $upperpivot = textlib::strtoupper($pivot); + $pivottoshow = textlib::strtoupper(format_string($pivot, true, $fmtoptions)); // Reduce pivot to 1cc if necessary if ( !$fullpivot ) { - $upperpivot = $textlib->substr($upperpivot, 0, 1); - $pivottoshow = $textlib->substr($pivottoshow, 0, 1); + $upperpivot = textlib::substr($upperpivot, 0, 1); + $pivottoshow = textlib::substr($pivottoshow, 0, 1); } // if there's a group break diff --git a/mod/imscp/backup/moodle2/backup_imscp_activity_task.class.php b/mod/imscp/backup/moodle2/backup_imscp_activity_task.class.php index 05a5905068d02..a19fc0a331a89 100644 --- a/mod/imscp/backup/moodle2/backup_imscp_activity_task.class.php +++ b/mod/imscp/backup/moodle2/backup_imscp_activity_task.class.php @@ -16,40 +16,41 @@ // along with Moodle. If not, see . /** - * @package mod - * @subpackage imscp - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_imscp_activity_task class + * + * @package mod_imscp + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -require_once($CFG->dirroot . '/mod/imscp/backup/moodle2/backup_imscp_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/imscp/backup/moodle2/backup_imscp_stepslib.php'); /** - * imscp backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the IMSCP instance */ class backup_imscp_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the imscp.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_imscp_activity_structure_step('imscp_structure', 'imscp.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/imscp/db/access.php b/mod/imscp/db/access.php index 99036960b1f1c..0b92bafbfa10e 100644 --- a/mod/imscp/db/access.php +++ b/mod/imscp/db/access.php @@ -1,5 +1,4 @@ -
    - - + + - - - - - - + + + + + + diff --git a/mod/imscp/lib.php b/mod/imscp/lib.php index d7ae5476597ba..6dadbe0df9b0e 100644 --- a/mod/imscp/lib.php +++ b/mod/imscp/lib.php @@ -261,9 +261,12 @@ function imscp_get_participants($imscpid) { /** * Lists all browsable file areas - * @param object $course - * @param object $cm - * @param object $context + * + * @package mod_imscp + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object * @return array */ function imscp_get_file_areas($course, $cm, $context) { @@ -277,16 +280,19 @@ function imscp_get_file_areas($course, $cm, $context) { /** * File browsing support for imscp module ontent area. - * @param object $browser - * @param object $areas - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return object file_info instance or null if not found + * + * @package mod_imscp + * @category files + * @param stdClass $browser file browser + * @param stdClass $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info instance or null if not found */ function imscp_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG, $DB; @@ -323,12 +329,14 @@ function imscp_get_file_info($browser, $areas, $course, $cm, $context, $filearea /** * Serves the imscp files. * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_imscp + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - justsend the file */ function imscp_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/mod/label/backup/moodle2/backup_label_activity_task.class.php b/mod/label/backup/moodle2/backup_label_activity_task.class.php index d13506551d655..5e7533bc84c97 100644 --- a/mod/label/backup/moodle2/backup_label_activity_task.class.php +++ b/mod/label/backup/moodle2/backup_label_activity_task.class.php @@ -16,40 +16,41 @@ // along with Moodle. If not, see . /** - * @package mod - * @subpackage label - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_label_activity_task class + * + * @package mod_label + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; -require_once($CFG->dirroot . '/mod/label/backup/moodle2/backup_label_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/label/backup/moodle2/backup_label_stepslib.php'); /** - * label backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Label instance */ class backup_label_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the label.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_label_activity_structure_step('label_structure', 'label.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * No content encoding needed for this activity + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the same content with no changes */ static public function encode_content_links($content) { return $content; diff --git a/mod/label/db/install.xml b/mod/label/db/install.xml index 11f486c698060..0a69f2e3b95e2 100644 --- a/mod/label/db/install.xml +++ b/mod/label/db/install.xml @@ -1,17 +1,17 @@ -
    - - + + - - - + + + diff --git a/mod/label/lib.php b/mod/label/lib.php index d11ba19c54271..2430d176a36ee 100644 --- a/mod/label/lib.php +++ b/mod/label/lib.php @@ -35,11 +35,9 @@ * @return string */ function get_label_name($label) { - $textlib = textlib_get_instance(); - $name = strip_tags(format_string($label->intro,true)); - if ($textlib->strlen($name) > LABEL_MAX_NAME_LENGTH) { - $name = $textlib->substr($name, 0, LABEL_MAX_NAME_LENGTH)."..."; + if (textlib::strlen($name) > LABEL_MAX_NAME_LENGTH) { + $name = textlib::substr($name, 0, LABEL_MAX_NAME_LENGTH)."..."; } if (empty($name)) { diff --git a/mod/lesson/backup/moodle2/backup_lesson_activity_task.class.php b/mod/lesson/backup/moodle2/backup_lesson_activity_task.class.php index 0d8d9dd318946..40d0dbdae8e75 100644 --- a/mod/lesson/backup/moodle2/backup_lesson_activity_task.class.php +++ b/mod/lesson/backup/moodle2/backup_lesson_activity_task.class.php @@ -18,38 +18,42 @@ /** * This file contains the backup task for the lesson module * - * @package mod - * @subpackage lesson - * @copyright 2010 Sam Hemelryk - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_lesson + * @category backup + * @copyright 2010 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -/** - * Require the backup lesson steps lib - */ +defined('MOODLE_INTERNAL') || die(); + require_once($CFG->dirroot . '/mod/lesson/backup/moodle2/backup_lesson_stepslib.php'); /** - * The backup task class for the lesson module + * Provides the steps to perform one complete backup of the Lesson instance + * * @copyright 2010 Sam Hemelryk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class backup_lesson_activity_task extends backup_activity_task { + /** + * No specific settings for this activity + */ protected function define_my_settings() { - // There are no settings } + /** + * Defines a backup step to store the instance data in the lesson.xml file + */ protected function define_my_steps() { $this->add_step(new backup_lesson_activity_structure_step('lesson structure', 'lesson.xml')); } /** - * Replaces links within the content with links that can be corrected during - * restore + * Encodes URLs to various Lesson scripts * - * @param string $content - * @return string + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; @@ -104,5 +108,4 @@ static public function encode_content_links($content) { // Return the now encoded content return $content; } - } diff --git a/mod/lesson/db/access.php b/mod/lesson/db/access.php index bb650d966baac..d78341cb73c93 100644 --- a/mod/lesson/db/access.php +++ b/mod/lesson/db/access.php @@ -1,5 +1,4 @@ -
    - - + + - - - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + @@ -56,19 +56,19 @@
    - - - - - - - - - - + + + + + + + + + + - - + + @@ -77,19 +77,19 @@
    - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -99,15 +99,15 @@
    - - - - - - - - - + + + + + + + + + @@ -121,12 +121,12 @@
    - - - - - - + + + + + + @@ -138,11 +138,11 @@
    - - - - - + + + + + @@ -154,13 +154,13 @@
    - - - - - - - + + + + + + + @@ -173,10 +173,10 @@
    - - - - + + + + diff --git a/mod/lesson/essay.php b/mod/lesson/essay.php index a0a611c466a4c..e60f43e654b8f 100644 --- a/mod/lesson/essay.php +++ b/mod/lesson/essay.php @@ -393,7 +393,7 @@ $data->id = $cm->id; $data->attemptid = $attemptid; $data->score = $essayinfo->score; - $data->studentanswer = format_string($essayinfo->answer, FORMAT_MOODLE); + $data->studentanswer = format_string($essayinfo->answer, $essayinfo->answerformat); $data->response = $essayinfo->response; $mform->set_data($data); diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 4bae4af7c11ae..10e53db0f947c 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -888,12 +888,14 @@ function lesson_get_import_export_formats($type) { /** * Serves the lesson attachments. Implements needed access control ;-) * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_lesson + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - justsend the file */ function lesson_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { @@ -940,7 +942,11 @@ function lesson_pluginfile($course, $cm, $context, $filearea, $args, $forcedownl /** * Returns an array of file areas - * @return array + * + * @package mod_lesson + * @category files + * @todo MDL-31048 localize + * @return array a list of available file areas */ function lesson_get_file_areas() { $areas = array(); @@ -953,16 +959,18 @@ function lesson_get_file_areas() { /** * Returns a file_info_stored object for the file being requested here * - * @global $CFG - * @param file_browse $browser - * @param array $areas - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename + * @package mod_lesson + * @category files + * @global stdClass $CFG + * @param file_browse $browser file browser instance + * @param array $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name * @return file_info_stored */ function lesson_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { diff --git a/mod/lesson/pagetypes/essay.php b/mod/lesson/pagetypes/essay.php index d6705f34a5b34..43f8e1447b657 100644 --- a/mod/lesson/pagetypes/essay.php +++ b/mod/lesson/pagetypes/essay.php @@ -97,8 +97,10 @@ public function check_answer() { if (is_array($data->answer)) { $studentanswer = $data->answer['text']; + $studentanswerformat = $data->answer['format']; } else { $studentanswer = $data->answer; + $studentanswerformat = FORMAT_MOODLE; } if (trim($studentanswer) === '') { @@ -117,9 +119,10 @@ public function check_answer() { $userresponse->graded = 0; $userresponse->score = 0; $userresponse->answer = $studentanswer; + $userresponse->answerformat = $studentanswerformat; $userresponse->response = ""; $result->userresponse = serialize($userresponse); - + $result->studentanswerformat = $studentanswerformat; $result->studentanswer = s($studentanswer); return $result; } @@ -220,7 +223,7 @@ public function report_answers($answerpage, $answerdata, $useranswer, $pagestats // dont think this should ever be reached.... $avescore = get_string("nooneansweredthisquestion", "lesson"); } - $answerdata->answers[] = array(format_text($essayinfo->answer, FORMAT_MOODLE, $formattextdefoptions), $avescore); + $answerdata->answers[] = array(format_text($essayinfo->answer, $essayinfo->answerformat, $formattextdefoptions), $avescore); $answerpage->answerdata = $answerdata; } return $answerpage; diff --git a/mod/lesson/pagetypes/multichoice.php b/mod/lesson/pagetypes/multichoice.php index 3e666c5d2fdde..7ab9d2cd0e7d8 100644 --- a/mod/lesson/pagetypes/multichoice.php +++ b/mod/lesson/pagetypes/multichoice.php @@ -253,7 +253,7 @@ public function check_answer() { } } else { // only one answer allowed - if (empty($data->answerid) && !is_int($data->answerid)) { + if (!isset($data->answerid) || (empty($data->answerid) && !is_int($data->answerid))) { $result->noanswer = true; return $result; } diff --git a/mod/lesson/styles.css b/mod/lesson/styles.css index 6a0492acfd61f..3b6d7413704fd 100644 --- a/mod/lesson/styles.css +++ b/mod/lesson/styles.css @@ -13,7 +13,7 @@ .path-mod-lesson .menu .menuwrapper {max-height: 400px;overflow: auto;vertical-align: top;margin-bottom: 10px;} .path-mod-lesson .menu ul {list-style: none;padding: 5px 0px 0px 5px;margin: 0px;} .path-mod-lesson .menu ul li {padding-bottom: 5px;} -.path-mod-lesson .skip {position: absolute;left: -1000em;width: 20em;} +.path-mod-lesson .skip {position: absolute;top: -1000em;width: 20em;} .path-mod-lesson .branchbuttoncontainer.horizontal div, .path-mod-lesson .branchbuttoncontainer.horizontal form {display: inline;} .path-mod-lesson .firstpageoptions {width:30%;margin-left:35%;margin-top:1em;} diff --git a/mod/lti/backup/moodle2/backup_lti_activity_task.class.php b/mod/lti/backup/moodle2/backup_lti_activity_task.class.php index d4b6803ac0ab6..1c00c4e6692d1 100644 --- a/mod/lti/backup/moodle2/backup_lti_activity_task.class.php +++ b/mod/lti/backup/moodle2/backup_lti_activity_task.class.php @@ -33,17 +33,16 @@ // Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu /** - * This file contains the lti module backup class + * Defines backup_lti_activity_task class * - * @package mod - * @subpackage lti - * @copyright 2009 Marc Alier, Jordi Piguillem, Nikolas Galanis - * marc.alier@upc.edu - * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu - * @author Marc Alier - * @author Jordi Piguillem - * @author Nikolas Galanis - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_lti + * @category backup + * @copyright 2009 Marc Alier , Jordi Piguillem, Nikolas Galanis + * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu + * @author Marc Alier + * @author Jordi Piguillem + * @author Nikolas Galanis + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; @@ -51,29 +50,28 @@ require_once($CFG->dirroot . '/mod/lti/backup/moodle2/backup_lti_stepslib.php'); /** - * lti backup task that provides all the settings and steps to perform one - * complete backup of the module + * Provides the steps to perform one complete backup of the LTI instance */ class backup_lti_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the lti.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_lti_activity_structure_step('lti_structure', 'lti.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/lti/db/access.php b/mod/lti/db/access.php index 0c28a0ce83c61..5f4edc8efef16 100644 --- a/mod/lti/db/access.php +++ b/mod/lti/db/access.php @@ -17,10 +17,8 @@ /** * This file contains the capabilities used by the lti module * - * @package mod - * @subpackage lti - * @copyright 2009 Marc Alier, Jordi Piguillem, Nikolas Galanis - * marc.alier@upc.edu + * @package mod_lti + * @copyright 2009 Marc Alier, Jordi Piguillem, Nikolas Galanis, marc.alier@upc.edu * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu * @author Marc Alier * @author Jordi Piguillem diff --git a/mod/lti/db/install.xml b/mod/lti/db/install.xml index 2df3df50e7b73..d1b95bd4f4a7d 100644 --- a/mod/lti/db/install.xml +++ b/mod/lti/db/install.xml @@ -1,37 +1,37 @@ -
    - - + + - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - + + + - - + + @@ -42,16 +42,16 @@
    - + - + - - - - - - + + + + + + @@ -63,8 +63,8 @@
    - - + + @@ -77,15 +77,15 @@
    - - - - - - - - - + + + + + + + + + diff --git a/mod/lti/locallib.php b/mod/lti/locallib.php index 74f0276046f44..0bbe06b85ba2a 100644 --- a/mod/lti/locallib.php +++ b/mod/lti/locallib.php @@ -413,8 +413,6 @@ function lti_get_tool_table($tools, $id) { * @return Array of custom parameters */ function lti_split_custom_parameters($customstr) { - $textlib = textlib_get_instance(); - $lines = preg_split("/[\n;]/", $customstr); $retval = array(); foreach ($lines as $line) { @@ -422,8 +420,8 @@ function lti_split_custom_parameters($customstr) { if ( $pos === false || $pos < 1 ) { continue; } - $key = trim($textlib->substr($line, 0, $pos)); - $val = trim($textlib->substr($line, $pos+1, strlen($line))); + $key = trim(textlib::substr($line, 0, $pos)); + $val = trim(textlib::substr($line, $pos+1, strlen($line))); $key = lti_map_keyname($key); $retval['custom_'.$key] = $val; } @@ -438,10 +436,8 @@ function lti_split_custom_parameters($customstr) { * @return string Processed name */ function lti_map_keyname($key) { - $textlib = textlib_get_instance(); - $newkey = ""; - $key = $textlib->strtolower(trim($key)); + $key = textlib::strtolower(trim($key)); foreach (str_split($key) as $ch) { if ( ($ch >= 'a' && $ch <= 'z') || ($ch >= '0' && $ch <= '9') ) { $newkey .= $ch; diff --git a/mod/lti/servicelib.php b/mod/lti/servicelib.php index 05acae505f5c2..18d58012fdfa7 100644 --- a/mod/lti/servicelib.php +++ b/mod/lti/servicelib.php @@ -192,7 +192,7 @@ function lti_delete_grade($ltiinstance, $userid) { $status = grade_update(LTI_SOURCE, $ltiinstance->course, LTI_ITEM_TYPE, LTI_ITEM_MODULE, $ltiinstance->id, 0, $grade, array('deleted'=>1)); - return $status == GRADE_UPDATE_OK || $status == GRADE_UPDATE_ITEM_DELETED; //grade_update seems to return ok now, but could reasonably return deleted in the future + return $status == GRADE_UPDATE_OK; } function lti_verify_message($key, $sharedsecrets, $body, $headers = null) { diff --git a/mod/page/backup/moodle1/lib.php b/mod/page/backup/moodle1/lib.php index f0783ee413e37..c917a1693e1dd 100644 --- a/mod/page/backup/moodle1/lib.php +++ b/mod/page/backup/moodle1/lib.php @@ -53,11 +53,18 @@ public function process_legacy_resource(array $data) { $page['intro'] = $data['intro']; $page['introformat'] = $data['introformat']; $page['content'] = $data['alltext']; - $page['contentformat'] = (int)$data['reference']; - // this is unexpected but just in case (the same step applied during upgrade) - if ($page['contentformat'] < 0 or $page['contentformat'] > 4) { - $page['contentformat'] = FORMAT_MOODLE; + if ($data['type'] === 'html') { + // legacy Resource of the type Web page + $page['contentformat'] = FORMAT_HTML; + + } else { + // legacy Resource of the type Plain text page + $page['contentformat'] = (int)$data['reference']; + + if ($page['contentformat'] < 0 or $page['contentformat'] > 4) { + $page['contentformat'] = FORMAT_MOODLE; + } } $page['legacyfiles'] = RESOURCELIB_LEGACYFILES_ACTIVE; diff --git a/mod/page/backup/moodle2/backup_page_activity_task.class.php b/mod/page/backup/moodle2/backup_page_activity_task.class.php index 16637b612689b..3ad67485f31c6 100644 --- a/mod/page/backup/moodle2/backup_page_activity_task.class.php +++ b/mod/page/backup/moodle2/backup_page_activity_task.class.php @@ -16,40 +16,41 @@ // along with Moodle. If not, see . /** - * @package mod - * @subpackage page - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_page_activity_task class + * + * @package mod_page + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; -require_once($CFG->dirroot . '/mod/page/backup/moodle2/backup_page_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/page/backup/moodle2/backup_page_stepslib.php'); /** - * page backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Page instance */ class backup_page_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the page.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_page_activity_structure_step('page_structure', 'page.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/page/db/access.php b/mod/page/db/access.php index debd91f68641d..247d01438c173 100644 --- a/mod/page/db/access.php +++ b/mod/page/db/access.php @@ -1,5 +1,4 @@ -
    - - + + - - - - - - - - - - + + + + + + + + + + diff --git a/mod/page/lib.php b/mod/page/lib.php index ef3d84b52f4df..e6160ffb09bb6 100644 --- a/mod/page/lib.php +++ b/mod/page/lib.php @@ -285,9 +285,12 @@ function page_get_coursemodule_info($coursemodule) { /** * Lists all browsable file areas - * @param object $course - * @param object $cm - * @param object $context + * + * @package mod_page + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object * @return array */ function page_get_file_areas($course, $cm, $context) { @@ -298,16 +301,19 @@ function page_get_file_areas($course, $cm, $context) { /** * File browsing support for page module content area. - * @param object $browser - * @param object $areas - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return object file_info instance or null if not found + * + * @package mod_page + * @category files + * @param stdClass $browser file browser instance + * @param stdClass $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info instance or null if not found */ function page_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG; @@ -343,12 +349,15 @@ function page_get_file_info($browser, $areas, $course, $cm, $context, $filearea, /** * Serves the page files. - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * + * @package mod_page + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - just send the file */ function page_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php b/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php index e5092f4b42fdf..0acf1be07a690 100644 --- a/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php +++ b/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php @@ -15,21 +15,20 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_quiz_activity_task class + * + * @package mod_quiz + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/mod/quiz/backup/moodle2/backup_quiz_stepslib.php'); - /** - * quiz backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Quiz instance * * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -37,14 +36,13 @@ class backup_quiz_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines backup steps to store the instance data and required questions */ protected function define_my_steps() { // Generate the quiz.xml file containing all the quiz information @@ -67,8 +65,10 @@ protected function define_my_steps() { } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ public static function encode_content_links($content) { global $CFG; diff --git a/mod/quiz/db/access.php b/mod/quiz/db/access.php index 485cc246a44e3..ee7bf4ac3994b 100644 --- a/mod/quiz/db/access.php +++ b/mod/quiz/db/access.php @@ -17,8 +17,7 @@ /** * Capability definitions for the quiz module. * - * @package mod - * @subpackage quiz + * @package mod_quiz * @copyright 2006 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/quiz/db/events.php b/mod/quiz/db/events.php index bfb7b5c3527b1..0a9de7edceed0 100644 --- a/mod/quiz/db/events.php +++ b/mod/quiz/db/events.php @@ -15,10 +15,10 @@ // along with Moodle. If not, see . /** - * Post-install code for the quiz module. + * Add event handlers for the quiz * - * @package mod - * @subpackage quiz + * @package mod_quiz + * @category event * @copyright 2011 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/quiz/db/install.xml b/mod/quiz/db/install.xml index 7eb850dc74ba1..391fe5907fe38 100644 --- a/mod/quiz/db/install.xml +++ b/mod/quiz/db/install.xml @@ -1,47 +1,47 @@ -
    - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + @@ -52,19 +52,19 @@
    - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -77,11 +77,11 @@
    - - - - - + + + + + @@ -93,10 +93,10 @@
    - - - - + + + + @@ -106,12 +106,12 @@
    - - - - - - + + + + + + @@ -120,14 +120,14 @@
    - - - - - - - - + + + + + + + + @@ -139,9 +139,9 @@
    - + - + diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index f81034e9dc9d9..c8306dbca6cf7 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -127,7 +127,7 @@ $string['cannotsavequestion'] = 'Cannot save question list'; $string['cannotsetgrade'] = 'Could not set a new maximum grade for the quiz'; $string['cannotsetsumgrades'] = 'Failed to set sumgrades'; -$string['cannotstartgradesmismatch'] = 'Cannot start an attempt at this quiz. The quiz is supposed to be graded, but there are no questions in the quiz that are worth any marks.'; +$string['cannotstartgradesmismatch'] = 'Cannot start an attempt at this quiz. The quiz is set to be graded out of {$a->grade}, but none of the questions in the quiz have a grade. This can be fixed on the \'Edit quiz\' page.'; $string['cannotstartmissingquestion'] = 'Cannot start an attempt at this quiz. The quiz definition includes a question that does not exist.'; $string['cannotstartnoquestions'] = 'Cannot start an attempt at this quiz. The quiz has not been set up yet. No questions have been added.'; $string['cannotwrite'] = 'Cannot write to export file ({$a})'; diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index ba61fe692b23e..a48e3de4e740c 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1638,12 +1638,14 @@ function quiz_extend_settings_navigation($settings, $quiznode) { /** * Serves the quiz files. * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_quiz + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - justsend the file */ function quiz_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { @@ -1683,10 +1685,14 @@ function quiz_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa * Called via pluginfile.php -> question_pluginfile to serve files belonging to * a question in a question_attempt when that attempt is a quiz attempt. * - * @param object $course course settings object - * @param object $context context object + * @package mod_quiz + * @category files + * @param stdClass $course course settings object + * @param stdClass $context context object * @param string $component the name of the component we are serving files for. * @param string $filearea the name of the file area. + * @param int $qubaid the attempt usage id. + * @param int $slot the id of a question in this quiz attempt. * @param array $args the remaining bits of the file path. * @param bool $forcedownload whether the user must be forced to download the file. * @return bool false if file not found, does not return if found - justsend the file diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index f4bba125c837d..6ad5cd93a88f6 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -71,7 +71,8 @@ function quiz_create_attempt($quiz, $attemptnumber, $lastattempt, $timenow, $isp if ($quiz->sumgrades < 0.000005 && $quiz->grade > 0.000005) { throw new moodle_exception('cannotstartgradesmismatch', 'quiz', - new moodle_url('/mod/quiz/view.php', array('q' => $quiz->id))); + new moodle_url('/mod/quiz/view.php', array('q' => $quiz->id)), + array('grade' => quiz_format_grade($quiz, $quiz->grade))); } if ($attemptnumber == 1 || !$quiz->attemptonlast) { diff --git a/mod/quiz/report/grading/db/access.php b/mod/quiz/report/grading/db/access.php index e3fdd609d69da..08295db07dfa6 100644 --- a/mod/quiz/report/grading/db/access.php +++ b/mod/quiz/report/grading/db/access.php @@ -17,8 +17,7 @@ /** * Capability definitions for the quiz manual grading report. * - * @package quiz - * @subpackage grading + * @package quiz_grading * @copyright 2010 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index 0ee9c33a5ecbe..30ed2d71fb571 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -126,11 +126,28 @@ public function display($quiz, $cm, $course) { $this->currentgroup, '', false); } + $questionsinquiz = quiz_questions_in_quiz($quiz->questions); + $counts = null; + if ($slot && $questionsinquiz) { + // Make sure there is something to do. + $statecounts = $this->get_question_state_summary(array($slot)); + foreach ($statecounts as $record) { + if ($record->questionid == $questionid) { + $counts = $record; + break; + } + } + // If not, redirect back to the list. + if (!$counts || $counts->$grade == 0) { + redirect($this->list_questions_url(), get_string('alldoneredirecting', 'quiz_grading')); + } + } + // Start output. $this->print_header_and_tabs($cm, $course, $quiz, 'grading'); // What sort of page to display? - if (!quiz_questions_in_quiz($quiz->questions)) { + if (!$questionsinquiz) { echo quiz_no_questions_message($quiz, $cm, $this->context); } else if (!$slot) { @@ -138,7 +155,7 @@ public function display($quiz, $cm, $course) { } else { $this->display_grading_interface($slot, $questionid, $grade, - $pagesize, $page, $shownames, $showidnumbers, $order); + $pagesize, $page, $shownames, $showidnumbers, $order, $counts); } return true; } @@ -313,25 +330,9 @@ protected function display_index($includeauto) { } protected function display_grading_interface($slot, $questionid, $grade, - $pagesize, $page, $shownames, $showidnumbers, $order) { + $pagesize, $page, $shownames, $showidnumbers, $order, $counts) { global $OUTPUT; - // Make sure there is something to do. - $statecounts = $this->get_question_state_summary(array($slot)); - - $counts = null; - foreach ($statecounts as $record) { - if ($record->questionid == $questionid) { - $counts = $record; - break; - } - } - - // If not, redirect back to the list. - if (!$counts || $counts->$grade == 0) { - redirect($this->list_questions_url(), get_string('alldoneredirecting', 'quiz_grading')); - } - if ($pagesize * $page >= $counts->$grade) { $page = 0; } diff --git a/mod/quiz/report/overview/db/install.xml b/mod/quiz/report/overview/db/install.xml index b077072a807fe..2a648769c0130 100644 --- a/mod/quiz/report/overview/db/install.xml +++ b/mod/quiz/report/overview/db/install.xml @@ -1,18 +1,18 @@ -
    - - - - - - - + + + + + + + diff --git a/mod/quiz/report/statistics/db/access.php b/mod/quiz/report/statistics/db/access.php index c29f1d45a0512..234e1694716a9 100644 --- a/mod/quiz/report/statistics/db/access.php +++ b/mod/quiz/report/statistics/db/access.php @@ -17,8 +17,7 @@ /** * Capability definitions for the quiz statistics report. * - * @package quiz - * @subpackage statistics + * @package quiz_statistics * @copyright 2008 Jamie Pratt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/quiz/report/statistics/db/install.xml b/mod/quiz/report/statistics/db/install.xml index fc95b19aa8737..7184605d7f32c 100644 --- a/mod/quiz/report/statistics/db/install.xml +++ b/mod/quiz/report/statistics/db/install.xml @@ -1,27 +1,27 @@ -
    - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -29,22 +29,22 @@
    - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -52,14 +52,14 @@
    - - - - - + + + + + - - + + diff --git a/mod/quiz/report/statistics/lib.php b/mod/quiz/report/statistics/lib.php index 0f3e262721b63..34026f851f4b0 100644 --- a/mod/quiz/report/statistics/lib.php +++ b/mod/quiz/report/statistics/lib.php @@ -29,7 +29,10 @@ /** * Serve questiontext files in the question text when they are displayed in this report. - * @param context $context the context + * + * @package mod_quiz + * @category files + * @param stdClass $context the context * @param int $questionid the question id * @param array $args remaining file args * @param bool $forcedownload diff --git a/mod/resource/backup/moodle2/backup_resource_activity_task.class.php b/mod/resource/backup/moodle2/backup_resource_activity_task.class.php index d92ff642e597c..4a28b44e40d71 100644 --- a/mod/resource/backup/moodle2/backup_resource_activity_task.class.php +++ b/mod/resource/backup/moodle2/backup_resource_activity_task.class.php @@ -16,40 +16,41 @@ // along with Moodle. If not, see . /** - * @package mod - * @subpackage resource - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_resource_activity_task class + * + * @package mod_resource + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; -require_once($CFG->dirroot . '/mod/resource/backup/moodle2/backup_resource_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/resource/backup/moodle2/backup_resource_stepslib.php'); /** - * resource backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the Resource instance */ class backup_resource_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the resource.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_resource_activity_structure_step('resource_structure', 'resource.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/resource/db/access.php b/mod/resource/db/access.php index 5abde1965cbfa..54453da95b4c1 100644 --- a/mod/resource/db/access.php +++ b/mod/resource/db/access.php @@ -1,5 +1,4 @@ -
    - - + + - - - - - - - - - - + + + + + + + + + + @@ -29,22 +29,22 @@
    - - + + - - - - + + + + - - - + + + - - + + diff --git a/mod/resource/lib.php b/mod/resource/lib.php index f5c80ca3ffb20..2b109b60e2220 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -309,9 +309,12 @@ function resource_cm_info_view(cm_info $cm) { /** * Lists all browsable file areas - * @param object $course - * @param object $cm - * @param object $context + * + * @package mod_resource + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object * @return array */ function resource_get_file_areas($course, $cm, $context) { @@ -322,16 +325,19 @@ function resource_get_file_areas($course, $cm, $context) { /** * File browsing support for resource module content area. - * @param object $browser - * @param object $areas - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return object file_info instance or null if not found + * + * @package mod_resource + * @category files + * @param stdClass $browser file browser instance + * @param stdClass $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info instance or null if not found */ function resource_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG; @@ -367,12 +373,15 @@ function resource_get_file_info($browser, $areas, $course, $cm, $context, $filea /** * Serves the resource files. - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * + * @package mod_resource + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - just send the file */ function resource_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/mod/scorm/backup/moodle2/backup_scorm_activity_task.class.php b/mod/scorm/backup/moodle2/backup_scorm_activity_task.class.php index da537f8bcd4f2..e6e8c022ca223 100644 --- a/mod/scorm/backup/moodle2/backup_scorm_activity_task.class.php +++ b/mod/scorm/backup/moodle2/backup_scorm_activity_task.class.php @@ -15,38 +15,41 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_scorm_activity_task class + * + * @package mod_scorm + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/scorm/backup/moodle2/backup_scorm_stepslib.php'); // Because it exists (must) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/scorm/backup/moodle2/backup_scorm_stepslib.php'); /** - * scorm backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides the steps to perform one complete backup of the SCORM instance */ class backup_scorm_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the scorm.xml file */ protected function define_my_steps() { - // SCORM only has one structure step $this->add_step(new backup_scorm_activity_structure_step('scorm_structure', 'scorm.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/scorm/db/access.php b/mod/scorm/db/access.php index b1919909f8345..101da76dc7ab8 100644 --- a/mod/scorm/db/access.php +++ b/mod/scorm/db/access.php @@ -17,11 +17,13 @@ /** * Capability definitions for the quiz module. * - * @package mod - * @subpackage scorm - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @package mod_scorm + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'mod/scorm:viewreport' => array( diff --git a/mod/scorm/db/install.xml b/mod/scorm/db/install.xml index fefbb5fc786c0..d9434b4fc88ac 100644 --- a/mod/scorm/db/install.xml +++ b/mod/scorm/db/install.xml @@ -1,45 +1,45 @@ -
    - - + + - - + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + @@ -50,13 +50,13 @@
    - - + + - + @@ -67,10 +67,10 @@
    - - + + - + @@ -79,14 +79,14 @@
    - - - - - + + + + + - + @@ -101,12 +101,12 @@
    - - - + + + - - + + @@ -116,14 +116,14 @@
    - - - - - - - - + + + + + + + + @@ -134,10 +134,10 @@
    - - + + - + @@ -148,11 +148,11 @@
    - - - + + + - + @@ -165,11 +165,11 @@
    - - + + - - + + @@ -181,9 +181,9 @@
    - - - + + + @@ -196,18 +196,18 @@
    - - - + + + - + - + - - + + diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 823b8232b70a4..e7dfeb8840a8f 100644 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -817,16 +817,18 @@ function scorm_get_file_areas($course, $cm, $context) { /** * File browsing support for SCORM file areas * - * @param stdclass $browser - * @param stdclass $areas - * @param stdclass $course - * @param stdclass $cm - * @param stdclass $context - * @param string $filearea - * @param int $itemid - * @param string $filepath - * @param string $filename - * @return stdclass file_info instance or null if not found + * @package mod_scorm + * @category files + * @param file_browser $browser file browser instance + * @param array $areas file areas + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param int $itemid item ID + * @param string $filepath file path + * @param string $filename file name + * @return file_info instance or null if not found */ function scorm_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG; @@ -880,12 +882,14 @@ function scorm_get_file_info($browser, $areas, $course, $cm, $context, $filearea /** * Serves scorm content, introduction images and packages. Implements needed access control ;-) * - * @param object $course - * @param object $cm - * @param object $context - * @param string $filearea - * @param array $args - * @param bool $forcedownload + * @package mod_scorm + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download * @return bool false if file not found, does not return if found - just send the file */ function scorm_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/mod/scorm/report/graphs/graph.php b/mod/scorm/report/graphs/graph.php new file mode 100644 index 0000000000000..2891739b4b784 --- /dev/null +++ b/mod/scorm/report/graphs/graph.php @@ -0,0 +1,193 @@ +. +/** + * Core Report class of graphs reporting plugin + * + * @package scormreport_graphs + * @copyright 2012 Ankit Kumar Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +define('NO_DEBUG_DISPLAY', true); + +require_once(dirname(__FILE__) . '/../../../../config.php'); +require_once($CFG->libdir . '/graphlib.php'); +require_once($CFG->dirroot.'/mod/scorm/report/reportlib.php'); +require_once($CFG->dirroot.'/mod/scorm/locallib.php'); + +$scoid = required_param('scoid', PARAM_INT);// sco ID + +$sco = $DB->get_record('scorm_scoes', array('id'=>$scoid), '*', MUST_EXIST); +$scorm = $DB->get_record('scorm', array('id'=>$sco->scorm), '*', MUST_EXIST); +$cm = get_coursemodule_from_instance('scorm', $scorm->id, 0, false, MUST_EXIST); +$course = $DB->get_record('course', array('id'=>$scorm->course), '*', MUST_EXIST); + + +// Capability Checks +require_login($course, false, $cm); +$contextmodule = context_module::instance($cm->id); +require_capability('mod/scorm:viewreport', $contextmodule); + +// find out current groups mode +$currentgroup = groups_get_activity_group($cm, true); + +// Group Check +if (empty($currentgroup)) { + // all users who can attempt scoes + if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', '', '', false)) { + $nostudents = true; + $allowedlist = ''; + } else { + $allowedlist = array_keys($students); + } +} else { + // all users who can attempt scoes and who are in the currently selected group + if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', $currentgroup, '', false)) { + $nostudents = true; + $groupstudents = array(); + } + $allowedlist = array_keys($groupstudents); +} + +$params = array(); +list($usql, $params) = $DB->get_in_or_equal($allowedlist); +$params[] = $scoid; + +// Determine Sco keys to be used +if (scorm_version_check($scorm->version, SCORM_13)) { + $maxkey = 'cmi.score.max'; + $minkey = 'cmi.score.min'; + $scorekey = 'cmi.score.raw'; +} else { + $maxkey = 'cmi.core.score.max'; + $minkey = 'cmi.core.score.min'; + $scorekey = 'cmi.core.score.raw'; +} +$bands = 11; +$bandwidth = 10; + +// Determine maximum % secured for each user. +$usergrades = array(); +$graphdata = array(); +for ($i = 0; $i < $bands; $i++) { + $graphdata[$i] = 0; +} + + +// Do this only if we have students to report +if(!$nostudents) { + // Construct the SQL + $select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, '; + $select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid '; + $from = 'FROM {scorm_scoes_track} st '; + $where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?'; + $attempts = $DB->get_records_sql($select.$from.$where, $params); + + foreach ($attempts as $attempt) { + if ($trackdata = scorm_get_tracks($scoid, $attempt->userid, $attempt->attempt)) { + if (isset($trackdata->$scorekey)) { + $score = $trackdata->$scorekey; + if (!isset($trackdata->$minkey) || empty($trackdata->$minkey)) { + $minmark = 0; + } else { + $minmark = $trackdata->$minkey; + } + if (!isset($trackdata->$maxkey) || empty($trackdata->$maxkey)) { + $maxmark = 100; + } else { + $maxmark = $trackdata->$maxkey; + } + $range = ($maxmark - $minmark); + if (empty($range)) { + continue; + } + $percent = round((($score*100)/$range), 2); + if (empty($usergrades[$attempt->userid]) || !isset($usergrades[$attempt->userid]) || ($percent > $usergrades[$attempt->userid]) || ($usergrades[$attempt->userid] === '*')) { + $usergrades[$attempt->userid] = $percent; + } + unset($percent); + } else { + // User has made an attempt but either SCO was not able to record the score or something else is broken in SCO + if (!isset($usergrades[$attempt->userid])) { + $usergrades[$attempt->userid] = '*'; + } + } + } + } +} + +$bandlabels[] = get_string('invaliddata', 'scormreport_graphs'); +for ($i = 1; $i <= $bands-1; $i++) { + $bandlabels[] = ($i - 1) * $bandwidth . ' - ' . $i * $bandwidth; +} +// Recording all users who attempted the SCO,but resulting data was invalid. +foreach ($usergrades as $userpercent) { + if ($userpercent === '*') { + $graphdata[0]++; + } else { + $gradeband = floor($userpercent/10); + if ($gradeband != ($bands - 1)) { + $gradeband++; + } + $graphdata[$gradeband]++; + } +} + +$line = new graph(800, 600); +$line->parameter['title'] = ''; +$line->parameter['y_label_left'] = get_string('participants', 'scormreport_graphs'); +$line->parameter['x_label'] = get_string('percent', 'scormreport_graphs'); +$line->parameter['y_label_angle'] = 90; +$line->parameter['x_label_angle'] = 0; +$line->parameter['x_axis_angle'] = 60; + +//following two lines seem to silence notice warnings from graphlib.php +$line->y_tick_labels = null; +$line->offset_relation = null; + +$line->parameter['bar_size'] = 1; +// don't forget to increase spacing so that graph doesn't become one big block of colour +$line->parameter['bar_spacing'] = 10; +$line->x_data = $bandlabels; + +$line->y_format['allusers'] = array( + 'colour' => 'red', + 'bar' => 'fill', + 'shadow_offset' => 1, + 'legend' => get_string('allparticipants') +); +ksort($graphdata); +$line->y_data['allusers'] = $graphdata; +$line->y_order = array('allusers'); + +$ymax = max($line->y_data['allusers']); +$line->parameter['y_min_left'] = 0; // start at 0 +$line->parameter['y_max_left'] = $ymax; +$line->parameter['y_decimal_left'] = 0; // 2 decimal places for y axis. + +//pick a sensible number of gridlines depending on max value on graph. +$gridlines = $ymax; +while ($gridlines >= 10) { + if ($gridlines >= 50) { + $gridlines /= 5; + } else { + $gridlines /= 2; + } +} + +$line->parameter['y_axis_gridlines'] = $gridlines + 1; + +$line->draw(); diff --git a/mod/scorm/report/graphs/lang/en/scormreport_graphs.php b/mod/scorm/report/graphs/lang/en/scormreport_graphs.php new file mode 100644 index 0000000000000..81bdbd7a233b9 --- /dev/null +++ b/mod/scorm/report/graphs/lang/en/scormreport_graphs.php @@ -0,0 +1,31 @@ +. + +/** + * Strings for component 'scorm_basic' report plugin + * + * @package scormreport_graphs + * @copyright 2012 Ankit Kumar Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$string['participants'] = 'Number of participants'; +$string['pluginname'] = 'Graph report'; +$string['percent'] = 'Percent(%) secured'; +$string['invaliddata'] = 'Not enough data'; + + + diff --git a/mod/scorm/report/graphs/report.php b/mod/scorm/report/graphs/report.php new file mode 100644 index 0000000000000..d9d532b103c80 --- /dev/null +++ b/mod/scorm/report/graphs/report.php @@ -0,0 +1,63 @@ +. +/** + * Core Report class of graphs reporting plugin + * + * @package scormreport_graphs + * @copyright 2012 Ankit Kumar Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); +/** + * Main class to control the graphs reporting + * + * @package scormreport_graphs + * @copyright 2012 Ankit Kumar Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +class scorm_graphs_report extends scorm_default_report { + /** + * Displays the full report + * + * @param stdClass $scorm full SCORM object + * @param stdClass $cm - full course_module object + * @param stdClass $course - full course object + * @param string $download - type of download being requested + */ + function display($scorm, $cm, $course, $download) { + global $DB, $OUTPUT, $PAGE; + + if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used + groups_print_activity_menu($cm, new moodle_url($PAGE->url)); + } + + if ($scoes = $DB->get_records('scorm_scoes', array("scorm"=>$scorm->id), 'id')) { + foreach ($scoes as $sco) { + if ($sco->launch != '') { + $imageurl = new moodle_url('/mod/scorm/report/graphs/graph.php', + array('scoid' => $sco->id)); + $graphname = $sco->title; + echo $OUTPUT->heading($graphname); + echo html_writer::tag('div', html_writer::empty_tag('img', + array('src' => $imageurl, 'alt' => $graphname)), + array('class' => 'graph')); + } + } + } + } +} diff --git a/mod/scorm/report/graphs/version.php b/mod/scorm/report/graphs/version.php new file mode 100644 index 0000000000000..19b6c13242b4b --- /dev/null +++ b/mod/scorm/report/graphs/version.php @@ -0,0 +1,30 @@ +. + + +/** + * Defines the version of scormreport_graphs + * + * @package scormreport_graphs + * @copyright 2012 Ankit Kumar Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->version = 2012021000; // The current plugin version (Date: YYYYMMDDXX) +$plugin->requires = 2011120500; // Requires this Moodle version +$plugin->component = 'scormreport_graphs'; // Full name of the plugin (used for diagnostics) diff --git a/mod/scorm/styles.css b/mod/scorm/styles.css index 736afa55cc2bd..fe38c21b5935c 100644 --- a/mod/scorm/styles.css +++ b/mod/scorm/styles.css @@ -27,6 +27,8 @@ #page-mod-scorm-player #altpopuplink {position: left; padding: 5px; border: 0px; } #page-mod-scorm-player #scormmode {float: left; border: 0px; } #page-mod-scorm-player.pagelayout-popup #page-content .region-content {padding: 0px; } +#page-mod-scorm-player.pagelayout-popup #page-wrapper {width:100%;} +#page-mod-scorm-player .yui-layout-scroll div.yui-layout-bd {overflow:visible;} .path-mod-scorm.forcejavascript .scorm-center { display:none;} .path-mod-scorm.forcejavascript .toc { display:none;} @@ -35,4 +37,4 @@ .path-mod-scorm.jsenabled .forcejavascriptmessage {display: none;} .path-mod-scorm.jsenabled .scorm-center { display:block;} .path-mod-scorm.jsenabled .toc { display:block;} -.path-mod-scorm.jsenabled #scormpage #tocbox { display:block;} \ No newline at end of file +.path-mod-scorm.jsenabled #scormpage #tocbox { display:block;} diff --git a/mod/survey/backup/moodle2/backup_survey_activity_task.class.php b/mod/survey/backup/moodle2/backup_survey_activity_task.class.php index 6a8dd697dc3a5..8f66bd8e73282 100644 --- a/mod/survey/backup/moodle2/backup_survey_activity_task.class.php +++ b/mod/survey/backup/moodle2/backup_survey_activity_task.class.php @@ -16,38 +16,41 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @subpackage backup-moodle2 - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_survey_activity_task class + * + * @package mod_survey + * @category backup + * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once($CFG->dirroot . '/mod/survey/backup/moodle2/backup_survey_stepslib.php'); // Because it exists (must) +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/survey/backup/moodle2/backup_survey_stepslib.php'); /** - * survey backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides all the settings and steps to perform one complete backup of the activity */ class backup_survey_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the survey.xml file */ protected function define_my_steps() { - // Choice only has one structure step $this->add_step(new backup_survey_activity_structure_step('survey_structure', 'survey.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/survey/db/access.php b/mod/survey/db/access.php index 859007710e005..212d71c5d1b3c 100644 --- a/mod/survey/db/access.php +++ b/mod/survey/db/access.php @@ -1,32 +1,28 @@ : -// -// component_name should be the same as the directory name of the mod or block. -// -// Core moodle capabilities are defined thus: -// moodle/: -// -// Examples: mod/forum:viewpost -// block/recent_activity:view -// moodle/site:deleteuser -// -// The variable name for the capability definitions array is $capabilities +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Plugin capabilities + * + * @package mod_survey + * @copyright 2006 Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/mod/survey/db/install.xml b/mod/survey/db/install.xml index 051a13c3af365..b4e4d1cab1d42 100644 --- a/mod/survey/db/install.xml +++ b/mod/survey/db/install.xml @@ -1,20 +1,20 @@ -
    - - - - - - + + + + + + - - + + @@ -26,13 +26,13 @@
    - + - - + + @@ -40,13 +40,13 @@
    - - - - - - - + + + + + + + @@ -59,10 +59,10 @@
    - - - - + + + + diff --git a/mod/url/backup/moodle2/backup_url_activity_task.class.php b/mod/url/backup/moodle2/backup_url_activity_task.class.php index 8ebb801dbd245..de1ff7c110fb8 100644 --- a/mod/url/backup/moodle2/backup_url_activity_task.class.php +++ b/mod/url/backup/moodle2/backup_url_activity_task.class.php @@ -16,43 +16,41 @@ // along with Moodle. If not, see . /** - * @package mod - * @subpackage url - * @copyright 2010 onwards Andrew Davis - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Defines backup_url_activity_task class + * + * @package mod_url + * @category backup + * @copyright 2010 onwards Andrew Davis + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; - // This activity has not particular settings but the inherited from the generic - // backup_activity_task so here there isn't any class definition, like the ones - // existing in /backup/moodle2/backup_settingslib.php (activities section) - -require_once($CFG->dirroot . '/mod/url/backup/moodle2/backup_url_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/url/backup/moodle2/backup_url_stepslib.php'); /** - * URL backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Provides all the settings and steps to perform one complete backup of the activity */ class backup_url_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the url.xml file */ protected function define_my_steps() { $this->add_step(new backup_url_activity_structure_step('url_structure', 'url.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/url/db/access.php b/mod/url/db/access.php index e7196ac50dbb8..c0d4d813ded0d 100644 --- a/mod/url/db/access.php +++ b/mod/url/db/access.php @@ -1,5 +1,4 @@ -
    - - + + - - - - - - - + + + + + + + diff --git a/mod/wiki/backup/moodle2/backup_wiki_activity_task.class.php b/mod/wiki/backup/moodle2/backup_wiki_activity_task.class.php index 09062a9efd249..fd44b98c955bc 100644 --- a/mod/wiki/backup/moodle2/backup_wiki_activity_task.class.php +++ b/mod/wiki/backup/moodle2/backup_wiki_activity_task.class.php @@ -1,32 +1,57 @@ dirroot . '/mod/wiki/backup/moodle2/backup_wiki_stepslib.php'); // Because it exists (must) -require_once($CFG->dirroot . '/mod/wiki/backup/moodle2/backup_wiki_settingslib.php'); // Because it exists (optional) +// 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 . /** - * wiki backup task that provides all the settings and steps to perform one - * complete backup of the activity + * Defines backup_wiki_activity_task class + * + * @package mod_wiki + * @category backup + * @copyright 2010 Jordi Piguillem + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/wiki/backup/moodle2/backup_wiki_stepslib.php'); +require_once($CFG->dirroot . '/mod/wiki/backup/moodle2/backup_wiki_settingslib.php'); + +/** + * Provides all the settings and steps to perform one complete backup of the activity */ class backup_wiki_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity - } + } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the wiki.xml file */ protected function define_my_steps() { - // Wiki only has one structure step $this->add_step(new backup_wiki_activity_structure_step('wiki_structure', 'wiki.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/wiki/db/access.php b/mod/wiki/db/access.php index ead3849d9c08a..40b0d2654bc0c 100644 --- a/mod/wiki/db/access.php +++ b/mod/wiki/db/access.php @@ -1,14 +1,29 @@ . + /** + * Plugin capabilities * - * This file defines all wiki module specific capabilities - * - * @author Jordi Piguillem - * - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package wiki + * @package mod_wiki + * @author Jordi Piguillem + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'mod/wiki:viewpage' => array( diff --git a/mod/wiki/db/install.xml b/mod/wiki/db/install.xml index 608dcb6085866..d6000c0b45329 100644 --- a/mod/wiki/db/install.xml +++ b/mod/wiki/db/install.xml @@ -1,24 +1,24 @@ -
    - - + + - - - - + + + + - - - + + + @@ -29,10 +29,10 @@
    - - - - + + + + @@ -42,16 +42,16 @@
    - - + + - - - - - - - + + + + + + + @@ -61,13 +61,13 @@
    - - - + + + - - - + + + @@ -76,9 +76,9 @@
    - - - + + + @@ -88,10 +88,10 @@
    - - - - + + + + @@ -102,11 +102,11 @@
    - - + + - - + + diff --git a/mod/wiki/lib.php b/mod/wiki/lib.php index 4f573ce2f1d17..d1e78cb7fee9c 100644 --- a/mod/wiki/lib.php +++ b/mod/wiki/lib.php @@ -434,9 +434,17 @@ function wiki_scale_used_anywhere($scaleid) { } /** - * Pluginfile hook + * file serving callback * - * @author Josep Arus + * @copyright Josep Arus + * @package mod_wiki + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download */ function wiki_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; diff --git a/mod/wiki/locallib.php b/mod/wiki/locallib.php index db4bf8c02e54b..4270d2b42750e 100644 --- a/mod/wiki/locallib.php +++ b/mod/wiki/locallib.php @@ -490,7 +490,7 @@ function wiki_get_orphaned_pages($swid) { AND s.id = ? AND w.id = s.wikiid AND p.title != w.firstpagetitle - AND p.id NOT IN (SELECT topageid FROM {wiki_links} WHERE subwikiid = ?);"; + AND p.id NOT IN (SELECT topageid FROM {wiki_links} WHERE subwikiid = ?)"; return $DB->get_records_sql($sql, array($swid, $swid, $swid)); } diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index ac21684ebc49e..d14c92b498f24 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -1247,7 +1247,7 @@ private function print_history_content() { $time = userdate($row->timecreated, get_string('strftimetime', 'langconfig')); $versionid = wiki_get_version($row->id); $versionlink = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $versionid->id)); - $userlink = new moodle_url('/user/view.php', array('id' => $username->id)); + $userlink = new moodle_url('/user/view.php', array('id' => $username->id, 'course' => $PAGE->cm->course)); $contents[] = array('', html_writer::link($versionlink->out(false), $row->version), $picture . html_writer::link($userlink->out(false), fullname($username)), $time, $OUTPUT->container($date, 'wiki_histdate')); $table = new html_table(); @@ -1275,7 +1275,7 @@ private function print_history_content() { } else { $viewlink = $version->version; } - $userlink = new moodle_url('/user/view.php', array('id' => $version->userid)); + $userlink = new moodle_url('/user/view.php', array('id' => $version->userid, 'course' => $PAGE->cm->course)); $contents[] = array($this->choose_from_radio(array($version->version => null), 'compare', 'M.mod_wiki.history()', $checked - 1, true) . $this->choose_from_radio(array($version->version => null), 'comparewith', 'M.mod_wiki.history()', $checked, true), $viewlink, $picture . html_writer::link($userlink->out(false), fullname($user)), $time, $OUTPUT->container($date, 'wiki_histdate')); } @@ -2531,10 +2531,11 @@ protected function add_page_delete_options($pages, $swid, &$table) { /** * Prints lists of versions which can be deleted * - * @global object $OUTPUT + * @global core_renderer $OUTPUT + * @global moodle_page $PAGE */ private function print_delete_version() { - global $OUTPUT; + global $OUTPUT, $PAGE; $pageid = $this->page->id; // versioncount is the latest version @@ -2564,7 +2565,7 @@ private function print_delete_version() { $time = userdate($row->timecreated, get_string('strftimetime', 'langconfig')); $versionid = wiki_get_version($row->id); $versionlink = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $versionid->id)); - $userlink = new moodle_url('/user/view.php', array('id' => $username->id)); + $userlink = new moodle_url('/user/view.php', array('id' => $username->id, 'course' => $PAGE->cm->course)); $picturelink = $picture . html_writer::link($userlink->out(false), fullname($username)); $historydate = $OUTPUT->container($date, 'wiki_histdate'); $contents[] = array('', html_writer::link($versionlink->out(false), $row->version), $picturelink, $time, $historydate); @@ -2601,7 +2602,7 @@ private function print_delete_version() { $viewlink = $version->version; } - $userlink = new moodle_url('/user/view.php', array('id' => $version->userid)); + $userlink = new moodle_url('/user/view.php', array('id' => $version->userid, 'course' => $PAGE->cm->course)); $picturelink = $picture . html_writer::link($userlink->out(false), fullname($user)); $historydate = $OUTPUT->container($date, 'wiki_histdate'); $radiofromelement = $this->choose_from_radio(array($version->version => null), 'fromversion', 'M.mod_wiki.deleteversion()', $versioncount, true); diff --git a/mod/workshop/backup/moodle2/backup_workshop_activity_task.class.php b/mod/workshop/backup/moodle2/backup_workshop_activity_task.class.php index 7f6398c365b80..c9edbe76c54ea 100644 --- a/mod/workshop/backup/moodle2/backup_workshop_activity_task.class.php +++ b/mod/workshop/backup/moodle2/backup_workshop_activity_task.class.php @@ -16,12 +16,12 @@ // along with Moodle. If not, see . /** - * Class {@link backup_workshop_activity_task} definition + * Defines {@link backup_workshop_activity_task} class * - * @package mod - * @subpackage workshop - * @copyright 2010 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_workshop + * @category backup + * @copyright 2010 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); @@ -35,22 +35,23 @@ class backup_workshop_activity_task extends backup_activity_task { /** - * Define (add) particular settings this activity can have + * No specific settings for this activity */ protected function define_my_settings() { - // No particular settings for this activity } /** - * Define (add) particular steps this activity can have + * Defines a backup step to store the instance data in the workshop.xml file */ protected function define_my_steps() { $this->add_step(new backup_workshop_activity_structure_step('workshop_structure', 'workshop.xml')); } /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; diff --git a/mod/workshop/backup/moodle2/backup_workshop_settingslib.php b/mod/workshop/backup/moodle2/backup_workshop_settingslib.php index 5214e82d85145..87689fb1bea38 100644 --- a/mod/workshop/backup/moodle2/backup_workshop_settingslib.php +++ b/mod/workshop/backup/moodle2/backup_workshop_settingslib.php @@ -21,10 +21,10 @@ * Workshop has no particular settings but the inherited from the generic * {@link backup_activity_task}. * - * @package mod - * @subpackage workshop - * @copyright 2010 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_workshop + * @category backup + * @copyright 2010 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/mod/workshop/backup/moodle2/backup_workshop_stepslib.php b/mod/workshop/backup/moodle2/backup_workshop_stepslib.php index f2a6273bd8012..26e6adf84cc03 100644 --- a/mod/workshop/backup/moodle2/backup_workshop_stepslib.php +++ b/mod/workshop/backup/moodle2/backup_workshop_stepslib.php @@ -18,10 +18,10 @@ /** * Defines all the backup steps that will be used by {@link backup_workshop_activity_task} * - * @package mod - * @subpackage workshop - * @copyright 2010 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_workshop + * @category backup + * @copyright 2010 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); @@ -29,10 +29,15 @@ /** * Defines the complete workshop structure for backup, with file and id annotations * - * @see http://docs.moodle.org/dev/Workshop for XML structure diagram + * @link http://docs.moodle.org/dev/Workshop for XML structure diagram */ class backup_workshop_activity_structure_step extends backup_activity_structure_step { + /** + * Defines the structure of the 'workshop' element inside the workshop.xml file + * + * @return backup_nested_element + */ protected function define_structure() { // are we including userinfo? diff --git a/mod/workshop/db/access.php b/mod/workshop/db/access.php index 5749b27ecbb7a..d1e38e83e2102 100644 --- a/mod/workshop/db/access.php +++ b/mod/workshop/db/access.php @@ -1,5 +1,4 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/db/install.xml b/mod/workshop/db/install.xml index afc44e29f4e20..e570e0e128ab5 100644 --- a/mod/workshop/db/install.xml +++ b/mod/workshop/db/install.xml @@ -1,38 +1,38 @@ -
    - - + + - + - + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -41,25 +41,25 @@
    - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + @@ -70,20 +70,20 @@
    - - - - - - - - - - + + + + + + + + + + - + - + @@ -94,13 +94,13 @@
    - - + + - - + + - + @@ -110,11 +110,11 @@
    - - - - - + + + + + @@ -125,40 +125,40 @@
    - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -169,17 +169,17 @@
    - - - - - - - - - + + + + + + + + + - + @@ -188,13 +188,13 @@
    - - - - - + + + + + - + @@ -203,19 +203,19 @@
    - - - + + + - - - - - - - + + + + + + + - + @@ -228,23 +228,23 @@
    - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + @@ -258,14 +258,14 @@
    - - - - - - + + + + + + - + @@ -275,12 +275,12 @@
    - - - - + + + + - + @@ -289,15 +289,15 @@
    - - - - - - - + + + + + + + - + diff --git a/mod/workshop/eval/best/db/install.xml b/mod/workshop/eval/best/db/install.xml index b0d6dcca7edf0..a7b8197b0eba9 100644 --- a/mod/workshop/eval/best/db/install.xml +++ b/mod/workshop/eval/best/db/install.xml @@ -1,14 +1,14 @@ -
    - - - + + + diff --git a/mod/workshop/form/accumulative/assessment_form.php b/mod/workshop/form/accumulative/assessment_form.php index 242690d5ab7ac..a6ca71ceb1451 100644 --- a/mod/workshop/form/accumulative/assessment_form.php +++ b/mod/workshop/form/accumulative/assessment_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to assess a submission by accumulative grading strategy * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/backup/moodle1/lib.php b/mod/workshop/form/accumulative/backup/moodle1/lib.php index c33e8bcefc10a..4ebce9f633407 100644 --- a/mod/workshop/form/accumulative/backup/moodle1/lib.php +++ b/mod/workshop/form/accumulative/backup/moodle1/lib.php @@ -18,8 +18,7 @@ /** * Provides support for the conversion of moodle1 backup to the moodle2 format * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/backup/moodle2/backup_workshopform_accumulative_subplugin.class.php b/mod/workshop/form/accumulative/backup/moodle2/backup_workshopform_accumulative_subplugin.class.php index 2421a1e76051d..271fb5946cb6f 100644 --- a/mod/workshop/form/accumulative/backup/moodle2/backup_workshopform_accumulative_subplugin.class.php +++ b/mod/workshop/form/accumulative/backup/moodle2/backup_workshopform_accumulative_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php b/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php index dc2418b686af3..d9fd712cb35fa 100644 --- a/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php +++ b/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/db/install.php b/mod/workshop/form/accumulative/db/install.php index 2b847226e502e..b8b7a0521c358 100644 --- a/mod/workshop/form/accumulative/db/install.php +++ b/mod/workshop/form/accumulative/db/install.php @@ -19,8 +19,7 @@ * This file replaces the legacy STATEMENTS section in db/install.xml, * lib.php/modulename_install() post installation hook and partially defaults.php * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/db/install.xml b/mod/workshop/form/accumulative/db/install.xml index 075cf24521edf..a37e571faafce 100644 --- a/mod/workshop/form/accumulative/db/install.xml +++ b/mod/workshop/form/accumulative/db/install.xml @@ -1,18 +1,18 @@ -
    - - - + + + - - - + + + diff --git a/mod/workshop/form/accumulative/db/upgrade.php b/mod/workshop/form/accumulative/db/upgrade.php index 3fa5e17ec5676..5ff3a28f6dc10 100644 --- a/mod/workshop/form/accumulative/db/upgrade.php +++ b/mod/workshop/form/accumulative/db/upgrade.php @@ -18,8 +18,7 @@ /** * Keeps track of upgrades to the workshop accumulative grading strategy * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/edit_form.php b/mod/workshop/form/accumulative/edit_form.php index 2cd040a55a151..7ecb3dbb0a640 100644 --- a/mod/workshop/form/accumulative/edit_form.php +++ b/mod/workshop/form/accumulative/edit_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to edit accumulative grading strategy forms. * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/lang/en/workshopform_accumulative.php b/mod/workshop/form/accumulative/lang/en/workshopform_accumulative.php index 2ad796a93564b..41a26e5737c6b 100644 --- a/mod/workshop/form/accumulative/lang/en/workshopform_accumulative.php +++ b/mod/workshop/form/accumulative/lang/en/workshopform_accumulative.php @@ -18,8 +18,7 @@ /** * Strings for component 'workshopform_accumulative', language 'en', branch 'MOODLE_20_STABLE' * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/lib.php b/mod/workshop/form/accumulative/lib.php index 1c960e20f3c77..2a266281c009e 100644 --- a/mod/workshop/form/accumulative/lib.php +++ b/mod/workshop/form/accumulative/lib.php @@ -18,8 +18,7 @@ /** * This file defines a class with accumulative grading strategy logic * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,6 +28,18 @@ require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues +/** + * Server workshop files + * + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool + */ function workshopform_accumulative_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload) { global $DB; diff --git a/mod/workshop/form/accumulative/simpletest/testlib.php b/mod/workshop/form/accumulative/simpletest/testlib.php index f418c03bea678..3485aba1fa3cd 100644 --- a/mod/workshop/form/accumulative/simpletest/testlib.php +++ b/mod/workshop/form/accumulative/simpletest/testlib.php @@ -18,8 +18,7 @@ /** * Unit tests for Accumulative grading strategy logic * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/accumulative/version.php b/mod/workshop/form/accumulative/version.php index bc09f65d23eed..595443a4394c8 100644 --- a/mod/workshop/form/accumulative/version.php +++ b/mod/workshop/form/accumulative/version.php @@ -21,8 +21,7 @@ * This code fragment is called by moodle_needs_upgrading() and * /admin/index.php * - * @package workshopform - * @subpackage accumulative + * @package workshopform_accumulative * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/assessment_form.php b/mod/workshop/form/comments/assessment_form.php index da2bc8f5bdce9..1dc19e115d8d6 100644 --- a/mod/workshop/form/comments/assessment_form.php +++ b/mod/workshop/form/comments/assessment_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to assess a submission by comments grading strategy * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/backup/moodle1/lib.php b/mod/workshop/form/comments/backup/moodle1/lib.php index 10b6b282650f1..5d557a443c68e 100644 --- a/mod/workshop/form/comments/backup/moodle1/lib.php +++ b/mod/workshop/form/comments/backup/moodle1/lib.php @@ -18,8 +18,7 @@ /** * Provides support for the conversion of moodle1 backup to the moodle2 format * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/backup/moodle2/backup_workshopform_comments_subplugin.class.php b/mod/workshop/form/comments/backup/moodle2/backup_workshopform_comments_subplugin.class.php index 4c6c0034ff92c..54f3d091593ee 100644 --- a/mod/workshop/form/comments/backup/moodle2/backup_workshopform_comments_subplugin.class.php +++ b/mod/workshop/form/comments/backup/moodle2/backup_workshopform_comments_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/backup/moodle2/restore_workshopform_comments_subplugin.class.php b/mod/workshop/form/comments/backup/moodle2/restore_workshopform_comments_subplugin.class.php index d72d72de38148..f32b017490b53 100644 --- a/mod/workshop/form/comments/backup/moodle2/restore_workshopform_comments_subplugin.class.php +++ b/mod/workshop/form/comments/backup/moodle2/restore_workshopform_comments_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2010 onwards David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/db/install.php b/mod/workshop/form/comments/db/install.php index 5dbde2c1025e0..e4bfdd3ac2923 100644 --- a/mod/workshop/form/comments/db/install.php +++ b/mod/workshop/form/comments/db/install.php @@ -19,8 +19,7 @@ * This file replaces the legacy STATEMENTS section in db/install.xml, * lib.php/modulename_install() post installation hook and partially defaults.php * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/db/install.xml b/mod/workshop/form/comments/db/install.xml index 191ae1adfabb5..d83002e9ea6b5 100644 --- a/mod/workshop/form/comments/db/install.xml +++ b/mod/workshop/form/comments/db/install.xml @@ -1,16 +1,16 @@ -
    - - - + + + - + diff --git a/mod/workshop/form/comments/db/upgrade.php b/mod/workshop/form/comments/db/upgrade.php index 31bb6c3b1f6b9..07100d555b223 100644 --- a/mod/workshop/form/comments/db/upgrade.php +++ b/mod/workshop/form/comments/db/upgrade.php @@ -18,8 +18,7 @@ /** * Keeps track of upgrades to the workshop comments grading strategy * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/edit_form.php b/mod/workshop/form/comments/edit_form.php index 2019456278b69..9b819f1c4143e 100644 --- a/mod/workshop/form/comments/edit_form.php +++ b/mod/workshop/form/comments/edit_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to edit comments grading strategy forms. * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/lang/en/workshopform_comments.php b/mod/workshop/form/comments/lang/en/workshopform_comments.php index 8083b05e81813..c331288a35f53 100644 --- a/mod/workshop/form/comments/lang/en/workshopform_comments.php +++ b/mod/workshop/form/comments/lang/en/workshopform_comments.php @@ -18,8 +18,7 @@ /** * Strings for component 'workshopform_comments', language 'en', branch 'MOODLE_20_STABLE' * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/comments/lib.php b/mod/workshop/form/comments/lib.php index 156eef8555a4a..1e7723f1059bd 100644 --- a/mod/workshop/form/comments/lib.php +++ b/mod/workshop/form/comments/lib.php @@ -18,8 +18,7 @@ /** * This file defines a class with comments grading strategy logic * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,6 +28,18 @@ require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues +/** + * Server workshop files + * + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool + */ function workshopform_comments_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload) { global $DB; diff --git a/mod/workshop/form/comments/version.php b/mod/workshop/form/comments/version.php index 4d944040a5aed..7e93bd646e0cb 100644 --- a/mod/workshop/form/comments/version.php +++ b/mod/workshop/form/comments/version.php @@ -21,8 +21,7 @@ * This code fragment is called by moodle_needs_upgrading() and * /admin/index.php * - * @package workshopform - * @subpackage comments + * @package workshopform_comments * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/assessment_form.php b/mod/workshop/form/numerrors/assessment_form.php index 90ec66f66e268..84cc45023247d 100644 --- a/mod/workshop/form/numerrors/assessment_form.php +++ b/mod/workshop/form/numerrors/assessment_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to assess a submission by numerrors grading strategy * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/backup/moodle1/lib.php b/mod/workshop/form/numerrors/backup/moodle1/lib.php index a88a2b30ee97d..d2c631038112d 100644 --- a/mod/workshop/form/numerrors/backup/moodle1/lib.php +++ b/mod/workshop/form/numerrors/backup/moodle1/lib.php @@ -18,8 +18,7 @@ /** * Provides support for the conversion of moodle1 backup to the moodle2 format * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/backup/moodle2/backup_workshopform_numerrors_subplugin.class.php b/mod/workshop/form/numerrors/backup/moodle2/backup_workshopform_numerrors_subplugin.class.php index 78cf7324d50e9..6c330bfe220cc 100644 --- a/mod/workshop/form/numerrors/backup/moodle2/backup_workshopform_numerrors_subplugin.class.php +++ b/mod/workshop/form/numerrors/backup/moodle2/backup_workshopform_numerrors_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2010 onwards David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/backup/moodle2/restore_workshopform_numerrors_subplugin.class.php b/mod/workshop/form/numerrors/backup/moodle2/restore_workshopform_numerrors_subplugin.class.php index ce81fcb5eda74..d5d76cbb23baf 100644 --- a/mod/workshop/form/numerrors/backup/moodle2/restore_workshopform_numerrors_subplugin.class.php +++ b/mod/workshop/form/numerrors/backup/moodle2/restore_workshopform_numerrors_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2010 onwards David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/db/install.php b/mod/workshop/form/numerrors/db/install.php index 6a9e7dc264058..7ce64e916eb53 100644 --- a/mod/workshop/form/numerrors/db/install.php +++ b/mod/workshop/form/numerrors/db/install.php @@ -19,8 +19,7 @@ * This file replaces the legacy STATEMENTS section in db/install.xml, * lib.php/modulename_install() post installation hook and partially defaults.php * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/db/install.xml b/mod/workshop/form/numerrors/db/install.xml index 0107271b96c08..d3f3528346332 100644 --- a/mod/workshop/form/numerrors/db/install.xml +++ b/mod/workshop/form/numerrors/db/install.xml @@ -1,20 +1,20 @@ -
    - - - + + + - - + + - + @@ -23,10 +23,10 @@
    - - - - + + + + diff --git a/mod/workshop/form/numerrors/db/upgrade.php b/mod/workshop/form/numerrors/db/upgrade.php index 386fdeed0a32d..3da30666389f6 100644 --- a/mod/workshop/form/numerrors/db/upgrade.php +++ b/mod/workshop/form/numerrors/db/upgrade.php @@ -18,8 +18,7 @@ /** * Keeps track of upgrades to the workshop numerrors grading strategy * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/edit_form.php b/mod/workshop/form/numerrors/edit_form.php index a0fe35189be55..3ccce763435fd 100644 --- a/mod/workshop/form/numerrors/edit_form.php +++ b/mod/workshop/form/numerrors/edit_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to edit "Number of errors" grading strategy forms. * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/lang/en/workshopform_numerrors.php b/mod/workshop/form/numerrors/lang/en/workshopform_numerrors.php index 1ffe8ee6b3d5c..a37c4075a8a7d 100644 --- a/mod/workshop/form/numerrors/lang/en/workshopform_numerrors.php +++ b/mod/workshop/form/numerrors/lang/en/workshopform_numerrors.php @@ -18,8 +18,7 @@ /** * Strings for component 'workshopform_numerrors', language 'en', branch 'MOODLE_20_STABLE' * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/lib.php b/mod/workshop/form/numerrors/lib.php index 8abe992086c12..2fd0ce905499a 100644 --- a/mod/workshop/form/numerrors/lib.php +++ b/mod/workshop/form/numerrors/lib.php @@ -18,8 +18,7 @@ /** * This file defines a class with "Number of errors" grading strategy logic * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,6 +28,18 @@ require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues +/** + * Server workshop files + * + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool + */ function workshopform_numerrors_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload) { global $DB; diff --git a/mod/workshop/form/numerrors/settings.php b/mod/workshop/form/numerrors/settings.php index 54da4b18edf53..1ca9889422b30 100644 --- a/mod/workshop/form/numerrors/settings.php +++ b/mod/workshop/form/numerrors/settings.php @@ -20,8 +20,7 @@ * * The values defined here are often used as defaults for all module instances. * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/simpletest/testlib.php b/mod/workshop/form/numerrors/simpletest/testlib.php index c0528c8d3163a..57ee3baa67b8a 100644 --- a/mod/workshop/form/numerrors/simpletest/testlib.php +++ b/mod/workshop/form/numerrors/simpletest/testlib.php @@ -18,8 +18,7 @@ /** * Unit tests for Number of errors grading logic * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/numerrors/version.php b/mod/workshop/form/numerrors/version.php index 7422f89938ad1..e616c301f5186 100644 --- a/mod/workshop/form/numerrors/version.php +++ b/mod/workshop/form/numerrors/version.php @@ -21,8 +21,7 @@ * This code fragment is called by moodle_needs_upgrading() and * /admin/index.php * - * @package workshopform - * @subpackage numerrors + * @package workshopform_numerrors * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/assessment_form.php b/mod/workshop/form/rubric/assessment_form.php index be61bd1b63a25..c1597542918f4 100644 --- a/mod/workshop/form/rubric/assessment_form.php +++ b/mod/workshop/form/rubric/assessment_form.php @@ -21,8 +21,7 @@ * Rubric can be displayed in two possible layouts - list or grid. This file defines * therefore defines two classes, respectively. * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/backup/moodle1/lib.php b/mod/workshop/form/rubric/backup/moodle1/lib.php index d10ea4c3d368d..be0a6c6b11add 100644 --- a/mod/workshop/form/rubric/backup/moodle1/lib.php +++ b/mod/workshop/form/rubric/backup/moodle1/lib.php @@ -18,8 +18,7 @@ /** * Provides support for the conversion of moodle1 backup to the moodle2 format * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/backup/moodle2/backup_workshopform_rubric_subplugin.class.php b/mod/workshop/form/rubric/backup/moodle2/backup_workshopform_rubric_subplugin.class.php index 1fb4eac1bc9b8..f96b96f779a5a 100644 --- a/mod/workshop/form/rubric/backup/moodle2/backup_workshopform_rubric_subplugin.class.php +++ b/mod/workshop/form/rubric/backup/moodle2/backup_workshopform_rubric_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/backup/moodle2/restore_workshopform_rubric_subplugin.class.php b/mod/workshop/form/rubric/backup/moodle2/restore_workshopform_rubric_subplugin.class.php index 35b40006b32c1..21249b6a92f33 100644 --- a/mod/workshop/form/rubric/backup/moodle2/restore_workshopform_rubric_subplugin.class.php +++ b/mod/workshop/form/rubric/backup/moodle2/restore_workshopform_rubric_subplugin.class.php @@ -16,8 +16,7 @@ // along with Moodle. If not, see . /** - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2010 onwards David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/db/install.php b/mod/workshop/form/rubric/db/install.php index 91558303e31fe..908f9ac9205fa 100644 --- a/mod/workshop/form/rubric/db/install.php +++ b/mod/workshop/form/rubric/db/install.php @@ -19,8 +19,7 @@ * This file replaces the legacy STATEMENTS section in db/install.xml, * lib.php/modulename_install() post installation hook and partially defaults.php * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/db/install.xml b/mod/workshop/form/rubric/db/install.xml index 5297350e9c027..9653fad320b81 100644 --- a/mod/workshop/form/rubric/db/install.xml +++ b/mod/workshop/form/rubric/db/install.xml @@ -1,16 +1,16 @@ -
    - - - + + + - + @@ -19,11 +19,11 @@
    - - - + + + - + @@ -32,8 +32,8 @@
    - - + + diff --git a/mod/workshop/form/rubric/db/upgrade.php b/mod/workshop/form/rubric/db/upgrade.php index 7a4041c4e6f01..62927bf429828 100644 --- a/mod/workshop/form/rubric/db/upgrade.php +++ b/mod/workshop/form/rubric/db/upgrade.php @@ -18,8 +18,7 @@ /** * Keeps track of upgrades to the workshop rubric grading strategy * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/edit_form.php b/mod/workshop/form/rubric/edit_form.php index 52740d7e21bf6..79acc4233834c 100644 --- a/mod/workshop/form/rubric/edit_form.php +++ b/mod/workshop/form/rubric/edit_form.php @@ -18,8 +18,7 @@ /** * This file defines an mform to edit rubric grading strategy forms. * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/lang/en/workshopform_rubric.php b/mod/workshop/form/rubric/lang/en/workshopform_rubric.php index 2c35273d687b4..9c2b5e3017887 100644 --- a/mod/workshop/form/rubric/lang/en/workshopform_rubric.php +++ b/mod/workshop/form/rubric/lang/en/workshopform_rubric.php @@ -18,8 +18,7 @@ /** * Strings for component 'workshopform_rubric', language 'en', branch 'MOODLE_20_STABLE' * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/lib.php b/mod/workshop/form/rubric/lib.php index 17b54c27d0f6f..1361c66ebfb4d 100644 --- a/mod/workshop/form/rubric/lib.php +++ b/mod/workshop/form/rubric/lib.php @@ -18,8 +18,7 @@ /** * This file defines a class with rubric grading strategy logic * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,6 +28,18 @@ require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues +/** + * Server workshop files + * + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool + */ function workshopform_rubric_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload) { global $DB; diff --git a/mod/workshop/form/rubric/simpletest/testlib.php b/mod/workshop/form/rubric/simpletest/testlib.php index 23dddd2f00630..27a9fe97c6387 100644 --- a/mod/workshop/form/rubric/simpletest/testlib.php +++ b/mod/workshop/form/rubric/simpletest/testlib.php @@ -18,8 +18,7 @@ /** * Unit tests for Rubric grading strategy logic * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/form/rubric/version.php b/mod/workshop/form/rubric/version.php index 4d50e93d5d0e7..926c9f7f75a36 100644 --- a/mod/workshop/form/rubric/version.php +++ b/mod/workshop/form/rubric/version.php @@ -21,8 +21,7 @@ * This code fragment is called by moodle_needs_upgrading() and * /admin/index.php * - * @package workshopform - * @subpackage rubric + * @package workshopform_rubric * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index f671657a1b1c6..c3adb19fa0d4d 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -1145,6 +1145,9 @@ function workshop_grade_item_category_update($workshop) { * The file area workshop_intro for the activity introduction field is added automatically * by {@link file_browser::get_file_info_context_module()} * + * @package mod_workshop + * @category files + * * @param stdClass $course * @param stdClass $cm * @param stdClass $context @@ -1171,6 +1174,9 @@ function workshop_get_file_areas($course, $cm, $context) { * Besides that, areas workshop_instructauthors and mod_workshop instructreviewers contain the media * embedded using the mod_form.php. * + * @package mod_workshop + * @category files + * * @param stdClass $course * @param stdClass $cm * @param stdClass $context @@ -1255,8 +1261,11 @@ function workshop_pluginfile($course, $cm, $context, $filearea, array $args, $fo /** * File browsing support for workshop file areas * - * @param stdClass $browser - * @param stdClass $areas + * @package mod_workshop + * @category files + * + * @param file_browser $browser + * @param array $areas * @param stdClass $course * @param stdClass $cm * @param stdClass $context @@ -1264,7 +1273,7 @@ function workshop_pluginfile($course, $cm, $context, $filearea, array $args, $fo * @param int $itemid * @param string $filepath * @param string $filename - * @return stdclass file_info instance or null if not found + * @return file_info instance or null if not found */ function workshop_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG, $DB; diff --git a/portfolio/googledocs/db/events.php b/portfolio/googledocs/db/events.php index 98b9dbd340c16..b0d3d0c702fb0 100644 --- a/portfolio/googledocs/db/events.php +++ b/portfolio/googledocs/db/events.php @@ -1,4 +1,27 @@ . + +/** + * Add event handlers for the googledocs portfolio. + * + * @package portfolio_googledocs + * @category event + * @copyright 2009 Penny Leach + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ $handlers = array ( 'user_deleted' => array ( diff --git a/portfolio/mahara/db/install.xml b/portfolio/mahara/db/install.xml index 48ef556f195d1..9450b2a457c64 100644 --- a/portfolio/mahara/db/install.xml +++ b/portfolio/mahara/db/install.xml @@ -1,13 +1,13 @@ -
    - - + + diff --git a/portfolio/picasa/db/events.php b/portfolio/picasa/db/events.php index afca2ebd0ef11..09ef7cca20c68 100644 --- a/portfolio/picasa/db/events.php +++ b/portfolio/picasa/db/events.php @@ -1,4 +1,27 @@ . + +/** + * Add event handlers for the picasa portfolio. + * + * @package portfolio_picasa + * @category event + * @copyright 2009 Penny Leach + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ $handlers = array ( 'user_deleted' => array ( @@ -7,6 +30,4 @@ 'schedule' => 'cron', 'internal' => 0, ), -); - - +); \ No newline at end of file diff --git a/question/engine/datalib.php b/question/engine/datalib.php index 0c0f2eb8494ba..455044bdd3c86 100644 --- a/question/engine/datalib.php +++ b/question/engine/datalib.php @@ -151,6 +151,7 @@ protected function insert_step_data(question_attempt_step $step, $stepid, $conte foreach ($step->get_all_data() as $name => $value) { if ($value instanceof question_file_saver) { $value->save_files($stepid, $context); + $value = (string) $value; } $data = new stdClass(); @@ -768,22 +769,6 @@ protected function delete_usage_records_for_mysql(qubaid_condition $qubaids) { $qubaids->usage_id_in_params()); } - /** - * This function is a work-around for poor MySQL performance with - * DELETE FROM x WHERE id IN (SELECT ...). We have to use a non-standard - * syntax to get good performance. See MDL-29520. - * @param string $test sql fragment. - * @param array $params used by $test. - */ - protected function delete_attempt_steps_for_mysql($test, $params) { - // TODO once MDL-29589 is fixed, eliminate this method, and instead use the new $DB API. - $this->db->execute(' - DELETE qas, qasd - FROM {question_attempt_steps} qas - LEFT JOIN {question_attempt_step_data} qasd ON qasd.attemptstepid = qas.id - WHERE qas.questionattemptid ' . $test, $params); - } - /** * Delete all the steps for a question attempt. * @param int $qaids question_attempt id. @@ -795,19 +780,12 @@ public function delete_steps($stepids, $context) { } list($test, $params) = $this->db->get_in_or_equal($stepids, SQL_PARAMS_NAMED); - if ($deletefiles) { - $this->delete_response_files($context->id, $test, $params); - } - - if ($this->db->get_dbfamily() == 'mysql') { - $this->delete_attempt_steps_for_mysql($test, $params); - return; - } + $this->delete_response_files($context->id, $test, $params); $this->db->delete_records_select('question_attempt_step_data', "attemptstepid $test", $params); $this->db->delete_records_select('question_attempt_steps', - "attemptstepid $test", $params); + "id $test", $params); } /** diff --git a/question/format.php b/question/format.php index 081b68b36a35b..221db62e2daab 100644 --- a/question/format.php +++ b/question/format.php @@ -103,6 +103,20 @@ public function export_file_extension() { return '.txt'; } + /** + * Check if the given file is capable of being imported by this plugin. + * + * Note that expensive or detailed integrity checks on the file should + * not be performed by this method. Simple file type or magic-number tests + * would be suitable. + * + * @param stored_file $file the file to check + * @return bool whether this plugin can import the file + */ + public function can_import_file($file) { + return ($file->get_mimetype() == $this->mime_type()); + } + // Accessor methods /** diff --git a/question/format/blackboard_six/format.php b/question/format/blackboard_six/format.php index 484a31d24ff54..08614d3f024b2 100644 --- a/question/format/blackboard_six/format.php +++ b/question/format/blackboard_six/format.php @@ -40,6 +40,14 @@ function provide_import() { return true; } + public function can_import_file($file) { + $mimetypes = array( + mimeinfo('type', '.dat'), + mimeinfo('type', '.zip') + ); + return in_array($file->get_mimetype(), $mimetypes); + } + //Function to check and create the needed dir to unzip file to function check_and_create_import_dir($unique_code) { diff --git a/question/import_form.php b/question/import_form.php index 571e8cb008aa2..719317d9822de 100644 --- a/question/import_form.php +++ b/question/import_form.php @@ -133,7 +133,7 @@ protected function validate_uploaded_file($data, $errors) { $qformat = new $classname(); $file = reset($files); - if ($file->get_mimetype() != $qformat->mime_type()) { + if (!$qformat->can_import_file($file)) { $a = new stdClass(); $a->actualtype = $file->get_mimetype(); $a->expectedtype = $qformat->mime_type(); diff --git a/question/previewlib.php b/question/previewlib.php index 5d40879868d28..3bf47b26c12b6 100644 --- a/question/previewlib.php +++ b/question/previewlib.php @@ -214,8 +214,10 @@ public function get_url_params() { * Called via pluginfile.php -> question_pluginfile to serve files belonging to * a question in a question_attempt when that attempt is a preview. * - * @param object $course course settings object - * @param object $context context object + * @package core_question + * @category files + * @param stdClass $course course settings object + * @param stdClass $context context object * @param string $component the name of the component we are serving files for. * @param string $filearea the name of the file area. * @param int $qubaid the question_usage this image belongs to. diff --git a/question/type/calculated/db/install.xml b/question/type/calculated/db/install.xml index 34c5fd39aca8b..996d1e373800c 100644 --- a/question/type/calculated/db/install.xml +++ b/question/type/calculated/db/install.xml @@ -1,18 +1,18 @@ -
    - - - + + + - - - + + + @@ -24,19 +24,19 @@
    - - - - - - - - - - - + + + + + + + + + + + - + @@ -45,12 +45,12 @@
    - - + + - + - + @@ -59,9 +59,9 @@
    - - - + + + @@ -73,9 +73,9 @@
    - - - + + + diff --git a/question/type/calculated/lib.php b/question/type/calculated/lib.php index efbad8e534672..ca7559ae8befb 100644 --- a/question/type/calculated/lib.php +++ b/question/type/calculated/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage calculated + * @package qtype_calculated * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,16 @@ /** * Checks file access for calculated questions. + * + * @package qtype_calculated + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_calculated_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index a86bb20d4ca45..af7cd38433ac6 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -1839,6 +1839,7 @@ public function move_files($questionid, $oldcontextid, $newcontextid) { parent::move_files($questionid, $oldcontextid, $newcontextid); $this->move_files_in_answers($questionid, $oldcontextid, $newcontextid); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); } protected function delete_files($questionid, $contextid) { @@ -1846,6 +1847,7 @@ protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_answers($questionid, $contextid); + $this->delete_files_in_hints($questionid, $contextid); } } diff --git a/question/type/calculatedmulti/lib.php b/question/type/calculatedmulti/lib.php index 45c25a339ef64..f78a1668a8c3c 100644 --- a/question/type/calculatedmulti/lib.php +++ b/question/type/calculatedmulti/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage calculatedmulti + * @package qtype_calculatedmulti * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,16 @@ /** * Checks file access for calculated multiple-choice questions. + * + * @package qtype_calculatedmulti + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_calculatedmulti_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/question/type/calculatedmulti/questiontype.php b/question/type/calculatedmulti/questiontype.php index 963a95e6cbaed..220d1bcaf8f68 100644 --- a/question/type/calculatedmulti/questiontype.php +++ b/question/type/calculatedmulti/questiontype.php @@ -276,6 +276,7 @@ public function move_files($questionid, $oldcontextid, $newcontextid) { parent::move_files($questionid, $oldcontextid, $newcontextid); $this->move_files_in_answers($questionid, $oldcontextid, $newcontextid, true); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); $fs->move_area_files_to_new_context($oldcontextid, $newcontextid, 'qtype_calculatedmulti', 'correctfeedback', $questionid); @@ -290,6 +291,7 @@ protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_answers($questionid, $contextid, true); + $this->delete_files_in_hints($questionid, $contextid); $fs->delete_area_files($contextid, 'qtype_calculatedmulti', 'correctfeedback', $questionid); diff --git a/question/type/calculatedsimple/lib.php b/question/type/calculatedsimple/lib.php index c21d4c4aa8b06..d95bddbbe4cf2 100644 --- a/question/type/calculatedsimple/lib.php +++ b/question/type/calculatedsimple/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage calculatedsimple + * @package qtype_calculatedsimple * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,17 @@ /** * Checks file access for simple calculated questions. + * + * @package qtype_calculatedsimple + * @category files + * + * @param stdClass $course + * @param stdClass $cm + * @param stdClass $context + * @param string $filearea + * @param array $args + * @param bool $forcedownload + * @return bool */ function qtype_calculatedsimple_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { diff --git a/question/type/edit_question_form.php b/question/type/edit_question_form.php index f8e21a17e344b..a0c80c4be9434 100644 --- a/question/type/edit_question_form.php +++ b/question/type/edit_question_form.php @@ -348,7 +348,7 @@ protected function add_combined_feedback_fields($withshownumpartscorrect = false if ($withshownumpartscorrect && $feedbackname == 'partiallycorrectfeedback') { $mform->addElement('advcheckbox', 'shownumcorrect', get_string('options', 'question'), - get_string('shownumpartscorrect', 'question')); + get_string('shownumpartscorrectwhenfinished', 'question')); } } } diff --git a/question/type/essay/db/install.xml b/question/type/essay/db/install.xml index a7c70f0427332..9f2e657b63838 100644 --- a/question/type/essay/db/install.xml +++ b/question/type/essay/db/install.xml @@ -1,18 +1,18 @@ -
    - - + + - - - - + + + + diff --git a/question/type/essay/lib.php b/question/type/essay/lib.php index f80f38e7b8bf4..38e6557f653b8 100644 --- a/question/type/essay/lib.php +++ b/question/type/essay/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage essay + * @package qtype_essay * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,16 @@ /** * Checks file access for essay questions. + * + * @package qtype_essay + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_essay_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; diff --git a/question/type/match/db/install.xml b/question/type/match/db/install.xml index 2ae3b17d0722a..e381e062a0aa4 100644 --- a/question/type/match/db/install.xml +++ b/question/type/match/db/install.xml @@ -1,22 +1,22 @@ -
    - - + + - - - - - - - - + + + + + + + + @@ -25,11 +25,11 @@
    - - - - - + + + + + diff --git a/question/type/match/lib.php b/question/type/match/lib.php index dd80721489c2c..f997cc41f6ce7 100644 --- a/question/type/match/lib.php +++ b/question/type/match/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage match + * @package qtype_match * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,15 @@ /** * Checks file access for matching questions. + * @package qtype_match + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_match_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $DB, $CFG; diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index 36f08b5f6f266..4a381970a051c 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -208,6 +208,7 @@ public function move_files($questionid, $oldcontextid, $newcontextid) { } $this->move_files_in_combined_feedback($questionid, $oldcontextid, $newcontextid); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); } protected function delete_files($questionid, $contextid) { @@ -223,5 +224,6 @@ protected function delete_files($questionid, $contextid) { } $this->delete_files_in_combined_feedback($questionid, $contextid); + $this->delete_files_in_hints($questionid, $contextid); } } diff --git a/question/type/multianswer/db/install.xml b/question/type/multianswer/db/install.xml index 753bd5fe3a0ae..f7428890e3e2d 100644 --- a/question/type/multianswer/db/install.xml +++ b/question/type/multianswer/db/install.xml @@ -1,11 +1,11 @@ - +
    - - - + + + diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index c9cb5df8363bc..3dc969aa4961f 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -223,6 +223,16 @@ public function get_random_guess_score($questiondata) { } return $fractionsum / $fractionmax; } + + public function move_files($questionid, $oldcontextid, $newcontextid) { + parent::move_files($questionid, $oldcontextid, $newcontextid); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); + } + + protected function delete_files($questionid, $contextid) { + parent::delete_files($questionid, $contextid); + $this->delete_files_in_hints($questionid, $contextid); + } } diff --git a/question/type/multichoice/db/install.xml b/question/type/multichoice/db/install.xml index 3516b9ebcc375..acc9835fe3d6c 100644 --- a/question/type/multichoice/db/install.xml +++ b/question/type/multichoice/db/install.xml @@ -1,25 +1,25 @@ -
    - - - + + + - - - - - - - - + + + + + + + + - + diff --git a/question/type/multichoice/lib.php b/question/type/multichoice/lib.php index f93fd45abe870..2b0b8857a9c96 100644 --- a/question/type/multichoice/lib.php +++ b/question/type/multichoice/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage multichoice + * @package qtype_multichoice * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,16 @@ /** * Checks file access for multiple choice questions. + * + * @package qtype_multichoice + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_multichoice_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; diff --git a/question/type/multichoice/questiontype.php b/question/type/multichoice/questiontype.php index e155366f15706..02fe6f4e56a64 100644 --- a/question/type/multichoice/questiontype.php +++ b/question/type/multichoice/questiontype.php @@ -240,11 +240,13 @@ public function move_files($questionid, $oldcontextid, $newcontextid) { parent::move_files($questionid, $oldcontextid, $newcontextid); $this->move_files_in_answers($questionid, $oldcontextid, $newcontextid, true); $this->move_files_in_combined_feedback($questionid, $oldcontextid, $newcontextid); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); } protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_answers($questionid, $contextid, true); $this->delete_files_in_combined_feedback($questionid, $contextid); + $this->delete_files_in_hints($questionid, $contextid); } } diff --git a/question/type/numerical/db/install.xml b/question/type/numerical/db/install.xml index 15dcb7772984c..f56fab6d9f126 100644 --- a/question/type/numerical/db/install.xml +++ b/question/type/numerical/db/install.xml @@ -1,14 +1,14 @@ -
    - - - + + + @@ -21,12 +21,12 @@
    - - - - - - + + + + + + @@ -35,9 +35,9 @@
    - - - + + + diff --git a/question/type/numerical/db/simpletest/testupgradelibnewqe.php b/question/type/numerical/db/simpletest/testupgradelibnewqe.php index 92899c317cbd8..aea2d4ee21545 100644 --- a/question/type/numerical/db/simpletest/testupgradelibnewqe.php +++ b/question/type/numerical/db/simpletest/testupgradelibnewqe.php @@ -229,7 +229,7 @@ public function test_numerical_deferredfeedback_history620() { 'maxmark' => 1, 'minfraction' => 0, 'flagged' => 0, - 'questionsummary' => "Calculate your answer to the nearest WHOLE £ and enter it in the blank space provided. \n\n[Note: Please _DO NOT_ enter commas, spaces or £ signs within the number you enter.] \n\nThe cash flows of a project are set out below: \n\n \t\tYear 0 \n \t\t(28,000) \n\n \t\tYear 1 \n \t\t18,000 \n\n \t\tYear 2 \n \t\t16,000 \n\nUsing the Table in Book 11, what is the project's net present value using a discount rate of 10%? \n\nIf it is negative, put a minus sign before the number you enter. \n\n£", + 'questionsummary' => "Calculate your answer to the nearest WHOLE £ and enter it in the blank space provided. \n\n[Note: Please _DO NOT_ enter commas, spaces or £ signs within the number you enter.] \n\nThe cash flows of a project are set out below: \n\n \t\tYEAR \n \t\t£ \n\n \t\tYear 0 \n \t\t(28,000) \n\n \t\tYear 1 \n \t\t18,000 \n\n \t\tYear 2 \n \t\t16,000 \n\nUsing the Table in Book 11, what is the project's net present value using a discount rate of 10%? \n\nIf it is negative, put a minus sign before the number you enter. \n\n£", 'rightanswer' => '1586', 'responsesummary' => '17520', 'timemodified' => 1178567143, diff --git a/question/type/numerical/lib.php b/question/type/numerical/lib.php index fdf7deba7179c..e31de0adafa71 100644 --- a/question/type/numerical/lib.php +++ b/question/type/numerical/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage numerical + * @package qtype_numerical * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,16 @@ /** * Checks file access for numerical questions. + * + * @package qtype_numerical + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_numerical_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index b275ffa195db9..53f29b2c407ff 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -470,6 +470,7 @@ public function move_files($questionid, $oldcontextid, $newcontextid) { parent::move_files($questionid, $oldcontextid, $newcontextid); $this->move_files_in_answers($questionid, $oldcontextid, $newcontextid); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); } protected function delete_files($questionid, $contextid) { @@ -477,6 +478,7 @@ protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_answers($questionid, $contextid); + $this->delete_files_in_hints($questionid, $contextid); } } diff --git a/question/type/questiontypebase.php b/question/type/questiontypebase.php index 88750453d06ce..0e18786a3af87 100644 --- a/question/type/questiontypebase.php +++ b/question/type/questiontypebase.php @@ -1103,6 +1103,27 @@ protected function move_files_in_answers($questionid, $oldcontextid, } } + /** + * Move all the files belonging to this question's hints when the question + * is moved from one context to another. + * @param int $questionid the question being moved. + * @param int $oldcontextid the context it is moving from. + * @param int $newcontextid the context it is moving to. + * @param bool $answerstoo whether there is an 'answer' question area, + * as well as an 'answerfeedback' one. Default false. + */ + protected function move_files_in_hints($questionid, $oldcontextid, $newcontextid) { + global $DB; + $fs = get_file_storage(); + + $hintids = $DB->get_records_menu('question_hints', + array('questionid' => $questionid), 'id', 'id,1'); + foreach ($hintids as $hintid => $notused) { + $fs->move_area_files_to_new_context($oldcontextid, + $newcontextid, 'question', 'hint', $hintid); + } + } + /** * Move all the files belonging to this question's answers when the question * is moved from one context to another. @@ -1157,6 +1178,22 @@ protected function delete_files_in_answers($questionid, $contextid, $answerstoo } } + /** + * Delete all the files belonging to this question's hints. + * @param int $questionid the question being deleted. + * @param int $contextid the context the question is in. + */ + protected function delete_files_in_hints($questionid, $contextid) { + global $DB; + $fs = get_file_storage(); + + $hintids = $DB->get_records_menu('question_hints', + array('questionid' => $questionid), 'id', 'id,1'); + foreach ($hintids as $hintid => $notused) { + $fs->delete_area_files($contextid, 'question', 'hint', $hintid); + } + } + /** * Delete all the files belonging to this question's answers. * @param int $questionid the question being deleted. diff --git a/question/type/random/db/simpletest/testupgradelibnewqe.php b/question/type/random/db/simpletest/testupgradelibnewqe.php index 19dcd2235b3a0..6b594357ff951 100644 --- a/question/type/random/db/simpletest/testupgradelibnewqe.php +++ b/question/type/random/db/simpletest/testupgradelibnewqe.php @@ -232,7 +232,7 @@ public function test_random_deferredfeedback_history620() { 'maxmark' => 1, 'minfraction' => 0, 'flagged' => 0, - 'questionsummary' => "(Notice in the panel at the left that the question you have just done is now greyed out. Remember that you can REVISIT ANY QUESTIONS by clicking on the NUMBERED BOXES. Click Q1 now to try this out and then click Q2 to return here.) \n\n[Table 1 showing Number of households receiving home care (England)] \n\n() \n\nWhich was the first year when more than a quarter of a million households received care from independent agencies?", + 'questionsummary' => "(Notice in the panel at the left that the question you have just done is now greyed out. Remember that you can REVISIT ANY QUESTIONS by clicking on the NUMBERED BOXES. Click Q1 now to try this out and then click Q2 to return here.) \n\n[Table 1 showing Number of households receiving home care (England)] \n\n(LINK TO RESIZABLE TABLE 1) \n\nWhich was the first year when more than a quarter of a million households received care from independent agencies?", 'rightanswer' => '2005', 'responsesummary' => '2005', 'timemodified' => 1238182723, diff --git a/question/type/randomsamatch/db/install.xml b/question/type/randomsamatch/db/install.xml index 164af920ade90..1622ddd05bb63 100644 --- a/question/type/randomsamatch/db/install.xml +++ b/question/type/randomsamatch/db/install.xml @@ -1,14 +1,14 @@ -
    - - - + + + diff --git a/question/type/shortanswer/db/install.xml b/question/type/shortanswer/db/install.xml index 8aaf8e2629063..eb410f6de1526 100644 --- a/question/type/shortanswer/db/install.xml +++ b/question/type/shortanswer/db/install.xml @@ -1,15 +1,15 @@ -
    - - + + - + diff --git a/question/type/shortanswer/lib.php b/question/type/shortanswer/lib.php index 3320b30fd4e3e..e508d68a6414e 100644 --- a/question/type/shortanswer/lib.php +++ b/question/type/shortanswer/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage shortanswer + * @package qtype_shortanswer * @copyright Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,15 @@ /** * Checks file access for short answer questions. + * @package qtype_shortanswer + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_shortanswer_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $DB, $CFG; diff --git a/question/type/shortanswer/question.php b/question/type/shortanswer/question.php index a540871492740..a875c8c1a0546 100644 --- a/question/type/shortanswer/question.php +++ b/question/type/shortanswer/question.php @@ -101,6 +101,28 @@ public static function compare_string_with_wildcard($string, $pattern, $ignoreca return preg_match($regexp, trim($string)); } + public function get_correct_response() { + $response = parent::get_correct_response(); + if ($response) { + $response['answer'] = $this->clean_response($response['answer']); + } + return $response; + } + + public function clean_response($answer) { + // Break the string on non-escaped asterisks. + $bits = preg_split('/(?move_files_in_answers($questionid, $oldcontextid, $newcontextid); + $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); } protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_answers($questionid, $contextid); + $this->delete_files_in_hints($questionid, $contextid); } public function save_question_options($question) { diff --git a/question/type/shortanswer/renderer.php b/question/type/shortanswer/renderer.php index 501b1bff52eab..e7879bfb68039 100644 --- a/question/type/shortanswer/renderer.php +++ b/question/type/shortanswer/renderer.php @@ -117,6 +117,7 @@ public function correct_response(question_attempt $qa) { return ''; } - return get_string('correctansweris', 'qtype_shortanswer', s($answer->answer)); + return get_string('correctansweris', 'qtype_shortanswer', + s($question->clean_response($answer->answer))); } } diff --git a/question/type/shortanswer/simpletest/helper.php b/question/type/shortanswer/simpletest/helper.php index 71a0f409111a2..533b5802d7512 100644 --- a/question/type/shortanswer/simpletest/helper.php +++ b/question/type/shortanswer/simpletest/helper.php @@ -34,7 +34,7 @@ */ class qtype_shortanswer_test_helper extends question_test_helper { public function get_test_questions() { - return array('frogtoad', 'frogonly'); + return array('frogtoad', 'frogonly', 'escapedwildcards'); } /** @@ -130,4 +130,25 @@ public function get_shortanswer_question_data_frogonly() { return $qdata; } + + /** + * Makes a shortanswer question with just the correct ansewer 'frog', and + * no other answer matching. + * @return qtype_shortanswer_question + */ + public function make_shortanswer_question_escapedwildcards() { + question_bank::load_question_definition_classes('shortanswer'); + $sa = new qtype_shortanswer_question(); + test_question_maker::initialise_a_question($sa); + $sa->name = 'Question with escaped * in the answer.'; + $sa->questiontext = 'How to you write x times y in C? __________'; + $sa->generalfeedback = 'In C, this expression is written x * y.'; + $sa->usecase = false; + $sa->answers = array( + 13 => new question_answer(13, '*x\*y*', 1.0, 'Well done.', FORMAT_HTML), + ); + $sa->qtype = question_bank::get_qtype('shortanswer'); + + return $sa; + } } diff --git a/question/type/shortanswer/simpletest/testquestion.php b/question/type/shortanswer/simpletest/testquestion.php index 4db7d6b4b79dc..54aa98758a52f 100644 --- a/question/type/shortanswer/simpletest/testquestion.php +++ b/question/type/shortanswer/simpletest/testquestion.php @@ -145,6 +145,12 @@ public function test_get_correct_response() { $question->get_correct_response()); } + public function test_get_correct_response_escapedwildcards() { + $question = test_question_maker::make_question('shortanswer', 'escapedwildcards'); + + $this->assertEqual(array('answer' => 'x*y'), $question->get_correct_response()); + } + public function test_get_question_summary() { $sa = test_question_maker::make_question('shortanswer'); $qsummary = $sa->get_question_summary(); diff --git a/question/type/truefalse/db/install.xml b/question/type/truefalse/db/install.xml index c5ca5266a233c..5078c7bf4e2d9 100644 --- a/question/type/truefalse/db/install.xml +++ b/question/type/truefalse/db/install.xml @@ -1,15 +1,15 @@ -
    - - - - + + + + diff --git a/question/type/truefalse/lib.php b/question/type/truefalse/lib.php index e209cec65af11..a3c4620c4233a 100644 --- a/question/type/truefalse/lib.php +++ b/question/type/truefalse/lib.php @@ -18,8 +18,7 @@ * Serve question type files * * @since 2.0 - * @package qtype - * @subpackage truefalse + * @package qtype_truefalse * @copyright 2010 The Open Unviersity * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +29,15 @@ /** * Checks file access for true-false questions. + * @package qtype_truefalse + * @category files + * @param stdClass $course course object + * @param stdClass $cm course module object + * @param stdClass $context context object + * @param string $filearea file area + * @param array $args extra arguments + * @param bool $forcedownload whether or not force download + * @return bool */ function qtype_truefalse_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; diff --git a/rating/index.php b/rating/index.php index 2667947fb2dad..78a8b86f2e89a 100644 --- a/rating/index.php +++ b/rating/index.php @@ -18,8 +18,8 @@ /** * A page to display a list of ratings for a given item (forum post etc) * - * @package core - * @subpackage rating + * @package core_rating + * @category rating * @copyright 2010 Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/rating/lib.php b/rating/lib.php index cb1242880deea..9484702b2490d 100644 --- a/rating/lib.php +++ b/rating/lib.php @@ -1,5 +1,4 @@ context context to use for the rating [required] * component => component using ratings ie mod_forum [required] * ratingarea => ratingarea to associate this rating with [required] @@ -175,8 +155,8 @@ public function __construct($options) { /** * Update this rating in the database + * * @param int $rating the integer value of this rating - * @return void */ public function update_rating($rating) { global $DB; @@ -225,6 +205,7 @@ public function update_rating($rating) { /** * Retreive the integer value of this rating + * * @return int the integer value of this rating object */ public function get_rating() { @@ -234,7 +215,7 @@ public function get_rating() { /** * Returns this ratings aggregate value as a string. * - * @return string + * @return string ratings aggregate value */ public function get_aggregate_string() { @@ -258,7 +239,7 @@ public function get_aggregate_string() { * Returns true if the user is able to rate this rating object * * @param int $userid Current user assumed if left empty - * @return bool + * @return bool true if the user is able to rate this rating object */ public function user_can_rate($userid = null) { if (empty($userid)) { @@ -292,7 +273,7 @@ public function user_can_rate($userid = null) { * Returns true if the user is able to view the aggregate for this rating object. * * @param int|null $userid If left empty the current user is assumed. - * @return bool + * @return bool true if the user is able to view the aggregate for this rating object */ public function user_can_view_aggregate($userid = null) { if (empty($userid)) { @@ -317,11 +298,11 @@ public function user_can_view_aggregate($userid = null) { /** * Returns a URL to view all of the ratings for the item this rating is for. * - * If this is a rating of a post then this URL will take the user to a page that shows all - * of the ratings for the post (this one included). + * If this is a rating of a post then this URL will take the user to a page that shows all of the ratings for the post + * (this one included). * - * @param bool $popup - * @return moodle_url + * @param bool $popup whether of not the URL should be loaded in a popup + * @return moodle_url URL to view all of the ratings for the item this rating is for. */ public function get_view_ratings_url($popup = false) { $attributes = array( @@ -340,10 +321,9 @@ public function get_view_ratings_url($popup = false) { /** * Returns a URL that can be used to rate the associated item. * - * @param int|null $rating The rating to give the item, if null then no rating - * param is added. + * @param int|null $rating The rating to give the item, if null then no rating param is added. * @param moodle_url|string $returnurl The URL to return to. - * @return moodle_url + * @return moodle_url can be used to rate the associated item. */ public function get_rate_url($rating = null, $returnurl = null) { if (empty($returnurl)) { @@ -384,6 +364,8 @@ public function get_rate_url($rating = null, $returnurl = null) { /** * The rating_manager class provides the ability to retrieve sets of ratings from the database * + * @package core_rating + * @category rating * @copyright 2010 Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 2.0 @@ -391,8 +373,7 @@ public function get_rate_url($rating = null, $returnurl = null) { class rating_manager { /** - * An array of calculated scale options to save us generating them for each request. - * @var array + * @var array An array of calculated scale options to save us generating them for each request. */ protected $scales = array(); @@ -408,7 +389,6 @@ class rating_manager { * component => string The component to delete ratings from [optional] * ratingarea => string The ratingarea to delete ratings from [optional] * } - * @return void */ public function delete_ratings($options) { global $DB; @@ -434,8 +414,8 @@ public function delete_ratings($options) { } /** - * Returns an array of ratings for a given item (forum post, glossary entry etc) - * This returns all users ratings for a single item + * Returns an array of ratings for a given item (forum post, glossary entry etc). This returns all users ratings for a single item + * * @param stdClass $options { * context => context the context in which the ratings exists [required] * component => component using ratings ie mod_forum [required] @@ -486,8 +466,8 @@ public function get_all_ratings_for_item($options) { } /** - * Adds rating objects to an array of items (forum posts, glossary entries etc) - * Rating objects are available at $item->rating + * Adds rating objects to an array of items (forum posts, glossary entries etc). Rating objects are available at $item->rating + * * @param stdClass $options { * context => context the context in which the ratings exists [required] * component => the component name ie mod_forum [required] @@ -645,7 +625,7 @@ public function get_ratings($options) { * plugintype => string plugin type ie 'mod' Used to find the permissions callback [optional] * pluginname => string plugin name ie 'forum' Used to find the permissions callback [optional] * } - * @return stdClass + * @return stdClass rating settings object */ protected function generate_rating_settings_object($options) { @@ -704,9 +684,9 @@ protected function generate_rating_settings_object($options) { /** * Generates a scale object that can be returned * - * @global moodle_database $DB - * @param type $scaleid - * @return stdClass + * @global moodle_database $DB moodle database object + * @param int $scaleid scale-type identifier + * @return stdClass scale for ratings */ protected function generate_rating_scale_object($scaleid) { global $DB; @@ -750,12 +730,12 @@ protected function generate_rating_scale_object($scaleid) { /** * Gets the time the given item was created * - * TODO: Find a better solution for this, its not ideal to test for fields really we should be + * TODO: MDL-31511 - Find a better solution for this, its not ideal to test for fields really we should be * asking the component the item belongs to what field to look for or even the value we * are looking for. * * @param stdClass $item - * @return mixed + * @return int|null return null if the created time is unavailable, otherwise return a timestamp */ protected function get_item_time_created($item) { if( !empty($item->created) ) { @@ -771,7 +751,8 @@ protected function get_item_time_created($item) { /** * Returns an array of grades calculated by aggregating item ratings. - * @param object $options { + * + * @param stdClass $options { * userid => int the id of the user whose items have been rated. NOT the user who submitted the ratings. 0 to update all. [required] * aggregationmethod => int the aggregation method to apply when calculating grades ie RATING_AGGREGATE_AVERAGE [required] * scaleid => int the scale from which the user can select a rating. Used for bounds checking. [required] @@ -779,12 +760,10 @@ protected function get_item_time_created($item) { * itemtableusercolum => int the column of the user table containing the item owner's user id [required] * component => The component for the ratings [required] * ratingarea => The ratingarea for the ratings [required] - * * contextid => int the context in which the rated items exist [optional] - * * modulename => string the name of the module [optional] * moduleid => int the id of the module instance [optional] - * + * } * @return array the array of the user's grades */ public function get_user_grades($options) { @@ -895,7 +874,7 @@ public function get_user_grades($options) { /** * Returns array of aggregate types. Used by ratings. * - * @return array + * @return array aggregate types */ public function get_aggregate_types() { return array (RATING_AGGREGATE_NONE => get_string('aggregatenone', 'rating'), @@ -908,6 +887,7 @@ public function get_aggregate_types() { /** * Converts an aggregation method constant into something that can be included in SQL + * * @param int $aggregate An aggregation constant. For example, RATING_AGGREGATE_AVERAGE. * @return string an SQL aggregation method */ @@ -938,9 +918,10 @@ public function get_aggregation_method($aggregate) { /** * Looks for a callback like forum_rating_permissions() to retrieve permissions from the plugin whose items are being rated + * * @param int $contextid The current context id - * @param string component the name of the component that is using ratings ie 'mod_forum' - * @param string ratingarea The area the rating is associated with + * @param string $component the name of the component that is using ratings ie 'mod_forum' + * @param string $ratingarea The area the rating is associated with * @return array rating related permissions */ public function get_plugin_permissions_array($contextid, $component, $ratingarea) { @@ -957,6 +938,7 @@ public function get_plugin_permissions_array($contextid, $component, $ratingarea /** * Validates a submitted rating + * * @param array $params submitted data * context => object the context in which the rated items exists [required] * component => The component the rating belongs to [required] @@ -1007,7 +989,7 @@ public function check_rating_is_valid($params) { * Initialises JavaScript to enable AJAX ratings on the provided page * * @param moodle_page $page - * @return true + * @return true always returns true */ public function initialise_rating_javascript(moodle_page $page) { global $CFG; @@ -1030,7 +1012,7 @@ public function initialise_rating_javascript(moodle_page $page) { * Returns a string that describes the aggregation method that was provided. * * @param string $aggregationmethod - * @return string + * @return string describes the aggregation method that was provided */ public function get_aggregate_label($aggregationmethod) { $aggregatelabel = ''; @@ -1057,8 +1039,25 @@ public function get_aggregate_label($aggregationmethod) { }//end rating_manager class definition +/** + * The rating_exception class provides the ability to generate exceptions that can be easily identified as coming from the ratings system + * + * @package core_rating + * @category rating + * @copyright 2010 Andrew Davis + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since Moodle 2.0 + */ class rating_exception extends moodle_exception { + /** + * @var string The message to accompany the thrown exception + */ public $message; + /** + * Generate exceptions that can be easily identified as coming from the ratings system + * + * @param string $errorcode the error code to generate + */ function __construct($errorcode) { $this->errorcode = $errorcode; $this->message = get_string($errorcode, 'error'); diff --git a/rating/rate.php b/rating/rate.php index ab05b47330625..6d5956333f1d4 100644 --- a/rating/rate.php +++ b/rating/rate.php @@ -20,8 +20,8 @@ * * It is similar to rate_ajax.php. Unlike rate_ajax.php a return url is required. * - * @package core - * @subpackage rating + * @package core_rating + * @category rating * @copyright 2010 Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/rating/rate_ajax.php b/rating/rate_ajax.php index 98a81a82346c3..204db6b72237a 100644 --- a/rating/rate_ajax.php +++ b/rating/rate_ajax.php @@ -20,8 +20,8 @@ * * It is similar to rate.php. Unlike rate.php a return url is NOT required. * - * @package core - * @subpackage rating + * @package core_rating + * @category rating * @copyright 2010 Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/report/completion/db/access.php b/report/completion/db/access.php index 080a6e8b5cabb..de617164509aa 100644 --- a/report/completion/db/access.php +++ b/report/completion/db/access.php @@ -17,13 +17,14 @@ /** * Capabilities * - * @package report - * @subpackage completion + * @package report_completion * @copyright 2009 Catalyst IT Ltd * @author Aaron Barnes * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'report/completion:view' => array( diff --git a/report/completion/index.php b/report/completion/index.php index dcd81a98b01ed..ba53cf9a5ffd6 100644 --- a/report/completion/index.php +++ b/report/completion/index.php @@ -68,8 +68,7 @@ function csv_quote($value) { global $excel; if ($excel) { - $tl = textlib_get_instance(); - return $tl->convert('"'.str_replace('"',"'",$value).'"','UTF-8','UTF-16LE'); + return textlib::convert('"'.str_replace('"',"'",$value).'"','UTF-8','UTF-16LE'); } else { return '"'.str_replace('"',"'",$value).'"'; } @@ -91,6 +90,9 @@ function csv_quote($value) { * Load data */ +// Retrieve course_module data for all modules in the course +$modinfo = get_fast_modinfo($course); + // Get criteria for course $completion = new completion_info($course); @@ -145,9 +147,8 @@ function csv_quote($value) { */ if ($csv) { $shortname = format_string($course->shortname, true, array('context' => $context)); - $textlib = textlib_get_instance(); header('Content-Disposition: attachment; filename=progress.'. - preg_replace('/[^a-z0-9-]/','_',$textlib->strtolower(strip_tags($shortname))).'.csv'); + preg_replace('/[^a-z0-9-]/','_',textlib::strtolower(strip_tags($shortname))).'.csv'); // Unicode byte-order mark for Excel if ($excel) { header('Content-Type: text/csv; charset=UTF-16LE'); @@ -335,6 +336,7 @@ function csv_quote($value) { exit; } + print '
    '; print '
    '; // Print criteria group names @@ -492,13 +494,10 @@ function csv_quote($value) { switch ($criterion->criteriatype) { case COMPLETION_CRITERIA_TYPE_ACTIVITY: - // Load activity - $activity = $criterion->get_mod_instance(); - // Display icon $icon = $OUTPUT->pix_url('icon', $criterion->module); $iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance; - $icontitle = $activity->name; + $icontitle = $modinfo->cms[$criterion->moduleinstance]->name; $iconalt = get_string('modulename', $criterion->module); break; @@ -577,10 +576,7 @@ function csv_quote($value) { if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) { // Load activity - $mod = $criterion->get_mod_instance(); - $activity = $DB->get_record('course_modules', array('id' => $criterion->moduleinstance)); - $activity->name = $mod->name; - + $activity = $modinfo->cms[$criterion->moduleinstance]; // Get progress information and state if (array_key_exists($activity->id,$user->progress)) { @@ -707,6 +703,7 @@ function csv_quote($value) { exit; } print '
    '; +print ''; print $pagingbar; print '
    • 0) { // Only show CSV if there are some users/actvs $shortname = format_string($course->shortname, true, array('context' => $context)); - $textlib = textlib_get_instance(); header('Content-Disposition: attachment; filename=progress.'. - preg_replace('/[^a-z0-9-]/','_',$textlib->strtolower(strip_tags($shortname))).'.csv'); + preg_replace('/[^a-z0-9-]/','_',textlib::strtolower(strip_tags($shortname))).'.csv'); // Unicode byte-order mark for Excel if ($excel) { header('Content-Type: text/csv; charset=UTF-16LE'); @@ -281,6 +279,7 @@ function csv_quote($value) { exit; } + print '
      '; print ''; // User heading / sort option @@ -415,6 +414,7 @@ function csv_quote($value) { exit; } print '
      '; +print '
      '; print $pagingbar; print '
      • '; str += this.get_page_button(1)+'1 '; var span = 5; var ex = (span-1)/2; - if (r.page+ex>=r.pages) { - var max = r.pages; + if (r.page+ex>=lastpage) { + var max = lastpage; } else { if (r.page'; + if (max==lastpage) { + str += this.get_page_button(lastpage)+lastpagetext+''; } else { str += this.get_page_button(max)+max+''; - str += ' ... '+this.get_page_button(r.pages)+r.pages+''; + str += ' ... '+this.get_page_button(lastpage)+lastpagetext+''; } str += ''; } diff --git a/repository/filepicker.php b/repository/filepicker.php index b7b1a65f3f3c2..68aee10060b12 100644 --- a/repository/filepicker.php +++ b/repository/filepicker.php @@ -206,9 +206,23 @@ } } if (!empty($list['page'])) { - // TODO: need a better solution - $pagingurl = new moodle_url("$CFG->httpswwwroot/repository/filepicker.php?action=list&itemid=$itemid&ctx_id=$contextid&repo_id=$repo_id&course=$courseid"); - echo $OUTPUT->paging_bar($list['total'], $list['page'] - 1, $list['perpage'], $pagingurl); + // TODO MDL-28482: need a better solution + // paging_bar is not a good option because it starts page numbering from 0 and + // repositories number pages starting from 1. + $pagingurl = new moodle_url("$CFG->httpswwwroot/repository/filepicker.php?action=list&itemid=$itemid&ctx_id=$contextid&repo_id=$repo_id&course=$courseid&sesskey=". sesskey()); + if (!isset($list['perpage']) && !isset($list['total'])) { + $list['perpage'] = 10; // instead of setting perpage&total we use number of pages, the result is the same + } + if (empty($list['total'])) { + if ($list['pages'] == -1) { + $total = ($list['page'] + 2) * $list['perpage']; + } else { + $total = $list['pages'] * $list['perpage']; + } + } else { + $total = $list['total']; + } + echo $OUTPUT->paging_bar($total, $list['page'], $list['perpage'], $pagingurl); } echo ''; foreach ($list['list'] as $item) { diff --git a/repository/filesystem/db/access.php b/repository/filesystem/db/access.php index e6e0034835c57..585622ad54cf2 100644 --- a/repository/filesystem/db/access.php +++ b/repository/filesystem/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_filesystem + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/flickr/db/access.php b/repository/flickr/db/access.php index b29e54f7873cb..14be5e5e07766 100644 --- a/repository/flickr/db/access.php +++ b/repository/flickr/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_flickr + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/flickr_public/db/access.php b/repository/flickr_public/db/access.php index 585b1aacba2fb..3379ec546cea0 100644 --- a/repository/flickr_public/db/access.php +++ b/repository/flickr_public/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_flickr_public + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/googledocs/db/access.php b/repository/googledocs/db/access.php index 5527635e4995e..ac63795a3a3b7 100644 --- a/repository/googledocs/db/access.php +++ b/repository/googledocs/db/access.php @@ -1,4 +1,28 @@ . + +/** + * Plugin capabilities. + * + * @package repository_googledocs + * @copyright 2009 Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/local/db/access.php b/repository/local/db/access.php index f8a26a1c8ad2d..258bdcc12c03e 100644 --- a/repository/local/db/access.php +++ b/repository/local/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_local + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/merlot/db/access.php b/repository/merlot/db/access.php index 47595dcbc65de..02fe277e475ff 100644 --- a/repository/merlot/db/access.php +++ b/repository/merlot/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_merlot + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/picasa/db/access.php b/repository/picasa/db/access.php index 70a2badb47afa..16a7c5bb17d62 100644 --- a/repository/picasa/db/access.php +++ b/repository/picasa/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_picasa + * @copyright 2009 Dan Poltawski + * @author Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/recent/db/access.php b/repository/recent/db/access.php index 2feeda3394d91..68f7ea59103ad 100644 --- a/repository/recent/db/access.php +++ b/repository/recent/db/access.php @@ -1,5 +1,4 @@ . +/** + * Plugin capabilities. + * + * @package repository_recent + * @copyright 2010 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'repository/recent:view' => array( diff --git a/repository/s3/db/access.php b/repository/s3/db/access.php index b5d3fc7808368..54cfdc84ac500 100644 --- a/repository/s3/db/access.php +++ b/repository/s3/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_s3 + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/upload/db/access.php b/repository/upload/db/access.php index c8c2824370c3f..0cce788ce8bd1 100644 --- a/repository/upload/db/access.php +++ b/repository/upload/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_upload + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/upload/lib.php b/repository/upload/lib.php index 3dc6330eea11c..447fd0861e5c5 100644 --- a/repository/upload/lib.php +++ b/repository/upload/lib.php @@ -223,6 +223,7 @@ public function get_listing() { $ret['list'] = array(); $ret['dynload'] = false; $ret['upload'] = array('label'=>get_string('attachment', 'repository'), 'id'=>'repo-form'); + $ret['allowcaching'] = true; // indicates that result of get_listing() can be cached in filepicker.js return $ret; } diff --git a/repository/url/db/access.php b/repository/url/db/access.php index ba7926964961a..af19a89b7240f 100644 --- a/repository/url/db/access.php +++ b/repository/url/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_url + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/user/db/access.php b/repository/user/db/access.php index 122a97ca4cb0f..fcbde60764207 100644 --- a/repository/user/db/access.php +++ b/repository/user/db/access.php @@ -1,5 +1,4 @@ . +/** + * Plugin capabilities. + * + * @package repository_user + * @copyright 2010 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = array( 'repository/user:view' => array( diff --git a/repository/webdav/db/access.php b/repository/webdav/db/access.php index a15f12f822058..2a2a428c1ff89 100644 --- a/repository/webdav/db/access.php +++ b/repository/webdav/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_webdav + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/wikimedia/db/access.php b/repository/wikimedia/db/access.php index a02b320814bb6..540db0e930db7 100644 --- a/repository/wikimedia/db/access.php +++ b/repository/wikimedia/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_wikimedia + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/wikimedia/lib.php b/repository/wikimedia/lib.php index adc3d25d9478c..8a827afa95b06 100644 --- a/repository/wikimedia/lib.php +++ b/repository/wikimedia/lib.php @@ -31,17 +31,41 @@ class repository_wikimedia extends repository { public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { + global $SESSION; parent::__construct($repositoryid, $context, $options); $this->keyword = optional_param('wikimedia_keyword', '', PARAM_RAW); if (empty($this->keyword)) { $this->keyword = optional_param('s', '', PARAM_RAW); } + $sess_keyword = 'wikimedia_'.$this->id.'_keyword'; + if (empty($this->keyword) && optional_param('page', '', PARAM_RAW)) { + // This is the request of another page for the last search, retrieve the cached keyword + if (isset($SESSION->{$sess_keyword})) { + $this->keyword = $SESSION->{$sess_keyword}; + } + } else if (!empty($this->keyword)) { + // save the search keyword in the session so we can retrieve it later + $SESSION->{$sess_keyword} = $this->keyword; + } } public function get_listing($path = '', $page = '') { $client = new wikimedia; $list = array(); - $list['list'] = $client->search_images($this->keyword); + $list['page'] = (int)$page; + if ($list['page'] < 1) { + $list['page'] = 1; + } + $list['list'] = $client->search_images($this->keyword, $list['page'] - 1); $list['nologin'] = true; + $list['norefresh'] = true; + $list['nosearch'] = true; + if (!empty($list['list'])) { + $list['pages'] = -1; // means we don't know exactly how many pages there are but we can always jump to the next page + } else if ($list['page'] > 1) { + $list['pages'] = $list['page']; // no images available on this page, this is the last page + } else { + $list['pages'] = 0; // no paging + } return $list; } // login @@ -57,10 +81,24 @@ public function print_login() { $keyword->type = 'text'; $keyword->name = 'wikimedia_keyword'; $keyword->value = ''; - - $form = array(); - $form['login'] = array($keyword); - return $form; + if ($this->options['ajax']) { + $form = array(); + $form['login'] = array($keyword); + $form['nologin'] = true; + $form['norefresh'] = true; + $form['nosearch'] = true; + $form['allowcaching'] = true; // indicates that login form can be cached in filepicker.js + return $form; + } else { + echo << + + + +
        {$keyword->label}
        + +EOD; + } } //search // if this plugin support global search, if this function return diff --git a/repository/wikimedia/wikimedia.php b/repository/wikimedia/wikimedia.php index 549b394dbb9b8..ce186b8f21ed7 100644 --- a/repository/wikimedia/wikimedia.php +++ b/repository/wikimedia/wikimedia.php @@ -141,13 +141,14 @@ public function get_thumb_url($image_url, $orig_width, $orig_height, $thumb_widt * @param string $keyword * @return array */ - public function search_images($keyword) { + public function search_images($keyword, $page = 0) { $files_array = array(); $this->_param['action'] = 'query'; $this->_param['generator'] = 'search'; $this->_param['gsrsearch'] = $keyword; $this->_param['gsrnamespace'] = WIKIMEDIA_FILE_NS; $this->_param['gsrlimit'] = WIKIMEDIA_THUMBS_PER_PAGE; + $this->_param['gsroffset'] = $page * WIKIMEDIA_THUMBS_PER_PAGE; $this->_param['prop'] = 'imageinfo'; $this->_param['iiprop'] = 'url|dimensions|mime'; $this->_param['iiurlwidth'] = WIKIMEDIA_IMAGE_SIDE_LENGTH; diff --git a/repository/youtube/db/access.php b/repository/youtube/db/access.php index 3e0b333c6246d..d2d1f90316aa5 100644 --- a/repository/youtube/db/access.php +++ b/repository/youtube/db/access.php @@ -1,4 +1,29 @@ . + +/** + * Plugin capabilities. + * + * @package repository_youtube + * @copyright 2009 Dongsheng Cai + * @author Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); $capabilities = array( diff --git a/repository/youtube/lib.php b/repository/youtube/lib.php index cb0020443cfc8..19f60b27cbf33 100644 --- a/repository/youtube/lib.php +++ b/repository/youtube/lib.php @@ -27,6 +27,8 @@ */ class repository_youtube extends repository { + /** @var int maximum number of thumbs per page */ + const YOUTUBE_THUMBS_PER_PAGE = 27; /** * Youtube plugin constructor @@ -35,9 +37,6 @@ class repository_youtube extends repository { * @param array $options */ public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { - $this->start =1; - $this->max = 27; - $this->sort = optional_param('youtube_sort', 'relevance', PARAM_TEXT); parent::__construct($repositoryid, $context, $options); } @@ -50,11 +49,40 @@ public function check_login() { * @param string $search_text * @return array */ - public function search($search_text) { + public function search($search_text, $page) { + global $SESSION; + $sort = optional_param('youtube_sort', '', PARAM_TEXT); + $sess_keyword = 'youtube_'.$this->id.'_keyword'; + $sess_sort = 'youtube_'.$this->id.'_sort'; + + // This is the request of another page for the last search, retrieve the cached keyword and sort + if ($page && !$search_text && isset($SESSION->{$sess_keyword})) { + $search_text = $SESSION->{$sess_keyword}; + } + if ($page && !$sort && isset($SESSION->{$sess_sort})) { + $sort = $SESSION->{$sess_sort}; + } + if (!$sort) { + $sort = 'relevance'; // default + } + + // Save this search in session + $SESSION->{$sess_keyword} = $search_text; + $SESSION->{$sess_sort} = $sort; + $this->keyword = $search_text; $ret = array(); $ret['nologin'] = true; - $ret['list'] = $this->_get_collection($search_text, $this->start, $this->max, $this->sort); + $ret['page'] = (int)$page; + if ($ret['page'] < 1) { + $ret['page'] = 1; + } + $start = ($ret['page'] - 1) * self::YOUTUBE_THUMBS_PER_PAGE + 1; + $max = self::YOUTUBE_THUMBS_PER_PAGE; + $ret['list'] = $this->_get_collection($search_text, $start, $max, $sort); + $ret['norefresh'] = true; + $ret['nosearch'] = true; + $ret['pages'] = -1; return $ret; } @@ -142,6 +170,7 @@ public function print_login($ajax = true) { $ret['login'] = array($search, $sort); $ret['login_btn_label'] = get_string('search'); $ret['login_btn_action'] = 'search'; + $ret['allowcaching'] = true; // indicates that login form can be cached in filepicker.js return $ret; } diff --git a/tag/coursetagslib.php b/tag/coursetagslib.php index c83b9543084b9..e3d78b080585f 100644 --- a/tag/coursetagslib.php +++ b/tag/coursetagslib.php @@ -125,7 +125,7 @@ function coursetag_get_all_tags($sort='name', $numtags=0) { global $CFG, $DB; // note that this selects all tags except for courses that are not visible - $sql = "SELECT id, name, id, tagtype, rawname, f.timemodified, flag, count + $sql = "SELECT id, name, tagtype, rawname, f.timemodified, flag, count FROM {tag} t, (SELECT tagid, MAX(timemodified) as timemodified, COUNT(id) as count FROM {tag_instance} WHERE tagid NOT IN @@ -367,7 +367,7 @@ function coursetag_store_keywords($tags, $courseid, $userid=0, $tagtype='officia //add tag if does not exist if (!$tagid = tag_get_id($tag)) { $tag_id_array = tag_add(array($tag), $tagtype); - $tagid = $tag_id_array[moodle_strtolower($tag)]; + $tagid = $tag_id_array[textlib::strtolower($tag)]; } //ordering $ordering = 0; @@ -444,15 +444,11 @@ function coursetag_get_tagged_courses($tagid) { $courses = array(); if ($crs = $DB->get_records_select('tag_instance', "tagid=:tagid AND itemtype='course'", array('tagid'=>$tagid))) { foreach ($crs as $c) { - //this capability check was introduced to stop display of courses that a student could not - //view, but arguably it is best that when clicking on a tag, the tagged course summary should - //be seen and then if the student clicks on that they will be given the opportunity to join - //note courses not visible should not have their tagid sent to this function - // $context = get_context_instance(CONTEXT_COURSE, $c->itemid); - //if (is_enrolled($context) oe is_viewing($context)) { - $course = $DB->get_record('course', array('id'=>$c->itemid)); + $course = $DB->get_record('course', array('id'=>$c->itemid)); + // check if the course is hidden + if ($course->visible == 1 || has_capability('moodle/course:viewhiddencourses', context_course::instance($course->id))) { $courses[$c->itemid] = $course; - //} + } } } return $courses; @@ -695,8 +691,7 @@ function coursetag_get_official_keywords($courseid, $asarray=false) { } foreach ($tags as $tag) { if( empty($CFG->keeptagnamecase) ) { - $textlib = textlib_get_instance(); - $name = $textlib->strtotitle($tag->name); + $name = textlib::strtotitle($tag->name); } else { $name = $tag->rawname; } diff --git a/tag/index.php b/tag/index.php index 56e23726aa122..7e957826964e8 100644 --- a/tag/index.php +++ b/tag/index.php @@ -92,14 +92,51 @@ echo $OUTPUT->heading($tagname, 2, 'headingblock header tag-heading'); tag_print_management_box($tag); tag_print_description_box($tag); +// Check what type of results are avaialable +require_once($CFG->dirroot.'/tag/coursetagslib.php'); +$courses = coursetag_get_tagged_courses($tag->id); + +if (has_capability('moodle/blog:view', $systemcontext)) { + require_once($CFG->dirroot.'/blog/lib.php'); + require_once($CFG->dirroot.'/blog/locallib.php'); -echo ''; + $bloglisting = new blog_listing(array('tag' => $tag->id)); + $limit = 10; + $start = 0; + $blogs = $bloglisting->get_entries($start, $limit); +} +$usercount = tag_record_count('user', $tag->id); + +// Only include 's to those anchors that actually will be shown +$relatedpageslink = ""; +$countanchors = 0; +if (!empty($courses)) { + $relatedpageslink = ''.get_string('courses').''; + $countanchors++; +} +if (!empty($blogs)) { + if ($countanchors > 0) { + $relatedpageslink .= ' | '; + } + $relatedpageslink .= ''.get_string('relatedblogs', 'tag').''; + $countanchors++; +} +if ($usercount > 0) { + if ($countanchors > 0) { + $relatedpageslink .= ' | '; + } + $relatedpageslink .= ''.get_string('users').''; + $countanchors++; +} +// If only one anchor is present, no is needed +if ($countanchors == 0) { + echo '

        '.get_string('noresultsfor', 'tag', $tagname).'

        '; +} elseif ($countanchors > 1) { + echo '

        '.$relatedpageslink.'

        '; +} // Display courses tagged with the tag -require_once($CFG->dirroot.'/tag/coursetagslib.php'); -if ($courses = coursetag_get_tagged_courses($tag->id)) { +if (!empty($courses)) { $totalcount = count( $courses ); echo $OUTPUT->box_start('generalbox', 'tag-blogs'); //could use an id separate from tag-blogs, but would have to copy the css style to make it look the same @@ -116,49 +153,39 @@ } // Print up to 10 previous blogs entries -if (has_capability('moodle/blog:view', $systemcontext)) { - require_once($CFG->dirroot.'/blog/lib.php'); - require_once($CFG->dirroot.'/blog/locallib.php'); - $bloglisting = new blog_listing(array('tag' => $tag->id)); - $limit = 10; - $start = 0; +if (!empty($blogs)) { + echo $OUTPUT->box_start('generalbox', 'tag-blogs'); + $heading = get_string('relatedblogs', 'tag', $tagname). ' ' . get_string('taggedwith', 'tag', $tagname); + echo "
        "; + echo $OUTPUT->heading($heading, 3); - if ($blogs = $bloglisting->get_entries($start, $limit)) { - - echo $OUTPUT->box_start('generalbox', 'tag-blogs'); - $heading = get_string('relatedblogs', 'tag', $tagname). ' ' . get_string('taggedwith', 'tag', $tagname); - echo ""; - echo $OUTPUT->heading($heading, 3); - - echo ''; - $allblogsurl = new moodle_url('/blog/index.php', array('tagid' => $tag->id)); - echo '

        '.get_string('seeallblogs', 'tag', $tagname).'

        '; + $allblogsurl = new moodle_url('/blog/index.php', array('tagid' => $tag->id)); + echo '

        '.get_string('seeallblogs', 'tag', $tagname).'

        '; - echo $OUTPUT->box_end(); - } + echo $OUTPUT->box_end(); } -$usercount = tag_record_count('user', $tag->id); if ($usercount > 0) { //user table box diff --git a/tag/lib.php b/tag/lib.php index 2859162b61d8f..cdbe37fb9048a 100644 --- a/tag/lib.php +++ b/tag/lib.php @@ -286,7 +286,7 @@ function tag_get($field, $value, $returnfields='id, name, rawname') { global $DB; if ($field == 'name') { - $value = moodle_strtolower($value); // To cope with input that might just be wrong case + $value = textlib::strtolower($value); // To cope with input that might just be wrong case } return $DB->get_record('tag', array($field=>$value), $returnfields); } @@ -446,7 +446,7 @@ function tag_get_id($tags, $return_value=null) { //TODO MDL-31152 test this and see if it helps performance without breaking anything //foreach($tags as $key => $tag) { - // $clean_tag = moodle_strtolower($tag); + // $clean_tag = textlib::strtolower($tag); // if ( array_key_exists($clean_tag), $tag_id_cache) ) { // $result[$clean_tag] = $tag_id_cache[$clean_tag]; // $tags[$key] = ''; // prevent further processing for this one. @@ -455,8 +455,8 @@ function tag_get_id($tags, $return_value=null) { $tags = array_values(tag_normalize($tags)); foreach($tags as $key => $tag) { - $tags[$key] = moodle_strtolower($tag); - $result[moodle_strtolower($tag)] = null; // key must exists : no value for a key means the tag wasn't found. + $tags[$key] = textlib::strtolower($tag); + $result[textlib::strtolower($tag)] = null; // key must exists : no value for a key means the tag wasn't found. } if (empty($tags)) { @@ -562,7 +562,7 @@ function tag_rename($tagid, $newrawname) { return false; } - if (! $newname_clean = moodle_strtolower($newrawname_clean)) { + if (! $newname_clean = textlib::strtolower($newrawname_clean)) { return false; } @@ -673,8 +673,7 @@ function tag_display_name($tagobject, $html=TAG_RETURN_HTML) { if (empty($CFG->keeptagnamecase)) { //this is the normalized tag name - $textlib = textlib_get_instance(); - $tagname = $textlib->strtotitle($tagobject->name); + $tagname = textlib::strtotitle($tagobject->name); } else { //original casing of the tag name $tagname = $tagobject->rawname; @@ -760,7 +759,7 @@ function tag_add($tags, $type="default") { // note that the difference between rawname and name is only // capitalization : the rawname is NOT the same at the rawtag. $tag_object->rawname = $tag; - $tag_name_lc = moodle_strtolower($tag); + $tag_name_lc = textlib::strtolower($tag); $tag_object->name = $tag_name_lc; //var_dump($tag_object); $tags_ids[$tag_name_lc] = $DB->insert_record('tag', $tag_object); @@ -813,7 +812,7 @@ function tag_autocomplete($text) { global $DB; return $DB->get_records_sql("SELECT tg.id, tg.name, tg.rawname FROM {tag} tg - WHERE tg.name LIKE ?", array(moodle_strtolower($text)."%")); + WHERE tg.name LIKE ?", array(textlib::strtolower($text)."%")); } /** @@ -1123,7 +1122,7 @@ function tag_normalize($rawtags, $case = TAG_CASE_LOWER) { continue; } if ( !array_key_exists($rawtag, $cleaned_tags_lc) ) { - $cleaned_tags_lc[$rawtag] = moodle_strtolower( clean_param($rawtag, PARAM_TAG) ); + $cleaned_tags_lc[$rawtag] = textlib::strtolower( clean_param($rawtag, PARAM_TAG) ); $cleaned_tags_mc[$rawtag] = clean_param($rawtag, PARAM_TAG); } if ( $case == TAG_CASE_LOWER ) { diff --git a/tag/locallib.php b/tag/locallib.php index 6c750b069b62b..fb7f9a9f7300a 100644 --- a/tag/locallib.php +++ b/tag/locallib.php @@ -356,7 +356,6 @@ function tag_print_tagged_users_table($tag_object, $limitfrom='', $limitnum='', function tag_print_user_box($user, $return=false) { global $CFG, $OUTPUT; - $textlib = textlib_get_instance(); $usercontext = get_context_instance(CONTEXT_USER, $user->id); $profilelink = ''; @@ -381,8 +380,8 @@ function tag_print_user_box($user, $return=false) { } //truncate name if it's too big - if ($textlib->strlen($fullname) > 26) { - $fullname = $textlib->substr($fullname, 0, 26) .'...'; + if (textlib::strlen($fullname) > 26) { + $fullname = textlib::substr($fullname, 0, 26) .'...'; } $output .= ''. $fullname .''; diff --git a/theme/afterburner/style/afterburner_layout.css b/theme/afterburner/style/afterburner_layout.css index 5fd8e689e14ca..fdaab2edc99f3 100644 --- a/theme/afterburner/style/afterburner_layout.css +++ b/theme/afterburner/style/afterburner_layout.css @@ -13,6 +13,7 @@ body { } #page-wrapper { width:90%; + min-width: 775px; margin: 0 auto; background: transparent; border: 1px solid #eee; @@ -157,4 +158,4 @@ CONTENT-ONLY - NO SIDE BLOCKS WHATSOEVER (Middle Column Only) /* PAGELAYOUT-REPORT -------------------------*/ -.pagelayout-report #page-content #region-main-box #region-post-box #region-main-wrap #region-main-pad #region-main .region-content .no-overflow {overflow: auto;} \ No newline at end of file +.pagelayout-report #page-content #region-main-box #region-post-box #region-main-wrap #region-main-pad #region-main .region-content .no-overflow {overflow: auto;} diff --git a/theme/afterburner/style/afterburner_styles.css b/theme/afterburner/style/afterburner_styles.css index c03d7b2e72e4d..ab18d758d44ab 100644 --- a/theme/afterburner/style/afterburner_styles.css +++ b/theme/afterburner/style/afterburner_styles.css @@ -253,6 +253,11 @@ Course Section Topic & Weekly display: none; /* hides topic items title or weekly itens title */ margin-bottom: 9px; } +/*Login (Login page)*/ +.loginbox .loginform .form-label {width:46%;} +.dir-rtl .loginbox .loginform .form-label {width:46%;} +.loginbox .loginform .form-input {width:53%;} + /* Login (Front Page) -----------------------*/ diff --git a/theme/anomaly/style/base.css b/theme/anomaly/style/base.css index 019f65746ff25..ce915e3c039ec 100644 --- a/theme/anomaly/style/base.css +++ b/theme/anomaly/style/base.css @@ -61,6 +61,7 @@ h6.main { text-align: center; } + /** * Tabs */ diff --git a/theme/anomaly/style/general.css b/theme/anomaly/style/general.css index fc19a6d68e79f..2f93b1aab1846 100644 --- a/theme/anomaly/style/general.css +++ b/theme/anomaly/style/general.css @@ -186,13 +186,13 @@ h1.headermain { } .loginbox .loginform .form-label { - width: 39%; + width: 44%; float: left; text-align: right; } .loginbox .loginform .form-input { - width: 60%; + width: 55%; float: right; text-align: left; } @@ -244,6 +244,8 @@ h1.headermain { border-top: 1px solid #DDD; } +.dir-rtl .loginbox .loginform .form-input {width:50%} + /** Blocks **/ .block { @@ -835,4 +837,4 @@ h1.headermain { /* Add Block -------------------------*/ -.block .content .singleselect form#add_block .select.menubui_addblock { width: 160px;} \ No newline at end of file +.block .content .singleselect form#add_block .select.menubui_addblock { width: 160px;} diff --git a/theme/base/layout/frontpage.php b/theme/base/layout/frontpage.php index 4c09416159072..8a02304930e32 100644 --- a/theme/base/layout/frontpage.php +++ b/theme/base/layout/frontpage.php @@ -90,6 +90,7 @@ echo $OUTPUT->standard_footer_html(); ?> +
        standard_end_of_body_html() ?> diff --git a/theme/base/layout/general.php b/theme/base/layout/general.php index cfb761d62264b..afb9cfca4110d 100644 --- a/theme/base/layout/general.php +++ b/theme/base/layout/general.php @@ -103,6 +103,7 @@ ?> +
        standard_end_of_body_html() ?> diff --git a/theme/base/layout/report.php b/theme/base/layout/report.php index e42b1cbd6f981..4692917988049 100644 --- a/theme/base/layout/report.php +++ b/theme/base/layout/report.php @@ -83,6 +83,7 @@ ?> +
        standard_end_of_body_html() ?> diff --git a/theme/base/style/core.css b/theme/base/style/core.css index c7fed783488ba..2857512abd9b3 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -39,8 +39,14 @@ a.dimmed_text:visited, .usersuspended a:link, .usersuspended a:visited, .dimmed_category, -.dimmed_category a { height: 1%; opacity: 0.5; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); } - +.dimmed_category a { + color: #AAA; +} +.activity.label .dimmed_text { + opacity: 0.5; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + filter: alpha(opacity=50); +} .unlist, .unlist li, .inline-list, @@ -272,7 +278,7 @@ input#id_externalurl {direction:ltr;} /** * Login */ -.loginbox {margin:15px;overflow:hidden;} +.loginbox {margin:15px;overflow:visible;} .loginbox.twocolumns {margin:15px;} .loginbox h2, .loginbox .subcontent {margin:5px;padding:10px;text-align:center;} @@ -285,8 +291,9 @@ input#id_externalurl {direction:ltr;} .loginbox .potentialidps .potentialidplist {margin-left:40%;} .loginbox .potentialidps .potentialidplist div {text-align:left;} .loginbox .loginform {margin-top:1em;text-align:left;} -.loginbox .loginform .form-label {float:left;text-align:right;width:40%;} -.loginbox .loginform .form-input {float:right;width:59%;} +.loginbox .loginform .form-label {float:left;text-align:right;width:44%;direction:rtl; white-space:nowrap;} +.dir-rtl .loginbox .loginform .form-label {float:left;text-align:right;width:44%;direction:ltr; white-space:nowrap;} +.loginbox .loginform .form-input {float:right;width:55%;} .loginbox .loginform .form-input input {width: 6em;} .loginbox .signupform {margin-top:1em;text-align:center;} .loginbox.twocolumns .loginpanel {float:left;width:49.5%;border-right: 1px solid;margin-bottom:-2000px;padding-bottom:2000px;} diff --git a/theme/base/style/message.css b/theme/base/style/message.css index aa0b2505a7ab5..57adc20a2e620 100644 --- a/theme/base/style/message.css +++ b/theme/base/style/message.css @@ -55,6 +55,8 @@ table.message .searchresults td {padding:5px;} .message .hiddenelement {display:none;} /** not just using hidden as mform adds that class to its fieldset */ .message .visible {display:inline;} +.message #usergroupselector.fieldset, .message #viewing {width: 100%;} + .messagesearchresults {margin-bottom:40px;} .messagesearchresults td {padding:0px 10px 0px 20px;} .messagesearchresults td span {white-space:nowrap;} diff --git a/theme/binarius/style/pagelayout.css b/theme/binarius/style/pagelayout.css index bde162c687073..5aaf4d21d3d15 100644 --- a/theme/binarius/style/pagelayout.css +++ b/theme/binarius/style/pagelayout.css @@ -114,7 +114,6 @@ body { width: 0px; } - /** Report layout **/ .pagelayout-report {border-top:1px solid #555555;} .pagelayout-report #page {width:auto;position:relative;overflow:visible;} @@ -128,6 +127,8 @@ body { .pagelayout-report #page-footer {float:none;} .pagelayout-report #page-content .region-content {overflow:visible;} .pagelayout-report.content-only #report-main-content .region-content {margin-left:0;} +.pagelayout-report #page-content-wrapper #page-content #report-main-content .region-content + .no-overflow {overflow: auto;} /** Correct for right to left languages **/ .dir-rtl.pagelayout-report #report-main-content .region-content {margin-left:0;margin-right:200px;} @@ -141,4 +142,4 @@ body { .ie6.pagelayout-report #report-region-pre, .ie6.pagelayout-report #report-region-pre .block .ie7.pagelayout-report #report-region-pre, -.ie7.pagelayout-report #report-region-pre .block {width:100%;} \ No newline at end of file +.ie7.pagelayout-report #report-region-pre .block {width:100%;} diff --git a/theme/formal_white/layout/general.php b/theme/formal_white/layout/general.php index 8dfd26ccc3a4b..570ada7d50549 100644 --- a/theme/formal_white/layout/general.php +++ b/theme/formal_white/layout/general.php @@ -116,7 +116,6 @@ -
        diff --git a/theme/formal_white/style/core.css b/theme/formal_white/style/core.css index 2e41f009e28c7..56ededa80ae78 100644 --- a/theme/formal_white/style/core.css +++ b/theme/formal_white/style/core.css @@ -111,13 +111,16 @@ input[type="radio"] { } .loginbox .loginform .form-label { - margin: 0 auto; float: left; - text-align: right; width: 40%; + margin: 0 auto; + text-align: right; } .dir-rtl .loginbox .loginform .form-label { + float: none; + width: 100%; + margin: 0 auto; text-align: right; } @@ -129,7 +132,7 @@ input[type="radio"] { .loginbox .loginform .form-input #username, .loginbox .loginform .form-input #password { - width: 50%; + width: 100%; color: #000; } diff --git a/theme/formal_white/style/course.css b/theme/formal_white/style/course.css index 22947d48922ef..921e2cc0bf2b1 100644 --- a/theme/formal_white/style/course.css +++ b/theme/formal_white/style/course.css @@ -64,7 +64,7 @@ #page-report .plugin, #page-course-import .plugin {margin-bottom:20px;margin-left:10%;margin-right:10%;border:1px solid #cecece;background-color:[[setting:blockcontentbgc]];} -.path-course-view .unread {background:#9EBEFF;} +.path-course-view .unread {background:#E3DFD4;} .path-course-view .completionprogress {font-size:80%; padding:8px 26px 5px 5px;} #page-course-category .courseboxes, @@ -86,6 +86,14 @@ .categorypicker {text-align:center;margin-bottom:10px;} .path-report-outline .loginfo {text-align:center;margin:1em;} .categorylist {width:90%;margin:0 auto;text-align:left;} +.categorylist .category .info, +.categorylist .category .indentation, +.categorylist .category .name, +.categorylist .category .image, +.categorylist .course .name, +.categorylist .course .info { + margin: 0.1em; +} /* Course and category combo list on front page */ .course_category_tree .controls {margin-bottom:5px;text-align:right;float:right;} diff --git a/theme/formal_white/style/formal_white.css b/theme/formal_white/style/formal_white.css index f57b3f644c315..dcde08010ba2e 100644 --- a/theme/formal_white/style/formal_white.css +++ b/theme/formal_white/style/formal_white.css @@ -133,6 +133,8 @@ th.header, .generalbox th, .generaltable th.header {background-image:url([[pix:theme|gradient_h]]);background-repeat:repeat-x;border-top:1px #C6BDA8 solid;background-color:#E3DFD4;} /*#modules, .compatibleblockstable {margin-left:auto; margin-right:auto;} waiting for MDL-26760*/ +table.flexible .r0, table.generaltable .r0 {background-color: #F0F0F0;} +table.flexible .r1, table.generaltable .r1 {background-color: #FAFAFA;} /* admin pages */ div#chooseuser {border:0 transparent none;} @@ -231,5 +233,26 @@ form.loginform .rememberusername { width: auto; } +/* RSS - MDL-29367 */ +.block_rss_client .list li:first-child { + border-top-width: 0; +} + +.block_rss_client .list li { + border-top: 1px solid #DDDDDD; + padding: 5px; +} + +/* Upcoming events - MDL-29367 */ +/* to have the same separator as in .block_rss_client .list li */ +.block_calendar_upcoming .content > hr { + display:none; +} + +.block_calendar_upcoming .event { + border-bottom: 1px solid #DDDDDD; + padding: 5px; +} + /** Custom CSS **/ [[setting:customcss]] diff --git a/theme/formal_white/style/forum.css b/theme/formal_white/style/forum.css index 6cea0c91b8ddb..17167c89a3abd 100644 --- a/theme/formal_white/style/forum.css +++ b/theme/formal_white/style/forum.css @@ -4,15 +4,15 @@ .forumpost {border: 1px solid #CACACA;} .forumpost .row {background-color:#FFF;} -.forumpost .row.header {background-color:[[setting:blockcontentbgc]];background-image:none;} -.forumpost.firstpost .row.header {background-color:[[setting:lblockcolumnbgc]];} +.forumpost .row.header {background-color:#E3DFD4;background-image:none;} +.forumpost.firstpost .row.header {background-color:#E3DFD4;} .forumpost .topic .author {font-size: 0.8em;padding:4px;} .forumpost .topic .subject {font-weight: bold;padding:4px 4px 0;} .forumpost .options div {border-top: 1px dotted #DBDBDB;} .forumpost .content div, .forumpost .options div {padding:4px;} -.forumpost.unread {background: #9EBEFF;} -.forumpost.unread .content {border:2px solid #DBDBDB;} /** inside border of unread posts in nested format in */ +.forumpost.unread .content {background-color: [[setting:lblockcolumnbgc]];} /** inside of unread posts in nested format in */ +.forumpost .row .topic {background-color: #E3DFD4;} #page-mod-forum-view .forummode, .path-mod-forum .forumheaderlist .replies {text-align: center;} @@ -30,4 +30,5 @@ #page-mod-forum-view .forumheaderlist {border-color:#DDDDDD;} /** border around posts in */ #email .unsubscribelink {border-width: 0px 1px 0px 0px;border-style: solid;text-align:center;} #page-mod-forum-view .highlight2 {color:#AA0000;} -#page-mod-forum-view.dir-rtl .forumheaderlist .discussion .starter {text-align:right;} \ No newline at end of file +#page-mod-forum-view.dir-rtl .forumheaderlist .discussion .starter {text-align:right;} +#page-mod-forum-view .unread {background: #E3DFD4;} diff --git a/theme/formal_white/style/tabs.css b/theme/formal_white/style/tabs.css index 75267453781f5..c4f8db7f58698 100644 --- a/theme/formal_white/style/tabs.css +++ b/theme/formal_white/style/tabs.css @@ -5,22 +5,27 @@ position:relative; margin-bottom:3.5em; } + .tabtree .tabrow0 { text-align:center; width:100%; margin:1em 0px; } + /* serve a qualcosa? */ .tabtree ul li.here .empty { display: none; } + .tabtree .tabrow0 li { display:inline; margin-right:-4px; } + .tabtree .tabrow0 li.here { - font-weight: normal; + font-weight: bold; } + .tabtree .tabrow0 li.here .empty { display: block; height: 1px; @@ -30,15 +35,18 @@ width: 100%; bottom: -4px; } + .tabtree .tabrow0 li a:link, .tabtree .tabrow0 li a:visited, .tabtree .tabrow0 li a:active { color:#000; } + .tabtree .tabrow0 li.here a { position:relative; z-index:102; } + .tabtree .tabrow0 li a { background-image:url([[pix:theme|tab/left]]); padding-left:14px; @@ -50,9 +58,11 @@ background-color:transparent; border:none; } + .tabtree .tabrow0 li a:hover { background-image:url([[pix:theme|tab/left_hover]]); } + .tabtree .tabrow0 li a span { background-image:url([[pix:theme|tab/right]]); background-repeat:no-repeat; @@ -61,9 +71,11 @@ padding-top:10px; padding-bottom:4px; /*to remove the border-bottom*/ } + .tabtree .tabrow0 li a:hover span { background-image:url([[pix:theme|tab/right_hover]]); } + .tabtree .tabrow0 ul, .tabtree .tabrow0 div { background-image:url([[pix:theme|tab/tabrow1]]); @@ -75,12 +87,14 @@ top:100%; margin:0px; } + .tabtree .tabrow0 .empty { height:1px; overflow:hidden; padding:0px; position:absolute; } + .tabtree .tabrow1 li a, .tabtree .tabrow1 li a:hover, .tabtree .tabrow1 li a span, @@ -92,15 +106,26 @@ .tabtree .tabrow1 li a:hover { font-weight:bold; + text-decoration: underline; +} + +.tabtree .tabrow1 li { + font-weight: normal; +} + +.tabtree .tabrow1 li.here { + font-weight: bold; } .groupmanagementtable { width:90%; } + .groupmanagementtable td { vertical-align:top; border-width:0px; } + .groupmanagementtable td p { margin:0px; } diff --git a/theme/index.php b/theme/index.php index 17cc1c0d1ff00..ce2a3d10fd108 100644 --- a/theme/index.php +++ b/theme/index.php @@ -25,6 +25,7 @@ $choose = optional_param('choose', '', PARAM_PLUGIN); $reset = optional_param('reset', 0, PARAM_BOOL); $device = optional_param('device', '', PARAM_TEXT); +$unsettheme = optional_param('unsettheme', 0, PARAM_BOOL); admin_externalpage_setup('themeselector'); @@ -42,8 +43,7 @@ if ($reset and confirm_sesskey()) { theme_reset_all_caches(); -} else if ($choose && $device && confirm_sesskey()) { - +} else if ($choose && $device && !$unsettheme && confirm_sesskey()) { // Load the theme to make sure it is valid. $theme = theme_config::load($choose); // Get the config argument for the chosen device. @@ -71,19 +71,20 @@ echo $output->continue_button($CFG->wwwroot . '/theme/index.php'); echo $output->footer(); exit; +} else if ($device && $unsettheme && confirm_sesskey() && ($device != 'default')) { + //Unset the theme and continue. + unset_config(get_device_cfg_var_name($device)); + $device = ''; } // Otherwise, show either a list of devices, or is enabledevicedetection set to no or a // device is specified show a list of themes. -echo $OUTPUT->header('themeselector'); -echo $OUTPUT->heading(get_string('themes')); - -echo $OUTPUT->single_button(new moodle_url('index.php', array('sesskey' => sesskey(), 'reset' => 1)), get_string('themeresetcaches', 'admin')); - $table = new html_table(); $table->data = array(); +$heading = ''; if (!empty($CFG->enabledevicedetection) && empty($device)) { + $heading = get_string('selectdevice', 'admin'); // Display a list of devices that a user can select a theme for. $strthemenotselected = get_string('themenoselected', 'admin'); @@ -91,7 +92,7 @@ // Display the device selection screen $table->id = 'admindeviceselector'; - $table->head = array(get_string('devicetype', 'admin'), get_string('theme'), get_string('info')); + $table->head = array(get_string('devicetype', 'admin'), get_string('currenttheme', 'admin'), get_string('info')); $devices = get_device_type_list(); foreach ($devices as $device) { @@ -103,6 +104,7 @@ } $screenshotcell = $strthemenotselected; + $unsetthemebutton = ''; if ($themename) { // Check the theme exists $themename = clean_param($themename, PARAM_THEME); @@ -118,21 +120,28 @@ // Show the name of the picked theme $headingthemename = $OUTPUT->heading($strthemename, 3); } + // If not default device then show option to unset theme. + if ($device != 'default') { + $unsetthemestr = get_string('unsettheme', 'admin'); + $unsetthemeurl = new moodle_url('/theme/index.php', array('device' => $device, 'sesskey' => sesskey(), 'unsettheme' => true)); + $unsetthemebutton = new single_button($unsetthemeurl, $unsetthemestr, 'get'); + $unsetthemebutton = $OUTPUT->render($unsetthemebutton); + } } $deviceurl = new moodle_url('/theme/index.php', array('device' => $device, 'sesskey' => sesskey())); $select = new single_button($deviceurl, $strthemeselect, 'get'); $table->data[] = array( - $device, + $OUTPUT->heading(ucfirst($device), 3), $screenshotcell, - $headingthemename . $OUTPUT->render($select) + $headingthemename . $OUTPUT->render($select) . $unsetthemebutton ); } } else { // Either a device has been selected of $CFG->enabledevicedetection is off so display a list // of themes to select. - + $heading = get_string('selecttheme', 'admin', $device); if (empty($device)) { // if $CFG->enabledevicedetection is off this will return 'default' $device = get_device_type(); @@ -183,10 +192,19 @@ // Contents of the second cell. $infocell = $OUTPUT->heading($strthemename, 3); - // Button to choose this as the main theme - $maintheme = new single_button(new moodle_url('/theme/index.php', array('device' => $device, 'choose' => $themename, 'sesskey' => sesskey())), get_string('usetheme'), 'get'); - $maintheme->disabled = $ischosentheme; - $infocell .= $OUTPUT->render($maintheme); + // Button to choose this as the main theme or unset this theme for + // devices other then default + if (($ischosentheme) && ($device != 'default')) { + $unsetthemestr = get_string('unsettheme', 'admin'); + $unsetthemeurl = new moodle_url('/theme/index.php', array('device' => $device, 'unsettheme' => true, 'sesskey' => sesskey())); + $unsetbutton = new single_button($unsetthemeurl, $unsetthemestr, 'get'); + $infocell .= $OUTPUT->render($unsetbutton); + } else if ((!$ischosentheme)) { + $setthemestr = get_string('usetheme'); + $setthemeurl = new moodle_url('/theme/index.php', array('device' => $device, 'choose' => $themename, 'sesskey' => sesskey())); + $setthemebutton = new single_button($setthemeurl, $setthemestr, 'get'); + $infocell .= $OUTPUT->render($setthemebutton); + } $row[] = $infocell; @@ -194,6 +212,10 @@ $table->rowclasses[$themename] = join(' ', $rowclasses); } } +echo $OUTPUT->header('themeselector'); +echo $OUTPUT->heading($heading); + +echo $OUTPUT->single_button(new moodle_url('index.php', array('sesskey' => sesskey(), 'reset' => 1, 'device' => $device)), get_string('themeresetcaches', 'admin')); echo html_writer::table($table); diff --git a/theme/javascript.php b/theme/javascript.php index 3ebba8bb191ed..6f7ebadc8be5b 100644 --- a/theme/javascript.php +++ b/theme/javascript.php @@ -130,6 +130,10 @@ function send_uncached_js($js) { } function minify($files) { + if (empty($files)) { + return ''; + } + if (0 === stripos(PHP_OS, 'win')) { Minify::setDocRoot(); // IIS may need help } @@ -150,6 +154,30 @@ function minify($files) { 'quiet' => true ); - $result = Minify::serve('Files', $options); - return $result['content']; + $error = 'unknown'; + try { + $result = Minify::serve('Files', $options); + if ($result['success']) { + return $result['content']; + } + } catch (Exception $e) { + $error = $e->getMessage(); + $error = str_replace("\r", ' ', $error); + $error = str_replace("\n", ' ', $error); + } + + // minification failed - try to inform the theme developer and include the non-minified version + $js = << 'side-post', ), 'admin' => array( - 'theme' => 'base', 'file' => 'report.php', 'regions' => array('side-pre'), 'defaultregion' => 'side-pre', @@ -163,6 +162,13 @@ 'regions' => array(), 'options' => array('nofooter'=>true, 'nonavbar'=>true), ), + // The pagelayout used when a redirection is occuring. + 'redirect' => array( + 'theme' => 'canvas', + 'file' => 'embedded.php', + 'regions' => array(), + 'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true), + ), // Should display the content and basic headers only. 'print' => array( 'file' => 'general.php', @@ -170,7 +176,6 @@ 'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true), ), 'report' => array( - 'theme' => 'base', 'file' => 'report.php', 'regions' => array('side-pre'), 'defaultregion' => 'side-pre', @@ -240,4 +245,4 @@ //////////////////////////////////////////////////// // Sets a custom render factory to use with the // theme, used when working with custom renderers. -//////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////////////////////// diff --git a/theme/sky_high/layout/frontpage.php b/theme/sky_high/layout/frontpage.php index 5f2d4600bda91..0a3ccf68010cb 100644 --- a/theme/sky_high/layout/frontpage.php +++ b/theme/sky_high/layout/frontpage.php @@ -1,10 +1,9 @@ layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT)); -$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT)); - -$showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT)); -$showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT)); +$hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT); +$hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT); +$showsidepre = $hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT); +$showsidepost = $hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT); $custommenu = $OUTPUT->custom_menu(); $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu)); @@ -17,16 +16,14 @@ } else if (!$showsidepost && !$showsidepre) { $bodyclasses[] = 'content-only'; } -if ($hassidepre || $hassidepost) { - $bodyclasses[] = 'background'; +if ($hascustommenu) { + $bodyclasses[] = 'has_custom_menu'; } - if (!empty($PAGE->theme->settings->logo)) { $logourl = $PAGE->theme->settings->logo; } else { $logourl = NULL; } - if (!empty($PAGE->theme->settings->footnote)) { $footnote = $PAGE->theme->settings->footnote; } else { diff --git a/theme/sky_high/layout/general.php b/theme/sky_high/layout/general.php index d99c4d51030d4..76a97d16576c6 100644 --- a/theme/sky_high/layout/general.php +++ b/theme/sky_high/layout/general.php @@ -1,9 +1,12 @@ layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT)); -$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT)); +$hasheading = ($PAGE->heading); $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); $hasfooter = (empty($PAGE->layout_options['nofooter'])); +$hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT)); +$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT)); +$haslogininfo = (empty($PAGE->layout_options['nologininfo'])); + $showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT)); $showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT)); @@ -18,16 +21,17 @@ } else if (!$showsidepost && !$showsidepre) { $bodyclasses[] = 'content-only'; } +if ($hascustommenu) { + $bodyclasses[] = 'has_custom_menu'; +} if ($hassidepre || $hassidepost) { $bodyclasses[] = 'background'; } - if (!empty($PAGE->theme->settings->logo)) { $logourl = $PAGE->theme->settings->logo; } else { $logourl = NULL; } - if (!empty($PAGE->theme->settings->footnote)) { $footnote = $PAGE->theme->settings->footnote; } else { diff --git a/theme/sky_high/layout/report.php b/theme/sky_high/layout/report.php index 0744183f59416..68cc55b10cc49 100644 --- a/theme/sky_high/layout/report.php +++ b/theme/sky_high/layout/report.php @@ -2,18 +2,18 @@ $hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT)); $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); +$hasfooter = (empty($PAGE->layout_options['nofooter'])); $showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT)); $custommenu = $OUTPUT->custom_menu(); $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu)); $bodyclasses = array(); -if (!$showsidepre) { +if ($showsidepre) { + $bodyclasses[] = 'side-pre-only'; +} else { $bodyclasses[] = 'content-only'; } -if ($hassidepre) { - $bodyclasses[] = 'background'; -} if (!empty($PAGE->theme->settings->logo)) { $logourl = $PAGE->theme->settings->logo; @@ -39,29 +39,28 @@ standard_top_of_body_html() ?>
        -
        +
        @@ -73,30 +72,25 @@
        - - - + + + + +
        -
        -
        -
        -
        +
        +
        +
        +
        -
        -
        -
        - main_content() ?> -
        +
        +
        + main_content() ?>
        -
        +
        blocks_for_region('side-pre') ?>
        @@ -110,27 +104,38 @@ +
        + - + - + + + + + + + + home_link(); ?> + standard_footer_html(); ?> + +
        + + + +
        -
        - home_link(); - echo $OUTPUT->standard_end_of_body_html() ?> -
        + + +standard_end_of_body_html() ?> diff --git a/theme/sky_high/style/core.css b/theme/sky_high/style/core.css index 1af68bb5bc33e..9c49f7486078d 100644 --- a/theme/sky_high/style/core.css +++ b/theme/sky_high/style/core.css @@ -1,30 +1,21 @@ /* @group Core */ -.pagelayout-frontpage, -.pagelayout-incourse, -.pagelayout-general, -.pagelayout-course, -.pagelayout-coursecategory, -.pagelayout-admin, -.pagelayout-mydashboard, -.pagelayout-mypublic, -.pagelayout-login, -.pagelayout-report { - background:url([[pix:theme|body]]) top left repeat-x #dcecf9; +html, body { + background: #dcecf9 url([[pix:theme|body]]) left top repeat-x fixed; } - -body,h1,h2,h3,h4,h5,h6,p,ul,ol,dl,input,textarea { - font-family:Arial, Helvetica, sans-serif; - color:#333; +body.pagelayout-popup.background { + background: #dcecf9 url([[pix:theme|body]]) left top repeat-x fixed !important; +} +#page, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, input, textarea { + font-family: Arial, Helvetica, sans-serif; + color: #333; } - #wrapper { - background:#fff; - margin:20px 5% 0px 5%; - padding:0px; - border:1px solid #c1bc9d; + background: #fff; + margin: 20px 5% 0; + padding: 0px; + border: 1px solid #c1bc9d; } - #page-content-wrapper { padding: 0px; padding-top: 0px; @@ -32,23 +23,19 @@ body,h1,h2,h3,h4,h5,h6,p,ul,ol,dl,input,textarea { border-top: 1px solid #ccc; } .pagelayout-frontpage #page-content #region-main-box #region-post-box { - padding-top: 0; + padding-top: 0; } - a:link, a:visited { color: #003466; text-decoration: none; } - -a:hover, a:active, a:focus { +a:active, a:hover, a:focus { color: #4785ac; text-decoration: none; } - #region-main-box { border: 0px none; } - #newmessageoverlay { background: #f9f9d4; margin-left: 55px; @@ -60,9 +47,7 @@ a:hover, a:active, a:focus { -moz-opacity:0.9; -khtml-opacity: 0.9; opacity: 0.9; - } - #newmessageoverlay #newmessagelinks { border-top: 1px dashed #ccc; padding-top: 5px; @@ -82,7 +67,6 @@ a:hover, a:active, a:focus { height: 80px; border-bottom: 1px solid #fff; } - .logo { height: 50px; float: left; @@ -90,12 +74,10 @@ a:hover, a:active, a:focus { padding-top: 18px; padding-right: 0px; } - .headermain { font-weight:normal; margin:.8em 0.5em 0.75em; } - h1.headermain { color: #006699; font-weight: normal; @@ -110,23 +92,23 @@ h1.headerwlogo { display: block; float: left; margin-top: 35px; - } - .tagline { color: #006699 !important; padding-top: 7px; font-size: .45em; text-transform: uppercase; } - .headermenu { font-size: .9em; } - -p.helplink { - text-align: center; +p.helplink a { + display: block; + width: 25%; + margin: 0 auto; + padding: 10px; } + /* @end */ /* @group Navbar */ @@ -139,25 +121,21 @@ p.helplink { margin-left: 4px; margin-right: 4px; } - .breadcrumb { text-transform: uppercase; font-weight: bold; font-size: .9em; margin-left: 7px; } - .breadcrumb a { color: #336699 !important; } - .breadcrumb ul { color: #666; } .arrow, .arrow_button input { color: #aaa; } - /* @end */ /* @group Blocks */ @@ -165,41 +143,34 @@ p.helplink { .block_action { padding:0px; } - .block .content { background:#c7eafd; border:1px solid #867f6a; } - .block .minicalendar td, .block .minicalendar th { border: none; } - .block { border: 0px none; } - .block .header { border: 1px solid #ccc; background: #fff; padding-left:5px; } - .block .title h2 { text-transform: uppercase; padding-bottom: 0px; color: #336699; font-size: .95em; } - .block .content { background: #fff; border: 1px solid #ccc; padding: 10px; margin-top: -2px; } - .block_calendar_month table.minicalendar.calendartable td,.block_calendar_month table.minicalendar.calendartable th { border: none !important; } @@ -216,7 +187,6 @@ p.helplink { font-size: 1.8em; font-weight: normal; } - .completionprogress { color: #336699; text-transform: uppercase; @@ -227,22 +197,18 @@ p.helplink { border: 1px solid #ccc; margin-right: 20px; } - .path-course-view li.activity { border-bottom: 1px dashed #c3daf9; padding-top: 10px; padding-bottom: 5px; } - /* @end */ /* @group Dock */ body.has_dock { - margin:0; + margin: 0; } - - #dock { border-right: 0px none; background: url([[pix:theme|dock]]) repeat-y top right #fff; @@ -251,48 +217,42 @@ body.has_dock { bottom:auto; background-color:#5ea4dc; } - - #dock .dockeditem { background: url([[pix:theme|dock]]) repeat-y top right #fff; padding:2px; padding-right:0px; } - #dock .dockedtitle { border-width:0; } - #dock .dockedtitle h2 { margin:0; padding:10px 3px; } - #dock .dockedtitle.activeitem { background-color:#407ea8; border-top: 1px solid #6f6856; } - #dockeditempanel { background-color:#5ea4dc; margin-left:0px; border-left: none; } - #dockeditempanel .dockeditempanel_content { border-color:#6f6856; border-left: none; } - #dockeditempanel .dockeditempanel_hd { background: #407ea8; border-width:0; } - #dockeditempanel .dockeditempanel_hd h2 { font-size:1em; color:#fff; } +#dockeditempanel .dockeditempanel_bd .block_navigation .block_tree li { + overflow:visible; +} /* @end */ @@ -303,7 +263,6 @@ body.has_dock { margin: 0; padding: 0; } - #page-footer-inner{ padding: 20px 0 30px; clear: both; @@ -314,28 +273,26 @@ body.has_dock { height: 75px; text-align: left; } - #page-footer .footnote { float: left; padding-top: 80px; padding-left: 20px; } - #page-footer .logininfo { padding-top: 80px; text-align: right; } - +.purgecaches { + padding-bottom: 10px; +} .purgecaches a { text-decoration: none; padding: 0 1em; } - .purgecaches a:link, .purgecaches a:hover { border-style: solid; } - .purgecaches a:link { border-width: 1px 2px 2px 1px; border-color: #CECECE #8A8A8A #8A8A8A #CECECE; @@ -344,7 +301,6 @@ body.has_dock { border-width: 2px 1px 1px 2px; border-color: #8A8A8A #CECECE #CECECE #8A8A8A; } - /* @end */ /* @group Forums */ @@ -369,5 +325,4 @@ body.has_dock { background: #FFF; padding:4px; } - -/* @end */ \ No newline at end of file +/* @end */ diff --git a/theme/sky_high/style/pagelayout.css b/theme/sky_high/style/pagelayout.css index 28a68f9b2f937..d243e8ef2f4d1 100644 --- a/theme/sky_high/style/pagelayout.css +++ b/theme/sky_high/style/pagelayout.css @@ -12,7 +12,6 @@ body { #page { width:100%; max-width: 1600px; - overflow:hidden; margin:0 auto; } diff --git a/theme/sky_high/style/report.css b/theme/sky_high/style/report.css index 570bb96a74c0d..a9bdbb3d78481 100644 --- a/theme/sky_high/style/report.css +++ b/theme/sky_high/style/report.css @@ -1,128 +1,138 @@ /** Report layout **/ -body.pagelayout-report { - background-image: none; - background-color: #fff; -} - -body.pagelayout-report.has_dock { - margin-left: 30px; -} -.pagelayout-report #page { +#report-wrapper { + background: #fff; + margin: 20px 2% 0; + padding: 0px; + border: 1px solid #c1bc9d; +} +#report-page-content { + clear: both; + float: left; + overflow: hidden; + position: relative; width: 100%; - margin: 0 auto; +} +#report-page-content #report-region-main-box { + float: left; + right: 0%; position: relative; + width: 100%; } -.pagelayout-report #page-header, -.pagelayout-report #page-footer { - float: none; - background: #f3f3f3 none; +#report-page-content #report-region-main-box #report-region-post-box { + float: left; + right: 82%; + position: relative; width: 100%; - margin: 0; - padding: 0; - text-align: left; } -.pagelayout-report #page-header { - background:#97d3f4 url([[pix:theme|header]]) no-repeat top right; - margin-bottom: 0px; - height: 105px; - border-bottom: 1px solid #FFF; +#report-page-content #report-region-main-box + #report-region-post-box #report-region-main { + float: left; + overflow: hidden; + position: relative; + margin-right: 0px; + left: 101%; + width: 80%; } - -.pagelayout-report #page-header #custommenu { - display: none; +#report-page-content #report-region-main-box + #report-region-post-box #report-region-pre { + float: left; + overflow: hidden; + position: relative; + left: 3%; + width: 16%; } -.pagelayout-report .navbar { - background-color: #FFF; - height: 20px; - margin: 0; - padding: 5px 0; +#report-page-content #report-region-main-box + #report-region-post-box #report-region-main .region-content { + overflow: hidden; + padding: 20px 0px; } - -.pagelayout-report #page-footer { - text-align: center; - height: auto; +#report-page-content #report-region-main-box + #report-region-post-box #report-region-pre .region-content { + overflow: hidden; + padding: 20px 0 0; } -.pagelayout-report #page-footer .logininfo, -.pagelayout-report #page-footer .homelink { - margin: 1em 0 0; - padding: 0; - text-align: center; -} - -.pagelayout-report #page-content { - background: #FFF url([[pix:theme|top_bg]]) repeat-x center top; - float: none; - overflow: visible; - width: auto; - padding-top: 1em; -} -.pagelayout-report #report-main-content { - float: left; +#report-page-content-wrapper .generaltable { width: 100%; } -.pagelayout-report #report-main-content .region-content { - margin-left: 210px; - overflow: visible; - padding-bottom: 20px; -} -.pagelayout-report #report-main-content .region-content table.generaltable { - background-color: #FFF; - width: 98%; - margin: 0 auto; - padding: 0; + +/* REPORT FOOTER +-------------------------*/ + +.pagelayout-admin #page-footer-inner, +.pagelayout-report #page-footer-inner { + margin: 0 2%; } -.pagelayout-report #report-region-wrap { - width: 0; - float: right; - position: relative; - left: -100%; + +/* REPORT DOCK +-------------------------*/ +body.pagelayout-report.has_dock { + margin-left: 3% } -.pagelayout-report #report-region-pre { - width: 200px; - margin-left: 5px; +.pagelayout-report #dock { + width: 3%; } -/** CONTENT ONLY **/ -.pagelayout-report.content-only #report-main-content .region-content { - margin-left: 10px; -} -.pagelayout-report.content-only #report-region-pre { - width: 0; + +/* CONTENT-ONLY +-------------------------*/ + .pagelayout-admin.content-only #report-page-content-wrapper + #report-page-content #report-region-main-box #report-region-post-box, + .pagelayout-report.content-only #report-page-content-wrapper + #report-page-content #report-region-main-box #report-region-post-box { + right: 1%; + width: 100%; +} + .pagelayout-admin.content-only #report-page-content-wrapper + #report-page-content #report-region-main-box #report-region-post-box #report-region-main, + .pagelayout-report.content-only #report-page-content-wrapper + #report-page-content #report-region-main-box #report-region-post-box #report-region-main { + left: 1%; + width: 100%; +} + .pagelayout-admin.content-only #report-page-content-wrapper #report-page-content + #report-region-main-box #report-region-post-box #report-region-pre, + .pagelayout-report.content-only #report-page-content-wrapper #report-page-content + #report-region-main-box #report-region-post-box #report-region-pre { + left: 0; + width: 0; +} + .pagelayout-admin.content-only #report-page-content-wrapper + #report-page-content #report-region-main-box #report-region-post-box + #report-region-main .region-content, + .pagelayout-report.content-only #report-page-content-wrapper + #report-page-content #report-region-main-box #report-region-post-box + #report-region-main .region-content { + padding: 0 1%; } -/** Correct for right to left languages **/ -.dir-rtl.pagelayout-report #report-main-content .region-content { - margin-left: 0; - margin-right: 210px; +/* @pagelayout-report - overflow */ +.pagelayout-admin #report-page-content #report-region-main, +.pagelayout-report #report-page-content #report-region-main { + overflow: auto; } -.dir-rtl.pagelayout-report #report-region-wrap { - left:0; +.pagelayout-admin #report-page-content #report-region-main .region-content, +.pagelayout-report #report-page-content #report-region-main .region-content { + overflow: visible; } -/** Stabalise IE6 behaviour on the report layout **/ -.ie6.pagelayout-report #report-main-content { - float: none; - width: auto; -} -.ie6.pagelayout-report #report-region-wrap { - float: none; - width: 200px; - left: auto; - position: absolute; - top: 0; -} -.ie6.pagelayout-report #report-region-pre, -.ie6.pagelayout-report #report-region-pre .block { - width: 100%; -} +/* @pagelayout-report - horizontal overflow */ +.pagelayout-admin #report-page-content-wrapper #report-page-content #report-region-main-box + #report-region-post-box #report-region-main .region-content .no-overflow, +.pagelayout-report #report-page-content-wrapper #report-page-content #report-region-main-box + #report-region-post-box #report-region-main .region-content .no-overflow { + overflow: auto; + } @media print { - .pagelayout-report .region-content {margin-left: 0px !important;} - .pagelayout-report #report-region-pre {width: 0px !important;} - .pagelayout-report .region-content table.generaltable {font-size:70% !important;} - .pagelayout-report #report-region-pre, - .pagelayout-report #page-header, - .pagelayout-report #page-footer, - .pagelayout-report #dock { display: none;} -} + #report-page-content #report-region-main-box {right: 0%;} + #report-page-content #report-region-main-box #report-region-post-box {right: 100%;} + #report-page-content #report-region-main-box #report-region-post-box #report-region-main {left: 101%; width: 98%;} + #report-page-content #report-region-main-box #report-region-post-box #report-region-pre {width: 0%; left: 0%} + + #report-page-content-wrapper table.generaltable { font-size: 70% !important;} + + #page-header, + #page-footer, + #dock { display: none;} +} \ No newline at end of file diff --git a/theme/splash/config.php b/theme/splash/config.php index 6601892a163b4..41ba3bcd107c3 100644 --- a/theme/splash/config.php +++ b/theme/splash/config.php @@ -1,5 +1,4 @@ name = 'splash'; -//////////////////////////////////////////////////// -// Name of the theme. -//////////////////////////////////////////////////// - - $THEME->parents = array( 'canvas', 'base', ); -///////////////////////////////////////////////////// -// List exsisting theme(s) to use as parents. -//////////////////////////////////////////////////// - - $THEME->sheets = array( - 'sl', + 'pagelayout', + 'core', + 'menus', + 'red', 'green', 'blue', 'orange', - 'ie', + 'settings', ); -//////////////////////////////////////////////////// -// Name of the stylesheet(s) you are including in -// this new theme's /styles/ directory. -//////////////////////////////////////////////////// +$THEME->editor_sheets = array('editor'); $THEME->enable_dock = true; -//////////////////////////////////////////////////// -// Do you want to use the new navigation dock? -//////////////////////////////////////////////////// - - $THEME->layouts = array( // Most pages - if we encounter an unknown or a missing page type, this one is used. 'base' => array( @@ -126,7 +110,6 @@ ), // Embeded pages, like iframe embeded in moodleform 'embedded' => array( - 'theme' => 'canvas', 'file' => 'embedded.php', 'regions' => array(), 'options' => array('nofooter'=>true, 'nonavbar'=>true), @@ -145,6 +128,12 @@ 'regions' => array(), 'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true), ), + // The pagelayout used when a redirection is occuring. + 'redirect' => array( + 'file' => 'embedded.php', + 'regions' => array(), + 'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true), + ), 'report' => array( 'file' => 'report.php', 'regions' => array('side-pre'), @@ -152,19 +141,4 @@ ), ); - -/////////////////////////////////////////////////////////////// -// These are all of the possible layouts in Moodle. -/////////////////////////////////////////////////////////////// - - $THEME->csspostprocess = 'splash_process_css'; - - - -/////////////////////////////////////////////////////////////// -// Splash Theme Specific settings for Administrators to customise -// css. -/////////////////////////////////////////////////////////////// - -$THEME->editor_sheets = array('editor'); \ No newline at end of file diff --git a/theme/splash/lang/en/theme_splash.php b/theme/splash/lang/en/theme_splash.php index 36c02ecc8e0f9..bb3412dc8f1a9 100644 --- a/theme/splash/lang/en/theme_splash.php +++ b/theme/splash/lang/en/theme_splash.php @@ -1,5 +1,4 @@

        About

        Splash is a fluid-width, three-column theme for Moodle 2.0.

        Tweaks

        This theme is built upon both Base and Canvas, two parent themes included in the Moodle core. If you want to modify this theme, we recommend that you first duplicate it then rename it before making your changes. This will prevent your customized theme from being overwritten by future Moodle upgrades, and you\'ll still have the original files if you make a mess. More information on modifying themes can be found in the MoodleDocs.

        Credits

        This theme was coded and is maintained by Caroline Kennedy of Synergy Learning. She can be contacted by email at caroline.kennedy@synergy-learningw.com.

        License

        This, and all other themes included in the Moodle core, are licensed under the GNU General Public License.

        '; +$string['choosereadme'] = '

        About

        Splash is a fluid-width, three-column theme for Moodle 2.0.

        Tweaks

        This theme is built upon both Base and Canvas, two parent themes included in the Moodle core. If you want to modify this theme, we recommend that you first duplicate it then rename it before making your changes. This will prevent your customized theme from being overwritten by future Moodle upgrades, and you\'ll still have the original files if you make a mess. More information on modifying themes can be found in the MoodleDocs.

        Credits

        This theme was coded and is maintained by Caroline Kennedy of Synergy Learning. She can be contacted by email at caroline.kennedy@synergy-learningw.com.

        License

        This, and all other themes included in the Moodle core, are licensed under the GNU General Public License.

        '; $string['configtitle'] = 'Splash Theme settings'; $string['customcss'] = 'Custom CSS'; $string['customcssdesc'] = 'Any CSS you enter here will be added to every page allowing your to easily customise this theme.'; diff --git a/theme/splash/layout/embedded.php b/theme/splash/layout/embedded.php new file mode 100644 index 0000000000000..1c62999c9b54e --- /dev/null +++ b/theme/splash/layout/embedded.php @@ -0,0 +1,48 @@ +. + +/** + * General layout for the splash theme + * + * @package theme_splash + * @copyright 2012 Caroline Kennedy - Synergy Learning + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +echo $OUTPUT->doctype() ?> +htmlattributes() ?>> + + <?php echo $PAGE->title ?> + + standard_head_html() ?> + + +standard_top_of_body_html() ?> + +
        + + + +
        + main_content() ?> +
        + + + +
        +standard_end_of_body_html() ?> + + diff --git a/theme/splash/layout/general.php b/theme/splash/layout/general.php index 47a457f444e6c..4763983db91d8 100644 --- a/theme/splash/layout/general.php +++ b/theme/splash/layout/general.php @@ -1,4 +1,26 @@ . + +/** + * General layout for the splash theme + * + * @package theme_splash + * @copyright 2012 Caroline Kennedy - Synergy Learning + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ $hasheading = ($PAGE->heading); $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); @@ -41,74 +63,101 @@ standard_head_html() ?> - standard_top_of_body_html() ?> -
        - - - +
        @@ -147,10 +198,12 @@ @@ -131,10 +186,12 @@