Changeset 23323


Ignore:
Timestamp:
06/18/13 15:26:17 (6 years ago)
Author:
mistic100
Message:

move remove_image.php code to a trigger on init

Location:
extensions/BatchDownloader
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/include/download.inc.php

    r23291 r23323  
    173173  $replace = '$1 
    174174{strip}<a class="removeSet" href="{$U_VIEW}&amp;remove={$thumbnail.id}" data-id="{$thumbnail.id}" rel="nofollow"> 
    175 {\'Remove from download set\'|@translate}&nbsp;<img src="{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}template/image_delete.png" title="{\'Remove from download set\'|@translate}"> 
     175{\'Remove from download set\'|@translate}&nbsp;<img src="{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}template/images/image_delete.png" title="{\'Remove from download set\'|@translate}"> 
    176176</a>{/strip}'; 
    177177 
  • extensions/BatchDownloader/include/events.inc.php

    r23321 r23323  
    279279} 
    280280 
     281/* ajax request to remove an image */ 
     282function batch_downloader_remove_image() 
     283{ 
     284  if (!isset($_POST['action']) || $_POST['action']!='bd_remove_image') return; 
     285   
     286  check_status(ACCESS_CLASSIC); 
     287 
     288  if (isset($_POST['set_id']) and isset($_POST['toggle_id'])) 
     289  { 
     290    try 
     291    { 
     292      $BatchDownloader = new BatchDownloader($_POST['set_id']); 
     293      $BatchDownloader->removeImages(array($_POST['toggle_id'])); 
     294      echo 'ok'; 
     295    } 
     296    catch (Exception $e) 
     297    { 
     298      echo 'error'; 
     299    } 
     300  } 
     301  else 
     302  { 
     303    echo 'error'; 
     304  } 
     305   
     306  exit(0); 
     307} 
     308 
    281309?> 
  • extensions/BatchDownloader/main.inc.php

    r23290 r23323  
    3232else 
    3333{ 
     34  add_event_handler('init', 'batch_downloader_remove_image'); 
     35   
    3436  add_event_handler('loc_end_section_init', 'batch_download_section_init'); 
    3537  add_event_handler('loc_end_index', 'batch_download_page'); 
  • extensions/BatchDownloader/template/thumbnails_css_js.tpl

    r23291 r23323  
    1212  jQuery.ajax({ldelim} 
    1313    type: "POST", 
    14     url: "{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}remove_image.php", 
    15     data: {ldelim} "set_id": "{$SET_ID}", "toggle_id": toggle_id } 
    16   }).done(function(msg) {ldelim} 
    17     if (msg == "false") {ldelim} 
    18       $trigger.parent("li").hide("fast", function() {ldelim} $trigger.remove() }); 
    19       jQuery(".nbImagesSet").html(parseInt(jQuery(".nbImagesSet").html()) -1); 
    20        
    21       if (typeof GThumb == "object") GThumb.build(); 
    22     } else {ldelim} 
     14    url: "{$ROOT_URL}index.php", 
     15    data: {ldelim} 
     16      action: "bd_remove_image", 
     17      set_id: "{$SET_ID}", 
     18      toggle_id: toggle_id 
     19    }, 
     20    success: function(msg) {ldelim} 
     21      if (msg == "ok") {ldelim} 
     22        $trigger.parent("li").hide("fast", function() {ldelim} $trigger.remove() }); 
     23        jQuery(".nbImagesSet").html(parseInt(jQuery(".nbImagesSet").html()) -1); 
     24         
     25        if (typeof GThumb == "object") GThumb.build(); 
     26      } else {ldelim} 
     27        $trigger.html('{'Un unknown error occured'|@translate}'); 
     28      } 
     29    }, 
     30    error: function() {ldelim} 
    2331      $trigger.html('{'Un unknown error occured'|@translate}'); 
    2432    } 
Note: See TracChangeset for help on using the changeset viewer.