Name:$br->Version";
$ie = 'if IE';
if( $br->Name == 'MSIE' && $br->Version == '6.0' ) {
$ie .= ' 6';
}
elseif( $br->Name == 'MSIE' && $br->Version == '7.0' ) {
$ie .= ' 7';
}
$ar = NAVT::get_option(ASSETS);
$gnavt_indent = $seq = 0;
$gnavt_output = '';
$gnavt_config = array();
$gnavt_groups = NAVT::get_option(GCONFIG);
if(is_array($ar)) {
// build the assets group
$gnavt_output = _indentt($gnavt_indent+1) . "\n" .
$gnavt_output .= _indentt($gnavt_indent+2) . "
\n";
$gnavt_output .= NAVT_DISPLAY::make_asset_group($ar, $gnavt_indent+3);
}
$scheme = 0;
$ar = NAVT::get_option(ICONFIG);
if( is_array($ar) ) {
// build each group
foreach( $ar as $group_ar ) {
$seq += 100;
$scheme = ( $scheme + 1 > 6 ? 1: $scheme + 1 );
$gnavt_output .= NAVT_DISPLAY::make_sortable_group($group_ar, $gnavt_indent+3, $scheme, $seq);
}
}
$gnavt_output .= _indentt($gnavt_indent+2) . "
\n";
$gnavt_output .= _indentt($gnavt_indent+1) . "\n\n";
$gnavt_output .= NAVT_DISPLAY::make_sortable_group(null, $gnavt_indent+1, null, null, true);
NAVT::update_option(ICONFIG, $gnavt_config);
NAVT::update_option(GCONFIG, $gnavt_groups);
NAVT::update_option(SCHEME, $scheme);
//navt_write_debug(NAVT_CFG, sprintf("%s::%s gcfg:\n", __CLASS__, __FUNCTION__), $gnavt_groups);
//navt_write_debug(NAVT_CFG, sprintf("%s::%s icfg:\n", __CLASS__, __FUNCTION__), $gnavt_config);
//navt_write_debug(NAVT_CFG, sprintf("%s::%s - end\n", __CLASS__, __FUNCTION__));
}
/**
* Create the default (assets) group
*
* @param string $name
* @param array $ar
* @param integer $in
* @param integer $scheme
* @return string
* @since .96
*/
function make_asset_group($ar, $in) {
$in0 = _indentt($in); $in1 = _indentt($in+1); $in2 = _indentt($in+2);
$in3 = _indentt($in+3); $in4 = _indentt($in+4);
$name = 'ASSETS';
$sel = array();
if(is_array($ar) && count($ar) > 0) {
$sel[TYPE_PAGE] = $in3 . "".
__("pages", 'navt_domain') . "
\n" . $in4 . "
\n";
$html =
$in0 . "\n" .
$in1 . "
".strtolower($name)."
\n" .
$in1 . "
\n" .
$in1 . "
\n" .
$in2 . "
\n" .
$in2 . "
" . __("To create a new item, click an element from one of the groups listed below.", 'navt_domain') . "
\n" .
$in2 . "
\n" .
$sel[TYPE_PAGE] .
$sel[TYPE_CAT] .
$sel[TYPE_AUTHOR] .
$sel[TYPE_LINK] .
$in2 . "
\n" .
$in1 . "
\n" .
$in0 . "
\n";
}
return($html);
}
/**
* Create the html for a default asset
*
* @param integer $in
* @param array $item
* @return string
* @since .96
*/
function make_default_asset($in, $item, $is_alt) {
$id = NAVT::make_id($item);
$alt = (($is_alt) ? 'alt' : '');
$nme = wp_specialchars($item[NME]);
$icon = 'zz' . NAVT_DISPLAY::get_icon($item);
$html = _indentt($in) . "\n";
return($html);
}
/**
* Create the html for a sortable group
*
* @param string $name
* @param array $ar
* @param integer $in
* @param integer $scheme
* @param integer $seq
* @return string
* @since .96
*/
function make_sortable_group($group_ar, $in, $scheme, $seq, $create_template=false) {
global $gnavt_groups;
$in0 = _indentt($in); $in1 = _indentt($in+1); $in2 = _indentt($in+2); $in3 = _indentt($in+3);
$hideThis = " style='display:none;'";
$scheme_id = ((false === $create_template) ? 'csQ2719522Q' : '');
$group_options = 0;
$name = '';
if((true === $create_template) || (is_array($group_ar) && count($group_ar) > 0)) {
$html =
$in0 . "\n" .
$in1 . "
Q2719521Q
\n" .
$in1 . "

\n" .
$in1 . "

\n" .
$in1 . "

\n" .
$in1 . "
\n" .
$in2 . "
\n";
if( false === $create_template ) {
foreach($group_ar as $member_id => $item) {
if( '' == $name ) {
// get the name of this group
$name = $item[GRP];
$upcase = strtoupper($name);
$locase = strtolower($name);
if( is_array($gnavt_groups) ) {
if( !array_key_exists($locase, $gnavt_groups ) ) {
$gnavt_groups[$locase] = NAVT::mk_group_config();
}
else {
$group_options = $gnavt_groups[$locase]['options'] & 0xffff;
}
}
}
// make this sortable
$locked = (($group_options & ISLOCKED) ? true: false);
$html .= NAVT_DISPLAY::make_sortable_item($in+3, $item, $seq++, $locked);
}
}
// finish this off
$html .=
$in3 . "-
\n" .
$in2 . "
\n" .
$in1 . "
\n" .
$in0 . "
\n\n";
// If not creating the template
if( false === $create_template ) {
$html = str_replace('Q2719520Q', $upcase, $html);
$html = str_replace('Q2719521Q', $locase, $html);
$html = str_replace('Q2719522Q', $scheme, $html);
$html = str_replace('@PRIVATE@', (($group_options & ISPRIVATE ) ? ' private ': ''), $html);
$html = str_replace('@HIDDEN@', '', $html);
$html = str_replace('@LOCKED@', (( $group_options & ISLOCKED ) ? ' locked ': ''), $html);
}
else {
// creating the template
$html = str_replace('@HIDDEN@', ' '.$hideThis, $html);
$html = str_replace('@LOCKED@', '', $html);
$html = str_replace('@PRIVATE@', '', $html);
}
}
return($html);
}
/**
* Create the html for a sortable item
*
* @param integer $in
* @param array $item
* @param integer $seq
* @return string
* @since .96
*/
function make_sortable_item($in, $item, $seq, $locked=false) {
global $gnavt_config;
$show_class = $lockd = '';
$isprivate = $isdraft = $isconnected = 0;
if(is_array($item)) {
$id = NAVT::make_id($item, $seq);
$opts = intval($item[OPT], 10);
$show_class = (($opts & DO_NOT_DISPLAY) ? 'noshow' : '');
$lockd = ($locked === false) ? 'ui-enabled':'ui-disabled';
$isprivate = (($opts & ISPRIVATE) ? 1: 0);
$isdraft = (($opts & ISDRAFTPAGE) ? 1: 0);
$isconnected = (($opts & DISCONNECTED) ? 0: 1);
$icon = NAVT_DISPLAY::get_icon($item);
if( TYPE_PAGE == $item[TYP] ) {
if( $opts & ISDRAFTPAGE ) {
$isconnected = 0;
}
else {
$isconnected = (( $opts & DISCONNECTED ) ? 0: 1);
}
}
if( TYPE_SEP == $item[TYP] ) {
if( !($opts & (HRULE_OPTION | PLAIN_TEXT_OPTION)) ) {
$item[NME] = __('empty space', 'navt_domain');
}
else if( $opts & HRULE_OPTION ) {
$item[NME] = __('horizontal rule', 'navt_domain');
}
}
}
$in0 = _indentt($in); $in1 = _indentt($in+1); $in2 = _indentt($in+2);
$in3 = _indentt($in+3); $in4 = _indentt($in+4); $in5 = _indentt($in+5); $in6 = _indentt($in+6);
$html =
$in0 . "\n" .
$in1 . "\n" .
$in2 . "
\n" .
$in2 . "
\n" .
$in2 . "
\n" .
$in2 . "
\n" .
$in2 . "
\n" .
$in3 . "
\n" .
$in4 . "
\n" .
$in4 . "
\n" .
$in3 . "
\n" .
$in3 . "
\n" .
$in3 . "
\n" .
$in2 . "
\n" .
$in2 . "
\n" .
$in1 . "
\n" .
$in0 . "\n";
// local replacements
if( is_array($item) ) {
$level = intval($item[LVL], 10);
$alias = NAVT::truncate($item[NME], (21 - $level));
$html = str_replace('QIDQ', $id, $html);
$html = str_replace('QNMEQ', wp_specialchars($item[NME]), $html);
$html = str_replace('QALIASQ', wp_specialchars($alias), $html);
$html = str_replace('QTYPEQ', $item[TYP], $html);
$html = str_replace('QLEVELQ', $item[LVL], $html);
$html = str_replace('@PRIVATE@', (($isprivate) ? 'private' : ''), $html);
$html = str_replace('@DRAFT@', (($isdraft) ? 'draft' : ''), $html);
$html = str_replace('@CONNECT@', (($isconnected) ? '' : 'disconnected'), $html);
$html = str_replace('@ICON@', 'i-'.$icon, $html);
}
if( !is_array($item) || $show_class == 'noshow' ) {
$html = str_replace('@HIDDEN@', ( !is_array($item) ? " style='display:none;'" : ''), $html);
$html = str_replace('@DRAFT@', '', $html);
$html = str_replace('@PRIVATE@', '', $html);
$html = str_replace('@ICON@', '', $html);
$html = str_replace('@CONNECT@', '', $html);
$html = str_replace('QLEVELQ', '0', $html);
}
// add sortable item to the working configuration
if(is_array($item)) {
// part of the configuration
$gnavt_config[ strtolower($item[GRP])][ $id ] = $item;
}
return($html);
}
/**
* Returns all of the html created for the page
*
* @return string
* @since version .96
*/
function get_group_output() {
global $gnavt_output;
return($gnavt_output);
}
function get_icon($item) {
$opts = intval($item[OPT], 10);
$icon = '';
if( $item[TYP] == TYPE_PAGE ) {
$icon = (($opts & ISDRAFTPAGE) ? 'draftpage' : 'page');
}
if( $item[TYP] == TYPE_CAT ) { $icon = 'category'; }
if( $item[TYP] == TYPE_SEP ) { $icon = 'divider'; }
if( $item[TYP] == TYPE_AUTHOR) { $icon = 'user'; }
if( $item[TYP] == TYPE_ELINK ) { $icon = 'elink'; }
if( $item[TYP] == TYPE_LINK && $item[IDN] == HOMEIDN ) { $icon = 'home'; }
if( $item[TYP] == TYPE_LINK && $item[IDN] == LOGINIDN ) { $icon = 'admin'; }
return($icon);
}
}// end class
/** ---------------------------------
* Create the page
* ---------------------------------*/
$src = NAVT::get_url() . '/' . IMG_BLANK;
NAVT_DISPLAY::init();
$html .= "\n
\n" .
get_navt_topbar($gnavt_indent+1) .
"
\n" .
NAVT_DISPLAY::get_group_output() .
"
\n" .
navt_group_options_helper($gnavt_indent) .
get_navt_footer($gnavt_indent);
$html = str_replace('@SRC@', $src, $html);
$html = str_replace('@NS@', 'navt_ns', $html);
echo $html;
/**
* creates the contents of the page sidebar
*
* @param integer $in
* @return html string
* @since .96
*/
function get_navt_topbar($in) {
global $ie;
$in0 = _indentt($in); $in1 = _indentt($in+1); $in2 = _indentt($in+2); $in3 = _indentt($in+3);
$html =
$in0 . "\n".
$in0 . "\n" .
$in0 . "• ". __('Navigation Tool for WordPress v', 'navt_domain') . SCRIPTVERS . " •
\n" .
$in0 . "\n" .
// create new group toolbar
$in1 . "
\n" .
// backup-restore toolbar
$in1 . "
\n" .
// updates
$in1 . "
\n" .
$in2 . "
".__('Change Log', 'navt_domain')."
\n" .
// controls
$in2 . "\n" .
$in1 . "\n" .
$in0 . "
\n" .
$in0 . "\n";
return($html);
}
/**
* Creates the group options helper
*
* @param integer $in
*/
function navt_group_options_helper($in) {
global $ie;
$in0 = _indentt($in);
$html = "\n" . $in0 . "
";
return($html);
}
/**
* creates the contents of the page footer
*
* @param integer $in
* @return html string
* @since .96
*/
function get_navt_footer($in) {
global $ie;
$html =
"\n\n" . _indentt($in) .
"\n" . _indentt($in) .
"
\n".
_indentt($in) . "\n\n";
return($html);
}
?>