fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7552] Adding a new module


From: Torstein
Subject: [Fmsystem-commits] [7552] Adding a new module
Date: Mon, 05 Sep 2011 06:29:38 +0000

Revision: 7552
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7552
Author:   vator
Date:     2011-09-05 06:29:33 +0000 (Mon, 05 Sep 2011)
Log Message:
-----------
Adding a new module

Added Paths:
-----------
    trunk/controller/
    trunk/controller/inc/
    trunk/controller/inc/class.menu.inc.php
    trunk/controller/inc/class.socommon.inc.php
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.soprocedure.inc.php
    trunk/controller/inc/class.uicommon.inc.php
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/controller/inc/model/
    trunk/controller/inc/model/class.check_item.inc.php
    trunk/controller/inc/model/class.control.inc.php
    trunk/controller/inc/model/class.model.inc.php
    trunk/controller/inc/model/class.procedure.inc.php
    trunk/controller/inc/model/class.schedule.inc.php
    trunk/controller/index.php
    trunk/controller/js/
    trunk/controller/setup/
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/setup/setup.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/setup/tables_update.inc.php
    trunk/controller/templates/
    trunk/controller/templates/base/
    trunk/controller/templates/base/common.php
    trunk/controller/templates/base/control.php
    trunk/controller/templates/base/css/
    trunk/controller/templates/base/css/base.css
    trunk/controller/templates/base/property_location_partial.php

Added: trunk/controller/inc/class.menu.inc.php
===================================================================
--- trunk/controller/inc/class.menu.inc.php                             (rev 0)
+++ trunk/controller/inc/class.menu.inc.php     2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,52 @@
+<?php
+       class controller_menu
+       {
+               function get_menu()
+               {
+                       $incoming_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'controller';
+                       $menus = array();
+
+                       $menus['navbar'] = array
+                       (
+                               'controller' => array
+                               (
+                                       'text'  => lang('Controller'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'activitycalendar.uiactivities.index') ),
+                    'image'    => array('property', 'location'),
+                                       'order' => 10,
+                                       'group' => 'office'
+                               )
+                       );
+
+                       $menus['navigation'] =  array
+                       (
+                               'control' => array
+                               (
+                                       'text'  => lang('Control'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.index') ),
+                                 'image'       => array('property', 
'location_1'),
+                               ),
+                               'organizationList' => array
+                               (
+                                       'text'  => lang('OrganizationList'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'activitycalendar.uiorganization.index') ),
+                           'image'     => array('property', 'location_tenant'),
+                                       'children'      => array(
+                                                               
'changed_organizations' => array
+                                                               (
+                                                                       'text'  
=> lang('changed_org_group'),
+                                                                       'url'   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'activitycalendar.uiorganization.changed_organizations') ),
+                                                                       'image' 
=> array('property', 'location_tenant')
+                                                               )
+                                                       )
+                               )      
+                       );
+                       
+                       $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');
+
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;
+
+                       return $menus;
+               }
+       }

Added: trunk/controller/inc/class.socommon.inc.php
===================================================================
--- trunk/controller/inc/class.socommon.inc.php                         (rev 0)
+++ trunk/controller/inc/class.socommon.inc.php 2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,323 @@
+<?php
+abstract class controller_socommon
+{
+       protected $db;
+       protected $like;
+       protected $join;
+       protected $left_join;
+       
+       public function __construct()
+       {
+               $this->db           = clone $GLOBALS['phpgw']->db;
+               $this->like                     = & $this->db->like;
+               $this->join                     = & $this->db->join;
+               $this->left_join        = & $this->db->left_join;
+       }
+       
+       /**
+        * Marshal values according to type
+        * @param $value the value
+        * @param $type the type of value
+        * @return database value
+        */
+       protected function marshal($value, $type)
+       {
+               if($value === null)
+               {
+                       return 'NULL';
+               }
+               else if($type == 'int')
+               {
+                       if($value == '')
+                       {
+                               return 'NULL';
+                       }
+                       return intval($value);
+               }
+               else if($type == 'float')
+               {
+                       return str_replace(',', '.', $value);
+               }
+               else if($type == 'field')
+               {
+                       return $this->db->db_addslashes($value);
+               }
+               return "'" . $this->db->db_addslashes($value) . "'";
+       }
+
+       /*
+       
+       /**
+        * Unmarchal database values according to type
+        * @param $value the field value
+        * @param $type a string dictating value type
+        * @return the php value
+        */
+       protected function unmarshal($value, $type)
+       {
+               if($type == 'bool')
+               {
+                       return (boolean)$value;
+               }
+               elseif($value === null || $value == 'NULL')
+               {
+                       return null;
+               }
+               elseif($type == 'int')
+               {
+                       return intval($value);
+               }
+        elseif($type == 'float')
+        {
+            return floatval($value);
+        }
+               return $value;
+       }
+
+       /**
+        * Get the count of the specified query. Query must return a signel 
column
+        * called count.
+        * 
+        * @param $sql the sql query
+        * @return the count value
+        */
+       protected function get_query_count($sql)
+       {
+               $result = $this->db->query($sql);
+               if($result && $this->db->next_record())
+               {
+                       return $this->unmarshal($this->db->f('count', true), 
'int');
+               } 
+       }
+       
+       /**
+        * Implementing classes must return an instance of itself.
+        *  
+        * @return the class instance.
+        */
+       public abstract static function get_instance();
+
+       /**
+        * Convenience method for getting one single object. Calls get() with 
the
+        * specified id as a filter.
+        * 
+        * @param $id int with id of object to return.
+        * @return object with the specified id, null if not found.
+        */
+       public function get_single(int $id)
+       {
+               $objects = $this->get(null, null, null, null, null, null, 
array($this->get_id_field_name() => $id));
+               if(count($objects) > 0)
+               {
+                       $keys = array_keys($objects);
+                       return $objects[$keys[0]];
+               }
+               return null;
+       }
+       
+       /**
+        * Method for retrieving the db-object (security "forgotten")
+        */
+       public function get_db(){
+               return $this->db;
+       }
+
+       /**
+        * Method for retreiving objects.
+        * 
+        * @param $start_index int with index of first object.
+        * @param $num_of_objects int with max number of objects to return.
+        * @param $sort_field string representing the object field to sort on.
+        * @param $ascending boolean true for ascending sort on sort field, 
false
+        * for descending.
+        * @param $search_for string with free text search query.
+        * @param $search_type string with the query type.
+        * @param $filters array with key => value of filters.
+        * @return array of objects. May return an empty
+        * array, never null. The array keys are the respective index numbers.
+        */
+       public function get(int $start_index, int $num_of_objects, string 
$sort_field, boolean $ascending, string $search_for, string $search_type, array 
$filters)
+       {
+               $results = array();                     // Array to store 
result objects
+               $map = array();                         // Array to hold number 
of records per target object
+               $check_map = array();           // Array to hold the actual 
number of record read per target object
+               $object_ids = array();          // All of the object ids 
encountered
+               $added_object_ids = array();// All of the added objects ids
+               
+               // Retrieve information about the table name and the name and 
alias of id column
+               // $break_on_limit -    flag indicating whether to break the 
loop when the number of records 
+               //                                              for all the 
result objects are traversed
+               $id_field_name_info = $this->get_id_field_name(true);
+               if(is_array($id_field_name_info))
+               {
+                       $break_on_limit = true;
+                       $id_field_name = $id_field_name_info['translated'];
+               }
+               else
+               {
+                       $break_on_limit = false;
+                       $id_field_name = $id_field_name_info;
+               }
+
+               // Special case: Sort on id field. Always changed to the id 
field name.
+               // $break_when_num_of_objects_reached - flag indicating to 
break the loop when the number of 
+               //              results are reached and we are sure that the 
records are ordered by the id
+               if($sort_field == null || $sort_field == 'id' || $sort_field == 
'')
+               {
+                       $sort_field = $id_field_name;
+                       $break_when_num_of_objects_reached = true;
+               }
+               else
+               {
+                       $break_when_num_of_objects_reached = false;
+               }
+               
+               // Only allow positive start index
+               if($start_index < 0)
+               {
+                       $start_index = 0;
+               }
+               
+
+               // test-input for break on ordered queries
+               $db2 = clone($this->db);
+
+               $sql = $this->get_query($sort_field, $ascending, $search_for, 
$search_type, $filters, false);
+               $sql_parts = explode('1=1',$sql); // Split the query to insert 
extra condition on test for break
+               $this->db->query($sql,__LINE__, __FILE__, false, true);
+
+               while ($this->db->next_record()) // Runs through all of the 
results
+               {
+                       $should_populate_object = false; // Default value - we 
won't populate object    
+                       $result_id = 
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
+                       if(in_array($result_id, $added_object_ids)) // Object 
with this id already added
+                       {
+                               $should_populate_object = true; // We should 
populate this object as we already have it in our result array
+                       }
+                       else // Object isn't already added to array
+                       {
+                               if(!in_array($result_id, $object_ids)) // 
Haven't already added this id
+                               {
+                                       $object_ids[] = $result_id; // We have 
to add the new id
+                               }
+                               // We have to check if we should populate this 
object
+                               if(count($object_ids) > $start_index) // We're 
at index above start index
+                               {
+                                       if($num_of_objects == null || 
count($results) < $num_of_objects) // We haven't found all the objects we're 
looking for
+                                       {
+                                               $should_populate_object = true; 
// We should populate this object
+                                               $added_object_ids[] = 
$result_id; // We keep the id
+                                       }
+                               }
+                       }
+                       if($should_populate_object)
+                       {       
+                               $result = &$results[$result_id];
+                               $results[$result_id] = 
$this->populate($result_id,$result);
+                               $last_result_id = $result_id;
+                               $map[$result_id] = (int)$map[$result_id] +1;
+                       }
+                       
+                       //Stop looping when array not sorted on other then id 
and wanted number of results is reached
+                       if(count($results) == $num_of_objects  && 
$last_result_id != $result_id && $break_when_num_of_objects_reached)
+                       {
+                               break;
+                       }
+                       // else stop looping when wanted number of results is 
reached all records for result objects are read
+                       else if($break_on_limit && (count($results) == 
$num_of_objects)  && $last_result_id != $result_id)
+                       {
+                               $id_ok = 0;
+                               foreach ($map as $_result_id => $_count)
+                               {
+                                       if(!isset($check_map[$_result_id]))
+                                       {
+                                               // Query the number of records 
for the specific object in question
+                                               $sql2 = "{$sql_parts[0]} 1=1 
AND {$id_field_name_info['table']}.{$id_field_name_info['field']} = 
{$_result_id} {$sql_parts[1]}";
+                                               $db2->query($sql2,__LINE__, 
__FILE__);
+                                               $db2->next_record();
+                                               $check_map[$_result_id] = 
$db2->num_rows();
+                                       }
+                                       if(     $check_map[$_result_id] == 
$_count )
+                                       {
+                                               $id_ok++;
+                                       }
+                               }
+                               if($id_ok == $num_of_objects)
+                               {
+                                       break;
+                               }
+                       }
+               }
+               return $results;
+       }
+       
+       /**
+        * Returns count of matching objects.
+        * 
+        * @param $search_for string with free text search query.
+        * @param $search_type string with the query type.
+        * @param $filters array with key => value of filters.
+        * @return int with object count.
+        */
+       public function get_count(string $search_for, string $search_type, 
array $filters)
+       {
+               return $this->get_query_count($this->get_query(null, null, 
$search_for, $search_type, $filters, true));
+       }
+       
+       /**
+        * Implementing classes must return the name of the field used in the 
query
+        * returned from get_query().
+        * 
+        * @return string with name of id field.
+        */
+       protected abstract function get_id_field_name();
+       
+       /**
+        * Returns SQL for retrieving matching objects or object count.
+        * 
+        * @param $start_index int with index of first object.
+        * @param $num_of_objects int with max number of objects to return.
+        * @param $sort_field string representing the object field to sort on.
+        * @param $ascending boolean true for ascending sort on sort field, 
false
+        * for descending.
+        * @param $search_for string with free text search query.
+        * @param $search_type string with the query type.
+        * @param $filters array with key => value of filters.
+        * @param $return_count boolean telling to return only the count of the
+        * matching objects, or the objects themself.
+        * @return string with SQL.
+        */
+
+       protected abstract function get_query(string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count);
+
+       protected abstract function populate(int $object_id, &$object);
+       
+       protected abstract function add(&$object);
+       
+       protected abstract function update($object);
+       
+       /**
+       * Store the object in the database.  If the object has no ID it is 
assumed to be new and
+       * inserted for the first time.  The object is then updated with the new 
insert id.
+       */
+       
+       public function store(&$object)
+       {
+               if ($object->validates()) {
+                       if ($object->get_id() > 0) {
+                               // We can assume this composite came from the 
database since it has an ID. Update the existing row
+                               return $this->update($object);
+                       }
+                       else
+                       {
+                               // This object does not have an ID, so will be 
saved as a new DB row
+                               return $this->add($object);
+                       }
+               }
+
+               // The object did not validate
+               return false;
+       }
+       
+}
+?>
\ No newline at end of file

Added: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php                                
(rev 0)
+++ trunk/controller/inc/class.socontrol.inc.php        2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,143 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control', 'inc/model/');
+
+class controller_socontrol extends controller_socommon
+{
+       protected static $so;
+
+       /**
+        * Get a static reference to the storage object associated with this 
model object
+        *
+        * @return controller_soparty the storage object
+        */
+       public static function get_instance()
+       {
+               if (self::$so == null) {
+                       self::$so = CreateObject('controller.socontrol');
+               }
+               return self::$so;
+       }
+
+       /**
+        * Function for adding a new activity to the database. Updates the 
activity object.
+        *
+        * @param activitycalendar_activity $activity the party to be added
+        * @return bool true if successful, false otherwise
+        */
+       function add(&$control)
+       {
+               
+               $title = $control->get_title();
+               
+               var_dump("i add");
+               
+               $sql = "INSERT INTO controller_control (title) VALUES 
('$title')";
+               $result = $this->db->query($sql, __LINE__,__FILE__);
+
+               if(isset($result)) {
+                       // Set the new party ID
+                       
$control->set_id($this->db->get_last_insert_id('controller_control', 'id'));
+                       // Forward this request to the update method
+                       return $this->update($control);
+               }
+               else
+               {
+                       return false;
+               }
+               
+       }
+
+       /**
+        * Update the database values for an existing activity object.
+        *
+        * @param $activity the activity to be updated
+        * @return boolean true if successful, false otherwise
+        */
+       
+       
+       function update($control)
+       {       
+               
+               $id = intval($control->get_id());
+                       
+               $values = array(
+                       'title = ' . $this->marshal($control->get_title(), 
'string'),
+                       'description = ' . 
$this->marshal($control->get_description(), 'string'),
+                       'start_date = ' . 
$this->marshal($control->get_start_date(), 'int'),
+                       'end_date = ' . 
$this->marshal($control->get_end_date(), 'int'),
+                       'repeat_date = ' . 
$this->marshal($control->get_repeat_date(), 'int'),
+                       'repeat_day = ' . 
$this->marshal($control->get_repeat_day(), 'int'),
+                       'repeat_interval = ' . 
$this->marshal($control->get_repeat_interval(), 'int'),
+               
+               );
+               
+               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
+               $result = $this->db->query('UPDATE controller_control SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+               
+               return isset($result);
+       }
+       
+       
+       function get_procedure_list(){
+               
+               
+       }
+       
+       
+       function get_id_field_name($extended_info = false)
+       {
+               /*
+               if(!$extended_info)
+               {
+                       $ret = 'id';
+               }
+               else
+               {
+                       $ret = array
+                       (
+                               'table'                 => 'activity', // alias
+                               'field'                 => 'id',
+                               'translated'    => 'id'
+                       );
+               }
+               */
+               return $ret;
+       }
+
+       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
+       {
+               
+               
+       }
+       
+       function populate(int $control_id, &$control)
+       {
+               /*
+               if($control == null) {
+                       $control = new activitycalendar_activity((int) 
$activity_id);
+
+                       
$control->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                       
$control->set_organization_id($this->unmarshal($this->db->f('organization_id'), 
'int'));
+                       
$control->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+                       
$control->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                       
$control->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                       
$control->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                       
$control->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                       
$control->set_target($this->unmarshal($this->db->f('target'), 'string'));
+                       
$control->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$control->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                       
$control->set_internal_arena($this->unmarshal($this->db->f('internal_arena'), 
'string'));
+                       
$control->set_time($this->unmarshal($this->db->f('time'), 'string'));
+                       
$control->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
+                       
$control->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
+                       
$control->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+                       
+                       
+               }
+               */
+               return $control;
+       }
+       
+}

Added: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php                              
(rev 0)
+++ trunk/controller/inc/class.soprocedure.inc.php      2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,190 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'procedure', 'inc/model/');
+
+class controller_soprocedure extends controller_socommon
+{
+       protected static $so;
+
+       /**
+        * Get a static reference to the storage object associated with this 
model object
+        *
+        * @return controller_soparty the storage object
+        */
+       public static function get_instance()
+       {
+               if (self::$so == null) {
+                       self::$so = CreateObject('controller.soprocedure');
+               }
+               return self::$so;
+       }
+
+       /**
+        * Function for adding a new activity to the database. Updates the 
activity object.
+        *
+        * @param activitycalendar_activity $activity the party to be added
+        * @return bool true if successful, false otherwise
+        */
+       function add(&$procedure)
+       {
+               
+               $title = $procedure->get_title();
+               
+               $sql = "INSERT INTO controller_procedure (title) VALUES 
('$title')";
+               $result = $this->db->query($sql, __LINE__,__FILE__);
+
+               if(isset($result)) {
+                       // Set the new party ID
+                       
$procedure->set_id($this->db->get_last_insert_id('controller_procedure', 'id'));
+                       // Forward this request to the update method
+                       return $this->update($procedure);
+               }
+               else
+               {
+                       return false;
+               }
+               
+       }
+
+       /**
+        * Update the database values for an existing activity object.
+        *
+        * @param $activity the activity to be updated
+        * @return boolean true if successful, false otherwise
+        */
+
+       function update($procedure)
+       {       
+               $id = intval($procedure->get_id());
+                       
+               $values = array(
+                       '$purpose = ' . 
$this->marshal($procedure->get_purpose(), 'string'),
+                       'responsibility = ' . 
$this->marshal($procedure->get_responsibility(), 'int'),
+                       'description = ' . 
$this->marshal($procedure->get_description(), 'int'),
+                       'reference = ' . 
$this->marshal($procedure->get_reference(), 'int'),
+                       'attachment = ' . 
$this->marshal($procedure->get_attachment(), 'int')
+               );
+               
+               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
+               $result = $this->db->query('UPDATE controller_procedure SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+               
+               return isset($result);
+       }
+       
+       /**
+        * Get single procedure
+        * 
+        * @param       $id     id of the procedure to return
+        * @return a controller_procedure
+        */
+       function get_single($id)
+       {
+               $id = (int)$id;
+               
+               $sql = "SELECT p.* FROM controller_procedure p WHERE p.id = " . 
$id;
+               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+               $this->db->next_record();
+               
+               $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id', true), 'int'));
+               $procedure->set_title($this->unmarshal($this->db->f('title', 
true), 'string'));
+               
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
+               
$procedure->set_responsibility($this->unmarshal($this->db->f('responsibility', 
true), 'string'));
+               
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
+               
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
+               
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+               
+               return $procedure;
+       }
+       
+       /**
+        * Get a list of procedure objects matching the specific filters
+        * 
+        * @param $start search result offset
+        * @param $results number of results to return
+        * @param $sort field to sort by
+        * @param $query LIKE-based query string
+        * @param $filters array of custom filters
+        * @return list of rental_composite objects
+        */
+       function get_procedure_array($start = 0, $results = 1000, $sort = null, 
$dir = '', $query = null, $search_option = null, $filters = array())
+       {
+               $results = array();
+               
+               //$condition = $this->get_conditions($query, 
$filters,$search_option);
+               $order = $sort ? "ORDER BY $sort $dir ": '';
+               
+               //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
+               $sql = "SELECT * FROM controller_procedure $order";
+               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
+               
+               while ($this->db->next_record()) {
+                       $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id', true), 'int'));
+                       
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                       
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
+                       
$procedure->set_responsibility($this->unmarshal($this->db->f('responsibility', 
true), 'string'));
+                       
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
+                       
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
+                       
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+                       
+                       $results[] = $procedure;
+               }
+               
+               return $results;
+       }       
+       
+       function get_id_field_name($extended_info = false)
+       {
+               /*
+               if(!$extended_info)
+               {
+                       $ret = 'id';
+               }
+               else
+               {
+                       $ret = array
+                       (
+                               'table'                 => 'activity', // alias
+                               'field'                 => 'id',
+                               'translated'    => 'id'
+                       );
+               }
+               */
+               return $ret;
+       }
+
+       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
+       {
+               
+               
+       }
+       
+       function populate(int $procedure_id, &$procedure)
+       {
+               /*
+               if($procedure == null) {
+                       $procedure = new activitycalendar_activity((int) 
$activity_id);
+
+                       
$procedure->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                       
$procedure->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                       
$procedure->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+                       
$procedure->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                       
$procedure->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                       
$procedure->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                       
$procedure->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                       
$procedure->set_target($this->unmarshal($this->db->f('target'), 'string'));
+                       
$procedure->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$procedure->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                       
$procedure->set_internal_arena($this->unmarshal($this->db->f('internal_arena'), 
'string'));
+                       
$procedure->set_time($this->unmarshal($this->db->f('time'), 'string'));
+                       
$procedure->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
+                       
$procedure->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
+                       
$procedure->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+                       
+                       
+               }
+               */
+               return $procedure;
+       }
+       
+}

