SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/main_layout.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. use Sprout\Helpers\Admin;
  17. use Sprout\Helpers\AdminAuth;
  18. use Sprout\Helpers\AdminPerms;
  19. use Sprout\Helpers\Csrf;
  20. use Sprout\Helpers\Enc;
  21. use Sprout\Helpers\Jquery;
  22. use Sprout\Helpers\Notification;
  23. use Sprout\Helpers\Router;
  24. use Sprout\Helpers\Sprout;
  25. use Sprout\Helpers\Subsites;
  26.  
  27.  
  28. $merged_js = 'media/merged/admin.' . Sprout::getVersion() . '.js';
  29. $merged_css = 'media/merged/admin.' . Sprout::getVersion() . '.css';
  30.  
  31. $body_classes = array();
  32. if (!empty($locked)) {
  33. $body_classes[] = 'record-locked';
  34. }
  35. if (!$nav and !$nav_tools) {
  36. $body_classes[] = 'no-sidebar';
  37. }
  38.  
  39.  
  40. ?>
  41. <!DOCTYPE html>
  42. <html lang="en">
  43. <head>
  44. <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  45. <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  46. <meta name="viewport" content="width=device-width, initial-scale=1">
  47. <meta name="robots" content="noindex, nofollow">
  48.  
  49. <title><?php echo $browser_title; ?> | SproutCMS</title>
  50.  
  51. <base href="<?php echo Sprout::absRoot(); ?>">
  52.  
  53. <script>var ROOT = 'ROOT/'; var SITE = 'SITE/';</script>
  54.  
  55. <?php
  56. // Provide lock details to JavaScript to allow for unlocking on page unload
  57. if (!empty($currlock)) {
  58. echo '<script>var currlock = ', json_encode($currlock), ';</script>', "\n";
  59. }
  60. ?>
  61.  
  62. <?php
  63. // Allow AJAX to use the CSRF token
  64. echo '<script>var csrfToken = "', Csrf::getTokenValue(), '";</script>', "\n";
  65. ?>
  66.  
  67. <link rel="icon" href="ROOT/media/images/favicon.ico" type="image/x-icon" sizes="16x16 32x32 48x48 256x256">
  68. <link rel="icon" type="image/png" href="ROOT/media/images/favicon-16x16.png" sizes="16x16">
  69. <link rel="icon" type="image/png" href="ROOT/media/images/favicon-32x32.png" sizes="32x32">
  70. <link rel="icon" type="image/png" href="ROOT/media/images/favicon-96x96.png" sizes="96x96">
  71. <link rel="apple-touch-icon" sizes="152x152" href="ROOT/media/images/apple-touch-icon-152x152.png">
  72.  
  73. <!-- Styles -->
  74. <?php if (file_exists(DOCROOT . $merged_css)): ?>
  75. <link href="ROOT/<?php echo $merged_css; ?>" rel="stylesheet" type="text/css">
  76. <?php else: ?>
  77. <link href="ROOT/media/css/normalize.css" rel="stylesheet" type="text/css">
  78. <link href="ROOT/media/css/common.css" rel="stylesheet" type="text/css">
  79. <link href="ROOT/media/css/ui.core.css" rel="stylesheet" type="text/css">
  80. <link href="ROOT/sprout/media/css/admin_layout.css" rel="stylesheet">
  81. <link href="ROOT/sprout/media/css/admin_editing_area.css" rel="stylesheet">
  82. <link href="ROOT/media/css/facebox.css" rel="stylesheet">
  83. <?php endif; ?>
  84.  
  85. <!-- jQuery + jQuery UI -->
  86. <?= Jquery::script('jquery', 'admin'); ?>
  87. <?= Jquery::script('jqueryui', 'admin'); ?>
  88.  
  89. <!-- Libraries -->
  90. <?php if (file_exists(DOCROOT . $merged_js)): ?>
  91. <script src="ROOT/<?php echo $merged_js; ?>"></script>
  92. <?php else: ?>
  93. <script src="ROOT/media/js/jquery.cookie.js"></script>
  94. <script src="ROOT/media/js/common.js"></script>
  95. <script src="ROOT/media/js/jquery.matchHeight-min.js"></script>
  96. <script src="ROOT/sprout/media/js/admin_layout.js"></script>
  97. <script src="ROOT/sprout/media/js/admin_editing_area.js"></script>
  98. <script src="ROOT/media/js/facebox.js"></script>
  99. <?php endif; ?>
  100.  
  101. <needs />
  102.  
  103. </head>
  104. <body class="<?php echo implode(' ', $body_classes); ?>">
  105.  
  106. <div id="wrapper">
  107.  
  108. <div id="top-bar" class="-clearfix">
  109. <div class="container">
  110. <ul id="top-bar-nav" class="-clearfix">
  111. <?php if (AdminAuth::isSuper()): ?>
  112. <li class="top-bar-nav-item">
  113. <a class="top-bar-nav-link icon-before icon-storage" href="SITE/dbtools" title="Dev tools (sql, db sync, etc)">Dev tools</a>
  114. </li>
  115. <?php endif; ?>
  116. <?php if (!empty($manual_url = Kohana::config('branding.manual_url'))): ?>
  117. <li class="top-bar-nav-item">
  118. <a class="top-bar-nav-link icon-before icon-book" href="<?= Enc::html($manual_url); ?>" target="_blank" title="Manual">Manual</a>
  119. </li>
  120. <?php endif; ?>
  121. <li class="top-bar-nav-item">
  122. <button class="top-bar-nav-button icon-before icon-settings" type="button" title="Settings">Settings</button>
  123. <div class="dropdown-box top-bar-nav-settings-dropdown">
  124. <div class="dropdown-box__text">
  125. <p>Admin access</p>
  126. </div>
  127. <ul class="top-bar-nav-settings-dropdown-list list-style-2">
  128. <?php if (AdminPerms::getManageOperatorCategories()): ?>
  129. <li class="top-bar-nav-settings-dropdown-list-item">
  130. <a href="admin/intro/operator">Operators</a>
  131. </li>
  132. <?php endif; ?>
  133. <?php if (AdminPerms::canAccess('access_operators')): ?>
  134. <li class="top-bar-nav-settings-dropdown-list-item">
  135. <a href="admin/intro/per_record_permission">Per-record permissions</a>
  136. </li>
  137. <?php endif; ?>
  138. <?php if (AdminPerms::controllerAccess('action_log', 'contents')): ?>
  139. <li class="top-bar-nav-settings-dropdown-list-item">
  140. <a href="admin/intro/action_log">Activity log</a>
  141. </li>
  142. <?php endif; ?>
  143. </ul>
  144. <div class="dropdown-box__text dropdown-box__text--mid">
  145. <p>Content settings</p>
  146. </div>
  147. <ul class="top-bar-nav-settings-dropdown-list list-style-2">
  148. <?php if (AdminPerms::controllerAccess('content_subscribe', 'contents')): ?>
  149. <li class="top-bar-nav-settings-dropdown-list-item">
  150. <a href="admin/intro/content_subscription">Content subscriptions</a>
  151. </li>
  152. <?php endif; ?>
  153. <?php if (AdminPerms::controllerAccess('extra_page', 'contents')): ?>
  154. <li class="top-bar-nav-settings-dropdown-list-item">
  155. <a href="admin/intro/extra_page">Snippet pages</a>
  156. </li>
  157. <?php endif; ?>
  158. <?php if (AdminPerms::controllerAccess('document_type', 'contents')): ?>
  159. <li class="top-bar-nav-settings-dropdown-list-item">
  160. <a href="admin/intro/document_type">Document types</a>
  161. </li>
  162. <?php endif; ?>
  163. <?php if (AdminPerms::controllerAccess('redirect', 'contents')): ?>
  164. <li class="top-bar-nav-settings-dropdown-list-item">
  165. <a href="admin/intro/redirect">Redirects</a>
  166. </li>
  167. <?php endif; ?>
  168. <?php if (AdminPerms::controllerAccess('subsite', 'contents')): ?>
  169. <li class="top-bar-nav-settings-dropdown-list-item">
  170. <a href="admin/intro/subsite">Subsites</a>
  171. </li>
  172. <?php endif; ?>
  173. </ul>
  174. </div>
  175. </li>
  176. <?php $operator = AdminAuth::getDetails(); ?>
  177. <li class="top-bar-nav-item">
  178. <button class="top-bar-nav-button icon-before icon-person" type="button" title="Operator <?= Enc::html($operator['name']); ?>">
  179. <span class="topbar-nav-button__avatar">
  180. <img class="topbar-nav-button__avatar__image" src="https://www.gravatar.com/avatar/<?php echo md5( strtolower( trim( $operator['email'] ) ) ); ?>?s=84&amp;d=blank" alt="">
  181. </span> User settings</button>
  182. <div class="dropdown-box top-bar-nav-settings-dropdown">
  183.  
  184. <div class="dropdown-box__text">
  185. <p><?= Enc::html($operator['name']); ?></p>
  186. </div>
  187.  
  188. <ul class="top-bar-nav-settings-dropdown-list list-style-2">
  189. <?php if (AdminAuth::hasDatabaseRecord()): ?>
  190. <li class="top-bar-nav-settings-dropdown-list-item">
  191. <a href="admin/intro/my_settings">Settings</a>
  192. </li>
  193. <?php endif; ?>
  194. <li class="top-bar-nav-settings-dropdown-list-item">
  195. <a href="SITE/admin/logout">Log out</a>
  196. </li>
  197. </ul>
  198. </div>
  199. </li>
  200. </ul>
  201. </div>
  202. </div>
  203.  
  204. <header id="header" class="-clearfix">
  205. <div class="navigation-area">
  206. <div class="container">
  207. <div class="logo sidebar -clearfix"><span class="logo-sprout">Sprout</span> <span class="logo-cms">CMS</span> <span class="logo-version"><?= Enc::html(Sprout::getVersion()); ?></span></div>
  208.  
  209. <div id="navigation" class="mainbar">
  210. <?php echo Admin::topNav($controller_name); ?>
  211. </div>
  212. </div>
  213. </div>
  214. <div class="sub-header">
  215. <div class="container">
  216. <div class="sidebar sub-header-side">
  217.  
  218. </div>
  219. <div class="mainbar sub-header-main">
  220. <h1 class="site-title"><?php echo Enc::html(Subsites::getConfigAdmin('site_title')); ?></h1>
  221.  
  222. <a class="sub-header-view-site-button button button-regular button-green icon-after icon-desktop_mac" href="<?php echo Enc::html($live_url); ?>" target="_blank">View live site</a>
  223.  
  224. <?php if (Subsites::hasMultiple()): ?>
  225. <!-- Subsite selector version -->
  226. <div id="select-site">
  227. <?php // echo Enc::html(Subsites::getName($_SESSION['admin']['active_subsite'])); ?>
  228. <?php echo Subsites::listSelector($_SESSION['admin']['active_subsite']); ?>
  229. </div>
  230. <?php endif; ?>
  231. </div>
  232. </div>
  233. </div>
  234. </header>
  235.  
  236.  
  237. <div id="content" class="-clearfix">
  238. <div class="container">
  239. <div id="main" class="mainbar mainbar-reverse <?= empty($main_class) ? '' : Enc::html($main_class); ?>">
  240.  
  241. <!-- Main Heading -->
  242. <div id="main-heading">
  243.  
  244. <div id="main-heading-options">
  245. <?php if ($controller_name == 'page' and strpos(Router::$current_uri, '/edit/') !== false): ?>
  246. <button type="button" class="button button-grey button-small icon-after icon-settings page-settings-button page-edit-tab-button" data-target="page-settings-wrapper">Page settings</button>
  247. <button type="button" class="button button-grey button-small icon-after icon-history revisions-button page-edit-tab-button" data-target="page-revisions-wrapper">Revisions</button>
  248. <?php endif; ?>
  249. <?php if (!empty($enable_seo)): ?>
  250. <button type="button" class="button button-grey button-small icon-after icon-search seo-button page-edit-tab-button" data-target="seo-wrapper">SEO</button>
  251. <?php endif; ?>
  252. <?php if (!empty($has_tags)) : ?>
  253. <button type="button" class="button button-grey button-small icon-after icon-local_offer tags-button page-edit-tab-button" data-target="tags-wrapper">Tags</button>
  254. <?php endif; ?>
  255. </div>
  256.  
  257. <?php if ($controller_name !== '_dashboard'): ?>
  258. <?php
  259. // Encode the title, but preserve STRONG tags as they mark the actual name of the item being edited
  260. $main_title = str_replace(['<strong>','</strong>'], ['###strong###','###/strong###'], $main_title);
  261. $main_title = Enc::htmlNoDup($main_title);
  262. $main_title = str_replace(['###strong###','###/strong###'], ['<strong>','</strong>'], $main_title);
  263.  
  264. echo '<h2>', $main_title, '</h2>';
  265. ?>
  266. <?php endif; ?>
  267. </div>
  268.  
  269. <!-- Main Content -->
  270. <div id="main-content" class="-clearfix">
  271. <?php echo Notification::checkMessages(); ?>
  272. <?php if (!empty($locked)) echo '<ul class="messages all-type-neutral"><li class="neutral">This record currently locked for editing by ', Enc::html($locked['operator_name']), ' as of ', date('g:i a', strtotime($locked['date_modified'])), '</li></ul>'; ?>
  273. <?php echo $main_content; ?>
  274. </div>
  275.  
  276. <?php require("_footer.php"); ?>
  277. </div>
  278. <div id="sidebar" class="sidebar sidebar-reverse">
  279.  
  280. <button type="button" class="sidebar-collapse-button icon-before icon-keyboard_arrow_left" title="Toggle sidebar"><span class="-vis-hidden">Close sidebar</span></button>
  281.  
  282. <div class="sidebar-inner">
  283. <?php if ($nav): ?>
  284. <!-- Navigation -->
  285. <div class="sidebar-box">
  286. <h2 class="icon-before icon-insert_drive_file"><?php echo Enc::html($controller_navigation_name); ?></h2>
  287.  
  288. <div class="sidebar-box-content">
  289. <?php echo $nav; ?>
  290. </div>
  291.  
  292. </div>
  293. <?php endif; ?>
  294.  
  295. <?php if ($nav_tools): ?>
  296. <div id="search" class="sidebar-box">
  297. <h2 class="icon-before icon-settings">Tools</h2>
  298. <div class="sidebar-box-content">
  299. <ul class="list-style-1">
  300. <?php echo implode("\n", $nav_tools); ?>
  301. </ul>
  302. </div>
  303.  
  304. </div>
  305. <?php endif; ?>
  306. </div>
  307.  
  308. </div>
  309. <?php require("_footer.php"); ?>
  310. </div>
  311. </div>
  312.  
  313.  
  314. </div>
  315.  
  316.  
  317.  
  318. <script type="text/javascript">
  319. $(document).ready(function() { $(document).trigger('done'); });
  320. </script>
  321.  
  322. </body>
  323. </html>
  324.