[geeklog-cvs] geeklog: Calendar: Removed function calls from language arrays. ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Apr 6 12:11:30 EDT 2012


changeset 8571:3d51430f9804
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/3d51430f9804
user: Tom <websitemaster at cogeco.net>
date: Fri Apr 06 12:01:12 2012 -0400
description:
Calendar: Removed function calls from language arrays. Added functions for Geeklog Config to pull data for dropdowns. Now deals with change or delete of topics.

diffstat:

 plugins/calendar/functions.inc              |  81 +++++++++++++++++++++++++++++
 plugins/calendar/install_defaults.php       |   6 +-
 plugins/calendar/install_updates.php        |   6 +-
 plugins/calendar/language/english.php       |   4 +-
 plugins/calendar/language/english_utf-8.php |   4 +-
 5 files changed, 89 insertions(+), 12 deletions(-)

diffs (165 lines):

diff -r dbef142df357 -r 3d51430f9804 plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc	Fri Apr 06 11:57:58 2012 -0400
+++ b/plugins/calendar/functions.inc	Fri Apr 06 12:01:12 2012 -0400
@@ -2267,4 +2267,85 @@
    }
 }
 
+
+/**
+ * Config Manager function
+ *
+ * @return   array   Array of (groud id, group name) pairs
+ *
+ */
+function plugin_configmanager_select_block_group_id_calendar()
+{
+    return SEC_getUserGroups();
+}
+
+/**
+ * Config Manager function
+ *
+ * @return   array   Array of (topic id, topic name) pairs
+ *
+ */
+function plugin_configmanager_select_block_topic_calendar()
+{
+    return array_flip(TOPIC_getList());
+}
+
+/**
+* Callback function when an item was saved
+*
+* @param    string  $id     (unused) ID of item being saved
+* @param    string  $type   type of item ('article', 'staticpages', ...)
+* @param    string  $old_id (unused) previous ID of item, if != $id
+* @return   void
+* @see      PLG_itemSaved
+*
+*/
+function plugin_itemsaved_calendar($id, $type, $old_id)
+{
+    global $_TABLES, $_CA_CONF;
+
+    // we're really only interested in Topic ID changes
+    if (($type == 'topic') && !empty($old_id) && ($id != $old_id)) {
+        $key = array_search($old_id, $_CA_CONF['block_topic']);
+
+        if ($key > 0) {
+            // Update config
+            $_CA_CONF['block_topic'][$key] = $id;
+            
+            // Now save it to the configuration
+            $c = config::get_instance();
+            $c->set('block_topic', $_CA_CONF['block_topic'], 'calendar');
+        }        
+    }
+}
+
+/**
+* Callback function when an item was deleted
+*
+* @param    string  $id     ID of item being deleted
+* @param    string  $type   type of item ('article', 'staticpages', ...)
+* @return   void
+* @see      PLG_itemDeleted
+*
+*/
+function plugin_itemdeleted_calendar($id, $type)
+{
+    global $_TABLES, $_CA_CONF;
+
+    // we're really only interested in Topic Deletes
+    if ($type == 'topic') {
+        $key = array_search($id, $_CA_CONF['block_topic']);
+
+        if ($key > 0) {
+            // delete item from config
+            unset($_CA_CONF['block_topic'][$key]);
+            
+            // Now save it to the configuration
+            $c = config::get_instance();
+            $c->set('block_topic', $_CA_CONF['block_topic'], 'calendar');
+        }    
+        // Note: All topics could get deleted from array which would mean the block would not display untill user adds more in config
+    }
+}
+
 ?>