Added: trunk/controller/inc/class.uicommon.inc.php
===================================================================
--- trunk/controller/inc/class.uicommon.inc.php                         (rev 0)
+++ trunk/controller/inc/class.uicommon.inc.php 2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,490 @@
+<?php
+       phpgw::import_class('phpgwapi.yui');
+       
+       /**
+        * Cherry pick selected values into a new array
+        * 
+        * @param array $array    input array
+        * @param array $keys     array of keys to pick
+        *
+        * @return array containg values from $array for the keys in $keys.
+        */
+       
+
+       function extract_values($array, $keys)
+       {
+               $result = array();
+               foreach($keys as $key)
+               {
+                       if(in_array($key, array_keys($array)))
+                       {
+                               $result[$key] = $array[$key];
+                       }
+               }
+               return $result;
+       }
+       
+       function array_set_default(&$array, $key, $value)
+       {
+               if(!isset($array[$key])) $array[$key] = $value;
+       }
+       
+       define('MANAGER','MANAGER');
+       define('EXECUTIVE_OFFICER','EXECUTIVE_OFFICER');
+       define('ADMINISTRATOR','ADMINISTRATOR');
+       
+       abstract class controller_uicommon
+       {
+               protected static $old_exception_handler;
+               
+               const LOCATION_ROOT = '.';
+               const LOCATION_IN = '.RESPONSIBILITY.INTO';
+               const LOCATION_OUT = '.RESPONSIBILITY.OUT';
+               const LOCATION_INTERNAL = '.RESPONSIBILITY.INTERNAL';
+               
+               public $dateFormat;
+               
+               public $type_of_user;
+               
+               public $flash_msgs;
+               
+               public function __construct()
+               {
+                       self::set_active_menu('activitycalendar');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/calendar/assets/skins/sam/calendar.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/autocomplete/assets/skins/sam/autocomplete.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/treeview/assets/skins/sam/treeview.css');
+                       
//self::add_stylesheet('controller/templates/base/css/base.css');
+                       self::add_javascript('controller', 'controller', 
'common.js');
+                       $this->tmpl_search_path = array();
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/phpgwapi/templates/base');
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set']);
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '/templates/base');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('calendar');
+                       phpgwapi_yui::load_widget('autocomplete');
+                       phpgwapi_yui::load_widget('animation');
+                       
+                       $dateFormat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       
+                       $this->acl = & $GLOBALS['phpgw']->acl;
+                       $this->locations = & $GLOBALS['phpgw']->locations;
+                       
+/*                     $this->type_of_user = array(
+                       MANAGER => $this->isManager(),
+                               EXECUTIVE_OFFICER => 
$this->isExecutiveOfficer(),
+                               ADMINISTRATOR => $this->isAdministrator()
+                       );*/
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($GLOBALS['phpgw_info']['flags']['currentapp']);
+               }
+               
+               /**
+                * Permission check. Proxy method for method check in 
phpgwapi->acl
+                * 
+                * @param $location
+                * @param $permission
+                * @return true if check is ok, false othewise
+                */
+               protected function hasPermissionOn($location = 
activitycalendar_uicommon::LOCATION_ROOT, $permission = PHPGW_ACL_PRIVATE){
+                       return 
$this->acl->check($location,$permission,'bkbooking');
+               }
+               
+               
+               /**
+                * Check to see if this user is an administrator
+                * 
+                * @return true if private permission on root, false otherwise
+                */
+               protected function isAdministrator(){
+                       return 
$this->acl->check(controller_uicommon::LOCATION_ROOT,PHPGW_ACL_PRIVATE,'controller');
+               }
+               
+               /**
+                * Check to see if the user is an executive officer
+                * 
+                * @return true if at least add permission on fields of 
responsibilities (locations: .RESPONSIBIITY.*)
+                */
+               protected function isExecutiveOfficer(){
+                       return (
+                               
$this->acl->check(controller_uicommon::LOCATION_IN,PHPGW_ACL_ADD,'controller')  
||
+                               
$this->acl->check(controller_uicommon::LOCATION_OUT,PHPGW_ACL_ADD,'controller') 
||
+                               
$this->acl->check(controller_uicommon::LOCATION_INTERNAL,PHPGW_ACL_ADD,'controller')
+                       );
+               }
+               
+               /**
+                * Check to see if the user is a manager
+                * 
+                * @return true if no read,add,delete,edit permission on fields 
of responsibilities (locations: .RESPONSIBILITY.*)
+                */
+               protected function isManager(){
+                       return !$this->isExecutiveOfficer();
+               }
+               
+               public static function 
process_controller_unauthorized_exceptions()
+               {
+                       self::$old_exception_handler = 
set_exception_handler(array(__CLASS__, 
'handle_controller_unauthorized_exception'));
+               }
+               
+               public static function 
handle_controller_unauthorized_exception(Exception $e)
+               {
+                       if ($e instanceof controller_unauthorized_exception)
+                       {
+                               $message = htmlentities('HTTP/1.0 401 
Unauthorized - '.$e->getMessage(), null, self::encoding());
+                               header($message);
+                               echo 
"<html><head><title>$message</title></head><body><strong>$message</strong></body></html>";
+                       } else {
+                               call_user_func(self::$old_exception_handler, 
$e);
+                       }
+               }
+
+               public function link($data)
+               {
+                       return $GLOBALS['phpgw']->link('/index.php', $data);
+               }
+
+               public function redirect($link_data)
+               {
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+               }
+
+               public function flash($msg, $type='success')
+               {
+                       $this->flash_msgs[$msg] = $type == 'success';
+               }
+
+               public function flash_form_errors($errors)
+               {
+                       foreach($errors as $field => $msg)
+                       {
+                               $this->flash_msgs[$msg] = false;
+                       }
+               }
+
+               public function add_stylesheet($path)
+               {
+                       $GLOBALS['phpgw']->css->add_external_file($path);
+               }
+
+               public function add_javascript($app, $pkg, $name)
+               {
+                       return $GLOBALS['phpgw']->js->validate_file($pkg, 
str_replace('.js', '', $name), $app);
+               }
+
+        public function set_active_menu($item)
+        {
+            $GLOBALS['phpgw_info']['flags']['menu_selection'] = $item;
+        }
+
+               /**
+               * A more flexible version of xslttemplate.add_file
+               */
+               public function add_template_file($tmpl)
+               {
+                       if(is_array($tmpl))
+                       {
+                               foreach($tmpl as $t)
+                               {
+                                       $this->add_template_file($t);
+                               }
+                               return;
+                       }
+                       foreach(array_reverse($this->tmpl_search_path) as $path)
+                       {
+                               $filename = $path . '/' . $tmpl . '.xsl';
+                               if (file_exists($filename))
+                               {
+                                       
$GLOBALS['phpgw']->xslttpl->xslfiles[$tmpl] = $filename;
+                                       return;
+                               }
+                       }
+                       echo "Template $tmpl not found in search path: ";
+                       print_r($this->tmpl_search_path);
+                       die;
+               }
+
+        public function render_template($output)
+        {
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
+                       if($this->flash_msgs)
+                       {
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                               foreach($msgbox_data as & $message)
+                               {
+                                       echo "<div 
class='{$message['msgbox_class']}'>";
+                                       echo $message['msgbox_text'];
+                                       echo '</div>';
+                               }
+                       }
+                       echo htmlspecialchars_decode($output);
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+        }
+               
+        public function check_active($url)
+               {
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               $activate = extract_values($_POST, 
array("status", "activate_id"));
+                               
$this->bo->set_active(intval($activate['activate_id']), 
intval($activate['status']));
+                               $this->redirect(array('menuaction' => $url, 
'id' => $activate['activate_id']));
+                       }
+               }
+
+               /**
+                * Build a YUI result of the data
+                * 
+                * @param $data the data
+                * @return YUI result { ResultSet => { totalRecords => ?, 
Result => ?}
+                */
+               public function yui_results($data,$field_total = 
'total_records', $field_results = 'results')
+               {
+             return array
+                       (   
+                               'ResultSet' => array(
+                                       'totalRecords' => $data[$field_total], 
+                                       'Result' => $data[$field_results]
+                               )   
+                       );  
+               }
+               
+               /**
+                * Returns formatted version of gab id. The format of the 
string returned
+                * is '[Cadastral unit number] / [Property unit number] / 
[Leasehold unit number] / [Section unit number]'.
+                * 
+                * @param $gab_id string with id to to format.
+                * @return string formatted version of the string passed to the 
method,
+                * or the same string if the one passed is of an incorrect 
format.
+                */
+               public static function get_nicely_formatted_gab_id(string 
$gab_id)
+               {
+                       if(strlen($gab_id) == 20)
+                       {
+                               $gab_id = substr($gab_id,4,5).' / 
'.substr($gab_id,9,4).' / '.substr($gab_id,13,4).' / '.substr($gab_id,17,3);
+                       }
+                       return $gab_id;
+               }       
+       
+               public function render($template,$local_variables = array())
+               {
+                       foreach($local_variables as $name => $value)
+                       {
+                               $$name = $value;        
+                                       
+                       }
+                       
+                       ob_start();
+                       foreach(array_reverse($this->tmpl_search_path) as $path)
+                       {
+                               $filename = $path . '/' . $template;
+                               if (file_exists($filename))
+                               {
+                                       include($filename);
+                                       break;
+                               }
+                       }
+                       $output = ob_get_contents();
+                       ob_end_clean();
+                       self::render_template($output);
+               }
+               
+               /**
+                * Method for JSON queries.
+                * 
+                * @return YUI result
+                */
+               public abstract function query();
+               
+               /**
+                * Generate javascript for the extra column definitions for a 
partial list
+                * 
+                * @param $array_name the name of the javascript variable that 
contains the column definitions
+                * @param $extra_cols the list of extra columns to set
+                * @return string javascript
+                */
+               public static function get_extra_column_defs($array_name, 
$extra_cols = array())
+               {
+                       $result = "";
+                       
+                       foreach($extra_cols as $col){
+                               $literal  = '{';
+                               $literal .= 'key: "' . $col['key'] . '",';
+                               $literal .= 'label: "' . $col['label'] . '"';
+                               if (isset($col['formatter'])) {
+                                       $literal .= ',formatter: ' . 
$col['formatter'];
+                               }
+                               if (isset($col['parser'])) {
+                                       $literal .= ',parser: ' . 
$col['parser'];
+                               }
+                               $literal .= '}';
+                               
+                               if($col["index"]){
+                                       $result .= 
"{$array_name}.splice(".$col["index"].", 0,".$literal.");";
+                               } else {
+                                       $result .= 
"{$array_name}.push($literal);";
+                               }
+                       }
+                       
+                       return $result;
+               }
+               
+               /**
+                * Generate javascript definitions for any editor widgets set 
on columns for 
+                * a partial list.
+                * 
+                * @param $array_name the name of the javascript variable that 
contains the column definitions
+                * @param $editors the list of editors, keyed by column key
+                * @return string javascript
+                */
+               public static function get_column_editors($array_name, $editors 
= array())
+               {
+                       $result  = "for (var i in {$array_name}) {\n";
+                       $result .= "    switch ({$array_name}[i].key) {\n";
+                       foreach ($editors as $field => $editor) {
+                               $result .= "            case '{$field}':\n";
+                               $result .= "                    
{$array_name}[i].editor = {$editor};\n";
+                               $result .= "                    break;\n";
+                       }
+                       $result .= " }\n";
+                       $result .= "}";
+                       
+                       return $result;
+               }
+               
+               /**
+                * Returns a html-formatted error message if one is defined in 
the
+                * list of validation errors on the object we're given.  If no
+                * error is defined, an empty string is returned.
+                * 
+                * @param $object the object to display errors for
+                * @param $field the name of the attribute to display errors for
+                * @return string a html formatted error message
+                */
+               public static function get_field_error($object, $field)
+               {
+                       if(isset($object))
+                       {
+                               $errors = $object->get_validation_errors();
+                               
+                               if ($errors[$field]) {
+                                       return '<label class="error" for="' . 
$field . '">' . $errors[$field] . '</label>';
+                               }
+                               return '';
+                       }
+               }
+               
+               public static function get_messages($messages, $message_type)
+               {
+                       $output = '';
+                       if(is_array($messages) && count($messages) > 0) // 
Array of messages
+                       {
+                               $output = "<div class=\"{$message_type}\">";
+                               foreach($messages as $message)
+                               {
+                                       $output .= "<p 
class=\"message\">{$message}</p>";
+                               }
+                               $output .= "</div>";
+                       }
+                       else if($messages) {
+                               $output = "<div class=\"{$message_type}\"><p 
class=\"message\">{$messages}</p></div>";
+                       }
+                       return $output;
+               }
+               /**
+                * Returns a html-formatted error message to display on top of 
the page.  If
+                * no error is defined, an empty string is returned.
+                * 
+                * @param $error the error to display
+                * @return string a html formatted error message
+                */
+               public static function get_page_error($errors)
+               {
+                       return self::get_messages($errors, 'error');
+               }
+               
+               /**
+                * Returns a html-formatted error message to display on top of 
the page.  If
+                * no error is defined, an empty string is returned.
+                * 
+                * @param $error the error to display
+                * @return string a html formatted error message
+                */
+               public static function get_page_warning($warnings)
+               {
+                       return self::get_messages($warnings, 'warning');
+               }
+               
+               /**
+                * Returns a html-formatted info message to display on top of 
the page.  If
+                * no message is defined, an empty string is returned.
+                * 
+                * @param $message the message to display
+                * @return string a html formatted info message
+                */
+               public static function get_page_message($messages)
+               {
+                       return self::get_messages($messages, 'info');
+               }
+
+        /**
+                * Download xls, csv or similar file representation of a data 
table
+                */
+        public function download()
+        {
+            $list = $this->query();
+            $list = $list['ResultSet']['Result'];
+
+            $keys = array();
+
+            if(count($list[0]) > 0) {
+                foreach($list[0] as $key => $value) {
+                    if(!is_array($value)) {
+                        array_push($keys, $key);
+                    }
+                }
+            }
+            
+            // Remove newlines from output
+            $count = count($list);
+            for($i = 0; $i < $count; $i++)
+            {
+                               foreach ($list[$i] as $key => &$data)
+                               {
+                                       $data = str_replace(array("\n","\r\n", 
"<br>"),'',$data);
+                               }
+            }
+
+             // Use keys as headings
+            $headings = array();
+            $count_keys = count($keys);
+            for($j=0;$j<$count_keys;$j++)
+            {
+               array_push($headings, lang($keys[$j]));
+            }
+
+            $property_common = CreateObject('property.bocommon');
+            $property_common->download($list, $keys, $headings);
+        }
+               
+               /**
+                * Added because error reporting facilities in phpgw tries to 
serialize the PDO
+                * instance in $this->db which causes an error. This method 
removes $this->db from the 
+                * serialized values to avoid this problem.
+                */
+               public function __sleep()
+               {
+                       return array('table_name', 'fields');
+               }
+               
+               protected function generate_secret($length = 10)
+               {
+                       return 
substr(base64_encode(rand(1000000000,9999999999)),0, $length);
+               }
+               
+       }
+?>

