fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17175] booking: prepare for non-cookie


From: sigurdne
Subject: [Fmsystem-commits] [17175] booking: prepare for non-cookie
Date: Fri, 20 Oct 2017 09:37:31 -0400 (EDT)

Revision: 17175
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17175
Author:   sigurdne
Date:     2017-10-20 09:37:30 -0400 (Fri, 20 Oct 2017)
Log Message:
-----------
booking: prepare for non-cookie

Modified Paths:
--------------
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/inc/class.uibooking.inc.php
    trunk/booking/templates/base/application.xsl
    trunk/booking/templates/base/booking.xsl
    trunk/booking/templates/base/report_freetime.xsl
    trunk/bookingfrontend/inc/class.uibooking.inc.php
    trunk/bookingfrontend/js/bookingfrontend/application.js
    trunk/bookingfrontend/templates/base/application.xsl
    trunk/bookingfrontend/templates/base/booking.xsl
    trunk/bookingfrontend/templates/base/booking_info.xsl
    trunk/bookingfrontend/templates/base/building.xsl
    trunk/bookingfrontend/templates/base/resource.xsl

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/booking/inc/class.uiallocation.inc.php        2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -289,6 +289,26 @@
                        {
                                $season = 
$this->season_bo->read_single(phpgw::get_var('season_id', 'int'));
                                array_set_default($_POST, 'resources', array());
+
+                               if(empty($_POST['organization_id']))
+                               {
+                                       $application_id = 
phpgw::get_var('application_id', 'int', 'POST');
+                                       if($application_id)
+                                       {
+                                               $application = 
createObject('booking.boapplication')->read_single($application_id);
+                                               if($organization_number = 
$application['customer_organization_number'])
+                                               {
+                                                       $organizations = 
createObject('booking.soorganization')->read(array('filters' => 
array('organization_number' => $organization_number,
+                                                               'active' => 
1)));
+
+                                                       
$_POST['organization_id'] = $organizations['results'][0]['id'];
+                                                       
$_POST['organization_name'] = $organizations['results'][0]['name'];
+                                               }
+                                       }
+
+                               }
+
+
                                $allocation = extract_values($_POST, 
$this->fields);
                                if ($_POST['cost'])
                                {

Modified: trunk/booking/inc/class.uibooking.inc.php
===================================================================
--- trunk/booking/inc/class.uibooking.inc.php   2017-10-20 09:20:08 UTC (rev 
17174)
+++ trunk/booking/inc/class.uibooking.inc.php   2017-10-20 13:37:30 UTC (rev 
17175)
@@ -393,6 +393,18 @@
                                $season = 
$this->season_bo->read_single(phpgw::get_var('season_id','int', 'POST'));
                                $booking['organization_id'] = 
phpgw::get_var('organization_id','int', 'POST');
                                $booking['organization_name'] = 
phpgw::get_var('organization_name','string', 'POST');
+                               if($application_id && 
empty($booking['organization_id']))
+                               {
+                                       $application = 
createObject('booking.boapplication')->read_single($application_id);
+                                       if($organization_number = 
$application['customer_organization_number'])
+                                       {
+                                               $organizations = 
createObject('booking.soorganization')->read(array('filters' => 
array('organization_number' => $organization_number,
+                                                       'active' => 1)));
+
+                                               $_POST['organization_id'] = 
$organizations['results'][0]['id'];
+                                               $_POST['organization_name'] = 
$organizations['results'][0]['name'];
+                                       }
+                               }
                                $noallocation = True;
                        }
                        if ($_SERVER['REQUEST_METHOD'] == 'POST')

Modified: trunk/booking/templates/base/application.xsl
===================================================================
--- trunk/booking/templates/base/application.xsl        2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/booking/templates/base/application.xsl        2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -296,10 +296,13 @@
                                                                                
allocationParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="allocation_params"/>;
                                                                                
bookingParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="booking_params"/>;
                                                                                
eventParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="event_params"/>;
+                                                                               
var allocationaddURL = phpGWLink('index.php', 
{menuaction:'booking.uiallocation.add'});
+                                                                               
var bookingaddURL = phpGWLink('index.php', 
{menuaction:'booking.uibooking.add'});
+                                                                               
var eventaddURL = phpGWLink('index.php', {menuaction:'booking.uievent.add'});
                                                                        
</script>
                                                                        <div 
class="pure-control-group">
                                                                                
<label>&nbsp;</label>
-                                                                               
<select name="create" onchange="if(this.selectedIndex==1) 
JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uiallocation.add',
 allocationParams[{id}]); if(this.selectedIndex==2) 
JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uibooking.add', 
eventParams[{id}]); if(this.selectedIndex==3) 
JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uievent.add', 
eventParams[{id}]);">
+                                                                               
<select name="create" onchange="if(this.selectedIndex==1) 
JqueryPortico.booking.postToUrl(allocationaddURL, allocationParams[{id}]); 
if(this.selectedIndex==2) JqueryPortico.booking.postToUrl(bookingaddURL, 
eventParams[{id}]); if(this.selectedIndex==3) 
JqueryPortico.booking.postToUrl(eventaddURL, eventParams[{id}]);">
                                                                                
        <xsl:if test="not(../case_officer/is_current_user)">
                                                                                
                <xsl:attribute name="disabled">disabled</xsl:attribute>
                                                                                
        </xsl:if>

Modified: trunk/booking/templates/base/booking.xsl
===================================================================
--- trunk/booking/templates/base/booking.xsl    2017-10-20 09:20:08 UTC (rev 
17174)
+++ trunk/booking/templates/base/booking.xsl    2017-10-20 13:37:30 UTC (rev 
17175)
@@ -84,8 +84,8 @@
                var resourceIds = '<xsl:value-of 
select="booking/resource_ids"/>';
                var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'Resource Type')"/>;
     <![CDATA[
-            var resourcesURL = 
'index.php?menuaction=booking.uiresource.index&sort=name&phpgw_return_as=json&' 
+ resourceIds;
-        ]]>
+            var resourcesURL = phpGWLink('index.php', {menuaction: 
'booking.uiresource.index', sort:'name'}, true) + '&' + resourceIds;
+       ]]>
                var colDefsResources = [{key: 'name', label: lang['Name'], 
formatter: genericLink}, {key: 'type', label: lang['Resource Type']}];
                
createTable('resources_container',resourcesURL,colDefsResources);
        </script>

Modified: trunk/booking/templates/base/report_freetime.xsl
===================================================================
--- trunk/booking/templates/base/report_freetime.xsl    2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/booking/templates/base/report_freetime.xsl    2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -161,8 +161,9 @@
                                                                                
<td>
                                                                                
        <script type="text/javascript">
                                                                                
                eventParams[<xsl:value-of select="counter"/>] = <xsl:value-of 
select="event_params"/>;
+                                                                               
                var eventaddURL = phpGWLink('index.php', 
{menuaction:'menuaction=booking.uievent.add'});
                                                                                
        </script>
-                                                                               
        <a href="#" 
onclick="JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uievent.add',
 eventParams[{counter}]);">Lag arrangement</a>
+                                                                               
        <a href="#" onclick="JqueryPortico.booking.postToUrl(eventaddURL, 
eventParams[{counter}]);">Lag arrangement</a>
                                                                                
</td>
                                                                        </tr>
                                                                </xsl:for-each>

Modified: trunk/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uibooking.inc.php   2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/bookingfrontend/inc/class.uibooking.inc.php   2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -1182,7 +1182,7 @@
                        }
                        $booking['resource_info'] = join(', ', $res_names);
                        $booking['building_link'] = 
