fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14337] added google map to building and resource


From: Sigurd Nes
Subject: [Fmsystem-commits] [14337] added google map to building and resource
Date: Thu, 12 Nov 2015 12:00:28 +0000

Revision: 14337
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14337
Author:   sigurdne
Date:     2015-11-12 12:00:26 +0000 (Thu, 12 Nov 2015)
Log Message:
-----------
added google map to building and resource

Modified Paths:
--------------
    branches/dev-syncromind/bookingfrontend/inc/class.uiresource.inc.php
    branches/dev-syncromind/bookingfrontend/templates/base/building.xsl
    branches/dev-syncromind/bookingfrontend/templates/base/resource.xsl
    branches/dev-syncromind/bookingfrontend/templates/base/search.xsl

Modified: branches/dev-syncromind/bookingfrontend/inc/class.uiresource.inc.php
===================================================================
--- branches/dev-syncromind/bookingfrontend/inc/class.uiresource.inc.php        
2015-11-12 00:24:01 UTC (rev 14336)
+++ branches/dev-syncromind/bookingfrontend/inc/class.uiresource.inc.php        
2015-11-12 12:00:26 UTC (rev 14337)
@@ -39,7 +39,8 @@
 
                public function show()
                {
-                       $resource = $this->bo->read_single(phpgw::get_var('id', 
'GET'));
+                       $resource = $this->bo->read_single(phpgw::get_var('id', 
'int', 'GET'));
+                       $resource['building'] = 
ExecMethod('booking.bobuilding.read_single', $resource['building_id']);
                        $resource['building_link']  = 
self::link(array('menuaction' => 'bookingfrontend.uibuilding.show', 'id' => 
$resource['building_id']));
                        $resource['buildings_link'] = 
self::link(array('menuaction' => 'bookingfrontend.uisearch.index', 'type' => 
'building'));
                        $resource['resources_link'] = 
self::link(array('menuaction' => 'bookingfrontend.uisearch.index', 'type' => 
'resource'));
@@ -53,7 +54,7 @@
 
                public function schedule()
                {
-            $resource = $this->bo->get_schedule(phpgw::get_var('id', 'GET'), 
'bookingfrontend.uibuilding', 'bookingfrontend.uiresource', 
'bookingfrontend.uisearch.index');
+            $resource = $this->bo->get_schedule(phpgw::get_var('id', 'int', 
'GET'), 'bookingfrontend.uibuilding', 'bookingfrontend.uiresource', 
'bookingfrontend.uisearch.index');
             $building = 
$this->building_bo->read_single($resource['building_id']);
             $resource['deactivate_application'] = 
$building['deactivate_application'];
             if ($building['deactivate_application'] == 0) {

Modified: branches/dev-syncromind/bookingfrontend/templates/base/building.xsl
===================================================================
--- branches/dev-syncromind/bookingfrontend/templates/base/building.xsl 
2015-11-12 00:24:01 UTC (rev 14336)
+++ branches/dev-syncromind/bookingfrontend/templates/base/building.xsl 
2015-11-12 12:00:26 UTC (rev 14337)
@@ -79,16 +79,27 @@
                     <dl class="proplist-col images">
                         <div id="images_container"></div>
                     </dl>
-                </div>
+                                       <dl class="proplist-col images">
+                                               <div 
id="images_container"></div>
+                                               <xsl:if test="street and 
normalize-space(street)">
+                                                       <iframe width="500" 
height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" 
id="googlemapiframe" src=""></iframe><br />
+                                                       <small><a href="" 
id="googlemaplink" style="color:#0000FF;text-align:left" target="_new">Vis 
større kart</a></small>
+                                               </xsl:if>
+                                       </dl>
+               </div>
             </div>
+
             <script type="text/javascript">
                 var building_id = <xsl:value-of select="id"/>;
                 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 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;
                 ]]>
                 
                 var rResources = 'results';
@@ -105,6 +116,17 @@
                 createTable('resources_container', resourcesURL, 
colDefsResources, rResources);
                 createTable('documents_container', documentURL, 
colDefsDocument);
                 createTable('building_users_container', building_usersURL, 
colDefsBuilding_users, rBuilding_users, '', paginatorTableBuilding_users);
+
+                               $(window).load(function(){
+                                       // Load image
+                                       
JqueryPortico.booking.inlineImages('images_container', document_buildingURL);
+
+                                       // Load Google map
+                                       if( iurl.length > 0 ) {
+                                               
$("#googlemapiframe").attr("src", iurl);
+                                               
$("#googlemaplink").attr("href", linkurl);
+                                       }
+                               });
 /*
                 <![CDATA[
 

Modified: branches/dev-syncromind/bookingfrontend/templates/base/resource.xsl
===================================================================
--- branches/dev-syncromind/bookingfrontend/templates/base/resource.xsl 
2015-11-12 00:24:01 UTC (rev 14336)
+++ branches/dev-syncromind/bookingfrontend/templates/base/resource.xsl 
2015-11-12 12:00:26 UTC (rev 14337)
@@ -42,22 +42,42 @@
                     <div id="images_container">
                     </div>
                 </dl>
-            </div>
+                                       <dl class="proplist-col images">
+                                               <div 
id="images_container"></div>
+                                                       <xsl:if 
test="resource/building/street and normalize-space(resource/building/street)">
+                                                               <iframe 
width="500" height="300" frameborder="0" scrolling="no" marginheight="0" 
marginwidth="0" id="googlemapiframe" src=""></iframe><br />
+                                                               <small><a 
href="" id="googlemaplink" style="color:#0000FF;text-align:left" 
target="_new">Vis større kart</a></small>
+                                                       </xsl:if>
+                                       </dl>
+           </div>
         </div>
        </div>
        <script type="text/javascript">
                var resource_id = <xsl:value-of select="resource/id"/>;
                var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'category', 'Activity')"/>;
+               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 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;
+         ]]>
 
         var colDefsDocumentsResource = [{key: 'name', label: lang['Name'], 
formatter: genericLink}];
 
         createTable('documents_container', documentsResourceURL, 
colDefsDocumentsResource);
-        JqueryPortico.booking.inlineImages('images_container', 
documentsResourceImagesURL);
+        $(window).load(function(){
+                       JqueryPortico.booking.inlineImages('images_container', 
documentsResourceImagesURL);
 
+                       // Load Google map
+                       if( iurl.length > 0 ) {
+                               $("#googlemapiframe").attr("src", iurl);
+                               $("#googlemaplink").attr("href", linkurl);
+                       }
+
+               });
+
     /*
     <![CDATA[
         YAHOO.util.Event.addListener(window, "load", function() {

Modified: branches/dev-syncromind/bookingfrontend/templates/base/search.xsl
===================================================================
--- branches/dev-syncromind/bookingfrontend/templates/base/search.xsl   
2015-11-12 00:24:01 UTC (rev 14336)
+++ branches/dev-syncromind/bookingfrontend/templates/base/search.xsl   
2015-11-12 12:00:26 UTC (rev 14337)
@@ -115,11 +115,11 @@
                                                     </xsl:otherwise>
                                                 </xsl:choose>
                                                 <div id="{img_container}"/>
-                                                <!--script 
type="text/javascript">
-                                                
YAHOO.util.Event.addListener(window, "load", function() {
+                                                <script type="text/javascript">
+                                                $(window).load(function() {
                                                     
JqueryPortico.booking.inlineImages('<xsl:value-of select="img_container"/>', 
'<xsl:value-of select="img_url"/>');
                                                 });
-                                                </script-->
+                                                </script>
                                             </dd>
                                             <xsl:if 
test="string-length(homepage) &gt; 1">
                                                 <dt><h4><xsl:value-of 
select="php:function('lang', 'Homepage')" /></h4></dt>




reply via email to

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