[geeklog-cvs] geeklog: Added a Comment Default config option for the Static Pa...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Nov 29 09:07:42 EST 2009


changeset 7495:5efbfc846ad1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/5efbfc846ad1
user: Dirk Haun <dirk at haun-online.de>
date: Sun Nov 29 13:35:24 2009 +0100
description:
Added a Comment Default config option for the Static Pages plugin (feature request #0000966)

diffstat:

 plugins/staticpages/autoinstall.php             |   2 +-
 plugins/staticpages/functions.inc               |   8 +++++++-
 plugins/staticpages/install_defaults.php        |   7 ++++++-
 plugins/staticpages/language/english.php        |   6 ++++--
 plugins/staticpages/language/english_utf-8.php  |   6 ++++--
 plugins/staticpages/sql/mssql_updates.php       |  22 +++++++++++++++++++++-
 plugins/staticpages/sql/mysql_updates.php       |  22 +++++++++++++++++++++-
 public_html/admin/plugins/staticpages/index.php |   6 +++---
 public_html/docs/english/staticpages.html       |   7 +++++++
 public_html/docs/history                        |   4 +++-
 10 files changed, 77 insertions(+), 13 deletions(-)

diffs (259 lines):

diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/autoinstall.php
--- a/plugins/staticpages/autoinstall.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/autoinstall.php	Sun Nov 29 13:35:24 2009 +0100
@@ -51,7 +51,7 @@
     $info = array(
         'pi_name'         => $pi_name,
         'pi_display_name' => $pi_display_name,
-        'pi_version'      => '1.6.1',
+        'pi_version'      => '1.6.2',
         'pi_gl_version'   => '1.6.1',
         'pi_homepage'     => 'http://www.geeklog.net/'
     );
diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/functions.inc	Sun Nov 29 13:35:24 2009 +0100
@@ -1077,11 +1077,17 @@
                 }
             }
 
-            update_ConfValues_1_6_0();
+            SP_update_ConfValues_1_6_0();
 
             $current_version = '1.6.1';
             break;
 
+        case '1.6.1':
+            SP_update_ConfValues_1_6_1();
+
+            $current_version = '1.6.2';
+            break;
+
         default:
             $done = true;
         }
diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/install_defaults.php
--- a/plugins/staticpages/install_defaults.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/install_defaults.php	Sun Nov 29 13:35:24 2009 +0100
@@ -115,6 +115,9 @@
 // Display Meta Tags for static pages (1 = show, 0 = don't) 
 $_SP_DEFAULT['meta_tags'] = 0;
 
+// Whether to enable (0) or disable (-1) comments by default
+$_SP_DEFAULT['comment_code'] = -1;
+
 // Define default permissions for new pages created from the Admin panel.
 // Permissions are perm_owner, perm_group, perm_members, perm_anon (in that
 // order). Possible values:
@@ -174,6 +177,8 @@
                 0, 0, null, 110, true, 'staticpages');
         $c->add('meta_tags', $_SP_DEFAULT['meta_tags'], 'select',
                 0, 0, 0, 120, true, 'staticpages');
+        $c->add('comment_code', $_SP_DEFAULT['comment_code'], 'select',
+                0, 0, 17, 125, true, 'staticpages');
 
         $c->add('fs_whatsnew', NULL, 'fieldset',
                 0, 1, NULL, 0, true, 'staticpages');
@@ -200,7 +205,7 @@
         $c->add('fs_permissions', NULL, 'fieldset',
                 0, 3, NULL, 0, true, 'staticpages');
         $c->add('default_permissions', $_SP_DEFAULT['default_permissions'],'@select',
-                0, 3, 12, 120, true, 'staticpages');
+                0, 3, 12, 130, true, 'staticpages');
 
     }
 
diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/language/english.php
--- a/plugins/staticpages/language/english.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/language/english.php	Sun Nov 29 13:35:24 2009 +0100
@@ -142,6 +142,7 @@
     'aftersave' => 'After Saving Page',
     'atom_max_items' => 'Max. Pages in Webservices Feed',
     'meta_tags' => 'Enable Meta Tags',
