fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15598]


From: saul . huanay
Subject: [Fmsystem-commits] [15598]
Date: Wed, 7 Sep 2016 00:29:04 +0000 (UTC)

Revision: 15598
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15598
Author:   psaul
Date:     2016-09-07 00:29:04 +0000 (Wed, 07 Sep 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
    branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
    branches/dev-syncromind-2/rental/js/rental/schedule.js
    branches/dev-syncromind-2/rental/templates/base/schedule.xsl

Modified: branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-09-06 
11:56:41 UTC (rev 15597)
+++ branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-09-07 
00:29:04 UTC (rev 15598)
@@ -1273,7 +1273,7 @@
 }
 
 
-function createTableSchedule (d, u, c, r, cl, dt, a, p)
+function createTableSchedule (d, u, c, r, cl, dt, a, p, t)
 {
        var container = document.getElementById(d);
        var xtable = document.createElement('table');
@@ -1415,31 +1415,37 @@
                                });
                                tableBody.appendChild(tableBodyTr);
                        });
-               }
 
-               if (p)
-               {
-                       var start = a.start;
-                       var total = data['ResultSet'].totalResultsAvailable;
-                       var n_objects = a.length;
-            start = (start > total) ? 0 : start;
+                       if (p)
+                       {
+                               var start = a.start;
+                               var total = 
data['ResultSet'].totalResultsAvailable;
+                               var n_objects = a.length;
+                               start = (start > total) ? 0 : start;
 
-                       var pages = Math.floor(total / n_objects);
-                       var res = total % n_objects;
-                       var page = (start == 0) ? 1 : (start / n_objects) + 1;
+                               var pages = Math.floor(total / n_objects);
+                               var res = total % n_objects;
+                               var page = (start == 0) ? 1 : (start / 
n_objects) + 1;
 
-                       pages = (res > 0) ? pages+1 : pages;
-                       pages = (pages == 0) ? pages+1 : pages;
+                               pages = (res > 0) ? pages+1 : pages;
+                               pages = (pages == 0) ? pages+1 : pages;
 
-                       var paginator = createPaginatorSchedule(pages, page);
-                       container.appendChild(paginator);
-                       
-                       var input_start = document.createElement('input');
-                       input_start.setAttribute('type', 'hidden');
-                       input_start.setAttribute('name', 'start_index');
-                       input_start.setAttribute('id', 'start_index');
-                       input_start.value = start;
-                       container.appendChild(input_start);
+                               var paginator = createPaginatorSchedule(pages, 
page);
+                               container.appendChild(paginator);
+
+                               var input_start = 
document.createElement('input');
+                               input_start.setAttribute('type', 'hidden');
+                               input_start.setAttribute('name', 'start_index');
+                               input_start.setAttribute('id', 'start_index');
+                               input_start.value = start;
+                               container.appendChild(input_start);
+                       }
+
+                       if (t)
+                       {
+                               var toolbar = schedule.createToolbar();
+                               container.insertBefore(toolbar, xtable);
+                       }
                }
        });
 }
@@ -1778,7 +1784,6 @@
 
        if (data[k])
        {
-               var contratctLink = (data['contract_link']) ? 
data['contract_link'] : null;
                text = data[k]['status'];
        }
        else
@@ -1787,6 +1792,18 @@
                classes = "free";
        }
 
+       trAttributes.push( {attribute: 'data-id', value: data['id']} );
+       trFunction.push(
+               {
+                       event: 'click',
+                       callFunction: function () {
+                               
$(this).parent().parent().find('tr').removeClass("trselected")
+                               $(this).parent().addClass("trselected");
+                               $('#schedule_toolbar button').attr('disabled', 
false);
+                       }
+               }
+       );
+
        var data_return = {
                text: text,
                classes: classes,

Modified: branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php      
2016-09-06 11:56:41 UTC (rev 15597)
+++ branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php      
2016-09-07 00:29:04 UTC (rev 15598)
@@ -22,8 +22,8 @@
                        'remove_unit' => true,
                        'query' => true,
                        'download' => true,
-            'schedule' => true,
-            'get_schedule' => true
+                       'schedule' => true,
+                       'get_schedule' => true
                );
 
                public function __construct()
@@ -1107,25 +1107,126 @@
                }
 
                public function schedule ()
