fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16039] more on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [16039] more on eventplanner
Date: Fri, 2 Dec 2016 15:40:30 +0000 (UTC)

Revision: 16039
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16039
Author:   sigurdne
Date:     2016-12-02 15:40:30 +0000 (Fri, 02 Dec 2016)
Log Message:
-----------
more on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.bobooking.inc.php
    trunk/eventplanner/inc/class.sobooking.inc.php
    trunk/eventplanner/inc/class.uiapplication.inc.php
    trunk/eventplanner/inc/class.uibooking.inc.php
    trunk/eventplanner/js/portico/application.edit.js
    trunk/eventplanner/setup/phpgw_no.lang
    trunk/eventplanner/setup/setup.inc.php
    trunk/eventplanner/setup/tables_current.inc.php
    trunk/eventplanner/setup/tables_update.inc.php
    trunk/eventplanner/templates/base/application.xsl
    trunk/eventplanner/templates/base/vendor.xsl
    trunk/phpgwapi/inc/class.jqcal2.inc.php

Modified: trunk/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bobooking.inc.php      2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/inc/class.bobooking.inc.php      2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -101,4 +101,9 @@
 
                        return $values;
                }
+
+               public function update_bookings( $ids, $action )
+               {
+                       return 
eventplanner_sobooking::get_instance()->update_bookings($ids, $action);
+               }
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.sobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.sobooking.inc.php      2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/inc/class.sobooking.inc.php      2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -113,4 +113,29 @@
                        return  $this->db->transaction_commit();
                }
 
+               public function update_bookings($ids, $action )
+               {
+                       if(!$ids || !is_array($ids))
+                       {
+                               return;
+                       }
+
+                       switch ($action)
+                       {
+                               case 'disable':
+                                       $sql = "UPDATE eventplanner_booking SET 
active = 0";
+
+                                       break;
+                               case 'enable':
+                                       $sql = "UPDATE eventplanner_booking SET 
active = 1";
+                                       break;
+
+                               default:
+                                       throw new Exception("action {$action} 
not supported");
+                                       break;
+                       }
+
+                       $sql .= 'WHERE id IN(' . implode(',', $ids) . ')';
+                       return $this->db->query($sql,__LINE__,__FILE__);
+               }
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uiapplication.inc.php  2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/inc/class.uiapplication.inc.php  2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -237,14 +237,12 @@
                        $tabs['calendar'] = array(
                                'label' => lang('calendar'),
                                'link' => '#calendar',
-                               'function' => "set_tab('calendar')"
+                               'function' => "set_tab('calendar')",
+                               'disable'       => $id ? false : true
                        );
 
                        $bocommon = CreateObject('property.bocommon');
 
-                       $GLOBALS['phpgw']->jqcal->add_listener('date_start');
-                       $GLOBALS['phpgw']->jqcal->add_listener('date_end');
-
                        $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, '.application', 
'eventplanner');
                        $case_officer_options[] = array('id' => '', 'name' => 
lang('select'), 'selected' => 0);
                        foreach ($accounts as $account)
@@ -340,8 +338,13 @@
                                        array('disablePagination' => true)
                                )
                        );
-                       $GLOBALS['phpgw']->jqcal2->add_listener('from_', 
'datetime');
-                       $GLOBALS['phpgw']->jqcal2->add_listener('to_', 
'datetime');
+                       $GLOBALS['phpgw']->jqcal->add_listener('date_start');
+                       $GLOBALS['phpgw']->jqcal->add_listener('date_end');
+                       $GLOBALS['phpgw']->jqcal2->add_listener('from_', 
'datetime', '', array(
+                                       'min_date' => date('Y/m/d', 
$application->date_start),
+                                       'max_date' => date('Y/m/d', 
$application->date_end)
+                               )
+                       );
 
                        $application_type_list = 
execMethod('eventplanner.bogeneric.get_list', array('type' => 
'application_type'));
                        $types = (array)$application->types;
@@ -376,6 +379,7 @@
                                'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uiapplication.save')),
                                'cancel_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uiapplication.index',)),
                                'application' => $application,
+                               'new_vendor_url' => 
self::link(array('menuaction' => 'eventplanner.uivendor.add')),
                                'list_case_officer' => array('options' => 
$case_officer_options),
                                'cat_select' => 
$this->cats->formatted_xslt_list(array(
                                        'select_name' => 'category_id',

Modified: trunk/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uibooking.inc.php      2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/inc/class.uibooking.inc.php      2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -1,5 +1,5 @@
 <?php
-/**
+       /**
         * phpGroupWare - eventplanner: a part of a Facilities Management 
System.
         *
         * @author Sigurd Nes <address@hidden>
@@ -41,9 +41,9 @@
                        'view' => true,
                        'edit' => true,
                        'save' => true,
-                       'save_ajax'     => true
+                       'save_ajax' => true,
+                       'update' => true
                );
-
                protected
                        $fields,
                        $permissions;
@@ -58,7 +58,6 @@
                        $this->permissions = 
eventplanner_booking::get_instance()->get_permission_array();
                }
 
-
                public function index()
                {
                        if (empty($this->permissions[PHPGW_ACL_READ]))
@@ -93,8 +92,8 @@
                                                                'type' => 
'checkbox',
                                                                'name' => 
'filter_active',
                                                                'text' => 
lang('showall'),
-                                                               'value' =>  1,
-                                                               'checked'=> 1,
+                                                               'value' => 1,
+                                                               'checked' => 1,
                                                        )
                                                )
                                        )
@@ -147,7 +146,6 @@
 
                        self::render_template_xsl('datatable_jquery', $data);
                }
-
                /*
                 * Edit the price item with the id given in the http variable 
'id'
                 */
@@ -183,7 +181,7 @@
                        $comments = (array)$booking->comments;
                        foreach ($comments as $key => &$comment)
                        {
-                               $comment['value_count'] = $key +1;
+                               $comment['value_count'] = $key + 1;
                                $comment['value_date'] = 
$GLOBALS['phpgw']->common->show_date($comment['time']);
                        }
 
@@ -193,7 +191,7 @@
                                array('key' => 'author', 'label' => 
lang('User'), 'sortable' => false, 'resizeable' => true),
                                array('key' => 'comment', 'label' => 
lang('Note'), 'sortable' => false, 'resizeable' => true)
                        );
- 
+
                        $datatable_def[] = array(
                                'container' => 'datatable-container_0',
                                'requestUrl' => "''",
@@ -218,13 +216,38 @@
                        self::add_javascript('eventplanner', 'portico', 
'booking.edit.js');
                        self::render_template_xsl(array('booking', 
'datatable_inline'), array($mode => $data));
                }
-               
+
                public function save()
                {
                        parent::save();
                }
+
                public function save_ajax()
                {
                        return parent::save(true);
                }
+
+               public function update()
+               {
+                       $ids = phpgw::get_var('ids', 'int');
+                       $action = phpgw::get_var('action', 'string');
+
+                       if ($this->bo->update_bookings($ids, $action))
+                       {
+                               return array(
+                                       'status_kode' => 'ok',
+                                       'status' => lang('ok'),
+                                       'msg' => lang('messages_saved_form')
+                               );
+                       }
+                       else
+                       {
+                               return array
+                               (
+                                       'status_kode' => 'error',
+                                       'status' => lang('error'),
+                                       'msg' => lang('messages_form_error')
+                               );
+                       }
+               }
        }
\ No newline at end of file

Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js   2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/js/portico/application.edit.js   2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -3,15 +3,15 @@
 var strURL = phpGWLink('index.php', oArgs, true);
 JqueryPortico.autocompleteHelper(strURL, 'vendor_name', 'vendor_id', 
'vendor_container', 'name');
 
-validate_submit = function()
+validate_submit = function ()
 {
        var active_tab = $("#active_tab").val();
        conf = {
-       //      modules: 'date, security, file',
+               //      modules: 'date, security, file',
                validateOnBlur: false,
                scrollToTopOnError: true,
                errorMessagePosition: 'top'
-       //      language: validateLanguage
+                       //      language: validateLanguage
        };
 
        var test = $('form').isValid(false, conf);
@@ -20,7 +20,7 @@
                return;
        }
 
-       if(active_tab === 'first_tab')
+       if (active_tab === 'first_tab')
        {
                $('#tab-content').responsiveTabs('activate', 1);
                $("#save_button").val(lang['save']);
@@ -139,7 +139,7 @@
 
 });
 
-check_button_names = function()
+check_button_names = function ()
 {
        var tab = $("#active_tab").val();
        if (tab === 'calendar')
@@ -147,7 +147,7 @@
                $("#floating-box").hide();
                $("#submit_group_bottom").hide();
        }
-       else if(tab === 'first_tab')
+       else if (tab === 'first_tab')
        {
                $("#save_button").val(lang['next']);
                $("#save_button_bottom").val(lang['next']);
@@ -197,8 +197,14 @@
        $("#stage_size").val(total_size);
 }
 
