Changeset 1379


Ignore:
Timestamp:
02/16/07 15:24:18 (13 years ago)
Author:
jukka
Message:

Fixed #1115 spent 1h more. Forgot to add the actual validator in last commit, piece mass uploader also fixd, but with irritating feature of not being able to go back and try a better name. (That page nees one more button.)

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LeMillTool.py

    r1373 r1379  
    160160    def savePiece(self, uid, values): 
    161161        # Edit one piece 
     162        problem='' 
    162163        piece=self.uid_catalog(UID=uid) 
    163164        piece=piece[0].getObject() 
     165        if values.has_key('title') and values['title']: 
     166            if not piece.checkTitle(values['title']): 
     167                problem=self.translate('Title %s is already in use.' % values['title'], domain='lemill') 
     168                del values['title'] 
     169                 
    164170        piece.edit(**values) 
    165171        piece.at_post_edit_script() 
     172        return problem 
    166173 
    167174    def giveLanguageLink(self, REQUEST, lang, url, param): 
  • trunk/skins/lemill/piece_edit.cpt.metadata

    r876 r1379  
    33 
    44[validators] 
    5 validators = validate_base 
     5validators = validate_base, validate_title 
    66validators..form_add = 
    77validators..cancel = 
  • trunk/skins/lemill/script_editPieces.py

    r1212 r1379  
    1919edit_page=return_page['edit_page'] 
    2020edit_nr=return_page['edit_nr'] 
    21  
     21problems=[] 
     22psm='' 
    2223 
    2324for n in range(lenpieces): 
     
    3031    values.append(d) 
    3132    pieces.append(REQUEST.get('uid_%s' % n)) 
    32     context.lemill_tool.savePiece(pieces[n], values[n]) 
     33    problem=context.lemill_tool.savePiece(pieces[n], values[n]) 
     34    if problem: 
     35        problems.append(problem) 
     36 
     37if problems: 
     38    psm='&portal_status_message=%s' % ' '.join(problems) 
     39 
    3340 
    3441del REQUEST.SESSION['new_pieces'] 
     
    3744    n_pieces=REQUEST.SESSION['slide_uploader'] 
    3845    del REQUEST.SESSION['slide_uploader'] 
    39     return REQUEST.RESPONSE.redirect(context.absolute_url()+'/slide_uploader?n_pieces=%s' % n_pieces) 
     46    return REQUEST.RESPONSE.redirect(context.absolute_url()+'/slide_uploader?n_pieces=%s%s' % (n_pieces, psm)) 
    4047else:     
    4148    del REQUEST.SESSION['return_page'] 
    42     return REQUEST.RESPONSE.redirect(context.absolute_url()+'/%s?edit=%s#%s' % (edit_page, edit_nr, edit_nr)) 
     49    return REQUEST.RESPONSE.redirect(context.absolute_url()+'/%s?edit=%s#%s%s' % (edit_page, edit_nr, edit_nr, psm)) 
    4350     
  • trunk/skins/lemill/story_edit.cpt.metadata

    r236 r1379  
    33 
    44[validators] 
    5 validators = validate_base 
     5validators = validate_base, validate_title 
    66validators..form_add = 
    77validators..cancel = 
Note: See TracChangeset for help on using the changeset viewer.