fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9309] Documents added to resources under the categor


From: Alexander Stevenson
Subject: [Fmsystem-commits] [9309] Documents added to resources under the category frontpage image will be shown on the frontpage w /link instead of the standard image.
Date: Tue, 08 May 2012 09:09:45 +0000

Revision: 9309
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9309
Author:   andvare
Date:     2012-05-08 09:09:44 +0000 (Tue, 08 May 2012)
Log Message:
-----------
Documents added to resources under the category frontpage image will be shown 
on the frontpage w/link instead of the standard image.
The pictures are cropped into a 214x110 div.

Modified Paths:
--------------
    branches/dev-thomasez/booking/inc/class.sodocument.inc.php
    branches/dev-thomasez/booking/setup/phpgw_no.lang
    branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php
    branches/dev-thomasez/bookingfrontend/templates/base/search.xsl
    branches/dev-thomasez/phpgwapi/templates/bkbooking/css/frontend.css

Modified: branches/dev-thomasez/booking/inc/class.sodocument.inc.php
===================================================================
--- branches/dev-thomasez/booking/inc/class.sodocument.inc.php  2012-05-08 
08:19:47 UTC (rev 9308)
+++ branches/dev-thomasez/booking/inc/class.sodocument.inc.php  2012-05-08 
09:09:44 UTC (rev 9309)
@@ -8,6 +8,7 @@
                const CATEGORY_PICTURE = 'picture';
                const CATEGORY_DRAWING = 'drawing';
                const CATEGORY_REGULATION = 'regulation';
+               const CATEGORY_FRONTPAGE_PICTURE = 'frontpage_picture';
                const CATEGORY_OTHER = 'other';
                
                protected 
@@ -17,6 +18,7 @@
                           self::CATEGORY_PICTURE,
                           self::CATEGORY_DRAWING,
                                self::CATEGORY_REGULATION,
+                               self::CATEGORY_FRONTPAGE_PICTURE,
                           self::CATEGORY_OTHER,
                        ),
                        $uploadRootDir,

Modified: branches/dev-thomasez/booking/setup/phpgw_no.lang
===================================================================
--- branches/dev-thomasez/booking/setup/phpgw_no.lang   2012-05-08 08:19:47 UTC 
(rev 9308)
+++ branches/dev-thomasez/booking/setup/phpgw_no.lang   2012-05-08 09:09:44 UTC 
(rev 9309)
@@ -577,3 +577,4 @@
 Term   booking no      Ord/begrep
 Count  booking no      Antall
 Keywords       booking no      Nøkkelord
+Frontpage picture      booking no      Forsidebilde

Modified: branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php
===================================================================
--- branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php    
2012-05-08 08:19:47 UTC (rev 9308)
+++ branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php    
2012-05-08 09:09:44 UTC (rev 9309)
@@ -1,5 +1,6 @@
 <?php
        phpgw::import_class('booking.uicommon');
+       phpgw::import_class('booking.sodocument_resource');
 
        class bookingfrontend_uisearch extends booking_uicommon
        {
@@ -93,10 +94,30 @@
                                );
                        }
                        self::add_javascript('bookingfrontend', 
'bookingfrontend', 'search.js');
-      // Should of course be replaced with some config option for the image
-      // or using the tmpl_search_path. Need to work a little mor on this 
system
-      // to find the right option. - thomasez
-                       $params = is_null($search) ? array('frontimage' => 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/templates/{$GLOBALS['phpgw_info']['server']['template_set']}/images/nsf/forsidebilde.png",'layout'
 => $layout,'resource' => $resource) : array('search' => $search,'layout' => 
$layout,'resource' => $resource);
+
+                       // Images are now loaded from bb_document with category 
frontpage_picture
+                       if( !is_null( $search ) ) {
+                               $params = array('search' => $search,'layout' => 
$layout,'resource' => $resource);
+                       } else {
+
+
+                               $params = array(
+                                       'frontimage' => 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/templates/{$GLOBALS['phpgw_info']['server']['template_set']}/images/nsf/forsidebilde.png",
+                                       'layout' => $layout,
+                                       'resource' => $resource,
+                               );
+
+                               // Get frontpage picture documents
+                               $sodoc = 
CreateObject('booking.sodocument_resource');
+                               $documents = $sodoc->read( array( "filters" => 
array( "category" => booking_sodocument::CATEGORY_FRONTPAGE_PICTURE ) ) );
+
+                               // Insert into $params if there are pictures
+                               if( $documents['total_records'] > 0 ) {
+                                       // Convert nl2br on description
+                                       foreach( $documents['results'] as $key 
=> $data ) { $documents['results'][$key]['description'] = nl2br( 
$documents['results'][$key]['description'] ); }
+                                       $params['frontimages'] = 
$documents['results'];
+                               }
+                       }
 //                     echo "<pre>";print_r($resource);exit;
                        
                        self::render_template('search', $params);

