fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6525] merge 6519:6524 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6525] merge 6519:6524 from trunk
Date: Sun, 31 Oct 2010 13:21:20 +0000

Revision: 6525
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6525
Author:   sigurdne
Date:     2010-10-31 13:21:19 +0000 (Sun, 31 Oct 2010)
Log Message:
-----------
merge 6519:6524 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.boseason.inc.php
    branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
    branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php
    branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
    branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
    branches/Version-1_0-branch/booking/setup/phpgw_no.lang
    branches/Version-1_0-branch/booking/setup/setup.inc.php
    branches/Version-1_0-branch/booking/setup/tables_current.inc.php
    branches/Version-1_0-branch/booking/setup/tables_update.inc.php
    branches/Version-1_0-branch/booking/templates/base/allocation_new.xsl
    branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
    branches/Version-1_0-branch/rental/inc/class.menu.inc.php
    branches/Version-1_0-branch/rental/setup/phpgw_no.lang

Added Paths:
-----------
    
branches/Version-1_0-branch/booking/templates/base/allocation_new_preview.xsl
    branches/Version-1_0-branch/rental/inc/class.uidelegate.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiresultunit.inc.php
    branches/Version-1_0-branch/rental/templates/base/delegate_list.php
    branches/Version-1_0-branch/rental/templates/base/resultunit.php
    branches/Version-1_0-branch/rental/templates/base/resultunit_list.php
    
branches/Version-1_0-branch/rental/templates/base/resultunit_list_partial.php
    branches/Version-1_0-branch/rental/templates/portico/images/system-users.png

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524