+    'comment_code' => "Comment Default",
     'newstaticpagesinterval' => 'New Static Page Interval',
     'hidenewstaticpages' => 'Hide New Static Pages',
     'title_trim_length' => 'Title Trim Length',
@@ -163,14 +164,15 @@
     'fs_permissions' => 'Default Permissions'
 );
 
-// Note: entries 0, 1, 9, and 12 are the same as in $LANG_configselects['Core']
+// Note: entries 0, 1, 9, 12, 17 are the same as in $LANG_configselects['Core']
 $LANG_configselects['staticpages'] = array(
     0 => array('True' => 1, 'False' => 0),
     1 => array('True' => TRUE, 'False' => FALSE),
     2 => array('Date' => 'date', 'Page ID' => 'id', 'Title' => 'title'),
     3 => array('Date' => 'date', 'Page ID' => 'id', 'Title' => 'title', 'Label' => 'label'),
     9 => array('Forward to page' => 'item', 'Display List' => 'list', 'Display Home' => 'home', 'Display Admin' => 'admin'),
-    12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3)
+    12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
+    17 => array('Comments Enabled' => 0, 'Comments Disabled' => -1)
 );
 
 ?>
diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/language/english_utf-8.php
--- a/plugins/staticpages/language/english_utf-8.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/language/english_utf-8.php	Sun Nov 29 13:35:24 2009 +0100
@@ -142,6 +142,7 @@
     'aftersave' => 'After Saving Page',
     'atom_max_items' => 'Max. Pages in Webservices Feed',
     'meta_tags' => 'Enable Meta Tags',
+    'comment_code' => "Comment Default",
     'newstaticpagesinterval' => 'New Static Page Interval',
     'hidenewstaticpages' => 'Hide New Static Pages',
     'title_trim_length' => 'Title Trim Length',
@@ -163,14 +164,15 @@
     'fs_permissions' => 'Default Permissions'
 );
 
-// Note: entries 0, 1, 9, and 12 are the same as in $LANG_configselects['Core']
+// Note: entries 0, 1, 9, 12, 17 are the same as in $LANG_configselects['Core']
 $LANG_configselects['staticpages'] = array(
     0 => array('True' => 1, 'False' => 0),
     1 => array('True' => TRUE, 'False' => FALSE),
     2 => array('Date' => 'date', 'Page ID' => 'id', 'Title' => 'title'),
     3 => array('Date' => 'date', 'Page ID' => 'id', 'Title' => 'title', 'Label' => 'label'),
     9 => array('Forward to page' => 'item', 'Display List' => 'list', 'Display Home' => 'home', 'Display Admin' => 'admin'),
-    12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3)
+    12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
+    17 => array('Comments Enabled' => 0, 'Comments Disabled' => -1)
 );
 
 ?>
diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/sql/mssql_updates.php
--- a/plugins/staticpages/sql/mssql_updates.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/sql/mssql_updates.php	Sun Nov 29 13:35:24 2009 +0100
@@ -44,7 +44,7 @@
 * Handle update to plugin version 1.6.0: introduce meta tags option
 *
 */
-function update_ConfValues_1_6_0()
+function SP_update_ConfValues_1_6_0()
 {
     global $_CONF, $_TABLES, $_SP_DEFAULT;
 
@@ -95,4 +95,24 @@
     return true;
 }
 
+/**
+* Handle update to plugin version 1.6.1
+*
+*/
+function SP_update_ConfValues_1_6_1()
+{
+    global $_CONF, $_TABLES, $_SP_DEFAULT;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    require_once $_CONF['path'] . 'plugins/staticpages/install_defaults.php';
+
+    $c->add('comment_code', $_SP_DEFAULT['comment_code'], 'select',
+            0, 0, 17, 125, true, 'staticpages');
+
+    return true;
+}
+
 ?>
diff -r 7976884d585a -r 5efbfc846ad1 plugins/staticpages/sql/mysql_updates.php
--- a/plugins/staticpages/sql/mysql_updates.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/plugins/staticpages/sql/mysql_updates.php	Sun Nov 29 13:35:24 2009 +0100
@@ -45,7 +45,7 @@
 * Handle update to plugin version 1.6.0: introduce meta tags option
 *
 */
-function update_ConfValues_1_6_0()
+function SP_update_ConfValues_1_6_0()
 {
     global $_CONF, $_TABLES, $_SP_DEFAULT;
 
@@ -96,4 +96,24 @@
     return true;
 }
 
+/**
+* Handle update to plugin version 1.6.1
+*
+*/
+function SP_update_ConfValues_1_6_1()
+{
+    global $_CONF, $_TABLES, $_SP_DEFAULT;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    require_once $_CONF['path'] . 'plugins/staticpages/install_defaults.php';
+
+    $c->add('comment_code', $_SP_DEFAULT['comment_code'], 'select',
+            0, 0, 17, 125, true, 'staticpages');
+
+    return true;
+}
+
 ?>
diff -r 7976884d585a -r 5efbfc846ad1 public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php	Sun Nov 29 11:18:44 2009 +0100
+++ b/public_html/admin/plugins/staticpages/index.php	Sun Nov 29 13:35:24 2009 +0100
@@ -468,7 +468,7 @@
 */
 function staticpageeditor($sp_id, $mode = '', $editor = '')
 {
-    global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG_STATIC;
+    global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG_STATIC, $_SP_CONF;
 
     $retval = '';
 
@@ -484,7 +484,7 @@
         $A['unixdate'] = time();
         $A['sp_help'] = '';
         $A['sp_old_id'] = '';
-        $A['commentcode'] = $_CONF['comment_code'];
+        $A['commentcode'] = $_SP_CONF['comment_code'];
         $A['sp_where'] = 1; // default new pages to "top of page"
     } elseif (!empty($sp_id) && $mode == 'clone') {
         $result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '$sp_id'" . COM_getPermSQL('AND', 0, 3));
@@ -495,7 +495,7 @@
             $A['unixdate'] = time();
             $A['sp_hits'] = 0;
             $A['sp_old_id'] = '';
-            $A['commentcode'] = $_CONF['comment_code'];
+            $A['commentcode'] = $_SP_CONF['comment_code'];
         }
     } else {
         $A = $_POST;
diff -r 7976884d585a -r 5efbfc846ad1 public_html/docs/english/staticpages.html
--- a/public_html/docs/english/staticpages.html	Sun Nov 29 11:18:44 2009 +0100
+++ b/public_html/docs/english/staticpages.html	Sun Nov 29 13:35:24 2009 +0100
@@ -230,6 +230,13 @@
   <td>false</td>
   <td>Whether to include the meta tags of the staticpage when it is displayed.</td>
 </tr>
+<tr>
+  <td><a name="desc_comment_code">comment_code</a></td>
+  <td>-1</td>
+  <td>Allows you to define whether new Static Pages will allow comments (0) or
+    not (-1). This is only the default setting for new pages and can be
+    overridden for every single page.</td>
+</tr>
 </table>
 
 <h3><a name="whatsnew">What's New Block</a></h3>
diff -r 7976884d585a -r 5efbfc846ad1 public_html/docs/history
--- a/public_html/docs/history	Sun Nov 29 11:18:44 2009 +0100
+++ b/public_html/docs/history	Sun Nov 29 13:35:24 2009 +0100
@@ -12,8 +12,9 @@
   renamed our JavaScript remove() function to gl_cfg_remove() but forgot to
   update the dynamically created function calls (cf. bug #0000681) [Dirk]
 
-Static Pages Plugin
--------------------
+Static Pages Plugin 1.6.2
+-------------------
+- Added a Comment Default config option (feature request #0000966) [Dirk]
 - Added support for query highlighting [Dirk]
 
 



More information about the geeklog-cvs mailing list