From a6852eb2b2005d2a7b14c48701e44c39c74d4481 Mon Sep 17 00:00:00 2001
From: sebastian <sebastian@cfc7b370-4200-0410-a6e3-cb6bdb053afe>
Date: Thu, 10 Feb 2005 14:03:50 +0000
Subject: [PATCH] *** empty log message ***

---
 .../htmlUI/var/SmartyExtensions.inc.php       |  20 ++--
 livesupport/modules/htmlUI/var/conf.php       |   2 +-
 .../modules/htmlUI/var/html/Smarty/ChangeLog  |   2 +-
 .../html/Smarty/libs/Config_File.class.php    |   2 +-
 .../var/html/Smarty/libs/Smarty.class.php     |   2 +-
 .../Smarty/libs/Smarty_Compiler.class.php     |   2 +-
 .../examples/smarty-dynamic-fancygroup.tpl    |   2 +-
 .../examples/smarty-dynamic-green.tpl         |   2 +-
 .../templates/examples/smarty-dynamic.tpl     |   2 +-
 .../htmlUI/var/html/templates/masterpanel.tpl |   4 +
 .../html/templates/popup/_reload_parent.tpl   |   4 +-
 .../htmlUI/var/html/templates/scratchpad.tpl  |  19 ++++
 .../var/html/templates/script/basics.js.tpl   |   3 +
 .../htmlUI/var/html/templates/search.tpl      |   1 +
 .../var/html/templates/smarty-static.tpl      |   2 +-
 .../htmlUI/var/html/templates/styles.css      |   8 ++
 .../modules/htmlUI/var/html/ui_browser.php    |   7 +-
 .../modules/htmlUI/var/html/ui_handler.php    |   4 +
 .../modules/htmlUI/var/ui_base.inc.php        | 105 ++++++++++++++++++
 .../modules/htmlUI/var/ui_browser.class.php   |  25 +----
 .../modules/htmlUI/var/ui_browser_init.php    |  14 ++-
 .../modules/htmlUI/var/ui_handler.class.php   |  21 ++--
 .../modules/htmlUI/var/ui_handler_init.php    |   2 +-
 23 files changed, 197 insertions(+), 58 deletions(-)
 create mode 100644 livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl

diff --git a/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php b/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php
index 3abd46f51..a13c32b90 100644
--- a/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php
+++ b/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php
@@ -1,7 +1,12 @@
 <?php
-## some constants ########################
-$Smarty->assign('UI_BROWSER', UI_BROWSER);
-$Smarty->assign('UI_HANDLER', UI_HANDLER);
+$Smarty->register_object('uiBrowser', $uiBrowser);
+
+$Smarty->register_function('str_repeat', 'S_str_repeat');
+$Smarty->register_function('urlencode',  'S_urlencode');
+$Smarty->register_function('htmlspecialchars', 'S_htmlspecialchars');
+$Smarty->register_function('system', 'S_system');
+$Smarty->register_function('tra', 'S_tra');
+
 
 // --- Smarty Extensions ---
 /**
@@ -19,7 +24,7 @@ function S_str_repeat($param)
     return str_repeat($str, intval($count));
 
 }
-$Smarty->register_function('str_repeat', 'S_str_repeat');
+
 
  /**
  *  urlencode
@@ -34,7 +39,7 @@ function S_urlencode($param)
     extract($param);
     return urlencode($str);
 }
-$Smarty->register_function('urlencode',  'S_urlencode');
+
 
 /**
  *  htmlspecialchars
@@ -49,7 +54,7 @@ function S_htmlspecialchars($param)
     extract($param);
     return htmlspecialchars($str);
 }
-$Smarty->register_function('htmlspecialchars', 'S_htmlspecialchars');
+
 
 /**
  *  system
@@ -63,7 +68,7 @@ function S_system($param)
     extract($param);
     eval($code);
 }
-$Smarty->register_function('system', 'S_system');
+
 
 /**
  *  tra
@@ -78,5 +83,4 @@ function S_tra($param)
 
     echo $uiBrowser->tra($param[0], $param[1], $param[2], $param[3], $param[4], $param[5], $param[6], $param[7], $param[8], $param[9]);
 }
-$Smarty->register_function('tra', 'S_tra');
 ?>
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php
index 3823a44b1..fbd289961 100644
--- a/livesupport/modules/htmlUI/var/conf.php
+++ b/livesupport/modules/htmlUI/var/conf.php
@@ -23,7 +23,7 @@
 
 
     Author   : $Author: sebastian $
-    Version  : $Revision: 1.5 $
+    Version  : $Revision: 1.6 $
     Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $
 
 ------------------------------------------------------------------------------*/
