SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/tree_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\Inflector;
  18. ?>
  19.  
  20. <script type="text/javascript">
  21. function nav_actions(elem) {
  22. var item_id = $(elem).attr('rel').replace(/\/$/, '').replace(/^.*[\/\\]/g, '');
  23.  
  24. var html = '<h3>Actions</h3>';
  25. html += '<p><a href="admin/add/<?php echo $controller_name; ?>?parent_id=' + item_id + '">Add child</a></p>';
  26. html += '<p><a href="<?php echo $controller_name; ?>/reorder/' + item_id + '" onclick="$.facebox({\"ajax\":this.href}); return false;">Re-order children</a></p>';
  27. html += '<p><a href="admin/delete/<?php echo $controller_name; ?>/' + item_id + '">Delete</a></p>';
  28.  
  29. show_foldout(html, elem);
  30. }
  31.  
  32.  
  33. // Show the tree
  34. $(document).ready(function () {
  35.  
  36. $('#nav').fileTree({
  37. root: '/',
  38. script: 'admin/call/<?= $controller_name; ?>/filetreeOpen',
  39. closeScript: 'admin/call/<?= $controller_name; ?>/filetreeClose',
  40. showNodes: [<?php echo $nodes_string; ?>],
  41. expandSpeed: 0,
  42. collapseSpeed: 0
  43. },
  44. function(action, file) {
  45. var item_id = file.replace(/^.*[\/\\]/g, '');
  46. window.location = 'SITE/admin/edit/<?php echo $controller_name; ?>/' + item_id;
  47. });
  48.  
  49.  
  50.  
  51. });
  52. </script>
  53.  
  54. <ul class="list-style-1">
  55. <li class="add"><a href="SITE/admin/add/<?php echo $controller_name; ?>">Add <?php echo Inflector::singular($friendly_name); ?></a></li>
  56. </ul>
  57. <div id="nav">
  58. &nbsp;
  59. </div>
  60.