Modified: branches/Version-1_0-branch/booking/inc/class.boseason.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.boseason.inc.php      
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/inc/class.boseason.inc.php      
2010-10-31 13:21:19 UTC (rev 6525)
@@ -106,6 +106,7 @@
 
                function generate_allocation($season_id, $date, $to, $interval, 
$write=false)
                {
+                       $season = $this->so->read_single($season_id);
                        $this->authorize_write($season_id);
                        $valid = array();
                        $invalid = array();
@@ -120,8 +121,10 @@
                                        $allocation['active'] = '1';
                                        $allocation['from_'] = 
$date->format("Y-m-d").' '.$talloc['from_'];
                                        $allocation['to_'] = 
$date->format("Y-m-d").' '.$talloc['to_'];
+                                       $allocation['building_name'] = 
$season['building_name'];
                                        $allocation['completed'] = 1;
                                        $errors = 
$this->bo_allocation->validate($allocation);
+
                                        if(!$errors)
                                                $valid[] = $allocation;
                                        elseif 
(count($this->bo_allocation->filter_conflict_errors($errors)) === 0)

Modified: branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php  
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php  
2010-10-31 13:21:19 UTC (rev 6525)
@@ -144,7 +144,6 @@
                        if 
(!CreateObject('booking.soseason')->timespan_within_season($entity['season_id'],
 $from_, $to_)) {
                                $errors['season_boundary'] = lang("This booking 
is not within the selected season");
                        }
-                       flush();
                }
                
                public function find_expired() {

Modified: branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php 
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php 
2010-10-31 13:21:19 UTC (rev 6525)
@@ -15,6 +15,7 @@
                                        'secret'        => array('type' => 
'string', 'required' => true),
                                        'created'       => array('type' => 
'timestamp'),
                                        'modified'      => array('type' => 
'timestamp'),
+                                       'building_name' => array('type' => 
'string', 'required'=> true, 'query' => true),
                                        'frontend_modified'     => array('type' 
=> 'timestamp'),
                                        'owner_id'      => array('type' => 
'int', 'required' => true),
                                        'case_officer_id'       => array('type' 
=> 'int', 'required' => false),

Modified: branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php  
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php  
2010-10-31 13:21:19 UTC (rev 6525)
@@ -19,6 +19,7 @@
                        $this->bo = CreateObject('booking.boallocation');
                        $this->organization_bo    = 
CreateObject('booking.boorganization');
                        $this->building_bo    = 
CreateObject('booking.bobuilding');
+                       $this->season_bo    = CreateObject('booking.boseason');
                        
self::set_active_menu('booking::applications::allocations');
                        $this->fields = array('resources', 'cost', 
'application_id',
                                                                  
'building_id', 'building_name', 
@@ -119,15 +120,43 @@
                public function add()
                {
                        $errors = array();
+                       $step = phpgw::get_var('step', 'str', 'POST');
+                       if (! isset($step)) $step = 1;
+                       $invalid_dates = array();
+                       $valid_dates = array();
+
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
+                               $season = 
$this->season_bo->read_single($_POST['season_id']);
                                array_set_default($_POST, 'resources', array());
                                $allocation = extract_values($_POST, 
$this->fields);
                                $allocation['active'] = '1';
                                $allocation['completed'] = '0';
+
+                               $from_date = $_POST['from_'];
+                               $to_date = $_POST['to_'];
+                               $weekday = $_POST['weekday'];
+
+                               $allocation['from_'] = strftime("%Y-%m-%d 
%H:%M", strtotime($_POST['weekday']." ".$_POST['from_']));
+                               $allocation['to_'] = strftime("%Y-%m-%d %H:%M", 
strtotime($_POST['weekday']." ".$_POST['to_']));
+
+                               if (($_POST['weekday'] != 'sunday' &&  
date('w')  > date('w',strtotime($_POST['weekday']))) || (date('w') == 'sunday' 
&&  date('w') < date('w',strtotime($_POST['weekday'])))){
+                                       $allocation['from_'] = 
strftime("%Y-%m-%d %H:%M", strtotime($_POST['weekday']." 
".$_POST['from_'])-60*60*24*7);
+                                       $allocation['to_'] = strftime("%Y-%m-%d 
%H:%M", strtotime($_POST['weekday']." ".$_POST['to_'])-60*60*24*7);
+                               } 
+
+                               $_POST['from_'] = $allocation['from_'];
+                               $_POST['to_'] = $allocation['to_'];
+
                                $errors = $this->bo->validate($allocation);
-                               if(!$errors)
+
+                               if (!$errors)
                                {
+                                       $step++;
+                               }
+
+                               if (!$errors && $_POST['outseason'] != 'on' )
+                               {
                                        try {
                                                $receipt = 
$this->bo->add($allocation);
                                                
$this->redirect(array('menuaction' => 'booking.uiallocation.show', 
'id'=>$receipt['id']));
@@ -135,14 +164,86 @@
                                                $errors['global'] = lang('Could 
not add object due to insufficient permissions');
                                        }
                                }
+                               else if ($_POST['outseason'] == 'on' && 
!$errors && $step > 1)
+                               {
+
+                                       $repeat_until = 
strtotime($season['to_'])+60*60*24; 
+                                       $_POST['repeat_until'] = $season['to_'];
+
+                                       $max_dato = strtotime($_POST['to_']); 
// highest date from input
+                                       $interval = 
$_POST['field_interval']*60*60*24*7; // weeks in seconds
+                                       $i = 0;
+                                       // calculating valid and invalid dates 
from the first booking's to-date to the repeat_until date is reached
+                                       // the form from step 1 should validate 
and if we encounter any errors they are caused by double bookings.
+                                       while (($max_dato+($interval*$i)) <= 
$repeat_until)
+                                       {
+                                               $fromdate = date('Y-m-d H:i', 
strtotime($_POST['from_']) + ($interval*$i));
+                                               $todate = date('Y-m-d H:i', 
strtotime($_POST['to_']) + ($interval*$i));
+                                               $allocation['from_'] = 
$fromdate;
+                                               $allocation['to_'] = $todate;
+                                               $err = 
$this->bo->validate($allocation);
+                                               if ($err) 
+                                               {
+                                                       
$invalid_dates[$i]['from_'] = $fromdate;
+                                                       
$invalid_dates[$i]['to_'] = $todate;
+                                               } 
+                                               else 
+                                               {
+                                                       
$valid_dates[$i]['from_'] = $fromdate;
+                                                       $valid_dates[$i]['to_'] 
= $todate;
+                                                       if ($step == 3)
+                                                       {
+                                                               try {
+                                                                       
$receipt = $this->bo->add($allocation);
+                                                               } catch 
(booking_unauthorized_exception $e) {
+                                                                       
$errors['global'] = lang('Could not add object due to insufficient 
permissions');
+                                                               }
+                                                       }
+                                               }
+                                               $i++;
+                                       }
+                                       if ($step == 3) 
+                                       {
+                                               
$this->redirect(array('menuaction' => 'booking.uiallocation.show', 
'id'=>$receipt['id']));
+                                       }
+                               }
                        }
+
                        $this->flash_form_errors($errors);
                        self::add_javascript('booking', 'booking', 
'allocation.js');
                        array_set_default($allocation, 'resources', array());
                        $allocation['resources_json'] = 
json_encode(array_map('intval', $allocation['resources']));
                        $allocation['cancel_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.index'));
                        array_set_default($allocation, 'cost', '0');
-                       self::render_template('allocation_new', 
array('allocation' => $allocation));
+
+                       if ($step < 2) 
+                       {
+                               if($_SERVER['REQUEST_METHOD'] == 'POST' && 
$errors) {                           
+                                       $allocation['from_'] = 
strftime("%H:%M", strtotime($_POST['weekday']." ".$_POST['from_']));
+                                       $allocation['to_'] = strftime("%H:%M", 
strtotime($_POST['weekday']." ".$_POST['to_']));
+                               }
+                               self::render_template('allocation_new', 
array('allocation' => $allocation,
+                                       'step' => $step, 
+                                       'interval' => $_POST['field_interval'],
+                                       'repeat_until' => 
$_POST['repeat_until'],
+                                       'outseason' => $_POST['outseason'],
+                               ));
+                       } 
+                       else if ($step == 2) 
+                       {
+                               self::render_template('allocation_new_preview', 
array('allocation' => $allocation,
+                                       'step' => $step,
+                                       'recurring' => $_POST['recurring'],
+                                       'outseason' => $_POST['outseason'],
+                                       'interval' => $_POST['field_interval'],
+                                       'repeat_until' => 
$_POST['repeat_until'],
+                                       'weekday' => $weekday,
+                                       'from_date' => $from_date,
+                                       'to_date' => $to_date,
+                                       'valid_dates' => $valid_dates,
+                                       'invalid_dates' => $invalid_dates
+                               ));
+                       }
                }
 
                private function 
send_mailnotification_to_organization($organization, $subject, $body)

Modified: branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php 
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php 
2010-10-31 13:21:19 UTC (rev 6525)
@@ -177,6 +177,10 @@
                                                        'label' => 
lang('Status')
                                                ),
                                                array(
+                                                       'key' => 
'building_name',
+                                                       'label' => 
lang('Building')
+                                               ),
+                                               array(
                                                        'key' => 'what',
                                                        'label' => lang('What')
                                                ),

Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2010-10-29 
09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2010-10-31 
13:21:19 UTC (rev 6525)
@@ -466,3 +466,8 @@
 Lengt of shortname is to long, max 11 characters long  booking no      
Kortnavn er for langt, maks 11 tegn
 The organization number is wrong or not present        booking no      Det er 
ikke registrert et organisjonsnummer på denne organisasjonen
 The resource number is wrong or not present    booking no      Det er ikke 
registert et ressursnummer på denne organisasjonen
+Recurring allocation   booking no      Gjenta tildelingen
+weekday        booking no      Ukedag
+Out season     booking no      Ut sesong
+Allocations colliding with existing allocations or bookings (%1)       booking 
no      Tildelinger ikke kan lages
+Allocations that can be created        booking no      Tildelinger som kan 
lages

Modified: branches/Version-1_0-branch/booking/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/setup.inc.php     2010-10-29 
09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/setup/setup.inc.php     2010-10-31 
13:21:19 UTC (rev 6525)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.1.99';
+       $setup_info['booking']['version'] = '0.2.00';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';

Modified: branches/Version-1_0-branch/booking/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2010-10-31 13:21:19 UTC (rev 6525)
@@ -169,6 +169,7 @@
                                'created' => array('type' => 'timestamp', 
'nullable'=> False, 'default' => 'now'),
                                'modified' => array('type' => 'timestamp', 
'nullable'=> False, 'default' => 'now'),
                                'frontend_modified' => array('type' => 
'timestamp', 'nullable'=> True),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'activity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'description' => array('type' => 'text', 
'nullable' => False),
                                'contact_name' => array('type' => 'text', 
'nullable' => False),
@@ -195,6 +196,7 @@
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
False),
                                'active' => array('type' => 'int', 'nullable' 
=> False,'precision' => '4', 'default' => 1),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'application_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'organization_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'from_' => array('type' => 
'timestamp','nullable' => False),
@@ -217,6 +219,7 @@
                                'group_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'from_' => array('type' => 
'timestamp','nullable' => False),
                                'to_' => array('type' => 'timestamp','nullable' 
=> False),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'allocation_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'season_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'active' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False,'default' => '1'),

Modified: branches/Version-1_0-branch/booking/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_update.inc.php     
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/setup/tables_update.inc.php     
2010-10-31 13:21:19 UTC (rev 6525)
@@ -2366,4 +2366,19 @@
                        return $GLOBALS['setup_info']['booking']['currentver'];
                }
        }
