nukeSEO.com - PHPNuke SEO Search engine optimization, professional tools including nukeSEO, nukeSPAM, nukeFEED, nukePIE, nukeWYSIWYG and more

 

. Welcome to nukeSEO.com  ! 
.
.
.


.
nukeSEO.com: Forums


 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

admin tabs
 
 
Post new topic   Reply to topic    nukeSEO.com Forum Index -> PHP-Nuke enhancement ideas
View previous topic :: View next topic  
Author Message
GazJ
webmaster


Joined: Mar 20, 2007
Posts: 29

PostPosted: Sun Sep 26, 2010 6:44 pm    Post subject: admin tabs Reply with quote

hey buddy i like the admin tabs tweak with the double click to hide how about cookie support to remember the last tab you was on?

heres a snippet from a hide left/right blocks on a theme im doing.

Study it and see the cookie parts its pretty easy
this bit sets the cookie on click
Code:
$("#showrb").click(function () { 

$("#showrb").hide("slow");
$(".rightcontent").toggle("slow");
$("#hiderb").show("slow");
$.cookie("rightCol", "expanded", { expires: 7});
});

this bit detects the cookie if there is one
Code:
// get cookies for blocks display

$(document).ready(function(){
var leftCol = $.cookie("leftCol");
var rightCol = $.cookie("rightCol");
if (leftCol == "collapsed") {
   $(".leftcontent").css("display","none");
   $("#hidelb").hide("slow");
   $("#showlb").show("slow");
};
if (rightCol == "collapsed") {
   $(".rightcontent").css("display","none");
   $("#hiderb").hide("slow");
   $("#showrb").show("slow");
};
});


now lets break it down

Code:
rightCol = cookie name

expanded = value
$.cookie("rightCol", "expanded", { expires: 7});
the last part just sets an expire after 7 days


now for the cookie plugin js file
i cant find this anywhere the website is down so i cant paste a link so ill paste the whole contents of the js file



Code:
/**

 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
  
Back to top
View user's profile Send private message
kguske
Site Admin
Site Admin


Joined: May 12, 2005
Posts: 876

PostPosted: Wed Sep 29, 2010 8:09 pm    Post subject: Reply with quote

Hi Gazj,

Did you look at the jQuery Tools site I recommended? This looks interesting, but I'm swamped at the moment.
_________________
  
Back to top
View user's profile Send private message Visit poster's website
GazJ






PostPosted: Thu Sep 30, 2010 2:01 am    Post subject: Reply with quote

ye i looked at it before buddy it causes conflicts with afew plugins and certain parts of the jquery ui.

i like it just think its gonna cause head aches for me as i tend to look around the net for jquery plugins and pick the best and most flexible for what i want.

if i remember it plays havoc with afew dialog scripts and ui tabs
  
Back to top
kguske






PostPosted: Thu Sep 30, 2010 5:59 am    Post subject: Reply with quote

I did some research on it and still prefer the jQuery UI tools (and others) as well.
  
Back to top
GazJ






PostPosted: Thu Sep 30, 2010 11:31 am    Post subject: Reply with quote

while where on js files i have been looking around on ways to improve how i handle js includes i tweaked my js file scanner that inlcudes js file automaticly with no need to edit in the head tags and it now instead of including each file is opens the file and prints each one in a single php file and i also minify the output buffer in that file stripping out white spaces and comments

header.php

Code:
echo'script type="text/javascript" src="includes/head/js.php"'."\n";


includes/head/js.php

Code:



ob_start ("ob_gzhandler");

header('Content-type: text/javascript; charset: UTF-8');
header ("cache-control: must-revalidate");
$offset = 60 * 60;
$expire = "expires: " . gmdate ("D, d M Y H:i:s", time() + $offset) . " GMT";
header ($expire);
$data = '';

if(!function_exists('stripos')) {
  function stripos_clone($haystack, $needle, $offset=0) {
    $return = strpos(strtoupper($haystack), strtoupper($needle), $offset);
  if ($return === false) {
    return false;
    } else {
    return true;
    }
  }
} else {
// But when this is PHP5, we use the original function
  function stripos_clone($haystack, $needle, $offset=0) {
    $return = stripos($haystack, $needle, $offset=0);
  if ($return === false) {
    return false;
    } else {
    return true;
    }
  }
}

function nunukeARRAYheadinc($Path='',$type='.*'){
   $Path = ''.$Path;
   if(is_dir($Path) && !stripos_clone($Path, "..")){
      $Path2 = dir($Path);
      $dirArray = '';
      while (false !== ($file = $Path2->read())) {
         if (is_file($Path.'/'.$file) && preg_match('/'.$type.'/i', $file)) {
            if( $file != '.' && $file != '..' ) {
            $dirArray[] = $file;
            }
         }
      }
         if (!is_array($dirArray)) {
         return 0;
         }
      sort($dirArray);
      return $dirArray;
   }else{
   return 0;
   }
}
   $jsList = nunukeARRAYheadinc("core_files/js",".*js$");
      if ($jsList) {
         while (list($key,$val) = each($jsList)) {
         $data .= readfile('core_files/js/'.$val);
         }
      }

function compress($buffer) {
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
return $buffer;
}

echo compress($data);


just incase you want to have ago with it your self im also thinking about writing an admin control panel for it to allow me to turn off a js file and maybe a per module basis
  
Back to top
Display posts from previous:       
Post new topic   Reply to topic    nukeSEO.com Forum Index -> PHP-Nuke enhancement ideas All times are GMT - 5 Hours
 
 Page 1 of 1

 

Jump to:   
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001-2008 phpBB Group


Page Generation: 0.03 Seconds