[Mapbender-commits] r1695 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Oct 2 08:44:05 EDT 2007
Author: christoph
Date: 2007-10-02 08:44:05 -0400 (Tue, 02 Oct 2007)
New Revision: 1695
Modified:
trunk/mapbender/http/javascripts/mod_tab.php
Log:
class based refactoring
Modified: trunk/mapbender/http/javascripts/mod_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_tab.php 2007-10-02 12:39:45 UTC (rev 1694)
+++ trunk/mapbender/http/javascripts/mod_tab.php 2007-10-02 12:44:05 UTC (rev 1695)
@@ -20,14 +20,14 @@
/********** Configuration*************************************************/
$gui_id = $_REQUEST["gui_id"];
-$e_id_css = 'tabs';
-$e_id = 'tabs';
-include(dirname(__FILE__).'/../extensions/JSON.php');
-require_once(dirname(__FILE__).'/../classes/class_mb_exception.php');
-include(dirname(__FILE__).'/../include/dyn_js.php');
+$e_id_css = "tabs";
+$e_id = "tabs";
+include(dirname(__FILE__)."/../extensions/JSON.php");
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+include(dirname(__FILE__)."/../include/dyn_js.php");
$tab_ids = array();
-include(dirname(__FILE__).'/../include/dyn_php.php');
+include(dirname(__FILE__)."/../include/dyn_php.php");
echo "var tab_titles = [];\n";
@@ -46,138 +46,6 @@
$e = new mb_exception("tab_ids" . $output);
echo "var tab_ids = " . $output . ";";
-?>
-var tab_height = false;
-var tab_width = false;
-var tab_topOffset = false;
-var tab_leftOffset = false;
-var tab_active = -1;
-var tab_check = new Array();
-var tab_iv1 = false;
-var tab_wait = false;
-
-try{
- if (open_tab){}
-}
-catch(e){
- open_tab = false;
-}
-
-/********** Configuration*************************************************/
-mb_registerInitFunctions('tab_init()');
-function tab_init(){
- var obj = document.getElementById("tabs").style;
- tab_topOffset = parseInt(obj.top);
- tab_leftOffset = parseInt(obj.left);
- tab_width = parseInt(obj.width);
- tab_height = parseInt(obj.height);
- var str = "";
-
- for(var i = 0; i<tab_ids.length; i++){
- document.getElementById(tab_ids[i]).style.visibility = 'hidden';
- tab_titles[i] = tab_prefix + tab_titles[i];
- var newId = "tab_" + i;
- str += "<div id='"+newId+"' ";
- str += "style='";
- str += tab_style;
- str += "width:"+tab_width+"px;";
- str += "height:"+tab_height+"px;";
- str += "top:" + ((i * tab_height)) + "px;";
- str += "'";
- str += " onclick='tab_set("+i+")'>";
- str += tab_titles[i];
- str += "</div>";
- }
- document.getElementById("tabs").innerHTML = str;
-
- if (open_tab != 'false'){
- tab_set(open_tab);
- }
-}
-function tab_set(ind){
- if(tab_wait){
- return;
- }
- tab_unsetFrame();
- if(ind == tab_active){
- tab_wait = true;
- tab_active = -1;
- tab_check = new Array();
- tab_iv1 = setInterval("tab_move("+tab_active+")",1);
- return;
- }
- else{
- tab_wait = true;
- tab_active = ind;
- tab_check = new Array();
- tab_iv1 = setInterval("tab_move("+tab_active+")",1);
- return;
- }
-}
-function tab_setFrame(ind){
- for(var i = 0; i<tab_ids.length; i++){
- if(i == ind){
- var obj = document.getElementById(tab_ids[i]).style;
- var newpos = ((i+1) * tab_height) + parseInt(tab_topOffset);
- obj.top = (newpos + 1) + "px";
- obj.left = (tab_leftOffset) + "px";
- obj.width = tab_width;
- obj.height = (parseInt(tab_frameHeight[ind]) - 2);
- obj.visibility = 'visible';
- }
- }
-}
-function tab_unsetFrame(){
- for(var i = 0; i<tab_ids.length; i++){
- var obj = document.getElementById(tab_ids[i]).style;
- obj.visibility = 'hidden';
- }
-}
-function tab_open(tabid){
- var t = false;
- for(var i = 0; i<tab_ids.length; i++){
- if(tab_ids[i] == tabid){
- t = i;
- }
- }
- if(tab_active != t){
- tab_set(t);
- }
-}
-function tab_move(ind){
- for(var i = 0; i<tab_ids.length; i++){
- var newpos = (i * tab_height);
- if(i > ind && tab_active >= 0){
- newpos += parseInt(tab_frameHeight[ind]);
- }
- var myid = "tab_" + i;
- var pos = parseInt(document.getElementById(myid).style.top);
- if(pos == newpos){
- tab_check[i] = true;
- }
- else if(pos < newpos){
- document.getElementById(myid).style.top = (pos + 10) + "px";
- tab_check[i] = false;
- }
- else if(pos > newpos){
- document.getElementById(myid).style.top = (pos - 10) + "px";
- tab_check[i] = false;
- }
- }
-
- var check = true;
- for(var j=0; j<tab_check.length; j++){
- if(tab_check[j] == false){
- check = false;
- }
- }
- if(check == true){
- clearInterval(tab_iv1);
- tab_check = new Array();
- tab_wait = false;
- if(ind >= 0){
- tab_setFrame(ind);
- }
- return;
- }
-}
\ No newline at end of file
+include(dirname(__FILE__)."/../javascripts/style.js");
+include("mod_tab.js");
+?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list