+  $test[] = '0.1.99';
+       function booking_upgrade0_1_99()
+       {
 
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("");
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE 
bb_application SET building_name = b2.name FROM bb_building b2 WHERE EXISTS 
(SELECT 1 FROM bb_building b, bb_application a, bb_application_resource 
ar,bb_resource r WHERE a.activity_id = ar.application_id AND ar.resource_id = 
r.id AND r.building_id = b.id AND b2.id=b.id AND bb_booking.id=bo.id)");
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.00';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
+       }
+

Modified: branches/Version-1_0-branch/booking/templates/base/allocation_new.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/allocation_new.xsl       
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/booking/templates/base/allocation_new.xsl       
2010-10-31 13:21:19 UTC (rev 6525)
@@ -9,7 +9,9 @@
 
     <form action="" method="POST">
                <input type="hidden" name="application_id" 
value="{allocation/application_id}"/>
+
         <dl class="form-col">
+
             <dt><label for="field_building"><xsl:value-of 
select="php:function('lang', 'Building')" /></label></dt>
             <dd>
                 <div class="autocomplete">
@@ -22,16 +24,7 @@
                     <div id="building_container"/>
                 </div>
             </dd>
-            <dt><label for="field_season"><xsl:value-of 
select="php:function('lang', 'Season')" /></label></dt>
-            <dd>
-                <div id="season_container"><xsl:value-of 
select="php:function('lang', 'Select a building first')" /></div>
-            </dd>
-            <dt><label for="field_resources"><xsl:value-of 
select="php:function('lang', 'Resources')" /></label></dt>
-            <dd>
-                <div id="resources_container"><xsl:value-of 
select="php:function('lang', 'Select a building first')" /></div>
-            </dd>
-        </dl>
-        <dl class="form-col">
+
             <dt><label for="field_org"><xsl:value-of 
select="php:function('lang', 'Organization')" /></label></dt>
             <dd>
                 <div class="autocomplete">
@@ -44,28 +37,138 @@
                     <div id="org_container"/>
                 </div>
             </dd>
+
+                       <dt><label for="field_weekday"><xsl:value-of 
select="php:function('lang', 'Weekday')" /></label></dt>
+                       <dd>
+                               <select name="weekday" id="field_weekday">
+                                       <option value="monday">
+                                               <xsl:if 
test="../allocation/weekday = 'monday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Monday')" />        
+                                       </option>
+                                       <option value="tuesday">
+                                               <xsl:if 
test="../allocation/weekday = 'tuesday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Tuesday')" />
+                                       </option>
+                                       <option value="wednesday">
+                                               <xsl:if 
test="../allocation/weekday = 'wednesday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Wednesday')" />
+                                       </option>
+                                       <option value="thursday">
+                                               <xsl:if 
test="../allocation/weekday = 'thursday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Thursday')" />
+                                       </option>
+                                       <option value="friday">
+                                               <xsl:if 
test="../allocation/weekday = 'friday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Friday')" />
+                                       </option>
+                                       <option value="saturday">
+                                               <xsl:if 
test="../allocation/weekday = 'saturday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Saturday')" />
+                                       </option>
+                                       <option value="sunday">
+                                               <xsl:if 
test="../allocation/weekday = 'sunday'">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', 'Sunday')" />
+                                       </option>
+
+                               </select>
+                       </dd>
+
             <dt><label for="field_from"><xsl:value-of 
select="php:function('lang', 'From')" /></label></dt>
             <dd>
-                <div class="datetime-picker">
+                <div class="time-picker">
                 <input id="field_from" name="from_" type="text">
                     <xsl:attribute name="value"><xsl:value-of 
select="allocation/from_"/></xsl:attribute>
                 </input>
                 </div>
             </dd>
+
             <dt><label for="field_to"><xsl:value-of 
select="php:function('lang', 'To')" /></label></dt>
             <dd>
-                <div class="datetime-picker">
+                <div class="time-picker">
                 <input id="field_to" name="to_" type="text">
                     <xsl:attribute name="value"><xsl:value-of 
select="allocation/to_"/></xsl:attribute>
                 </input>
                 </div>
             </dd>
+                       <dt><label for="field_repeat_until"><xsl:value-of 
select="php:function('lang', 'Recurring allocation')" /></label></dt>
+                       <dd>
+                               <label>
+                                       <input type="checkbox" name="outseason" 
id="outseason">
+                                               <xsl:if test="outseason='on'">
+                                                       <xsl:attribute 
name="checked">checked</xsl:attribute>
+                                               </xsl:if>
+                                       </input>
+                                       <xsl:value-of 
select="php:function('lang', 'Out season')" />
+                               </label>
+                       </dd>
+                       <dt><xsl:value-of select="php:function('lang', 
'Interval')" /></dt>
+                       <dd>
+                               <xsl:value-of select="../field_interval" />
+                               <select id="field_interval" 
name="field_interval">
+                                       <option value="1">
+                                               <xsl:if test="interval=1">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '1 week')" />
+                                       </option>
+                                       <option value="2">
+                                               <xsl:if test="interval=2">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '2 weeks')" />
+                                       </option>
+                                       <option value="3">
+                                               <xsl:if test="interval=3">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '3 weeks')" />
+                                       </option>
+                                       <option value="4">
+                                               <xsl:if test="interval=4">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '4 weeks')" />
+                                       </option>
+                               </select>
+                       </dd>
+
+
+
+        </dl>
+        <dl class="form-col">
+
+            <dt><label for="field_season"><xsl:value-of 
select="php:function('lang', 'Season')" /></label></dt>
+            <dd>
+                <div id="season_container"><xsl:value-of 
select="php:function('lang', 'Select a building first')" /></div>
+            </dd>
+
             <dt><label for="field_cost"><xsl:value-of 
select="php:function('lang', 'Cost')" /></label></dt>
             <dd>
                 <input id="field_cost" name="cost" type="text">
                     <xsl:attribute name="value"><xsl:value-of 
select="allocation/cost"/></xsl:attribute>
                 </input>
             </dd>
+
+            <dt><label for="field_resources"><xsl:value-of 
select="php:function('lang', 'Resources')" /></label></dt>
+            <dd>
+                <div id="resources_container"><xsl:value-of 
select="php:function('lang', 'Select a building first')" /></div>
+            </dd>
+
+
         </dl>
         <div class="form-buttons">
             <input type="submit">

Copied: 
branches/Version-1_0-branch/booking/templates/base/allocation_new_preview.xsl 
(from rev 6524, trunk/booking/templates/base/allocation_new_preview.xsl)
===================================================================
--- 
branches/Version-1_0-branch/booking/templates/base/allocation_new_preview.xsl   
                            (rev 0)
+++ 
branches/Version-1_0-branch/booking/templates/base/allocation_new_preview.xsl   
    2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,71 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <div id="content">
+
+       <dl class="form">
+       <dt class="heading"><xsl:value-of select="php:function('lang', 'New 
Allocation')"/></dt>
+       </dl>
+    <xsl:call-template name="msgbox"/>
+       <xsl:call-template name="yui_booking_i18n"/>
+
+       <!-- <xsl:call-template name="xmlsource"/> -->
+
+           <form action="" method="POST">
+                       <input type="hidden" name="organization_name" 
value="{allocation/organization_name}"/>
+                       <input type="hidden" name="organization_id" 
value="{allocation/organization_id}"/>
+                       <input type="hidden" name="building_name" 
value="{allocation/building_name}"/>
+                       <input type="hidden" name="building_id" 
value="{allocation/building_id}"/>
+                       <input type="hidden" name="from_" value="{from_date}"/>
+                       <input type="hidden" name="to_" value="{to_date}"/>
+                       <input type="hidden" name="weekday" value="{weekday}"/>
+                       <input type="hidden" name="building_id" 
value="{allocation/building_id}"/>
+                       <input type="hidden" name="cost" 
value="{allocation/cost}"/>
+                       <input type="hidden" name="season_id" 
value="{allocation/season_id}"/>
+                       <input type="hidden" name="field_building_id" 
value="{allocation/building_id}"/>
+                       <input type="hidden" name="step" value="{step}" />
+                       <input type="hidden" name="repeat_until" 
value="{repeat_until}" />
+                       <input type="hidden" name="field_interval" 
value="{interval}" />
+                       <input type="hidden" name="outseason" 
value="{outseason}" />
+                       <xsl:for-each select="allocation/resources">
+                               <input type="hidden" name="resources[]" 
value="{.}" />
+                       </xsl:for-each>
+
+                       <h4><xsl:value-of select="php:function('lang', 
'Allocations that can be created')" /></h4>
+                       <div class="allocation-list">
+                               <xsl:for-each select="valid_dates">
+                                       <li>
+                                               <xsl:value-of select="from_"/> 
- <xsl:value-of select="to_"/>
+                                       </li>
+                               </xsl:for-each>
+                       </div>
+
+                       <h4><xsl:value-of select="php:function('lang', 
'Allocations  with existing allocations or bookings (%1)', 
count(result/invalid[from_]))" /></h4>
+                       <div class="allocation-list">
+                               <xsl:for-each select="invalid_dates">
+                                       <li>
+                                               <xsl:value-of select="from_"/> 
- <xsl:value-of select="to_"/>
+                                       </li>
+                               </xsl:for-each>
+                       </div>
+               <div class="form-buttons">
+                   <input type="submit" name="create">
+                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Create')" /></xsl:attribute>
+                               </input>
+                   <a class="cancel">
+                       <xsl:attribute name="href"><xsl:value-of 
select="allocation/cancel_link"/></xsl:attribute>
+                       <xsl:value-of select="php:function('lang', 'Cancel')" />
+                   </a>
+               </div>
+               </form>
+
+    </div>
+    <script type="text/javascript">
+        YAHOO.booking.initialSelection = <xsl:value-of 
select="allocation/resources_json"/>;
+    </script>
+</xsl:template>
+<xsl:template name="xmlsource">
+  NODE <xsl:value-of select="name()"/>
+  ATTR { <xsl:for-each select="attribute::*"><xsl:value-of 
select="name()"/>=<xsl:value-of select="."/> </xsl:for-each> }
+  CHILDREN: { <xsl:for-each select="*"><xsl:call-template 
name="xmlsource"/></xsl:for-each> }
+  TEXT <xsl:value-of select="text()"/>
+  <br/>
+</xsl:template>

