A few more UI div recommendations and CSS touchups

Make php '$config' array available in javascript as javascript 'config' object
This commit is contained in:
james 2010-08-20 15:11:11 +00:00
parent a449fce300
commit 02998f98d6
3 changed files with 44 additions and 17 deletions

View File

@ -43,11 +43,12 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false) {
?> ?>
<!doctype html> <!doctype html>
<html> <html>
<head><title><? if($title && !$titletranslated) echo i18n($title); else if($title) echo $title; else echo i18n($config['fairname']); ?></title> <head>
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/jquery-ui-1.7.2.custom.css" type="text/css" media="all" /> <title><? if($title && !$titletranslated) echo i18n($title); else if($title) echo $title; else echo i18n($config['fairname']); ?></title>
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/sfiab.css" type="text/css" media="all" /> <link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/jquery-ui-1.7.2.custom.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type="text/css" media="all" /> <link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/sfiab.css" type="text/css" media="all" />
<meta charset="UTF-8"> <link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type="text/css" media="all" />
<meta charset="UTF-8">
</head> </head>
<body> <body>
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/jquery/1.3.2/jquery.min.js"></script>
@ -62,13 +63,14 @@ $(document).ready(function(){
if($("#importantdatesbox").length) if($("#importantdatesbox").length)
$("#importantdatesbox").load("important_dates.php?display=box"); $("#importantdatesbox").load("important_dates.php?display=box");
}); });
//and dump the whole PHP configuration into a Javascript Object, so we can use it anywhere we need to refer to config variables in javascript
var config=<?=json_encode($config)?>;
</script> </script>
<? <?
//if we're under /admin or /config we also want the translation editor //if we're under /admin or /config or /super we also want the translation editor
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config") if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super")
require_once("../translationseditor.inc.php"); require_once("../translationseditor.inc.php");
?> ?>
<div id="page-wrapper"> <div id="page-wrapper">
<div id="page"> <div id="page">
<div id="page-inner"> <div id="page-inner">
@ -382,11 +384,15 @@ if(substr(getcwd(),-6)!="/admin" && substr(getcwd(),-7)!="/config" && substr(get
<? <?
} }
*/ */
?>
<div id="work-area">
<div id="main-title">
<?
if($icon && theme_icon($icon)) { if($icon && theme_icon($icon)) {
echo "<div style=\"float: left; margin-right: 5px;\">"; echo " <div id=\"main-icon\" class=\"link-icon\">";
echo theme_icon($icon); echo theme_icon($icon);
echo "</div>"; echo "</div>\n";
} }
//if we're under /admin or /config then we want to show the ? help icon //if we're under /admin or /config then we want to show the ? help icon
@ -395,23 +401,30 @@ if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(get
$fname=substr($_SERVER['REDIRECT_SCRIPT_URL'],strlen($config['SFIABDIRECTORY'])+1); $fname=substr($_SERVER['REDIRECT_SCRIPT_URL'],strlen($config['SFIABDIRECTORY'])+1);
else else
$fname=substr($_SERVER['PHP_SELF'],strlen($config['SFIABDIRECTORY'])+1); $fname=substr($_SERVER['PHP_SELF'],strlen($config['SFIABDIRECTORY'])+1);
echo "<div style=\"float: right;\"<a target=\"_sfiabhelp\" href=\"http://www.sfiab.ca/wiki/index.php/Help_$fname\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/32/help.".$config['icon_extension']."\"></a></div>";
echo " <div id=\"help-icon\" class=\"link-icon\"><a target=\"_sfiabhelp\" href=\"http://www.sfiab.ca/wiki/index.php/Help_$fname\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/32/help.".$config['icon_extension']."\"></a></div>\n";
} }
if($title && !$titletranslated) if($title && !$titletranslated)
echo "<h2>".i18n($title)."</h2>"; echo "<h2>".i18n($title)."</h2>\n";
else if($title) else if($title)
echo "<h2>".$title."</h2>"; echo "<h2>".$title."</h2>\n";
display_messages(); display_messages();
?>
</div><!-- main-title-->
<div id="main-content">
<?
} }
/* END OF send_header */ /* END OF send_header */
function send_footer() { function send_footer() {
global $config; global $config;
?> ?>
</div> </div><!--main-content-->
</div><!--work-area-->
</div><!--main-->
<div id="lower-section" class="clear"> <div id="lower-section" class="clear">
<div id="footer"> <div id="footer">
<? <?

View File

@ -2,11 +2,11 @@ function taskNavLevel(l1,l2,l3,l4) {
if(l2) { if(l2) {
//we have a secondary click, which implies we also have a primary nav selected //we have a secondary click, which implies we also have a primary nav selected
//we may or may not have l3 or l4 though, so they are handled separately below //we may or may not have l3 or l4 though, so they are handled separately below
$("#secondarymenu").load("<?=$config['SFIABDIRECTORY']?>/nav.php?level=1&id="+l1,null,function() { $("#secondarymenu").load(config.SFIABDIRECTORY+"/nav.php?level=1&id="+l1,null,function() {
$("#secondarymenu").show(); $("#secondarymenu").show();
$("#tertiarymenu_accordion").accordion("destroy"); $("#tertiarymenu_accordion").accordion("destroy");
$("#tertiarymenu_accordion").load("<?=$config['SFIABDIRECTORY']?>/nav.php?level=2&id="+l2,null,function() { $("#tertiarymenu_accordion").load(config.SFIABDIRECTORY+"/nav.php?level=2&id="+l2,null,function() {
$("#tertiarymenu_accordion").accordion({clearStyle: true, collapsible: true, active: false}); //"option", "collapsible", true); $("#tertiarymenu_accordion").accordion({clearStyle: true, collapsible: true, active: false}); //"option", "collapsible", true);
$("#tertiarymenu").show(); $("#tertiarymenu").show();
@ -30,7 +30,7 @@ function taskNavLevel(l1,l2,l3,l4) {
} }
else { else {
//only the primary link clicked, so show the secondary, and thats it. //only the primary link clicked, so show the secondary, and thats it.
$("#secondarymenu").load("<?=$config['SFIABDIRECTORY']?>/nav.php?level=1&id="+l1,null,function() { $("#secondarymenu").load(config.SFIABDIRECTORY+"/nav.php?level=1&id="+l1,null,function() {
$(".primarynav-selected").removeClass("primarynav-selected"); $(".primarynav-selected").removeClass("primarynav-selected");
$("#primary_nav_"+l1).addClass("primarynav-selected"); $("#primary_nav_"+l1).addClass("primarynav-selected");

View File

@ -117,6 +117,20 @@ table tr.odd {
margin: auto; margin: auto;
} }
div#main-icon {
display: block;
float: left;
}
div#help-icon {
display: block;
float: right;
}
div.link-icon {
padding: 4px;
}
#mainwhere { #mainwhere {
margin-left: 185px; margin-left: 185px;
margin-right: 3px; margin-right: 3px;