Changeset 426


Ignore:
Timestamp:
07/11/06 17:47:58 (13 years ago)
Author:
jukka
Message:

Fixed #367, spent 1h. There is a delete button now in page where coverimages are uploaded or changed. It works.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GroupBlog.py

    r418 r426  
    141141    def getCoverImageURL(self): 
    142142        """Returns the URL for the cover image.""" 
    143         if self.getField('coverImage').getSize(self)[0] > 0: 
     143        if self.getField('hasCoverImage').get(self)==True: 
    144144            return self.absolute_url()+'/coverImage' 
    145145        return 'default_group.png'  
     
    254254        cat.set(self, value, **kwargs) 
    255255 
     256    # These have to be duplicated since its difficult to base these folderish objects on non-folderish Resources  
     257 
     258 
    256259    def setCoverImage(self, value, **kwargs): 
    257         """ This modification for a mutator flags object to have a coverImage """ 
     260        """ Normal mutator, but flags object to have a coverImage (hasCoverImage = True) """ 
    258261        cover=self.getField('coverImage') 
    259262        cover.set(self,value,**kwargs) 
    260263        has_cover=self.getField('hasCoverImage') 
    261264        has_cover.set(self,True) 
     265        self.reindexObject() 
     266 
     267    def delCoverImage(self): 
     268        """ Reverse of setCoverImage """ 
     269        cover=self.getField('coverImage') 
     270        cover.set(self,None) 
     271        has_cover=self.getField('hasCoverImage') 
     272        has_cover.set(self,False) 
     273        self.reindexObject() 
    262274 
    263275registerType(GroupBlog, PROJECTNAME) 
  • trunk/Resources.py

    r415 r426  
    7575    def getCoverImageURL(self): 
    7676        """Returns the URL for the cover image.""" 
    77         if self.getField('coverImage').getSize(self)[0] > 0: 
     77        if self.getField('hasCoverImage').get(self)==True: 
    7878            return self.absolute_url()+'/coverImage' 
    7979        return 'default_%s.png' % self.meta_type.lower() 
    8080 
    8181    def setCoverImage(self, value, **kwargs): 
    82         """ This modification for a mutator flags object to have a coverImage """ 
     82        """ Normal mutator, but flags object to have a coverImage (hasCoverImage = True) """ 
    8383        cover=self.getField('coverImage') 
    8484        cover.set(self,value,**kwargs) 
     
    8686        has_cover.set(self,True) 
    8787        self.reindexObject() 
     88 
     89    def delCoverImage(self): 
     90        """ Reverse of setCoverImage """ 
     91        cover=self.getField('coverImage') 
     92        cover.set(self,None) 
     93        has_cover=self.getField('hasCoverImage') 
     94        has_cover.set(self,False) 
     95        self.reindexObject() 
     96 
    8897 
    8998    def getCollectionsFolder(self): 
  • trunk/skins/lemill/change_coverimage.cpt

    r364 r426  
    4747                         
    4848                        <div class="formControls"> 
     49                            <input tal:condition="context/getHasCoverImage" class="context" 
     50                            type="submit" 
     51                            name="form.button.Delete" 
     52                            value="Delete" 
     53                            i18n:attributes="value label_delete;" 
     54                            tal:attributes="tabindex tabindex/next" 
     55                            /> 
     56 
    4957                            <input class="context" 
    5058                            type="submit" 
  • trunk/skins/lemill/change_coverimage.cpt.metadata

    r364 r426  
    66action.success..Submit=traverse_to:string:script_changeCoverImage 
    77action.success..Cancel=redirect_to:string:view 
     8action.success..Delete=traverse_to:string:script_deleteCoverImage 
    89action.failure=redirect_to:python:object.absolute_url() 
  • trunk/skins/lemill/groupblog_view.pt

    r418 r426  
    1111    <div metal:fill-slot="main"> 
    1212    <metal:main-macro define-macro="main"> 
    13  
    14         <div metal:use-macro="here/document_actions/macros/document_actions"> 
    15             Document actions (print, sendto etc) 
    16         </div> 
    1713 
    1814        <h1 tal:content="object_title" class="documentFirstHeading"> 
  • trunk/skins/lemill/kb_view.pt

    r255 r426  
    77<metal:main fill-slot="main"> 
    88    <tal:main-macro metal:define-macro="main"> 
    9  
    10         <div metal:use-macro="here/document_actions/macros/document_actions"> 
    11             Document actions (print, sendto etc) 
    12         </div> 
    139 
    1410        <h1 tal:content="object_title" class="documentFirstHeading"> 
  • trunk/skins/lemill/portlet_material_actions.pt

    r375 r426  
    55<div metal:define-macro="portlet" id="portlet-material-actions"> 
    66 
    7 <div class="tb-portlet" metal:define-macro="image_div"> 
     7<div class="tb-portlet" metal:define-macro="image_div">     
    88    <img src="default.png" tal:attributes="src here/getCoverImageURL" height="120" width="160" style="padding: 10px 19px"/> 
    99    <!-- ul displayed for a group --> 
Note: See TracChangeset for help on using the changeset viewer.