Modified: branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php     
2010-10-29 09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php     
2010-10-31 13:21:19 UTC (rev 6525)
@@ -21,7 +21,7 @@
 
        $setup_info['bookingfrontend']['depends'][] = array(
                'appname' => 'booking',
-               'versions' => Array('0.1.92', '0.1.93', '0.1.94', '0.1.95', 
'0.1.96', '0.1.97', '0.1.98', '0.1.99')
+               'versions' => Array('0.1.92', '0.1.93', '0.1.94', '0.1.95', 
'0.1.96', '0.1.97', '0.1.98', '0.1.99', '0.2.00')
        );
 
        $setup_info['bookingfrontend']['depends'][] = array(

Modified: branches/Version-1_0-branch/rental/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.menu.inc.php   2010-10-29 
09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/rental/inc/class.menu.inc.php   2010-10-31 
13:21:19 UTC (rev 6525)
@@ -92,15 +92,16 @@
                                                'url'   => '',
                                                'image' => array('rental', 
'x-office-document'),
                                                'children' => $sync_choices
+                                       ),
+                                       'resultunit' => array
+                                       (
+                                               'text' => lang('delegates'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uiresultunit.index','appname' => 'rental') ),
+                                               'image' => array('rental', 
'system-users')
                                        )
                                );
                        }
                        
-                       
-                       
-                       
-                       
-                       
                        $menus['navigation'] =  array
                        (
                                'contracts' => array

Copied: branches/Version-1_0-branch/rental/inc/class.uidelegate.inc.php (from 
rev 6524, trunk/rental/inc/class.uidelegate.inc.php)
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uidelegate.inc.php             
                (rev 0)
+++ branches/Version-1_0-branch/rental/inc/class.uidelegate.inc.php     
2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,139 @@
+<?php
+       phpgw::import_class('rental.uicommon');
+       
+       class uidelegate extends rental_uicommon
+       {
+               public $public_functions = array
+               (
+                       'index'                         => true,
+                       'query'                         => true,
+                       'add_delegate'          => true,
+                       'remove_delegate'       => true
+               );
+               
+               public function __construct()
+               {
+                       parent::__construct();
+
+                       self::set_active_menu('rental::delegates');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('delegates');
+               }
+               
+               public function query(){
+                       $unit_id = (int)phpgw::get_var('unit_id');
+                       
+                       if (isset($unit_id) && $unit_id > 0) {
+                               $delegates_per_org_unit = 
frontend_bofrontend::get_delegates($unit_id);
+                       }
+                       
+                       $delegates_data = array('results' => 
$delegates_per_org_unit, 'total_records' => count($delegates_per_org_unit));
+                       
+                       $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
+                       
+                       return $this->yui_results($resultunit_data, 
'total_records', 'results');
+               }
+               
+               public function index(){
+                       if(isset($_POST['search']))
+                       {
+                               $username = phpgw::get_var('username');
+                               if(!isset($username))
+                               {
+                                       $msglog['error'][] = array('msg' => 
lang('lacking_username'));
+                               }
+                               else if($username == 
$GLOBALS['phpgw_info']['user']['account_lid'])
+                               {
+                                       $msglog['error'][] = array('msg' => 
lang('searching_for_self'));
+                               }
+                               else
+                               {
+                                       $account_id = 
frontend_bofrontend::delegate_exist($username);
+                                       if($account_id)
+                                       {
+                                               $search = 
frontend_bofrontend::get_account_info($account_id);
+                                               $msglog['message'][] = 
array('msg' => lang('user_found_in_PE'));
+                                       }
+                                       else
+                                       {
+                                               $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($username);
+                                               if($fellesdata_user)
+                                               {
+                                                       $search = 
$fellesdata_user;
+                                                       $msglog['message'][] = 
array('msg' => lang('user_found_in_Fellesdata'));
+                                               }
+                                               else
+                                               {
+                                                       $msglog['error'][] = 
array('msg' => lang('no_hits'));
+                                               }
+                                       }
+                               }
+                       } 
+                       else if(isset($_POST['add']))
+                       {
+                               $account_id = phpgw::get_var('account_id');
+                               
+                               $org_units = 
frontend_bofellesdata::get_instance()->get_result_units($GLOBALS['phpgw_info']['user']['account_lid']);
+                               
+                               //Parameter to delegate access to only a single 
organisational unit
+                               $org_unit_id = 
$this->header_state['selected_org_unit'];
+                               $success = true;
+                               
+                               foreach($org_units as $org_unit)
+                               {
+                                       if($org_unit_id == 'all' || 
$org_unit['ORG_UNIT_ID'] == $org_unit_id)
+                                       {
+                                               $res = 
$this->add_delegate($account_id,$org_unit['ORG_UNIT_ID'],$org_unit['ORG_NAME']);
+                                               if(!$res)
+                                               {
+                                                       $msglog['error'][] = 
array('msg' => lang('error_delegating_unit',$org_unit['ORG_NAME']));
+                                               }
+                                               $success = $success  && $res;
+                                       }
+                               }
+                               
+                               if($success)
+                               {
+                                       $msglog['message'][] = array('msg' => 
lang('delegation_successful'));   
+                               }
+                               else
+                               {
+                                       $msglog['error'][] = array('msg' => 
lang('delegation_error'));  
+                               }
+                       }
+                       
+                       
+                       
+                       
+                       
+                       $this->render('delegate_list.php');
+               }
+               
+               public function add_delegate(int $account_id, $org_unit_id, 
$org_name)
+               {
+                       if(!isset($account_id) || $account_id == '')
+                       {
+                               //User is only registered in Fellesdata
+                               $username = phpgw::get_var('username'); 
+                               $firstname = phpgw::get_var('firstname'); 
+                               $lastname = phpgw::get_var('lastname'); 
+                               $password = 'TEst1234';
+                               
+                               $account_id = 
frontend_bofrontend::create_delegate_account($username, $firstname, $lastname, 
$password);
+                               
+                               if(isset($account_id) && 
!is_numeric($account_id))
+                               {
+                                       return false;
+                               }
+                       }       
+                       return frontend_bofrontend::add_delegate($account_id, 
null, $org_unit_id, $org_name);
+               }
+               
+               public function remove_delegate()
+               {
+                       $account_id = phpgw::get_var('account_id'); 
+                       $owner_id = phpgw::get_var('owner_id');
+                       
+                       
frontend_bofrontend::remove_delegate($account_id,$owner_id);
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'rental.uiresultunit.edit'));
+               }
+       }
\ No newline at end of file