Modified: branches/dev-thomasez/bookingfrontend/templates/base/search.xsl
===================================================================
--- branches/dev-thomasez/bookingfrontend/templates/base/search.xsl     
2012-05-08 08:19:47 UTC (rev 9308)
+++ branches/dev-thomasez/bookingfrontend/templates/base/search.xsl     
2012-05-08 09:09:44 UTC (rev 9309)
@@ -100,11 +100,33 @@
                </div>
                </div>
                <div style="text-align:center;">
-                       <img alt="" >
-                               <xsl:attribute name="src">
-                                       <xsl:value-of select="frontimage"/> 
-                               </xsl:attribute>
-                       </img>
+                       <xsl:choose>
+                               <xsl:when test="frontimages">
+                                       <div id="frontimagesbox">
+                                               <xsl:for-each 
select="frontimages">
+                                                       <a>
+                                                               <xsl:attribute 
name="href">index.php?menuaction=bookingfrontend.uiresource.show&amp;id=<xsl:value-of
 select="owner_id"/></xsl:attribute>
+                                                               <div 
class="frontimagebox">
+                                                                       <div 
class="frontimage">
+                                                                               
<xsl:attribute name="style">
+                                                                               
        background-image: url( 
'index.php?menuaction=bookingfrontend.uidocument_resource.download&amp;id=<xsl:value-of
 select="id"/>' );
+                                                                               
</xsl:attribute>
+                                                                       </div>
+                                                                       
<xsl:value-of disable-output-escaping="yes" select="description"/>
+                                                               </div>
+                                                       </a>
+                                               </xsl:for-each>
+                                               <div class="clr"></div>
+                                       </div>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <img alt="" >
+                                               <xsl:attribute name="src">
+                                                       <xsl:value-of 
select="frontimage"/> 
+                                               </xsl:attribute>
+                                       </img>
+                               </xsl:otherwise>
+                       </xsl:choose>
                </div>  
        </xsl:if>
        <xsl:variable name="layout"><xsl:value-of select="layout" 
/></xsl:variable>

Modified: branches/dev-thomasez/phpgwapi/templates/bkbooking/css/frontend.css
===================================================================
--- branches/dev-thomasez/phpgwapi/templates/bkbooking/css/frontend.css 
2012-05-08 08:19:47 UTC (rev 9308)
+++ branches/dev-thomasez/phpgwapi/templates/bkbooking/css/frontend.css 
2012-05-08 09:09:44 UTC (rev 9309)
@@ -390,4 +390,29 @@
     cursor: pointer!important;
 }
 
+div.frontimagebox {
+       width: 214px;
+       margin: 2px;
+       padding: 0px;
+       color: #888;
+       float: left;
+       clear: none;
+       font-size: 9pt;
+       text-align: left;
+}
 
+div.frontimagebox div.frontimage {
+       width: 214px;
+       height: 110px;
+       margin: 0px;
+       padding: 0px;
+       border: none;
+       display: block;
+       background-repeat: no-repeat;
+       background-position: center 30%;
+}
+
+div#frontimagesbox {
+       clear: both;
+       display: inline-block;
+}




reply via email to

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