Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: [Emerging] - Admin Tip Panels for sNews  (Read 4246 times)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
[Emerging] - Admin Tip Panels for sNews
« on: November 02, 2007, 08:36:38 PM »

I have experimented with a few approaches to adding Admin Tip Panels into the Admin Panels in sNews over the past several months. Each required more javascript files, additional modding, added more "weight" to the overall package... and slowed sNews down a good bit.

I took a different approach today... now that I finally have a new version (1.1) of the MEMU package running quite smoothly... and I was quite pleasantly surprised with the simplicity and overall results. The good part is that it doesn't require any "new" external scripts... it makes use of the expandable panel technique already present in the default sNews package.

This addon begins with a new admin_tips.php (module) file in the mods folder, which contains a small expandable panel function for each Admin Tip Panel. Language variables are added to the english.php language file... a new, simple style declaration is added to each template's css/style.css file... and the actual function-names are simply inserted throughout the admin panel functions where required, in the engine file(s). I haven't tried yet... but I'd also like to put the language variables for this addon in their own file as well.

As an example... here is the function that displays the Tip Panel in the  "New Category" admin panel"

Quote
function admintip_newcat() {
   echo '<a title="'.l('admin_tip').'" onclick="toggle(\'sub1\')" style="cursor: pointer;"><img src="'.db(website).''.gl(sub_dir).'sn_icons/help-icon.png" alt="'.l('admin_tip').'" /></a>';
   echo '<div id="sub1" style="display: none;">';
   echo '<div class="tip_panel">'.l('howto_newcat').'</div>';
echo '</div>';
}


Here is what the New Category Panel looks like when you first arrive...


And here is what it looks like when you click on the icon image to expand the panel... it stays open while you enter data within the panel (for reference) and collapses when you click the icon (when done):
« Last Edit: November 02, 2007, 08:40:15 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

pwendel

  • Full Member
  • ***
  • Karma: 8
  • Posts: 106
    • sNews 1.6 in Danish
Re: [Emerging] - Admin Tip Panels for sNews
« Reply #1 on: November 04, 2007, 08:49:11 AM »

Very nice mod - and I think you are on the right track for implementing it as well, by using existing functionality where possible.

I think its a great help for newcomers and it will make sNews more accessible to the general public (quite accessible as it is, but still).

I think usability is what should help a 'simple' cms like sNews grab marketshare from some of the bigger distributions.

Per.
Logged
"Opportunity is missed by alot of people because it comes dressed in blue overalls and looks like hard work" -- Thomas Edison (1847-1931)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [Emerging] - Admin Tip Panels for sNews
« Reply #2 on: November 04, 2007, 05:51:31 PM »

I haven't tried yet... but I'd also like to put the language variables for this addon in their own file as well.
As it turns out... creating mod-specific language variable arrays is also quite simple. With this addon, I moved the admin_tips.php file - which includes all the functions used to display each Admin Tip panel - into its own folder in the mods folder. I then used the default sNews language variable structure to create a new langtip_en.php file and added it to the same folder so both files are in the same directory. The langtip_en.php file is included at the top of the admin_tips.php file which, in turn, is included into the cong.php file. Using translated files is also simple. Let' say we want a french language file for a french-language site. The langtip_en.php file can be cloned, re-named to langtip_fr.php, added to the mod folder (admin_tips) and translated into french, and then included at the top of the admin_tips.php file where the langtip_en.php file is/was included.

The only difference between the default language variable array in sNews... and the new mod-specific one... is that the variables need to start with a different prefix than those in the default file. This allows you to use variable names that are exactly the same as ones used in the default array (if necessary) without conflicting with the default variable-names. So... in this case, the array is a tl array instead of an l array, and all variable strings start with $tl instead of $l.

The final result is... that the Admin Tips package can be added to any sNews package with only three steps:
1. Copying the admin_tips folder into a site root or a mods folder in the site root,
2. Including the admin_tips.php file at the top of index.php in a default package (or in the config.php file in the MEMU and MESU modular packages),
3. inserting the function-name (call strings) where desired in each function in the engine file.
« Last Edit: November 04, 2007, 07:11:53 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

centered

  • Guest
Re: [Emerging] - Admin Tip Panels for sNews
« Reply #3 on: November 05, 2007, 10:50:42 PM »

Awesome mod Keys, I agree with pwendel, any type of help to make the software more accessable is good!
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: [Emerging] - Admin Tip Panels for sNews
« Reply #4 on: November 06, 2007, 12:43:04 PM »

Wowsa, an old favourite has been dusted off, it seems... D'ya remember way back when, old mate... We did dabble with this sometime ago, but it faded out for some reason... Great to see it up again. You're so good, Doug ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [Emerging] - Admin Tip Panels for sNews
« Reply #5 on: November 06, 2007, 01:27:16 PM »

Wowsa, an old favourite has been dusted off, it seems... D'ya remember way back when, old mate... We did dabble with this sometime ago, but it faded out for some reason... Great to see it up again. You're so good, Doug ;)
Yes, I remember. I was never really satisfied with the results of those past attempts. The one that did work fairly well (back then, I seem to remember) opened the tip panels in overlays but I was not able to re-position them on an individual level... and some were getting in the way of other page elements. This one eliminates that problem altogether, and stays open and available all the time while the user works in the panel or until the user collapses it when done.  :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU