Skip to content

Commit

Permalink
Also replaces some generic icons with more specific ones. Removes "Co…
Browse files Browse the repository at this point in the history
…nfigure WYSIWYG Toolbar" since it's now done in the site configuration. Changes "Report a Bug" to only admin users and opens a new window.

Still needs the 'toggle_red.png" icon to have a transparent background.
  • Loading branch information
dleffler committed Jun 11, 2011
1 parent 4b6be5c commit d2d4511
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 56 deletions.
60 changes: 42 additions & 18 deletions framework/datatypes/user.php
@@ -1,21 +1,21 @@
<?php

##################################################
#
# Copyright (c) 2004-2011 OIC Group, Inc.
# Written and Designed by Adam Kessler
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/**
* This file is part of Exponent
* Exponent is free software; you can redistribute
* it and/or modify it under the terms of the GNU
* General Public License as published by the Free
* Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The file that holds the user class
*
* @link http://www.gnu.org/licenses/gpl.txt GPL http://www.gnu.org/licenses/gpl.txt
* @package Exponent-CMS
* @copyright 2004-2011 OIC Group, Inc.
* @author Adam Kessler <adam@oicgroup.net>
* @version 2.0.0
*/

class user extends expRecord {
public $validates = array(
Expand Down Expand Up @@ -93,24 +93,45 @@ public function authenticate($password) {

public function updateLastLogin() {
global $db, $user;
$obj = null;
$obj->id = $this->id;
$obj->last_login = time();
$db->updateObject($obj, 'user');
//$this->update(array('last_login'=>time()));
}

/**
* Is the user either a super admin or an acting admin?
*
* @return bool
*/
public function isAdmin() {
return (!empty($this->is_acting_admin) || !empty($this->is_admin)) ? true : false;
}

/**
* Is the user a super admin?
*
* @return bool
*/
public function isSuperAdmin() {
return $this->is_admin;
}

public function isActingAdmin() {
/**
* Is the user an acting admin and NOT a super admin?
*
* @return bool
*/
public function isActingAdmin() {
return ($this->is_admin == false && $this->is_acting_admin == true) ? true : false;
}


/**
* Is the user logged on
*
* @return bool
*/
public function isLoggedIn() {
return (empty($this->id)) ? false : true;
}
Expand All @@ -134,6 +155,9 @@ private function getUserProfile() {
}
}

/**
* Set user object admin flags
*/
private function checkAdminFlags() {
global $user;
if (!empty($this->is_admin) && $user->is_admin == 0) $this->is_admin = 0;
Expand Down
29 changes: 28 additions & 1 deletion framework/modules/administration/assets/css/slingbar.css
Expand Up @@ -157,12 +157,39 @@
#admintoolbar li.config a.yuimenuitemlabel {
background:url(../images/admintoolbar/config.png) no-repeat 5px 50%;
}
#admintoolbar .info li.reportbug a.yuimenuitemlabel {
background:url(../../../../core/assets/images/bug.png) no-repeat 5px 50%;
}
#admintoolbar li.development a.yuimenuitemlabel {
background:url(../images/admintoolbar/development.png) no-repeat 5px 50%;
}
#admintoolbar li.develop_on_red a.yuimenuitemlabel {
background:url(../../../../core/assets/images/toggle_red.png) no-repeat 5px 50%;
}
#admintoolbar li.develop_on_green a.yuimenuitemlabel {
background:url(../../../../core/assets/images/toggle_on.png) no-repeat 5px 50%;
}
#admintoolbar li.develop_off a.yuimenuitemlabel {
background:url(../../../../core/assets/images/toggle_off.png) no-repeat 5px 50%;
}
#admintoolbar li.remove a.yuimenuitemlabel {
background:url(../../../../core/assets/images/delete.png) no-repeat 5px 50%;
}
#admintoolbar li.search a.yuimenuitemlabel {
background:url(../../../../core/assets/images/view.png) no-repeat 5px 50%;
}
#admintoolbar li.manage a.yuimenuitemlabel {
background:url(../../../../core/assets/images/manage.png) no-repeat 5px 50%;
}
#admintoolbar li.users a.yuimenuitemlabel {
background:url(../images/admintoolbar/manage-users.png) no-repeat 5px 50%;
}
#admintoolbar li.euser a.yuimenuitemlabel {
background:url(../../../../core/assets/images/exp-admin-sprite.png) no-repeat 3px -26px;
}
#admintoolbar li.egroup a.yuimenuitemlabel {
background:url(../../../../core/assets/images/exp-admin-sprite.png) no-repeat 3px -56px;
}
#admintoolbar li.sitetree a.yuimenuitemlabel {
background:url(../images/admintoolbar/sitetree.png) no-repeat 5px 50%;
}
Expand Down Expand Up @@ -525,4 +552,4 @@ admintoolbar .yuimenu
#admintoolbar .yuimenuitem-checked-disabled
{
background-image: url(../images/admintoolbar/menuitem_checkbox_disabled.png);
}
}
120 changes: 83 additions & 37 deletions framework/modules/administration/menus/admin.php
Expand Up @@ -26,33 +26,72 @@
$my_version = EXPONENT_VERSION_MAJOR.".".EXPONENT_VERSION_MINOR.".".EXPONENT_VERSION_REVISION;
$my_type = EXPONENT_VERSION_TYPE.EXPONENT_VERSION_ITERATION;

