Skip to content

Commit 68b58f3

Browse files
dgrammatikophproberto
authored andcommitted
[imp] reduce uneeded calls for mootools. Fixes #4888
miss that UT UT UT again UT One more time Introduce new function formvalidator -Deprecate formvalidation and introduce formvalidator -Copy the layouts standard and confirm to isis and load jQuery instead of mootools add a deprecated msg to the log CS Changes UT
1 parent 618a178 commit 68b58f3

File tree

15 files changed

+61
-26
lines changed

15 files changed

+61
-26
lines changed

administrator/components/com_users/views/mail/tmpl/default.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
$script .= "\t\t".'}'."\n";
2828
$script .= "\t\t".'}'."\n";
2929

30+
JHtml::_('behavior.core');
3031
JHtml::_('formbehavior.chosen', 'select');
3132

3233
JFactory::getDocument()->addScriptDeclaration($script);

layouts/joomla/toolbar/batch.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
defined('_JEXEC') or die;
1111

12+
JHtml::_('behavior.core');
13+
1214
$title = $displayData['title'];
1315
$message = JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
1416
?>

layouts/joomla/toolbar/confirm.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
defined('_JEXEC') or die;
1111

12+
JHtml::_('behavior.core');
13+
1214
$doTask = $displayData['doTask'];
1315
$class = $displayData['class'];
1416
$text = $displayData['text'];

layouts/joomla/toolbar/help.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
defined('_JEXEC') or die;
1111

12+
JHtml::_('behavior.core');
13+
1214
$doTask = $displayData['doTask'];
1315
$text = $displayData['text'];
1416

layouts/joomla/toolbar/popup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
defined('_JEXEC') or die;
1111

12+
JHtml::_('behavior.core');
13+
1214
$doTask = $displayData['doTask'];
1315
$class = $displayData['class'];
1416
$text = $displayData['text'];

layouts/joomla/toolbar/slider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
defined('_JEXEC') or die;
1111

12+
JHtml::_('behavior.core');
13+
1214
$doTask = $displayData['doTask'];
1315
$class = $displayData['class'];
1416
$text = $displayData['text'];

layouts/joomla/toolbar/standard.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
defined('_JEXEC') or die;
1111

12+
JHtml::_('behavior.core');
13+
1214
$doTask = $displayData['doTask'];
1315
$class = $displayData['class'];
1416
$text = $displayData['text'];

layouts/joomla/toolbar/versions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
*/
99

1010
defined('_JEXEC') or die;
11+
12+
JHtml::_('behavior.framework');
13+
1114
?>
1215
<a rel="{handler: 'iframe', size: {x: <?php echo $displayData['height']; ?>, y: <?php echo $displayData['width']; ?>}}"
1316
href="index.php?option=com_contenthistory&amp;view=history&amp;layout=modal&amp;tmpl=component&amp;item_id=<?php echo (int) $displayData['itemId']; ?>&amp;type_id=<?php echo $displayData['typeId']; ?>&amp;type_alias=<?php echo $displayData['typeAlias']; ?>&amp;<?php echo JSession::getFormToken(); ?>=1"

libraries/cms/html/behavior.php

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ public static function caption($selector = 'img.caption')
136136
* @return void
137137
*
138138
* @since 1.5
139+
*
140+
* @Deprecated 3.4 Use formvalidator instead
139141
*/
140142
public static function formvalidation()
141143
{
144+
JLog::add('The use of formvalidation is deprecated use formvalidator instead.', JLog::WARNING, 'deprecated');
145+
142146
// Only load once
143147
if (isset(static::$loaded[__METHOD__]))
144148
{
@@ -148,8 +152,32 @@ public static function formvalidation()
148152
// Include MooTools framework
149153
static::framework();
150154

151-
// Include jQuery Framework
152-
JHtml::_('jquery.framework');
155+
// Load the new jQuery code
156+
static::formvalidator();
157+
}
158+
159+
/**
160+
* Add unobtrusive JavaScript support for form validation.
161+
*
162+
* To enable form validation the form tag must have class="form-validate".
163+
* Each field that needs to be validated needs to have class="validate".
164+
* Additional handlers can be added to the handler for username, password,
165+
* numeric and email. To use these add class="validate-email" and so on.
166+
*
167+
* @return void
168+
*
169+
* @since 3.4
170+
*/
171+
public static function formvalidator()
172+
{
173+
// Only load once
174+
if (isset(static::$loaded[__METHOD__]))
175+
{
176+
return;
177+
}
178+
179+
// Include core
180+
static::core();
153181

154182
// Add validate.js language strings
155183
JText::script('JLIB_FORM_FIELD_INVALID');
@@ -209,10 +237,10 @@ public static function combobox()
209237
{
210238
return;
211239
}
212-
// Include MooTools framework
213-
static::framework();
240+
// Include core
241+
static::core();
214242

215-
JHtml::_('script', 'system/combobox.js', true, true);
243+
JHtml::_('script', 'system/combobox.js', false, true);
216244
static::$loaded[__METHOD__] = true;
217245
}
218246

@@ -400,14 +428,14 @@ public static function multiselect($id = 'adminForm')
400428
}
401429

402430
// Include jQuery
403-
JHtml::_('jquery.framework');
431+
static::core();
404432

405-
JHtml::_('script', 'system/multiselect.js', true, true);
433+
JHtml::_('script', 'system/multiselect.js', false, true);
406434

407435
// Attach multiselect to document
408436
JFactory::getDocument()->addScriptDeclaration(
409-
"window.addEvent('domready', function() {
410-
new Joomla.JMultiSelect('" . $id . "');
437+
"jQuery(document).ready(function() {
438+
Joomla.JMultiSelect('" . $id . "');
411439
});"
412440
);
413441

@@ -649,9 +677,9 @@ public static function highlighter(array $terms, $start = 'highlighter-start', $
649677
}
650678

651679
// Include jQuery
652-
JHtml::_('jquery.framework');
680+
static::core();
653681

654-
JHtml::_('script', 'system/highlighter.js', true, true);
682+
JHtml::_('script', 'system/highlighter.js', false, true);
655683

656684
$terms = str_replace('"', '\"', $terms);
657685

@@ -695,11 +723,8 @@ public static function noframes()
695723
return;
696724
}
697725

698-
// Include MooTools framework
699-
static::framework();
700-
701726
// Include jQuery
702-
JHtml::_('jquery.framework');
727+
static::core();
703728

704729
$js = "jQuery(function () {if (top == self) {document.documentElement.style.display = 'block'; }" .
705730
" else {top.location = self.location; }});";

libraries/cms/toolbar/button/confirm.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public function fetchId($type = 'Confirm', $msg = '', $name = '', $text = '', $t
8787
*/
8888
protected function _getCommand($msg, $name, $task, $list)
8989
{
90-
JHtml::_('behavior.framework');
9190
$message = JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
9291
$message = addslashes($message);
9392

0 commit comments

Comments
 (0)