[prev in list] [next in list] [prev in thread] [next in thread] 

List:       os-sim-commits
Subject:    [Os-sim-commits] os-sim/www/panel panel.php,1.4,1.5
From:       "Tomas V.V.Cox" <tvvcox () users ! sourceforge ! net>
Date:       2006-04-20 17:32:42
Message-ID: E1FWd1H-0004KS-44 () mail ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/os-sim/os-sim/www/panel
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5699/www/panel

Modified Files:
	panel.php 
Log Message:
Added panel geom options

Index: panel.php
===================================================================
RCS file: /cvsroot/os-sim/os-sim/www/panel/panel.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- panel.php	20 Apr 2006 12:24:50 -0000	1.4
+++ panel.php	20 Apr 2006 17:32:40 -0000	1.5
@@ -5,6 +5,7 @@
  * - Add options for Window contents update frecuency
  * - Config options for plugins and panel configs location
  * - Export/import plugin for easily exchange config
+ * - Add a "loading" icon/label (gmail style)
  */
 $plugins_dir = array('../../include/panel/plugins'); // XXX make configure options for this
 $configs_dir = '/tmp/ossim_config';                  // XXX make configure options for this
@@ -18,19 +19,34 @@
 //
 // Detect if that's an AJAX call
 //
-if (GET('interface') == 'ajax' && GET('ajax_method') == 'showWindowContents') {
-    $ajax = &new Window_Panel_Ajax($plugins_dir, $configs_dir);
-    $options = $ajax->loadConfig(GET('id'));
-    if (count($options)) {
-        $data['CONTENTS'] = $ajax->showWindowContents($options);
-        $data['TITLE']    = $options['window_title'];
-    } else { // New window
-        $data['CONTENTS'] = '';
-        $data['TITLE']    = _("New window");
+if (GET('interface') == 'ajax') {
+    if (GET('ajax_method') == 'showWindowContents') {
+        $ajax = &new Window_Panel_Ajax($plugins_dir, $configs_dir);
+        $options = $ajax->loadConfig(GET('id'));
+        if (count($options)) {
+            $data['CONTENTS'] = $ajax->showWindowContents($options);
+            $data['TITLE']    = $options['window_title'];
+        } else { // New window
+            $data['CONTENTS'] = '';
+            $data['TITLE']    = _("New window");
+        }
+        $data['ID'] = GET('id');
+        echo $ajax->parseTemplate('./window_tpl.htm', $data);
+    } elseif (GET('ajax_method') == 'savePanelConfig') {
+        $ajax = &new Window_Panel_Ajax($plugins_dir, $configs_dir);
+        $config['rows'] = GET('rows') ? GET('rows') : 3;
+        $config['cols'] = GET('cols') ? GET('cols') : 2;
+        $ajax->saveConfig('panel', $config);
     }
-    $data['ID'] = GET('id');
-    echo $ajax->parseTemplate('./window_tpl.htm', $data);
     exit;
+// 
+// Load Panel settings from config
+//
+} else {
+    $ajax = &new Window_Panel_Ajax($plugins_dir, $configs_dir);
+    $options = $ajax->loadConfig();
+    $rows = isset($options['panel']['rows']) ? $options['panel']['rows'] : 3;
+    $cols = isset($options['panel']['cols']) ? $options['panel']['cols'] : 2;
 }
 ?>
 <html>
@@ -59,21 +75,32 @@
   
 </head>
 <body>
-<small><?=_("Panel config")?>: <a href="#" onClick=""></small>
+<small>
+    <?=_("Panel config")?>:
+    <?=_("Geom")?>: <input id="rows" type="text" size="2" value="<?=$rows?>">x
+    <input id="cols" type="text" size="2" value="<?=$cols?>">
+    <a href="#" onClick="javascript:
+        panel_save($('rows').value, $('cols').value);
+        panel_load($('rows').value, $('cols').value);
+        "><?=_("Apply")?></a>
+</small>
+<!-- displays saveConfig errors -->
+<div id="container" style="margin: 0px; padding: 0px"></div>
 <br>
 
 <div id="placehere">
 Ossim Panel Loading...
 </div>
 
-<div id="container" style="display: none"></div>
+<!-- do nothing, Ajax.Updater in ajax_load() needs an element -->
+<div id="null" style="display: none"></div>
 
 <script>
 function ajax_load(id)
 {
     ajax_url = '<?=$_SERVER['PHP_SELF']?>?interface=ajax&ajax_method=showWindowContents&id='+id;
     new Ajax.Updater (
-        'container',  // Element to refresh
+        'null',  // Element to refresh
         ajax_url, // URL
         {          // options
             method: 'get',
@@ -85,20 +112,46 @@
     );
     return false;
 }
-Control.Panel.setOptions(
-    {rows: 4,
-     cols: 2,
-     posWidth: 620,
-     posHeight: 300,
-     posClass: 'panel-position',
-     posHoverClass: 'panel-active'
-     }
-);
-Control.Panel.drawGrid($('placehere'));
-ajax_load('1x1');
-ajax_load('1x2');
-ajax_load('1x3');
-ajax_load('1x4');
+
+function panel_save(rows, cols)
+{
+    ajax_url = '<?=$_SERVER['PHP_SELF']?>?interface=ajax&ajax_method=savePanelConfig';
+    new Ajax.Updater (
+        'container',  // Element to refresh
+        ajax_url, // URL
+        {          // options
+            method: 'get',
+            asynchronous: true,
+            parameters: 'rows='+rows+'&cols='+cols,
+            onComplete: function(req) {
+                $('container').innerHTML = req.responseText;
+            }
+        }
+    );
+    return false;
+}
+
+function panel_load(rows, cols)
+{
+    Control.Panel.setOptions(
+        {rows: rows,
+         cols: cols,
+         posWidth: 620,
+         posHeight: 300,
+         posClass: 'panel-position',
+         posHoverClass: 'panel-active'
+         }
+    );
+    Control.Panel.drawGrid($('placehere'));
+    for (i=1; i <= cols; i++) {
+        for (j=1; j <= rows; j++) {
+            var win_id = i+'x'+j;
+            ajax_load(win_id);
+        }
+    }
+}
+
+panel_load(<?=$rows?>, <?=$cols?>)
 </script>
 
 </body></html>



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Os-sim-commits mailing list
Os-sim-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/os-sim-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic