changeset 2977:4daa7442c8da octave-forge

Javascript in separate files, added date to html pages, added favicon
author hauberg
date Sun, 28 Jan 2007 11:37:02 +0000
parents 0eb09548dd25
children d09227b983a2
files www/Makefile www/fixed.js www/get_current_date.sh www/javascript.jsin www/macros.m4
diffstat 5 files changed, 161 insertions(+), 136 deletions(-) [+]
line wrap: on
line diff
--- a/www/Makefile	Sat Jan 27 19:22:31 2007 +0000
+++ b/www/Makefile	Sun Jan 28 11:37:02 2007 +0000
@@ -4,7 +4,7 @@
 HTML_SRC = $(shell find . | grep "\.in")
 IMG_HTML = $(HTML_SRC:.in=.html)
 
-all: build-www doc developers.html doxygen
+all: build-www doc developers.html doxygen javascript.js
 	make $(IMG_HTML)
 	make -k -C ../doc/coda www-dist
 	if [ ! -e coda ]; then rm -rf coda; fi
@@ -32,6 +32,9 @@
 %.html : %.in
 	$(M4) $(M4_OPTIONS) $(MACRO_FILE) $< > $@
 
+javascript.js: javascript.jsin
+	$(M4) $(M4_OPTIONS) $(MACRO_FILE) $< > $@
+
 clean:
 	@for f in $(IMG_HTML); do \
 	  d=`dirname $$f`; \
@@ -41,7 +44,7 @@
 	    fi; \
 	  fi; \
 	done
-	rm -fr *.html developers.in INDEX coda .octave_hist .octave_packages install doxygen 
+	rm -fr *.html developers.in INDEX coda .octave_hist .octave_packages install doxygen javascript.js
 
 package:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/fixed.js	Sun Jan 28 11:37:02 2007 +0000
