Jump to content


Photo
- - - - -

Быстрый просмотр в админке ZOO

zoo быстрый просмотр рецепт

18 replies to this topic

#1 Cheren-dow

Cheren-dow
  • JBZoo User (rus)
  • User rate: 95.7
  • posts: 5060
  • topics: 31

Posted 17 March 2015 - 10:34

*
POPULAR

Прочитав вопрос от пользователя alexmixaylov, из его темы, идея показалась интересной, собственно решил выложить рецепт. Итак, что бы не боятся за обновления давайте переопределим вывод материалов и сделаем ссылку быстрого просмотра на шаблон full материала.

 

1. Создаем файл в шаблоне админки:

  1. сайт\administrator\templates\isis\html\com_zoo\item\default.php

Данных папок вы не увидите в шаблоне, поэтому их нужно тоже создать

 

2. Вставляем код:

  1. <?php
  2.  
  3. // no direct access
  4. defined('_JEXEC') or die('Restricted access');
  5.  
  6. // add js
  7. $this->app->document->addScript('assets:js/item.js');
  8. $this->app->jbassets->fancybox();
  9. ?>
  10. <script type="text/javascript">
  11. jQuery(function ($) {
  12. $('.popup-item').fancybox({
  13. overlay: {locked: false}
  14. });
  15. });
  16. </script>
  17.  
  18. <form class="items-default" action="<?php echo $this->app->link(); ?>" method="post" name="adminForm" id="adminForm"
  19. accept-charset="utf-8">
  20.  
  21. <?php echo $this->partial('menu'); ?>
  22.  
  23. <div class="box-bottom">
  24.  
  25. <?php if ($this->is_filtered || $this->pagination->total > 0) : ?>
  26.  
  27. <ul class="filter">
  28. <li class="filter-left">
  29. <input type="text" name="search" id="search" value="<?php echo $this->lists['search']; ?>"
  30. class="rounded"/>
  31. <button onclick="this.form.submit();"><?php echo JText::_('Search'); ?></button>
  32. <button
  33. onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_('Reset'); ?></button>
  34. </li>
  35. <?php if ($this->app->joomla->version->isCompatible('3.0')) : ?>
  36. <li class="filter-right">
  37. <?php echo str_replace(array('input-mini', 'size="1"'), '', $this->pagination->getLimitBox()); ?>
  38. </li>
  39. <?php endif ?>
  40. <li class="filter-right">
  41. <?php echo $this->lists['select_category']; ?>
  42. </li>
  43. <li class="filter-right">
  44. <?php echo $this->lists['select_type']; ?>
  45. </li>
  46. <li class="filter-right">
  47. <?php echo $this->lists['select_author']; ?>
  48. </li>
  49. </ul>
  50.  
  51. <?php endif;
  52.  
  53. if ($this->pagination->total > 0) : ?>
  54.  
  55. <table class="list stripe">
  56. <thead>
  57. <tr>
  58. <th class="checkbox">
  59. <input type="checkbox" class="check-all"/>
  60. </th>
  61. <th class="name" colspan="2">
  62. <?php echo $this->app->html->_('grid.sort', 'Name', 'a.name', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  63. </th>
  64. <th class="type">
  65. <?php echo $this->app->html->_('grid.sort', 'Type', 'a.type', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  66. </th>
  67. <th class="published">
  68. <?php echo $this->app->html->_('grid.sort', 'Published', 'a.state', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  69. </th>
  70. <th class="frontpage">
  71. <?php echo JText::_('Frontpage'); ?>
  72. </th>
  73. <th class="searchable">
  74. <?php echo JText::_('Searchable'); ?>
  75. </th>
  76. <th class="comments">
  77. <?php echo JText::_('Comments'); ?>
  78. </th>
  79. <th class="priority">
  80. <?php echo $this->app->html->_('grid.sort', 'Order Priority', 'a.priority', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  81. </th>
  82. <th class="access">
  83. <?php echo $this->app->html->_('grid.sort', 'Access', 'a.access', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  84. </th>
  85. <th class="author">
  86. <?php echo $this->app->html->_('grid.sort', 'Author', 'a.created_by', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  87. </th>
  88. <th class="date">
  89. <?php echo $this->app->html->_('grid.sort', 'Date', 'a.created', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  90. </th>
  91. <th class="hits">
  92. <?php echo $this->app->html->_('grid.sort', 'Hits', 'a.hits', @$this->lists['order_Dir'], @$this->lists['order']); ?>
  93. </th>
  94. </tr>
  95. </thead>
  96. <tfoot>
  97. <tr>
  98. <td colspan="13">
  99. <?php echo $this->pagination->getListFooter(); ?>
  100. </td>
  101. </tr>
  102. </tfoot>
  103. <tbody>
  104. <?php
  105. $nullDate = $this->app->database->getNullDate();
  106. for ($i = 0, $n = count($this->items); $i < $n; $i++) :
  107.  
  108. $row = $this->items[$i];
  109. $now = $this->app->date->create()->toUnix();
  110. $publish_up = $this->app->date->create($row->publish_up);
  111. $publish_down = $this->app->date->create($row->publish_down);
  112. $offset = $this->app->date->getOffset();
  113. $publish_up->setTimezone(new DateTimeZone($offset));
  114. $publish_down->setTimezone(new DateTimeZone($offset));
  115.  
  116. $img = '';
  117. $alt = '';
  118. if ($now <= $publish_up->toUnix() && $row->state == 1) {
  119. $img = 'publish_y.png';
  120. $alt = JText::_('Published');
  121. } else if (($now <= $publish_down->toUnix() || $row->publish_down == $nullDate) && $row->state == 1) {
  122. $img = 'publish_g.png';
  123. $alt = JText::_('Published');
  124. } else if ($now > $publish_down->toUnix() && $row->state == 1) {
  125. $img = 'publish_r.png';
  126. $alt = JText::_('Expired');
  127. } else if ($row->state == 0) {
  128. $img = 'publish_x.png';
  129. $alt = JText::_('Unpublished');
  130. }
  131.  
  132. if ($row->searchable == 0) {
  133. $search_img = 'publish_x.png';
  134. $search_alt = JText::_('None searchable');
  135. } elseif ($row->searchable == 1) {
  136. $search_img = 'tick.png';
  137. $search_alt = JText::_('Searchable');
  138. }
  139.  
  140. if ($row->frontpage) {
  141. $frontpage_img = 'tick.png';
  142. $frontpage_alt = JText::_('JYES');
  143. } else {
  144. $frontpage_img = 'publish_x.png';
  145. $frontpage_alt = JText::_('JNO');
  146. }
  147.  
  148. $comments_enabled = (int)$row->getParams()->get('config.enable_comments', 1);
  149. $comments_img = $comments_enabled ? 'tick.png' : 'publish_x.png';
  150. $comments_alt = $comments_enabled ? JText::_('Comments enabled') : JText::_('Comments disabled');
  151.  
  152. $times = '';
  153.  
  154. if (isset($row->publish_up)) {
  155. if ($row->publish_up == $nullDate) {
  156. $times .= JText::_('Start: Always');
  157. } else {
  158. $times .= JText::_('Start') . ": " . $publish_up->format('Y-m-d H:i:s', true);
  159. }
  160. }
  161.  
  162. if (isset($row->publish_down)) {
  163. if ($row->publish_down == $nullDate) {
  164. $times .= "<br />" . JText::_('Finish No Expiry');
  165. } else {
  166. $times .= "<br />" . JText::_('Finish') . ": " . $publish_down->format('Y-m-d H:i:s', true);
  167. }
  168. }
  169.  
  170. // author
  171. $author = $row->created_by_alias;
  172. if (!$author) {
  173. if (isset($this->users[$row->created_by])) {
  174. $author = $this->users[$row->created_by]->name;
  175.  
  176. if ($this->app->user->get()->authorise('core.edit', 'com_users')) {
  177. $author = '<a href="' . $this->app->component->users->link(array('task' => 'user.edit', 'layout' => 'edit', 'view' => 'user', 'id' => $row->created_by)) . '" title="' . JText::_('Edit User') . '">' . $author . '</a>';
  178. }
  179. } else {
  180. $author = JText::_('Guest');
  181. }
  182. }
  183. ?>
  184. <tr>
  185. <td class="checkbox">
  186. <input type="checkbox" name="cid[]" value="<?php echo $row->id; ?>"/>
  187. </td>
  188. <td class="icon"></td>
  189. <td class="name">
  190. <span class="editlinktip hasTip"
  191. title="<?php echo JText::_('Edit Item'); ?>::<?php echo $row->name; ?>">
  192. <?php
  193. if ($row->canEdit()) {
  194. echo '<a href="' . $this->app->link(array('controller' => $this->controller, 'changeapp' => $this->application->id, 'task' => 'edit', 'cid[]' => $row->id)) . '">' . $row->name . '</a>';
  195. } else {
  196. echo $row->name;
  197. }
  198. ?>
  199. </span>
  200. <?php
  201. $itemUrl = $this->app->route->item($row, false);
  202. $siteUrl = str_replace('administrator/', '', JUri::base());
  203. ?>
  204. <a href="<?php echo $siteUrl . $itemUrl; ?>&tmpl=component" class="popup-item" title=""
  205. data-fancybox-type="iframe">
  206. <em class="icon-out-2"></em>
  207. </a>
  208. </td>
  209. <td class="type">
  210. <?php echo $this->application->getType($row->type)->name; ?>
  211. </td>
  212. <td class="published">
  213. <span class="editlinktip hasTip"
  214. title="<?php echo JText::_('Publish Information'); ?>::<?php echo $times; ?>">
  215. <?php if ($row->canEditState()) : ?>
  216. <a href="#" rel="task-<?php echo $row->state ? 'unpublish' : 'publish'; ?>">
  217. <img src="<?php echo $this->app->path->url('assets:images/' . $img); ?>" width="16"
  218. height="16" border="0" alt="<?php echo $alt; ?>"/>
  219. </a>
  220. <?php else: ?>
  221. <img src="<?php echo $this->app->path->url('assets:images/' . $img); ?>" width="16"
  222. height="16" border="0" alt="<?php echo $alt; ?>"/>
  223. <?php endif; ?>
  224. </span>
  225. </td>
  226. <td class="frontpage">
  227. <?php if ($row->canManageFrontpage()) : ?>
  228. <a href="#" rel="task-<?php echo 'toggleFrontpage'; ?>"
  229. title="<?php echo JText::_('Toggle frontpage state'); ?>">
  230. <img src="<?php echo $this->app->path->url('assets:images/' . $frontpage_img); ?>"
  231. width="16" height="16" border="0" alt="<?php echo $frontpage_alt; ?>"/>
  232. </a>
  233. <?php else: ?>
  234. <img src="<?php echo $this->app->path->url('assets:images/' . $frontpage_img); ?>" width="16"
  235. height="16" border="0" alt="<?php echo $frontpage_alt; ?>"/>
  236. <?php endif; ?>
  237. </td>
  238. <td class="searchable">
  239. <?php if ($row->canEdit()) : ?>
  240. <a href="#" rel="task-<?php echo $row->searchable ? 'makenonesearchable' : 'makesearchable'; ?>"
  241. title="<?php echo JText::_('Edit searchable state'); ?>">
  242. <img src="<?php echo $this->app->path->url('assets:images/' . $search_img); ?>" width="16"
  243. height="16" border="0" alt="<?php echo $search_alt; ?>"/>
  244. </a>
  245. <?php else: ?>
  246. <img src="<?php echo $this->app->path->url('assets:images/' . $search_img); ?>" width="16"
  247. height="16" border="0" alt="<?php echo $search_alt; ?>"/>
  248. <?php endif; ?>
  249. </td>
  250. <td class="comments">
  251. <?php if ($row->canEdit()) : ?>
  252. <a href="#" rel="task-<?php echo $comments_enabled ? 'disablecomments' : 'enablecomments'; ?>"
  253. title="<?php echo JText::_('Enable/Disable comments'); ?>">
  254. <img src="<?php echo $this->app->path->url('assets:images/' . $comments_img); ?>" width="16"
  255. height="16" border="0" alt="<?php echo $comments_alt; ?>"/>
  256. </a>
  257. <?php else: ?>
  258. <img src="<?php echo $this->app->path->url('assets:images/' . $comments_img); ?>" width="16"
  259. height="16" border="0" alt="<?php echo $comments_alt; ?>"/>
  260. <?php endif; ?>
  261. </td>
  262. <td class="priority">
  263. <?php if ($row->canEdit()) : ?>
  264. <span class="minus"></span>
  265. <input type="text" class="value" value="<?php echo $row->priority; ?>" size="5"
  266. name="priority[<?php echo $row->id; ?>]"/>
  267. <span class="plus"></span>
  268. <?php else: ?>
  269. <input type="text" class="value" value="<?php echo $row->priority; ?>" size="5"
  270. name="priority[<?php echo $row->id; ?>]" disabled/>
  271. <?php endif; ?>
  272. </td>
  273. <td class="access">
  274. <span><?php echo JText::_($this->app->zoo->getGroup($row->access)->name); ?></span>
  275. </td>
  276. <td class="author">
  277. <?php echo $author; ?>
  278. </td>
  279. <td class="date">
  280. <?php echo $this->app->html->_('date', $row->created, JText::_('DATE_FORMAT_LC4'), $this->app->date->getOffset()); ?>
  281. </td>
  282. <td class="hits">
  283. <?php echo $row->hits ?>
  284. </td>
  285. </tr>
  286. <?php endfor; ?>
  287. </tbody>
  288. </table>
  289.  
  290. <?php
  291. elseif ($this->is_filtered) :
  292.  
  293. $title = JText::_('SEARCH_NO_ITEMS') . '!';
  294. $message = null;
  295. echo $this->partial('message', compact('title', 'message'));
  296.  
  297. else :
  298.  
  299. $title = JText::_('NO_ITEMS_YET') . '!';
  300. $message = JText::_('ITEM_MANAGER_DESCRIPTION');
  301. echo $this->partial('message', compact('title', 'message'));
  302.  
  303. endif;
  304. ?>
  305.  
  306. </div>
  307.  
  308. <input type="hidden" name="controller" value="<?php echo $this->controller; ?>"/>
  309. <input type="hidden" name="task" value=""/>
  310. <input type="hidden" name="boxchecked" value="0"/>
  311. <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>"/>
  312. <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>"/>
  313. <input type="hidden" name="changeapp" value="<?php echo $this->application->id; ?>"/>
  314. <?php echo $this->app->html->_('form.token'); ?>
  315.  
  316. </form>
  317.  
  318. <script type="text/javascript">
  319. jQuery(function ($) {
  320. $('#adminForm').BrowseItems();
  321. });
  322. </script>
  323.  
  324. <?php echo ZOO_COPYRIGHT;

Теперь переходим в список материалов админки и видим новую ссылку у материалов.

5jn5_200x0.png

По клику на нее через fancybox подгружается шаблон full материала

tjcj_200x0.jpg

 

ВНИМАНИЕ!!!

  • Будьте внимательны при замене файлов.
  • Проверьте с начало на тестовом сайте а уже потом загружайте на рабочий сайт.
  • Это решение(модификация) тестировалось на 
    Joomla: 3.3.3
    JBZoo: 2.1.5 Pro
    Zoo: 3.2.1,
  • Не забывайте - это решение(модификация) и при следующих обновлениях эти изменения могут пострадать.
  • При появлении проблем Тех.Поддержка ответственности не несет. 

  • 10
Изображение
 

#2 laRus

laRus
  • JBZoo User (rus)
  • User rate: 60
  • posts: 1334
  • topics: 31

Posted 17 March 2015 - 10:47

Здорово! Оч.удобно!!

Спасибо, Cheren-dow!  :)


  • 0
..minimum effort for maximum effect? - Oh yeah! It's good!..

#3 Cheren-dow

Cheren-dow
  • Topic Starter
  • JBZoo User (rus)
  • User rate: 95.7
  • posts: 5060
  • topics: 31

Posted 17 March 2015 - 10:58

Дополню: если строку 

  1. <a href="<?php echo $siteUrl . $itemUrl; ?>&tmpl=component" class="popup-item" title=""

заменить на 

  1. <a href="<?php echo $siteUrl . $itemUrl; ?>&tmpl=component&jbquickview=teaser" class="popup-item" title=""

То будет открываться шаблон teaser. Если нужен full или любой другой шаблон в параметр jbquickview устанавливаете название шаблона


  • 3
Изображение
 

#4 isay777

isay777
  • JBZoo User (rus)
  • User rate: 113.4
  • posts: 1878
  • topics: 232

Posted 17 March 2015 - 11:22

Отлично


  • 0
ХОСТИНГ для сайтов jbzoo (все попугаи)

#5 alexmixaylov

alexmixaylov
  • JBZoo User (rus)
  • User rate: 7.7
  • posts: 679
  • topics: 142

Posted 17 March 2015 - 14:01

Спасибо огромное

это на самом деле очень удобно


  • 0

#6 laRus

laRus
  • JBZoo User (rus)
  • User rate: 60
  • posts: 1334
  • topics: 31

Posted 18 March 2015 - 07:34

Я удалила сообщение о проблеме. ИЗВИНИТЕ, задача в чем-то другом... однако ж, как оно бывает - сутки провозилась... 

Простите, пожалуйста, буду еще разбираться, вскрылись дополнительные обстоятельства.  :rolleyes:


Edited by Ursa, 18 March 2015 - 07:41.

  • 0
..minimum effort for maximum effect? - Oh yeah! It's good!..

#7 CB9TOIIIA

CB9TOIIIA
  • Administrators
  • User rate: 230.6
  • posts: 3680
  • topics: 235

Posted 18 March 2015 - 09:45

Отличное решение для новостника! :)


Edited by CB9TOIIIA, 18 March 2015 - 10:35.

  • 1

#8 laRus

laRus
  • JBZoo User (rus)
  • User rate: 60
  • posts: 1334
  • topics: 31

Posted 18 March 2015 - 10:39

CB9TOIIIA, on 18 Mar 2015 - 08:45, said:

по клику переходить на frontend этого материала
хи-хи-хи, "к хорошему быстро привыкаешь" (с) И хочется больше! :)) 

 

А если серьезно, отличная идея и уже практически одно из возможных решений:

CB9TOIIIA, on 18 Mar 2015 - 08:45, said:

спец. шаблон ...- и в него покидать нужные переменные из типа материала
  
  • 0
..minimum effort for maximum effect? - Oh yeah! It's good!..

#9 CB9TOIIIA

CB9TOIIIA
  • Administrators
  • User rate: 230.6
  • posts: 3680
  • topics: 235

Posted 18 March 2015 - 10:40

Ursa, on 18 Mar 2015 - 09:39, said:

хи-хи-хи, "к хорошему быстро привыкаешь" (с) И хочется больше! :)) 

 

А если серьезно, отличная идея и уже практически одно из возможных решений:

 

 

я оставил как есть + немного регулярок добавил, т.к. share от яндекса и прочее очень тормозили прогрузку, их убрал для этого просмотра)


Edited by CB9TOIIIA, 18 March 2015 - 10:41.

  • 0

#10 laRus

laRus
  • JBZoo User (rus)
  • User rate: 60
  • posts: 1334
  • topics: 31

Posted 18 March 2015 - 11:15

CB9TOIIIA, on 18 Mar 2015 - 09:40, said:

share от яндекса
у кого этого нету, можно и не напрягаться  :))

хотя странно, за счет чего тормозили-то?... это наверно НА ВАШЕМ (сильно нагруженном) сайте потому что, да?   :)


  • 0
..minimum effort for maximum effect? - Oh yeah! It's good!..





Also tagged with one or more of these keywords: zoo, быстрый просмотр, рецепт

Click to return to top of page in style!