[geeklog-cvs] geeklog: Merged with upstream

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Mar 22 18:29:49 EDT 2012


changeset 8544:2b367c53d578
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/2b367c53d578
user: Rouslan Placella <rouslan at placella.com>
date: Thu Mar 22 21:59:49 2012 +0000
description:
Merged with upstream

diffstat:

 language/english.php           |  15 +++++----
 language/english_utf-8.php     |  15 +++++----
 plugins/calendar/functions.inc |  48 ++++++++++++++++++++++++++++++-
 plugins/polls/functions.inc    |  47 ++++++++++++++++++++++++++++++-
 public_html/admin/block.php    |  63 +++++++++++++++++++++++++++++++++++++++--
 system/lib-admin.php           |  53 +++++++++++++++++++++++++++++++++++
 system/lib-plugins.php         |  41 ++++++++++++++++++++++++++-
 7 files changed, 258 insertions(+), 24 deletions(-)

diffs (truncated from 448 to 300 lines):

diff -r bcb520dc928a -r 2b367c53d578 language/english.php
--- a/language/english.php	Thu Mar 22 21:58:16 2012 +0000
+++ b/language/english.php	Thu Mar 22 21:59:49 2012 +0000
@@ -690,8 +690,8 @@
     2 => 'You do not have the necessary rights to edit this block.',
     3 => 'Block Editor',
     4 => 'There was a problem reading this feed (see error.log for details).',
-    5 => '',
-    6 => '',
+    5 => 'Yes',
+    6 => 'No',
     7 => 'All',
     8 => 'Block Security Level',
     9 => 'Block Order',
@@ -705,12 +705,12 @@
     17 => 'Block Content',
     18 => 'Please fill in the Block Title and Content fields',
     19 => 'Block Manager',
-    20 => '',
+    20 => 'Regular Blocks',
     21 => 'Block SecLev',
-    22 => '',
+    22 => 'Dynamic Blocks',
     23 => 'Block Order',
-    24 => '',
-    25 => 'To modify or delete a block, click on that block\'s edit icon below.  To create a new block, click on "Create New" above. To move a block, click on the arrows or [R] and [L] boxes.',
+    24 => 'Dynamic',
+    25 => 'To modify or delete a regular block, click on that block\'s edit icon below.  To create a new regular block, click on "Create New" above. To move a regular block, click on the arrows or [R] and [L] boxes. To edit dynamic blocks check the plugin configuration that the block is related too.',
     26 => 'Layout Block',
     27 => 'PHP Block',
     28 => 'PHP Block Options',
@@ -753,7 +753,8 @@
     65 => 'Order',
     66 => 'Autotags',
     67 => 'Check to allow autotags',
-    68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.'
+    68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.',
+    69 => 'Plugin Name'
 );
 
 ###############################################################################
diff -r bcb520dc928a -r 2b367c53d578 language/english_utf-8.php
--- a/language/english_utf-8.php	Thu Mar 22 21:58:16 2012 +0000
+++ b/language/english_utf-8.php	Thu Mar 22 21:59:49 2012 +0000
@@ -692,8 +692,8 @@
     2 => 'You do not have the necessary rights to edit this block.',
     3 => 'Block Editor',
     4 => 'There was a problem reading this feed (see error.log for details).',
-    5 => '',
-    6 => '',
+    5 => 'Yes',
+    6 => 'No',
     7 => 'All',
     8 => 'Block Security Level',
     9 => 'Block Order',
@@ -707,12 +707,12 @@
     17 => 'Block Content',
     18 => 'Please fill in the Block Title and Content fields',
     19 => 'Block Manager',
-    20 => '',
+    20 => 'Regular Blocks',
     21 => 'Block SecLev',
-    22 => '',
+    22 => 'Dynamic Blocks',
     23 => 'Block Order',
-    24 => '',
-    25 => 'To modify or delete a block, click on that block\'s edit icon below.  To create a new block, click on "Create New" above. To move a block, click on the arrows or [R] and [L] boxes.',
+    24 => 'Dynamic',
+    25 => 'To modify or delete a regular block, click on that block\'s edit icon below.  To create a new regular block, click on "Create New" above. To move a regular block, click on the arrows or [R] and [L] boxes. To edit dynamic blocks check the plugin configuration that the block is related too.',
     26 => 'Layout Block',
     27 => 'PHP Block',
     28 => 'PHP Block Options',
@@ -755,7 +755,8 @@
     65 => 'Order',
     66 => 'Autotags',
     67 => 'Check to allow autotags',
-    68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.'
+    68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.',
+    69 => 'Plugin Name'
 );
 
 ###############################################################################
