]> CRI, Mines Paris - PSL - Portfolio.git/commitdiff
Prise en compte du paramètre thumb_size au moment de la fabrication.
authorBenoît Pin <benoit.pin@gmail.com>
Mon, 31 Mar 2014 07:53:28 +0000 (09:53 +0200)
committerBenoît Pin <benoit.pin@gmail.com>
Mon, 31 Mar 2014 07:53:28 +0000 (09:53 +0200)
photo.py
skins/photo_layout_macros.pt
skins/portfolio_style.css.dtml

index c0c92c68a21db03b8fb9db72f95bd9fd5d18035f..7cb8974b255b0037f6d1cfcc473d156106c46ced 100755 (executable)
--- a/photo.py
+++ b/photo.py
@@ -29,7 +29,7 @@ from Products.CMFCore.DynamicType import DynamicType
 from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
 from Products.Photo.Photo import Photo as BasePhoto
 from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
 from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
 from Products.Photo.Photo import Photo as BasePhoto
 from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByName, getUtilityByInterfaceName
 from Products.Photo.cache import memoizedmethod
 from Products.DCWorkflow.utils import modifyRolesForPermission
 from interfaces import IPhoto
 from Products.Photo.cache import memoizedmethod
 from Products.DCWorkflow.utils import modifyRolesForPermission
 from interfaces import IPhoto
@@ -214,4 +214,14 @@ class Photo(DynamicType, CMFCatalogAware, BasePhoto, DefaultDublinCoreImpl) :
        
 InitializeClass(Photo)
 
        
 InitializeClass(Photo)
 
-PhotoFactory = Factory(Photo)
\ No newline at end of file
+class _PhotoFactory(Factory) :
+    def __call__(self, *args, **kw):
+        if not kw.has_key('thumb_height') or not kw.has_key('thumb_width') :
+            utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+            portal = utool.getPortalObject()
+            size = portal.getProperty('thumb_size')
+            kw.update({'thumb_height' : size, 'thumb_width' : size })
+        return self._callable(*args, **kw)
+    
+
+PhotoFactory = _PhotoFactory(Photo)
\ No newline at end of file
index 16571dd825e6af659a7af4a0f7723a84782485be..48b80401eda86a5fa3e4b1c8270b4d087ba009db 100644 (file)
     <div metal:define-macro="film_bar" tal:omit-tag="">
       <div id="film_bar">
         <table cellspacing="0">
     <div metal:define-macro="film_bar" tal:omit-tag="">
       <div id="film_bar">
         <table cellspacing="0">
-          <tr tal:define="slide_size python:portal_object.thumb_height/2 + 10">
+          <tr tal:define="slide_size python:portal_object.thumb_size/2 + 10">
             <td tal:repeat="info contextInfos/infos">
                 <a href="." tal:attributes="href info/href;
                                             class info/className;
             <td tal:repeat="info contextInfos/infos">
                 <a href="." tal:attributes="href info/href;
                                             class info/className;
           })();
           ''' % {'filmLength': len(contextInfos['infos'])
                 ,'center': index
           })();
           ''' % {'filmLength': len(contextInfos['infos'])
                 ,'center': index
-                ,'slideSize': portal_object.thumb_width/2 + 11
+                ,'slideSize': portal_object.thumb_size/2 + 11
                 ,'reBaseCtxUrl':contextInfos['reBaseCtxUrl']
                 ,'canonicalUrl':contextInfos['canonicalUrl']
                 }">
                 ,'reBaseCtxUrl':contextInfos['reBaseCtxUrl']
                 ,'canonicalUrl':contextInfos['canonicalUrl']
                 }">
index e2aadab3932cdfb1cf7ab694b3f620a356d9f9bd..f88048ec17222dffa9ebefd7a12684df06baddf7 100755 (executable)
@@ -129,7 +129,7 @@ table.metadata_category select:focus {
   background: &dtml-portfolio_slide_background;;
   color: &dtml-fontColor;;
   display:block;
   background: &dtml-portfolio_slide_background;;
   color: &dtml-fontColor;;
   display:block;
-  width: <dtml-var expr="thumb_width + 16">px;/*&dtml-slide_size;px;*/
+  width: <dtml-var expr="thumb_size + 16">px;/*&dtml-slide_size;px;*/
   height: 256px;
   display:block;
   text-align:center;
   height: 256px;
   display:block;
   text-align:center;
@@ -336,7 +336,7 @@ div.lightbox {
   overflow:hidden;
   position:relative;
   width:100%;
   overflow:hidden;
   position:relative;
   width:100%;
-  height: <dtml-var expr="thumb_height/2 + 12">px;;
+  height: <dtml-var expr="thumb_size/2 + 12">px;;
 }
 
 #film_bar table {
 }
 
 #film_bar table {
@@ -350,8 +350,8 @@ div.lightbox {
 }
 
 #film_bar a {
 }
 
 #film_bar a {
-  width: <dtml-var expr="thumb_width/2 + 10">px;;
-  height: <dtml-var expr="thumb_height/2 + 10">px;;
+  width: <dtml-var expr="thumb_size/2 + 10">px;;
+  height: <dtml-var expr="thumb_size/2 + 10">px;;
   display:block;
   text-align:center;
   vertical-align:middle;
   display:block;
   text-align:center;
   vertical-align:middle;