self::link(array('menuaction' => 'bookingfrontend.uibuilding.show',
-                                       'id' => 
$booking['resources'][0]['building_id']));
+                                       'id' => $booking['building_id']));
                        $booking['org_link'] = self::link(array('menuaction' => 
'bookingfrontend.uiorganization.show',
                                        'id' => 
$booking['group']['organization_id']));
                        $booking['group_link'] = self::link(array('menuaction' 
=> 'bookingfrontend.uigroup.show',

Modified: trunk/bookingfrontend/js/bookingfrontend/application.js
===================================================================
--- trunk/bookingfrontend/js/bookingfrontend/application.js     2017-10-20 
09:20:08 UTC (rev 17174)
+++ trunk/bookingfrontend/js/bookingfrontend/application.js     2017-10-20 
13:37:30 UTC (rev 17175)
@@ -291,8 +291,7 @@
 
 function populateTableChkRegulations(building_id, selection, resources)
 {
-       var url = 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=building::'
 + building_id;
-//    var url = phpGWLink('bookingfrontend/', {menuaction: 
'booking.uidocument_view.regulations', sort: 'name', 'owner[]': 
'building::'+building_id}, true);
+    var url = phpGWLink('bookingfrontend/', {menuaction: 
'booking.uidocument_view.regulations', sort: 'name'}, true) + 
'&owner[]=building::' + building_id;
        for (var r in resources)
        {
                url += '&owner[]=resource::' + resources[r];

Modified: trunk/bookingfrontend/templates/base/application.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/application.xsl        2017-10-20 
09:20:08 UTC (rev 17174)
+++ trunk/bookingfrontend/templates/base/application.xsl        2017-10-20 
13:37:30 UTC (rev 17175)
@@ -250,8 +250,11 @@
                                                                
allocationParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="allocation_params"/>;
                                                                
bookingParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="booking_params"/>;
                                                                
eventParams[<xsl:value-of select="id"/>] = <xsl:value-of 
select="event_params"/>;
+                                                               var 
allocationaddURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'booking.uiallocation.add'});
+                                                               var 
bookingaddURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'booking.uibooking.add'});
+                                                               var eventaddURL 
= phpGWLink('bookingfrontend/index.php', {menuaction:'booking.uievent.add'});
                                                        </script>
-                                                       <select name="create" 
onchange="if(this.selectedIndex==1) 
JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uiallocation.add',
 allocationParams[{id}]); if(this.selectedIndex==2) 
JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uibooking.add', 
eventParams[{id}]); if(this.selectedIndex==3) 
JqueryPortico.booking.postToUrl('index.php?menuaction=booking.uievent.add', 
eventParams[{id}]);">
+                                                       <select name="create" 
onchange="if(this.selectedIndex==1) 
JqueryPortico.booking.postToUrl(allocationaddURL, allocationParams[{id}]); 
if(this.selectedIndex==2) JqueryPortico.booking.postToUrl(bookingaddURL, 
eventParams[{id}]); if(this.selectedIndex==3) 
JqueryPortico.booking.postToUrl(eventaddURL, eventParams[{id}]);">
                                                                <xsl:if 
test="not(../case_officer/is_current_user)">
                                                                        
<xsl:attribute name="disabled">disabled</xsl:attribute>
                                                                </xsl:if>
@@ -518,12 +521,11 @@
                var resources = <xsl:value-of select="application/resources" />;
 
         <![CDATA[
-            var resourcesURL = 
'index.php?menuaction=bookingfrontend.uiresource.index_json&sort=name&phpgw_return_as=json&'
 + resourceIds;
-            var applicationURL = 
'index.php?menuaction=bookingfrontend.uiapplication.associated&phpgw_return_as=json&filter_application_id='
 + app_id;
-            var documentURL = 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=building::'
 + building_id;
-                documentURL += 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=resource::'+
 resources;
-                       var attachmentsResourceURL = 
'index.php?menuaction=bookingfrontend.uidocument_application.index&sort=name&no_images=1&filter_owner_id='
 + app_id + '&phpgw_return_as=json&';
-
+            var resourcesURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uiresource.index_json', sort:'name'}, true) +'&' + 
resourceIds;
+            var applicationURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uiapplication.associated', 
filter_application_id:app_id}, true);
+            var documentURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'booking.uidocument_view.regulations', sort:'name'}, true) + 
'&owner[]=building::' + building_id;
+                documentURL += '&owner[]=resource::'+ resources;
+                       var attachmentsResourceURL = 
phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uidocument_application.index', sort:'name', 
no_images:1, filter_owner_id:app_id}, true);
         ]]>
 
                if (resourceIds) {

Modified: trunk/bookingfrontend/templates/base/booking.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/booking.xsl    2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/bookingfrontend/templates/base/booking.xsl    2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -71,9 +71,8 @@
        <script type="text/javascript">
                var resourcesIds = '<xsl:value-of select="booking/resource_ids" 
/>';
                var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'Resource Type')" />;
-        
         <![CDATA[
-            var resourceURL = 
'index.php?menuaction=bookingfrontend.uiresource.index_json&sort=name&phpgw_return_as=json&'
 + resourcesIds;
+            var resourceURL = phpGWLink('bookingfrontend/index.php', 
{menuaction: 'bookingfrontend.uiresource.index_json', sort:'name'}, true) + '&' 
+ resourcesIds;
         ]]>
                var colDefsResources = [{key: 'name', label: lang['Name'], 
formatter: genericLink}, {key: 'type', label: lang['Resource Type']}];
                createTable('resources_container', resourceURL, 
colDefsResources, 'results');

