Changeset 19821


Ignore:
Timestamp:
Jan 5, 2013, 1:39:08 AM (12 years ago)
Author:
julien1311
Message:

[file_uploader] pdf2tab update

Location:
extensions/File_Uploader
Files:
3 added
1 deleted
32 edited

Legend:

Unmodified
Added
Removed
  • extensions/File_Uploader

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/admin

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/admin/admin_configuration.php

    r19472 r19821  
    1313        }
    1414       
     15        $conf_file_uploader['pdf2tab_extensions'] = $_POST['file_uploader_pdf2tab_extensions'];
     16        $conf_file_uploader['pdf2tab_extensions'] = explode(',', $conf_file_uploader['pdf2tab_extensions']);
     17       
    1518        //Save
    1619        conf_update_param('file_uploader', serialize($conf_file_uploader));
     
    2124foreach ($conf_file_uploader as $file_uploader_key => $value)
    2225        $file_uploader_checked[$file_uploader_key] = (($conf_file_uploader[$file_uploader_key] == 1) ? 'checked = "checked"' : '');
     26$template->assign('file_uploader_checked', $file_uploader_checked);
    2327
    24 $template->assign('file_uploader_checked', $file_uploader_checked);
     28if ($conf_file_uploader['pdf2tab_extensions'][0]=='')
     29                $conf_file_uploader['pdf2tab_extensions'] = null;
     30$template->assign('file_uploader_pdf2tab_extensions',$conf_file_uploader['pdf2tab_extensions']);
    2531
    2632//Add our template to the global template
  • extensions/File_Uploader/admin/admin_configuration.tpl

    r19666 r19821  
     1{include file='include/colorbox.inc.tpl'}
     2
     3{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
     4{footer_script require='jquery.tokeninput'}
     5jQuery(document).ready(function() {ldelim}
     6        jQuery('select[name="file_uploader_pdf2tab_extensions"]').tokenInput(
     7                [{foreach from=$extensions item=extension name=extensions}{ldelim}"{$extension|@escape:'javascript'}"{rdelim}{if !$smarty.foreach.extensions.last},{/if}{/foreach}],
     8    {ldelim}
     9      hintText: '{'file_uploader_pdf2tab_hint_text'|@translate}',
     10      noResultsText: '',
     11      searchingText: '',
     12      newText: '',
     13      animateDropdown: false,
     14      preventDuplicates: true,
     15      allowCreation: true
     16    }
     17  );
     18
     19  jQuery("a.preview-box").colorbox();
     20});
     21{/footer_script}
     22
    123<div class="titrePage">
    224  <h2>{'File Uploader Plugin'|@translate}</h2>
     
    931                        <label><input type="checkbox" name="file_uploader_checkbox[new_tab]" value="1" {$file_uploader_checked.new_tab}> {'Open files in a new tab'|@translate}</label>
    1032                </p>
     33                <p id="file_uploader_pdf2tab_supported_extensions">
     34                        {'file_uploader_pdf2tab_supported_extensions_description'|@translate}
     35                </p>
     36                <p id="file_uploader_pdf2tab_supported_extensions">     
     37                        <select name="file_uploader_pdf2tab_extensions">
     38                                {foreach from=$file_uploader_pdf2tab_extensions item=file_uploader_pdf2tab_extension}
     39                                        <option value="{$file_uploader_pdf2tab_extension}" class="selected">{$file_uploader_pdf2tab_extension}</option>
     40                                {/foreach}
     41                        </select>
     42                </p>
    1143                <p>
    1244                        <label><input type="checkbox" name="file_uploader_checkbox[overwrite]" value="1" {$file_uploader_checked.overwrite}> {'Overwrite files without notice'|@translate}</label>
  • extensions/File_Uploader/install

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/install/config_default.inc.php

    r19775 r19821  
    3535        'new_tab' => 1,
    3636        'overwrite' => 0,
     37        'pdf2tab_extensions' => array('pdf', 'docx', 'doc', 'odt', 'xlsx', 'xls', 'ods', 'pptx', 'ppt', 'odp'),
    3738);
    3839
  • extensions/File_Uploader/install/functions.inc.php

    r19775 r19821  
    11<?php
     2function file_uploader_install($config) {
     3        $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("file_uploader" ,"'.pwg_db_real_escape_string(serialize($config)).'", "File Uploader plugin parameters");';
     4        pwg_query($query);
     5}
     6
     7function file_uploader_update_db() {
     8        global $conf;
     9        include(dirname(__FILE__).'/config_default.inc.php');
     10
     11        $config = array();
     12        if (isset($conf['file_uploader']))
     13                $conf_file_uploader = unserialize($conf['file_uploader']);
     14       
     15        if (isset($conf_file_uploader)) {
     16                foreach ($config_default as $key => $value) {
     17                        if (isset($conf_file_uploader[$key]))
     18                                $config[$key] = $conf_file_uploader[$key];
     19                        else
     20                                $config[$key] = $config_default[$key];
     21                }
     22                file_uploader_delete_conf("file_uploader");
     23                file_uploader_install($config);
     24        } else {
     25                file_uploader_install($config_default);
     26        }
     27}
     28
     29function file_uploader_delete_conf($where) {
     30        $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE (param="'.$where.'");';
     31        pwg_query($query);
     32}
     33
    234function file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir) {
    335        //If the directory does not exist, we create it
  • extensions/File_Uploader/language

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/da_DK

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/da_DK/plugin.lang.php

    r19724 r19821  
    2626$lang['No file to upload'] = 'Der er ingen fil at uploade';
    2727$lang['Open files in a new tab'] = 'Åbn filer i et nyt faneblad';
    28 $lang['Open the file in a new tab'] = 'Åbn filen i et nyt faneblad';
     28$lang['file_uploader_pdf2tab_tooltip'] = 'Åbn filen i et nyt faneblad';
    2929$lang['Overwrite files without notice'] = 'Overskriv filer uden advarsel';
    3030$lang['Piwigo is a free software (opensource software), you can use it for free and this is not going to change. Donations are collected by the Piwigo Foundation (non profit organization) to cover project fees.'] = 'Piwigo er fri software (open source-software), som du frit kan anvende og vil altid være det. Donationer modtages af Piwigo Foundation (nonprofitnorganisation) med det formål at dække projektomkostninger.';
  • extensions/File_Uploader/language/de_DE

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/de_DE/plugin.lang.php

    r19697 r19821  
    2424$lang['No file to upload'] = 'Keine Datei zum hochladen';
    2525$lang['Open files in a new tab'] = 'Öffne Datei in neuem TAB';
    26 $lang['Open the file in a new tab'] = 'Öffne die Datei in einem neuen TAB';
     26$lang['file_uploader_pdf2tab_tooltip'] = 'Öffne die Datei in einem neuen TAB';
    2727$lang['Overwrite files without notice'] = 'Überschreibe Datei ohne Warnhinweis';
    2828$lang['Piwigo is a free software (opensource software), you can use it for free and this is not going to change. Donations are collected by the Piwigo Foundation (non profit organization) to cover project fees.'] = 'Piwigo ist eine freie Software (Open Source), Du kannst sie kostenlos benutzen. Piwigo wird stets kostenlos bleiben. Spenden werden von der Piwigo Foundation (nicht kommerzielle Organisation) verwendet um Projektkosten zu decken.';
  • extensions/File_Uploader/language/el_GR

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/el_GR/plugin.lang.php

    r19713 r19821  
    3131$lang['Piwigo is a free software (opensource software), you can use it for free and this is not going to change. Donations are collected by the Piwigo Foundation (non profit organization) to cover project fees.'] = 'Το Piwigo είναι δωρεάν λογισμικό (λογισμικό ανοικτού κώδικα), μπορείτε να το χρησιμοποιήσετε ελεύθερα και αυτό δεν πρόκειται να αλλάξει. Δωρεές συλλέγονται από το Ίδρυμα Piwigo Foundation (μη κερδοσκοπικός οργανισμός) για την κάλυψη των αμοιβών του έργου.';
    3232$lang['Overwrite files without notice'] = 'Αντικατάσταση αρχείων χωρίς προειδοποίηση';
    33 $lang['Open the file in a new tab'] = 'Ανοίξτε το αρχείο σε μια νέα καρτέλα';
     33$lang['file_uploader_pdf2tab_tooltip'] = 'Ανοίξτε το αρχείο σε μια νέα καρτέλα';
    3434$lang['Open files in a new tab'] = 'Ανοίξτε το αρχεία σε μια νέα καρτέλα';
    3535$lang['No file to upload'] = 'Δεν υπάρχει αρχείο για να φορτώσετε';
  • extensions/File_Uploader/language/en_UK

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/en_UK/plugin.lang.php

    r19666 r19821  
    5454//pdf2tab
    5555//picture.php
    56 $lang['Open the file in a new tab'] = 'Open the file in a new tab';
     56$lang['file_uploader_pdf2tab_tooltip'] = 'Open the file in a new tab';
    5757?>
  • extensions/File_Uploader/language/es_ES

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/es_ES/plugin.lang.php

    r19730 r19821  
    2626$lang['No file to upload'] = 'Ningun archivo para subir';
    2727$lang['Open files in a new tab'] = 'Abrir archivos en una nueva pestaña';
    28 $lang['Open the file in a new tab'] = 'Abrir archivo en una nueva pestaña';
     28$lang['file_uploader_pdf2tab_tooltip'] = 'Abrir archivo en una nueva pestaña';
    2929$lang['Overwrite files without notice'] = 'Sobrescribir archivos sin notificarlo';
    3030$lang['Piwigo is a free software (opensource software), you can use it for free and this is not going to change. Donations are collected by the Piwigo Foundation (non profit organization) to cover project fees.'] = 'Piwigo es un software gratuito (código abierto), puedes usarlo gratis y esto no va a cambiar. Las donaciones son recolectadas por la fundación Piwigo (sin ánimo de lucro) para cubrir los gastos del proyecto.';
  • extensions/File_Uploader/language/fr_FR

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/fr_FR/plugin.lang.php

    r19666 r19821  
    5454//pdf2tab
    5555//picture.php
    56 $lang['Open the file in a new tab'] = 'Ouvrir le fichier dans un nouvel onglet';
     56$lang['file_uploader_pdf2tab_tooltip'] = 'Ouvrir le fichier dans un nouvel onglet';
    5757?>
  • extensions/File_Uploader/language/hu_HU

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/hu_HU/plugin.lang.php

    r19710 r19821  
    3131$lang['Specify a thumbnail for your file'] = 'Adja meg a bélyegkép fájlt';
    3232$lang['Type of file not supported'] = 'A fájltípus nem támogatott';
    33 $lang['Open the file in a new tab'] = 'Nyissa meg a fájlt egy új fülön';
     33$lang['file_uploader_pdf2tab_tooltip'] = 'Nyissa meg a fájlt egy új fülön';
    3434$lang['There have been errors. See below'] = 'Hibák történtek. Lásd alább';
    3535$lang['File upload stopped by extension'] = 'A fájl feltöltést leállította a bővítmény';
  • extensions/File_Uploader/language/tr_TR

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/language/tr_TR/plugin.lang.php

    r19693 r19821  
    3939$lang['No file to upload'] = 'Yükleyecek dosya yok';
    4040$lang['Open files in a new tab'] = 'PDF dosyaların yeni sekmede aç';
    41 $lang['Open the file in a new tab'] = 'Dosyayı yeni sekmede aç';
     41$lang['file_uploader_pdf2tab_tooltip'] = 'Dosyayı yeni sekmede aç';
    4242$lang['Overwrite files without notice'] = 'Uyarmaksızın dosyaların üzerine yaz';
    4343$lang['Specify a file to upload'] = 'Yüklenecek bir dosya seçin';
  • extensions/File_Uploader/main.inc.php

    r19675 r19821  
    5757        //add a stylesheet
    5858        $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PATH.'admin/admin.css">');
     59        $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'css/admin.css">');
    5960}
    6061?>
  • extensions/File_Uploader/maintain.inc.php

    r19775 r19821  
    66        include_once(dirname(__FILE__).'/install/functions.inc.php');
    77
    8         $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("file_uploader" ,"'.pwg_db_real_escape_string(serialize($config_default)).'", "File Uploader plugin parameters");';
    9         pwg_query($query);
     8        file_uploader_install($config_default);
    109       
    1110        file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir);
     
    1615        include_once(dirname(__FILE__).'/install/functions.inc.php');
    1716       
     17        file_uploader_update_db();
    1818        file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir);
    1919}
    2020
    2121function plugin_uninstall() {
    22         $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE (param="file_uploader");';
    23         pwg_query($query);
     22        include_once(dirname(__FILE__).'/install/functions.inc.php');
     23
     24        file_uploader_delete_conf("file_uploader");
    2425}
    2526
  • extensions/File_Uploader/plugin_pdf2tab

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/plugin_pdf2tab/include

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/plugin_pdf2tab/include/picture.inc.php

    r19680 r19821  
    11<?php
    2 add_event_handler('render_element_content','pdf2tab_add_links_picture',EVENT_HANDLER_PRIORITY_NEUTRAL+10,2);
     2add_event_handler('render_element_content','file_uploader_pdf2tab_add_links_picture',EVENT_HANDLER_PRIORITY_NEUTRAL+10,2);
    33
    4 function pdf2tab_add_links_picture($content, $element_info) {
    5         include_once('constants.inc.php');
    6 
    7         if (in_array(strtolower(substr(strrchr($element_info['file'], "."),1)), $supported_extensions)) {
    8                 $content = pdf2tab_add_link_image($content, $element_info);
    9                 $content = pdf2tab_add_link_beside_image($content, $element_info);
     4function file_uploader_pdf2tab_add_links_picture($content, $element_info) {
     5        global $conf;
     6       
     7        $conf_file_uploader = unserialize($conf['file_uploader']);
     8       
     9        if (in_array(strtolower(substr(strrchr($element_info['file'], "."),1)), $conf_file_uploader['pdf2tab_extensions'])) {
     10                $content = file_uploader_pdf2tab_add_link_image($content, $element_info);
     11                $content = file_uploader_pdf2tab_add_link_beside_image($content, $element_info);
    1012        }
    1113       
     
    1315}
    1416
    15 function pdf2tab_add_link_image($content, $element_info) {
     17function file_uploader_pdf2tab_add_link_image($content, $element_info) {
    1618        preg_match('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i',$content,$match);
    17         $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('Open the file in a new tab').'">'.$match[0].'</a>',$content);
     19        $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('file_uploader_pdf2tab_tooltip').'">'.$match[0].'</a>',$content);
    1820       
    1921        return $content;
    2022}
    2123
    22 function pdf2tab_add_link_beside_image($content, $element_info) {
    23         $content .= '<p class="imageComment"><a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('Open the file in a new tab').'">'.l10n('Open the file in a new tab').'</a>';
     24function file_uploader_pdf2tab_add_link_beside_image($content, $element_info) {
     25        $content .= '<p class="imageComment"><a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('file_uploader_pdf2tab_tooltip').'">'.l10n('file_uploader_pdf2tab_tooltip').'</a>';
    2426       
    2527        return $content;
  • extensions/File_Uploader/plugin_pdf2tab/include/thumbnails.inc.php

    r19680 r19821  
    11<?php
    2 add_event_handler('loc_end_index_thumbnails', 'pdf2tab_thumbnails');
     2add_event_handler('loc_end_index_thumbnails', 'file_uploader_pdf2tab_thumbnails');
    33
    4 function pdf2tab_thumbnails($tpl_thumbnails_var) {
    5         global $template;
    6         include_once('constants.inc.php');
     4function file_uploader_pdf2tab_thumbnails($tpl_thumbnails_var) {
     5        global $template, $conf;
    76       
    8         $template->set_prefilter('index_thumbnails', 'pdf2tab_add_tag_thumbnails');
     7        $conf_file_uploader = unserialize($conf['file_uploader']);
    98       
    10         $template->assign('pdf2tab_supported_extensions', $supported_extensions);
    11         $template->set_filename('pdf2tab_template_thumbnails', FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'template/thumbnails.tpl');
    12         $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('pdf2tab_template_thumbnails', true));
     9        $template->set_prefilter('index_thumbnails', 'file_uploader_pdf2tab_add_tag_thumbnails');
     10       
     11        $template->assign('file_uploader_pdf2tab_supported_extensions', $conf_file_uploader['pdf2tab_extensions']);
     12        $template->set_filename('file_uploader_pdf2tab_template_thumbnails', FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'template/thumbnails.tpl');
     13        $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('file_uploader_pdf2tab_template_thumbnails', true));
    1314       
    1415        return $tpl_thumbnails_var;
    1516}
    1617
    17 function pdf2tab_add_tag_thumbnails($content, &$smarty) {
     18function file_uploader_pdf2tab_add_tag_thumbnails($content, &$smarty) {
    1819        global $template;
    1920
    2021        $search = 'class="thumbnail"';
    2122       
    22         $replacement = 'class="thumbnail" pdf2tab="{$thumbnail.path}"';
     23        $replacement = 'class="thumbnail" file_uploader_pdf2tab="{$thumbnail.path}"';
    2324        $content= str_replace($search, $replacement, $content);
    2425
  • extensions/File_Uploader/plugin_pdf2tab/template

    • Property tsvn:logtemplate set to [file_uploader]
  • extensions/File_Uploader/plugin_pdf2tab/template/thumbnails.tpl

    r19675 r19821  
    44<script type="text/javascript">
    55        //Add a link to the thumbnail
    6         function pdf2tab_link() {
     6        function file_uploader_pdf2tab_link() {
    77                $("img[class=thumbnail]").each(function() {
    8                         var filename_array = $(this).attr("pdf2tab").split(".");
     8                        var filename_array = $(this).attr("file_uploader_pdf2tab").split(".");
    99                        var filename_extension = filename_array[filename_array.length-1].toLowerCase();
    1010                       
    1111{/literal}
    12                         var pdf2tab_supported_extensions = new Array();
    13                         {foreach from=$pdf2tab_supported_extensions item=extension name=loop}
    14                                 pdf2tab_supported_extensions[{$smarty.foreach.loop.index}] = "{$extension}";
     12                        var file_uploader_pdf2tab_supported_extensions = new Array();
     13                        {foreach from=$file_uploader_pdf2tab_supported_extensions item=extension name=loop}
     14                                file_uploader_pdf2tab_supported_extensions[{$smarty.foreach.loop.index}] = "{$extension}";
    1515                        {/foreach}
    1616{literal}
    17                         if(jQuery.inArray(filename_extension, pdf2tab_supported_extensions) != -1)
     17                        if(jQuery.inArray(filename_extension, file_uploader_pdf2tab_supported_extensions) != -1)
    1818                        {
    1919                                $(this).closest('a').attr({
    2020                                        target: "_blank",
    21                                         href: $(this).attr("pdf2tab")
     21                                        href: $(this).attr("file_uploader_pdf2tab")
    2222                                });
    2323{/literal}
    24                                 $(this).attr("title","{'Open the file in a new tab'|@translate}");
     24                                $(this).attr("title","{'file_uploader_pdf2tab_tooltip'|@translate}");
    2525{literal}
    2626                        }                       
     
    3030        //When the document has finiched to load
    3131        jQuery(document).ready(function(){
    32                 pdf2tab_link();
     32                file_uploader_pdf2tab_link();
    3333        });
    3434 
    3535        //Allow pdf2tab to work with RV Thumb Scroller
    3636        jQuery(window).bind("RVTS_loaded", function(){
    37                 pdf2tab_link();
     37                file_uploader_pdf2tab_link();
    3838        });
    3939</script>
Note: See TracChangeset for help on using the changeset viewer.