Changeset 20099


Ignore:
Timestamp:
Jan 13, 2013, 12:49:45 PM (8 years ago)
Author:
mistic100
Message:

compatible with Simple, new export options

Location:
extensions/UserCollections
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/admin/export.php

    r20090 r20099  
    1212}
    1313
     14// pwg_unset_session_var('uc_export_active_fields');
     15// pwg_unset_session_var('uc_export_inactive_fields');
    1416
    1517if (isset($_POST['download']))
    1618{
    17   $content = $UserCollection->serialize($_POST['content']);
     19  pwg_set_session_var('uc_export_active_fields', $_POST['active']);
     20  pwg_set_session_var('uc_export_inactive_fields', $_POST['inactive']);
     21 
     22  $content = $UserCollection->serialize($_POST['active']);
    1823  $filename = 'collection_'.$_GET['col_id'].'_'.date('Ymd-Hi').'.csv';
    1924 
     
    3237}
    3338
     39$default_active_fields = array(
     40  'id',
     41  'name',
     42  'path',
     43  );
     44$default_inactive_fields = array(
     45  'file',
     46  'url',
     47  'date_creation',
     48  'collection_add_date',
     49  'filesize',
     50  'width',
     51  'height',
     52  );
     53
     54$template->assign('active_fields', pwg_get_session_var('uc_export_active_fields', $default_active_fields));
     55$template->assign('inactive_fields', pwg_get_session_var('uc_export_inactive_fields', $default_inactive_fields));
     56
    3457$template->set_filename('user_collections', dirname(__FILE__) . '/template/export.tpl');
    3558
  • extensions/UserCollections/admin/template/export.tpl

    r20093 r20099  
    2020});
    2121
     22$("#invokeFrame").load(function() {
     23  $(this).css('height', $(this).contents().find('body').outerHeight(true)+10);
     24});
     25
    2226$("input[name='download']").click(function() {
    2327  $("#fields_active li").each(function() {
    24     $("#export_form").append('<input type="hidden" name="content[]" value="'+ $(this).data('name') +'"/>');
     28    $("#export_form").append('<input type="hidden" name="active[]" value="'+ $(this).data('name') +'"/>');
     29  });
     30  $("#fields_inactive li").each(function() {
     31    $("#export_form").append('<input type="hidden" name="inactive[]" value="'+ $(this).data('name') +'"/>');
    2532  });
    2633});
     
    3744  <ul id="fields_active" class="connectedSortable">
    3845    <h4>{'Active'|@translate}</h4>
    39     <li data-name="id"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> id</li>
    40     <li data-name="name"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> name</li>
    41     <li data-name="path"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> path</li>
     46  {foreach from=$active_fields item=field}
     47    <li data-name="{$field}"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> {$field}</li>
     48  {/foreach}
    4249  </ul>
    4350  <ul id="fields_inactive" class="connectedSortable">
    4451    <h4>{'Inactive'|@translate}</h4>
    45     <li data-name="file"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> file</li>
    46     <li data-name="url"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> url</li>
     52  {foreach from=$inactive_fields item=field}
     53    <li data-name="{$field}"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> {$field}</li>
     54  {/foreach}
    4755  </ul>
    4856 
  • extensions/UserCollections/admin/template/style.css

    r20090 r20099  
    4444.connectedSortable {
    4545  display:inline-block;
    46   width:150px;
     46  width:170px;
    4747  vertical-align:top;
    4848  border:1px dashed #7a7a7a;
     
    9696#invokeFrame {
    9797  width:100%;
    98   height:500px;
     98  background:#e7e7e7;
     99  color:#222;
     100  border:none;
    99101}
  • extensions/UserCollections/include/UserCollection.class.php

    r20093 r20099  
    504504  function serialize($params)
    505505  {
    506     $params = array_intersect($params, array('id','file','name','url','path'));
     506    $params = array_intersect($params, array('id','file','name','url','path','date_creation','collection_add_date','filesize','width','height'));
    507507   
    508508    $content = null;
     
    514514    file,
    515515    name,
    516     path
     516    path,
     517    date_creation,
     518    filesize,
     519    width,
     520    height,
     521    add_date AS collection_add_date
    517522  FROM '.IMAGES_TABLE.'
    518   WHERE id IN('.implode(',', $this->images).')
     523    JOIN '.COLLECTION_IMAGES_TABLE.' ON id = image_id
     524  WHERE col_id = '.$this->data['id'].'
    519525  ORDER BY id
    520526;';
     
    537543          switch ($field)
    538544          {
    539           case 'id':
    540             $element[] = $row['id']; break;
    541           case 'file':
    542             $element[] = $row['file']; break;
    543545          case 'name':
    544546            $element[] = render_element_name($row); break;
     
    547549          case 'path':
    548550            $element[] = $root_url.ltrim($row['path'], './'); break;
     551          default:
     552            $element[] = $row[$field]; break;
    549553          }
    550554        }
  • extensions/UserCollections/include/events.inc.php

    r20097 r20099  
    126126{
    127127  // add links
    128   $search = '#(<span class="wrap1">|<li class="gthumb">)#';
     128  $search = '#(<li>|<li class="gthumb">)#';
    129129  $replace = '$1
    130130{strip}<a class="addCollection" href="{$collection_toggle_url}{$thumbnail.id}" data-id="{$thumbnail.id}" rel="nofollow">
  • extensions/UserCollections/template/thumbnails_css_js.tpl

    r20097 r20099  
    11{html_style}
    2 .thumbnails .wrap1 {ldelim} position:relative !important; }
    3 .wrap1 .addCollection, .gthumb .addCollection {ldelim} width:100%;height:16px;display:none;position:absolute;top:0;background:rgba(0,0,0,0.8);padding:2px;border-radius:2px;font-size:10px;z-index:100 !important;color:#eee;white-space:nowrap; }
    4 .wrap1:hover .addCollection, .gthumb:hover .addCollection {ldelim} display:block; }
     2#thumbnails li {ldelim} position:relative !important;display:inline-block; }
     3li .addCollection {ldelim} width:100%;height:16px;display:none;position:absolute;top:0;background:rgba(0,0,0,0.8);padding:2px;border-radius:2px;font-size:10px;z-index:100 !important;color:#eee;white-space:nowrap; }
     4li:hover .addCollection {ldelim} display:block !important; }
    55{/html_style}
    66
Note: See TracChangeset for help on using the changeset viewer.