fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13844] fixing datatable and forms


From: Saul
Subject: [Fmsystem-commits] [13844] fixing datatable and forms
Date: Thu, 03 Sep 2015 14:56:19 +0000

Revision: 13844
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13844
Author:   psaul
Date:     2015-09-03 14:56:18 +0000 (Thu, 03 Sep 2015)
Log Message:
-----------
fixing datatable and forms

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.bocommon.inc.php
    branches/dev-syncromind/booking/inc/class.socommon.inc.php
    branches/dev-syncromind/booking/inc/class.sogroup.inc.php
    branches/dev-syncromind/booking/inc/class.uidocument.inc.php
    branches/dev-syncromind/booking/inc/class.uievent.inc.php
    branches/dev-syncromind/booking/inc/class.uigroup.inc.php
    branches/dev-syncromind/booking/inc/class.uiorganization.inc.php
    branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php
    branches/dev-syncromind/booking/templates/base/application.xsl

Modified: branches/dev-syncromind/booking/inc/class.bocommon.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.bocommon.inc.php  2015-09-03 
12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.bocommon.inc.php  2015-09-03 
14:56:18 UTC (rev 13844)
@@ -38,7 +38,7 @@
 
                function read()
                {
-                       return 
$this->so->read($this->build_default_read_params());
+                    return $this->so->read($this->build_default_read_params());
                }
                
                /**

Modified: branches/dev-syncromind/booking/inc/class.socommon.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.socommon.inc.php  2015-09-03 
12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.socommon.inc.php  2015-09-03 
14:56:18 UTC (rev 13844)
@@ -128,7 +128,7 @@
                {
                        $cols = array();
                        $joins = array();
-                       
+                        
                        foreach($this->fields as $field => $params)
                        {
                                if(isset($params['manytomany']) && 
$params['manytomany'])
@@ -433,7 +433,9 @@
                                }
                        }
                        
+                echo($condition);exit();
                        $base_sql = "SELECT $cols FROM $this->table_name $joins 
WHERE $condition $order ";
+                        
                        if ($results) 
                        {
                                $this->db->limit_query($base_sql, $start, 
__LINE__, __FILE__, $results);
@@ -457,7 +459,7 @@
                        foreach($results as $id => $result)
                        {
                            $id_map[$result['id']] = $id;
-                       }
+                       }                        
                        foreach($this->fields as $field => $params)
                        {
                                if($params['manytomany'])
@@ -472,28 +474,28 @@
                                                                $colnames[] = 
is_array($paramsOrCol) ? $intOrCol : $paramsOrCol;
                                                        }
                                                        $colnames = join(',', 
$colnames);
-                                                       
-                                               $this->db->query("SELECT 
$colnames, $key FROM $table WHERE $key IN($ids)", __LINE__, __FILE__);
-                                               $row[$field] = array();
-                                               while ($this->db->next_record())
-                                               {
-                                                   $id = 
$this->_unmarshal($this->db->f($key, false), 'int');
-                                                               $data = array();
-                                                               
foreach($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
-                                                               {       
-                                                                       if 
(is_array($paramsOrCol)) {
-                                                                               
$col = $intOrCol;
-                                                                               
$type = isset($paramsOrCol['type']) ? $paramsOrCol['type'] : $params['type'];
-                                                                       } else {
-                                                                               
$col = $paramsOrCol;
-                                                                               
$type = $params['type'];
-                                                                       }
-                                                                               
-                                                                       
$data[$col] = $this->_unmarshal($this->db->f($col, false), $type);
-                                                               }
-                                                               $row[$field][] 
= $data;
-                                                       
$results[$id_map[$id]][$field][] = $data;
-                                               }
+                                                        
+                                                        
$this->db->query("SELECT $colnames, $key FROM $table WHERE $key IN($ids)", 
__LINE__, __FILE__);
+                                                        $row[$field] = array();
+                                                        while 
($this->db->next_record())
+                                                        {
+                                                            $id = 
$this->_unmarshal($this->db->f($key, false), 'int');
+                                                                        $data 
= array();
+                                                                        
foreach($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
+                                                                        {      
+                                                                               
 if (is_array($paramsOrCol)) {
+                                                                               
         $col = $intOrCol;
+                                                                               
         $type = isset($paramsOrCol['type']) ? $paramsOrCol['type'] : 
$params['type'];
+                                                                               
 } else {
+                                                                               
         $col = $paramsOrCol;
+                                                                               
         $type = $params['type'];
+                                                                               
 }
+
+                                                                               
 $data[$col] = $this->_unmarshal($this->db->f($col, false), $type);
+                                                                        }
+                                                                        
$row[$field][] = $data;
+                                                                
$results[$id_map[$id]][$field][] = $data;
+                                                        }
                                                }
                                                else
                                                {

Modified: branches/dev-syncromind/booking/inc/class.sogroup.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.sogroup.inc.php   2015-09-03 
12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.sogroup.inc.php   2015-09-03 
14:56:18 UTC (rev 13844)
@@ -32,15 +32,18 @@
                                                        'key' => 'id',
                                                        'column' => 'name'
                                                )),
-                                       'contacts'              => array('type' 
=> 'string',
-                                               'manytomany' => array(
-                                                       'table' => 
'bb_group_contact',
-                                                       'key' => 'group_id',
-                                                       'column' => 
array('name',
-                                                                         
'email' => array('sf_validator' => createObject('booking.sfValidatorEmail', 
array(), array('invalid' => '%field% contains an invalid email'))),
-                                                                         
'phone')
-                                               )
-                                       ),
+                                       'contacts'              => array(
+                                                                    'type' => 
'string',
+                                                                    
'manytomany' => array(
+                                                                        
'table' => 'bb_group_contact',
+                                                                        'key' 
=> 'group_id',
+                                                                        
'column' => array(
+                                                                            
'name',
+                                                                            
'email' => array('sf_validator' => createObject('booking.sfValidatorEmail', 
array(), array('invalid' => '%field% contains an invalid email'))),
+                                                                            
'phone')
+                                                                    )
+                                                                )
+                                        
                                )
                        );
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];

Modified: branches/dev-syncromind/booking/inc/class.uidocument.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uidocument.inc.php        
2015-09-03 12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.uidocument.inc.php        
2015-09-03 14:56:18 UTC (rev 13844)
@@ -1,7 +1,7 @@
 <?php
        phpgw::import_class('booking.uicommon');
 
-    phpgw::import_class('booking.uidocument_building');
+        phpgw::import_class('booking.uidocument_building');
        phpgw::import_class('booking.uipermission_building');
        
 //     phpgw::import_class('phpgwapi.uicommon_jquery');
@@ -16,7 +16,7 @@
                public 
                        $public_functions = array(
                                'index'                 => true,
-                'query'         => true,
+                                'query'         => true,
                                'show'                  => true,
                                'add'                   => true,
                                'edit'                  => true,

Modified: branches/dev-syncromind/booking/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uievent.inc.php   2015-09-03 
12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.uievent.inc.php   2015-09-03 
14:56:18 UTC (rev 13844)
@@ -167,6 +167,9 @@
             'filters' => $filters
         );
         
+        var_dump($params);
+        exit();
+        
                $events = $this->bo->so->read($params);
 
                foreach($events['results'] as &$event)

Modified: branches/dev-syncromind/booking/inc/class.uigroup.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uigroup.inc.php   2015-09-03 
12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.uigroup.inc.php   2015-09-03 
14:56:18 UTC (rev 13844)
@@ -175,6 +175,7 @@
         public function query()
                {
                        $groups = $this->bo->read();
+                        
                        array_walk($groups["results"], array($this, 
"_add_links"), $this->module.".uigroup.show");
                        foreach($groups["results"] as &$group) {
                                
@@ -196,7 +197,6 @@
                                        );
                                }
                        }
-                       
                        $results = $this->jquery_results($groups);
                        
                        if (is_array($parent_entity = 
$this->get_parent_if_inline())) {

Modified: branches/dev-syncromind/booking/inc/class.uiorganization.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiorganization.inc.php    
2015-09-03 12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.uiorganization.inc.php    
2015-09-03 14:56:18 UTC (rev 13844)
@@ -125,7 +125,24 @@
 
                public function query()
                {
-                       $organizations = $this->bo->read();
+                    
+//                        $search = phpgw::get_var('search');
+//                        $order = phpgw::get_var('order');
+//                        $columns = phpgw::get_var('columns');
+//
+//                        $params = array(
+//                            'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
+//                            'results' => phpgw::get_var('length', 'int', 
'REQUEST', null),
+//                            'query' => $search['value'],
+//                            'order' => $columns[$order[0]['column']]['data'],
+//                            'sort'   => 
$columns[$order[0]['column']]['data'],
+//                            'dir'    => $order[0]['dir'],
+//                            'filters' => $filters
+//                        );
+//                    
+//                     $organizations = $this->bo->so->read($params);
+                    
+                        $organizations = $this->bo->read();
                        array_walk($organizations["results"], array($this, 
"_add_links"), "booking.uiorganization.show");
 
                        foreach($organizations["results"] as &$organization) {

Modified: branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php  
2015-09-03 12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php  
2015-09-03 14:56:18 UTC (rev 13844)
@@ -151,23 +151,23 @@
         {
             $this->db = & $GLOBALS['phpgw']->db;
 
-//                     $current_user = $this->current_account_id();
+//            $current_user = $this->current_account_id();
             $current_user = 7;
-                       $current_user_building_data = array();
-                       $sql = "select object_id from bb_permission where 
subject_id=".$current_user." and role='case_officer';";
-                       $this->db->query($sql);
-                       while ($record = array_shift($this->db->resultSet)) {
-                               $current_user_building_data[] = 
$record['object_id'];
-                       }
+            $current_user_building_data = array();
+            $sql = "select object_id from bb_permission where 
subject_id=".$current_user." and role='case_officer';";
+            $this->db->query($sql);
+            while ($record = array_shift($this->db->resultSet)) {
+                    $current_user_building_data[] = $record['object_id'];
+            }
 
-                       $filters['building_id'] = $current_user_building_data;
+            $filters['building_id'] = $current_user_building_data;
 
-                       if(isset($_SESSION['showall']))
-                       {
-                               unset($filters['building_id']);
-                       } else {
-                               $filters['building_id'] = 
$current_user_building_data;
-                       }
+            if(isset($_SESSION['showall']))
+            {
+                    unset($filters['building_id']);
+            } else {
+                    $filters['building_id'] = $current_user_building_data;
+            }
 
             $testdata =  phpgw::get_var('filter_building_id', 'int', 
'REQUEST', null);
             if ($testdata != 0) {

Modified: branches/dev-syncromind/booking/templates/base/application.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application.xsl      
2015-09-03 12:20:08 UTC (rev 13843)
+++ branches/dev-syncromind/booking/templates/base/application.xsl      
2015-09-03 14:56:18 UTC (rev 13844)
@@ -119,11 +119,15 @@
                                 </div>
 
                                 <div class="pure-control-group">
-                                    <dt class="heading">1. <xsl:value-of 
select="php:function('lang', 'History and comments (%1)', 
count(application/comments/author))" /></dt>
+                                    <dt class="heading">
+                                        <h3>1. <xsl:value-of 
select="php:function('lang', 'History and comments (%1)', 
count(application/comments/author))" /></h3>
+                                    </dt>
                                         <div class="pure-control-group">
                                         <xsl:for-each 
select="application/comments[author]">
                                                 <label>
+                                                    <h4>
                                                         <xsl:value-of 
select="php:function('pretty_timestamp', time)"/>: <xsl:value-of 
select="author"/>
+                                                    </h4>
                                                 </label>
                                                 <xsl:choose>
                                                         <xsl:when 
test='contains(comment,"bookingfrontend.uidocument_building.download")'>        
                     
@@ -140,31 +144,35 @@
                                 </div>
 
                                 <div class="pure-control-group">
-                                    <dt class="heading">2. <xsl:value-of 
select="php:function('lang', 'Why?')" /></dt>
+                                    <dt class="heading">
+                                        <h3>2. <xsl:value-of 
select="php:function('lang', 'Why?')" /></h3>
+                                    </dt>
                                     <div class="pure-control-group">
                                         <label>
-                                            <xsl:value-of 
select="php:function('lang', 'Activity')" />
+                                            <h4><xsl:value-of 
select="php:function('lang', 'Activity')" /></h4>
                                         </label>
                                         <xsl:value-of 
select="application/activity_name"/>
                                     </div>
                                     <div class="pure-control-group">
                                         <label>
-                                            <xsl:value-of 
select="php:function('lang', 'Description')" />
+                                            <h4><xsl:value-of 
select="php:function('lang', 'Description')" /></h4>
                                         </label>
                                         <xsl:value-of 
select="application/description"/>
                                     </div>
                                     <div class="pure-control-group">
                                         <label>
-                                            <xsl:value-of 
select="config/application_equipment"/>
+                                            <h4><xsl:value-of 
select="config/application_equipment"/></h4>
                                         </label>
                                         <xsl:value-of 
select="application/equipment"/>
                                     </div>
                                 </div>
                                 <div class="pure-control-group">
-                                    <dt class="heading">3. <xsl:value-of 
select="php:function('lang', 'Where?')" /></dt>
+                                    <dt class="heading">
+                                        <h3>3. <xsl:value-of 
select="php:function('lang', 'Where?')" /></h3>
+                                    </dt>
                                     <div class="pure-control-group">
                                         <label>
-                                            <xsl:value-of 
select="php:function('lang', 'Building')" />
+                                            <h4><xsl:value-of 
select="php:function('lang', 'Building')" /></h4>
                                         </label>
                                         <xsl:value-of 
select="application/building_name"/>
                                                     (<a href="javascript: 
void(0)" 
@@ -177,7 +185,7 @@
                                     <dd><div id="resources_container"/></dd>
                                 </div>
                                 <div class="pure-control-group">
-                                    <dt class="heading">4. <xsl:value-of 
select="php:function('lang', 'When?')" /></dt>
+                                    <dt class="heading"><h3>4. <xsl:value-of 
select="php:function('lang', 'When?')" /></h3></dt>
                                                 <script type="text/javascript">
                                                         var allocationParams = 
{};
                                                         var bookingParams = {};
@@ -200,7 +208,7 @@
                                                 <xsl:for-each 
select="application/dates">
                                                 <div 
class="pure-control-group">    
                                                     <label>
-                                                        <xsl:value-of 
select="php:function('lang', 'From')" />:
+                                                        <h4><xsl:value-of 
select="php:function('lang', 'From')" />:</h4>
                                                     </label> 
                                                     <xsl:value-of 
select="php:function('pretty_timestamp', from_)"/>
                                                         <xsl:if 
test="../case_officer/is_current_user">
@@ -222,7 +230,7 @@
                                                 </div>
                                                 <div 
class="pure-control-group">
                                                     <label>
-                                                        <xsl:value-of 
select="php:function('lang', 'To')" />:
+                                                        <h4><xsl:value-of 
select="php:function('lang', 'To')" />:</h4>
                                                     </label> 
                                                         <xsl:value-of 
select="php:function('pretty_timestamp', to_)"/>
                                                 </div>
@@ -234,6 +242,8 @@
                                                                     
bookingParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="booking_params"/>;
                                                                     
eventParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="event_params"/>;
                                                             </script>
+                                                <div 
class="pure-control-group">
+                                                    <label></label>
                                                         <select name="create" 
onchange="if(this.selectedIndex==1) 
YAHOO.booking.postToUrl('index.php?menuaction=booking.uiallocation.add', 
allocationParams[{id}]); if(this.selectedIndex==2) 
YAHOO.booking.postToUrl('index.php?menuaction=booking.uibooking.add', 
eventParams[{id}]); if(this.selectedIndex==3) 
YAHOO.booking.postToUrl('index.php?menuaction=booking.uievent.add', 
eventParams[{id}]);">
 
                                                                 <xsl:if 
test="not(../case_officer/is_current_user)">
@@ -251,14 +261,15 @@
                                                     <option><xsl:value-of 
select="php:function('lang', '- Created -')" /></option>
                                                                         
</xsl:if>
                                                         </select>
+                                                </div>
                                                         </xsl:if>
                                                 </xsl:for-each>
                                 </div>
                                 <div class="pure-control-group">
-                                    <dt class="heading">5. <xsl:value-of 
select="php:function('lang', 'Who?')" /></dt>
+                                    <dt class="heading"><h3>5. <xsl:value-of 
select="php:function('lang', 'Who?')" /></h3></dt>
                                     <div class="pure-control-group">
                                         <label>
-                                            <xsl:value-of 
select="php:function('lang', 'Target audience')" />
+                                            <h4><xsl:value-of 
select="php:function('lang', 'Target audience')" /></h4>
                                         </label>    
                                             <label>
                                                 <ul>
@@ -272,52 +283,55 @@
                                     </div>
                                     <div class="pure-control-group">
                                         <label>
-                                            <xsl:value-of 
select="php:function('lang', 'Number of participants')" />
+                                            <h4><xsl:value-of 
select="php:function('lang', 'Number of participants')" /></h4>
                                         </label>
                                                 
-                                                        <table id="agegroup">
-                                                                
<tr><th/><th><xsl:value-of select="php:function('lang', 'Male')" /></th>
-                                                                    
<th><xsl:value-of select="php:function('lang', 'Female')" /></th></tr>
+                                                        <table id="agegroup" 
class="pure-table pure-table-striped">
+                                                            <thead>
+                                                                
<tr><th><xsl:value-of select="php:function('lang', 'Name')" 
/></th><th><xsl:value-of select="php:function('lang', 'Male')" /></th>
+                                                                    
<th><xsl:value-of select="php:function('lang', 'Female')" /></th></tr></thead>
+                                                            <tbody>
                                                                 <xsl:for-each 
select="agegroups">
                                                                         
<xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
                                                                         <tr>
-                                                                               
 <th><xsl:value-of select="name"/></th>
+                                                                               
 <td><xsl:value-of select="name"/></td>
                                                                                
 <td><xsl:value-of select="../application/agegroups/male[../agegroup_id = 
$id]"/></td>
                                                                                
 <td><xsl:value-of select="../application/agegroups/female[../agegroup_id = 
$id]"/></td>
                                                                         </tr>
                                                                 </xsl:for-each>
+                                                            </tbody>
                                                         </table>
                                                 
                                     </div>                                     
        
                                 </div>
                                 <div class="clr"/>
                                 <div class="pure-control-group">
-                                        <div class="heading"><br />6. 
<xsl:value-of select="php:function('lang', 'Contact information')" /></div>
+                                        <dt class="heading"><h3>6. 
<xsl:value-of select="php:function('lang', 'Contact information')" /></h3></dt>
                                             <div class="pure-control-group">
                                                 <label>
-                                                    <xsl:value-of 
select="php:function('lang', 'Name')" />
+                                                    <h4><xsl:value-of 
select="php:function('lang', 'Name')" /></h4>
                                                 </label>
                                                         <xsl:value-of 
select="application/contact_name"/>
                                             </div>
                                             <div class="pure-control-group">
                                                 <label>
-                                                    <xsl:value-of 
select="php:function('lang', 'Email')" />
+                                                    <h4><xsl:value-of 
select="php:function('lang', 'Email')" /></h4>
                                                 </label>
                                                         <xsl:value-of 
select="application/contact_email"/>
                                             </div>
                                             <div class="pure-control-group">
                                                 <label>
-                                                    <xsl:value-of 
select="php:function('lang', 'Phone')" />
+                                                    <h4><xsl:value-of 
select="php:function('lang', 'Phone')" /></h4>
                                                 </label>
                                                         <xsl:value-of 
select="application/contact_phone"/>
                                             </div>
                                 </div>
                                 <div class="pure-control-group">
-                                        <div class="heading">7. <xsl:value-of 
select="php:function('lang', 'responsible applicant')" /> / <xsl:value-of 
select="php:function('lang', 'invoice information')" /></div>
+                                        <dt class="heading"><h3>7. 
<xsl:value-of select="php:function('lang', 'responsible applicant')" /> / 
<xsl:value-of select="php:function('lang', 'invoice information')" /></h3></dt>
                                         <div class="pure-control-group">
                                             <xsl:if 
test="application/customer_identifier_type = 'organization_number'">
                                                 <label>
-                                                    <xsl:value-of 
select="php:function('lang', 'organization number')" />
+                                                    <h4><xsl:value-of 
select="php:function('lang', 'organization number')" /></h4>
                                                 </label>
                                                     <xsl:value-of 
select="application/customer_organization_number"/>
                                             </xsl:if>
@@ -325,14 +339,14 @@
                                         <div class="pure-control-group">
                                             <xsl:if 
test="application/customer_identifier_type = 'ssn'">
                                                 <label>
-                                                    <xsl:value-of 
select="php:function('lang', 'Date of birth or SSN')" />
+                                                    <h4><xsl:value-of 
select="php:function('lang', 'Date of birth or SSN')" /></h4>
                                                 </label>
                                                     <xsl:value-of 
select="application/customer_ssn"/>
                                             </xsl:if>
                                         </div>
                                 </div>
                                 <div class="pure-control-group">
-                                        <div class="heading"><br />8. 
<xsl:value-of select="php:function('lang', 'Terms and conditions')" /></div>
+                                        <dt class="heading"><br /><h3>8. 
<xsl:value-of select="php:function('lang', 'Terms and conditions')" /></h3></dt>
                                         <p><xsl:value-of 
select="php:function('lang', 'All that borrow premises from Stavanger Kommune 
must verify that they have read the terms and conditions, this is usually fire 
regulations and house rules.')" /></p>
                                         <br />
                                         <div 
id='regulation_documents'>&nbsp;</div>
@@ -352,15 +366,15 @@
                                     </button>
                                 </xsl:if-->
                                 <xsl:if test="not(frontend)">
-                                        <dl class="proplist">
-                                    <dt class="heading"><xsl:value-of 
select="php:function('lang', 'Associated items')" /></dt>
+                                    <div class="pure-control-group">
+                                    <dt class="heading"><h3><xsl:value-of 
select="php:function('lang', 'Associated items')" /></h3></dt>
                                                 <dd><div 
id="associated_container"/></dd>
-                                        </dl>
+                                    </div>
                                 </xsl:if>
 
                                 <xsl:if test="application/edit_link">
-                                        <dl class="proplist">
-                                                <dt 
class="heading"><xsl:value-of select="php:function('lang', 'Actions')" /></dt>
+                                        <div class="pure-control-group">
+                                                <dt 
class="heading"><h3><xsl:value-of select="php:function('lang', 'Actions')" 
/></h3></dt>
 
                                                         <dt>
                                                                 <xsl:if 
test="application/case_officer/is_current_user">
@@ -421,7 +435,7 @@
                                                         </xsl:if>
                                                 </xsl:if>
                                                 <!--dd><br/><a 
href="{application/dashboard_link}"><xsl:value-of select="php:function('lang', 
'Back to Dashboard')" /></a></dd-->
-                                        </dl>
+                                        </div>
                                 </xsl:if>
                             </fieldset>
                             </div>
@@ -450,10 +464,78 @@
         if (!resourceIds || resourceIds == "") {
                resourceIds = false;
         }
-       var lang = <xsl:value-of select="php:function('js_lang', 'Resources', 
'Resource Type', 'ID', 'Type', 'From', 'To', 'Document', 'Active' ,'Delete', 
'del')"/>;
+       var lang = <xsl:value-of select="php:function('js_lang', 'Resources', 
'Resource Type', 'No records found', 'ID', 'Type', 'From', 'To', 'Document', 
'Active' ,'Delete', 'del')"/>;
        var app_id = <xsl:value-of select="application/id"/>;
        var building_id = <xsl:value-of select="application/building_id"/>;     
        var resources = <xsl:value-of select="application/resources"/>;
+
+        <![CDATA[
+        var resourcesURL = 
'index.php?menuaction=booking.uiresource.index&sort=name&phpgw_return_as=json&' 
+ resourceIds;
+        var associatedURL = 
'index.php?menuaction=booking.uiapplication.associated&sort=from_&dir=asc&phpgw_return_as=json&filter_application_id='+app_id;
+        ]]>
+        
+        
+        $.get(resourcesURL, function(resourcesData){
+            var resourcesBody = '';
+            var resourcesTableClass = "pure-table";
+            if (resourcesData.data.length === 0){
+                resourcesBody = '<tr><td colspan="2">'+lang['No records 
found']+'</td></tr>';
+            }else{
+                resourcesTableClass = "pure-table pure-table-striped";
+                $.each(resourcesData.data , function(index,value){
+                    <![CDATA[
+                    resourcesBody += '<tr><td><a 
href='+value.link+'>'+value.name+'</a></td><td>'+value.type+'</td></tr>';
+                    ]]>
+                });
+            }
+            <![CDATA[
+                var resourcesTable = '<table 
class="'+resourcesTableClass+'"><thead><tr><th>'+lang['Resources']+'</th><th>'+lang['Resource
 Type']+'</th></tr></thead><tbody>'+resourcesBody+'</tbody></table>';
+            ]]>
+            $('#resources_container').html(resourcesTable);
+        });
+            
+        
+        <![CDATA[
+            var associatedHead = 
'<th>'+lang['ID']+'</th><th>'+lang['Type']+'</th><th>'+lang['From']+'</th><th>'+lang['To']+'</th><th>'+lang['Active']+'</th>';
+        ]]>
+        
+        if (currentuser != 1) {
+            associatedColspan = 6;
+            associatedHead += '<th>'+lang['Delete']+'</th>'
+        } else {
+            associatedColspan = 5;
+        }
+        
+        $.get(associatedURL, function(associatedData){
+            var associatedBody = '';
+            var associatedTableClass = "pure-table";
+            if (associatedData.results.length === 0){
+                associatedBody += '<tr><td 
colspan="'+associatedColspan+'">'+lang['No records found']+'</td></tr>';
+            }else{
+                associatedTableClass = "pure-table pure-table-striped";
+                $.each(associatedData.results, function(index, value){
+                    <![CDATA[
+                    associatedBody += '<td><a 
href="'+value.link+'">'+value.id+'</a></td><td>'+value.type+'</td><td>'+value.from_+'</td><td>'+value.to_+'</td><td>'+value.active+'</td>';
+                    ]]>
+                    if (currentuser != 1){
+                        <![CDATA[
+                        associatedBody += '<td><a onclick="return confirm(\'Er 
du sikker på at du vil slette denne?\';" 
href="'+value.dellink+'">slett</a></td>';
+                        ]]>
+                    }
+                });
+            }
+            console.log(associatedBody);
+            <![CDATA[
+                var associatedTable = '<table 
class="'+associatedTableClass+'"><thead><tr>'+associatedHead+'</tr></thead><tbody><tr>'+associatedBody+'</tr></tbody></table>';
+            ]]>
+            $('#associated_container').html(associatedTable);
+        });
+        
+        
+            
+
+        
+
        
 YAHOO.util.Event.addListener(window, "load", function() {
        <![CDATA[
@@ -461,6 +543,7 @@
                url3 += 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=resource::'+
 resources; 
 
        ]]>
+        console.log(url3);
        var colDefs = [{key: 'name', label: lang['Document'], formatter: 
YAHOO.booking.formatLink}];
     YAHOO.booking.inlineTableHelper('regulation_documents', url3, colDefs);
        if (resourceIds) {
@@ -468,6 +551,7 @@
            var url = 
'index.php?menuaction=booking.uiresource.index&sort=name&phpgw_return_as=json&' 
+ resourceIds;
            var url2 = 
'index.php?menuaction=booking.uiapplication.associated&sort=from_&dir=asc&phpgw_return_as=json&filter_application_id='+app_id;
                ]]>
+                console.log(url);
            var colDefs = [{key: 'name', label: lang['Resources'], formatter: 
YAHOO.booking.formatLink}, {key: 'type', label: lang['Resource Type']}];
            YAHOO.booking.inlineTableHelper('resources_container', url, 
colDefs);
                if (currentuser == 1) {




reply via email to

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