Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated wolfcms

  • Loading branch information...
commit 6a0447ea468b959fb30d3df585c35ea981c95446 2 parents e614316 + b5e5540
@ajcates authored
Showing with 161 additions and 135 deletions.
  1. +157 −132 wolf/app/layouts/backend.php
  2. +4 −3 wolf/app/models/Behavior.php
View
289 wolf/app/layouts/backend.php
@@ -16,7 +16,7 @@
// Redirect to front page if user doesn't have appropriate roles.
if (!AuthUser::hasPermission('admin_view')) {
- header('Location: ' . URL_PUBLIC . ' ');
+ header('Location: '.URL_PUBLIC.' ');
exit();
}
@@ -26,153 +26,178 @@
// Allow for nice title.
// @todo improve/clean this up.
-$title = ($ctrl == 'plugin') ? Plugin::$controllers[Dispatcher::getAction()]->label : ucfirst($ctrl) . 's';
-if (isset($this->vars['content_for_layout']->vars['action'])) {
- $tmp = $this->vars['content_for_layout']->vars['action'];
- $title .= ' - ' . ucfirst($tmp);
-
- if ($tmp == 'edit' && isset($this->vars['content_for_layout']->vars['page'])) {
- $tmp = $this->vars['content_for_layout']->vars['page'];
- $title .= ' - ' . $tmp->title;
+if (!isset($title) || trim($title) == '') {
+ $title = ($ctrl == 'plugin') ? Plugin::$controllers[Dispatcher::getAction()]->label : ucfirst($ctrl).'s';
+ if (isset($this->vars['content_for_layout']->vars['action'])) {
+ $tmp = $this->vars['content_for_layout']->vars['action'];
+ $title .= ' - '.ucfirst($tmp);
+
+ if ($tmp == 'edit' && isset($this->vars['content_for_layout']->vars['page'])) {
+ $tmp = $this->vars['content_for_layout']->vars['page'];
+ $title .= ' - '.$tmp->title;
+ }
}
}
?>
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="utf-8" />
- <title><?php echo Setting::get('admin_title'), ' - ', $title; ?></title>
-
- <!--[if lt IE 9]>
- <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
-
- <link rel="shortcut icon" href="/admin/themes/<?php echo Setting::get('theme'); ?>/favicon.ico" type="image/vnd.microsoft.icon" />
- <link rel="stylesheet" href="<?php echo URI_PUBLIC; ?>wolf/admin/themes/<?php echo Setting::get('theme'); ?>/screen.css" media="screen" type="text/css" />
- <link rel="stylesheet" href="<?php echo URI_PUBLIC; ?>wolf/admin/markitup/skins/simple/style.css" type="text/css" />
-
- <script src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/jquery-1.6.2.min.js"></script>
- <script src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/jquery-ui-1.8.5.custom.min.js"></script>
- <script src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/jquery.ui.nestedSortable.js"></script>
- <script src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/cp-datepicker.js"></script>
- <script src="<?php echo URI_PUBLIC; ?>wolf/admin/markitup/jquery.markitup.js"></script>
- <script src="<?php echo BASE_URI; ?>wolfbase.js"></script>
- <script src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/wolf.js"></script>
-
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+
+ <title><?php use_helper('Kses'); echo $title . ' | ' . kses(Setting::get('admin_title'), array()); ?></title>
+
+ <link rel="favourites icon" href="<?php echo URI_PUBLIC; ?>wolf/admin/images/favicon.ico" />
+ <link href="<?php echo URI_PUBLIC; ?>wolf/admin/stylesheets/admin.css" media="screen" rel="Stylesheet" type="text/css" />
+ <link href="<?php echo URI_PUBLIC; ?>wolf/admin/themes/<?php echo Setting::get('theme'); ?>/styles.css" id="css_theme" media="screen" rel="Stylesheet" type="text/css" />
+
+ <!-- IE6 PNG support fix -->
+ <!--[if lt IE 7]>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/unitpngfix.js"></script>
+ <![endif]-->
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/cp-datepicker.js"></script>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/wolf.js"></script>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/jquery-1.6.2.min.js"></script>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/jquery-ui-1.8.5.custom.min.js"></script>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/jquery.ui.nestedSortable.js"></script>
+
+ <script type="text/javascript" src="<?php echo URI_PUBLIC; ?>wolf/admin/markitup/jquery.markitup.js"></script>
+ <link rel="stylesheet" type="text/css" href="<?php echo URI_PUBLIC; ?>wolf/admin/markitup/skins/simple/style.css" />
+
<?php foreach(Plugin::$plugins as $plugin_id => $plugin): ?>
<?php if (file_exists(CORE_ROOT . '/plugins/' . $plugin_id . '/' . $plugin_id . '.js')): ?>
-<script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/plugins/<?php echo $plugin_id.'/'.$plugin_id; ?>.js"></script>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/plugins/<?php echo $plugin_id.'/'.$plugin_id; ?>.js"></script>
<?php endif; ?>
<?php if (file_exists(CORE_ROOT . '/plugins/' . $plugin_id . '/' . $plugin_id . '.css')): ?>
-<link href="<?php echo URI_PUBLIC; ?>wolf/plugins/<?php echo $plugin_id.'/'.$plugin_id; ?>.css" media="screen" rel="Stylesheet" type="text/css" />
+ <link href="<?php echo URI_PUBLIC; ?>wolf/plugins/<?php echo $plugin_id.'/'.$plugin_id; ?>.css" media="screen" rel="Stylesheet" type="text/css" />
<?php endif; ?>
<?php endforeach; ?>
<?php foreach(Plugin::$javascripts as $jscript_plugin_id => $javascript): ?>
-<script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/plugins/<?php echo $javascript; ?>"></script>
+ <script type="text/javascript" charset="utf-8" src="<?php echo URI_PUBLIC; ?>wolf/plugins/<?php echo $javascript; ?>"></script>
+<?php endforeach; ?>
+
+ <script type="text/javascript">
+ // <![CDATA[
+ $(document).ready(function() {
+ (function showMessages(e) {
+ e.fadeIn('slow')
+ .animate({opacity: 1.0}, 1500)
+ .fadeOut('slow', function() {
+ if ($(this).next().attr('class') == 'message') {
+ showMessages($(this).next());
+ }
+ $(this).remove();
+ })
+ })( $(".message:first") );
+
+ $("input:visible:enabled:first").focus();
+
+ // Get the initial values and activate filter
+ $('.filter-selector').each(function() {
+ var $this = $(this);
+ $this.data('oldValue', $this.val());
+
+ if ($this.val() == '') {
+ return true;
+ }
+ var elemId = $this.attr('id').slice(0, -10);
+ var elem = $('#'+elemId+'_content');
+ $this.trigger('wolfSwitchFilterIn', [$this.val(), elem]);
+ });
+
+ $('.filter-selector').live('change',function(){
+ var $this = $(this);
+ var newFilter = $this.val();
+ var oldFilter = $this.data('oldValue');
+ $this.data('oldValue', newFilter);
+ var elemId = $this.attr('id').slice(0, -10);
+ var elem = $('#'+elemId+'_content');
+ $(this).trigger('wolfSwitchFilterOut', [oldFilter, elem]);
+ $(this).trigger('wolfSwitchFilterIn', [newFilter, elem]);
+ });
+ });
+ // ]]>
+ </script>
+
+<?php $action = Dispatcher::getAction(); ?>
+ </head>
+ <body id="body_<?php echo $ctrl.'_'.Dispatcher::getAction(); ?>">
+ <!-- Div to allow for modal dialogs -->
+ <div id="mask"></div>
+
+ <div id="header">
+ <div id="site-title"><a href="<?php echo get_url(); ?>"><?php echo Setting::get('admin_title'); ?></a></div>
+ <div id="mainTabs">
+ <ul>
+ <li id="page-plugin" class="plugin"><a href="<?php echo get_url('page'); ?>"<?php if ($ctrl=='page') echo ' class="current"'; ?>><?php echo __('Pages'); ?></a></li>
+<?php if (AuthUser::hasPermission('snippet_view')): ?>
+ <li id="snippet-plugin" class="plugin"><a href="<?php echo get_url('snippet'); ?>"<?php if ($ctrl=='snippet') echo ' class="current"'; ?>><?php echo __('Snippets'); ?></a></li>
+<?php endif; ?>
+<?php if (AuthUser::hasPermission('layout_view')): ?>
+ <li id="layout-plugin" class="plugin"><a href="<?php echo get_url('layout'); ?>"<?php if ($ctrl=='layout') echo ' class="current"'; ?>><?php echo __('Layouts'); ?></a></li>
+<?php endif; ?>
+
+<?php foreach (Plugin::$controllers as $plugin_name => $plugin): ?>
+<?php if ($plugin->show_tab && (AuthUser::hasPermission($plugin->permissions))): ?>
+ <?php Observer::notify('view_backend_list_plugin', $plugin_name, $plugin); ?>
+ <li id="<?php echo $plugin_name;?>-plugin" class="plugin"><a href="<?php echo get_url('plugin/'.$plugin_name); ?>"<?php if ($ctrl=='plugin' && $action==$plugin_name) echo ' class="current"'; ?>><?php echo __($plugin->label); ?></a></li>
+ <?php endif; ?>
<?php endforeach; ?>
- </head>
- <body>
- <header>
- <div id="logo"><a href="<?php echo URL_PUBLIC ?>"><?php echo Setting::get('admin_title') ?></a></div>
- <ul id="user-controls">
- <li><?php echo __('You are currently logged in as'); ?> <a href="<?php echo get_url('user/edit/' . AuthUser::getId()); ?>"><?php echo AuthUser::getRecord()->name; ?></a> | </li>
- <li><a href="<?php echo get_url('login/logout'); ?>"><?php echo __('Logout'); ?></a> | </li>
- <li><a id="site-view-link" href="<?php echo URL_PUBLIC; ?>" target="_blank"><?php echo __('View Site'); ?></a></li>
- </ul>
- </header>
-
- <nav>
- <ul>
- <li<?php if ($ctrl == 'page') echo ' class="current"'; ?>>
- <a href="<?php echo get_url('page'); ?>">
- <?php echo __('Pages'); ?> <span class="counter"><?php //echo Record::countFrom('Page') ?></span>
- </a>
- </li>
- <?php if (AuthUser::hasPermission('snippet_view')): ?>
- <li<?php if ($ctrl == 'snippet') echo ' class="current"'; ?>>
- <a href="<?php echo get_url('snippet'); ?>"><?php echo __('Snippets'); ?> <span class="counter"><?php //echo Record::countFrom('Snippet') ?></span></a>
- </li>
- <?php endif; ?>
- <?php if (AuthUser::hasPermission('layout_view')): ?>
- <li<?php if ($ctrl == 'layout') echo ' class="current"'; ?>>
- <a href="<?php echo get_url('layout'); ?>"><?php echo __('Layouts'); ?> <span class="counter"><?php //echo Record::countFrom('Layout') ?></span></a>
- </li>
- <?php endif; ?>
- <?php foreach (Plugin::$controllers as $plugin_name => $plugin): ?>
- <?php if ($plugin->show_tab && (AuthUser::hasPermission($plugin->permissions))): ?>
- <?php Observer::notify('view_backend_list_plugin', $plugin_name, $plugin); ?>
- <li <?php if ($ctrl == 'plugin' && $action == $plugin_name) echo ' class="current"'; ?>>
- <a href="<?php echo get_url('plugin/' . $plugin_name); ?>"><?php echo __($plugin->label); ?></a>
- </li>
- <?php endif; ?>
- <?php endforeach; ?>
- </ul>
-
- <ul class="right">
- <?php if (AuthUser::hasPermission('admin_edit')): ?>
- <li<?php if ($ctrl == 'setting' && $action != 'plugin') echo ' class="current"'; ?>>
- <a href="<?php echo get_url('setting'); ?>"><?php echo __('Settings'); ?></a>
- </li>
- <?php endif; ?>
- <?php if (AuthUser::hasPermission('admin_edit')): ?>
- <li<?php if ($ctrl == 'setting' && $action == 'plugin') echo ' class="current"'; ?>>
- <a href="<?php echo get_url('setting/plugin'); ?>"><?php echo __('Plugins'); ?></a>
- </li>
- <?php endif; ?>
- <?php if (AuthUser::hasPermission('user_view')): ?>
- <li<?php if ($ctrl == 'user') echo ' class="current"'; ?>>
- <a href="<?php echo get_url('user'); ?>"><?php echo __('Users'); ?></a>
- </li>
- <?php endif; ?>
- </ul>
- </nav>
+<?php if (AuthUser::hasPermission('admin_edit')): ?>
+ <li class="right"><a href="<?php echo get_url('setting'); ?>"<?php if ($ctrl=='setting') echo ' class="current"'; ?>><?php echo __('Administration'); ?></a></li>
+<?php endif; ?>
+<?php if (AuthUser::hasPermission('user_view')): ?>
+ <li class="right"><a href="<?php echo get_url('user'); ?>"<?php if ($ctrl=='user') echo ' class="current"'; ?>><?php echo __('Users'); ?></a></li>
+<?php endif; ?>
+ </ul>
+ </div>
+ </div>
<?php if (Flash::get('error') !== null): ?>
-<div id="error" class="message" style="display: none;"><?php echo Flash::get('error'); ?></div>
+ <div id="error" class="message" style="display: none;"><?php echo Flash::get('error'); ?></div>
<?php endif; ?>
<?php if (Flash::get('success') !== null): ?>
-<div id="success" class="message" style="display: none"><?php echo Flash::get('success'); ?></div>
+ <div id="success" class="message" style="display: none"><?php echo Flash::get('success'); ?></div>
<?php endif; ?>
<?php if (Flash::get('info') !== null): ?>
-<div id="info" class="message" style="display: none"><?php echo Flash::get('info'); ?></div>
+ <div id="info" class="message" style="display: none"><?php echo Flash::get('info'); ?></div>
<?php endif; ?>
- <div id="content" <?php if (isset($sidebar) && trim($sidebar) != '') { echo ' class="use-sidebar sidebar-at-side2"'; } ?>>
- <?php if (isset($section_bar)) { ?>
- <div id="section-bar">
- <?php echo $section_bar; ?>
- </div> <!-- #section_bar -->
- <?php } ?>
-
- <?php if (isset($page_bar)) { ?>
- <div id="page-bar">
- <?php echo $page_bar; ?>
- </div> <!-- #page_bar -->
- <?php } ?>
-
- <section id="page-content">
- <?php echo $content_for_layout; ?>
- </section>
-
- <aside id="sidebar">
- <!-- sidebar -->
- <?php if (isset($sidebar) && trim($sidebar) != '') { echo $sidebar; } ?>
- <!-- end sidebar -->
- </aside>
-
- <div class="clearer">&nbsp;</div>
-
- </div>
-
- <footer>
- <p>
- <?php echo __('Thank you for using'); ?> <a href="http://www.wolfcms.org/" target="_blank">Wolf CMS</a> <?php echo CMS_VERSION; ?> | <a href="http://forum.wolfcms.org/" target="_blank"><?php echo __('Feedback'); ?></a> | <a href="http://wiki.wolfcms.org/" target="_blank"><?php echo __('Documentation'); ?></a>
- </p>
- <?php if (DEBUG): ?>
- <p class="stats">
- <?php echo __('Page rendered in'); ?> <?php echo execution_time(); ?> <?php echo __('seconds'); ?>
- | <?php echo __('Memory usage:'); ?> <?php echo memory_usage(); ?>
- </p>
- <?php endif; ?>
- </footer>
- </body>
+ <div id="main">
+ <div id="content-wrapper">
+ <div id="content">
+ <!-- content -->
+ <?php echo $content_for_layout; ?>
+ <!-- end content -->
+ </div>
+ </div>
+ <?php if (isset($sidebar)) { ?>
+ <div id="sidebar-wrapper">
+ <div id="sidebar">
+ <!-- sidebar -->
+ <?php echo $sidebar; ?>
+ <!-- end sidebar -->
+ </div>
+ </div>
+ <?php } ?>
+ </div>
+
+ <div id="footer">
+ <p>
+ <?php echo __('Thank you for using'); ?> <a href="http://www.wolfcms.org/" target="_blank">Wolf CMS</a> <?php echo CMS_VERSION; ?> | <a href="http://forum.wolfcms.org/" target="_blank"><?php echo __('Feedback'); ?></a> | <a href="http://wiki.wolfcms.org/" target="_blank"><?php echo __('Documentation'); ?></a>
+ </p>
+<?php if (DEBUG): ?>
+ <p class="stats">
+ <?php echo __('Page rendered in'); ?> <?php echo execution_time(); ?> <?php echo __('seconds'); ?>
+ | <?php echo __('Memory usage:'); ?> <?php echo memory_usage(); ?>
+ </p>
+<?php endif; ?>
+
+ <p id="site-links">
+ <?php echo __('You are currently logged in as'); ?> <a href="<?php echo get_url('user/edit/'.AuthUser::getId()); ?>"><?php echo AuthUser::getRecord()->name; ?></a>
+ <span class="separator"> | </span>
+ <a href="<?php echo get_url('login/logout'); ?>"><?php echo __('Log Out'); ?></a>
+ <span class="separator"> | </span>
+ <a id="site-view-link" href="<?php echo URL_PUBLIC; ?>" target="_blank"><?php echo __('View Site'); ?></a>
+ </p>
+ </div>
+ </body>
</html>
View
7 wolf/app/models/Behavior.php
@@ -60,14 +60,15 @@ public static function remove($behavior_id) {
public static function load($behavior_id, &$page, $params) {
if ( ! empty(self::$behaviors[$behavior_id])) {
$file = CORE_ROOT.'/plugins/'.self::$behaviors[$behavior_id];
+ $behavior_class = Inflector::camelize($behavior_id);
if (isset(self::$loaded_files[$file]))
- return new $behavior_id($page, $params);
+ return new $behavior_class($page, $params);
if (file_exists($file)) {
include $file;
self::$loaded_files[$file] = true;
- return new $behavior_id($page, $params);
+ return new $behavior_class($page, $params);
}
else {
exit ("Behavior $behavior_id not found!");
@@ -83,7 +84,7 @@ public static function load($behavior_id, &$page, $params) {
* @return string class name of the page
*/
public static function loadPageHack($behavior_id) {
- $behavior_page_class = 'Page'.str_replace(' ','',ucwords(str_replace('_',' ', $behavior_id)));
+ $behavior_page_class = Inflector::camelize('page_'.$behavior_id);
if (class_exists($behavior_page_class, false))
return $behavior_page_class;
Please sign in to comment.
Something went wrong with that request. Please try again.