$expAdminMenu = array(
'text' => '<img src="' . $this->asset_path . 'images/admintoolbar/expbar.png">',
'classname' => 'site',
'submenu' => array(
'id' => 'admin',
'itemdata' => array(
array(
'classname'=>'info',
'text'=>'About ExponentCMS',
"submenu"=>array(
'id'=>'ver',
'itemdata'=>array(
array(
'classname'=>'moreinfo',
'text'=>"Exponent Version : ".$my_version."<br />Release level : ".$my_type."<br />Release date : ".date("F-d-Y",EXPONENT_VERSION_BUILDDATE)."<br />PHP Version : ".phpversion(),"disabled"=>true
),
array(
'text' => "Report a bug",
'url' => 'http://exponentcms.lighthouseapp.com/projects/61783-exponent-cms/tickets/new',
'icon' => ICON_RELATIVE . "bug.png"
)
)
)
),
)
)
);
$script = "
var reportbugwindow = function (){
win = window.open('http://exponentcms.lighthouseapp.com/projects/61783-exponent-cms/tickets/new');
if (!win) {
//Catch the popup blocker
alert(\"Your popup blocker has prevented the file manager from opening\");
}
}
YAHOO.util.Event.on('reportabug','click',reportbugwindow);
";
exponent_javascript_toFoot('zreportabug', '', null, $script);

if ($user->isAdmin()) {
$expAdminMenu = array(
'text' => '<img src="' . $this->asset_path . 'images/admintoolbar/expbar.png">',
'classname' => 'site',
'submenu' => array(
'id' => 'admin',
'itemdata' => array(
array(
'classname' => 'info',
'text'=>'About ExponentCMS',
"submenu"=>array(
'id'=>'ver',
'itemdata'=>array(
array(
'classname' => 'moreinfo',
'text'=>"Exponent Version : ".$my_version."<br />Release level : ".$my_type."<br />Release date : ".date("F-d-Y",EXPONENT_VERSION_BUILDDATE)."<br />PHP Version : ".phpversion(),"disabled"=>true
),
array(
'text' => "Report a bug",
'url'=>'#',
'id'=>'reportabug',
'classname' => 'reportbug',
)
)
)
),
)
)
);
} else {
$expAdminMenu = array(
'text' => '<img src="' . $this->asset_path . 'images/admintoolbar/expbar.png">',
'classname' => 'site',
'submenu' => array(
'id' => 'admin',
'itemdata' => array(
array(
'classname' => 'info',
'text'=>'About ExponentCMS',
"submenu"=>array(
'id'=>'ver',
'itemdata'=>array(
array(
'classname' => 'moreinfo',
'text'=>"Exponent Version : ".$my_version."<br />Release level : ".$my_type."<br />Release date : ".date("F-d-Y",EXPONENT_VERSION_BUILDDATE)."<br />PHP Version : ".phpversion(),"disabled"=>true
)
)
)
),
)
)
);
}


if ($user->isAdmin()) {
Expand All @@ -71,18 +110,19 @@
),
array(
'text' => 'Regenerate Search Index',
'classname' => 'search',
'url' => makeLink(array(
'module' => 'search',
'action' => 'spider'
))
),
array(
/* array(
'text' => expLang::gettext("Configure Editor Toolbar"),
'url' => makeLink(array(
'module' => 'expHTMLEditor',
'action' => 'manage'
))
)
) */
)
)
);
Expand All @@ -104,55 +144,54 @@
'controller' => 'users',
'action' => 'manage'
)),
'icon' => ICON_RELATIVE . "userperms.png"
'classname' => 'euser',
),
array(
'text' => $i18n['group_accounts'],
'url' => makeLink(array(
'module' => 'users',
'action' => 'manage_groups'
)),
'icon' => ICON_RELATIVE . "groupperms.png"
'classname' => 'egroup',
),
array(
'text' => $i18n['profile_definitions'],
'url' => makeLink(array(
'module' => 'users',
'action' => 'manage_extensions'
)),
'icon' => ICON_RELATIVE . "groupperms.png"
),
array(
'text' => $i18n['user_sessions'],
'url' => makeLink(array(
'module' => 'users',
'action' => 'manage_sessions'
)),
'icon' => ICON_RELATIVE . "groupperms.png"
)
)
)
);

}