Added: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php                                
(rev 0)
+++ trunk/controller/inc/class.uicontrol.inc.php        2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,80 @@
+<?php
+       phpgw::import_class('controller.uicommon');
+       phpgw::import_class('property.boevent');
+       phpgw::import_class('controller.socontrol');
+       phpgw::import_class('controller.soprocedure');
+       
+       include_class('controller', 'control', 'inc/model/');
+
+       class controller_uicontrol extends controller_uicommon
+       {
+               private $bo; 
+               private $so;
+               private $so_proc; 
+               
+               public $public_functions = array
+               (
+                       'index' =>      true
+               );
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       
+                       $this->so = CreateObject('controller.socontrol');
+                       $this->so_proc = CreateObject('controller.soprocedure');
+                       $this->bo = CreateObject('property.boevent',true);
+               }
+               
+               public function index()
+               {
+                       $repeat_type = $this->bo->get_rpt_type_list();
+                       $repeat_day = $this->bo->get_rpt_day_list();
+
+                       if(isset($_POST['save_control'])) // The user has 
pressed the save button
+                       {
+                               if(isset($control)) // If an control object is 
created
+                               {
+                                       
$control->set_title(phpgw::get_var('title'));
+                                       $control->set_description($desc);
+                                       $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
+                                       $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
+                                                                       
+                                       $this->so->add($control);
+                               }
+                               else 
+                               {
+
+                                       $control = new controller_control();
+                                       
+                                       
$control->set_title(phpgw::get_var('title'));
+                                       
$control->set_description(phpgw::get_var('description'));
+                                       $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
+                                       $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
+                                       $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
+                                       $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
+                                       $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
+                                       
+                                                                       
+                                       $this->so->add($control);
+                               }
+                       }
+                       
+                       $procedure_array = 
$this->so_proc->get_procedure_array();
+                       
+                       $this->render('control.php', array
+                                                       (
+                                                       'editable' => true,
+                                                       'repeat_type' => 
$repeat_type,
+                                                       'repeat_day' => 
$repeat_day,
+                                                       'procedure_array' => 
$procedure_array 
+                                                       )
+                                               );
+               }
+                                       
+               public function query()
+               {
+                       var_dump("Er i uicontrol");
+
+               }       
+       }
\ No newline at end of file

Added: trunk/controller/inc/model/class.check_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item.inc.php                         
(rev 0)
+++ trunk/controller/inc/model/class.check_item.inc.php 2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,91 @@
+<?php
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_check_item extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $title;
+               protected $required;
+               protected $what_to_desc;
+               protected $how_to_desc;
+               protected $control_group_id;
+               protected $control_type_id;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_required($required)
+               {
+                       $this->required = $required;
+               }
+               
+               public function get_required() { return $this->required; }
+               
+               public function set_what_to_desc($what_to_desc)
+               {
+                       $this->what_to_desc = $what_to_desc;
+               }
+               
+               public function get_what_to_desc() { return 
$this->what_to_desc; }
+               
+               public function set_how_to_desc($how_to_desc)
+               {
+                       $this->how_to_desc = $how_to_desc;
+               }
+               
+               public function get_how_to_desc() { return $this->how_to_desc; }
+               
+               public function set_control_group_id($control_group_id)
+               {
+                       $this->control_group_id = $control_group_id;
+               }
+               
+               public function get_control_group_id() { return 
$this->control_group_id; }
+               
+               public function set_control_type_id($control_type_id)
+               {
+                       $this->control_type_id = $control_type_id;
+               }
+               
+               public function get_control_type_id() { return 
$this->control_type_id; }
+               
+                       
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.sopurpose');
+                       }
+                       
+                       return self::$so;
+               }
+       }
+?>
\ No newline at end of file

Added: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php                            
(rev 0)
+++ trunk/controller/inc/model/class.control.inc.php    2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,75 @@
+<?php
+       include_class('controller', 'model', 'inc/model/');
+
+       class controller_control extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $title;
+               protected $description;
+               protected $start_date;
+               protected $end_date;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+               
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_description($description)
+               {
+                       $this->description = $description;
+               }
+               
+               public function get_description() { return $this->description; }
+               
+               public function set_end_date($end_date)
+               {
+                       $this->end_date = $end_date;
+               }
+               
+               public function get_end_date() { return $this->end_date; }
+               
+               public function set_start_date($start_date)
+               {
+                       $this->start_date = $start_date;
+               }
+               
+               public function get_start_date() { return $this->start_date; }
+               
+               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol');
+                       }
+                       
+                       return self::$so;
+               }
+       }
+?>
\ No newline at end of file

Added: trunk/controller/inc/model/class.model.inc.php
===================================================================
--- trunk/controller/inc/model/class.model.inc.php                              
(rev 0)
+++ trunk/controller/inc/model/class.model.inc.php      2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,54 @@
+<?php
+
+abstract class controller_model
+{
+       protected $validation_errors = array();
+       protected $validation_warnings = array();
+       
+       protected $consistency_warnings = array();
+       
+       protected $field_of_responsibility_id;
+       protected $field_of_responsibility_name;
+       protected $permission_array;
+
+       public function __construct(int $id)
+       {
+               $this->id = (int)$id;
+       }
+       
+       public function get_id()
+       {
+               return $this->id;
+       }
+
+       public function set_id($id)
+       {
+               $this->id = $id;
+       }
+               
+       /**
+        * Gets the value of the class attribute with the given name.  As such 
this function translates from
+        * string to variable.
+        *
+        * @param $field the name of the class attribute to get
+        * @return mixed the value of the attribute
+        */
+       public function get_field($field)
+       {
+               return $this->{"$field"};
+       }
+
+       /**
+        * Sets the value of the class attribute with the given name.  As such 
this function translates from
+        * string to variable name.
+        *
+        * @param $field the name of the class attribute to set
+        * @param $value the value to set
+        */
+       public function set_field($field, $value)
+       {
+               $this->{"$field"} = $value;
+       }
+       
+}
+?>

Added: trunk/controller/inc/model/class.procedure.inc.php
===================================================================
--- trunk/controller/inc/model/class.procedure.inc.php                          
(rev 0)
+++ trunk/controller/inc/model/class.procedure.inc.php  2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,90 @@
+<?php
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_procedure extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $title;
+               protected $purpose;
+               protected $responsibility;
+               protected $description;
+               protected $reference;
+               protected $attachment;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+               
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_purpose($purpose)
+               {
+                       $this->purpose = $purpose;
+               }
+               
+               public function get_purpose() { return $this->purpose; }
+               
+               public function get_responsibility() { return 
$this->responsibility; }
+               
+               public function set_responsibility($responsibility)
+               {
+                       $this->responsibility = $responsibility;
+               }
+               
+               public function set_description($description)
+               {
+                       $this->description = $description;
+               }
+               
+               public function get_description() { return $this->description; }
+               
+               public function set_reference($reference)
+               {
+                       $this->reference = $reference;
+               }
+               
+               public function get_reference() { return $this->reference; }
+               
+               public function set_attachment($attachment)
+               {
+                       $this->attachment = $attachment;
+               }
+               
+               public function get_attachment() { return $this->attachment; }
+               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.sopurpose');
+                       }
+                       
+                       return self::$so;
+               }
+       }
+?>
\ No newline at end of file

Added: trunk/controller/inc/model/class.schedule.inc.php
===================================================================
--- trunk/controller/inc/model/class.schedule.inc.php                           
(rev 0)
+++ trunk/controller/inc/model/class.schedule.inc.php   2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,65 @@
+<?php
+       include_class('controller', 'model', 'inc/model/');
+
+       class controller_schedule extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $control_id;
+               protected $schedule_time;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+               
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
+               public function set_schedule_time($schedule_time)
+               {
+                       $this->schedule_time = $schedule_time;
+               }
+               
+               public function get_schedule_time() { return 
$this->schedule_time; }
+               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.soschedule');
+                       }
+                       
+                       return self::$so;
+               }
+       }
+?>
\ No newline at end of file

Added: trunk/controller/index.php
===================================================================
--- trunk/controller/index.php                          (rev 0)
+++ trunk/controller/index.php  2011-09-05 06:29:33 UTC (rev 7552)
@@ -0,0 +1,53 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @version $Id: index.php 6445 2010-10-05 21:52:58Z sigurdne $
+       */
+
+       /**
+        * Start page
+        *
+        * This script will check if there is defined a startpage in the users
+        * preferences - and then forward the user to this page
+        */
+
+       $GLOBALS['phpgw_info']['flags'] = array
+       (
+               'noheader'              => true,
+               'nonavbar'              => true,
+               'currentapp'    => 'controller'
+       );
+
+       include_once('../header.inc.php');
+
+       $start_page = 'uicontrol';
+
+       if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page'])
+               && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page'] 
)
+       {
+               $start_page = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page'];
+       }
+
+       $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
"controller.{$start_page}.index"));

