Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD] Always on Top Admin Menu  (Read 2106 times)

Artos Viros

  • Newbie
  • *
  • Karma: 0
  • Posts: 20
[MOD] Always on Top Admin Menu
« on: July 24, 2007, 08:26:00 pm »

This is the Always on Top Admin Menu I talked about a long time ago, I haven't done any change from then, but since I've been using on my blog and it's been working ok (just some minor known "bugs") I'm going to release it hoping it helps someone.

What's this about?
This mod adds -when logged in- a DIV at the top of every page with the common options from the Admin, (add+view categories, add+view articles, etc..) plus the hability to aprove, edit or erase the comments without need to display the article page -just if you have turned on the "approve comments" option- (The comments will appear on a retractable div).

Since I wanted to display it in a horizontal div, I tried to avoid as much as I could the use of the text instead I'm working with some icons (tooltip with some info included)

Known bugs
It's almost impossible to display as a single line if you use any of the following translation files: Portuguese, Nederlands, Polish, Swedsh and german, this is mainly because some of them have very long descriptions or if you're working with "small" screen resolutions (actually aren't THAT small, just try it and you'll see what I'm talkin about...)

Philmoz suggested some minor changes to avoid this, but even with that change we can't gain enough extra space...

Installation:

This is how will look like:



You will need this rar file (mod_admintools.php and the images) just 7kb

First of all, same as always, make a backup of your snews.php

Add the following code to your CSS file:
Code: [Select]
#admintools
{
width:100%;
font-size: 11px;
top:0px;
background-color: #c0c0c0;
margin: 0px;
padding:0px;
min-height:50px;
}
#mod01
{
white-space: nowrap;
float:left;
left: 0px;
}
#mod02
{
white-space: normal;
float:right;
text-align:right;
right: 0px;
}
#clear
{
clear:both; height:0pt; margin: -15px; padding:0px; border: 0px solid red;
}
.modtitle
{
font-size:11pt;
text-transform:uppercase;
letter-spacing: -2pt;
font-family: Arial Black;
}
Now at your snews.php (or your translation file) add this variable:
Code: [Select]
$l['approve'] = 'Approve comment';In your snews.php file:
In //BREADCRUMBS breadcrumbs() function
locate the line:
Code: [Select]
if ($_SESSION[db('website').'Logged_In'] == token()) {echo $link.'administration/" title="'.l('administration').'">'.l('administration').' '.l('divider').' ';}and erase it or comment it by adding double slash // at the beggning of the line.This is for do not display the link to the admin section in the subheader/breadcrumbs div.


At the end of the BREADCRUMBS code block add:
Code: [Select]
//Admintools -  here we just want to check we are already logged in, if so the mod will appear.
function admintools() {
   if ( isset($_SESSION[db('website').'Logged_In']) ) {
include ('mod_admintools.php');
    }}
(if needed change the path of the mod_admintools.php)


LOCATE the //ADMINISTRATION FORM and turn all that code block into this:
Code: [Select]
function administration() {
   if ( isset($_SESSION[db('website').'Logged_In']) ) {
echo l('operation_completed');
echo '';
}}
Finally, nearly at the end of the /*** PROCESSING (CATEGORIES, CONTENTS, COMMENTS) ***/ processing() function, locate the "case 'deletecomment':" and after the break; add:
Code: [Select]
case 'approvemod':
      $commentid = $_GET['commentid'];
mysql_query("UPDATE ".db('prefix')."comments SET approved = 'True' WHERE id = $commentid LIMIT 1;");
echo notification(0,'', $link);
echo '';
break;
Now at your index.php add after the body tag this:
Code: [Select]
Logged

centered

  • Guest
[MOD] Always on Top Admin Menu
« Reply #1 on: July 25, 2007, 12:31:09 am »

Awesome mod.  I haven't tried it yet but the idea was something I had when I was starting my mod.
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
[MOD] Always on Top Admin Menu
« Reply #2 on: July 25, 2007, 02:33:45 pm »

ooo good job artos thank you  :D