diff --git a/livesupport/modules/htmlUI/var/html/Smarty/ChangeLog b/livesupport/modules/htmlUI/var/html/Smarty/ChangeLog
index 39a239636..d4ce4d935 100644
--- a/livesupport/modules/htmlUI/var/html/Smarty/ChangeLog
+++ b/livesupport/modules/htmlUI/var/html/Smarty/ChangeLog
@@ -2979,7 +2979,7 @@
 
     * libs/Smarty.class.php
       libs/Smarty_Compiler.class.php:
-      added CVS $Id: ChangeLog,v 1.4 2005/02/09 16:50:18 sebastian Exp $
+      added CVS $Id: ChangeLog,v 1.5 2005/02/10 14:03:50 sebastian Exp $
 
 2003-03-31  Messju Mohr  <messju@lammfellpuschen.de>
 
diff --git a/livesupport/modules/htmlUI/var/html/Smarty/libs/Config_File.class.php b/livesupport/modules/htmlUI/var/html/Smarty/libs/Config_File.class.php
index 9713a239c..1ada6aa46 100644
--- a/livesupport/modules/htmlUI/var/html/Smarty/libs/Config_File.class.php
+++ b/livesupport/modules/htmlUI/var/html/Smarty/libs/Config_File.class.php
@@ -25,7 +25,7 @@
  * @package Smarty
  */
 
-/* $Id: Config_File.class.php,v 1.4 2005/02/09 16:50:18 sebastian Exp $ */
+/* $Id: Config_File.class.php,v 1.5 2005/02/10 14:03:50 sebastian Exp $ */
 
 /**
  * Config file reading class
diff --git a/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty.class.php b/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty.class.php
index 77a37c5b1..5743b5431 100644
--- a/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty.class.php
+++ b/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty.class.php
@@ -30,7 +30,7 @@
  * @version 2.6.6
  */
 