Copied: branches/Version-1_0-branch/rental/inc/class.uiresultunit.inc.php (from 
rev 6524, trunk/rental/inc/class.uiresultunit.inc.php)
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiresultunit.inc.php           
                (rev 0)
+++ branches/Version-1_0-branch/rental/inc/class.uiresultunit.inc.php   
2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,96 @@
+<?php
+       phpgw::import_class('rental.uicommon');
+       phpgw::import_class('rental.bofellesdata');
+       
+       class rental_uiresultunit extends rental_uicommon
+       {
+               public $public_functions = array
+               (
+                       'index'                         => true,
+                       'edit'                          => true,
+                       'query'                         => true
+               );
+               
+               public function __construct()
+               {
+                       parent::__construct();
+
+                       self::set_active_menu('rental::resultunit');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('delegates');
+               }
+               
+               public function query()
+               {
+                       
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;
+                       }
+                       // YUI variables for paging and sorting
+                       $start_index    = phpgw::get_var('startIndex', 'int');
+                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
+                       $sort_field             = phpgw::get_var('sort', 
'string', 'GET', 'identifier');
+                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       // Form variables
+                       $search_for     = phpgw::get_var('query');
+                       $search_type    = phpgw::get_var('search_option');
+                       // Create an empty result set
+                       $result_count = 0;
+                       
+                       
+                       // get all result unit from fellesdata
+                       $bofelles = rental_bofellesdata::get_instance();
+                       $result_units = $bofelles->get_result_units();
+                       
+                       foreach($result_units as &$unit) {
+                               $delegates_per_org_unit = 
frontend_bofrontend::get_delegates($unit['ORG_UNIT_ID']);
+                               $number_of_delegates = 
count($delegates_per_org_unit);
+                               $unit['UNIT_NO_OF_DELEGATES'] = 
$number_of_delegates;
+                       }
+                       
+                       $resultunit_data = array('results' => $result_units, 
'total_records' => count($result_units));
+                       
+                       $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
+                       
+                       array_walk($resultunit_data['results'], array($this, 
'add_actions'));
+                       
+                       return $this->yui_results($resultunit_data, 
'total_records', 'results');
+               }
+               
+               /**
+               * View a list of all resultunits
+               */
+               public function index()
+               {
+                       $search_for = phpgw::get_var('search_for');
+                       if($search_for)
+                       {
+                               phpgwapi_cache::session_set('rental', 
'resultunit_query', $search_for);
+                       }
+                       $this->render('resultunit_list.php');
+               }
+               
+               
+               public function add_actions(&$value)
+               {
+                       $value['ajax'][] = false;
+                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 'rental.uiresultunit.edit', 
'id' => $value['unit_id'], 'initial_load' => 'no')));
+                       $value['labels'][] = lang('edit_delegate');
+               }
+               
+               public function edit(){
+                       
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('edit');
+                       $unit_id = (int)phpgw::get_var('id');
+                       
+                       if (isset($unit_id) && $unit_id > 0) {
+                               
+                               $bofelles = rental_bofellesdata::get_instance();
+                               $unit ;//= $bofelles->get_result_unit($unit_id);
+                               
+                               $this->render('resultunit.php', $unit);
+                       }
+               }
+       }
\ No newline at end of file

Modified: branches/Version-1_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2010-10-29 
09:55:02 UTC (rev 6524)
+++ branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2010-10-31 
13:21:19 UTC (rev 6525)
@@ -161,6 +161,7 @@
 date   rental  no      Dato
 date_start     rental  no      Gjelder fra
 decimal separator      rental  no      Skilletegn for desimaler
+delegates      rental  no      Delegering
 delete rental  no      Slett
 department     rental  no      Avdeling
 deposit        rental  no      Depositum
@@ -413,6 +414,7 @@
 recurrence     rental  no      Gjentakelse
 reference      rental  no      Deres ref
 regulation     rental  no      Regulering
+related_delegates      rental  no      Delegater
 remove rental  no      Fjern
 remove_from_workbench  rental  no      Fjern fra mitt skrivebord
 remove_from_all_workbenches    rental  no      Fjern fra alle skrivebord
@@ -429,6 +431,8 @@
 responsibility_id      rental  no      Ansvar
 Responsibility id must be 6 characters.        rental  no      Ansvar må være 
seks tegn.
 responsibility_id_not_numeric  rental  no      Ansvar må være et tall
+result_unit_back       rental  no      Resultatsliste
+result_unit    rental  no      Resultatsenhet
 result_unit_number     rental  no      Resultatsenhet
 Run    rental  no      Kjørt
 run by rental  no      Utført av
@@ -512,6 +516,10 @@
 under_dismissal        rental  no      Under oppsigelse
 under_planning rental  no      Under planlegging
 units  rental  no      Enheter
