Changeset 6369


Ignore:
Timestamp:
05/31/12 18:24:52 (12 years ago)
Author:
acoutinho
Message:

Ticket #2821 - Inconsistências na interface de anexos e na remoção de anexos

Location:
trunk/prototype
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/config/attachment.ini

    r5715 r6369  
    44[before.create] 
    55encodeCreateAttachment = modules/calendar/interceptors/DBMapping.php 
    6  
    7 [after.delete] 
    8 deleteAttachmentDependences = modules/calendar/interceptors/DBMapping.php 
    96 
    107[PostgreSQL.mapping] 
  • trunk/prototype/config/schedulableToAttachment.ini

    r5715 r6369  
    55schedulable = schedulable.attachments 
    66 
     7[before.delete] 
     8decodeSchedulablettachment = modules/calendar/interceptors/DBMapping.php 
     9 
     10[after.delete] 
     11deleteAttachmentDependences = modules/calendar/interceptors/DBMapping.php 
     12 
    713[PostgreSQL.mapping] 
    814id = id 
  • trunk/prototype/modules/calendar/css/layout.css

    r6319 r6369  
    705705 
    706706.button.add.button-add-attachment{margin: -9px 0 0 8px;} 
    707 .button.upload{margin-bottom: 4px;} 
     707.button.btn-danger.delete{margin: 0 0 0 0;} 
     708 
     709.button.upload{top: 4px;} 
     710.button.upload.edit{top: -2px;} 
     711 
    708712div.fileupload-buttonbar{padding: 0.2em 0.5em } 
    709713.archive-error{color: #F00;} 
     
    711715.progress.in-progress{width: 100px; height: 12px;} 
    712716 
     717span.status-upload{margin: -4px 0px 0px 0px;} 
    713718 
    714719.lbl-archive-nome, .lbl-archive-size{font-weight: bold !important;} 
     
    11621167.ui-tabs .ui-tabs-panel { padding: 0; margin-top: 10px;} 
    11631168 
     1169.ui-tabs #calendar_addevent_details5.ui-tabs-panel{margin-top: -3px; min-height: 323px;} 
     1170 
    11641171.ui-tabs .ui-tabs-nav li .ui-icon-close { 
    11651172    float: right; 
  • trunk/prototype/modules/calendar/interceptors/DBMapping.php

    r6345 r6369  
    813813    } 
    814814 
     815    public function decodeSchedulablettachment(&$uri, &$params, &$criteria, $original) { 
     816        if (isset($original['URI']['id'])){ 
     817            $schedulableAttachment = Controller::read(array('concept' => 'schedulableToAttachment'), false, array('filter' => array( '=', 'attachment' , $original['URI']['id'] ))); 
     818            $uri['id'] = $schedulableAttachment[0]['id']; 
     819        } 
     820    } 
     821 
    815822    public function deleteAttachmentDependences(&$uri, &$params, &$criteria, $original) { 
    816  
    817         if (isset($original['URI']['id'])) 
    818             Controller::delete(array('concept' => 'schedulableToAttachment', null, array('filter' => array('=', 'attachment', $original['URI']['id'])))); 
     823        Controller::delete(array('concept' => 'attachment', 'id' => $original['URI']['id'])); 
    819824    } 
    820825 
  • trunk/prototype/modules/calendar/js/helpers.js

    r6359 r6369  
    13311331    text: 'Excluir' 
    13321332}).click(function () { 
    1333     $('.row.fileupload-buttonbar .attachments-list p').remove(); 
    1334                                  
    1335     var ids = []; 
    1336     $.each($('.attachment-list input'), function (i, input) { 
    1337         ids.push(input.value); 
    1338     }); 
    1339     if(ids.length > 0){ 
    1340         DataLayer.remove('attachment', { 
    1341             filter: ['IN', 'id', ids] 
    1342             }); 
    1343         $('.attachment-list input').remove(); 
    1344     } 
     1333    $.Zebra_Dialog('Tem certeza que deseja excluir todos anexos?', { 
     1334        'type':     'question', 
     1335        'overlay_opacity': '0.5', 
     1336        'buttons':  ['Sim', 'Não'], 
     1337        'onClose':  function(clicked) { 
     1338            if(clicked == 'Sim'){ 
     1339                 
     1340                var ids = []; 
     1341                $.each($('.attachment-list input'), function (i, input) { 
     1342                     DataLayer.remove('schedulableToAttachment', { 
     1343                        filter: ['=', 'id', ''+input.value] 
     1344                        }); 
     1345                }); 
     1346                $('.attachment-list input').remove(); 
     1347                $('.row.fileupload-buttonbar .attachments-list p').remove(); 
     1348            } 
     1349        }}); 
    13451350}).end() 
    13461351.filter('.close').button({ 
     
    13501355    text: false 
    13511356}).click(function () { 
    1352     DataLayer.remove('attachment', $(this).parents('p').find('input[name="fileId[]"]').val()); 
     1357    DataLayer.remove('schedulableToAttachment', $(this).parents('p').find('input[name="fileId[]"]').val()); 
    13531358    $(this).parents('p').remove(); 
    13541359}).end() 
  • trunk/prototype/modules/calendar/templates/event_add.ejs

    r6331 r6369  
    161161         
    162162        <fieldset class="attachment-list hidden"> 
     163             <%if(data.event && data.event.attachments){ 
     164                for (var i=0; i< data.event.attachments.length; i++) {%> 
     165                    <input type="hidden" name="fileId[]" value="<%=data.event.attachments[i].id%>"/> 
     166                <%} 
     167            }%> 
    163168        </fieldset> 
    164169    </form> 
     
    166171<div class="overflow_add_calender"> 
    167172        <fieldset id="calendar_addevent_details5" class="tab-level2"> 
    168                 <form id="fileupload" action="attachment:detail" method="POST"> 
     173        <form id="fileupload" action="attachment:detail" method="POST"> 
    169174        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> 
    170175        <div class="row fileupload-buttonbar"> 
     
    183188                                <%}%> 
    184189            </div> 
    185                         <div id="fileupload-progress"></div> 
     190            <div id="fileupload-progress"></div> 
    186191            <div class="files-list"> 
    187192               <ul class="attachments-list"> 
     
    197202                                                        <a href="../prototype/getArchive.php?attachment=<%=data.event.attachments[i].id%>" class="button tiny upload downlaod-archive">Download</a> 
    198203                                                        <%if(data.event.acl.organization || data.event.acl.write){%> 
    199                                                                 <span class="button close tiny upload delete-upload" title="Deletar">Deletar</span> 
     204                                                                <span class="button close tiny upload edit delete-upload" title="Deletar">Deletar</span> 
    200205                                                        <%}%> 
    201206                                                        <input type="hidden" name="fileId[]" value="<%=data.event.attachments[i].id%>"/> 
Note: See TracChangeset for help on using the changeset viewer.