Added: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang                                (rev 0)
+++ trunk/controller/setup/phpgw_no.lang        2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,630 @@
+control        controller      no      Kontroll
+control_helptext       controller      no      Her kommer hjelpetekst for å 
opprette en kontroll
+title  controller      no      kontroll
+close  controller      no      Lukk
+clear  controller      no      Nullstill
+month 1        controller      no      januar
+month 2        controller      no      februar
+month 3        controller      no      mars
+month 4        controller      no      april
+month 5        controller      no      mai
+month 6        controller      no      juni
+month 7        controller      no      juli
+month 8        controller      no      august
+month 9        controller      no      september
+month 10       controller      no      oktober
+month 11       controller      no      november
+month 12       controller      no      desember
+month 0 capitalized    controller      no      Ikke tilgjengelig
+month 1 capitalized    controller      no      Januar
+month 2 capitalized    controller      no      Februar
+month 3 capitalized    controller      no      Mars
+month 4 capitalized    controller      no      April
+month 5 capitalized    controller      no      Mai
+month 6 capitalized    controller      no      Juni
+month 7 capitalized    controller      no      Juli
+month 8 capitalized    controller      no      August
+month 9 capitalized    controller      no      September
+month 10 capitalized   controller      no      Oktober
+month 11 capitalized   controller      no      November
+month 12 capitalized   controller      no      Desember
+monthly        controller      no      Månedlig
+month  controller      no      Måned
+calendar_months        controller      no      
["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]
+calendar_weekdays      controller      no      
["Sø","Ma","Ti","On","To","Fr","Lø"]
+select_date    controller      no      Velg dato
+year controller        no      År
+location_code  controller      no      Enhetsnummer
+included_units controller      no      Leieobjektets enheter
+floor  controller      no      Etasje
+section        controller      no      Seksjon
+room   controller      no      Rom
+save   controller      no      Lagre
+1-6 characters controller      no      1-6 tegn
+6 characters   controller      no      6 tegn
+account_in     controller      no      Art/konto inntektsside
+account_in_not_numeric controller      no      Art/konto inntektsside må være 
et tall
+account_number controller      no      Kontonummer
+account_out    controller      no      Art/konto utgiftsside
+account_out_not_numeric        controller      no      Art/konto utgiftsside 
må være et tall
+active_party   controller      no      Kontraktspart er aktiv
+active_plural  controller      no      Aktive
+active_single  controller      no      Aktiv
+active controller      no      Aktiv
+add_area       controller      no      Legg til areal
+added_areas    controller      no      Inkludert areal
+add    controller      no      Legg til
+address        controller      no      Adresse
+adjust_price   controller      no      Juster pris
+adjustment     controller      no      Regulering
+adjustable     controller      no      Regulerbar
+adjustment_interval    controller      no      Reguleringsintervall
+adjustment_is_executed controller      no      Reguleringen er utført
+adjustment_is_not_executed     controller      no      Reguleringen er ikke 
utført
+adjustment_list        controller      no      Reguleringer
+adjustment_list_out_of_date    controller      no      Det er kjørt en nyere 
regulering for samme utvalg av kontrakter
+adjustment_share       controller      no      Reguleringsandel
+adjustment_type        controller      no      Reguleringstype
+adjustment_year        controller      no      Sist regulert
+adjustment_date        controller      no      Reguleringsdato
+adjustment_type_KPI    controller      no      KPI
+adjustment_type_deflator       controller      no      Kommunal deflator
+advance        controller      no      Forskudd
+agresso_id     controller      no      Agresso-ID
+agresso_gl07   controller      no      Agresso GL07 - hovedbokstall
+agresso_lg04   controller      no      Agresso LG04 - salgsordrer
+add_location   controller      no      Legg enhet til leieobjektet
+address1       controller      no      Adresse 1
+address2       controller      no      Adresse 2
+all    controller      no      Alle
+all_locations  controller      no      Enheter fra eiendomsregisteret
+and    controller      no      og
+annually       controller      no      Årlig
+area_gros      controller      no      Bruttoareal
+area_net       controller      no      Nettoareal
+area_not_found controller      no      Kunne ikke finne detaljer om arealet
+area   controller      no      Areal
+area decimal places    controller      no      Antall desimaler for arealer
+area suffix    controller      no      Areal suffix
+area_max       controller      no      Max areal
+audience       controller      no      Målgrupper
+availability   controller      no      Tilgjengelighet
+availability_date      controller      no      Dato
+available_areas        controller      no      Tilgjenglig areal
+available_at   controller      no      Ledig på dato
+available_composites   controller      no      Ledige leieobjekt
+available_composites   controller      no      Tilgjengelige leieobjekter
+available_from controller      no      Tilgjengelig fra
+available_parties      controller      no      Tilgjengelige kontraktsparter
+available_price_items  controller      no      Tilgjengelige priselementer
+available?     controller      no      Kan leies ut?
+available      controller      no      Tilgjengelig
+available_for_pick     controller      no      tilgjengelig
+back   controller      no      Tilbake
+bank_guarantee controller      no      Bankgaranti
+Billing date   controller      no      Fakturadato
+billing time limit     controller      no      Faktura - tidsgrense
+billing_external       controller      no      Ekstern
+billing_internal       controller      no      Intern
+billing_start  controller      no      Fakturastart
+billing_term   controller      no      Termin
+billing_terms  controller      no      Terminer
+billing_unit   controller      no      Ansvar-/tjenestested    
+billing_removed_KF_contract    controller      no      Fjernet KF-kontrakt med 
id
+billing_removed_contract_part_1        controller      no      Fjernet kontrakt
+billing_removed_contract_part_2        controller      no      med total pris 
lik 0 kroner
+billing_removed_external_contract      controller      no      Kontrakt med 
ansvarsområde eksternleie må ha kontrakttype
+bill   controller      no      Faktura
+bill2  controller      no      Fakturér
+btn_add        controller      no      Deleger tilgang til bruker
+btn_search     controller      no      Finn bruker
+building       controller      no      Bygg
+calculations_internal_investment       controller      no      
Beregningsgrunnlag internleie/investeringer
+calculate_price_apiece controller      no      Pris regnes per stk.
+calculate_price_per_area       controller      no      Pris regnes ut fra areal
+calendar_months        controller      no      
["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]
+calendar_weekdays      controller      no      
["Sø","Ma","Ti","On","To","Fr","Lø"]
+cancel controller      no      Avbryt
+category config move in        controller      no      Kategori for 
innflyttingsmeldinger
+category config move out       controller      no      Kategori for 
utflyttingsmeldinger
+close  controller      no      Lukk
+clear  controller      no      Nullstill
+closing_due_date       controller      no      Nær opsjonsfrist
+CSV    controller      no      CSV
+comment        controller      no      Kommentar
+comments       controller      no      Kommentarer
+Commit controller      no      Avslutt
+Commited       controller      no      Avsluttet
+company        controller      no      Foretak
+company_name   controller      no      Foretak
+composite_name controller      no      Navn på leieobjekt
+composite_address      controller      no      Adresse på leieobjekt
+composite      controller      no      Leieobjekt
+composite_back controller      no      Leieobjektsliste
+composite_has_contract controller      no      Leieobjekt med aktive kontrakter
+composite_has_no_contract      controller      no      Leieobjekt uten aktive 
kontrakter
+contract       controller      no      Kontrakt
+contract_back  controller      no      Kontraktsliste
+contract_id    controller      no      Kontraktsnummer
+contract_not_adjustable        controller      no      Kontrakten er ikke 
regulerbar
+contract_number        controller      no      Kontraktnummer
+contract_warning       controller      no      Advarsler
+contracts_containing_this_composite    controller      no      Kontrakter 
knyttet til dette leieobjektet
+contracts      controller      no      Kontrakter
+contracts_under_dismissal      controller      no      Kontrakter under 
avslutning
+contract_under_dismissal       controller      no      Under avslutning
+contract_notifications controller      no      Kontraktens varsler
+contract_notification_status   controller      no      Status
+contracts_for_regulation       controller      no      Regulering med 
tilhørende kontrakter
+contract_regulation_back       controller      no      Regulering
+contracts_removed      controller      no      Kontrakter som er fjernet fra 
fakturakjøringen
+contracts_with_one_time        controller      no      Kontrakter med 
engangsbeløp
+contracts_in_cycle     controller      no      Kontrakter som følger vanlig 
fakturasyklus
+contracts_out_of_cycle controller      no      Kontrakter som avviker fra 
vanlig faktureringssyklus
+contracts_not_billed_before    controller      no      Kontrakter som ikke er 
fakturert tidligere
+contract_status        controller      no      Status
+contract_type_eksternleie      controller      no      Eksternleie
+contract_type_eksternleie_feste        controller      no      Feste (1520)
+contract_type_eksternleie_leilighet    controller      no      Leilighet (1530)
+contract_type_eksternleie_annen        controller      no      Annen (1510)
+contract_type_innleie  controller      no      Innleie
+contract_type_internleie       controller      no      Internleie
+contract_type_internleie_egne  controller      no      Egne
+contract_type_internleie_innleie       controller      no      Innleie
+contract_type_internleie_investeringskontrakt  controller      no      
Investeringskontrakt
+contract_type_internleie_KF    controller      no      KF
+contract_type_internleie_andre controller      no      Andre
+contract_type_investeringskontrakt     controller      no      
Investeringskontrakt
+contract_type  controller      no      Kontrakttype
+contract_type_id       controller      no      Kontrakttype
+contract_types controller      no      Kontrakttyper
+contract_type_internleie_1     controller      no      Utført 
internleieregulering av kontrakter som reguleres hvert år
+contract_type_internleie_2     controller      no      Utført 
internleieregulering av kontrakter som reguleres hvert annet år
+contract_type_internleie_10    controller      no      Utført 
internleieregulering av kontrakter som reguleres hvert tiende år
+contract_type_innleie_1        controller      no      Utført 
innleieregulering av kontrakter som reguleres hvert år
+contract_type_innleie_2        controller      no      Utført 
innleieregulering av kontrakter som reguleres hvert annet år
+contract_type_innleie_10       controller      no      Utført 
innleieregulering av kontrakter som reguleres hvert tiende år
+contract_type_eksternleie_1    controller      no      Utført 
eksternleieregulering av kontrakter som reguleres hvert år
+contract_type_eksternleie_2    controller      no      Utført 
eksternleieregulering av kontrakter som reguleres hvert annet år
+contract_type_eksternleie_10   controller      no      Utført 
eksternleieregulering av kontrakter som reguleres hvert tiende år
+contracts_closing_due_date     controller      no      Kontrakter nær 
opsjonsfrist
+contract_future_info   controller      no      Fremtidig kontraktsinformasjon
+Could not find specified billing job.  controller      no      Kunne ikke 
finne spesifisert fakturering.
+count decimal places   controller      no      Antall desimaler for opptelling
+count  controller      no      Antall
+count_suffix   controller      no      stk
+count_suffix   controller      no      stk
+create_billing controller      no      Opprett fakturakjøring
+create_shortcut        controller      no      Ny snarvei
+create_contract_contract_type_eksternleie      controller      no      Opprett 
eksternleiekontrakt
+create_contract_contract_type_innleie  controller      no      Opprett 
innleiekontrakt
+create_contract_contract_type_internleie       controller      no      Opprett 
internleiekontrakt
+create_user_based_on_email_link        controller      no      Opprett bruker 
basert på e-post
+create user based on email group       controller      no      Velg gruppe nye 
brukere blir innmeldt i
+cs15_export    controller      no      Kundefil
+currency decimal places        controller      no      Antall desimaler for 
valuta
+currency prefix        controller      no      Valuta prefix
+currency suffix        controller      no      Valuta suffix
+currency_thousands_separator   controller      no      .
+custom_address controller      no      overstyrt
+dashboard_title        controller      no      Forside - Min arbeidsoversikt
+DATATABLE_MSG_EMPTY    controller      no      Ingen data
+DATATABLE_MSG_ERROR    controller      no      Datafeil
+DATATABLE_MSG_LOADING  controller      no      Laster data
+date_end       controller      no      Gjelder til
+date   controller      no      Dato
+date_start     controller      no      Gjelder fra
+decimal separator      controller      no      Skilletegn for desimaler
+delegates      controller      no      Delegering
+delegate_removed       controller      no      Delegaten ble fjernet.
+delegation_error       controller      no      Feil under delegering
+delegation_successful  controller      no      Velykket delegering
+delete controller      no      Slett
+department     controller      no      Avdeling
+deposit        controller      no      Depositum
+description    controller      no      Beskrivelse
+details        controller      no      Detaljer
+document_type  controller      no      Dokumenttype
+documents      controller      no      Dokumenter
+Download Agresso import file   controller      no      Last ned 
Agresso-importfil (CS15)
+Download as %1 controller      no      Last tabellen i %1-format
+Download export        controller      no      Last ned eksporten
+do_not_exist   controller      no      Eksisterer ikke
+due_date       controller      no      Opsjonsfrist
+economy        controller      no      Økonomi
+edit_contract  controller      no      Redigér kontrakt
+edit   controller      no      Redigér
+elements_pr_page       controller      no      elementer per side
+elements       controller      no      Elementer
+email  controller      no      E-post
+email_create_user_based_on_email_title controller      no      Tilgang til 
Portico Estate
+email_create_user_based_on_email_message       controller      no      Hei %1 
%2:<br/>Det er opprettet en tilgang for deg i Portico 
Estate<br/><br/>Brukernavnet er e-posten din<br/>Passordet er 
%3<br/><br/>Systemet kan nås på adressen %4
+ended  controller      no      Avsluttet
+entity config move out controller      no      Entitet for utflytting
+entity config move in  controller      no      Entitet for innflytting
+error_create_user_based_on_email       controller      no      En feil oppstod 
under opprettelse av bruker
+error_create_user_based_on_email_account_exist controller      no      En 
konto med denne e-posten som brukernavn eksisterer allerede
+error_create_user_based_on_email_not_valid_address     controller      no      
Kan ikke opprette kontoen pga av e-postadressen ikke er gyldig
+error_no_contract_or_party     controller      no      Ingen kontrakt eller 
kontraktspart å utføre handlingen på
+events controller      no      Hendelser
+every_second_week      controller      no      Hver 14. dag
+Excel  controller      no      Excel
+execute_adjustments    controller      no      Utfør reguleringer
+executive_officer      controller      no      Saksbehandler
+executive_officer_for  controller      no      Saksbehandler for
+export controller      no      Eksport
+export_contracts       controller      no      Eksporter kontrakter
+export_contract_price_items    controller      no      Eksporter priselementer 
på kontrakter
+Export failed. controller      no      Eksporten feilet.
+Export format  controller      no      Format
+Export generated.      controller      no      Eksporten ble generert.
+export_to      controller      no      Eksporter
+external       controller      no      Eksterne kontraktsparter
+facilit_import controller      no      Import fra Facilit
+failed_removing_delegate       controller      no      Det oppstod en feil 
under sletting av delegaten.
+fax    controller      no      Faks
+fellesdata_not_in_use  controller      no      Fellesdata er ikke i bruk
+field_of_responsibility        controller      no      Ansvarsområde
+filters        controller      no      Filtre
+Finish controller      no      Avslutt
+fire_drawings  controller      no      Branntegninger
+firstname      controller      no      Fornavn
+first  controller      no      Første
+first_half     controller      no      1. halvår
+first_quarter  controller      no      1. kvartal
+fixed  controller      no      Tidsbestemt
+floor  controller      no      Etasje
+fourth_quarter controller      no      4. kvartal
+f_new_contract controller      no      Opprett kontrakt
+f_new_party    controller      no      Ny kontraktspart
+f_new_price_item       controller      no      Nytt priselement
+f_new_rc       controller      no      Nytt leieobjekt
+from   controller      no      Fra
+from email setting     controller      no      E-post adresse systemmeldinger 
(Fra)
+frontpage_was_reset    controller      no      Oppsettet på forsiden ble 
nullstilt
+frontpage_reset_setup  controller      no      Nullstill oppsett 
+f_select_columns       controller      no      Velg kolonner
+furnish_type   controller      no      Møbleringsstatus
+furnish_type_not_specified     controller      no      Ikke spesifisert
+furnish_type_furnished controller      no      Møblert
+furnish_type_partly_furnished  controller      no      Delvis møblert
+furnish_type_not_furnished     controller      no      Ikke møblert
+gab    controller      no      GAB
+gab_id controller      no      GAB
+Generate export        controller      no      Generér eksport
+Generate cs15  controller      no      Generér kundefil
+half-year      controller      no      Halvårig
+hidden controller      no      Skjult
+hidden_for_pick        controller      no      skjult
+has_custom_address     controller      no      Er adressen overstyrt?
+house_number   controller      no      Husnummer
+http address for external users        controller      no      HTTP adresse 
for eksterne brukere
+id     controller      no      ID
+Identifier     controller      no      Identifikator
+import_log_messages    controller      no      Import log
+import_reset   controller      no      Nullstill importstatus
+in_operation   controller      no      I drift
+inactive_party controller      no      Kontraktspart er inaktiv
+inactive       controller      no      Inaktiv
+included_units controller      no      Leieobjektets enheter
+internal       controller      no      Interne kontraktsparter
+interval       controller      no      Intervall
+Invalid location code for the building.        controller      no      Ugyldig 
objektnummer for bygg.
+invoice        controller      no      Faktura
+invoice_run    controller      no      Fakturakjøring
+invoice_menu   controller      no      Faktura
+invoice_header controller      no      Fakturaoverskrift
+is_active      controller      no      Aktiv
+is_area        controller      no      Areal
+is_payer       controller      no      Fakturamottaker
+is_inactive    controller      no      Inaktiv
+is_adjustable  controller      no      Indeksreguleres
+is_executed    controller      no      Utført
+is_one_time    controller      no      Engangsbeløp
+is_standard    controller      no      Standard priselement
+job_title      controller      no      Stillingstittel
+land_title     controller      no      Gnr/Bnr
+lacking_username       controller      no      Brukernavn må fylles ut
+last_edited_by_current_user    controller      no      Din siste endring
+lastname       controller      no      Etternavn
+last   controller      no      Siste
+last_updated   controller      no      Sist oppdatert
+level  controller      no      Nivå
+link   controller      no      Lenke
+location_code  controller      no      Enhetsnummer
+location_id    controller      no      Intern organisasjonstilknytning
+log_in_to_add_notfications     controller      no      Det er bare mulig å 
legge til varlser i redigeringsmodus.
+make_pdf       controller      no      Lag PDF for utskrift
+manual_adjust_price_item       controller      no      Manuell regulering av 
priselement
+manual_adjust_price_item_select        controller      no      Velg priselement
+manual_adjustment      controller      no      Manuell regulering
+marked_as      controller      no      og er merket
+max_area       controller      no      Areal
+message        controller      no      Melding
+messages_agresso_id_length     controller      no      Agresso-ID må inneholde 
9 tall eller bokstaver
+messages_fontpage_not_saved    controller      no      Oppsettet ble ikke 
lagret
+messages_fontpage_saved        controller      no      Oppsettet ble lagret
+messages_form_error    controller      no      Skjemaet inneholder en feil.
+messages_general       controller      no      Feil i feltet
+messages_isint controller      no      Feltet må inneholde et heltall
+messages_isnumeric     controller      no      Feltet må inneholde et tall
+messages_new_composite controller      no      Leieobjektet er opprettet
+messages_new_contract  controller      no      Ny kontrakt lagt til
+messages_new_contract_copied   controller      no      Ny kontrakt lagt til 
basert på kontrakt
+messages_new_contract_from_composite   controller      no      Ny kontrakt 
lagt til basert på leieobjekt
+messages_new_party     controller      no      Kontraktspart er opprettet
+messages_not_valid_date        controller      no      Må være en gyldig dato
+messages_number_out_of_range   controller      no      Tallet er over eller 
under tillatte verdier
+messages_required_field        controller      no      Dette feltet er påkrevd
+messages_right_click_to_add    controller      no      Høyreklikk for å legge 
til
+messages_saved_form    controller      no      Informasjonen ble lagret.
+messages_string_too_long       controller      no      Teksten er for lang
+Missing account in.    controller      no      Inngående konto mangler.
+Missing account out.   controller      no      Utgående konto mangler.
+Missing billing information.   controller      no      Ufullstendig 
konteringsinformasjon for kontrakt med id %1. Dette må rettes for å kunne 
fakturere kontrakten.
+Missing contract party.        controller      no      Kontraktspart mangler.
+Missing payer id.      controller      no      Mangler fakturamottaker.
+Missing project id.    controller      no      Prosjektnummer mangler.
+Missing responsibility id.     controller      no      Ansvar mangler.
+Missing service id.    controller      no      Tjeneste mangler.
+Missing system setting for project id. controller      no      
Systeminnstilling for prosjektnummer mangler.
+Missing system setting for responsibility id for the current user.     
controller      no      Systeminnstilling for ansvar mangler.
+missing_agresso_id     controller      no      Agresso Id må fylles ut
+mobile_phone   controller      no      Mobiltelefon
+month 1        controller      no      januar
+month 2        controller      no      februar
+month 3        controller      no      mars
+month 4        controller      no      april
+month 5        controller      no      mai
+month 6        controller      no      juni
+month 7        controller      no      juli
+month 8        controller      no      august
+month 9        controller      no      september
+month 10       controller      no      oktober
+month 11       controller      no      november
+month 12       controller      no      desember
+month 0 capitalized    controller      no      Ikke tilgjengelig
+month 1 capitalized    controller      no      Januar
+month 2 capitalized    controller      no      Februar
+month 3 capitalized    controller      no      Mars
+month 4 capitalized    controller      no      April
+month 5 capitalized    controller      no      Mai
+month 6 capitalized    controller      no      Juni
+month 7 capitalized    controller      no      Juli
+month 8 capitalized    controller      no      August
+month 9 capitalized    controller      no      September
+month 10 capitalized   controller      no      Oktober
+month 11 capitalized   controller      no      November
+month 12 capitalized   controller      no      Desember
+monthly        controller      no      Månedlig
+month  controller      no      Måned
+name   controller      no      Navn
+never  controller      no      Aldri
+new_notification       controller      no      Nytt varsel
+new_billing    controller      no      Ny fakturering
+new_adjustment controller      no      Ny regulering
+new_price      controller      no      Ny pris
+next   controller      no      Neste
+no     controller      no      Nei
+none   controller      no      Ingen
+nobody controller      no      Ingen
+No billing jobs found  controller      no      Ingen faktureringer funnet
+no_contracts_found     controller      no      Ingen kontrakter passet til 
søkekriteriene
+No contracts were selected.    controller      no      Du må velge minst én 
kontrakt for å faktuere.
+no_hits        controller      no      Ingen treff
+No invoices were found controller      no      Ingen fakturaer funnet
+no_name_composite      controller      no      Leieobjekt uten navn 
(løpenummer: %1)
+no_party_location      controller      no      Ingen intern 
organisasjonstilhørighet
+no_value       controller      no      Ingen
+not_available  controller      no      Ikke tilgjengelig
+notification_status    controller      no      Varsel
+notifications  controller      no      Varsler
+notification_optgroup_groups   controller      no      Grupper
+notification_optgroup_users    controller      no      Brukere
+not_started    controller      no      Ikke startet
+not_available_nor_hidden       controller      no      tilgjengelig eller 
skjult
+object_number  controller      no      Objektnummer
+objno_name_address     controller      no      Objektnummer/navn/adresse
+occupied       controller      no      Opptatt
+of_total       controller      no      av totalt
+ok     controller      no      Ok
+old_contract_id        controller      no      Gammelt kontraktsnummer
+ODS    controller      no      ODS
+One or more price items are missing Agresso ids.       controller      no      
Ett eller flere priselementer mangler Agresso-id.
+One or more price items have an invalid Agresso id. Id must consist of one 
capital letter and three digits.    controller      no      Ett eller flere 
priselementer har en ugyldig Agresso-id. Iden må bestå av én stor bokstav og 
tre tall.
+only_one_time  controller      no      Status
+only_one_time_yes      controller      no      Avviker fra vanlig 
faktureringssyklus, kun engangsbeløp
+only_one_time_no       controller      no      Følger vanlig fakturasyklus
+open_and_exported_exist        controller      no      En fakturakjøring som 
ikke er avsluttet med eksportert til Agresso-format eksisterer for dette 
ansvarsområdet. Denne må enten slettes eller avsluttes før denne 
fakturakjøringen kan eksportes.
+organisation_number    controller      no      Organisasjonsnummer
+organisation_or_ssn_number     controller      no      Org./fødselsnr
+orphan_units   controller      no      Ubrukte arealer
+or     controller      no      eller
+org_enhet_id   controller      no      Organisasjonsenhet
+org_unit_name  controller      no      Navn på tilsvarende enhet i Fellesdata
+org_unit_exist controller      no      Eksisterer
+other_guarantee        controller      no      Annen garanti
+others controller      no      Annet
+out_of_operation       controller      no      Ikke i drift
+overridden_address     controller      no      Overstyrt adresse
+override       controller      no      Fakturer fra
+panels controller      no      Vinduer
+part_of_contract       controller      no      Inngår i kontrakt av typen
+parties        controller      no      Kontraktsparter
+party_name     controller      no      Navn til kontraktspart
+party  controller      no      Kontraktspart
+party_back     controller      no      Kontraktspartliste
+party_location controller      no      Intern organisasjonstilhørighet
+party_type     controller      no      Type kontraktspart
+payer_id       controller      no      Fakturamottaker
+percent        controller      no      Prosent
+period controller      no      Periode
+permission_denied_edit_contract        controller      no      Du mangler 
rettigheter for å legge til å editere kontrakten
+permission_denied_new_contract controller      no      Du mangler rettigheter 
for å legge til å opprette nye kontrakter
+permission_denied_view_contract        controller      no      Du mangler 
rettigheter for å legge til å se kontrakten
+permission_denied_add_document controller      no      Du mangler rettigheter 
for å legge til et dokumenent
+phone  controller      no      Telefon
+postal_code_place      controller      no      Postnummer/-sted
+post_code      controller      no      Postnummer
+post_place     controller      no      Sted
+postal_code    controller      no      Postnummer
+place  controller      no      Sted
+previous       controller      no      Forrige
+price_item     controller      no      Priselement
+price_item_id  controller      no      Priselement ID
+price_item_type_apiece controller      no      Stk.
+price_item_type_area   controller      no      Areal
+price_item_inactive    controller      no      Inaktiv
+price_item_active      controller      no      Aktiv
+price_item_adjustable  controller      no      Ja
+price_item_not_adjustable      controller      no      Nei
+price_list     controller      no      Prisbok
+price_per_unit controller      no      Pris pr kvm
+price  controller      no      Pris
+price_element_in_use   controller      no      Priselementet er i bruk på en 
aktiv kontrakt
+project_id     controller      no      Prosjektnummer
+Project id can not be more than 6 characters.  controller      no      
Prosjektnummer kan ikke være mer enn seks tegn.
+propertyident  controller      no      G.nr. / B.nr. / F.nr. / S.nr.
+property_id    controller      no      BKB Identifikator
+property       controller      no      Eiendom
+publish_comment        controller      no      Kommentar vises i frontend
+quarterly      controller      no      Kvartalvis
+rc     controller      no      Leieobjekter
+recurrence     controller      no      Gjentakelse
+reference      controller      no      Deres ref
+regulation     controller      no      Regulering
+regulation_back        controller      no      Reguleringsliste
+related_delegates      controller      no      Delegater
+remove controller      no      Fjern
+remove_from_workbench  controller      no      Fjern fra mitt skrivebord
+remove_from_all_workbenches    controller      no      Fjern fra alle 
skrivebord
+remove_location        controller      no      Fjern enhet fra leieobjektet
+controller_composite   controller      no      Leieobjekt
+controller     controller      no      Kontroll
+rented_area    controller      no      Utleid areal
+rented_area_not_numeric        controller      no      Areal må være et tall
+reports        controller      no      Rapporter
+reset_price_item       controller      no      Hent verdier fra prisboken
+reset  controller      no      Nullstill
+reskontro      controller      no      Reskontro
+responsibility controller      no      Ansvar
+responsibility_id      controller      no      Ansvar
+Responsibility id must be 6 characters.        controller      no      Ansvar 
må være seks tegn.
+responsibility_id_not_numeric  controller      no      Ansvar må være et tall
+result_unit_back       controller      no      Resultatsliste
+result_unit    controller      no      Resultatsenhet
+result_unit_number     controller      no      Resultatsenhet
+Run    controller      no      Kjørt
+run by controller      no      Utført av
+room   controller      no      Rom
+running        controller      no      Løpende
+save   controller      no      Lagre
+save_setup     controller      no      Lagre oppsett på forsiden
+search_for     controller      no      Søk etter
+search_options controller      no      Søkevalg
+search controller      no      Søk
+search_where   controller      no      i
+second_half    controller      no      2. halvår
+second_quarter controller      no      2. kvartal
+section        controller      no      Seksjon
+security       controller      no      Sikkerhet
+security_amount        controller      no      Sikkerhetsbeløp
+security_amount_not_numeric    controller      no      Sikkerhetsbeløp må være 
et tall
+select_all_options     controller      no      &lt;Alle$gt;
+select_date    controller      no      Velg dato
+select_date_valid_year controller      no      Vennligst velg et gyldig år
+selected_composites    controller      no      Valgte leieobjekter
+selected_parties       controller      no      Valgte kontraktsparter
+selected_price_items   controller      no      Valgte priselementer
+serial controller      no      Løpenummer
+serial start   controller      no      Start - ordrenummerserie
+serial stop    controller      no      Slutt - ordrenummerserie
+service        controller      no      Tjeneste
+service_id     controller      no      Tjeneste
+Service id must be 5 characters.       controller      no      Tjeneste må 
være fem tegn.
+service_id_not_numeric controller      no      Tjeneste må være et tall
+service_exist  controller      no      Eksisterer
+set_payer      controller      no      Sett som fakturamottaker
+shortcuts      controller      no      Snarveier
+show_affected_contracts        controller      no      Vis kontrakter relatert 
til reguleringen
+show_move_in_reports   controller      no      Vis jasperreport for 
innflyttingsmelding
+show_move_out_reports  controller      no      Vis jasperreport for 
utflyttingsmelding
+show_in_out_move_reports       controller      no      Vis jasperreports for 
inn- og utflyttingsmeldinger
+showing_composite      controller      no      Leieobjekt
+showing_contract       controller      no      Kontrakt
+showing        controller      no      Viser priselement
+show   controller      no      Vis
+shows_from     controller      no      Viser fra
+ssn    controller      no      Fødselsnummer
+started        controller      no      Startet
+status_before  controller      no      før
+status_date    controller      no      den
+status_unknown controller      no      Ukjent status
+status controller      no      Status
+Success        controller      no      Suksess
+success_create_user_based_on_email     controller      no      En brukerkonto 
ble opprettet og en e-post ble sendt til brukeren
+sum    controller      no      Sum
+sync   controller      no      Synkroniser
+sync_identifier        controller      no      Kun identifikator
+sync_menu      controller      no      Synkronisering
+sync_message   controller      no      Melding
+sync_org_unit  controller      no      Eksisterende kobling
+sync_resp_and_service  controller      no      Ansvar
+sync_res_units controller      no      Gammelt resultatenhetsnummer
+sync_parties   controller      no      Synkronisér kontraktsparter mot 
Fellesdata
+sync_parties_service_and_responsibiity controller      no      Synkronisering: 
Ansvar (Kontrakt)
+sync_parties_result_unit_number        controller      no      Synkronisering: 
Resultatenhetsnummer (Kontraktspart)
+sync_parties_identifier        controller      no      Synkronisering: 
Identifikator
+sync_parties_fellesdata_id     controller      no      Synkronisering: 
Organisasjonsidentifikator
+syncronize_party       controller      no      Synkroniser kontraktspart
+System setting for project id can not be more than 6 characters.       
controller      no      Systeminnstilling for prosjektnummer kan ikke være mer 
enn seks tegn.
+System setting for responsibility id for the current user must be 6 
characters.        controller      no      Systeminnstilling for ansvar må være 
seks tegn.
+target_me      controller      no      Meg selv
+target_none    controller      no      Ingen
+terminated_contract    controller      no      Under opphør
+terminated_contracts   controller      no      Opphørte kontrakter
+the period has been billed before.     controller      no      Denne 
kontrakttypen med denne faktureringsterminen har allerede blitt fakturert for 
denne perioden.
+thousands separator    controller      no      Skilletegn for tusen
+third_quarter  controller      no      3. kvartal
+t_functions    controller      no      Funksjoner
+title  controller      no      Tittel
+t_new_composite        controller      no      Opprett nytt leieobjekt
+t_new_contract controller      no      Ny kontrakt
+t_new_party    controller      no      Opprett ny kontraktspart
+t_new_price_item       controller      no      Opprett nytt priselement
+to     controller      no      Til
+to_the_top     controller      no      Til toppen
+Total sum      controller      no      Totalt beløp
+total_price    controller      no      Total pris
+total_price_current_year       controller      no      Pris i budsjettperiode
+type   controller      no      Type
+under_dismissal        controller      no      Under oppsigelse
+under_planning controller      no      Under planlegging
+units  controller      no      Enheter
+unit_id        controller      no      Enhetsid
+unit_name      controller      no      Enhetsnavn
+unit_leader_name       controller      no      Navn enhetsleder
+unit_no_of_delegates   controller      no      Antall delegater
+update controller      no      Oppdatér
+upload controller      no      Last opp
+url    controller      no      Nettsted
+Unable to get a location code for the building.        controller      no      
Klarte ikke å hente objektnummer for bygget.
+username       controller      no      Brukernavn
+user_or_group  controller      no      Bruker/Gruppe
+vacant controller      no      Ledig
+view_contract  controller      no      Vis kontrakt
+unable_to_connect_to_database  controller      no      Problemer med å koble 
til databasen.
+unknown_user   controller      no      Personen finnes ikke.
+user_found_in_Fellesdata       controller      no      Personen finnes i 
Fellesdata.
+user_not_in_fellesdata controller      no      Personen finnes ikke i 
Fellesdata.
+user_found_in_PE       controller      no      Personen er bruker av dette 
systemet.
+warning_billing_date_between   controller      no      Fakturastart må være 
innenfor kontraktens datoer!
+warning_due_date_between       controller      no      Opsjonsfrist må være 
innenfor kontraktens datoer!
+warning_lacking_start_date     controller      no      Kontrakten mangler 
start-dato!
+warning_price_item_date_between        controller      no      Priselementets 
datoer må være innenfor kontraktens datoer!
+weekly controller      no      Ukentlig
+working_on     controller      no      Kontrakter under arbeid
+year   controller      no      År
+yes    controller      no      Ja
+your_notifications     controller      no      Dine varsler
+control_items  controller      no      Kontrollpunkt
\ No newline at end of file

Added: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php                                (rev 0)
+++ trunk/controller/setup/setup.inc.php        2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,45 @@
+<?php
+       $setup_info['controller']['name'] = 'controller';
+       $setup_info['controller']['version'] = '0.1';
+       $setup_info['controller']['app_order'] = 100;
+       $setup_info['controller']['enable'] = 1;
+       $setup_info['controller']['app_group']  = 'office';
+
+       $setup_info['controller']['description'] = 'Bergen kommune controller';
+
+       $setup_info['controller']['author'][] = array
+       (
+               'name'  => 'Bouvet ASA',
+               'email' => 'address@hidden'
+       );
+
+       /* Dependencies for this app to work */
+       $setup_info['controller']['depends'][] = array(
+               'appname' => 'phpgwapi',
+               'versions' => Array('0.9.17', '0.9.18')
+       );
+
+       $setup_info['controller']['depends'][] = array(
+               'appname' => 'property',
+               'versions' => Array('0.9.17')
+       );
+       
+       /* The hooks this app includes, needed for hooks registration */
+       $setup_info['controller']['hooks'] = array
+       (
+               'menu'  => 'controller.menu.get_menu',
+               'config'
+       );
+       
+       $setup_info['controller']['tables'] = array 
+       (
+               'controller_control',
+               'controller_control_schedule',
+               'controller_control_point_list',
+               'controller_control_point',
+               'controller_control_group',
+               'controller_check_point',
+               'controller_check_list'
+       );
+       
+?>

Added: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php                               
(rev 0)
+++ trunk/controller/setup/tables_current.inc.php       2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,118 @@
+<?php
+       $phpgw_baseline = array(
+               'controller_control' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'title' => array('type' => 
'varchar','precision' => '100', 'nullable' => False),
+                               'description' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => True),
+                               'start_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
+                               'end_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
+                               'frequency_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'procedure_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'requirement_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'costResponsibility_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => True),
+                               'responsibility_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'control_type_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'equipment_type_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'equipment_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'location_code' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'repeat_type' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
+                               'repeat_day' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
+                               'repeat_interval' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
+                               'enabled' => array('type' => 'int', 'precision' 
=> 2, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_control_schedule' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'control_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'schedule_time' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_control_item_list' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'control_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'control_item_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_control_item' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'title' => array('type' => 
'varchar','precision' => '100','nullable' => false),
+                               'required' => array('type' => 'bool','nullable' 
=> true,'default' => 'false'),
+                               'what_to_do_desc' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'how_to_do_desc' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'control_group_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'control_type_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_control_group' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'group_name' => array('type' => 
'varchar','precision' => '255','nullable' => false)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_check_item' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'control_item_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'status' => array('type' => 'bool','nullable' 
=> true,'default' => 'false'),
+                               'comment' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'check_list_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_check_list' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'control_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'check_list_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'status' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'comment' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'deadline' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'controller_procedure' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'title' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                               'purpose' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
+                               'responsibility' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
+                               'description' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
+                               'reference' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
+                               'attachment' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+       );