Modified: trunk/bookingfrontend/templates/base/booking_info.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/booking_info.xsl       2017-10-20 
09:20:08 UTC (rev 17174)
+++ trunk/bookingfrontend/templates/base/booking_info.xsl       2017-10-20 
13:37:30 UTC (rev 17175)
@@ -14,7 +14,7 @@
                </dt>
                <dd>
                        <a href="{booking/building_link}">
-                               <xsl:value-of 
select="booking/resources[position()=1]/building_name"/>
+                               <xsl:value-of select="booking/building_name"/>
                        </a>
                        (<xsl:value-of select="booking/resource_info"/>)
                </dd>

Modified: trunk/bookingfrontend/templates/base/building.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/building.xsl   2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/bookingfrontend/templates/base/building.xsl   2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -140,10 +140,10 @@
                                var lang = <xsl:value-of 
select="php:function('js_lang', 'Name', 'Category', 'Activity', 'Resource 
Type')"/>;
                                var address = '<xsl:value-of select="street"/>, 
<xsl:value-of select="zip_code"/>, <xsl:value-of select="city"/>';
                                <![CDATA[
-                var resourcesURL = 
'index.php?menuaction=bookingfrontend.uiresource.index_json&sort=name&filter_building_id='
 + building_id + '&phpgw_return_as=json&';
-                var documentURL = 
'index.php?menuaction=bookingfrontend.uidocument_building.index&sort=name&no_images=1&filter_owner_id='
 + building_id + '&phpgw_return_as=json&';
-                var building_usersURL = 
'index.php?menuaction=bookingfrontend.uiorganization.building_users&sort=name&building_id='
 + building_id + '&phpgw_return_as=json&';
-                var document_buildingURL = 
'index.php?menuaction=bookingfrontend.uidocument_building.index_images&sort=name&filter_owner_id='
 + building_id + '&phpgw_return_as=json&';
+                var resourcesURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uiresource.index_json',sort:'name', 
filter_building_id:building_id}, true);
+                var documentURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uidocument_building.index', sort:'name', 
no_images:1, filter_owner_id:building_id}, true);
+                var building_usersURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uiorganization.building_users', sort:'name', 
building_id:building_id}, true);
+                var document_buildingURL = 
phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uidocument_building.index_images', sort:'name', 
filter_owner_id:building_id}, true);
                                var iurl = 
'https://maps.google.com/maps?f=q&source=s_q&hl=no&output=embed&geocode=&q=' + 
address;
                                var linkurl = 
'https://maps.google.com/maps?f=q&source=s_q&hl=no&geocode=&q=' + address;
                 ]]>

Modified: trunk/bookingfrontend/templates/base/resource.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/resource.xsl   2017-10-20 09:20:08 UTC 
(rev 17174)
+++ trunk/bookingfrontend/templates/base/resource.xsl   2017-10-20 13:37:30 UTC 
(rev 17175)
@@ -86,8 +86,8 @@
                var address = '<xsl:value-of 
select="resource/building/street"/>, <xsl:value-of 
select="resource/building/zip_code"/>, <xsl:value-of 
select="resource/building/city"/>';
 
         <![CDATA[
-        var documentsResourceURL = 
'index.php?menuaction=bookingfrontend.uidocument_resource.index&sort=name&no_images=1&filter_owner_id='
 + resource_id + '&phpgw_return_as=json&';
-        var documentsResourceImagesURL = 
'index.php?menuaction=bookingfrontend.uidocument_resource.index_images&sort=name&filter_owner_id='
 + resource_id + '&phpgw_return_as=json&';
+        var documentsResourceURL = phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uidocument_resource.index', sort:'name', 
no_images:1, filter_owner_id:resource_id}, true);
+        var documentsResourceImagesURL = 
phpGWLink('bookingfrontend/index.php', 
{menuaction:'bookingfrontend.uidocument_resource.index_images', sort:'name', 
filter_owner_id:resource_id}, true);
         var iurl = 
'https://maps.google.com/maps?f=q&source=s_q&hl=no&output=embed&geocode=&q=' + 
address;
         var linkurl = 
'https://maps.google.com/maps?f=q&source=s_q&hl=no&geocode=&q=' + address;
          ]]>




reply via email to

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