-        {
+               {
                        $composite_id = (int)phpgw::get_var('id');
                        $date = new DateTime(phpgw::get_var('date'));
                        if ($date->format('w') != 1) {
                                $date->modify('last monday');
                        }
-            
-            $filters = $this->_get_filters();
-            
-            $schedule['filters'] = $filters;
 
+                       $editable = phpgw::get_var('editable', 'bool');
+                       $type = 'all_composites';
+
+                       $filters = $this->_get_filters();
+
+                       $schedule['filters'] = $filters;
+
                        $schedule['datasource_url'] = self::link(array(
                                'menuaction' => 
'rental.uicomposite.get_schedule',
-                               'phpgw_return_as' => 'json',
-                'type' => 'all_composites'
+                               'editable' => ($editable) ? 1 : 0,
+                               'type' => $type,
+                               'phpgw_return_as' => 'json'
                        ));
+
+                       $parameters = array();
+                       
+                       $parameters[] = array(
+                               'name' => 'id',
+                               'source' => 'id'
+                       );
+
+                       $toolbar = array();
+
+                       $toolbar[] = array(
+                               'name' => 'new',
+                               'text' => lang('new'),
+                               'action' => self::link(array(
+                                       'menuaction' => 'rental.uicomposite.add'
+                               ))
+                       );
+                       
+                       $toolbar[] = array(
+                               'name' => 'download',
+                               'text' => lang('download'),
+                               'action' => self::link(array(
+                                       'menuaction' => 
'rental.uicomposite.download',
+                                       'type' => $type,
+                                       'export' => true,
+                                       'allrows' => true
+                               ))
+                       );
+                       
+                       $toolbar[] = array(
+                               'name' => 'edit',
+                               'text' => lang('edit'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'rental.uicomposite.edit'
+                               )),
+                               'parameters' => $parameters
+                       );
+                       
+                       $toolbar[] = array(
+                               'name' => 'view',
+                               'text' => lang('show'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'rental.uicomposite.view'
+                               )),
+                               'parameters' => $parameters
+                       );
+                       
+                       $contract_types = 
rental_socontract::get_instance()->get_fields_of_responsibility();
+
+                       $valid_contract_types = array();
+                       if (isset($this->config->config_data['contract_types']) 
&& is_array($this->config->config_data['contract_types']))
+                       {
+                               foreach 
($this->config->config_data['contract_types'] as $_key => $_value)
+                               {
+                                       if ($_value)
+                                       {
+                                               $valid_contract_types[] = 
$_value;
+                                       }
+                               }
+                       }
+
+                       $create_types = array();
+                       foreach ($contract_types as $id => $label)
+                       {
+                               if ($valid_contract_types && !in_array($id, 
$valid_contract_types))
+                               {
+                                       continue;
+                               }
+
+                               $names = $this->locations->get_name($id);
+                               if ($names['appname'] == 
$GLOBALS['phpgw_info']['flags']['currentapp'])
+                               {
+                                       if 
($this->hasPermissionOn($names['location'], PHPGW_ACL_ADD))
+                                       {
+                                               $create_types[] = array($id, 
$label);
+                                       }
+                               }
+                       }
+
+                       foreach ($create_types as $create_type)
+                       {
+                               $toolbar[] = array
+                                       (
+                                       'name' => $create_type[1],
+                                       'text' => lang('create_contract_' . 
$create_type[1]),
+                                       'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                               'menuaction' => 
'rental.uicontract.add_from_composite',
+                                               'responsibility_id' => 
$create_type[0]
+                                       )),
+                                       'parameters' => $parameters
+                               );
+                       }
+
                        $schedule['composite_id'] = $composite_id;
                        $schedule['date'] = $date;
                        $schedule['picker_img'] = 
$GLOBALS['phpgw']->common->image('phpgwapi', 'cal');
+                       $schedule['toolbar'] = json_encode($toolbar);
 
                        self::add_javascript('rental','rental','schedule.js');
 
@@ -1135,16 +1236,16 @@
                }
 
                public function get_schedule ()