diff -r dbef142df357 -r 3d51430f9804 plugins/calendar/install_defaults.php
--- a/plugins/calendar/install_defaults.php	Fri Apr 06 11:57:58 2012 -0400
+++ b/plugins/calendar/install_defaults.php	Fri Apr 06 12:01:12 2012 -0400
@@ -197,9 +197,9 @@
         $c->add('block_order', $_CA_DEFAULT['block_order'], 'text',
                 0, 10, 0, 30, true, 'calendar', 20);
         $c->add('block_topic_option', $_CA_DEFAULT['block_topic_option'],'select',
-                0, 10, 16, 40, true, 'calendar', 20);  
+                0, 10, 15, 40, true, 'calendar', 20);  
         $c->add('block_topic', $_CA_DEFAULT['block_topic'], '%select',
-                0, 10, 17, 50, true, 'calendar', 20);
+                0, 10, NULL, 50, true, 'calendar', 20);
         
         $c->add('fs_block_permissions', NULL, 'fieldset', 0, 20, NULL, 0, true, 'calendar', 20);
         $new_group_id = 0;
@@ -216,7 +216,7 @@
             }
         }         
         $c->add('block_group_id', $new_group_id,'select',
-                0, 20, 15, 10, TRUE, 'calendar', 20);        
+                0, 20, NULL, 10, TRUE, 'calendar', 20);        
         $c->add('block_permissions', $_CA_DEFAULT['block_permissions'], '@select', 
                 0, 20, 14, 20, true, 'calendar', 20);         
     }
diff -r dbef142df357 -r 3d51430f9804 plugins/calendar/install_updates.php
--- a/plugins/calendar/install_updates.php	Fri Apr 06 11:57:58 2012 -0400
+++ b/plugins/calendar/install_updates.php	Fri Apr 06 12:01:12 2012 -0400
@@ -43,9 +43,9 @@
     $c->add('block_order', $_CA_DEFAULT['block_order'], 'text',
             0, 10, 0, 30, true, 'calendar', 20);
     $c->add('block_topic_option', $_CA_DEFAULT['block_topic_option'],'select',
-            0, 10, 16, 40, true, 'calendar', 20);  
+            0, 10, 15, 40, true, 'calendar', 20);  
     $c->add('block_topic', $_CA_DEFAULT['block_topic'], '%select',
-            0, 10, 17, 50, true, 'calendar', 20);
+            0, 10, NULL, 50, true, 'calendar', 20);
     
     $c->add('fs_block_permissions', NULL, 'fieldset', 0, 20, NULL, 0, true, 'calendar', 20);
     $new_group_id = 0;
@@ -62,7 +62,7 @@
         }
     }         
     $c->add('block_group_id', $new_group_id,'select',
-            0, 20, 15, 10, TRUE, 'calendar', 20);        
+            0, 20, NULL, 10, TRUE, 'calendar', 20);        
     $c->add('block_permissions', $_CA_DEFAULT['block_permissions'], '@select', 
             0, 20, 14, 20, true, 'calendar', 20);      
 
diff -r dbef142df357 -r 3d51430f9804 plugins/calendar/language/english.php
--- a/plugins/calendar/language/english.php	Fri Apr 06 11:57:58 2012 -0400
+++ b/plugins/calendar/language/english.php	Fri Apr 06 12:01:12 2012 -0400
@@ -249,9 +249,7 @@
     12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
     13 => array('No access' => 0, 'Use' => 2), 
     14 => array('No access' => 0, 'Read-Only' => 2),
-    15 => SEC_getUserGroups(),
-    16 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION),
-    17 => array_flip(TOPIC_getList())       
+    15 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION)
 );
 
 ?>
diff -r dbef142df357 -r 3d51430f9804 plugins/calendar/language/english_utf-8.php
--- a/plugins/calendar/language/english_utf-8.php	Fri Apr 06 11:57:58 2012 -0400
+++ b/plugins/calendar/language/english_utf-8.php	Fri Apr 06 12:01:12 2012 -0400
@@ -249,9 +249,7 @@
     12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
     13 => array('No access' => 0, 'Use' => 2), 
     14 => array('No access' => 0, 'Read-Only' => 2),
-    15 => SEC_getUserGroups(),
-    16 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION),
-    17 => array_flip(TOPIC_getList())    
+    15 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION)
 );
 
 ?>



More information about the geeklog-cvs mailing list