Added: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php                                
(rev 0)
+++ trunk/controller/setup/tables_update.inc.php        2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,35 @@
+<?php
+
+        /* Update Controller from v 0.1 to 0.1.1
+        */
+
+       $test[] = '0.1';
+       function controller_upgrade0_1()
+       {
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'activity_organization', array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'district' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'homepage' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'description' => array('type' => 
'text','nullable' => false),
+                               'email' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'phone' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'orgno' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'change_type' => array('type' => 
'varchar','precision' => '255','default' => 'new','nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );
+               
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.1';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
+       
+?>
\ No newline at end of file

Added: trunk/controller/templates/base/common.php
===================================================================
--- trunk/controller/templates/base/common.php                          (rev 0)
+++ trunk/controller/templates/base/common.php  2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,987 @@
+<script type="text/javascript">
+
+/**
+ * Javascript for the controller module.  Holds datasource init functions and 
form helpers.
+ *
+ * Functions and objects within this file are kept in the YAHOO.controller 
namespace.
+ */
+
+       // Holds data source setup funtions
+       YAHOO.controller.setupDatasource = new Array();
+
+       //Holds all data sources
+       YAHOO.controller.datatables = new Array();
+
+       counter = 0;
+       // Adds data source setup funtions
+       function setDataSource(source_url, column_defs, form_id, filter_ids, 
container_id, paginator_id, datatable_id,rel_id, editor_action, 
disable_left_click) {
+               YAHOO.controller.setupDatasource.push(
+                       function() {
+                               this.url = source_url;
+                               this.columns = column_defs;
+                               this.form = form_id;
+                               this.filters = filter_ids;
+                               this.container = container_id;
+                               this.paginator = paginator_id;
+                               this.tid = datatable_id;
+                               this.related_datatable = rel_id;
+                               this.editor_action = editor_action;
+                               if(disable_left_click) {
+                                       this.disable_left_click = true;
+                               } else {
+                                       this.disable_left_click = false;
+                               }
+                       }
+               );
+       }
+
+       YAHOO.controller.formatDate = function(elCell, oRecord, oColumn, oData) 
{
+               //alert("oDate: " + oData);
+               if (oData && oData != "Invalid Date" && oData != "NaN") {
+                       var my_date = Math.round(Date.parse(oData) / 1000);
+                       elCell.innerHTML = formatDate('<?php echo 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] ?>', 
my_date);
+               } else {
+                       elCell.innerHTML = "";
+               }
+       };
+
+       // Override the built-in formatter
+       YAHOO.widget.DataTable.formatCurrency = function(elCell, oRecord, 
oColumn, oData) {
+               if (oData != undefined) {
+                       elCell.innerHTML = YAHOO.util.Number.format( oData,
+                       {
+                               prefix: "<?php echo 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'].' ' ?>",
+                               thousandsSeparator: ",",
+                               decimalPlaces: 2
+                   });
+               }
+               //if (oData != undefined) {
+               //      elCell.innerHTML = '<?php echo 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'].' ' ?>' + 
parseFloat(oData).toFixed(2);
+               //}
+       };
+
+       // Reloads all data sources that are necessary based on the selected 
related datatable
+       function reloadDataSources(selected_datatable){
+
+               //... hooks into  the regular callback function 
(onDataReturnInitializeTable) call to set empty payload array
+               var loaded =  function  ( sRequest , oResponse , oPayload ) {
+                       var payload = new Array();
+                       this.onDataReturnInitializeTable( sRequest , oResponse 
, payload );
+               }
+
+               //... refresh the selected data tables
+               
selected_datatable.getDataSource().sendRequest('',{success:loaded, 
scope:selected_datatable});
+
+               //... traverse all datatables and refresh related (to the 
selected) data tables
+               for(var i=0; i<YAHOO.controller.datatables.length; i++){
+                       var datatable = YAHOO.controller.datatables[i];
+
+                       for(var j=0;j<selected_datatable.related.length;j++){
+                               var curr_related = 
selected_datatable.related[j];
+                               if(datatable.tid == curr_related){
+                                       
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
+                               }
+                       }
+               }
+       }
+
+       var highlightEditableCell = function(oArgs) {
+               var elCell = oArgs.target;
+               if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+                       this.highlightCell(elCell);
+               }
+       };
+
+       // Wraps data sources setup logic
+       function dataSourceWrapper(source_properties,pag) {
+
+               this.properties = source_properties;
+               this.paginator = pag;
+
+               //... prepare base url
+               this.url = this.properties.url;
+               if(this.url[length-1] != '&') {
+                       this.url += '&';
+               }
+
+               //... set up a new data source
+               this.source = new YAHOO.util.DataSource(this.url);
+
+               this.source.responseType = YAHOO.util.DataSource.TYPE_JSON;
+               this.source.connXhrMode = "queueRequests";
+
+               this.source.responseSchema = {
+                       resultsList: "ResultSet.Result",
+                       fields: this.properties.columns,
+                       metaFields : {
+                               totalRecords: "ResultSet.totalRecords"
+                       }
+               };
+
+               //... set up a new data table
+               if(this.properties.tid == 'total_price')
+               {
+                       //if the datatable is display of total price on 
contract, always initialize
+                       this.table = new YAHOO.widget.DataTable(
+                               this.properties.container,
+                               this.properties.columns,
+                               this.source,
+                               {
+                                       paginator: this.paginator,
+                                       dynamicData: true,
+                                       MSG_EMPTY: '<?php echo 
lang("DATATABLE_MSG_EMPTY")?>',
+                                       MSG_ERROR: '<?php echo 
lang("DATATABLE_MSG_ERROR")?>',
+                                       MSG_LOADING: '<?php echo 
lang("DATATABLE_MSG_LOADING")?>'
+                               }
+                       );
+               }
+               else
+               {
+                       this.table = new YAHOO.widget.DataTable(
+                               this.properties.container,
+                               this.properties.columns,
+                               this.source,
+                               {
+                                       paginator: this.paginator,
+                                       dynamicData: true,
+                                       <?php
+                                               $populate = 
phpgw::get_var('populate_form'); 
+                                               echo isset($populate)? 
'initialLoad: false,':''
+                                       ?>
+                                       <?php 
+                                               $initLoad = 
phpgw::get_var('initial_load');
+                                               echo ($initLoad == 'no')? 
'initialLoad: false,':''
+                                       ?>
+                                       MSG_EMPTY: '<?php echo 
lang("DATATABLE_MSG_EMPTY")?>',
+                                       MSG_ERROR: '<?php echo 
lang("DATATABLE_MSG_ERROR")?>',
+                                       MSG_LOADING: '<?php echo 
lang("DATATABLE_MSG_LOADING")?>'
+                               }
+                       );
+               }
+
+               //... set table properties
+               this.table.related = this.properties.related_datatable;
+               this.table.tid = this.properties.tid;
+               this.table.container_id = this.properties.container;
+               this.table.editor_action = this.properties.editor_action;
+
+               //... push the data table on a stack
+               YAHOO.controller.datatables.push(this.table);
+
+               //... ?
+               this.table.handleDataReturnPayload = function(oRequest, 
oResponse, oPayload) {
+                       if(oPayload){
+                               oPayload.totalRecords = 
oResponse.meta.totalRecords;
+                               return oPayload;
+                       }
+               }
+
+               //... create context menu for each record after the table has 
loaded the data
+               this.table.doAfterLoadData = function() {
+                       onContextMenuBeforeShow = function(p_sType, p_aArgs)
+                       {
+                               var oTarget = this.contextEventTarget;
+                               if (this.getRoot() == this)
+                               {
+                                       if(oTarget.tagName != "TD")
+                                       {
+                                               oTarget = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+                                       }
+                                       oSelectedTR = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+                                       oSelectedTR.style.backgroundColor  = 
'#AAC1D8' ;
+                                       oSelectedTR.style.color = "black";
+                                       YAHOO.util.Dom.addClass(oSelectedTR, 
prefixSelected);
+                               }
+                       }
+
+                       onContextMenuHide = function(p_sType, p_aArgs)
+                       {
+                               if (this.getRoot() == this && oSelectedTR)
+                               {
+                                       oSelectedTR.style.backgroundColor  = "" 
;
+                                       oSelectedTR.style.color = "";
+                                       YAHOO.util.Dom.removeClass(oSelectedTR, 
prefixSelected);
+                               }
+                       }
+                       
+                       var records = this.getRecordSet();
+                       var validRecords = 0;
+                       for(var i=0; i<records.getLength(); i++) {
+                               var record = records.getRecord(i);
+                               if(record == null)
+                               {
+                                       continue;
+                               }
+                               else
+                               {
+                                       validRecords++;
+                               }
+                                       
+                               // use a global counter to create unique names 
(even for the same datatable) for all context menues on the page
+                               var menuName = this.container_id + "_cm_" + 
counter;
+                               counter++;
+
+                               //... add menu items with label and handler 
function for click events
+                               var labels = record.getData().labels;
+                               //create a context menu that triggers on the 
HTML row element
+                               record.menu = new 
YAHOO.widget.ContextMenu(menuName,{trigger:this.getTrEl(validRecords -1 
),itemdata: labels, lazyload: true});
+
+                               //... subscribe handler for click events
+                               
record.menu.clickEvent.subscribe(onContextMenuClick, this);
+                               record.menu.subscribe("beforeShow", 
onContextMenuBeforeShow);
+                               record.menu.subscribe("hide", 
onContextMenuHide);
+
+                               //... render the menu on the related table row
+                               
record.menu.render(this.getTrEl(validRecords-1));
+                       }
+
+                       
+               }
+
+               //... calback methods for handling ajax calls
+               var ajaxResponseSuccess = function(o){
+                       reloadDataSources(this.args);
+               };
+
+               var ajaxResponseFailure = function(o){
+                       reloadDataSources(this.args);
+               };
+
+               //...create a handler for context menu clicks
+               var onContextMenuClick = function(eventString, args, table) {
+                       //... the argument holds the selected index number in 
the context menu
+                       var task = args[1];
+                       //... only act on a data table
+                       if(table instanceof YAHOO.widget.DataTable) {
+                               //... retrieve the record based on the selected 
table row
+                               var row = 
table.getTrEl(this.contextEventTarget);
+                               var record = table.getRecord(row);
+
+                               //... check whether this action should be an 
AJAX call
+                               if(record.getData().ajax[task.index]) {
+                                       var request = 
YAHOO.util.Connect.asyncRequest(
+                                               'GET',
+                                               record.getData().actions[ 
task.index ],
+                                               {
+                                                       success: 
ajaxResponseSuccess,
+                                                       success: 
ajaxResponseFailure,
+                                                       args:table
+                                               });
+                               } else {
+                                       window.location = 
record.getData().actions[task.index];
+                               }
+                       }
+               };
+
+               // Handle mouseover and click events for inline editing
+               this.table.subscribe("cellMouseoverEvent", 
highlightEditableCell);
+               this.table.subscribe("cellMouseoutEvent", 
this.table.onEventUnhighlightCell);
+               this.table.subscribe("cellClickEvent", 
this.table.onEventShowCellEditor);
+
+               this.table.subscribe("editorSaveEvent", function(oArgs) {
+                       var field = oArgs.editor.getColumn().field;
+                       var value = oArgs.newData;
+                       var id = oArgs.editor.getRecord().getData().id;
+                       var action = oArgs.editor.getDataTable().editor_action;
+
+                       // Translate to unix time if the editor is a calendar.
+                       if (oArgs.editor._sType == 'date') {
+                               var selectedDate = 
oArgs.editor.calendar.getSelectedDates()[0];
+                               //alert("selDate1: " + selectedDate);
+                               // Make sure we're at midnight GMT
+                               selectedDate = selectedDate.toString().split(" 
");
+                               //for(var e=0;e<selectedDate.length;e++){
+                               //      alert("element " + e + ": " + 
selectedDate[e]);
+                               //}
+                               if(selectedDate[3] == "00:00:00"){
+                               //      alert("seldate skal byttes!");
+                                       selectedDate = 
selectedDate.slice(0,3).join(" ") + " " + selectedDate[5] + " 00:00:00 GMT"; 
+                               }
+                               else{
+                                       selectedDate = 
selectedDate.slice(0,4).join(" ") + " 00:00:00 GMT";
+                               }
+                               //selectedDate = 
selectedDate.toString().split(" ").slice(0, 4).join(" ") + " 00:00:00 GMT";
+                               //alert("selDate2: " + selectedDate);
+                               var value = Math.round(Date.parse(selectedDate) 
/ 1000);
+                               //alert("selDate3 value: " + value);
+                       }
+
+                       var request = YAHOO.util.Connect.asyncRequest(
+                                       'GET',
+                                       'index.php?menuaction=' + action + 
"&amp;field=" + field + "&amp;value=" + value + "&amp;id=" + id,
+                                       {
+                                               success: ajaxResponseSuccess,
+                                               failure: ajaxResponseFailure,
+                                               args:oArgs.editor.getDataTable()
+                                       }
+                               );
+               });
+
+               // Don't set the row to be left-clickable if the table is 
editable by inline editors.
+               // In that case we use cellClickEvents instead
+               var table_should_be_clickable = true;
+               for (i in this.properties.columns) {
+                       if (this.properties.columns[i].editor) {
+                               table_should_be_clickable = false;
+                       }
+               }
+
+               if (table_should_be_clickable && 
!this.properties.disable_left_click) {
+                       //... create a handler for regular clicks on a table row
+                       this.table.subscribe("rowClickEvent", function(e,obj) {
+                               YAHOO.util.Event.stopEvent(e);
+
+                               //... trigger first action on row click
+                               var row = obj.table.getTrEl(e.target);
+                               if(row) {
+                                       var record = obj.table.getRecord(row);
+
+                                       //... check whether this action should 
be an AJAX call
+                                       if(record.getData().ajax[0]) {
+                                               var request = 
YAHOO.util.Connect.asyncRequest(
+                                                       'GET',
+                                                       //... execute first 
action
+                                                       
record.getData().actions[0],
+                                                       {
+                                                               success: 
ajaxResponseSuccess,
+                                                               failure: 
ajaxResponseFailure,
+                                                               args:obj.table
+                                                       }
+                                               );
+                                       } else {
+                                               //... execute first action
+                                               window.location = 
record.getData().actions[0];
+                                       }
+                               }
+                       },this);
+
+                       //... highlight rows on mouseover.  This too only 
happens if the table is
+                       // not editable.
+                       this.table.subscribe("rowMouseoverEvent", 
this.table.onEventHighlightRow);
+                       this.table.subscribe("rowMouseoutEvent", 
this.table.onEventUnhighlightRow);
+               }
+
+
+               //... create context menues when the table renders
+               this.table.subscribe("renderEvent",this.table.doAfterLoadData);
+
+               //... listen for form submits and filter changes
+               
YAHOO.util.Event.addListener(this.properties.form,'submit',formListener,this,true);
+               YAHOO.util.Event.addListener(this.properties.filters, 
'change',formListener,this,true);
+       }
+
+
+       // Set up data sources when the document has loaded
+       YAHOO.util.Event.addListener(window, "load", function() {
+               var i = 0;
+               while(YAHOO.controller.setupDatasource.length > 0){
+                       //... create a variable name, assign set up function to 
that variable and instantiate properties
+                       variableName = "YAHOO.controller.datasource" + i;
+                       eval(variableName + " = 
YAHOO.controller.setupDatasource.shift()");
+                       var source_properties = eval("new " + variableName + 
"()");
+
+<?php
+       if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] 
> 0)
+       {
+               $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+       }
+       else {
+               $user_rows_per_page = 10;
+       }
+?>
+
+                       // ... create a paginator for this datasource
+                       var pag = new YAHOO.widget.Paginator({
+                               rowsPerPage: <?php echo $user_rows_per_page ?>,
+                               alwaysVisible: true,
+                               rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+                               firstPageLinkLabel: "<< <?php echo 
lang('first') ?>",
+                               previousPageLinkLabel: "< <?php echo 
lang('previous') ?>",
+                               nextPageLinkLabel: "<?php echo lang('next') ?> 
>",
+                               lastPageLinkLabel: "<?php echo lang('last') ?> 
>>",
+                               template                        : 
"{RowsPerPageDropdown}<?php echo lang('elements_pr_page') 
?>.{CurrentPageReport}<br/>  {FirstPageLink} {PreviousPageLink} {PageLinks} 
{NextPageLink} {LastPageLink}",
+                               pageReportTemplate      : "<?php echo 
lang('shows_from') ?> {startRecord} <?php echo lang('to') ?> {endRecord} <?php 
echo lang('of_total') ?> {totalRecords}.",
+                               containers: [source_properties.paginator]
+                       });
+
+                       pag.render();
+
+                       //... send data source properties and paginator to 
wrapper function
+                       this.wrapper = new dataSourceWrapper(source_properties, 
pag);
+                       i+=1;
+
+                       <?php
+                               $populate = phpgw::get_var('populate_form');
+                               if(isset($populate)){?>
+                                       var qs = 
YAHOO.controller.serializeForm(source_properties.form);
+                                   this.wrapper.source.liveData = 
this.wrapper.url + qs + '&';
+                                   this.wrapper.source.sendRequest('', 
{success: function(sRequest, oResponse, oPayload) {
+                                       
this.wrapper.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.wrapper.paginator);
+                                   }, scope: this});
+                       <?php }
+                       ?>
+
+                       // XXX: Create generic column picker for all datasources
+
+                       // Shows dialog, creating one when necessary
+                       var newCols = true;
+                       var showDlg = function(e) {
+                               YAHOO.util.Event.stopEvent(e);
+
+                               if(newCols) {
+                                       // Populate Dialog
+                                       // Using a template to create elements 
for the SimpleDialog
+                                       var allColumns = 
this.wrapper.table.getColumnSet().keys;
+                                       var elPicker = 
YAHOO.util.Dom.get("dt-dlg-picker");
+                                       var elTemplateCol = 
document.createElement("div");
+                                       YAHOO.util.Dom.addClass(elTemplateCol, 
"dt-dlg-pickercol");
+                                       var elTemplateKey = 
elTemplateCol.appendChild(document.createElement("span"));
+                                       YAHOO.util.Dom.addClass(elTemplateKey, 
"dt-dlg-pickerkey");
+                                       var elTemplateBtns = 
elTemplateCol.appendChild(document.createElement("span"));
+                                       YAHOO.util.Dom.addClass(elTemplateBtns, 
"dt-dlg-pickerbtns");
+                                       var onclickObj = {fn:handleButtonClick, 
obj:this, scope:false };
+
+                                       // Create one section in the 
SimpleDialog for each Column
+                                       var elColumn, elKey, elButton, 
oButtonGrp;
+
+                                       for(var 
i=0,l=allColumns.length;i<l;i++) {
+                                               var oColumn = allColumns[i];
+                                               if(oColumn.label != 
'unselectable') { // We haven't marked the column as unselectable for the user
+                                                       // Use the template
+                                                       elColumn = 
elTemplateCol.cloneNode(true);
+
+                                                       // Write the Column key
+                                                       elKey = 
elColumn.firstChild;
+                                                       elKey.innerHTML = 
oColumn.label;
+
+                                                       // Create a ButtonGroup
+                                                       oButtonGrp = new 
YAHOO.widget.ButtonGroup({
+                                                               id: 
"buttongrp"+i,
+                                                               name: 
oColumn.getKey(),
+                                                               container: 
elKey.nextSibling
+                                                       });
+                                                       oButtonGrp.addButtons([
+                                                               { label: "Vis", 
value: "Vis", checked: ((!oColumn.hidden)), onclick: onclickObj},
+                                                               { label: 
"Skjul", value: "Skjul", checked: ((oColumn.hidden)), onclick: onclickObj}
+                                                       ]);
+
+                                                       
elPicker.appendChild(elColumn);
+                                               }
+                                       }
+
+                                       newCols = false;
+                               }
+
+                               myDlg.show();
+                       };
+
+                       var storeColumnsUrl = YAHOO.controller.storeColumnsUrl;
+                       var hideDlg = function(e) {
+                               this.hide();
+                               // After we've hidden the dialog we send a post 
call to store the columns the user has selected
+                               var postData = 'values[save]=1';
+                               var allColumns = 
wrapper.table.getColumnSet().keys;
+                               for(var i=0; i < allColumns.length; i++) {
+                                       if(!allColumns[i].hidden){
+                                               postData += 
'&values[columns][]=' + allColumns[i].getKey();
+                                       }
+                               }
+
+                               YAHOO.util.Connect.asyncRequest('POST', 
storeColumnsUrl, null, postData);
+                       };
+
+                       var handleButtonClick = function(e, oSelf) {
+                               var sKey = this.get("name");
+                               if(this.get("value") === "Skjul") {
+                                       // Hides a Column
+                                       wrapper.table.hideColumn(sKey);
+                               } else {
+                                       // Shows a Column
+                                       wrapper.table.showColumn(sKey);
+                               }
+                       };
+
+                       // Create the SimpleDialog
+                       YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
+                       var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
+                               width: "30em",
+                               visible: false,
+                               modal: false, // modal: true doesn't work for 
some reason - the dialog becomes unclickable
+                               buttons: [
+                                       {text:"Lukk", handler:hideDlg}
+                               ],
+                               fixedcenter: true,
+                               constrainToViewport: true
+                       });
+                       myDlg.render();
+
+                       // Nulls out myDlg to force a new one to be created
+                       wrapper.table.subscribe("columnReorderEvent", 
function(){
+                               newCols = true;
+                               YAHOO.util.Event.purgeElement("dt-dlg-picker", 
true);
+                               YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = 
"";
+                       }, this, true);
+
+                       // Hook up the SimpleDialog to the link
+                       YAHOO.util.Event.addListener("dt-options-link", 
"click", showDlg, this, true);
+               }
+       });
+
+       /*
+        * Listen for events in form. Serialize all form elements. Stop
+        * the original request and send new request.
+        */
+       function formListener(event){
+               YAHOO.util.Event.stopEvent(event);
+               var qs = YAHOO.controller.serializeForm(this.properties.form);
+           this.source.liveData = this.url + qs + '&';
+           this.source.sendRequest('', {success: function(sRequest, oResponse, 
oPayload) {
+               this.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.paginator);
+           }, scope: this});
+       }
+
+
+
+// TODO: All the calendar data must be removed when the 'old' calender is no 
longer used.
+
+// CALENDAR LOGIC
+
+function onClickOnInput(event)
+{
+       this.align();
+       this.show();
+}
+
+function closeCalender(event)
+{
+       YAHOO.util.Event.stopEvent(event);
+       this.hide();
+}
+
+function clearCalendar(event)
+{
+       YAHOO.util.Event.stopEvent(event);
+       this.clear();
+       document.getElementById(this.inputFieldID).value = '';
+       document.getElementById(this.hiddenField).value = '';
+}
+
+function initCalendar(inputFieldID, divContainerID, calendarBodyId, 
calendarTitle, closeButton,clearButton,hiddenField,noPostOnSelect)
+{
+       console.log("i init!!! " + inputFieldID + " : " + divContainerID + " : 
" + calendarBodyId + " : " + calendarTitle );
+       var overlay = new YAHOO.widget.Dialog(
+               divContainerID,
+               {       visible: false,
+                       close: true
+               }
+       );
+
+       var navConfig = {
+                       strings: {
+                               month:"<?php echo lang('month') ?>",
+                               year:"<?php echo lang('year') ?>",
+                               submit: "<?php echo lang('ok') ?>",
+                               cancel: "<?php echo lang('cancel') ?>",
+                               invalidYear: "<?php echo 
lang('select_date_valid_year') ?>"
+                               },
+                               initialFocus: "month"
+                       }
+       
+       var cal = new YAHOO.widget.Calendar(
+               calendarBodyId,
+               {       navigator:navConfig,
+                       title: '<?php echo lang('select_date') ?>',
+                       start_weekday:1,
+                       LOCALE_WEEKDAYS:"short"}
+       );
+
+       cal.cfg.setProperty("MONTHS_LONG",<?php echo lang('calendar_months') 
?>);
+       cal.cfg.setProperty("WEEKDAYS_SHORT",<?php echo 
lang('calendar_weekdays') ?>);
+       cal.render();
+
+       
cal.selectEvent.subscribe(onCalendarSelect,[inputFieldID,overlay,hiddenField,noPostOnSelect],false);
+       cal.inputFieldID = inputFieldID;
+       cal.hiddenField = hiddenField;
+
+       
YAHOO.util.Event.addListener(closeButton,'click',closeCalender,overlay,true);
+       
YAHOO.util.Event.addListener(clearButton,'click',clearCalendar,cal,true);
+       
YAHOO.util.Event.addListener(inputFieldID,'click',onClickOnInput,overlay,true);
+
+       return cal;
+}
+
+function onCalendarSelect(type,args,array){
+       //console.log("onCalendarSelect");
+       var firstDate = args[0][0];
+       var month = firstDate[1] + "";
+       var day = firstDate[2] + "";
+       var year = firstDate[0] + "";
+       var date = month + "/" + day + "/" + year;
+       var hiddenDateField = document.getElementById(array[2]);
+       if(hiddenDateField != null)
+       {
+               if(month < 10)
+               {
+                       month = '0' + month;
+               }
+               if(day < 10)
+               {
+                       day = '0' + day;
+               }
+               hiddenDateField.value = year + '-' + month + '-' + day;
+       }
+       document.getElementById(array[0]).value = formatDate('<?php echo 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] 
?>',Math.round(Date.parse(date)/1000));
+       array[1].hide();
+       if (cal_postOnChange || (array[3] != undefined && !array[3])) {
+               document.getElementById('ctrl_search_button').click();
+       }
+
+}
+
+/**
+ * Update the selected calendar date with a date from an input field
+ * Input field value must be of the format YYYY-MM-DD
+ */
+function updateCalFromInput(cal, inputId) {
+       var txtDate1 = document.getElementById(inputId);
+
+       if (txtDate1.value != "") {
+
+               var date_elements = txtDate1.value.split('-');
+               var year = date_elements[0];
+               var month = date_elements[1];
+               var day = date_elements[2];
+
+               cal.select(month + "/" + day + "/" + year);
+               var selectedDates = cal.getSelectedDates();
+               if (selectedDates.length > 0) {
+                       var firstDate = selectedDates[0];
+                       cal.cfg.setProperty("pagedate", 
(firstDate.getMonth()+1) + "/" + firstDate.getFullYear());
+                       cal.render();
+               }
+
+       }
+}
+
+function formatDate ( format, timestamp ) {
+    // http://kevin.vanzonneveld.net
+    // +   original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
+    // +      parts by: Peter-Paul Koch 
(http://www.quirksmode.org/js/beat.html)
+    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+    // +   improved by: MeEtc (http://yass.meetcweb.com)
+    // +   improved by: Brad Touesnard
+    // +   improved by: Tim Wiel
+    // +   improved by: Bryan Elliott
+    // +   improved by: Brett Zamir (http://brett-zamir.me)
+    // +   improved by: David Randall
+    // +      input by: Brett Zamir (http://brett-zamir.me)
+    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+    // +   improved by: Brett Zamir (http://brett-zamir.me)
+    // +   improved by: Brett Zamir (http://brett-zamir.me)
+    // +   derived from: gettimeofday
+    // %        note 1: Uses global: php_js to store the default timezone
+    // *     example 1: date('H:m:s \\m \\i\\s \\m\\o\\n\\t\\h', 1062402400);
+    // *     returns 1: '09:09:40 m is month'
+    // *     example 2: date('F j, Y, g:i a', 1062462400);
+    // *     returns 2: 'September 2, 2003, 2:26 am'
+    // *     example 3: date('Y W o', 1062462400);
+    // *     returns 3: '2003 36 2003'
+    // *     example 4: x = date('Y m d', (new Date()).getTime()/1000); // 
2009 01 09
+    // *     example 4: (x+'').length == 10
+    // *     returns 4: true
+
+    var jsdate=(
+        (typeof(timestamp) == 'undefined') ? new Date() : // Not provided
+        (typeof(timestamp) == 'number') ? new Date(timestamp*1000) : // UNIX 
timestamp
+        new Date(timestamp) // Javascript Date()
+    ); // , tal=[]
+    var pad = function(n, c){
+        if( (n = n + "").length < c ) {
+            return new Array(++c - n.length).join("0") + n;
+        } else {
+            return n;
+        }
+    };
+    var _dst = function (t) {
+        // Calculate Daylight Saving Time (derived from gettimeofday() code)
+        var dst=0;
+        var jan1 = new Date(t.getFullYear(), 0, 1, 0, 0, 0, 0);  // jan 1st
+        var june1 = new Date(t.getFullYear(), 6, 1, 0, 0, 0, 0); // june 1st
+        var temp = jan1.toUTCString();
+        var jan2 = new Date(temp.slice(0, temp.lastIndexOf(' ')-1));
+        temp = june1.toUTCString();
+        var june2 = new Date(temp.slice(0, temp.lastIndexOf(' ')-1));
+        var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
+        var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60);
+
+        if (std_time_offset === daylight_time_offset) {
+            dst = 0; // daylight savings time is NOT observed
+        }
+        else {
+            // positive is southern, negative is northern hemisphere
+            var hemisphere = std_time_offset - daylight_time_offset;
+            if (hemisphere >= 0) {
+                std_time_offset = daylight_time_offset;
+            }
+            dst = 1; // daylight savings time is observed
+        }
+        return dst;
+    };
+    var ret = '';
+    var txt_weekdays = ["Sunday","Monday","Tuesday","Wednesday",
+        "Thursday","Friday","Saturday"];
+    var txt_ordin = {1:"st",2:"nd",3:"rd",21:"st",22:"nd",23:"rd",31:"st"};
+    var txt_months =  ["", "January", "February", "March", "April",
+        "May", "June", "July", "August", "September", "October", "November",
+        "December"];
+
+    var f = {
+        // Day
+            d: function(){
+                return pad(f.j(), 2);
+            },
+            D: function(){
+                var t = f.l();
+                return t.substr(0,3);
+            },
+            j: function(){
+                return jsdate.getDate();
+            },
+            l: function(){
+                return txt_weekdays[f.w()];
+            },
+            N: function(){
+                return f.w() + 1;
+            },
+            S: function(){
+                return txt_ordin[f.j()] ? txt_ordin[f.j()] : 'th';
+            },
+            w: function(){
+                return jsdate.getDay();
+            },
+            z: function(){
+                return (jsdate - new Date(jsdate.getFullYear() + "/1/1")) / 
864e5 >> 0;
+            },
+
+        // Week
+            W: function(){
+                var a = f.z(), b = 364 + f.L() - a;
+                var nd2, nd = (new Date(jsdate.getFullYear() + 
"/1/1").getDay() || 7) - 1;
+
+                if(b <= 2 && ((jsdate.getDay() || 7) - 1) <= 2 - b){
+                    return 1;
+                }
+                if(a <= 2 && nd >= 4 && a >= (6 - nd)){
+                    nd2 = new Date(jsdate.getFullYear() - 1 + "/12/31");
+                    return date("W", Math.round(nd2.getTime()/1000));
+                }
+                return (1 + (nd <= 3 ? ((a + nd) / 7) : (a - (7 - nd)) / 7) >> 
0);
+            },
+
+        // Month
+            F: function(){
+                return txt_months[f.n()];
+            },
+            m: function(){
+                return pad(f.n(), 2);
+            },
+            M: function(){
+                var t = f.F();
+                return t.substr(0,3);
+            },
+            n: function(){
+                return jsdate.getMonth() + 1;
+            },
+            t: function(){
+                var n;
+                if( (n = jsdate.getMonth() + 1) == 2 ){
+                    return 28 + f.L();
+                }
+                if( n & 1 && n < 8 || !(n & 1) && n > 7 ){
+                    return 31;
+                }
+                return 30;
+            },
+
+        // Year
+            L: function(){
+                var y = f.Y();
+                return (!(y & 3) && (y % 1e2 || !(y % 4e2))) ? 1 : 0;
+            },
+            o: function(){
+                if (f.n() === 12 && f.W() === 1) {
+                    return jsdate.getFullYear()+1;
+                }
+                if (f.n() === 1 && f.W() >= 52) {
+                    return jsdate.getFullYear()-1;
+                }
+                return jsdate.getFullYear();
+            },
+            Y: function(){
+                return jsdate.getFullYear();
+            },
+            y: function(){
+                return (jsdate.getFullYear() + "").slice(2);
+            },
+
+        // Time
+            a: function(){
+                return jsdate.getHours() > 11 ? "pm" : "am";
+            },
+            A: function(){
+                return f.a().toUpperCase();
+            },
+            B: function(){
+                // peter paul koch:
+                var off = (jsdate.getTimezoneOffset() + 60)*60;
+                var theSeconds = (jsdate.getHours() * 3600) +
+                                 (jsdate.getMinutes() * 60) +
+                                  jsdate.getSeconds() + off;
+                var beat = Math.floor(theSeconds/86.4);
+                if (beat > 1000) {
+                    beat -= 1000;
+                }
+                if (beat < 0) {
+                    beat += 1000;
+                }
+                if ((String(beat)).length == 1) {
+                    beat = "00"+beat;
+                }
+                if ((String(beat)).length == 2) {
+                    beat = "0"+beat;
+                }
+                return beat;
+            },
+            g: function(){
+                return jsdate.getHours() % 12 || 12;
+            },
+            G: function(){
+                return jsdate.getHours();
+            },
+            h: function(){
+                return pad(f.g(), 2);
+            },
+            H: function(){
+                return pad(jsdate.getHours(), 2);
+            },
+            i: function(){
+                return pad(jsdate.getMinutes(), 2);
+            },
+            s: function(){
+                return pad(jsdate.getSeconds(), 2);
+            },
+            u: function(){
+                return pad(jsdate.getMilliseconds()*1000, 6);
+            },
+
+        // Timezone
+            e: function () {
+/*                var abbr='', i=0;
+                if (this.php_js && this.php_js.default_timezone) {
+                    return this.php_js.default_timezone;
+                }
+                if (!tal.length) {
+                    tal = timezone_abbreviations_list();
+                }
+                for (abbr in tal) {
+                    for (i=0; i < tal[abbr].length; i++) {
+                        if (tal[abbr][i].offset === 
-jsdate.getTimezoneOffset()*60) {
+                            return tal[abbr][i].timezone_id;
+                        }
+                    }
+                }
+*/
+                return 'UTC';
+            },
+            I: function(){
+                return _dst(jsdate);
+            },
+            O: function(){
+               var t = pad(Math.abs(jsdate.getTimezoneOffset()/60*100), 4);
+               t = (jsdate.getTimezoneOffset() > 0) ? "-"+t : "+"+t;
+               return t;
+            },
+            P: function(){
+                var O = f.O();
+                return (O.substr(0, 3) + ":" + O.substr(3, 2));
+            },
+            T: function () {
+/*                var abbr='', i=0;
+                if (!tal.length) {
+                    tal = timezone_abbreviations_list();
+                }
+                if (this.php_js && this.php_js.default_timezone) {
+                    for (abbr in tal) {
+                        for (i=0; i < tal[abbr].length; i++) {
+                            if (tal[abbr][i].timezone_id === 
this.php_js.default_timezone) {
+                                return abbr.toUpperCase();
+                            }
+                        }
+                    }
+                }
+                for (abbr in tal) {
+                    for (i=0; i < tal[abbr].length; i++) {
+                        if (tal[abbr][i].offset === 
-jsdate.getTimezoneOffset()*60) {
+                            return abbr.toUpperCase();
+                        }
+                    }
+                }
+*/
+                return 'UTC';
+            },
+            Z: function(){
+               return -jsdate.getTimezoneOffset()*60;
+            },
+
+        // Full Date/Time
+            c: function(){
+                return f.Y() + "-" + f.m() + "-" + f.d() + "T" + f.h() + ":" + 
f.i() + ":" + f.s() + f.P();
+            },
+            r: function(){
+                return f.D()+', '+f.d()+' '+f.M()+' '+f.Y()+' 
'+f.H()+':'+f.i()+':'+f.s()+' '+f.O();
+            },
+            U: function(){
+                return Math.round(jsdate.getTime()/1000);
+            }
+    };
+
+    return format.replace(/[\\]?([a-zA-Z])/g, function(t, s){
+        if( t!=s ){
+            // escaped
+            ret = s;
+        } else if( f[s] ){
+            // a date function exists
+            ret = f[s]();
+        } else{
+            // nothing special
+            ret = s;
+        }
+        return ret;
+    });
+}
+/*
+YAHOO.controller.autocompleteHelper = function(url, field, hidden, container, 
label_attr) {
+       label_attr = label_attr || 'name';
+       var myDataSource = new YAHOO.util.DataSource(url);
+       myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+       myDataSource.connXhrMode = "queueRequests";
+       myDataSource.responseSchema = {
+               resultsList: "ResultSet.Result",
+               fields: [label_attr, 'id']
+       };
+       myDataSource.maxCacheEntries = 5; 
+       console.log(myDataSource);
+       console.log(field);
+       console.log(container);
+       var ac = new YAHOO.widget.AutoComplete(field, container, myDataSource);
+       ac.queryQuestionMark = false;
+       ac.resultTypeList = false;
+       ac.forceSelection = true;
+       console.log(ac);
+       ac.itemSelectEvent.subscribe(function(sType, aArgs) {
+               YAHOO.util.Dom.get(hidden).value = aArgs[2].id;
+       });
+       return ac;
+};
+*/
+</script>

Added: trunk/controller/templates/base/control.php
===================================================================
--- trunk/controller/templates/base/control.php                         (rev 0)
+++ trunk/controller/templates/base/control.php 2011-09-05 06:29:33 UTC (rev 
7552)
@@ -0,0 +1,147 @@
+<?php  
+//include common logic for all templates
+       include("common.php");
+       phpgwapi_yui::load_widget('tabview');
+       phpgwapi_yui::tabview_setup('controller_tabview');
+?>
+
+<div class="identifier-header">
+<h1><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/32x32/actions/go-home.png" /> <?php echo lang('control') ?></h1>
+       <div>
+               <button onclick="javascript:window.location.href ='<?php echo 
$cancel_link;?>;'">&laquo;&nbsp;<?php //echo 
lang('composite_back');?></button><br/>
+               <label><?php echo lang('name') ?> </label><?php //echo 
$composite->get_name() ?>
+       </div>
+</div>
+
+
+<div id="controller_tabview" class="yui-navset">
+       <ul class="yui-nav">
+               <li class="selected"><a href="#details"><em><img src="<?php 
echo RENTAL_TEMPLATE_PATH ?>images/16x16/actions/go-home.png" alt="icon" /> 
<?php echo lang('details') ?></em></a></li>
+               
+               <?php //if($composite->get_id() > 0) { ?>
+               
+               <li><a href="#elements"><em><img src="<?php echo 
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-drawing-template.png" 
alt="icon" /> <?php echo lang('units') ?></em></a></li>
+               <li><a href="#controlitems"><em><img src="<?php echo 
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-drawing-template.png" 
alt="icon" /> <?php echo lang('control_items') ?></em></a></li>
+
+               <?php //} ?>
+       </ul>
+       
+<div class="yui-content">
+               <div id="details">
+                       <form action="#" method="post">
+                               <input type="hidden" name="id" value="<?php 
if(!empty($control)){ echo $control->get_id(); } else { echo '0'; }  ?>"/>
+                               <dl class="proplist-col">
+                                       <dt>
+                                               <label 
for="title">Tittel</label>
+                                       </dt>
+                                       <dd>
+                                               <input type="text" name="title" 
id="title" value="" />
+                                       </dd>
+                                       <dt>
+                                               <label 
for="description">Beskrivelse</label>
+                                       </dt>
+                                       <dd>
+                                               <input type="text" 
name="description" id="description" value="" />
+                                       </dd>
+                                       <dt>
+                                               <label 
for="start_date">Startdato</label>
+                                       </dt>
+                                       <dd>
+                                               <?php
+                                                       $start_date = "-";
+                                                       $start_date_yui = 
date('Y-m-d');
+                                                       $start_date_cal = 
$GLOBALS['phpgw']->yuical->add_listener('date_start', $start_date);
+                                               
+                                                       echo $start_date_cal;
+                                               ?>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="end_date">Sluttdato</label>
+                                       </dt>
+                                       <dd>
+                                               <?php
+                                                       $end_date = "";
+                                                       $end_date_yui;
+                                                       $end_date_cal =  
$GLOBALS['phpgw']->yuical->add_listener('date_end');
+                                               
+                                                       echo $end_date_cal;
+                                               ?>
+                                       </dd>
+                                       <dt>
+                                               <label>Dag</label>
+                                       </dt>
+                                       <dd>
+                                               <input type="checkbox" 
value="0" name="repeat_day[]" title="Mandag">Mandag
+                                               <input type="checkbox" 
value="1" name="repeat_day[]" title="Tirsdag">Tirsdag
+                                               <input type="checkbox" 
value="2" name="repeat_day[]" title="Onsdag">Onsdag
+                                               <input type="checkbox" 
value="3" name="repeat_day[]" title="Torsdag">Torsdag
+                                               <input type="checkbox" 
value="4" name="repeat_day[]" title="Fredag">Fredag
+                                               <input type="checkbox" 
value="5" name="repeat_day[]" title="Lørdag">Lørdag
+                                               <input type="checkbox" 
value="6" name="repeat_day[]" title="Søndag">Søndag
+                                       </dd>
+                                       <dt>
+                                               <label>Type</label>
+                                       </dt>
+                                       <dd>
+                                               <select id="repeat_type" 
name="repeat_type">
+                                                       <option value="0">Ikke 
angitt</option>
+                                                       <option 
value="1">Daglig</option>
+                                                       <option 
value="2">Ukentlig</option>
+                                                       <option 
value="3">Månedlig pr dato</option>
+                                                       <option 
value="4">Månedlig pr dag</option>
+                                                       <option 
value="5">Årlig</option>
+                                               </select>
+                                       </dd>
+                                       <dt>
+                                               <label>Intervall</label>
+                                       </dt>
+                                       <dd>
+                                               <input type="text" 
name="repeat_interval" value="" />
+                                       </dd>
+                                       <dt>
+                                               <label>Prosedyre</label>
+                                       </dt>
+                                       <dd>
+                                               <select id="procedure" 
name="procedure">
+                                                       <?php 
+                                                               foreach 
($procedure_array as $procedure) {
+                                                                       echo 
"<option value='" . $procedure->get_id() . "'>" . $procedure->get_title() . 
"</option>";
+                                                               }
+                                                       ?>
+                                                       
+                                               </select>
+                                       </dd>
+                               </dl>
+                               
+                               <div class="form-buttons">
+                                       <?php
+                                               echo '<input type="submit" 
name="save_control" value="' . lang('save') . '"/>';
+                                       ?>
+                               </div>
+                               
+                       </form>
+                                               
+               </div>
+               <div id="elements">
+                               <h3><?php echo lang('included_units') ?></h3>
+                               <?php 
+                                       $list_form = false; 
+                                       $list_id = 'included_units';
+                                       //$url_add_on = 
'&amp;control_id='.$control->get_id();
+                                       unset($extra_cols);
+                                       include('unit_list_partial.php');
+       
+                                       
+                   if ($editable) { 
+                                   echo '<h3>'.lang('all_locations').'</h3>';
+                                       $list_form = true; 
+                                       $list_id = 'property_uilocations';
+                                       //$url_add_on = 
'&amp;control_id='.$control->get_id();
+                                       unset($extra_cols);
+                                       $related = array('included_units');
+                                       
include('property_location_partial.php');
+                               }
+                               ?>
+               </div>
+       </div>
+</div>
\ No newline at end of file

Added: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css                                
(rev 0)
+++ trunk/controller/templates/base/css/base.css        2011-09-05 06:29:33 UTC 
(rev 7552)
@@ -0,0 +1,462 @@
+#invoice_details { float: left; width: 30%; }
+#list_navigation { float: left; width: 30%; }
+#user_messages { float: right; width: 40%;}
+#contract_lists {width: 100%; float: left; background-color: #EFEFEF; border: 
1px solid #ABABAB; padding-left: 1em; margin-top: 1em;}
+form#invoice_run {margin: 2em;}
+form#invoice_run th { 
+       background-color: #CDCDCD;
+       padding: 5px;
+       border: 1px solid #ABABAB;
+        font-weight: bolder;
+       }
+
+div#contract_lists td {
+       margin:0;
+       padding:4px 10px;
+}
+form#invoice_run td { 
+       border: 1px solid #CDCDCD;
+       }
+
+
+div#invoice_details dt{
+       float:left;
+        font-weight: bolder;
+        margin-right: 1em;
+       }
+
+div#invoice_details dd{
+       
+       }
+
+div.content {
+       margin: 2em;    
+}
+
+.hd {
+       margin-bottom: 0;
+       text-align: center;
+       }
+       
+.hd img {
+       vertical-align: middle;
+       }
+
+fieldset {
+       margin-top: 0.5em;      
+}
+
+legend {
+       font-weight: bolder;
+       margin-bottom: 0.2em;   
+}
+
+label {
+       margin-left: 0.3em;
+       margin-right: 0,3em;
+       font-style: normal;
+       font-size: 13px;
+}
+
+#content {
+    margin: 2em 1em;
+}
+.clr { clear: both;}
+
+#dashboard {padding: 1em;}
+#dashborad_column_1 { float:left; width:50%;}
+#dashboard_column_2 { margin-left:50%; width:50%;}
+
+#inactive {
+                               background-color: #ff5555;
+                               width: 10em;
+                               padding: 1em;
+                               border: 0.2em dotted #000000;
+                               letter-spacing: 2px;
+}
+#active {
+                               background-color: #ffffff;
+                               width: 10em;
+                               padding: 1em;
+                               border: 0em dotted #000000;
+                               letter-spacing: 2px;
+}
+
+#inactivate-button {
+                               border: 1px solid #000000;
+                               margin-top: 1em;
+                               padding: 0.1em;
+                               background-color: #ffffff;
+                               }
+
+#activate-button {
+                               border: 1px solid #000000;
+                               margin-top: 1em;
+                               padding: 0.1em;
+                               background-color: #ffffff;
+                               }
+
+ul.pathway {
+    font-weight: bolder;
+    margin: 1em 0;
+    font-size: 110%;
+}
+ul.pathway li a { color: #000; text-decoration: none;}
+ul.pathway li a:hover { color: #008; }
+ul.pathway li { 
+    display: inline;
+    background: url(../images/pathwaysep.png) no-repeat 0% 50%;
+    padding-left: 16px;
+}
+ul.pathway li:first-child { background: none; padding-left: 0;}
+
+dl.form, dl.form-col {
+    margin: 1em 1em 1em 0;
+}
+
+dl.form dt, dl.form-col dt {
+    font-style: italic;
+    font-weight: bolder;
+    margin: .5em 0 .1em 0;
+    color: #002;
+}
+dl.form dd textarea,
+dl.form-col dd textarea {
+    width: 15em;
+    height: 6em;
+}
+dl.form dd textarea.full-width,
+dl.form-col dd textarea.full-width {
+    width: 33em;
+    height: 10em;
+}
+dl.form dd input[type="text"],  dl.form dd .autocomplete,
+dl.form-col dd input[type="text"],  dl.form-col dd .autocomplete {
+    width: 15em;
+}
+dl.form dd .autocomplete,
+dl.form-col dd .autocomplete {
+    padding-bottom: 2em;
+}
+
+dl.form dt.heading, dl.form-col dt.heading {
+    color: #448;
+    font-weight: normal;
+    font-size: 110%;
+    margin-top: 1.4em;
+    margin-bottom: .6em;
+    border-bottom: 1px solid #aaa;
+}
+
+dl.proplist,
+dl.proplist-col {
+    margin: 1em 0;
+    padding-left: 2em;
+}
+dl.proplist dt,
+dl.proplist-col dt { 
+    font-style: italic; 
+    font-weight: bolder; 
+    font-size: 90%; 
+    margin: .8em 0 .1em 0;
+}
+
+dl.proplist-col,
+dl.form-col {
+    width: 18em;
+    float: left;
+}
+
+div.identifier-header {
+       padding-left: 2em;
+       margin-bottom: 1em;     
+}
+
+div.identifier-header label {
+       font-weight: bold;
+}
+
+.form-buttons {
+    clear: both;
+    padding-top: 2em;
+}
+.form-buttons button {
+    margin-right: .5em;
+}
+.form-buttons .cancel {
+    margin-left: .6em;
+}
+
+.date-picker .container,
+.datetime-picker .container { 
+    display:none; 
+    position:absolute; z-index:1;
+}
+#toolbar {
+    width: 100%;
+    background-color: #eee;
+    border: 1px solid #bbb;
+    margin-bottom: 0em;
+    padding: .3em;
+}
+
+#datatableToolbar {
+       background-color: white;
+    margin-bottom: 0em;
+    padding: .3em;
+}
+
+table.datatableToolbar {
+       padding: .3em;
+       }
+
+
+#controller_user_error {
+    width: 100%;
+    background-color: #eee;
+    border: 0px none #bbb;
+    margin-bottom: 0em;
+    padding-left: .3em;
+    color: red;
+    font-size: larger;
+}
+
+#controller_user_message {
+    width: 100%;
+    background-color: #eee;
+    border: 0px none #bbb;
+    margin-bottom: 0em;
+    padding-left: .3em;
+    color: green;
+    font-size: larger;
+}
+
+.toolbarelement {
+       vertical-align:middle;
+       }
+td.toolbarlabel {
+       width: 10em;
+       font-weight: bold;      
+       }
+td.toolbarcol {
+       padding-left: 1em;
+       }
+       
+div.calendarButtons {
+               vertical-align:middle;
+               background-color: grey;
+       }
+       
+label.toolbar_element_label {
+       padding-left: .25em;
+       padding-right: .50em;
+       vertical-align: middle;
+       }
+#toolbar input[type="text"] {
+    font-size: 120%;
+    margin: auto .25em;
+}
+
+dl.proplist dd.address,
+dl.proplist-col dd.address {
+    white-space: pre;
+}
+#week-selector { margin: 1em 0;}
+#week-selector li { display: inline; padding-right: .5em;}
+
+#schedule_container tr td { border-top: 1px solid #ccc; background: white; 
white-space: nowrap; }
+#schedule_container tr td:first-child { background: #eee; }
+#schedule_container tr.time td { border-top: 1px solid #444;}
+#schedule_container .color1 { background: #ccf;}
+#schedule_container .color2 { background: #cfc;}
+#schedule_container .color3 { background: #fcc;}
+#schedule_container .color4 { background: #ffb;}
+#schedule_container .color5 { background: #bff;}
+#schedule_container .color6 { background: #fbf;}
+
+#boundary-table td, #boundary-table th { 
+    padding: .1em .2em;
+}
+
+.date-container {
+    margin-bottom: .8em;
+    white-space: nowrap;
+}
+
+.date-container .close-btn {
+    display: block;
+    float: right;
+    border: none;
+    text-decoration: none;
+    background:transparent 
url(../../../../phpgwapi/js/yahoo/assets/skins/sam/sprite.png) no-repeat scroll 
0 -300px;
+    width: 25px;
+    height: 15px;
+    cursor: pointer;
+    color: white;
+}
+
+div.allocation-list
+{
+    width: 30em;
+    height: 10em;
+    border: 1px solid #555;
+    padding: .4em;
+    overflow: auto;
+}
+
+.showit {
+       visibility: visible;
+}
+.hideit {
+       visibility: hidden;
+}
+.datatable{
+       margin-left: 20px;
+       margin-top: 10px;
+}
+
+/* Styles for this the column selector */
+#dt-columnselector {width:45em;margin:0 auto;}
+#dt-options {margin-left:5px;}
+#dt-dlg {visibility:hidden;border:1px solid #808080;background-color:#E3E3E3;}
+#dt-dlg .hd 
{font-weight:bold;padding:1em;background:none;background-color:#E3E3E3;border-bottom:0;}
+#dt-dlg .ft {text-align:right;padding:.5em;background-color:#E3E3E3;}
+#dt-dlg .bd {height:15em;margin:0 1em;overflow:auto;border:1px solid 
black;background-color:white;}
+#dt-dlg .dt-dlg-pickercol {clear:both;padding:.5em 1em 3em;border-bottom:1px 
solid gray;}
+#dt-dlg .dt-dlg-pickerkey {float:left;}
+#dt-dlg .dt-dlg-pickerbtns {float:right;}
+/* Container workarounds for Mac Gecko scrollbar issues */
+.yui-panel-container.hide-scrollbars #dt-dlg .bd {
+    /* Hide scrollbars by default for Gecko on OS X */
+    overflow: hidden;
+}
+.yui-panel-container.show-scrollbars #dt-dlg .bd {
+    /* Show scrollbars for Gecko on OS X when the Panel is visible  */
+    overflow: auto;
+}
+#dt-dlg_c .underlay {overflow:hidden;}
+.inprogress {position:absolute;} /* transitional progressive enhancement state 
*/
+}
+
+dl.controller-description {
+       width: 70%;
+}
+dl.controller-description dt, dl.controller-description-edit {
+       width: 100%;
+       float:left;
+       font-weight:bold;
+}
+dl.controller-description dd {
+       width: 100%;
+       border: 1px solid #ccc;
+       float: left;
+       background-color: white;
+       height: 100px;
+       overflow-y: scroll;
+}
+dl.controller-description-edit textarea {
+       width: 100%;
+       height: 100px;
+       border: 1px solid #ccc;
+       float: left;
+}
+
+input#place {
+       width:60%;
+}
+
+input#address_1 {
+       width: 60%;
+       float:left;
+}
+
+input#house_number {
+       width: 20%;
+       float: left;
+}
+
+input.postcode {
+       width: 50px;
+       float: left;
+}
+
+.yui-navset {
+       clear: both;
+       margin-left: 2em;
+       margin-right: 2em;
+}
+
+h1 img, li img {
+       vertical-align: middle;
+}
+
+fieldset h3 {
+       display:block;
+       float:left;
+       line-height:1.3em;
+       margin:0;
+       width:120px;
+}
+
+/* Set up common form styles.  TODO: needs refinement. */
+legend, label, input, select {
+       margin:0 13px 0px 0px;
+}
+       
+label {
+       line-height:1.5em;
+}
+
+
+       
+fieldset {
+       border-bottom:0px solid #ccc;
+       padding:5px 0px 5px 10px;
+}
+
+h1 em {
+       font-style:italic;
+}
+
+div.info, div.error, div.warning {
+       font-weight: normal;
+       margin:10px;
+       padding:5px;
+       font-size:1.1em;
+       text-align: left;
+}
+p.message {
+       margin: 5px;
+}
+.info {
+       background-color:#CCFFCC;
+       border:1px solid #00FF00;
+       color:black;
+}
+.warning {
+       background-color: #FEEFB3;
+       border:1px solid #9F6000;
+       color:#9F6000;
+}
+.yui-calendar td.calcell {
+       border:0px !important;
+}
+.yui-skin-sam .yui-dt TABLE TH{
+       border: none !important;
+}
+.yui-skin-sam .yui-dt TABLE TD{
+       border: none !important;
+}
+
+.datatable_container {
+       margin-left: 1em;
+       margin-top: 1em;
+}
+
+.paginator {
+       margin-left: 1em !important;
+}
+
+th.yui-dt-sortable div{
+       background: 
url(../../../../phpgwapi/js/yahoo/assets/skins/sam/sprite.png) repeat-x scroll 
0pt -100px rgb(216, 216, 218);
+}