-        {
+               {
                        $composite_id = (int)phpgw::get_var('id');
                        $date = new DateTime(phpgw::get_var('date'));
 
-            if ($date->format('w') != 1)
+                       if ($date->format('w') != 1)
                        {
                                $date->modify('last monday');
                        }
 
-            $days = array();
+                       $days = array();
                        $date_to_array = clone $date;
                        for ($i = 0; $i < 7; $i++)
                        {
@@ -1152,60 +1253,63 @@
                                $date_to_array->modify("+1 day");
                        }
 
-            $composites_obj = $this->query();
-            $composites_data = $composites_obj['data'];
-            
-            $composites = array();
-            $n = 0;
-            
-            foreach ($composites_data as $composite)
-            {
-                $composite_obj = 
rental_socomposite::get_instance()->get_single($composite['id']);
-                $contracts = $composite_obj->get_contracts();
+                       $composites_obj = $this->query();
+                       $composites_data = $composites_obj['data'];
 
-                if (count($contracts) > 0)
-                {
-                    foreach ($contracts as $contract)
-                    {
-                        $contract = $contract->serialize();
+                       $composites = array();
+                       $n = 0;
 
-                        if ($composites[$n-1]['id'] != $composite['id'])
-                        {
-                            $composites[$n]['id'] = $composite['id'];
-                        }
-                        
-                        $composites[$n]['name'] = $composite['name'];
+                       foreach ($composites_data as $composite)
+                       {
+                               $composite_obj = 
rental_socomposite::get_instance()->get_single($composite['id']);
+                               $contracts = $composite_obj->get_contracts();
 
-                        $contract_date_start = new DateTime(date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
-                        $contract_date_end = new DateTime(date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
+                               if (count($contracts) > 0)
+                               {
+                                       foreach ($contracts as $contract)
+                                       {
+                                               $contract = 
$contract->serialize();
 
-                        foreach ($days as $day)
-                        {
-                            if ($day >= $contract_date_start && ($day <= 
$contract_date_end || $contract['date_end'] == ''))
-                            {
-                                $composites[$n]['contract_id'] = 
$contract['id'];
-                                $composites[$n]['old_contract_id'] = 
$contract['old_contract_id'];
-                                $composites[$n][date_format($day, 
'D')]['status'] = 'Ikke ledig';
-                            }
-                            else
-                            {
-                                $composites[$n][date_format($day, 
'D')]['status'] = 'Ledig';
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    $composites[$n]['id'] = $composite['id'];
-                    $composites[$n]['name'] = $composite['name'];
-                    foreach ($days as $day)
-                    {
-                        $composites[$n][date_format($day, 'D')]['status'] = 
'Ledig';
-                    }
-                }
-                $n++;
-            }
+                                               if ($composites[$n-1]['id'] != 
$composite['id'])
+                                               {
+                                                       $composites[$n]['id'] = 
$composite['id'];
+                                               }
+                                               
+                                               $composites[$n]['name'] = 
$composite['name'];
+                                               
$composites[$n]['object_number'] = $composite['location_code'];
 
+                                               $contract_date_start = new 
DateTime(date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
+                                               $contract_date_end = new 
DateTime(date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
+
+                                               foreach ($days as $day)
+                                               {
+                                                       if ($day >= 
$contract_date_start && ($day <= $contract_date_end || $contract['date_end'] == 
''))
+                                                       {
+                                                               
$composites[$n]['contract_id'] = $contract['id'];
+                                                               
$composites[$n]['old_contract_id'] = $contract['old_contract_id'];
+                                                               
$composites[$n][date_format($day, 'D')]['status'] = 'Ikke ledig';
+                                                       }
+                                                       else
+                                                       {
+                                                               
$composites[$n][date_format($day, 'D')]['status'] = 'Ledig';
+                                                       }
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       $composites[$n]['id'] = 
$composite['id'];
+                                       $composites[$n]['name'] = 
$composite['name'];
+                                       $composites[$n]['object_number'] = 
$composite['location_code'];
+
+                                       foreach ($days as $day)
+                                       {
+                                               
$composites[$n][date_format($day, 'D')]['status'] = 'Ledig';
+                                       }
+                               }
+                               $n++;
+                       }
+
                        $data = array(
                                'ResultSet' => array(
                                        "totalResultsAvailable" => 
$composites_obj['recordsTotal'],

Modified: branches/dev-syncromind-2/rental/js/rental/schedule.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/schedule.js      2016-09-06 
11:56:41 UTC (rev 15597)
+++ branches/dev-syncromind-2/rental/js/rental/schedule.js      2016-09-07 
00:29:04 UTC (rev 15598)
@@ -8,16 +8,16 @@
 
 schedule.renderSchedule = function (container, url, date, colFormatter, 
includeResource, classTable)
 {
-    classTable = (classTable) ? classTable : "pure-table";
-    while (date.getDay() != 1)
+       classTable = (classTable) ? classTable : "pure-table 
rentalScheduleTable";
+       while (date.getDay() != 1)
        {
                date.setDate(date.getDate() - 1);
        }
-    
-    var datestr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + 
date.getDate();
+
+       var datestr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + 
date.getDate();
        url += '&date=' + datestr;
-    
-    var detected_lang = navigator.language || navigator.userLanguage;
+
+       var detected_lang = navigator.language || navigator.userLanguage;
        var lang = {};
 
        if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang == 
'nb')
@@ -48,39 +48,42 @@
                        LBL_WEEK: 'Week'
                };
        }
-    
-    var colDefs = [
-        {key: 'id', label: 'Composite ID', type: 'th'}
-    ]
 
-    var keys = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
-    schedule.dates = {};
+       var colDefs = [
+               {key: 'object_number', label: 'Object Number', type: 'th'},
+               {key: 'name', label: 'Name', type: 'th'},
+               {key: 'id', label: 'Composite ID', type: 'th'}
+       ]
 
-    for (var i = 0; i < 7; i++)
-    {
-        var d = new Date(date.getFullYear(), date.getMonth(), date.getDate());
-        d.setDate(d.getDate() + i);
-        var x = (i < 6) ? i + 1 : 0;
-        schedule.dates[keys[x]] = d;
-        colDefs.push({
-            key: keys[x],
-            value: 'old_contract_id',
-            label: lang['WEEKDAYS_FULL'][x] + '<br>' + 
lang['MONTHS_LONG'][d.getMonth()] + ' ' + d.getDate(), formatter: colFormatter, 
date: d, day: d.getDate()
-        });
-    }
-    
-    var r = [{n: 'ResultSet'}, {n: 'Result'}];
-    
-    var params = (schedule.params) ? schedule.params : new Array();
-    var pagination = true;
-    
-    createTableSchedule(container, url, colDefs, r, classTable, datestr, 
params, pagination)
-    
+       var keys = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+       schedule.dates = {};
+
+       for (var i = 0; i < 7; i++)
+       {
+               var d = new Date(date.getFullYear(), date.getMonth(), 
date.getDate());
+               d.setDate(d.getDate() + i);
+               var x = (i < 6) ? i + 1 : 0;
+               schedule.dates[keys[x]] = d;
+               colDefs.push({
+                       key: keys[x],
+                       value: 'old_contract_id',
+                       label: lang['WEEKDAYS_FULL'][x] + '<br>' + 
lang['MONTHS_LONG'][d.getMonth()] + ' ' + d.getDate(), formatter: colFormatter, 
date: d, day: d.getDate()
+               });
+       }
+
+       var r = [{n: 'ResultSet'}, {n: 'Result'}];
+
+       var params = (schedule.params) ? schedule.params : new Array();
+       var pagination = true;
+       var toolbar = true;
+
+       createTableSchedule(container, url, colDefs, r, classTable, datestr, 
params, pagination, toolbar);
 }
 
 schedule.setupWeekPicker = function ()
 {
 }
+
 $(function ()
 {
        $("#cal_container #datepicker").datepicker({
@@ -99,6 +102,7 @@
                        }
                }
        });
+
        $("#cal_container #pickerImg").on('click', function ()
        {
                $("#cal_container #datepicker").datepicker("show");
@@ -110,7 +114,7 @@
        schedule.week = $.datepicker.iso8601Week(date);
        $('#cal_container #numberWeek').text(schedule.week);
        $("#cal_container #datepicker").datepicker("setDate", date);
-       classTable = (schedule.classTable) ? schedule.classTable : 'pure-table';
+       classTable = (schedule.classTable) ? schedule.classTable : 'pure-table 
rentalScheduleTable';
 
        var url = self.location.href;
        url = url.substr(0, (url.indexOf("#date")));
@@ -130,10 +134,12 @@
        date.setDate(date.getDate() + n);
        schedule.updateSchedule(date);
 }
+
 schedule.prevWeek = function ()
 {
        schedule.moveWeek(-7)
 };
+
 schedule.nextWeek = function ()
 {
        schedule.moveWeek(7)
@@ -141,60 +147,129 @@
 
 $(window).load(function()
 {
-    function searchSchedule ()
-    {
-        var location_id = $('#location_id').val();
-        var search_option = $('#search_option').val();
-        var contract_status = $('#contract_status').val();
-        var contract_type = $('#contract_type').val();
-        var search = $('#txtSearchSchedule').val();
-        var n_objects = $('#cboNObjects').val();
-        
-        var args = {
-            menuaction: 'rental.uicomposite.get_schedule',
-            composite_id: composite_id,
-            location_id: location_id,
-            search_option: search_option,
-            contract_status: contract_status,
-            contract_type: contract_type,
-            search: search,
-            n_objects: n_objects
-        }
-        
-        schedule.datasourceUrl = phpGWLink('index.php', args, true);
-        
-        schedule.renderSchedule('schedule_container', schedule.datasourceUrl, 
schedule.date, schedule.colFormatter, schedule.includeResource);
-    }
+       function searchSchedule ()
+       {
+               var location_id = $('#location_id').val();
+               var search_option = $('#search_option').val();
+               var contract_status = $('#contract_status').val();
+               var contract_type = $('#contract_type').val();
+               var search = $('#txtSearchSchedule').val();
+               var n_objects = $('#cboNObjects').val();
 
-    $('select.searchSchedule').on('change', function()
-    {
-        schedule.renderSchedule('schedule_container', schedule.datasourceUrl, 
schedule.date, schedule.colFormatter, schedule.includeResource);
-    });    
-    $('input.searchSchedule').on('keyup', function()
-    {
-        var $this = $(this);
-        if ($this.data('text') != $this.val())
-        {
-            setTimeout(function()
-            {
-                $this.data('text', $this.val());
-                schedule.params.search = $this.val();
-                schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
-            }, 500);
-        }
-    });
+               var args = {
+                       menuaction: 'rental.uicomposite.get_schedule',
+                       composite_id: composite_id,
+                       location_id: location_id,
+                       search_option: search_option,
+                       contract_status: contract_status,
+                       contract_type: contract_type,
+                       search: search,
+                       n_objects: n_objects
+               }
 
-    $('#schedule_container').on('click', '.paginate_button', function()
-    {
-        if ($(this).data('page'))
-        {
-            var page = $(this).data('page');
-            var l = $('#cboNObjects').val();
-            var start = l * (page - 1);
-            schedule.params.start = start;
-            schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
-        }
-    })
+               schedule.datasourceUrl = phpGWLink('index.php', args, true);
+
+               schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
+       }
+
+       $('select.searchSchedule').on('change', function()
+       {
+               schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
+       });
+
+       $('input.searchSchedule').on('keyup', function()
+       {
+               var $this = $(this);
+               if ($this.data('text') != $this.val())
+               {
+                       setTimeout(function()
+                       {
+                               $this.data('text', $this.val());
+                               schedule.params.search = $this.val();
+                               schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
+                       }, 500);
+               }
+       });
+
+       $('#schedule_container').on('click', '.paginate_button', function()
+       {
+               if ($(this).data('page'))
+               {
+                       var page = $(this).data('page');
+                       var l = $('#cboNObjects').val();
+                       var start = l * (page - 1);
+                       schedule.params.start = start;
+                       schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
+               }
+       })
 })
 
+schedule.createToolbar = function ()
+{
+       var toolbar = schedule.toolbar;
+       var container = document.createElement('div');
+       container.setAttribute('id', 'schedule_toolbar');
+       var id = "$('.rentalScheduleTable .trselected').data('id')";
+       $.each(toolbar, function(i, v)
+       {
+               var name = v['name'];
+               var text = v['text'];
+               var action = v['action'];
 
+               var  parameters = (v['parameters']) ? v['parameters'] : "";
+
+               var button = document.createElement('button');
+               button.innerHTML = text;
+               if (parameters)
+               {
+                       button.disabled = true;
+               }
+               if (name == 'download')
+               {
+                       button.addEventListener('click', function()
+                       {
+                               var new_action = action;
+                               $.each(schedule.params, function(i, v)
+                               {
+                                       new_action += '&' + i + '=' + v;
+                               });
+                               if (parameters)
+                               {
+                                       for (var i = 0; i < parameters.length; 
i++)
+                                       {
+                                               var val = 
eval(parameters[i]['source']);
+                                               new_action += '&' + 
parameters[i]['name'] + '=' + eval(val);
+                                       }
+                               }
+                               var iframe = document.createElement('iframe');
+                               iframe.style.height = "0px";
+                               iframe.style.width = "0px";
+                               iframe.src = new_action;
+                               if(confirm("This will take some time..."))
+                               {
+                                       document.body.appendChild( iframe );
+                               }
+                       }, false);
+               }
+               else
+               {
+                       button.addEventListener('click', function()
+                       {
+                               var new_action = action;
+                               if (parameters)
+                               {
+                                       for (var i = 0; i < parameters.length; 
i++)
+                                       {
+                                               var val = 
eval(parameters[i]['source']);
+                                               new_action += '&' + 
parameters[i]['name'] + '=' + eval(val);
+                                       }
+                               }
+                               window.open(new_action);
+                       }, false);
+               }
+
+               container.appendChild(button);
+       });
+
+       return container;
+}
\ No newline at end of file

Modified: branches/dev-syncromind-2/rental/templates/base/schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/schedule.xsl        
2016-09-06 11:56:41 UTC (rev 15597)
+++ branches/dev-syncromind-2/rental/templates/base/schedule.xsl        
2016-09-07 00:29:04 UTC (rev 15598)
@@ -10,203 +10,189 @@
 </xsl:template>
 
 <xsl:template xmlns:php="http://php.net/xsl"; match="schedule">
-    <style typ="text/css" rel="stylesheet">
+       <style typ="text/css" rel="stylesheet">
+               #schedule_container tbody tr th {background: #eee none repeat 
scroll 0 0;}
+               #schedule_toolbar {margin-bottom: 10px;}
                #week-selector {list-style: outside none none;display: 
inline-block;vertical-align: middle;}
                #week-selector li {display: inline-block;vertical-align: 
middle;}
                #cal_container {margin: 0 20px;}
                #cal_container #datepicker {width: 2px;opacity: 0;position: 
absolute;display:none;}
                #cal_container #numberWeek {width: 20px;display: inline-block;}
-        #schedule_container {display: inline-block;position: relative;}
-        #scheduleSearchBox {display: inline-block; vertical-align: middle;}
-            #scheduleSearchBox label {margin-right: 5px; margin-left: 20px;}
-            #scheduleSearchBox #txtSearchSchedule {}
-        .schedule_paginate#schedule-container_paginate {bottom: 
-50px;position: absolute;right: 0;}
-        .schedule_paginate#schedule-container_paginate .ellipsis {padding: 0 
1em;}
-        .paginate_button {border: 1px solid transparent;border-radius: 
2px;box-sizing: border-box;color: #333 !important;cursor: pointer;display: 
inline-block;margin-left: 2px;min-width: 1.5em;padding: 0.5em 1em;text-align: 
center;text-decoration: none !important;}
-        .paginate_button:hover {background: rgba(0, 0, 0, 0) 
linear-gradient(to bottom, #585858 0%, #111 100%) repeat scroll 0 0;border: 1px 
solid #111;color: white !important;}
-        .paginate_button:active {background: rgba(0, 0, 0, 0) 
linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%) repeat scroll 0 
0;box-shadow: 0 0 3px #111 inset;outline: medium none;}
-        .paginate_button.disabled,
-        .paginate_button.disabled:hover,
-        .paginate_button.disabled:active {background: transparent none repeat 
scroll 0 0;border: 1px solid transparent;box-shadow: none;color: #666 
!important;cursor: default;}
-        .paginate_button.previous {}
-        .paginate_button.next {}
-        .paginate_button.current,
-        .paginate_button.current:hover {background: rgba(0, 0, 0, 0) 
linear-gradient(to bottom, white 0%, #dcdcdc 100%) repeat scroll 0 0;border: 
1px solid #979797;color: #333 !important;}
-        
+               #schedule_container {display: inline-block;position: relative;}
+               #scheduleSearchBox {display: inline-block; vertical-align: 
middle;}
+                       #scheduleSearchBox label {margin-right: 5px; 
margin-left: 20px;}
+                       #scheduleSearchBox #txtSearchSchedule {}
+               .schedule_paginate#schedule-container_paginate {bottom: 
-50px;position: absolute;right: 0;}
+               .schedule_paginate#schedule-container_paginate .ellipsis 
{padding: 0 1em;}
+               .paginate_button {border: 1px solid transparent;border-radius: 
2px;box-sizing: border-box;color: #333 !important;cursor: pointer;display: 
inline-block;margin-left: 2px;min-width: 1.5em;padding: 0.5em 1em;text-align: 
center;text-decoration: none !important;}
+               .paginate_button:hover {background: rgba(0, 0, 0, 0) 
linear-gradient(to bottom, #585858 0%, #111 100%) repeat scroll 0 0;border: 1px 
solid #111;color: white !important;}
+               .paginate_button:active {background: rgba(0, 0, 0, 0) 
linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%) repeat scroll 0 
0;box-shadow: 0 0 3px #111 inset;outline: medium none;}
+               .paginate_button.disabled,
+               .paginate_button.disabled:hover,
+               .paginate_button.disabled:active {background: transparent none 
repeat scroll 0 0;border: 1px solid transparent;box-shadow: none;color: #666 
!important;cursor: default;}
+               .paginate_button.previous {}
+               .paginate_button.next {}
+               .paginate_button.current,
+               .paginate_button.current:hover {background: rgba(0, 0, 0, 0) 
linear-gradient(to bottom, white 0%, #dcdcdc 100%) repeat scroll 0 0;border: 
1px solid #979797;color: #333 !important;}
+               tr.trselected td, tr.trselected th {background-color: #acbad4 
!important;}
        </style>
-    <div id="contract_schedule">
-        <div id="shceduleFilters">
-            <div id="queryForm">
-                <style scoped="scoped" type="text/css" id="toggle-box-css">
-                    .toggle-box {display: none;}
-                    .toggle-box + label {cursor: pointer;display: 
block;font-weight: bold;line-height: 21px;margin-bottom: 5px;}
-                    .toggle-box + label + #toolbar {display: 
none;margin-bottom: 10px;}
-                    .toggle-box:checked + label + #toolbar {display: block;}
-                    .toggle-box + label:before {background-color: 
#4F5150;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 
10px;color: #FFFFFF;content: "+";display: block;float: left;font-weight: 
bold;height: 20px;line-height: 20px;margin-right: 5px;text-align: center;width: 
20px;}
-                    .toggle-box:checked + label:before {content: "\2212";}
-                </style>
-                <input type="checkbox" id="header1" class="toggle-box" />
-                <label for="header1">Filter</label>
-                <div id="toolbar" class="dtable_custom_controls">
-                    <table class="pure-table pure-table-horizontal" 
id="toolbar_table">
-                        <thead>
-                            <tr>
-                                <th>Name</th>
-                                <th>!item</th>
-                            </tr>
-                        </thead>
-                        <tbody>
-                            <script type="text/javascript">
-                                schedule.params = {};
-                            </script>
-                            <xsl:for-each select="filters">
-                                <tr>
-                                    <td><xsl:value-of select="text" /></td>
-                                    <td>                           
-                                        <xsl:variable name="name">
+       <div id="contract_schedule">
+               <div id="shceduleFilters">
+                       <div id="queryForm">
+                               <style scoped="scoped" type="text/css" 
id="toggle-box-css">
+                                       .toggle-box {display: none;}
+                                       .toggle-box + label {cursor: 
pointer;display: block;font-weight: bold;line-height: 21px;margin-bottom: 5px;}
+                                       .toggle-box + label + #toolbar 
{display: none;margin-bottom: 10px;}
+                                       .toggle-box:checked + label + #toolbar 
{display: block;}
+                                       .toggle-box + label:before 
{background-color: #4F5150;-webkit-border-radius: 10px;-moz-border-radius: 
10px;border-radius: 10px;color: #FFFFFF;content: "+";display: block;float: 
left;font-weight: bold;height: 20px;line-height: 20px;margin-right: 
5px;text-align: center;width: 20px;}
+                                       .toggle-box:checked + label:before 
{content: "\2212";}
+                               </style>
+                               <input type="checkbox" id="header1" 
class="toggle-box" />
+                               <label for="header1">Filter</label>
+                               <div id="toolbar" 
class="dtable_custom_controls">
+                                       <table class="pure-table 
pure-table-horizontal" id="toolbar_table">
+                                               <thead>
+                                                       <tr>
+                                                               <th>Name</th>
+                                                               <th>!item</th>
+                                                       </tr>
+                                               </thead>
+                                               <tbody>
+                                                       <script 
type="text/javascript">
+                                                               schedule.params 
= {};
+                                                       </script>
+                                                       <xsl:for-each 
select="filters">
+                                                               <tr>
+                                                                       
<td><xsl:value-of select="text" /></td>
+                                                                       <td>
+                                                                               
<xsl:variable name="name">
                                                                                
        <xsl:value-of select="name"/>
                                                                                
</xsl:variable>
-                                        <xsl:if test="type = 'filter'">
-                                            <select id="{$name}" 
name="{$name}" class="searchSchedule" width="250" style="width: 250px">         
                                       
-                                                <xsl:for-each select="list">
-                                                    <xsl:variable name="id">
-                                                        <xsl:value-of 
select="id"/>
-                                                    </xsl:variable>
-                                                    <xsl:choose>
-                                                        <xsl:when test="id = 
'NEW'">
-                                                            <option 
value="{$id}" selected="selected">
-                                                                <xsl:value-of 
select="name"/>
-                                                            </option>
-                                                        </xsl:when>
-                                                        <xsl:otherwise>
-                                                            <xsl:choose>
-                                                                <xsl:when 
test="selected = 'selected'">
-                                                                    <option 
value="{$id}" selected="selected">
-                                                                        
<xsl:value-of select="name"/>
-                                                                    </option>
-                                                                </xsl:when>
-                                                                <xsl:when 
test="selected = '1'">
-                                                                    <option 
value="{$id}" selected="selected">
-                                                                        
<xsl:value-of select="name"/>
-                                                                    </option>
-                                                                </xsl:when>
-                                                                <xsl:otherwise>
-                                                                    <option 
value="{$id}">
-                                                                        
<xsl:value-of select="name"/>
-                                                                    </option>
-                                                                
</xsl:otherwise>
-                                                            </xsl:choose>
-                                                        </xsl:otherwise>
-                                                    </xsl:choose>
-                                                </xsl:for-each>
-                                            </select>
-                                        </xsl:if>
-                                    </td>
-                                </tr>
-                                <script type="text/javascript">
-                                    schedule.params.<xsl:value-of 
select="name"/> = $('select#<xsl:value-of select="name"/>').val();
-                                    $('select#<xsl:value-of 
select="name"/>').change( function()
-                                    {
-                                        schedule.params.<xsl:value-of 
select="name"/> = $(this).val();
-                                    });
-                                </script>
-                            </xsl:for-each>
-                        </tbody>
-                    </table>
-                </div>
-            </div>
-        </div>
-        <ul id="week-selector">
-            <li>
-                <span class="pure-button pure-button-primary" 
onclick="schedule.prevWeek(); return false">
-                    <xsl:value-of select="php:function('lang', 'Previous 
week')"/>
-                </span>
-            </li>
-            <li id="cal_container">
-                <div>
-                    <span>
-                        <xsl:value-of select="php:function('lang', 'Week')" 
/>: </span>
-                    <label id="numberWeek"></label>
-                    <input type="text" id="datepicker" />
-                    <img id="pickerImg" src="{picker_img}" />
-                </div>
-            </li>
-            <li>
-                <span class="pure-button pure-button-primary" 
onclick="schedule.nextWeek(); return false">
-                    <xsl:value-of select="php:function('lang', 'Next week')"/>
-                </span>
-            </li>
-        </ul>
-        <p id="scheduleSearchBox">
-            <label for="txtSearchSchedule">Search: </label>
-            <input type="text" id="txtSearchSchedule" class="searchSchedule" />
-        </p>
-        <div id="schedule_container"></div>
-        <p>
-            <label for="cboNObjects">Show</label>
-            <select name="cboNObjects" id="cboNObjects" class="searchSchedule">
-                <option selected="selected" value="15">15</option>
-                <option value="30">30</option>
-                <option value="45">45</option>
-                <option value="0">All</option>
-            </select>
-            <label for="cboNObjects">Entries</label>
-            <script type="text/javascript">
-                schedule.params.n_objects = $('select#cboNObjects').val();
-                $('select#cboNObjects').change( function()
-                {
-                    schedule.params.length = $(this).val();
-                });
-            </script>
-        </p>
+                                                                               
<xsl:if test="type = 'filter'">
+                                                                               
        <select id="{$name}" name="{$name}" class="searchSchedule" width="250" 
style="width: 250px">
+                                                                               
                <xsl:for-each select="list">
+                                                                               
                        <xsl:variable name="id">
+                                                                               
                                <xsl:value-of select="id"/>
+                                                                               
                        </xsl:variable>
+                                                                               
                        <xsl:choose>
+                                                                               
                                <xsl:when test="id = 'NEW'">
+                                                                               
                                        <option value="{$id}" 
selected="selected">
+                                                                               
                                                <xsl:value-of select="name"/>
+                                                                               
                                        </option>
+                                                                               
                                </xsl:when>
+                                                                               
                                <xsl:otherwise>
+                                                                               
                                        <xsl:choose>
+                                                                               
                                                <xsl:when test="selected = 
'selected'">
+                                                                               
                                                        <option value="{$id}" 
selected="selected">
+                                                                               
                                                                <xsl:value-of 
select="name"/>
+                                                                               
                                                        </option>
+                                                                               
                                                </xsl:when>
+                                                                               
                                                <xsl:when test="selected = '1'">
+                                                                               
                                                        <option value="{$id}" 
selected="selected">
+                                                                               
                                                                <xsl:value-of 
select="name"/>
+                                                                               
                                                        </option>
+                                                                               
                                                </xsl:when>
+                                                                               
                                                <xsl:otherwise>
+                                                                               
                                                        <option value="{$id}">
+                                                                               
                                                                <xsl:value-of 
select="name"/>
+                                                                               
                                                        </option>
+                                                                               
                                                </xsl:otherwise>
+                                                                               
                                        </xsl:choose>
+                                                                               
                                </xsl:otherwise>
+                                                                               
                        </xsl:choose>
+                                                                               
                </xsl:for-each>
+                                                                               
        </select>
+                                                                               
</xsl:if>
+                                                                       </td>
+                                                               </tr>
+                                                               <script 
type="text/javascript">
+                                                                       
schedule.params.<xsl:value-of select="name"/> = $('select#<xsl:value-of 
select="name"/>').val();
+                                                                       
$('select#<xsl:value-of select="name"/>').change( function()
+                                                                       {
+                                                                               
schedule.params.<xsl:value-of select="name"/> = $(this).val();
+                                                                       });
+                                                               </script>
+                                                       </xsl:for-each>
+                                               </tbody>
+                                       </table>
+                               </div>
+                       </div>
+               </div>
+               <ul id="week-selector">
+                       <li>
+                               <span class="pure-button pure-button-primary" 
onclick="schedule.prevWeek(); return false">
+                                       <xsl:value-of 
select="php:function('lang', 'Previous week')"/>
+                               </span>
+                       </li>
+                       <li id="cal_container">
+                               <div>
+                                       <span>
+                                               <xsl:value-of 
select="php:function('lang', 'Week')" />: </span>
+                                       <label id="numberWeek"></label>
+                                       <input type="text" id="datepicker" />
+                                       <img id="pickerImg" src="{picker_img}" 
/>
+                               </div>
+                       </li>
+                       <li>
+                               <span class="pure-button pure-button-primary" 
onclick="schedule.nextWeek(); return false">
+                                       <xsl:value-of 
select="php:function('lang', 'Next week')"/>
+                               </span>
+                       </li>
+               </ul>
+               <p id="scheduleSearchBox">
+                       <label for="txtSearchSchedule">Search: </label>
+                       <input type="text" id="txtSearchSchedule" 
class="searchSchedule" />
+               </p>
+               <div id="schedule_container"></div>
+               <p>
+                       <label for="cboNObjects">Show</label>
+                       <select name="cboNObjects" id="cboNObjects" 
class="searchSchedule">
+                               <option selected="selected" 
value="15">15</option>
+                               <option value="30">30</option>
+                               <option value="45">45</option>
+                               <option value="0">All</option>
+                       </select>
+                       <label for="cboNObjects">Entries</label>
+                       <script type="text/javascript">
+                               schedule.params.n_objects = 
$('select#cboNObjects').val();
+                               $('select#cboNObjects').change( function()
+                               {
+                                       schedule.params.length = $(this).val();
+                               });
+                       </script>
+               </p>
+       </div>
+       <script type="text/javascript">
+               var composite_id = '<xsl:value-of select="composite_id"/>';
+               $(window).load(function() {
 
+                       schedule.params.length = $('#cboNObjects').val();
+                       schedule.params.search = $('#txtSearchSchedule').val();
+                       schedule.params.start = 0;
 
-        <!--div class="schedule_paginate" id="schedule-container_paginate">
-            <a class="paginate_button previous disabled" data-dt-idx="0" 
tabindex="1" id="schedule-container_previous">!prev</a>
-            <span>
-                <a class="paginate_button current" data-dt-idx="1" 
tabindex="1">1</a>
-                <a class="paginate_button " data-dt-idx="2" tabindex="1">2</a>
-                <a class="paginate_button " data-dt-idx="3" tabindex="1">3</a>
-                <a class="paginate_button " data-dt-idx="4" tabindex="1">4</a>
-                <a class="paginate_button " data-dt-idx="5" tabindex="1">5</a>
-                <span class="ellipsis">…</span>
-                <a class="paginate_button " data-dt-idx="6" tabindex="1">25</a>
-            </span>
-            <a class="paginate_button next" data-dt-idx="7" tabindex="1" 
id="schedule-container_next">Next</a>
-        </div-->
+                       schedule.setupWeekPicker('cal_container');
 
+                       var img_src = '<xsl:value-of select="picker_img"/>';
+                       //var composite_id = '<xsl:value-of 
select="composite_id"/>';
 
-    </div>
-    <script type="text/javascript">
-        var composite_id = '<xsl:value-of select="composite_id"/>';
-               $(window).load(function() {
-            
-            schedule.params.length = $('#cboNObjects').val();
-            schedule.params.search = $('#txtSearchSchedule').val();
-            schedule.params.start = 0;
-        
-            schedule.setupWeekPicker('cal_container');
+                       schedule.datasourceUrl = '<xsl:value-of 
select="datasource_url"/>';
+                       var initialRequest = getUrlData("date") || 
'<xsl:value-of select="date"/>';
 
-            var img_src = '<xsl:value-of select="picker_img"/>';
-            //var composite_id = '<xsl:value-of select="composite_id"/>';
+                       schedule.includeResource = false;
+                       schedule.colFormatter = 'rentalSchedule';
+                       var handleHistoryNavigation = function (state) {
+                               schedule.date = parseISO8601(state);
+                               schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
+                       };
 
-            schedule.datasourceUrl = '<xsl:value-of select="datasource_url"/>';
-            var initialRequest = getUrlData("date") || '<xsl:value-of 
select="date"/>';
-
-            schedule.includeResource = false;
-            schedule.colFormatter = 'rentalSchedule';
-            var handleHistoryNavigation = function (state) {
-                schedule.date = parseISO8601(state);
-                schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
-            };
-
-            var state = getUrlData("date") || initialRequest;
-            if (state){
-                handleHistoryNavigation(state);
-                schedule.week = $.datepicker.iso8601Week(schedule.date);
-                $('#cal_container #numberWeek').text(schedule.week);
-                $("#cal_container #datepicker").datepicker("setDate", 
parseISO8601(state));
-            }
+                       var state = getUrlData("date") || initialRequest;
+                       if (state){
+                               handleHistoryNavigation(state);
+                               schedule.week = 
$.datepicker.iso8601Week(schedule.date);
+                               $('#cal_container 
#numberWeek').text(schedule.week);
+                               $("#cal_container 
#datepicker").datepicker("setDate", parseISO8601(state));
+                       }
+                       schedule.toolbar = <xsl:value-of select="toolbar" />;
                });
        </script>
 </xsl:template>
\ No newline at end of file




reply via email to

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