-/* $Id: Smarty.class.php,v 1.4 2005/02/09 16:50:18 sebastian Exp $ */
+/* $Id: Smarty.class.php,v 1.5 2005/02/10 14:03:50 sebastian Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
diff --git a/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty_Compiler.class.php b/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty_Compiler.class.php
index 137a4a64a..c9eabd0d1 100644
--- a/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty_Compiler.class.php
+++ b/livesupport/modules/htmlUI/var/html/Smarty/libs/Smarty_Compiler.class.php
@@ -26,7 +26,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.4 2005/02/09 16:50:18 sebastian Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.5 2005/02/10 14:03:50 sebastian Exp $ */
 
 /**
  * Template compiling class
diff --git a/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-fancygroup.tpl b/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-fancygroup.tpl
index e52e96f6c..b9124fd82 100644
--- a/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-fancygroup.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-fancygroup.tpl
@@ -1,4 +1,4 @@
-<!--  $Id: smarty-dynamic-fancygroup.tpl,v 1.4 2005/02/09 16:50:18 sebastian Exp $ -->
+<!--  $Id: smarty-dynamic-fancygroup.tpl,v 1.5 2005/02/10 14:03:50 sebastian Exp $ -->
 
 <tr>
     <td valign="top" align="right">
diff --git a/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-green.tpl b/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-green.tpl
index 973641baa..bc25a9fb0 100644
--- a/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-green.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic-green.tpl
@@ -1,4 +1,4 @@
-<!--  $Id: smarty-dynamic-green.tpl,v 1.4 2005/02/09 16:50:18 sebastian Exp $ -->
+<!--  $Id: smarty-dynamic-green.tpl,v 1.5 2005/02/10 14:03:50 sebastian Exp $ -->
 
 <tr>
     <td align="right" valign="top" class="green"><b>{$element.label}:</b></td>
diff --git a/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic.tpl b/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic.tpl
index 182c5ff54..49b124880 100644
--- a/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/examples/smarty-dynamic.tpl
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<!--  $Id: smarty-dynamic.tpl,v 1.4 2005/02/09 16:50:18 sebastian Exp $ -->
+<!--  $Id: smarty-dynamic.tpl,v 1.5 2005/02/10 14:03:50 sebastian Exp $ -->
 <html>
 <head>
     <title>Smarty template for Array renderer</title>
diff --git a/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl b/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl
index 7b2a921b2..a432f02cc 100644
--- a/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl
@@ -7,6 +7,10 @@
     {include file="menu_top.tpl"}
 {/if}
 
+{if $showSP}
+    {include file="scratchpad.tpl"}
+{/if}
+
 {if $showPath}
     {include file="path.tpl"}
 {/if}
diff --git a/livesupport/modules/htmlUI/var/html/templates/popup/_reload_parent.tpl b/livesupport/modules/htmlUI/var/html/templates/popup/_reload_parent.tpl
index 73898a7fb..b5884b830 100644
--- a/livesupport/modules/htmlUI/var/html/templates/popup/_reload_parent.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/popup/_reload_parent.tpl
@@ -1,4 +1,4 @@
 <script type="text/javascript">
-    //opener.location.reload();
-    opener.location.href="{$UI_BROWSER}";
+    opener.location.reload();
+    //opener.location.href="{$UI_BROWSER}";
 </script>
diff --git a/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl b/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl
new file mode 100644
index 000000000..c02fac660
--- /dev/null
+++ b/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl
@@ -0,0 +1,19 @@
+{*Smarty template*}
+
+<div id="scratchpad">
+<center><b>ScratchPad</b></center>
+
+{if is_array($sp)}
+    <table>
+    <tr><th></th><th>{tra 0=Name}</th><th>{tra 0=Duration}</th><th>{tra 0=Type}</th></tr>
+    {foreach from=$sp item=i}
+        <tr>
+            <td><input type="checkbox" name="spid[{$row.id}]"></td>
+            <td>{$i.name}</td>
+            <td>{$i.duration}</td>
+            <td>{$i.type} </td>
+        </tr>
+    {/foreach}
+    </table>
+{/if}
+</div>
diff --git a/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl b/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl
index 4a6faacf5..b7d24681a 100644
--- a/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl
@@ -43,7 +43,10 @@
      }
      {/literal}
 
+     {uiBrowser->alertMsg assign='alertMsg'}
      {if $alertMsg}
         alert('{$alertMsg}');
      {/if}
+
+
 </script>
diff --git a/livesupport/modules/htmlUI/var/html/templates/search.tpl b/livesupport/modules/htmlUI/var/html/templates/search.tpl
index e8e0e043b..06e4cbbdf 100644
--- a/livesupport/modules/htmlUI/var/html/templates/search.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/search.tpl
@@ -27,6 +27,7 @@
             <div style="background-color: {cycle values='#eeeeee, #dadada'}">{$s.gunid}
                 <a href="{$UI_BROWSER}?act=getMdata&id={$s.par_id}">[XML]</a>
                 <a href="{$UI_BROWSER}?act=editMetaDataValues&id={$s.par_id}">[Form]</a>
+                <a href="#" onClick="popup('{$UI_HANDLER}?act=add2SP&id={$s.par_id}', '2SP', 1, 1)">[SP]</a>
             </div>
         {/foreach}
     {else}
diff --git a/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl b/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl
index 125d8bdcc..e84454015 100644
--- a/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<!--  $Id: smarty-static.tpl,v 1.5 2005/02/09 16:50:18 sebastian Exp $ -->
+<!--  $Id: smarty-static.tpl,v 1.6 2005/02/10 14:03:50 sebastian Exp $ -->
 <html>
 <head>
     <title>Smarty template for ArraySmarty renderer: 2 column layout example</title>
diff --git a/livesupport/modules/htmlUI/var/html/templates/styles.css b/livesupport/modules/htmlUI/var/html/templates/styles.css
index ba69c5673..ebae7afbf 100644
--- a/livesupport/modules/htmlUI/var/html/templates/styles.css
+++ b/livesupport/modules/htmlUI/var/html/templates/styles.css
@@ -49,6 +49,14 @@
     margin-top: 10px;
 }
 
+#scratchpad {
+    text-align: center;
+    width: 800px;
+    border-style : dotted;
+    padding : 5px;
+    margin-top: 10px;
+}
+
 #path {
     text-align: center;
     width: 800px;
diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php
index fdcd80e11..c4bf8865b 100644
--- a/livesupport/modules/htmlUI/var/html/ui_browser.php
+++ b/livesupport/modules/htmlUI/var/html/ui_browser.php
@@ -31,7 +31,6 @@ if (is_array($_REQUEST['popup'])){
                 $Smarty->assign('loginform', $uiBrowser->loginform($Smarty, $ui_fmask));
                 $Smarty->display('popup/login.tpl');
             break;
-
         }
     }
     die();
@@ -42,6 +41,9 @@ $Smarty->assign('statusbar', $uiBrowser->getStationInfo($ui_fmask['systemPrefs']
 
 if ($uiBrowser->userid) {
   $Smarty->assign('showMenuTop', TRUE);
+  $Smarty->assign('sp', $uiBrowser->getSP());
+  $Smarty->assign('showSP', TRUE);
+
   switch ($_REQUEST['act']){
     default:
         $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
@@ -150,6 +152,7 @@ if ($uiBrowser->userid) {
     break;
   }
 }
- 
+#$Smarty->load_filter('output', 'trimwhitespace');
+#$Smarty->register_outputfilter('smarty_outputfilter_trimwhitespace');
 $Smarty->display('main.tpl');
 ?>
diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php
index 9df9896b1..90dce9fee 100644
--- a/livesupport/modules/htmlUI/var/html/ui_handler.php
+++ b/livesupport/modules/htmlUI/var/html/ui_handler.php
@@ -87,6 +87,10 @@ switch($_REQUEST['act']){
         $uiHandler->storeMetaData($_REQUEST, $ui_fmask["mData"]);
     break;
 
+    case "add2SP":
+        $uiHandler->add2SP($uiHandler->id);
+    break;
+
     default:
         $_SESSION["alertMsg"] = $uiHandler->tra("Unknown method: ").$_REQUEST["act"];
         header("Location: ".UI_BROWSER);
diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php
index b491a3953..71249c3b7 100644
--- a/livesupport/modules/htmlUI/var/ui_base.inc.php
+++ b/livesupport/modules/htmlUI/var/ui_base.inc.php
@@ -16,6 +16,35 @@ function errCallBack($err)
  */
 class uiBase
 {
+    // --- class constructor ---
+    /**
+     *  uiBase
+     *
+     *  Initialize a new Basis Class including:
+     *  - database  initialation
+     *  - GreenBox initialation
+     *
+     *  @param $config array, configurartion data
+     */
+    function uiBase(&$config)
+    {
+        $dbc = DB::connect($config['dsn'], TRUE);
+        if (DB::isError($dbc)) {
+            die($dbc->getMessage());
+        }
+        $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
+        $this->gb =& new GreenBox(&$dbc, $config);
+        $this->sessid = $_REQUEST[$config['authCookieName']];
+        $this->userid = $this->gb->getSessUserId($this->sessid);
+        $this->login  = $this->gb->getSessLogin($this->sessid);
+        $this->id =  $_REQUEST['id'] ? $_REQUEST['id'] : $this->gb->getObjId($this->login, $this->gb->storId);
+        $this->InputTextStandardAttrib = array('size'     =>UI_INPUT_STANDARD_SIZE,
+                                               'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH);
+
+
+
+    }
+
     // --- basic funtionality ---
     /**
      *  tra
@@ -219,5 +248,81 @@ class uiBase
 
         return $arr;
     }
+
+
+    function getSP()
+    {
+        $spData = $this->gb->loadPref($this->sessid, 'scratchPadContents');
+        if (!PEAR::isError($spData)) {
+            $arr = explode(' ', $spData);
+            foreach($arr as $val) {
+                $pieces = explode(':', $val);
+                $filedata = $this->getFileInfo($pieces[0]);
+                $res[] = array('id'         => $pieces[0],
+                               #'added'      => $pieces[1],
+                               'name'       => $filedata['name'],
+                               'duration'   => $filedata['playtime_string']
+                         );
+            }
+
+            return ($res);
+        } else {
+            return FALSE;
+        }
+    }
+
+    function saveSP($data)
+    {
+        foreach($data as $val) {
+            $str .= $val['id'].':'.$val['added'].' ';
+        }
+
+        $this->gb->savePref($this->sessid, 'scratchPadContents', trim($str));
+    }
+
+    function add2SP($id)
+    {
+        if ($sp = $this->getSP()) {
+            foreach ($sp as $val) {
+                if ($val['id'] == $id) $exists = TRUE;
+            }
+        }
+
+        if(!$exists) {
+            $sp[] = array('id'      => $id,
+                          'added'   => date('Y-m-d')
+                    );
+            $this->saveSP($sp);
+            $this->_retmsg('Entry $1 added', $id);
+        } else {
+            $this->_retmsg('Entry $1 already exists', $id);
+        }
+
+        $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
+    }
+
+    function _retmsg($msg, $p1=NULL, $p2=NULL, $p3=NULL, $p4=NULL, $p5=NULL, $p6=NULL, $p7=NULL, $p8=NULL, $p9=NULL)
+    {
+        $_SESSION['alertMsg'] = $this->tra($msg, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9);
+    }
+
+
+    function getFileName($id)
+    {
+        $file = array_pop($this->gb->getPath($id));
+        return $file['name'];
+    }
+
+    function getFileInfo($id)
+    {
+        $f = $this->gb->analyzeFile($id, $this->sessid); 
+        return array(
+                    'name'              => $this->getFileName($id),
+                    'type'              => 0,
+                    'filename'          => $f['filename'],
+                    'playtime_seconds'  => $f['playtime_seconds'],
+                    'playtime_string'   => $f['playtime_string']
+                );
+    }
 }
 ?>
diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php
index 3dcc28ffa..ce9616a47 100644
--- a/livesupport/modules/htmlUI/var/ui_browser.class.php
+++ b/livesupport/modules/htmlUI/var/ui_browser.class.php
@@ -6,29 +6,14 @@ class uiBrowser extends uiBase {
     /**
      *  uiBrowser
      *
-     *  Initialize a new Browser Class including:
-     *  - database  initialation
-     *  - GreenBox initialation
+     *  Initialize a new Browser Class
+     *  Call uiBase constructor
      *
      *  @param $config array, configurartion data
      */
-    function uiBrowser($config)
+    function uiBrowser(&$config)
     {
-        $dbc = DB::connect($config['dsn'], TRUE);
-        if (DB::isError($dbc)) {
-            die($dbc->getMessage());
-        }
-        $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
-        $this->gb =& new GreenBox(&$dbc, $config);
-        $this->sessid = $_REQUEST[$config['authCookieName']];
-        $this->userid = $this->gb->getSessUserId($this->sessid);
-        $this->login  = $this->gb->getSessLogin($this->sessid);
-        $this->id =  $_REQUEST['id'] ? $_REQUEST['id'] : $this->gb->getObjId($this->login, $this->gb->storId);
-        $this->InputTextStandardAttrib = array('size'     =>UI_INPUT_STANDARD_SIZE,
-                                               'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH);
-
-
-
+        $this->uiBase($config);
     }
 
     // --- error handling ---
@@ -307,7 +292,7 @@ class uiBrowser extends uiBase {
      */
     function getSearchForm($id, &$formdata, &$mask)
     {
-        $form = new HTML_QuickForm('search', UI_STANDARD_FORM_METHOD, UI_BROWSER);
+        $form = new HTML_QuickForm('search', 'get', UI_BROWSER);
         $form->setConstants(array('id'=>$id, 'counter'=>($formdata['counter'] ? $formdata['counter'] : UI_SEARCH_MIN_ROWS)));
 
         foreach ($mask['mData']['tabs']['group']['group'] as $k=>$v) {
diff --git a/livesupport/modules/htmlUI/var/ui_browser_init.php b/livesupport/modules/htmlUI/var/ui_browser_init.php
index 3ec3244ac..87613f123 100644
--- a/livesupport/modules/htmlUI/var/ui_browser_init.php
+++ b/livesupport/modules/htmlUI/var/ui_browser_init.php
@@ -20,20 +20,22 @@ PEAR::setErrorHandling(PEAR_ERROR_RETURN);
 #PEAR::setErrorHandling(PEAR_ERROR_PRINT);
 
 // some global vars/objects
-$Smarty = new Smarty;
-require_once  dirname(__FILE__).'/SmartyExtensions.inc.php';
+$Smarty    = new Smarty;
 $uiBrowser = new uiBrowser($config);
-$uiBase    = new uiBase();
+$uiBase    = new uiBase($config);
 
-## some basic things
-$Smarty->assign('alertMsg', $uiBrowser->alertMsg());
+require_once  dirname(__FILE__).'/SmartyExtensions.inc.php';
+
+## some basic things ################################################
+$Smarty->assign('UI_BROWSER', UI_BROWSER);
+$Smarty->assign('UI_HANDLER', UI_HANDLER);
 $Smarty->assign('GLOBALS', array_merge($GLOBALS, array('id' => &$uiBrowser->id)));  ## ??? really all GLOBALS ??? ##
 $Smarty->assign('user', array('sessid' => &$uiBrowser->sessid,
                               'userid' => &$uiBrowser->userid,
                               'login'  => &$uiBrowser->login
                         )
                 );
-## retransfer incomplete formdata from SESSION to POST-data
+## retransfer incomplete formdata from SESSION to POST-data #########
 if(is_array($_SESSION['retransferFormData'])){
     foreach($_SESSION['retransferFormData'] as $k=>$v){
         $_POST[$k] = $v;
diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php
index 7582bf707..efd49f5ce 100644
--- a/livesupport/modules/htmlUI/var/ui_handler.class.php
+++ b/livesupport/modules/htmlUI/var/ui_handler.class.php
@@ -8,16 +8,18 @@ class uiHandler extends uiBase {
     var $redirUrl;
     var $alertMsg;
 
-    function uiHandler($config)
+    // --- class constructor ---
+    /**
+     *  uiBrowser
+     *
+     *  Initialize a new Browser Class
+     *  Call uiBase constructor
+     *
+     *  @param $config array, configurartion data
+     */
+    function uiHandler(&$config)
     {
-        $dbc = DB::connect($config['dsn'], TRUE);
-        $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
-        $this->gb =& new GreenBox(&$dbc, $config);
-        $this->id = (!$_REQUEST['id'] ? $this->gb->storId : $_REQUEST['id']);
-        $this->sessid = $_REQUEST[$config['authCookieName']];
-        $this->userid = $this->gb->getSessUserId($this->sessid);
-        $this->login  = $this->gb->getSessLogin ($this->sessid);
-        $this->config = $config;
+        $this->uiBase($config);
     }
 
     // --- authentication ---
@@ -517,7 +519,6 @@ class uiHandler extends uiBase {
 
         return FALSE;
     }
-
 }
 
 ?>
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/ui_handler_init.php b/livesupport/modules/htmlUI/var/ui_handler_init.php
index 9262cba57..a436f2abc 100644
--- a/livesupport/modules/htmlUI/var/ui_handler_init.php
+++ b/livesupport/modules/htmlUI/var/ui_handler_init.php
@@ -17,7 +17,7 @@ PEAR::setErrorHandling(PEAR_ERROR_RETURN);
 #PEAR::setErrorHandling(PEAR_ERROR_PRINT);
 
 $uiHandler = new uiHandler($config);
-$uiBase    = new uiBase();
+$uiBase    = new uiBase($config);
 
 require_once dirname(__FILE__).'/ui_fmask.inc.php';
 ?>