Ignore:
Timestamp:
10 Mar 2008, 19:12:40 (17 years ago)
Author:
joachim
Message:

show all fields for editing with value from first record,
show one line per field for better readability
add edit again button for importable files.

Location:
WAeUP_SRP/base/skins/waeup_upload
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_upload/uploads_form.pt

    r3308 r3314  
    3636              <th>Upload Date</th>
    3737              <th>Error Message</th>
    38               <th>Invalid Keys</th>
    3938            </tr>           
    40             <tr tal:repeat="row info/wrong"
    41                 tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
    42               <td align="left" valign="middle" style="width: 5px;">
    43                 <input type="checkbox" name="ids:list" value="" id="" class="noborder"
    44                        tal:define="id string:${row/id}.csv"
    45                        tal:attributes="value id;
    46                        id python:'cb_' + id;
    47                        checked python:id in info['choosen_ids'];"
    48                        />
    49               </td>
    50               <td tal:condition="nothing"> <a href="view" tal:attributes="href string:${row/url}"> <span tal:content="row/id" /></a>  </td>
    51               <td tal:content="string:${row/id}.csv" ></td>
    52               <td>
    53                 <select name="import_layout:record" tal:attributes="name string:${row/id}.import_layout:record">
    54                   <option tal:repeat="option python: context.portal_vocabularies.import_names.items()"
    55                           tal:attributes="value python: option[0];
    56                           selected python: option[0] == row['import_layout']"
    57                           tal:content="python:option[1]" />
    58                 </select>
    59               </td>
    60               <td tal:content="row/uploaded_by" ></td>
    61               <td tal:content="row/upload_date" ></td>
    62               <td tal:content="row/msg" ></td>
    63               <td>
    64                 <div tal:repeat="key row/invalid_keys">
    65                   <span tal:replace="key" /><br />
    66                   <select tal:attributes="name string:${row/id}|${key}.valid_key:record">
     39            <span tal:repeat="row info/wrong" tal:omit-tag="">
     40              <tr tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
     41                <td align="left" valign="middle" style="width: 5px;">
     42                  <input type="checkbox" name="ids:list" value="" id="" class="noborder"
     43                         tal:define="id string:${row/id}.csv"
     44                         tal:attributes="value id;
     45                         id python:'cb_' + id;
     46                         checked python:id in info['choosen_ids'];"
     47                         />
     48                </td>
     49                <td tal:condition="nothing"> <a href="view" tal:attributes="href string:${row/url}"> <span tal:content="row/id" /></a>  </td>
     50                <td tal:content="string:${row/id}.csv" ></td>
     51                <td>
     52                  <select name="import_layout:record" tal:attributes="name string:${row/id}.import_layout:record">
     53                    <option tal:repeat="option python: context.portal_vocabularies.import_names.items()"
     54                            tal:attributes="value python: option[0];
     55                            selected python: option[0] == row['import_layout']"
     56                            tal:content="python:option[1]" />
     57                  </select>
     58                </td>
     59                <td tal:content="row/uploaded_by" ></td>
     60                <td tal:content="row/upload_date" ></td>
     61                <td tal:content="row/msg" ></td>
     62              </tr>
     63              <tr>
     64                <th>Current</th>
     65                <th>Possible</th>
     66                <th>Value from 1. record</th>
     67              </tr>
     68              <tr tal:repeat="key row/invalid_keys">
     69                <td colspan="1">
     70                  <font tal:attributes="color python: test(key[1] == '----','red','black')" tal:content="python: key[0]" />
     71                </td>
     72                <td colspan="1"
     73                    tal:define="old_key python: key[0];new_key python: key[1];">
     74                  <select tal:attributes="name string:${row/id}|${old_key}.valid_key:record">
    6775                    <option tal:repeat="new row/valid_keys"
    68                             tal:attributes="value new"
     76                            tal:attributes="value new; selected python: new == new_key"
    6977                            tal:content="new" />
    70                   </select>
    71                 </div>
    72               </td>
    73               <td tal:condition="python:0">
    74                 <a href="edit" tal:attributes="href string:${row/url}/external_edit_form"
    75                    target="edit"
    76                    onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
    77                   [edit]
    78                 </a>
    79               </td>
    80             </tr>
    81           </table>
     78                  </select><br />
     79                </td>
     80                <td colspan="1" tal:content="python: key[2]" />
     81              </tr>
     82            </span>
     83            </table>
    8284         
    8385          <br />
     
    149151                 (cpsmcat('description_confirm_delete'), )"
    150152                 />
     153          <input type="submit" name="goto_edit" value="Edit again"
     154                 class="destructive" i18n:attributes="value"
     155                 />
    151156          <input type="submit" name="folder_delete:method" value="button_delete"
    152157                 class="destructive" i18n:attributes="value"
  • WAeUP_SRP/base/skins/waeup_upload/uploads_index.py

    r3313 r3314  
    2929
    3030path_info = request.get('PATH_INFO').split('/')
    31 NO_KEY = '----'
    3231info = {}
    3332info['action'] = "%s" % context.absolute_url()
     
    4746        msg, invalid_keys = doc['checkKeys']()
    4847        new_keys = []
    49         for key in invalid_keys:
    50             id_key = "%s|%s" % (short_id,key)
     48        for old_key,previous,value in invalid_keys:
     49            id_key = "%s|%s" % (short_id,old_key)
    5150            if request.form.has_key(id_key):
    5251                new_key = request.form.get(id_key)['valid_key']
    53                 if new_key != NO_KEY:
    54                     new_keys += (key,new_key),
     52                if new_key != old_key and new_key != doc.NO_KEY:
     53                    new_keys += (old_key,new_key),
    5554        if new_keys:
    5655            doc.editHeadline(new_keys)
    5756            for key in new_keys:
    5857                logger.info('%s changed column heading in file %s from %s to %s' % (member,long_id,key[0],key[1]))
     58    return request.RESPONSE.redirect(context.absolute_url())
    5959
    6060wrong = []
     
    6666    doc = upload.getContent()
    6767    row['valid_keys'] = doc['getKeys']()
    68     row['valid_keys'][0] = NO_KEY
     68    row['valid_keys'][0:0] = doc.NO_KEY,
    6969    row['id'] = id.replace('.csv','')
    7070    row['title'] = doc.filename
     
    7575    if import_message:
    7676        row['imported'] = True
     77        row['imported_by'] = getattr('doc','imported_by','')
    7778        row['msg'] = import_message
    7879        if getattr(doc,'import_date',''):
     
    8384    else:
    8485        row['msg'],row['invalid_keys'] = doc['checkKeys']()
    85         if not row['msg'] and not row['invalid_keys']:
     86        if not (request.has_key('goto_edit') and id in ids) and not row['msg']:
    8687            add_to = importable
    8788    row['filename'] = doc.filename
    8889    row['import_layout'] = doc.import_layout
     90    row['uploaded_by'] =  doc.uploaded_by
    8991    row['upload_date'] =  doc.upload_date.strftime("%d/%m/%y %H:%M:%S")
    90     row['uploaded_by'] = doc.uploaded_by
    9192    row['imported_by'] = doc.imported_by
    9293    add_to.append(row)
Note: See TracChangeset for help on using the changeset viewer.