Property changes on: trunk/controller/templates/base/css/base.css
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/controller/templates/base/property_location_partial.php
===================================================================
--- trunk/controller/templates/base/property_location_partial.php               
                (rev 0)
+++ trunk/controller/templates/base/property_location_partial.php       
2011-09-05 06:29:33 UTC (rev 7552)
@@ -0,0 +1,134 @@
+<script type="text/javascript">
+       
+       //Columns for datatable
+       var columnDefs = [
+               {
+                       key: "location_code",
+                       label: "<? echo lang('location_code');?>",
+                       sortable: true
+               },
+               {
+                       key: "loc1_name",
+                       label: "<? echo lang('name');?>",
+                       sortable: true
+               },
+               {
+                       key: "loc2_name",
+                       label: "<?php echo lang('building') ?>",
+                       sortable: false
+               },
+               {
+                       key: "loc3_name",
+                       label: "<?php echo lang('floor') ?>",
+                       sortable: false
+               },
+               {
+                       key: "loc4_name",
+                       label: "<?php echo lang('section') ?>",
+                       sortable: false
+               },
+               {
+                       key: "loc5_name",
+                       label: "<?php echo lang('room') ?>",
+                       sortable: false
+               },
+               {
+                       key: "adresse1",
+                       label: "<? echo lang('address');?>",
+                       sortable: true
+               },
+               {
+                       key: "postnummer",
+                       label: "<? echo lang('post_code');?>",
+                       sortable: true
+               },
+               {
+                       key: "poststed",
+                       label: "<? echo lang('post_place');?>",
+                       sortable: true
+               },
+               {
+                       key: "gab",
+                       label: "<? echo lang('gab');?>",
+                       sortable: true
+               },
+               {
+                       key: "actions",
+                       hidden: true
+               },
+               {
+                       key: "labels",
+                       hidden: true
+               },
+               {
+                       key: "ajax",
+                       hidden: true
+               }
+       ];
+
+       <?php
+               if(isset($extra_cols)){
+                       foreach($extra_cols as $col){
+                               $literal = "{key: \"".$col["key"]."\",
+                                               label: \"".$col["label"]."\"}";
+                               if($col["index"]){
+                                       echo 
"columnDefs.splice(".$col["index"].", 0,".$literal.");";
+                               } else {
+                                       echo "columnDefs.push($literal);";
+                               }
+                       }
+               }
+       ?>
+
+       // Initiating the data source
+       setDataSource(
+               
'index.php?menuaction=rental.uiproperty_location.query&amp;phpgw_return_as=json<?php
 echo $url_add_on ?>',
+               columnDefs,
+               '<?php echo $list_id ?>_form',
+               ['<?php echo $list_id ?>_ctrl_toggle_level'],
+               '<?php echo $list_id ?>_container',
+               '<?php echo $list_id ?>_paginator',
+               '<?php echo $list_id ?>',
+               new Array(<?php
+                               if(isset($related)){
+                                       foreach($related as $r){
+                                               echo "\"".$r."\"";
+                                       }
+                               }
+                       ?>)
+       );
+</script>
+
+<?php if($list_form) { ?>
+
+<form id="<?php echo $list_id ?>_form" method="GET">
+       <fieldset>
+               <!-- Search -->
+               <h3><?php echo lang('search_options') ?></h3>
+               <label for="<?php echo $list_id ?>_ctrl_search_query"><?php 
echo lang('search_for') ?></label>
+               <input id="<?php echo $list_id ?>_ctrl_search_query" 
type="text" name="query" />
+               <label for="<?php echo $list_id 
?>_ctrl_toggle_search_type"><?php echo lang('search_where') ?></label>
+               <select name="search_option" id="<?php echo $list_id 
?>_ctrl_toggle_search_type">
+                       <option value="objno_name_address" 
selected="selected"><?php echo lang('objno_name_address') ?></option>
+                       <option value="gab"><?php echo lang('gab') ?></option>
+               </select>
+               <input type="submit" id="ctrl_search_button" value="<?php echo 
lang('search') ?>" />
+       </fieldset>
+       <fieldset>
+               <!-- Filters -->
+               <h3><?php echo lang('filters') ?></h3>
+               <label for="<?php echo $list_id ?>_ctrl_toggle_level"><?php 
echo lang('level') ?></label>
+               <select name="type_id" id="<?php echo $list_id 
?>_ctrl_toggle_level">
+                       <option value="1"><?php echo lang('property') 
?></option>
+                       <option value="2" selected="selected"><?php echo 
lang('building') ?></option>
+                       <option value="3"><?php echo lang('floor') ?></option>
+                       <option value="4"><?php echo lang('section') ?></option>
+                       <option value="5"><?php echo lang('room') ?></option>
+               </select>
+       </fieldset>
+</form>
+
+<?php } ?>
+
+<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
+<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]