@@ -0,0 +1,6 @@
+function fix_top_menu()
+{
+    if (navigator.appVersion.indexOf('MSIE') == -1) {
+        document.getElementById("top-menu").style.position = "fixed";
+    } // end non-IE
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/get_current_date.sh	Sun Jan 28 11:37:02 2007 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo -n `/bin/date --rfc-3339=seconds`
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/javascript.jsin	Sun Jan 28 11:37:02 2007 +0000
@@ -0,0 +1,134 @@
+var cookie_name = "octave_forge_cookie";
+
+function set_cookie(val)
+{
+    if (document.cookie != document.cookie) {
+        index = document.cookie.indexOf(cookie_name);
+    } else {
+        index = -1;
+    }
+    if (index == -1) {
+        var cval = cookie_name + "=" + val + "; ";
+        var d = new Date();
+        d.setSeconds(d.getSeconds()+30);
+        cval = cval + "expires=" + d.toString() + ";";
+        document.cookie = cval;
+    }
+}
+
+function get_cookie()
+{
+    var retval = -1;
+    if (document.cookie) {
+        var index = document.cookie.indexOf(cookie_name);
+        if (index != -1) {
+            var start = document.cookie.indexOf("=", index) + 1;
+            stop = document.cookie.indexOf(";", start);
+            if (stop == -1) {
+                stop = document.cookie.length;
+            }
+            retval = document.cookie.substring(start, stop);
+        }
+    }
+    return retval;
+}
+
+function goto_url (selSelectObject)
+{
+    if (selSelectObject.options[selSelectObject.selectedIndex].value != "-1") {
+        location.href=selSelectObject.options[selSelectObject.selectedIndex].value;
+    }
+}
+
+function unfold(id)
+{
+    document.getElementById(id).style.display = "none";
+    document.getElementById(id+"_detailed").style.display = "block";
+}
+
+function fold(id)
+{
+    document.getElementById(id+"_detailed").style.display = "none";
+    document.getElementById(id).style.display = "block";
+}
+
+function switch_to(id)
+{
+    set_cookie(id);
+    if (id == "cat") {
+        other = "alpha-tab";
+        left = "2";
+        right = "1";
+    } else { // id == "alpha"
+        other = "cat-tab";
+        left = "1";
+        right = "2";
+    }
+    id = id + "-tab";
+    var tab1 = document.getElementById(id);
+    var tab2 = document.getElementById(other);
+
+    tab1.style.borderTop    = "2px solid black";
+    tab1.style.borderLeft   = "2px solid black";
+    tab1.style.borderRight  = right+"px solid black";
+    tab1.style.borderBottom = "2px solid #EEEEEE";
+    tab2.style.borderTop    = "1px solid black";
+    tab2.style.borderLeft   = left+"px solid black";
+    tab2.style.borderRight  = "1px solid black";
+    tab2.style.borderBottom = "2px solid black";
+
+    tab1.style.fontWeight = "bold";
+    tab2.style.fontWeight = "normal";
+    
+    tab1.style.background = "#EEEEEC";
+    tab2.style.background = "transparent";
+}
+
+function switch_to_cat()
+{
+    switch_to("cat");
+    var d = document.getElementById("menu-contents");
+    d.innerHTML = '\
+    m4_include([[[doc/menu.include]]])';
+}
+
+function switch_to_alpha()
+{
+    switch_to("alpha");
+    var d = document.getElementById("menu-contents");
+    d.innerHTML = '\
+    m4_include([[[doc/alphabetic.include]]])';
+}
+
+function write_left_menu()
+{
+    // Only do this if we are running non-IE browsers
+    if (navigator.appVersion.indexOf('MSIE') == -1) {
+        menuhtml = '<div id="left-switcher">\
+                      <div class="tab" id="cat-tab" onclick="javascript:switch_to_cat()">\
+                        <a href="javascript:switch_to_cat();" style="text-decoration: none;">Categorical</a>\
+                      </div>\
+                      <div class="tab" id="alpha-tab" onclick="javascript:switch_to_alpha()">\
+                        <a href="javascript:switch_to_alpha();" style="text-decoration: none;">Alphabetical</a>\
+                      </div>\
+                      <div id="menu-contents" class="left-menu" style="position: fixed; overflow: auto;">\
+                      </div>\
+                    </div>';
+        var left_menu_span = document.getElementById("left-menu-span");
+        left_menu_span.innerHTML = menuhtml;
+        var cat_tab = document.getElementById("cat-tab");
+        var alpha_tab = document.getElementById("alpha-tab");
+        cat_tab.style.width = "7.5em";
+        cat_tab.style.position = "absolute";
+        cat_tab.style.bottom = "-4px";
+        alpha_tab.style.width = "7.5em";
+        alpha_tab.style.position = "absolute";
+        alpha_tab.style.bottom = "-4px";
+    } // end non-IE
+    var tab = get_cookie();
+    if (tab == "alpha") {
+        switch_to_alpha();
+    } else {
+        switch_to_cat();
+    }
+}
--- a/www/macros.m4	Sat Jan 27 19:22:31 2007 +0000
+++ b/www/macros.m4	Sun Jan 28 11:37:02 2007 +0000
@@ -9,6 +9,10 @@
 m4_dnl
 m4_dnl
 m4_dnl
+m4_define(`__CURRENT_DATE__', `m4_esyscmd(/bin/sh ./get_current_date.sh)')m4_dnl
+m4_dnl
+m4_dnl
+m4_dnl
 m4_define(`__BASE_ADDRESS__', `m4_esyscmd(/bin/sh ./get-base-address)')m4_dnl
 m4_define(`__TEXT_DIR__', `__BASE_ADDRESS__`text/'')m4_dnl
 m4_define(`__IMAGE_DIR__', `__BASE_ADDRESS__`images/'')m4_dnl
@@ -63,141 +67,12 @@
 m4_define(`__OCTAVE_FORGE_HTTP__',
        `<a href="__BASE_ADDRESS__/$1" class="menu">$2</a>')m4_dnl
 
-m4_changequote([[[, ]]])
-m4_define([[[__JAVA_SCRIPT_FIXED__]]],
- [[[<script type="text/javascript">
-  <!--
-  function fix_top_menu() {
-    if (navigator.appVersion.indexOf('MSIE') == -1) {
-      document.getElementById("top-menu").style.position = "fixed";
-    } // end non-IE
-  }
-  // -->
-  </script>]]])m4_dnl
+m4_define(`__JAVA_SCRIPT_FIXED__',
+  `<script src="__BASE_ADDRESS__/fixed.js" type="text/javascript"></script>') m4_dnl
 m4_dnl
-m4_define([[[__JAVA_SCRIPT__]]],
- [[[  __JAVA_SCRIPT_FIXED__
-  <script type="text/javascript">
-  <!--
-  var cookie_name = "octave_forge_cookie";
-  function set_cookie(val) {
-    if (document.cookie != document.cookie) {
-      index = document.cookie.indexOf(cookie_name);
-    } else {
-      index = -1;
-    }
-    if (index == -1) {
-      var cval = cookie_name + "=" + val + "; ";
-      var d = new Date();
-      d.setSeconds(d.getSeconds()+30);
-      cval = cval + "expires=" + d.toString() + ";";
-      document.cookie = cval;
-    }
-  }
-  function get_cookie() {
-    var retval = -1;
-    if (document.cookie) {
-      var index = document.cookie.indexOf(cookie_name);
-      if (index != -1) {
-        var start = document.cookie.indexOf("=", index) + 1;
-        stop = document.cookie.indexOf(";", start);
-        if (stop == -1) {
-          stop = document.cookie.length;
-        }
-        retval = document.cookie.substring(start, stop);
-      }
-    }
-    return retval;
-  }
-  function goto_url (selSelectObject) {
-    if (selSelectObject.options[selSelectObject.selectedIndex].value != "-1") {
-     location.href=selSelectObject.options[selSelectObject.selectedIndex].value;
-    }
-  }
-  function unfold(id) {
-    document.getElementById(id).style.display = "none";
-    document.getElementById(id+"_detailed").style.display = "block";
-  }
-  function fold(id) {
-    document.getElementById(id+"_detailed").style.display = "none";
-    document.getElementById(id).style.display = "block";
-  }
-  function switch_to(id) {
-    set_cookie(id);
-    if (id == "cat") {
-        other = "alpha-tab";
-        left = "2";
-        right = "1";
-    } else { // id == "alpha"
-        other = "cat-tab";
-        left = "1";
-        right = "2";
-    }
-    id = id + "-tab";
-    var tab1 = document.getElementById(id);
-    var tab2 = document.getElementById(other);
-
-    tab1.style.borderTop    = "2px solid black";
-    tab1.style.borderLeft   = "2px solid black";
-    tab1.style.borderRight  = right+"px solid black";
-    tab1.style.borderBottom = "2px solid #EEEEEE";
-    tab2.style.borderTop    = "1px solid black";
-    tab2.style.borderLeft   = left+"px solid black";
-    tab2.style.borderRight  = "1px solid black";
-    tab2.style.borderBottom = "2px solid black";
-
-    tab1.style.fontWeight = "bold";
-    tab2.style.fontWeight = "normal";
-    
-    tab1.style.background = "#EEEEEC";
-    tab2.style.background = "transparent";
-  }
-  function switch_to_cat() {
-    switch_to("cat");
-    var d = document.getElementById("menu-contents");
-    d.innerHTML = '\
-    m4_include([[[doc/menu.include]]])';
-  }
-  function switch_to_alpha() {
-    switch_to("alpha");
-    var d = document.getElementById("menu-contents");
-    d.innerHTML = '\
-    m4_include([[[doc/alphabetic.include]]])';
-  }
-  function write_left_menu() {
-    // Only do this if we are running non-IE browsers
-    if (navigator.appVersion.indexOf('MSIE') == -1) {
-      menuhtml = '<div id="left-switcher">\
-                    <div class="tab" id="cat-tab" onclick="javascript:switch_to_cat()">\
-                      <a href="javascript:switch_to_cat();" style="text-decoration: none;">Categorical</a>\
-                    </div>\
-                    <div class="tab" id="alpha-tab" onclick="javascript:switch_to_alpha()">\
-                      <a href="javascript:switch_to_alpha();" style="text-decoration: none;">Alphabetical</a>\
-                    </div>\
-                    <div id="menu-contents" class="left-menu" style="position: fixed; overflow: auto;">\
-                    </div>\
-                  </div>';
-      var left_menu_span = document.getElementById("left-menu-span");
-      left_menu_span.innerHTML = menuhtml;
-      var cat_tab = document.getElementById("cat-tab");
-      var alpha_tab = document.getElementById("alpha-tab");
-      cat_tab.style.width = "7.5em";
-      cat_tab.style.position = "absolute";
-      cat_tab.style.bottom = "-4px";
-      alpha_tab.style.width = "7.5em";
-      alpha_tab.style.position = "absolute";
-      alpha_tab.style.bottom = "-4px";
-    } // end non-IE
-    var tab = get_cookie();
-    if (tab == "alpha") {
-      switch_to_alpha();
-    } else {
-      switch_to_cat();
-    }
-  }
-  // -->
-  </script>]]])m4_dnl
-m4_changequote(`, ')
+m4_define(`__JAVA_SCRIPT__',
+  `__JAVA_SCRIPT_FIXED__
+   <script src="__BASE_ADDRESS__/javascript.js" type="text/javascript"></script>') m4_dnl
 m4_dnl
 m4_dnl
 m4_dnl
@@ -235,9 +110,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
   <head>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+  <meta name="date" content="__CURRENT_DATE__"/>
   <title>$1</title>
   <link rel="stylesheet" type="text/css" href="__BASE_ADDRESS__/octave-forge.css" />
   __JAVA_SCRIPT__
+  <link rel="shortcut icon" href="__BASE_ADDRESS__/favicon.ico" />
   </head>
   __BODY__
   __TOP_MENU__([[[$1]]])
@@ -249,10 +126,12 @@
   <html>
   <head>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+  <meta name="date" content="__CURRENT_DATE__">
   <title>$1</title>
   <link rel="stylesheet" type="text/css" href="__BASE_ADDRESS__/doxygen.css">
   <link rel="stylesheet" type="text/css" href="__BASE_ADDRESS__/octave-forge.css">
   __JAVA_SCRIPT_FIXED__
+  <link rel="shortcut icon" href="__BASE_ADDRESS__/favicon.ico">
   </head>
   __BODY__
   __TOP_MENU__([[[$1]]])
@@ -311,6 +190,7 @@
   <title>$1</title>
   <link rel="stylesheet" type="text/css" href="__BASE_ADDRESS__/octave-forge.css" />
   __JAVA_SCRIPT__
+  <link rel="shortcut icon" href="__BASE_ADDRESS__/favicon.ico" />
   </head>
   __DOC_BODY__
   __TOP_MENU__([[[$1]]])