PageRenderTime 27ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/src/administrator/components/com_contenthistory/views/history/tmpl/modal.php

https://bitbucket.org/ke2083/transfans.co.uk-website
PHP | 191 lines | 169 code | 12 blank | 10 comment | 17 complexity | 94bd6a81b57167258fa403db7f2cc91d MD5 | raw file
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_contenthistory
  5. *
  6. * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. defined('_JEXEC') or die;
  10. JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
  11. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
  12. JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
  13. JHtml::_('behavior.multiselect');
  14. JHtml::_('jquery.framework');
  15. $input = JFactory::getApplication()->input;
  16. $field = $input->getCmd('field');
  17. $function = 'jSelectContenthistory_' . $field;
  18. $listOrder = $this->escape($this->state->get('list.ordering'));
  19. $listDirn = $this->escape($this->state->get('list.direction'));
  20. $message = JText::_('COM_CONTENTHISTORY_BUTTON_SELECT_ONE', true);
  21. $compareMessage = JText::_('COM_CONTENTHISTORY_BUTTON_SELECT_TWO', true);
  22. JText::script('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
  23. $deleteMessage = "alert(Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'));";
  24. $aliasArray = explode('.', $this->state->type_alias);
  25. $option = (end($aliasArray) == 'category') ? 'com_categories&amp;extension=' . implode('.', array_slice($aliasArray, 0, count($aliasArray) - 1)) : $aliasArray[0];
  26. $filter = JFilterInput::getInstance();
  27. $task = $filter->clean(end($aliasArray)) . '.loadhistory';
  28. $loadUrl = JRoute::_('index.php?option=' . $filter->clean($option) . '&amp;task=' . $task);
  29. $deleteUrl = JRoute::_('index.php?option=com_contenthistory&task=history.delete');
  30. $hash = $this->state->get('sha1_hash');
  31. $formUrl = 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id=' . $this->state->get('item_id') . '&type_id='
  32. . $this->state->get('type_id') . '&type_alias=' . $this->state->get('type_alias') . '&' . JSession::getFormToken() . '=1';
  33. JFactory::getDocument()->addScriptDeclaration("
  34. (function ($){
  35. $(document).ready(function (){
  36. $('#toolbar-load').click(function() {
  37. var ids = $('input[id*=\'cb\']:checked');
  38. if (ids.length == 1) {
  39. // Add version item id to URL
  40. var url = $('#toolbar-load').attr('data-url') + '&version_id=' + ids[0].value;
  41. $('#content-url').attr('data-url', url);
  42. if (window.parent) {
  43. window.parent.location = url;
  44. }
  45. } else {
  46. alert('" . $message . "');
  47. }
  48. });
  49. $('#toolbar-preview').click(function() {
  50. var windowSizeArray = ['width=800, height=600, resizable=yes, scrollbars=yes'];
  51. var ids = $('input[id*=\'cb\']:checked');
  52. if (ids.length == 1) {
  53. // Add version item id to URL
  54. var url = $('#toolbar-preview').attr('data-url') + '&version_id=' + ids[0].value;
  55. $('#content-url').attr('data-url', url);
  56. if (window.parent) {
  57. window.open(url, '', windowSizeArray);
  58. return false;
  59. }
  60. } else {
  61. alert('" . $message . "');
  62. }
  63. });
  64. $('#toolbar-compare').click(function() {
  65. var windowSizeArray = ['width=1000, height=600, resizable=yes, scrollbars=yes'];
  66. var ids = $('input[id*=\'cb\']:checked');
  67. if (ids.length == 2) {
  68. // Add version item ids to URL
  69. var url = $('#toolbar-compare').attr('data-url') + '&id1=' + ids[0].value + '&id2=' + ids[1].value;
  70. $('#content-url').attr('data-url', url);
  71. if (window.parent) {
  72. window.open(url, '', windowSizeArray);
  73. return false;
  74. }
  75. } else {
  76. alert('" . $compareMessage . "');
  77. }
  78. });
  79. });
  80. })(jQuery);
  81. "
  82. );
  83. ?>
  84. <div class="container-popup">
  85. <div class="btn-group pull-right">
  86. <button id="toolbar-load" type="submit" class="btn hasTooltip" aria-label="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_LOAD_DESC'); ?>" title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_LOAD_DESC'); ?>" data-url="<?php echo JRoute::_($loadUrl); ?>">
  87. <span class="icon-upload" aria-hidden="true"></span><span class="hidden-phone"><?php echo JText::_('COM_CONTENTHISTORY_BUTTON_LOAD'); ?></span></button>
  88. <button id="toolbar-preview" type="button" class="btn hasTooltip" aria-label="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_PREVIEW_DESC'); ?>" title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_PREVIEW_DESC'); ?>" data-url="<?php echo JRoute::_('index.php?option=com_contenthistory&view=preview&layout=preview&tmpl=component&' . JSession::getFormToken() . '=1'); ?>">
  89. <span class="icon-search" aria-hidden="true"></span><span class="hidden-phone"><?php echo JText::_('COM_CONTENTHISTORY_BUTTON_PREVIEW'); ?></span></button>
  90. <button id="toolbar-compare" type="button" class="btn hasTooltip" aria-label="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_COMPARE_DESC'); ?>" title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_COMPARE_DESC'); ?>" data-url="<?php echo JRoute::_('index.php?option=com_contenthistory&view=compare&layout=compare&tmpl=component&' . JSession::getFormToken() . '=1'); ?>">
  91. <span class="icon-zoom-in" aria-hidden="true"></span><span class="hidden-phone"><?php echo JText::_('COM_CONTENTHISTORY_BUTTON_COMPARE'); ?></span></button>
  92. <button onclick="if (document.adminForm.boxchecked.value==0){<?php echo $deleteMessage; ?>}else{ Joomla.submitbutton('history.keep')}" class="btn pointer hasTooltip" aria-label="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_KEEP_DESC'); ?>" title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_KEEP_DESC'); ?>">
  93. <span class="icon-lock" aria-hidden="true"></span><span class="hidden-phone"><?php echo JText::_('COM_CONTENTHISTORY_BUTTON_KEEP'); ?></span></button>
  94. <button onclick="if (document.adminForm.boxchecked.value==0){<?php echo $deleteMessage; ?>}else{ Joomla.submitbutton('history.delete')}" class="btn pointer hasTooltip" aria-label="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_DELETE_DESC'); ?>" title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_DELETE_DESC'); ?>">
  95. <span class="icon-delete" aria-hidden="true"></span><span class="hidden-phone"><?php echo JText::_('COM_CONTENTHISTORY_BUTTON_DELETE'); ?></span></button>
  96. </div>
  97. <div class="clearfix"></div>
  98. <hr class="hr-condensed" />
  99. <form action="<?php echo JRoute::_($formUrl); ?>" method="post" name="adminForm" id="adminForm">
  100. <table class="table table-striped table-condensed">
  101. <thead>
  102. <tr>
  103. <th width="1%" class="center">
  104. <input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
  105. </th>
  106. <th width="15%">
  107. <?php echo JText::_('JDATE'); ?>
  108. </th>
  109. <th width="15%" class="nowrap hidden-phone">
  110. <?php echo JText::_('COM_CONTENTHISTORY_VERSION_NOTE'); ?>
  111. </th>
  112. <th width="10%" class="nowrap">
  113. <?php echo JText::_('COM_CONTENTHISTORY_KEEP_VERSION'); ?>
  114. </th>
  115. <th width="15%" class="nowrap hidden-phone">
  116. <?php echo JText::_('JAUTHOR'); ?>
  117. </th>
  118. <th width="10%" class="nowrap center">
  119. <?php echo JText::_('COM_CONTENTHISTORY_CHARACTER_COUNT'); ?>
  120. </th>
  121. </tr>
  122. </thead>
  123. <tfoot>
  124. <tr>
  125. <td colspan="15">
  126. <?php echo $this->pagination->getListFooter(); ?>
  127. </td>
  128. </tr>
  129. </tfoot>
  130. <tbody>
  131. <?php $i = 0; ?>
  132. <?php foreach ($this->items as $item) : ?>
  133. <tr class="row<?php echo $i % 2; ?>">
  134. <td class="center">
  135. <?php echo JHtml::_('grid.id', $i, $item->version_id); ?>
  136. </td>
  137. <td>
  138. <a class="save-date" onclick="window.open(this.href,'win2','width=800,height=600,resizable=yes,scrollbars=yes'); return false;"
  139. href="<?php echo JRoute::_('index.php?option=com_contenthistory&view=preview&layout=preview&tmpl=component&' . JSession::getFormToken() . '=1&version_id=' . $item->version_id); ?>">
  140. <?php echo JHtml::_('date', $item->save_date, JText::_('DATE_FORMAT_LC6')); ?>
  141. </a>
  142. <?php if ($item->sha1_hash == $hash) : ?>
  143. <span class="icon-featured" aria-hidden="true"><span class="element-invisible"><?php echo JText::_('JFEATURED'); ?></span></span>&nbsp;
  144. <?php endif; ?>
  145. </td>
  146. <td class="hidden-phone">
  147. <?php echo htmlspecialchars($item->version_note); ?>
  148. </td>
  149. <td>
  150. <?php if ($item->keep_forever) : ?>
  151. <a class="btn btn-mini active" rel="tooltip" href="javascript:void(0);"
  152. onclick="return listItemTask('cb<?php echo $i; ?>','history.keep')"
  153. data-original-title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_KEEP_TOGGLE_OFF'); ?>">
  154. <?php echo JText::_('JYES'); ?>&nbsp;<span class="icon-lock" aria-hidden="true"></span>
  155. </a>
  156. <?php else : ?>
  157. <a class="btn btn-mini active" rel="tooltip" href="javascript:void(0);"
  158. onclick="return listItemTask('cb<?php echo $i; ?>','history.keep')"
  159. data-original-title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_KEEP_TOGGLE_ON'); ?>">
  160. <?php echo JText::_('JNO'); ?>
  161. </a>
  162. <?php endif; ?>
  163. </td>
  164. <td class="hidden-phone">
  165. <?php echo htmlspecialchars($item->editor); ?>
  166. </td>
  167. <td class="center">
  168. <?php echo number_format((int) $item->character_count, 0, JText::_('DECIMALS_SEPARATOR'), JText::_('THOUSANDS_SEPARATOR')); ?>
  169. </td>
  170. </tr>
  171. <?php $i++; ?>
  172. <?php endforeach; ?>
  173. </tbody>
  174. </table>
  175. <input type="hidden" name="task" value="" />
  176. <input type="hidden" name="boxchecked" value="0" />
  177. <?php echo JHtml::_('form.token'); ?>
  178. </form>
  179. </div>