+unit_id        rental  no      Enhetsid
+unit_name      rental  no      Enhetsnavn
+unit_leader_name       rental  no      Navn enhetsleder
+unit_no_of_delegates   rental  no      Antall delegater
 update rental  no      Oppdatér
 upload rental  no      Last opp
 url    rental  no      Nettsted

Copied: branches/Version-1_0-branch/rental/templates/base/delegate_list.php 
(from rev 6524, trunk/rental/templates/base/delegate_list.php)
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/delegate_list.php         
                (rev 0)
+++ branches/Version-1_0-branch/rental/templates/base/delegate_list.php 
2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,87 @@
+<script type="text/javascript">
+       //Add listener resetting form: redirects browser to call index  again
+       YAHOO.util.Event.addListener(
+               'ctrl_reset_button',
+               'click',
+               function(e)
+               {
+                       YAHOO.util.Event.stopEvent(e);
+                       window.location = 
'index.php?menuaction=rental.uidelegate.index';
+               }
+               );
+
+       // Defining columns for datatable
+       var columnDefs = [{
+                       key: "account_lastname",
+                       label: "<?php echo lang('account_lastname') ?>",
+                       sortable: true
+               },
+               {
+                       key: "account_firstname",
+                       label: "<?php echo lang('account_firstname') ?>",
+                       sortable: true
+               },
+               {
+                       key: "actions",
+                       hidden: true
+               },
+               {
+                       key: "labels",
+                       hidden: true
+               },
+               {
+                       key: "ajax",
+                       hidden: true
+               }];
+
+       // Initiating the data source
+       setDataSource(
+               
'index.php?menuaction=rental.uidelegate.query&amp;phpgw_return_as=json<?php 
echo $url_add_on; ?>&amp;editable=<?php echo isset($editable) && $editable ? 
"true" : "false"; ?>',
+               columnDefs,
+               '<?php echo $list_id ?>_form',
+               '<?php echo $list_id ?>_ctrl_search_query',
+               '<?php echo $list_id ?>_container',
+               '<?php echo $list_id ?>_paginator',
+               '<?php echo $list_id ?>',
+               '<?php echo isset($editor_action) ? $editor_action : '' ?>'
+       );
+
+</script>
+
+<?php
+       if($list_form)
+       {
+?>
+<form id="<?php echo $list_id ?>_form" method="GET">
+       <fieldset>
+       
+               <input type="hidden" name="account_id" 
value="{search/account_id}"/>
+               <label><?php echo lang('username') ?> </label>
+               <input type="text" name="username" 
value="{search/username}"/><input type="submit" name="search" value="<?php echo 
lang('btn_search') ?>"/>
+               <br/>
+               <label><?php echo lang('firstname') ?> </label>
+               <input type="text" name="firstname" readonly="" 
value="{search/firstname}" style="background-color: #CCCCCC;"/>
+               <br/>
+               <label><?php echo lang('lastname') ?> </label>
+               <input type="text" name="lastname" readonly="" 
value="{search/lastname}" style="background-color: #CCCCCC;"/>
+               <br/>
+               <label><?php echo lang('email') ?> </label>
+               <input type="text" name="email" readonly="" 
value="{search/email}" style="background-color: #CCCCCC;"/>
+               <br/>
+               <input type="submit" name="add" value="<?php echo 
lang('btn_add') ?>"/>
+       
+               <!-- Search -->
+               <h3><?php echo lang('search_options') ?></h3>
+               <label for="ctrl_search_query"><?php echo lang('search_for') 
?></label>
+               <input id="<?php echo $list_id ?>_ctrl_search_query" 
type="text" name="query" autocomplete="off" value="<?php echo isset($q) ? $q : 
''?>"/>
+               <input type="submit" id="ctrl_search_button" value="<?php echo 
lang('search') ?>" />
+               <input type="button" id="ctrl_reset_button" value="<?php echo 
lang('reset') ?>" />
+       </fieldset>
+
+</form>
+<?php
+       } // end if($list_form)
+?>
+
+<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
+<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
\ No newline at end of file

Copied: branches/Version-1_0-branch/rental/templates/base/resultunit.php (from 
rev 6524, trunk/rental/templates/base/resultunit.php)
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/resultunit.php            
                (rev 0)
+++ branches/Version-1_0-branch/rental/templates/base/resultunit.php    
2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,64 @@
+<?php
+       include("common.php");
+       phpgwapi_yui::load_widget('tabview');
+       phpgwapi_yui::tabview_setup('result_unit_tabview');
+       $config = CreateObject('phpgwapi.config','rental');
+       $config->read();
+?>
+
+<!--  ?php echo rental_uicommon::get_page_error($error) ?-->
+<!--  ?php echo 
rental_uicommon::get_page_warning($contract->get_validation_warnings()) ?-->
+<!--  ?php echo rental_uicommon::get_page_message($message) ?-->
+
+
+<!-- HOPPET OVER WARNINGS FORELØPIG -->
+
+<div class="identifier-header">
+       <h1><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/32x32/apps/system-users.png" /> <?php echo lang('result_unit'); ?></h1>
+       <div style="float: left; width: 50%;">
+               <button onclick="javascript:window.location.href ='<?php echo 
$cancel_link;?>;'">&laquo;&nbsp;<?php echo lang('result_unit_back'); 
?></button><br/>
+               <label><?php echo lang('unit_id'); ?> </label>
+               <?php if($unit["ORG_UNIT_ID"]){
+                       echo $unit["ORG_UNIT_ID"];
+               } ?>
+               <br/>
+               <label><?php echo lang('unit_name'); ?></label>
+               <?php echo $unit["ORG_NAME"]; ?>
+                <br/>
+               <label><?php echo lang('unit_leader_name'); ?></label>
+               <?php echo $unit["UNIT_ID"]; ?>
+               <br/>
+               <label><?php echo lang('unit_no_of_delegates') ?></label>
+               <?php echo $unit["UNIT_NO_OF_DELEGATES"]; ?>
+       </div>
+</div>
+
+<script type="text/javascript" language="JavaScript">
+function loadDatatables(delegates){
+       if(currTab == 'composites'){
+               for(i=0;i<YAHOO.rental.datatables.length;i++){
+                       if(YAHOO.rental.datatables[i].tid == 
'included_delegates'){
+                               reloadDataSources(YAHOO.rental.datatables[i]);
+                       }
+               }
+       }
+}
+</script>
+
+<div id="result_unit_tabview" class="yui-navset">
+       <ul class="yui-nav">
+               <li><a href="#delegates" onclick="javascript: 
loadDatatables('delegates');"><em><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/apps/system-users.png" alt="icon" /> <?php echo 
lang('delegates') ?></em></a></li>
+       </ul>
+       <div class="yui-content">
+               <?php if($unit["ORG_UNIT_ID"] > 0) {?>
+                       <div id="delegates">
+                               <h3><?php echo lang('related_delegates') ?></h3>
+                               <?php
+                                       $list_form = false;
+                                       $list_id = 'included_delegates';
+                                       $url_add_on = 
'&amp;type=included_delegates&amp;unit_id='.$unit["ORG_UNIT_ID"];
+                                       include('delegates_list_partial.php'); 
?>
+                       </div>
+               <?php }?>
+       </div>
+</div>
\ No newline at end of file