if ($user->isSuperAdmin()) {
$expAdminMenu['submenu']['itemdata'][] = array(
$expAdminMenu['submenu']['itemdata'][] = array(
'text' => 'Developer Tools',
'classname' => 'development',
'submenu' => array(
'id' => 'development',
'itemdata' => array(
array(
'text' => (DEVELOPMENT)?expLang::gettext('Turn error reporting off'):expLang::gettext('Turn error reporting on'),
'text' => (DEVELOPMENT)?expLang::gettext('Turn Error Reporting off'):expLang::gettext('Turn Error Reporting on'),
'classname' => (DEVELOPMENT)?'develop_on_red':'develop_off',
'url' => makeLink(array(
'module' => 'administrationmodule',
'action' => 'toggle_dev'
))
),
array(
'text' => (MINIFY)?expLang::gettext('Turn minification off'):expLang::gettext('Turn minification on'),
'text' => (MINIFY)?expLang::gettext('Turn Minification off'):expLang::gettext('Turn Minification on'),
'classname' => (MINIFY)?'develop_on_green':'develop_off',
'url' => makeLink(array(
'module' => 'administration',
'action' => 'toggle_minify'
Expand Down Expand Up @@ -191,6 +230,7 @@
),
array(
'text' => 'Remove Unused Tables',
'classname' => 'remove',
'url' => makeLink(array(
'controller' => 'administration',
'action' => 'manage_unused_tables'
Expand Down Expand Up @@ -250,20 +290,23 @@
'itemdata' => array(
array(
'text' => $i18n['upload_extension'],
'classname'=>'fileuploader',
'url' => makeLink(array(
'module' => 'administrationmodule',
'action' => 'upload_extension'
))
),
array(
'text' => expLang::gettext('Manage Modules'),
'classname' => 'manage',
'url' => makeLink(array(
'controller' => 'expModule',
'action' => 'manage'
))
),
array(
'text' => expLang::gettext('Manage Themes'),
'classname' => 'manage',
'url' => makeLink(array(
'module' => 'administration',
'action' => 'manage_themes'
Expand All @@ -274,12 +317,15 @@
),
array(
'text' => $i18n['clear_smarty'],
'classname' => 'remove',
'url' => makeLink(array(
'module' => 'administrationmodule',
'action' => 'clear_smarty_cache'
))
),
array(
'text' => (MAINTENANCE_MODE)?expLang::gettext('Turn Maintenance Mode off'):expLang::gettext('Turn Maintenance Mode on'),
'classname' => (MAINTENANCE_MODE)?'develop_on_red':'develop_off',
'text' => $i18n['toggle_maint'],
'url' => makeLink(array(
'module' => 'administrationmodule',
Expand Down

0 comments on commit d2d4511

Please sign in to comment.