-add_booking = function ()
+add_booking = function (id)
 {
+       var from_ = $("#from_").val();
+       if (!from_)
+       {
+               return;
+       }
+
        oArgs = {
                menuaction: 'eventplanner.uibooking.save_ajax',
                application_id: $("#application_id").val()
@@ -211,7 +217,7 @@
        $.ajax({
                type: 'POST',
                dataType: 'json',
-               data: {from_: $("#from_").val(), active: 1},
+               data: {from_: from_, active: 1, id:id || ''},
                url: requestUrl,
                success: function (data)
                {
@@ -241,6 +247,7 @@
        if (action === 'add')
        {
                add_booking();
+               return;
        }
 
        var api = $('#datatable-container_1').dataTable().api();
@@ -258,19 +265,28 @@
        {
                var aData = selected[n];
                ids.push(aData['id']);
+
+               if (action === 'edit')
+               {
+                       add_booking(aData['id']);
+                       return;
+               }
+
        }
 
        if (ids.length > 0)
        {
-               var data = {"ids": ids, "action": action, from_: 
$("#from_").val(), to_: $("#to_").val()};
+               var data = {"ids": ids, "action": action, from_: 
$("#from_").val()};
 
                oArgs = {
-                       menuaction: 'eventplanner.uibooking.update',
-                       application_id: $("#application_id").val()
+                       menuaction: 'eventplanner.uibooking.update'
                };
 
                var requestUrl = phpGWLink('index.php', oArgs, true);
 
+               var htmlString = '';
+               $("#receipt").html("");
+
                $.ajax({
                        type: 'POST',
                        dataType: 'json',
@@ -283,7 +299,6 @@
                                        if (data.status_kode == 'ok')
                                        {
                                                $("#from_").val('');
-                                               $("#to_").val('');
                                                htmlString += "<div 
class=\"msg_good\">";
                                        }
                                        else
@@ -297,6 +312,6 @@
                        }
                });
 
-               JqueryPortico.updateinlineTableHelper('datatable-container_4');
+               JqueryPortico.updateinlineTableHelper('datatable-container_1');
        }
 };

Modified: trunk/eventplanner/setup/phpgw_no.lang
===================================================================
--- trunk/eventplanner/setup/phpgw_no.lang      2016-12-02 01:01:06 UTC (rev 
16038)
+++ trunk/eventplanner/setup/phpgw_no.lang      2016-12-02 15:40:30 UTC (rev 
16039)
@@ -64,4 +64,7 @@
 raider eventplanner    no      Raider
 vendor report  eventplanner    no      Utøverrapport
 calendar       eventplanner    no      Kalender
-from   eventplanner    no      Fra
\ No newline at end of file
+from   eventplanner    no      Fra
+select all     eventplanner    no      Velg alle
+enable eventplanner    no      Aktiver
+disable        eventplanner    no      Deaktiver
\ No newline at end of file

Modified: trunk/eventplanner/setup/setup.inc.php
===================================================================
--- trunk/eventplanner/setup/setup.inc.php      2016-12-02 01:01:06 UTC (rev 
16038)
+++ trunk/eventplanner/setup/setup.inc.php      2016-12-02 15:40:30 UTC (rev 
16039)
@@ -11,7 +11,7 @@
         * @version $Id: setup.inc.php 14728 2016-02-11 22:28:46Z sigurdne $
         */
        $setup_info['eventplanner']['name'] = 'eventplanner';
-       $setup_info['eventplanner']['version'] = '0.9.18.001';
+       $setup_info['eventplanner']['version'] = '0.9.18.002';
        $setup_info['eventplanner']['app_order'] = 20;
        $setup_info['eventplanner']['enable'] = 1;
        $setup_info['eventplanner']['app_group'] = 'office';
@@ -58,6 +58,7 @@
                'eventplanner_resource',
                'eventplanner_resource_comment',
                'eventplanner_booking',
+               'eventplanner_booking_comment',
                'eventplanner_booking_cost',
                'eventplanner_booking_resource',
                'eventplanner_order',

Modified: trunk/eventplanner/setup/tables_current.inc.php
===================================================================
--- trunk/eventplanner/setup/tables_current.inc.php     2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/setup/tables_current.inc.php     2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -282,6 +282,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'eventplanner_booking_comment' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'booking_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                               'time' => array('type' => 'int', 'precision' => 
'8', 'nullable' => False),
+                               'author' => array('type' => 'text', 'nullable' 
=> False),
+                               'comment' => array('type' => 'text', 'nullable' 
=> False),
+                               'type' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => false,'default' => 'comment'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'eventplanner_booking' => array('booking_id' => 
'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'eventplanner_booking_cost' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
False),

Modified: trunk/eventplanner/setup/tables_update.inc.php
===================================================================
--- trunk/eventplanner/setup/tables_update.inc.php      2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/setup/tables_update.inc.php      2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -25,3 +25,34 @@
                }
                return $GLOBALS['setup_info']['eventplanner']['currentver'];
        }