Copied: branches/Version-1_0-branch/rental/templates/base/resultunit_list.php 
(from rev 6524, trunk/rental/templates/base/resultunit_list.php)
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/resultunit_list.php       
                        (rev 0)
+++ branches/Version-1_0-branch/rental/templates/base/resultunit_list.php       
2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,12 @@
+<?php
+       include("common.php");
+?>
+
+<h1><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/32x32/apps/system-users.png" /> <?php echo lang('delegates') ?></h1>
+
+<?php
+$list_form = true;
+$list_id = 'all_result_units';
+$url_add_on = '&amp;type=all_result_units';
+include('resultunit_list_partial.php');
+?>

Copied: 
branches/Version-1_0-branch/rental/templates/base/resultunit_list_partial.php 
(from rev 6524, trunk/rental/templates/base/resultunit_list_partial.php)
===================================================================
--- 
branches/Version-1_0-branch/rental/templates/base/resultunit_list_partial.php   
                            (rev 0)
+++ 
branches/Version-1_0-branch/rental/templates/base/resultunit_list_partial.php   
    2010-10-31 13:21:19 UTC (rev 6525)
@@ -0,0 +1,94 @@
+<script type="text/javascript">
+       //Add listener resetting form: redirects browser to call index  again
+       YAHOO.util.Event.addListener(
+               'ctrl_reset_button',
+               'click',
+               function(e)
+               {
+                       YAHOO.util.Event.stopEvent(e);
+                       window.location = 
'index.php?menuaction=rental.uiresultunit.index';
+               }
+               );
+
+       // Defining columns for datatable
+       var columnDefs = [{
+                       key: "unit_id",
+                       label: "<?php echo lang('unit_id') ?>",
+                       sortable: true
+               },
+               {
+                       key: "unit_name",
+                       label: "<?php echo lang('unit_name') ?>",
+                       sortable: true
+               },
+               {
+                       key: "unit_leader_name",
+                       label: "<?php echo lang('unit_leader_name') ?>",
+                   sortable: true
+               },
+               {
+                       key: "unit_no_of_delegates",
+                       label: "<?php echo lang('unit_no_of_delegates') ?>",
+                   sortable: true
+               },
+               {
+                       key: "actions",
+                       hidden: true
+               },
+               {
+                       key: "labels",
+                       hidden: true
+               },
+               {
+                       key: "ajax",
+                       hidden: true
+               }];
+
+       // Initiating the data source
+       setDataSource(
+               
'index.php?menuaction=rental.uiresultunit.query&amp;phpgw_return_as=json<?php 
echo $url_add_on; ?>&amp;editable=<?php echo isset($editable) && $editable ? 
"true" : "false"; ?>',
+               columnDefs,
+               '<?php echo $list_id ?>_form',
+               '<?php echo $list_id ?>_ctrl_search_query',
+               '<?php echo $list_id ?>_container',
+               '<?php echo $list_id ?>_paginator',
+               '<?php echo $list_id ?>',
+               '<?php echo isset($editor_action) ? $editor_action : '' ?>'
+       );
+
+</script>
+
+<?php
+       if($list_form)
+       {
+?>
+<form id="<?php echo $list_id ?>_form" method="GET">
+<?php
+       $populate = phpgw::get_var('populate_form');
+       //Avoid Notices
+       $q = false;
+       $s_type = false;
+       $status = false;
+       $status_contract = false;
+       if(isset($populate))
+       {
+               $q = phpgwapi_cache::session_get('rental', 'resultunit_query');
+               $s_type = phpgwapi_cache::session_get('rental', 
'resultunit_search_type');
+       } 
+?>
+       <fieldset>
+               <!-- Search -->
+               <h3><?php echo lang('search_options') ?></h3>
+               <label for="ctrl_search_query"><?php echo lang('search_for') 
?></label>
+               <input id="<?php echo $list_id ?>_ctrl_search_query" 
type="text" name="query" autocomplete="off" value="<?php echo isset($q) ? $q : 
''?>"/>
+               <input type="submit" id="ctrl_search_button" value="<?php echo 
lang('search') ?>" />
+               <input type="button" id="ctrl_reset_button" value="<?php echo 
lang('reset') ?>" />
+       </fieldset>
+
+</form>
+<?php
+       } // end if($list_form)
+?>
+
+<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
+<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
\ No newline at end of file

Copied: 
branches/Version-1_0-branch/rental/templates/portico/images/system-users.png 
(from rev 6524, trunk/rental/templates/portico/images/system-users.png)
===================================================================
(Binary files differ)




reply via email to

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