Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions administrator/components/com_users/views/group/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');

JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
?>

<script type="text/javascript">
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'group.cancel' || document.formvalidator.isValid(document.id('group-form')))
if (task == 'group.cancel' || document.formvalidator.isValid(document.getElementById('group-form')))
{
Joomla.submitform(task, document.getElementById('group-form'));
}
}
</script>
};
");
?>

<form action="<?php echo JRoute::_('index.php?option=com_users&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="group-form" class="form-validate form-horizontal">
<fieldset>
Expand Down
65 changes: 37 additions & 28 deletions administrator/components/com_users/views/groups/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,57 @@
$sortFields = $this->getSortFields();

JText::script('COM_USERS_GROUPS_CONFIRM_DELETE');
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)

$groupsWithUsers = array();

foreach ($this->items as $i => $item)
{
if ($item->user_count > 0)
{
if (task == 'groups.delete')
{
var f = document.adminForm;
var cb='';
<?php foreach ($this->items as $i => $item):?>
<?php if ($item->user_count > 0):?>
cb = f['cb'+<?php echo $i;?>];
if (cb && cb.checked)
{
if (confirm(Joomla.JText._('COM_USERS_GROUPS_CONFIRM_DELETE')))
{
Joomla.submitform(task);
array_push($groupsWithUsers, $i);
}
}

JText::script('COM_USERS_GROUPS_CONFIRM_DELETE');

JFactory::getDocument()->addScriptDeclaration('
Joomla.submitbutton = function(task) {
if (task == "groups.delete") {
var f = document.adminForm;
var cb = "";
var groupsWithUsers = [' . implode(',', $groupsWithUsers) . '];
for (index = 0; index < groupsWithUsers.length; ++index) {
cb = f["cb" + groupsWithUsers[index]];
if (cb && cb.checked) {
if (confirm(Joomla.JText._("COM_USERS_GROUPS_CONFIRM_DELETE"))) {
Joomla.submitform(task);
}
return;
}
}
return;
}
<?php endif;?>
<?php endforeach;?>
}
Joomla.submitform(task);
}
</script>
<script type="text/javascript">
Joomla.submitform(task);
};
');

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>')
if (order != "' . $listOrder . '")
{
dirn = 'asc';
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=groups');?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
Expand Down
21 changes: 10 additions & 11 deletions administrator/components/com_users/views/level/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');

JHtml::_('behavior.formvalidation');
?>
JHtml::_('behavior.formvalidator');

<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'level.cancel' || document.formvalidator.isValid(document.id('level-form')))
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
Joomla.submitform(task, document.id('level-form'));
}
}
if (task == 'level.cancel' || document.formvalidator.isValid(document.getElementById('level-form')))
{
Joomla.submitform(task, document.getElementById('level-form'));
}
};
");
/*
window.addEvent('domready', function(){
document.id('user-groups').getElements('input').each(function(i){
Expand Down Expand Up @@ -88,8 +88,7 @@
});
});
*/
</script>

?>

<form action="<?php echo JRoute::_('index.php?option=com_users&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="level-form" class="form-validate form-horizontal">
<fieldset>
Expand Down
15 changes: 8 additions & 7 deletions administrator/components/com_users/views/levels/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,25 @@
$saveOrderingUrl = 'index.php?option=com_users&task=levels.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'levelList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
?>
<script type="text/javascript">

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>')
if (order != "' . $listOrder . '")
{
dirn = 'asc';
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=levels');?>" method="post" id="adminForm" name="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
Expand Down
21 changes: 11 additions & 10 deletions administrator/components/com_users/views/note/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@

defined('_JEXEC') or die;

JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'note.cancel' || document.formvalidator.isValid(document.id('note-form')))

JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
Joomla.submitform(task, document.getElementById('note-form'));
}
}
</script>
if (task == 'note.cancel' || document.formvalidator.isValid(document.getElementById('note-form')))
{
Joomla.submitform(task, document.getElementById('note-form'));
}
};
");
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=note&id='.(int) $this->item->id);?>" method="post" name="adminForm" id="note-form" class="form-validate form-horizontal">
<fieldset class="adminform">
<div class="control-group">
Expand Down
15 changes: 8 additions & 7 deletions administrator/components/com_users/views/notes/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,25 @@
$listDirn = $this->escape($this->state->get('list.direction'));
$canEdit = $user->authorise('core.edit', 'com_users');
$sortFields = $this->getSortFields();
?>
<script type="text/javascript">

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>')
if (order != "' . $listOrder . '")
{
dirn = 'asc';
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=notes');?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
Expand Down
50 changes: 26 additions & 24 deletions administrator/components/com_users/views/user/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,40 @@
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');

JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');

// Get the form fieldsets.
$fieldsets = $this->form->getFieldsets();
?>

<script type="text/javascript">
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'user.cancel' || document.formvalidator.isValid(document.id('user-form')))
if (task == 'user.cancel' || document.formvalidator.isValid(document.getElementById('user-form')))
{
Joomla.submitform(task, document.getElementById('user-form'));
}
}
};

Joomla.twoFactorMethodChange = function(e)
{
var selectedPane = 'com_users_twofactor_' + jQuery('#jform_twofactor_method').val();

jQuery.each(jQuery('#com_users_twofactor_forms_container>div'), function(i, el) {
if (el.id != selectedPane)
{
jQuery('#' + el.id).hide(0);
}
else
{
jQuery('#' + el.id).show(0);
}
});
}
</script>
jQuery(document).ready(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to remove this one too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this is jquery dependent ? jQuery('#jform_twofactor_method').val();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was attached to an element's event it should be done on document.ready but this is only a function declaration that is called by other elements (in this case is fired when a select box changes) so it's done when the DOM is ready.

Also this code was executed like that originally so let's keep it. We have enough problems :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Joomla.twoFactorMethodChange = function(e)
{
var selectedPane = 'com_users_twofactor_' + jQuery('#jform_twofactor_method').val();

jQuery.each(jQuery('#com_users_twofactor_forms_container>div'), function(i, el) {
if (el.id != selectedPane)
{
jQuery('#' + el.id).hide(0);
}
else
{
jQuery('#' + el.id).show(0);
}
});
}
});
");

// Get the form fieldsets.
$fieldsets = $this->form->getFieldsets();
?>

<form action="<?php echo JRoute::_('index.php?option=com_users&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="user-form" class="form-validate form-horizontal" enctype="multipart/form-data">

Expand Down
15 changes: 8 additions & 7 deletions administrator/components/com_users/views/users/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,25 @@
$listDirn = $this->escape($this->state->get('list.direction'));
$loggeduser = JFactory::getUser();
$sortFields = $this->getSortFields();
?>
<script type="text/javascript">

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>')
if (order != "' . $listOrder . '")
{
dirn = 'asc';
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=users');?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
Expand Down