Dotclear

Changeset 2402


Ignore:
Timestamp:
06/27/10 15:57:03 (13 years ago)
Author:
Moe
Message:

clean:config 1.4:

  • moved versions management to the Versions Manager plugin
Location:
plugins/cleanConfig
Files:
2 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/cleanConfig/_admin.php

    r1968 r2402  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of clean:config. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
     4# This file is part of clean:config, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # clean:config 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; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# clean:config is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# clean:config is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) and images are from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
  • plugins/cleanConfig/_define.php

    r2100 r2402  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of clean:config. 
    5 # Copyright 2007,2009,2010 Moe (http://gniark.net/) 
     4# This file is part of clean:config, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # clean:config 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; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# clean:config is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# clean:config is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) and images are from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
     
    2526 
    2627$this->registerModule( 
    27         /* Name */                      "clean:config", 
    28         /* Description*/                "Delete blog and global settings and plugins' versions", 
    29         /* Author */                    "Moe (http://gniark.net/)", 
    30         /* Version */                   '1.3.3', 
    31         /* Permissions */               null 
     28     /* Name        */        "clean:config", 
     29     /* Description */        "Delete blog and global settings", 
     30     /* Author      */        "Moe (http://gniark.net/)", 
     31     /* Version     */        "1.4", 
     32     /* Permissions */        null 
    3233); 
    3334?> 
  • plugins/cleanConfig/inc/lib.cleanconfig.php

    r2100 r2402  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of clean:config. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
     4# This file is part of clean:config, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # clean:config 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; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# clean:config is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# clean:config is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) and images are from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
     24 
     25if (!defined('DC_RC_PATH')) {return;} 
    2326 
    2427class cleanconfig 
     
    111114                                   { 
    112115                                        $table->row(); 
    113                                         $table->cell(__('namespace:').' <strong>'.$v['ns'].'</strong>','class="ns-name" colspan="5"'); 
     116                                        $table->cell(__('namespace:'). 
     117                                             ' <strong>'.$v['ns'].'</strong>', 
     118                                             'class="ns-name" colspan="5"'); 
    114119                                        $echo_ns = true; 
    115120                                   } 
     
    129134                                   { 
    130135                                        $value = form::field(html::escapeHTML($k.'_field'),40, 
    131                                              null,html::escapeHTML($v['value']),null,null,null,'readonly="readonly"'); 
     136                                             null,html::escapeHTML($v['value']),null,null,null, 
     137                                             'readonly="readonly"'); 
    132138                                   } 
    133139                                   $table->cell($value); 
    134140                                   $table->cell($v['type']); 
    135141                                   $table->cell($v['label'],'class="maximal"'); 
     142                                    
    136143                                   $i++; 
    137144                              } 
     
    159166          return($str); 
    160167     } 
    161  
    162      public static function versions() 
    163      { 
    164           global $core; 
    165  
    166           $table = new table('class="clear" summary="'.__('Settings').'"'); 
    167  
    168           $query = 'SELECT module, version FROM '.DC_DBPREFIX.'version WHERE (module != \'core\');'; 
    169           $rs = $core->con->select($query); 
    170  
    171           # nothing to display 
    172           if ($rs->isEmpty()) 
    173           { 
    174                return('<p class="message">'.sprintf(__('%s is empty'),DC_DBPREFIX.'version').'</p>'); 
    175           } 
    176            
    177           $str = '<form method="post" action="'.http::getSelfURI().'">'."\n"; 
    178           $table = new table('class="clear" summary="'.__('Versions').'"'); 
    179           $table->part('head'); 
    180           $table->row(); 
    181           $table->header(__('Module'),'colspan="2"'); 
    182           $table->header(__('Version'),'class="nowrap"'); 
    183  
    184           $table->part('body'); 
    185  
    186           while ($rs->fetch()) 
    187           { 
    188                $module = $rs->module; 
    189                $table->row('class="line"'); 
    190                $table->cell(form::checkbox(array('versions[]',html::escapeHTML($module)),html::escapeHTML($module))); 
    191                $table->cell('<label for="'.html::escapeHTML(html::escapeHTML($module)).'">'.$module.'</label>'); 
    192                $table->cell($rs->version); 
    193           } 
    194  
    195           $str .= $table->get(); 
    196           $str .= ('<p class="checkboxes-helpers"></p>'. 
    197                '<input type="submit" name="delete_versions" value="'.__('Delete selected versions').'" /></p>'."\n". 
    198                '<p>'.$core->formNonce().'</p>'); 
    199           $str .= '</form>'."\n"; 
    200  
    201           return($str); 
    202      } 
    203  
    204      public static function delete_version($module) 
    205      { 
    206           global $core; 
    207  
    208           # inspired by drop() function in /dotclear/inc/core/class.dc.settings.php 
    209           $strReq = 'DELETE FROM '.$core->prefix.'version '; 
    210           $strReq .= 'WHERE module = \''.$core->con->escape($module).'\';'; 
    211  
    212           $core->con->execute($strReq); 
    213      } 
    214168} 
    215169 
  • plugins/cleanConfig/index.php

    r2100 r2402  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of clean:config. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
     4# This file is part of clean:config, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # clean:config 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; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# clean:config is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# clean:config is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) and images are from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
    2324 
    2425if (!defined('DC_CONTEXT_ADMIN')) {exit;} 
     26 
     27l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); 
    2528 
    2629require_once(dirname(__FILE__).'/php-xhtml-table/class.table.php'); 
     
    5356     } 
    5457} 
    55 elseif (isset($_POST['delete_versions'])) 
    56 { 
    57      if (count($_POST['versions']) == 0) 
    58      { 
    59           $msg = __('No version deleted.'); 
    60           $default_tab = 'versions'; 
    61      } 
    62      else 
    63      { 
    64           foreach ($_POST['versions'] as $k) 
    65           { 
    66                cleanconfig::delete_version($k); 
    67           } 
    68            
    69           http::redirect($p_url.'&versionsdeleted=1'); 
    70      } 
    71 } 
    7258 
    7359if (isset($_GET['settingsdeleted'])) 
     
    7662      
    7763     $default_tab = $limit.'_settings'; 
    78 } 
    79 elseif (isset($_GET['versionsdeleted'])) 
    80 { 
    81      $msg = __('Versions deleted.'); 
    8264} 
    8365 
     
    9476     //<![CDATA[ 
    9577          <?php echo dcPage::jsVar('dotclear.msg.confirm_cleanconfig_delete', 
    96           __('Are you sure you want to delete settings?')). 
    97           dcPage::jsVar('dotclear.msg.confirm_cleanconfig_delete_versions', 
    98           __('Are you sure you want to delete versions?')); ?> 
     78          __('Are you sure you want to delete settings?')); ?> 
    9979          $(document).ready(function() { 
    10080               $('.checkboxes-helpers').each(function() { 
     
    10383               $('input[name="delete"]').click(function() { 
    10484                    return window.confirm(dotclear.msg.confirm_cleanconfig_delete); 
    105                }); 
    106                $('input[name="delete_versions"]').click(function() { 
    107                     return window.confirm(dotclear.msg.confirm_cleanconfig_delete_versions); 
    10885               }); 
    10986               $('td[class="ns-name"]').css({ cursor:"pointer" }); 
     
    133110 
    134111     <div class="multi-part" id="versions" title="<?php echo __('versions'); ?>"> 
    135           <p><?php echo(__('Deletting the version of a plugin will reinstall it if the plugin has an install process.')); ?></p> 
    136           <?php echo(cleanconfig::versions()); ?> 
     112          <p><?php printf(__('This function has been moved to the %s plugin.'), 
     113               '<a href="http://plugins.dotaddict.org/dc2/details/versionsManager">'. 
     114               __('Versions Manager').'</a>'); ?></p> 
    137115     </div> 
    138116 
Note: See TracChangeset for help on using the changeset viewer.

Sites map