Ignore:
Timestamp:
Mar 20, 2016, 9:58:00 AM (8 years ago)
Author:
ddtddt
Message:

[extensions] - bmp_description - 2.8

Location:
extensions/bmp_description
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/bmp_description/index.php

    r22247 r31469  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2013 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    242// Recursive call
    253$url = '../';
  • extensions/bmp_description/initadmin.php

    r22253 r31469  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Batch Manager, Photo Description by plugin for Piwigo                 |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2013-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    322
     
    524
    625global $prefilter;
     26 
     27add_event_handler('get_batch_manager_prefilters', 'BMPD_add_batch_manager_prefilters');
     28add_event_handler('perform_batch_manager_prefilters', 'BMPD_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    729
    8   add_event_handler('get_batch_manager_prefilters', 'BMPD_add_batch_manager_prefilters');
    9   add_event_handler('perform_batch_manager_prefilters', 'BMPD_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    10 
    11 function BMPD_add_batch_manager_prefilters($prefilters)
    12 {load_language('plugin.lang', BMPD_PATH);
    13         array_push($prefilters, array(
     30function BMPD_add_batch_manager_prefilters($prefilters){
     31  array_push($prefilters, array(
    1432    'ID' => 'BMPD',
    1533    'NAME' => l10n('With no description'),
     
    1836}
    1937
    20 function BMPD_perform_batch_manager_prefilters($filter_sets, $prefilter)
    21 {
    22   if ($prefilter == 'BMPD')
    23   {
    24     $query = '
    25 SELECT id
    26   FROM '.IMAGES_TABLE.'
    27   WHERE comment is null
    28 ;';
     38function BMPD_perform_batch_manager_prefilters($filter_sets, $prefilter){
     39  if ($prefilter == 'BMPD'){
     40    $query = 'SELECT id FROM '.IMAGES_TABLE.' WHERE comment is null;';
    2941    $filter_sets[] = array_from_query($query, 'id');
    3042  }
    31  
    32         return $filter_sets;
     43  return $filter_sets;
    3344}
    3445
    35   add_event_handler('get_batch_manager_prefilters', 'BMPD2_add_batch_manager_prefilters');
    36   add_event_handler('perform_batch_manager_prefilters', 'BMPD2_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     46add_event_handler('get_batch_manager_prefilters', 'BMPD2_add_batch_manager_prefilters');
     47add_event_handler('perform_batch_manager_prefilters', 'BMPD2_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    3748
    38 function BMPD2_add_batch_manager_prefilters($prefilters)
    39 {
    40         array_push($prefilters, array(
     49function BMPD2_add_batch_manager_prefilters($prefilters){
     50  array_push($prefilters, array(
    4151    'ID' => 'BMPD2',
    4252    'NAME' => l10n('With description'),
    4353  ));
    44         return $prefilters;
     54  return $prefilters;
    4555}
    4656
    47 function BMPD2_perform_batch_manager_prefilters($filter_sets, $prefilter)
    48 {
    49   if ($prefilter == 'BMPD2')
    50   {
    51     $query = '
    52 SELECT id
    53   FROM '.IMAGES_TABLE.'
    54   WHERE comment is not null
    55 ;';
     57function BMPD2_perform_batch_manager_prefilters($filter_sets, $prefilter){
     58  if ($prefilter == 'BMPD2'){
     59    $query = 'SELECT id FROM '.IMAGES_TABLE.' WHERE comment is not null ;';
    5660    $filter_sets[] = array_from_query($query, 'id');
    5761  }
    58  
    59         return $filter_sets;
     62  return $filter_sets;
    6063}
    6164
    62 
    63  add_event_handler('loc_end_element_set_global', 'BMPD_loc_end_element_set_global');
    64  add_event_handler('element_set_global_action', 'BMPD_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     65add_event_handler('loc_end_element_set_global', 'BMPD_loc_end_element_set_global');
     66add_event_handler('element_set_global_action', 'BMPD_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    6567 
    66 function BMPD_loc_end_element_set_global()
    67  {
     68function BMPD_loc_end_element_set_global(){
    6869        global $template;
    69        
     70         $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
     71                if($PAED['state'] == 'active'){
     72                  $templatebmpd='
     73                   <input type="checkbox" name="check_BMPD4"> '.l10n('remove description').'<br>
     74                   <textarea rows="5" cols="50" placeholder="'.l10n('Type here the description')."  /  ".l10n('Use Extended Description tags...').'" class="description" name="BMPD3" id="BMPD3"></textarea><br>
     75                   <input type="checkbox" name="check_BMPD"> '.l10n('confirm').'
     76              ';
     77                }else{
     78                  $templatebmpd='
     79                   <input type="checkbox" name="check_BMPD4"> '.l10n('remove description').'<br>
     80                   <textarea rows="5" cols="50" placeholder="'.l10n('Type here the description').'" class="description" name="BMPD3" id="BMPD3"></textarea><br>
     81                   <input type="checkbox" name="check_BMPD"> '.l10n('confirm').'
     82              ';
     83                }
    7084        $template->append('element_set_global_plugins_actions', array(
    71     'ID' => 'BMPD3',
    72     'NAME' => l10n('Set description'),
    73     'CONTENT' => '
    74                                         <input type="checkbox" name="check_BMPD4"> '.l10n('remove description').'<br>
    75                                         <textarea rows="5" cols="50" class="description" name="BMPD3" id="BMPD3">'.l10n('Type here the description').'</textarea>
    76                                         <input type="checkbox" name="check_BMPD"> '.l10n('confirm').'
    77         ',
     85      'ID' => 'BMPD3',
     86      'NAME' => l10n('Set description'),
     87      'CONTENT' => $templatebmpd,
    7888        ));
    7989 }
    8090
    81 function BMPD_element_set_global_action($action, $collection)
    82  {
    83         if ($action == 'BMPD3')
    84   {
     91function BMPD_element_set_global_action($action, $collection) {
     92  if ($action == 'BMPD3'){
    8593    global $page;
    86    
    87     if (empty($_POST['check_BMPD']))
    88     {
     94    if (empty($_POST['check_BMPD'])){
    8995      array_push($page['warnings'], l10n('You need to confirm'));
    90     }
    91     else
    92     {
    93 
    94 if (isset($_POST['check_BMPD4']))
    95     {
    96       $_POST['BMPD3'] = null;
    97     }
    98    
    99 $datas = array();
    100     foreach ($collection as $image_id)
    101     {
    102       array_push(
    103         $datas,
    104         array(
    105           'id' => $image_id,
    106           'comment' => $_POST['BMPD3']
    107           )
    108         );
    109     }
    110 
    111     mass_updates(
    112       IMAGES_TABLE,
    113       array('primary' => array('id'), 'update' => array('comment')),
    114       $datas
    115       );
    116                
     96    }else{
     97          if (isset($_POST['check_BMPD4'])){
     98        $_POST['BMPD3'] = null;
     99      }
     100          $datas = array();
     101                foreach ($collection as $image_id){
     102                  array_push(
     103                        $datas,
     104                        array(
     105                          'id' => $image_id,
     106                          'comment' => $_POST['BMPD3']
     107                          )
     108                  );
     109                }
     110          mass_updates(
     111                IMAGES_TABLE,
     112                array('primary' => array('id'), 'update' => array('comment')),
     113                $datas
     114          );
    117115    }
    118116  }
    119  }
     117}
    120118
    121119?>
  • extensions/bmp_description/language/en_UK/index.php

    r22247 r31469  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    242// Recursive call
    253$url = '../';
  • extensions/bmp_description/language/en_UK/plugin.lang.php

    r22269 r31469  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Batch Manager, Photo Description by plugin for Piwigo                 |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2013-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221$lang['With description'] = 'With description';
    322$lang['With no description'] = 'Without description';
  • extensions/bmp_description/language/fr_FR/index.php

    r22247 r31469  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    242// Recursive call
    253$url = '../';
  • extensions/bmp_description/language/fr_FR/plugin.lang.php

    r22254 r31469  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Batch Manager, Photo Description by plugin for Piwigo                 |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2013-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221$lang['With description'] = 'Avec description';
    322$lang['With no description'] = 'Sans description';
  • extensions/bmp_description/main.inc.php

    r22255 r31469  
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=695
    77Author: ddtddt
    8 Author URI: http://piwigo.org/
     8Author URI: http://temmii.com/piwigo/
    99*/
     10
     11// +-----------------------------------------------------------------------+
     12// | Batch Manager, Photo Description by plugin for Piwigo                 |
     13// +-----------------------------------------------------------------------+
     14// | Copyright(C) 2013-2016 ddtddt               http://temmii.com/piwigo/ |
     15// +-----------------------------------------------------------------------+
     16// | This program is free software; you can redistribute it and/or modify  |
     17// | it under the terms of the GNU General Public License as published by  |
     18// | the Free Software Foundation                                          |
     19// |                                                                       |
     20// | This program is distributed in the hope that it will be useful, but   |
     21// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     22// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     23// | General Public License for more details.                              |
     24// |                                                                       |
     25// | You should have received a copy of the GNU General Public License     |
     26// | along with this program; if not, write to the Free Software           |
     27// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     28// | USA.                                                                  |
     29// +-----------------------------------------------------------------------+
    1030
    1131if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     
    1636define('BMPD_PATH' , PHPWG_PLUGINS_PATH . BMPD_DIR . '/');
    1737
     38add_event_handler('loading_lang', 'batch_manager_photo_description_loading_lang');       
     39function batch_manager_photo_description_loading_lang(){
     40  load_language('plugin.lang', BMPD_PATH);
     41}
     42
    1843// Plugin for admin
    1944if (script_basename() == 'admin')   
Note: See TracChangeset for help on using the changeset viewer.