Index: trunk/admin/include/elements.php =================================================================== diff -u -N --- trunk/admin/include/elements.php (revision 8397) +++ trunk/admin/include/elements.php (revision 0) @@ -1,627 +0,0 @@ -Get("AdminDirectory"); - if(!strlen($admin)) - { - $admin = "admin"; - } -} - -require_once($pathtoroot.$admin."/include/sections.php"); - - -$envar = "env=" . BuildEnv(); - -/* this function loads the javascript for each module's toolbar */ -function load_module_javascript($sectionname, $skip_modules = Array() ) -{ - global $adminURL, $pathtoroot; - - echo "\n"; - echo "\n"; - echo "\n"; - - global $objConfig, $ItemTabs; - $m = GetModuleArray("admin"); - echo ""; - foreach($m as $key=>$value) - { - $path = $pathtoroot. $value."admin/include/toolbar/".$sectionname.".php"; - if( !in_array($value, $skip_modules) && file_exists($path) ) - { - echo "\n\n"; - include_once($path); - } - else - echo "\n\n"; - } -} - -function load_module_styles() -{ - global $objConfig, $ItemTabs,$rootURL,$pathtoroot; - - $m = GetModuleArray("admin"); - echo ""; - foreach($m as $key=>$value) - { - $path = $pathtoroot.$value."admin/include/style.css"; - - if(file_exists($path)) - { - $inc = $rootURL.$value."admin/include/style.css"; - print "\n"; - } - } -} - -//*********************************** -//Page Header -function int_header($toolbar=NULL,$NavBarText=NULL,$ExtraTitle=NULL,$onLoad=NULL, $ExtraHead=NULL,$skip_modules=Array(),$OtherSection = '') -{ - global $pathtoroot, $pathtolocal, $section, $objSections, $rootURL, $localURL, $adminURL, $envar, $admin, $metatag, $objSession; - - - $style_sheet_global = $adminURL."/include/style.css"; - $style_sheet_local = $localURL."admin/include/style.css"; - - $ExtraTitle = str_replace(Array('<','>'),Array('<','>'),$ExtraTitle); - //$ExtraTitle = htmlentities($ExtraTitle); - if (is_object($toolbar)) - { - if(file_exists($pathtolocal."admin/include/toolbar.php")) - require_once ($pathtolocal."admin/include/toolbar.php"); - //Aray of the preloaded elems - //$int_toolbar_preload = array(); - - print "\n\t\n\t\tIn-portal\n"; - - if (constOn('REQUIRED_BASE_HREF')) { - $application =& kApplication::Instance(); - $template_cache =& $application->recallObject('TemplatesCache'); // sets THEMES_PATH constant - $m_tag_processor =& $application->recallObject('m_TagProcessor'); - echo $m_tag_processor->Base_Ref()."\n"; - } - - if(strlen($metatag)) - { - print $metatag."\n"; - } - else - { - $charset = GetRegionalOption('Charset'); - if(defined('FORCE_CHARSET')&&FORCE_CHARSET) $charset=FORCE_CHARSET; - print "\n"; - print "\n"; - } - print "\n"; - load_module_styles(); - require_once($pathtoroot.$admin."/include/mainscript.php"); - //require_once($pathtolocal."admin/include/script.js"); - print $ExtraHead; - $sectionname = explode(":", $section); - $sectionname = $sectionname[sizeof($sectionname)-1]; - - load_module_javascript($sectionname, $skip_modules); - if (is_object($toolbar)) { - print $toolbar->GetInitScript(); - } - - echo ''; - - print 'Get("CheckClass"))) - { - print $toolbar->onLoadString().">"; - } - else - print " >"; - - $menufunc = $toolbar->Get("load_menu_func"); - if (strlen($menufunc)) - { - print ""; - } - } - else - print " >"; - } - else - { - $charset = GetRegionalOption('Charset'); - print "In-Portal "; - print ""; - print ""; - print ""; - load_module_styles(); - require_once ($pathtoroot.$admin."/include/mainscript.php"); - //require_once ($pathtolocal."admin/include/script.js"); - $sectionname = explode(":", $section); - $sectionname = $sectionname[sizeof($sectionname)-1]; - load_module_javascript($sectionname); - - - print ""; - } - - if(strlen($section)>0) - { - $objSections->SetCurrentSection($section); - $sec = $objSections->GetCurrentSection(); - if ($sec->Get("notitle") != 1) print $objSections->page_title(); - - print $objSections->page_tabs($envar); - - if ($sec->Get("nonavbar") != 1) //Section Navigatior - print $objSections->section_header($envar,$NavBarText,$ExtraTitle,false,$OtherSection); - - //Toolbar if appropriate - if ( isset($sections[$section]) && ($sections[$section]['toolbar']==1) || ( is_object($toolbar) ) ) { - print $toolbar->Build(); - } - - } -}//Page Header - -// HELP Page Header -function int_help_header() -{ - global $pathtoroot; - global $pathtolocal; - global $section; - global $objSections; - global $rootURL; - global $localURL; - global $adminURL; - global $envar; - global $admin; - global $metatag; - - $style_sheet_global = $adminURL."/include/style.css"; - $style_sheet_local = $localURL."admin/include/style.css"; - - // TOOLBAR: - $charset = GetRegionalOption('Charset'); - print "In-Portal - Help"; - print ""; - print ""; - print ""; - load_module_styles(); - require_once ($pathtoroot.$admin."/include/mainscript.php"); - - print ""; - - - if(strlen($section)>0) - { - $objSections->SetCurrentSection($section); - $sec = $objSections->GetCurrentSection(); - - if ($sec->Get("notitle") != 1) print $objSections->page_title(); - - if ($sec->Get("nonavbar") != 1) //Section Navigatior - print $objSections->section_header($envar,'','', true); - - } -}// HELP Page Header - - -function int_SectionHeader($toolbar=NULL,$onLoad=NULL,$NavBarText=NULL,$ExtraTitle=NULL) -{ - global $pathtoroot; - global $pathtolocal; - global $section, $sections; - global $objSections; - global $rootURL; - global $adminURL,$admin; - global $localURL; - global $envar; - global $b_topmargin; - if (!isset($b_topmargin)) - $b_topmargin = 8; - - $sectionname = explode(":", $section); - $sectionname = $sectionname[sizeof($sectionname)-1]; - load_module_javascript($sectionname); - if(is_object($toolbar)) - print $toolbar->GetInitScript(); - print ""; - global $b_header_addon; - - if (isset($b_header_addon)) echo $b_header_addon; - - if(strlen($section)>0) - { - $objSections->SetCurrentSection($section); - $sec = $objSections->GetCurrentSection(); - if ($sec->Get("notitle")!=1) - print $objSections->page_title(); - - print $objSections->page_tabs($envar); - - //Section Navigatior - if ($sec->Get("nonavbar")!=1) - { - if (is_null($ExtraTitle)) - $ExtraTitle = ""; - - print $objSections->section_header($envar,$NavBarText,$ExtraTitle); - - } - //Toolbar if appropriate - if( isset($sections[$section]) ) - if($sections[$section]['toolbar'] == 1 || (is_object($toolbar)) ) - print $toolbar->Build(); - } -}//Section Page Header - -//*********************************** -//SubSection Title -function int_subsection_title($caption, $ColSpan = 5) -{ - int_table_color(1); - print << - - $caption - -END; -} - -function int_subsection_title_install($caption) -{ - int_table_color(1); - print << - - $caption - -END; -} - -function int_subsection_title_ret($caption) -{ - int_table_color_ret(1); - $o = "$caption"; - return $o; -} - -//SubSection Title - -//*********************************** -//Table Alternating colors -function int_table_color($reset_color=0, $return_result = false) -{ - static $colorset; - - if($reset_color) - { $colorset="table-color2"; - return; - } - - if ($colorset == "table-color1") - $colorset = "table-color2"; - else - $colorset = "table-color1"; - - $ret = "class=\"".$colorset."\""; - if($return_result) - return $ret; - else - print $ret; - -}//Table Alternating colors - -//Table Alternating colors with return -function int_table_color_ret($reset_color=0) -{ - static $colorset; - - if($reset_color) - { $colorset="table-color2"; - return; - } - - if ($colorset == "table-color1") - $colorset = "table-color2"; - else - $colorset = "table-color1"; - - return "class=\"".$colorset."\""; -}//Table Alternating colors - - -//*********************************** -//Hint -function int_hint($caption) -{ - - global $imagesURL; - - print << - - - $caption - - - -END; -}//Hint - -function int_hint_red($caption) -{ - - global $imagesURL; - - print << - - - $caption - - - -END; -}//Hint - -//*********************************** -//Navigation String -function int_nav($caption) -{ - global $pathtoroot; - global $imagespath; - - print << - - $caption - - -END; -}//Navigation String - - - -//*********************************** -//Print Out Images -function int_img($img) -{ - global $images; - global $pathtoroot; - global $imagesURL; - - $src = $imagesURL."/".$images[$img]['file']; - $alt = $images[$img]['alt']; - $width = $images[$img]['width']; - $height = $images[$img]['height']; - $name = $img; - - //Set ID if needed - if ($img == 'img:tool:view') - $id = "ID=\"viewbutton\""; - - print ""; - -}//Print Out Images - -//*********************************** -//Page Footer -function int_footer() -{ - global $objSession; - if($objSession->HasSystemPermission("DEBUG.INFO")) - { - //phpinfo(); - } - if( defined('REQUIRE_LAYER_HEADER') ) echo ''; - print << - -END; - - if( class_exists('kApplication') ) - { - $application =& kApplication::Instance(); - $application->Done(); - } -}//Page Footer - - -function HomeEnv() -{ - global $m_var_list_update; - - $m_var_list_update["cat"]=0; - - return BuildEnv(); -} - -function UpEnv() -{ - global $m_var_list_update,$objCatList; - - $current = $objCatList->CurrentCat(); - $parent = $current->Get("ParentId"); - $m_var_list_update["cat"]=$parent; - - return BuildEnv(); -} - -function ModuleInclude($file) -{ - global $pathtoroot; - - $m = GetModuleArray(); - foreach($m as $key=>$value) - { - $path = $pathtoroot.$value.$file; - if(file_exists($path)) - { - echo ""; - @include_once($path); - } - } -} - -function MultiEditButtons(&$ToolBar,$next,$prev,$Form,$StatusField, $url,$onClick, $ExtraVar="", $prev_phrase = 'la_ToolTip_Previous', $next_phrase = 'la_ToolTip_Next') -{ - global $adminURL; - - $url = preg_replace('/^\/(.*)/', '\\1', $url); // remove "/" from beginning - - $ToolBar->Add("divider"); - - if($prev>-1) - { - $MouseOver="swap('moveleft','toolbar/tool_prev_f2.gif');"; - $MouseOut="swap('moveleft', 'toolbar/tool_prev.gif');"; - - $var="env=".BuildEnv()."&en=$prev&lpn=".GetVar('lpn'); - if (strlen($ExtraVar)) - $var.= $ExtraVar; - - if ($onClick != 'LangSubmitMove') { - $link = "javascript:edit_submit('$Form','$StatusField','$url',0,'$var');"; - } - else { - $link = "javascript:$onClick('$url', '$prev')"; - } - $ToolBar->Add("moveleft",$prev_phrase,$link,$MouseOver,$MouseOut,"","toolbar/tool_prev.gif"); - } - else - { - $MouseOver=""; - $MouseOut=""; - //$onClick=""; - $link="#"; - $ToolBar->Add("moveleft",$prev_phrase,"#","","","","toolbar/tool_prev_f3.gif"); - - } - - if($next>-1) - { - $MouseOver="swap('moveright','toolbar/tool_next_f2.gif');"; - $MouseOut="swap('moveright', 'toolbar/tool_next.gif');"; - - $var="env=".BuildEnv()."&en=$next".( isset($_REQUEST['lpn']) ? '&lpn='.$_REQUEST['lpn'] : ''); - - if (strlen($ExtraVar)) - $var.= $ExtraVar; - - if ($onClick != 'LangSubmitMove') { - $link = "javascript:edit_submit('$Form','$StatusField','$url',0,'$var');"; - } - else { - $link = "javascript:$onClick('$url', '$next')"; - } - $ToolBar->Add("moveright",$next_phrase,$link,$MouseOver,$MouseOut,"","toolbar/tool_next.gif"); - } - else - { - $ToolBar->Add("moveright",$next_phrase,"#","","","","toolbar/tool_next_f3.gif"); - } -} - -function InsertButtons(&$ToolBar, $Buttons = Array(), $params = Array() ) -{ - foreach($Buttons as $button) - switch($button) - { - case 'save': - $ToolBar->Add( "img_save", "la_Save", "#", - "swap('img_save','toolbar/tool_select_f2.gif');", - "swap('img_save', 'toolbar/tool_select.gif');", - "edit_submit('".$params['form']."','".$params['status_field']."','".$params['url']."',1,'&lpn=".$_REQUEST['lpn']."');","tool_select.gif"); - - break; - case 'cancel': - $ToolBar->Add( "img_cancel", "la_Cancel", "#", - "swap('img_cancel','toolbar/tool_cancel_f2.gif');", - "swap('img_cancel', 'toolbar/tool_cancel.gif');", - "edit_submit('".$params['form']."','".$params['status_field']."','".$params['url']."',2,'&lpn=".$_REQUEST['lpn']."');","tool_cancel.gif"); - break; - case 'edit': - break; - case 'delete': - break; - - } - - - -} - -function GetTitle($item_phrase, $tab_phrase, $id, $item_name = false) -{ - //gets correct caption for editing windows with tabs - //echo "In: $item_phrase, $tab_phrase, $id"; - $is_new = (isset($_REQUEST['new']) && ($_REQUEST['new'] == 1)) || $id <= 0 ? 1 : 0; - $text = $is_new ? 'la_Text_Adding' : 'la_Text_Editing'; - $text = admin_language($text).' '.admin_language($item_phrase); - - if($is_new == 0) { - if ($item_name == false) { - $text .= ' #'.$id; - } - else { - if ($item_name != '') { - $text .= " '".$item_name."'"; - } - } - } - - if ($tab_phrase != '') { - $text .= ' - '.admin_language($tab_phrase); - } - - return $text; -} - -function MarkFields($form_name) -{ - // mark specified form fields as required - ?>