diff -r bcb520dc928a -r 2b367c53d578 plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc	Thu Mar 22 21:58:16 2012 +0000
+++ b/plugins/calendar/functions.inc	Thu Mar 22 21:59:49 2012 +0000
@@ -2158,10 +2158,11 @@
     if ($_CA_CONF['block_enable'] && SEC_hasAccess($owner_id, $_CA_CONF['block_group_id'], $_CA_CONF['block_permissions'][0], $_CA_CONF['block_permissions'][1], $_CA_CONF['block_permissions'][2], $_CA_CONF['block_permissions'][3])) {
         // Check if right topic
         if (($_CA_CONF['block_topic_option'] == TOPIC_ALL_OPTION) || ($_CA_CONF['block_topic_option'] == TOPIC_HOMEONLY_OPTION && COM_onFrontpage()) || ($_CA_CONF['block_topic_option'] == TOPIC_SELECTED_OPTION && in_array($topic, $_CA_CONF['block_topic']))) {
-            if (($side=='left' && $_CA_CONF['block_isleft'] == 1) || ($side=='right' && $_CA_CONF['block_isleft'] == 0)) { // Create a block
+            if (($side=='left' && $_CA_CONF['block_isleft'] == 1) || ($side=='right' && $_CA_CONF['block_isleft'] == 0)) { 
+                // Create a block
                 $display = phpblock_calendar();
                 
-                $retval[] = array('name'           => 'polls',
+                $retval[] = array('name'           => 'events',
                                   'type'           => 'dynamic',
                                   'onleft'         => $_CA_CONF['block_isleft'],
                                   'title'          => $LANG_CAL_1[50],
@@ -2176,6 +2177,49 @@
     return $retval;
 }
 
+
+/**
+* Gets config information for dynamic blocks from plugins
+*
+* Returns data for blocks on a given side and, potentially, for
+* a given topic.
+*
+* @param    string  $side   Side to get blocks for (right or left for now)
+* @param    string  $topic  Only get blocks for this topic
+* @return   array           array of block data
+* @link     http://wiki.geeklog.net/index.php/Dynamic_Blocks
+*
+*/
+function plugin_getBlocksConfig_calendar($side, $topic='')
+{
+    global $_TABLES, $_CONF, $_CA_CONF, $LANG_CAL_1;
+    
+    $retval = array();
+    
+    $owner_id = SEC_getDefaultRootUser();
+    
+    // Check permissions first
+    if (SEC_hasAccess($owner_id, $_CA_CONF['block_group_id'], $_CA_CONF['block_permissions'][0], $_CA_CONF['block_permissions'][1], $_CA_CONF['block_permissions'][2], $_CA_CONF['block_permissions'][3])) {
+        if (($side=='left' && $_CA_CONF['block_isleft'] == 1) || ($side=='right' && $_CA_CONF['block_isleft'] == 0)) { 
+            $retval[] = array('plugin'         => $LANG_CAL_1[16],
+                              'name'           => 'events',
+                              'title'          => $LANG_CAL_1[50],
+                              'type'           => 'dynamic',
+                              'onleft'         => $_CA_CONF['block_isleft'],
+                              'blockorder'     => $_CA_CONF['block_order'],
+                              'allow_autotags' => false,
+                              'help'           => '',
+                              'enable'         => $_CA_CONF['block_enable'],
+                              'topic_option'   => $_CA_CONF['block_topic_option'],
+                              'topic'          => $_CA_CONF['block_topic'],
+                              'inherit'        => array()
+                              );
+        }
+    }
+    
+    return $retval;
+}
+
 /**
 * This function is called to inform plugins when a group's information has
 * changed or a new group has been created.
diff -r bcb520dc928a -r 2b367c53d578 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Thu Mar 22 21:58:16 2012 +0000
+++ b/plugins/polls/functions.inc	Thu Mar 22 21:59:49 2012 +0000
@@ -1774,12 +1774,13 @@
     $retval = array();
     
     $owner_id = SEC_getDefaultRootUser();
-
+    
     // Check permissions first
     if ($_PO_CONF['block_enable'] && SEC_hasAccess($owner_id, $_PO_CONF['block_group_id'], $_PO_CONF['block_permissions'][0], $_PO_CONF['block_permissions'][1], $_PO_CONF['block_permissions'][2], $_PO_CONF['block_permissions'][3])) {
         // Check if right topic
         if (($_PO_CONF['block_topic_option'] == TOPIC_ALL_OPTION) || ($_PO_CONF['block_topic_option'] == TOPIC_HOMEONLY_OPTION && COM_onFrontpage()) || ($_PO_CONF['block_topic_option'] == TOPIC_SELECTED_OPTION && in_array($topic, $_PO_CONF['block_topic']))) {
-            if (($side=='left' && $_PO_CONF['block_isleft'] == 1) || ($side=='right' && $_PO_CONF['block_isleft'] == 0)) { // Create a block
+            if (($side=='left' && $_PO_CONF['block_isleft'] == 1) || ($side=='right' && $_PO_CONF['block_isleft'] == 0)) { 
+                // Create a block
                 $display = phpblock_polls();
                 
                 $retval[] = array('name'           => 'polls',
@@ -1798,6 +1799,48 @@
 }
 
 /**
+* Gets config information for dynamic blocks from plugins
+*
+* Returns data for blocks on a given side and, potentially, for
+* a given topic.
+*
+* @param    string  $side   Side to get blocks for (right or left for now)
+* @param    string  $topic  Only get blocks for this topic
+* @return   array           array of block data
+* @link     http://wiki.geeklog.net/index.php/Dynamic_Blocks
+*
+*/
+function plugin_getBlocksConfig_polls($side, $topic='')
+{
+    global $_TABLES, $_CONF, $_PO_CONF, $LANG_POLLS;
+    
+    $retval = array();
+    
+    $owner_id = SEC_getDefaultRootUser();
+    
+    // Check permissions first
+    if (SEC_hasAccess($owner_id, $_PO_CONF['block_group_id'], $_PO_CONF['block_permissions'][0], $_PO_CONF['block_permissions'][1], $_PO_CONF['block_permissions'][2], $_PO_CONF['block_permissions'][3])) {
+        if (($side=='left' && $_PO_CONF['block_isleft'] == 1) || ($side=='right' && $_PO_CONF['block_isleft'] == 0)) { 
+            $retval[] = array('plugin'         => $LANG_POLLS['polls'],
+                              'name'           => 'polls',
+                              'title'          => $LANG_POLLS['poll'],
+                              'type'           => 'dynamic',
+                              'onleft'         => $_PO_CONF['block_isleft'],
+                              'blockorder'     => $_PO_CONF['block_order'],
+                              'allow_autotags' => false,
+                              'help'           => '',
+                              'enable'         => $_PO_CONF['block_enable'],
+                              'topic_option'   => $_PO_CONF['block_topic_option'],
+                              'topic'          => $_PO_CONF['block_topic'],
+                              'inherit'        => array()
+                              );
+        }
+    }
+    
+    return $retval;
+}
+
+/**
 * This function is called to inform plugins when a group's information has
 * changed or a new group has been created.
 *
diff -r bcb520dc928a -r 2b367c53d578 public_html/admin/block.php
--- a/public_html/admin/block.php	Thu Mar 22 21:58:16 2012 +0000
+++ b/public_html/admin/block.php	Thu Mar 22 21:59:49 2012 +0000
@@ -383,7 +383,8 @@
 
     reorderblocks();
     
-    // writing the list
+    // Left
+    // Regular Blocks
     $header_arr = array(      # display 'text' and use table field 'field'
         array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false),
         array('text' => $LANG21[65], 'field' => 'blockorder', 'sort' => true),
@@ -399,6 +400,7 @@
 
     $text_arr = array(
         'has_extras' => true,
+		'title'      => "$LANG21[20] ($LANG21[40])",
         'form_url'   => $_CONF['site_admin_url'] . '/block.php'
     );
 
@@ -419,13 +421,39 @@
                     . XHTML . '>'
     );
 
-    $retval .= ADMIN_list(
+	$retval .= ADMIN_list(
         'blocks', 'ADMIN_getListField_blocks', $header_arr, $text_arr,
         $query_arr, $defsort_arr, '', $token, '', $form_arr
     );
+    
 
-    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
+    // Dynamic blocks 
+    $dyn_header_arr = array(      # display 'text' and use table field 'field'
+        array('text' => $LANG21[65], 'field' => 'blockorder', 'sort' => true),
+        array('text' => $LANG21[69], 'field' => 'plugin', 'sort' => true),
+        array('text' => $LANG_ADMIN['title'], 'field' => 'title', 'sort' => true),
+        array('text' => $LANG21[48], 'field' => 'name', 'sort' => true),
+        array('text' => $LANG_ADMIN['type'], 'field' => 'type', 'sort' => true),
+        array('text' => $LANG_ADMIN['topic'], 'field' => 'topic', 'sort' => true),
+        array('text' => $LANG_ADMIN['enabled'], 'field' => 'is_enabled', 'sort' => true)
+    );    
 
+	
+	$dyn_text_arr = array(
+        'title'      => "$LANG21[22] ($LANG21[40])",
+    );
+	
+	$leftblocks = PLG_getBlocksConfig('left', '', true);    
+	
+	// Sort Dynamic Blocks on Block Order
+    usort($leftblocks, "cmpDynamicBlocks");
+
+	$retval .= ADMIN_simpleList('ADMIN_getListField_dynamicblocks', $dyn_header_arr, $dyn_text_arr,
+                    $leftblocks, '', $form_arr);
+	
+
+    // Right
+    // Regular Blocks	
     $query_arr = array(
         'table' => 'blocks',
         'sql' => "SELECT * FROM {$_TABLES['blocks']} WHERE onleft = 0",
@@ -435,7 +463,7 @@
 
     $text_arr = array(
         'has_extras' => true,
-        'title'      => "$LANG21[19] ($LANG21[41])",
+        'title'      => "$LANG21[20] ($LANG21[41])",
         'form_url'   => $_CONF['site_admin_url'] . '/block.php'
     );
 
@@ -453,10 +481,37 @@
         $query_arr, $defsort_arr, '', $token, '', $form_arr
     );
 
+	// Dynamic blocks
+	$dyn_text_arr = array(
+        'title'      => "$LANG21[22] ($LANG21[41])",
+    );
+	
+	$rightblocks = PLG_getBlocksConfig('right', '', true);
+	



More information about the geeklog-cvs mailing list