Skip to content

Commit

Permalink
Merge pull request #8173 from dgt41/____redoMessagesModal
Browse files Browse the repository at this point in the history
Redo of #4563
  • Loading branch information
rdeutz committed Oct 27, 2015
2 parents 06be0a2 + 2de7089 commit 88ab251
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 76 deletions.
56 changes: 12 additions & 44 deletions administrator/components/com_messages/views/config/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,27 @@

JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.modal');

JFactory::getDocument()->addScriptDeclaration("
JFactory::getDocument()->addScriptDeclaration(
"
Joomla.submitbutton = function(task)
{
if (task == 'config.cancel' || document.formvalidator.isValid(document.getElementById('config-form')))
{
Joomla.submitform(task, document.getElementById('config-form'));
}
};
");
"
);
?>
<form action="<?php echo JRoute::_('index.php?option=com_messages'); ?>" method="post" name="adminForm" id="message-form" class="form-validate form-horizontal">
<form action="<?php echo JRoute::_('index.php?option=com_messages&view=config'); ?>" method="post" name="adminForm" id="message-form" class="form-validate form-horizontal">
<fieldset>
<div>
<div class="modal-header">
<h3><?php echo JText::_('COM_MESSAGES_MY_SETTINGS');?></h3>
</div>
<div class="modal-body">
<button class="btn btn-primary" type="submit" onclick="Joomla.submitform('config.save', this.form);window.top.setTimeout('window.parent.jModalClose()', 700);">
<?php echo JText::_('JSAVE');?></button>
<button class="btn" type="button" onclick="window.parent.jModalClose();">
<?php echo JText::_('JCANCEL');?></button>
<hr />
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('lock'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('lock'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('mail_on_new'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('mail_on_new'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('auto_purge'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('auto_purge'); ?>
</div>
</div>

</div>
</div>
</fieldset>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
<?php echo $this->form->renderField('lock'); ?>
<?php echo $this->form->renderField('mail_on_new'); ?>
<?php echo $this->form->renderField('auto_purge'); ?>
</fieldset>
<button id="saveBtn" type="button" class="hidden" onclick="Joomla.submitform('config.save', this.form);"></button>

<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/

defined('_JEXEC') or die;
JHtml::_('behavior.framework');

JHtml::_('behavior.core');
JHtml::_('formbehavior.chosen', 'select');
?>
<form action="<?php echo JRoute::_('index.php?option=com_messages'); ?>" method="post" name="adminForm" id="adminForm" class="form-horizontal">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,44 @@
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>

JFactory::getDocument()->addStyleDeclaration(
"
@media (min-width: 768px) {
div.modal {
left: none;
width: 500px;
margin-left: -250px;
}
}
"
);
?>
<form action="<?php echo JRoute::_('index.php?option=com_messages&view=messages'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_MESSAGES_SEARCH_IN_SUBJECT'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><span class="icon-search"></span></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.getElementById('filter_search').value='';this.form.submit();"><span class="icon-remove"></span></button>
</div>
<div class="btn-group pull-left hidden-phone">
<select name="filter_state" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
<?php echo JHtml::_('select.options', MessagesHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state'));?>
</select>
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_MESSAGES_SEARCH_IN_SUBJECT'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><span class="icon-search"></span></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.getElementById('filter_search').value='';this.form.submit();"><span class="icon-remove"></span></button>
</div>
<div class="btn-group pull-left hidden-phone">
<select name="filter_state" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
<?php echo JHtml::_('select.options', MessagesHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state'));?>
</select>
</div>
</div>
</div>
<div class="clearfix"> </div>
<div class="clearfix"> </div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
Expand Down Expand Up @@ -104,7 +115,6 @@
</tbody>
</table>
<?php endif; ?>

<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
Expand Down
30 changes: 20 additions & 10 deletions administrator/components/com_messages/views/messages/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

defined('_JEXEC') or die;
JHtml::_('behavior.modal');

/**
* View class for a list of messages.
Expand Down Expand Up @@ -42,7 +41,6 @@ public function display($tpl = null)
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));

return false;
}

Expand All @@ -62,7 +60,6 @@ protected function addToolbar()
{
$state = $this->get('State');
$canDo = JHelperContent::getActions('com_messages');

JToolbarHelper::title(JText::_('COM_MESSAGES_MANAGER_MESSAGES'), 'envelope inbox');

if ($canDo->get('core.create'))
Expand All @@ -78,13 +75,26 @@ protected function addToolbar()
}

JToolbarHelper::divider();
$bar = JToolbar::getInstance('toolbar');

// Instantiate a new JLayoutFile instance and render the layout
JHtml::_('behavior.modal', 'a.messagesSettings');
$layout = new JLayoutFile('toolbar.mysettings');

$bar->appendButton('Custom', $layout->render(array()), 'upload');
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton(
'Popup',
'cog',
'COM_MESSAGES_TOOLBAR_MY_SETTINGS',
'index.php?option=com_messages&amp;view=config&amp;tmpl=component',
500,
250,
0,
0,
'',
'',
'<button class="btn" type="button" data-dismiss="modal" aria-hidden="true">'
. JText::_('JCANCEL')
. '</button>'
. '<button class="btn btn-success" type="button" data-dismiss="modal" aria-hidden="true"'
. ' onclick="jQuery(\'#modal-cog iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_('JSAVE')
. '</button>'
);

if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
{
Expand Down

0 comments on commit 88ab251

Please sign in to comment.