<?php ############################################################## ##In-portal :: Administration Interfaces :: Common Elements ## ############################################################## ## In-portal ## ## Intechnic Corporation ## ## All Rights Reserved, 1998-2002 ## ## ## ## No portion of this code may be copied, reproduced or ## ## otherwise redistributed without proper written ## ## consent of Intechnic Corporation. Violation will ## ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## if(!defined('IS_INSTALL'))define('IS_INSTALL',0); if(!IS_INSTALL) { if (!admin_login()) { if(!headers_sent()) { setcookie("sid"," ",time()-3600); } $objSession->Logout(); header("Location: ".$adminURL."/login.php"); die(); //require_once($pathtoroot."admin/login.php"); } } global $admin,$pathtoroot, $objConfig; if(!strlen($admin)) { $admin = $objConfig->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 "<SCRIPT LANGUAGE=JavaScript1.2 src=\"".$adminURL."/browse/fw_menu.js\"></SCRIPT>\n"; echo "<SCRIPT LANGUAGE=JavaScript1.2 src=\"".$adminURL."/include/tabs.js\"></SCRIPT>\n"; echo "<script language=\"JavaScript1.2\" src=\"$adminURL/include/checkarray.js\"></script>\n"; global $objConfig, $ItemTabs; $m = GetModuleArray("admin"); echo "<!-- ".count($m)."-->"; foreach($m as $key=>$value) { $path = $pathtoroot. $value."admin/include/toolbar/".$sectionname.".php"; if( !in_array($value, $skip_modules) && file_exists($path) ) { echo "\n<!-- $path -->\n"; include_once($path); } else echo "\n<!-- $path not found -->\n"; } } function load_module_styles() { global $objConfig, $ItemTabs,$rootURL,$pathtoroot; $m = GetModuleArray("admin"); echo "<!-- module styles (".count($m).")-->"; foreach($m as $key=>$value) { $path = $pathtoroot.$value."admin/include/style.css"; if(file_exists($path)) { $inc = $rootURL.$value."admin/include/style.css"; print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$inc\">\n"; } } } //*********************************** //Page Header function int_header($toolbar=NULL,$NavBarText=NULL,$ExtraTitle=NULL,$onLoad=NULL, $ExtraHead=NULL,$skip_modules=Array(),$OtherSection = '') { 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"; $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 "<html>\n\t<head>\n\t\t<title>In-portal</title>\n"; if(strlen($metatag)) { print $metatag."\n"; } else { $charset = GetRegionalOption('Charset'); print "<meta http-equiv=\"content-type\" content=\"text/html;charset=$charset\">\n"; print "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n"; } print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">\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(); print '</head><body topmargin="0" leftmargin="8" marginheight="8" marginwidth="8" bgcolor="#FFFFFF"'; //*** Preload toolbar images if(strlen($onLoad)) { print $onLoad; } else print " ONLOAD=\"clear_list_checkboxes();\""; //*** Preload toolbar images if(is_object($toolbar)) { if (strlen($toolbar->Get("CheckClass"))) { print $toolbar->onLoadString().">"; } else print " >"; $menufunc = $toolbar->Get("load_menu_func"); if (strlen($menufunc)) { print "<script language=\"JavaScript1.2\">$menufunc</script>"; } } else print " >"; } else { $charset = GetRegionalOption('Charset'); print "<html><head><title>In-Portal </title>"; print "<meta http-equiv=\"content-type\" content=\"text/html;charset=$charset\">"; print "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">"; 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 "</head><body topmargin=\"0\" leftmargin=\"8\" marginheight=\"8\" marginwidth=\"8\" bgcolor=\"#FFFFFF\">"; } 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 "<html><head><title>In-Portal - Help</title>"; print "<meta http-equiv=\"content-type\" content=\"text/html;charset=$charset\">"; print "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">"; load_module_styles(); require_once ($pathtoroot.$admin."/include/mainscript.php"); print "</head><body topmargin=\"0\" leftmargin=\"8\" marginheight=\"8\" marginwidth=\"8\" bgcolor=\"#FFFFFF\">"; 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 "</head><body topmargin=\"$b_topmargin\" leftmargin=\"8\" marginheight=\"$b_topmargin\" marginwidth=\"8\" bgcolor=\"#FFFFFF\""; //*** Preload toolbar images if(strlen($onLoad)) { print $onLoad; } else print " onload=\"if (clear_checkboxes) clear_checkboxes();\""; 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 <<<END <!-- Subsection Title --> <tr class="subsectiontitle"> <td colspan="$ColSpan">$caption</td> </tr> END; } function int_subsection_title_install($caption) { int_table_color(1); print <<<END <!-- Subsection Title --> <tr class="subsectiontitle"> <td colspan="3">$caption</td> </tr> END; } function int_subsection_title_ret($caption) { int_table_color_ret(1); $o = "<!-- Subsection Title --><tr class=\"subsectiontitle\"><td colspan=\"5\">$caption</td></tr>"; 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 <<<END <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td> <span class="hint"><img src="$imagesURL/smicon7.gif" width="14" height="14" align="absmiddle">$caption</span> <td> </tr> </table> END; }//Hint function int_hint_red($caption) { global $imagesURL; print <<<END <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td> <span class="hint_red">$caption</span> <td> </tr> </table> END; }//Hint //*********************************** //Navigation String function int_nav($caption) { global $pathtoroot; global $imagespath; print <<<END <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#f0f0f0"> <tr> <td><b class="text"><span class="navbar"><a class="navbar" href="">$caption</a></span></b></td> </tr> </table> 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 "<img alt=\"$alt\" name=\"$name\" src=\"$src\" width=\"$width\" height=\"$height\" $id border=\"0\" align=\"absmiddle\">"; }//Print Out Images //*********************************** //Page Footer function int_footer() { global $objSession; if($objSession->HasSystemPermission("DEBUG.INFO")) { //phpinfo(); } if( defined('REQUIRE_LAYER_HEADER') ) echo '</div>'; print <<<END </body> </html> END; }//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 "<!-- $path -->"; @include_once($path); } } } function MultiEditButtons(&$ToolBar,$next,$prev,$Form,$StatusField, $url,$onClick, $ExtraVar="", $prev_phrase = 'Phrase Not Passed', $next_phrase = 'Phrase Not Passed') { global $adminURL; $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 ?> <script language="JavaScript">MarkAsRequired(document.getElementById("<?php echo $form_name; ?>"));</script> <?php } ?>