SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/list_navigation.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16.  
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\Inflector;
  19. ?>
  20.  
  21. <script type="text/javascript">
  22. function nav_actions(elem) {
  23. var item_id = $(elem).attr('rel').replace(/\/$/, '').replace(/^.*[\/\\]/g, '');
  24.  
  25. var html = '<p><a href="admin/delete/<?php echo $controller_name; ?>/' + item_id + '">Delete</a></p>';
  26.  
  27. }
  28.  
  29. $(document).ready(function() {
  30. var t = $('.sidebar-box-content ul');
  31.  
  32. $(t).find('LI A').mouseup(function(event) {
  33. if (event.button == 2) {
  34. nav_actions(this);
  35. }
  36.  
  37. event.stopPropagation();
  38. return false;
  39. });
  40.  
  41. $(t).find('LI A').each(function(i) {
  42. this.oncontextmenu = function() {return false;};
  43. });
  44. });
  45. </script>
  46.  
  47. <?php if ($allow_add): ?>
  48. <div class="inline-buttons sidebar-action-buttons -clearfix">
  49. <a class="icon-after icon-add button button-small" href="admin/add/<?php echo $controller_name; ?>">Add <?php echo Enc::html(Inflector::singular($friendly_name)); ?></a>
  50. </div>
  51. <?php endif; ?>
  52.  
  53. <ul class="list-style-1">
  54. <li class="file ext_txt"><a href="SITE/admin/contents/<?= $controller_name; ?>">All <?= Enc::html(strtolower($friendly_name)); ?></a></li>
  55.  
  56. <?php
  57. foreach($items as $item) {
  58. $name = Enc::html($item['name']);
  59. if ($item['id'] == $record_id) {
  60. $class = "file ext_txt active-node";
  61. } else {
  62. $class = "file ext_txt";
  63. }
  64. echo "<li class=\"{$class}\"><a href=\"SITE/admin/edit/{$controller_name}/{$item['id']}\" rel=\"{$item['id']}\">{$name}</a></li>";
  65. }
  66. ?>
  67. </ul>
  68.