+
+       $test[] = '0.9.18.002';
+
+       function eventplanner_upgrade0_9_18_002()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'eventplanner_booking_comment', array(
+                                       'fd' => array(
+                                               'id' => array('type' => 'auto', 
'nullable' => False),
+                                               'booking_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => False),
+                                               'time' => array('type' => 
'int', 'precision' => '8', 'nullable' => False),
+                                               'author' => array('type' => 
'text', 'nullable' => False),
+                                               'comment' => array('type' => 
'text', 'nullable' => False),
+                                               'type' => array('type' => 
'varchar', 'precision' => '20', 'nullable' => false,'default' => 'comment'),
+                                       ),
+                                       'pk' => array('id'),
+                                       'fk' => array(
+                                               'eventplanner_booking' => 
array('booking_id' => 'id')),
+                                       'ix' => array(),
+                                       'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['eventplanner']['currentver'] = 
'0.9.18.003';
+               }
+               return $GLOBALS['setup_info']['eventplanner']['currentver'];
+       }

Modified: trunk/eventplanner/templates/base/application.xsl
===================================================================
--- trunk/eventplanner/templates/base/application.xsl   2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/templates/base/application.xsl   2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -116,7 +116,14 @@
                                                                        
<xsl:attribute name="placeholder">
                                                                                
<xsl:value-of select="$lang_vendor"/>
                                                                        
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
                                                                </input>
+                                                               <xsl:text> 
</xsl:text>
+                                                               <a 
href="{new_vendor_url}" target="_blank">
+                                                                       
<xsl:value-of select="php:function('lang', 'new')"/>
+                                                               </a>
                                                                <div 
id="vendor_container"/>
                                                        </div>
                                                        <div 
class="pure-control-group">

Modified: trunk/eventplanner/templates/base/vendor.xsl
===================================================================
--- trunk/eventplanner/templates/base/vendor.xsl        2016-12-02 01:01:06 UTC 
(rev 16038)
+++ trunk/eventplanner/templates/base/vendor.xsl        2016-12-02 15:40:30 UTC 
(rev 16039)
@@ -167,7 +167,7 @@
                                                                        
<xsl:text>email</xsl:text>
                                                                </xsl:attribute>
                                                                <xsl:attribute 
name="placeholder">
-                                                               <xsl:value-of 
select="php:function('lang', 'email')"/>
+                                                                       
<xsl:value-of select="php:function('lang', 'email')"/>
                                                                </xsl:attribute>
                                                        </input>
                                                </div>
@@ -210,6 +210,9 @@
                                                                <xsl:value-of 
select="php:function('lang', 'remark')"/>
                                                        </label>
                                                        <textarea cols="47" 
rows="7" name="remark">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
                                                                <xsl:value-of 
select="vendor/remark"/>
                                                        </textarea>
                                                </div>

Modified: trunk/phpgwapi/inc/class.jqcal2.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.jqcal2.inc.php     2016-12-02 01:01:06 UTC (rev 
16038)
+++ trunk/phpgwapi/inc/class.jqcal2.inc.php     2016-12-02 15:40:30 UTC (rev 
16039)
@@ -43,7 +43,7 @@
 
                }
 
-               function add_listener($name, $type = 'date', $value = '')
+               function add_listener($name, $type = 'date', $value = '', 
$config = array())
                {
                        switch($type)
                        {
@@ -60,7 +60,7 @@
                                        $dateformat = "{$this->dateformat}";
                        }
 
-                       $this->_input_modern($name, $_type, $dateformat);
+                       $this->_input_modern($name, $_type, $dateformat, 
$config);
                        return "<input id='{$name}' type='text' 
value='{$value}' size='10' name='{$name}'/>";
                }
 
@@ -70,12 +70,28 @@
                * @access private
                * @param string $name the element ID
                */
-               function _input_modern($id, $type, $dateformat)
+               function _input_modern($id, $type, $dateformat, $config = 
array())
                {
                        $datepicker = $type == 'time' ? 0 : 1;
                        $timepicker = $type == 'date' ? 0 : 1;
                        $placeholder = str_ireplace(array('Y','m', 'd', 'H', 
'i'), array('YYYY', 'MM', 'DD', 'HH', 'mm' ),$dateformat);
 
+
+                       if(empty($config['min_date']))
+                       {
+                               $min_date = 0;
+                       }
+                       else
+                       {
+                               $min_date = "'{$config['min_date']}'";
+                       }
+
+                       if(!empty($config['max_date']))
+                       {
+                               $min_date .= ",maxDate:'{$config['max_date']}'";
+                       }
+
+
                        $js = <<<JS
                        $(document).ready(function()
                        {
@@ -91,12 +107,10 @@
                                        step: 15,
                                        weeks: true,
                                        dayOfWeekStart:1,
-               //                      mask:true,
-                                       minDate:0
+//                                     mask:true,
+                                       startDate: new Date,
+                                       minDate:{$min_date}
                                });
-//jQuery('#image_button').click(function(){
-//  jQuery('#datetimepicker4').datetimepicker('show'); //support hide,show and 
destroy command
-//});
                        });
 JS;
                        $GLOBALS['phpgw']->js->add_code('', $js);




reply via email to

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