Update of /cvsroot/php-blog/jBlog
In directory sc8-pr-cvs1:/tmp/cvs-serv17260
Modified Files:
jBlog_plugin_api.php jBlog_admin_plugins.inc.php
Log Message:
Block group placements for changing sort_order on admin_plugin. Make instatntiate_plugin add new plugin to bottom of list.
Index: jBlog_plugin_api.php
===================================================================
RCS file: /cvsroot/php-blog/jBlog/jBlog_plugin_api.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- jBlog_plugin_api.php 11 Mar 2003 03:08:20 -0000 1.11
+++ jBlog_plugin_api.php 15 Mar 2003 22:03:28 -0000 1.12
@@ -55,7 +55,14 @@
$key = $plugin_class_id . ":" . $id;
- jBlog_db_query("INSERT INTO $jBlog[dbPrefix]plugins (name) values ('$key')");
+ $rs = jBlog_db_query("SELECT MAX(sort_order) as sort_order_max FROM $jBlog[dbPrefix]plugins",true,'num');
+
+ if (is_array($rs))
+ $nextidx = intval($rs[0]+1);
+ else
+ $nextidx = 0;
+
+ jBlog_db_query("INSERT INTO $jBlog[dbPrefix]plugins (name, sort_order) values ('$key', $nextidx)");
return $key;
}
Index: jBlog_admin_plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/jBlog/jBlog_admin_plugins.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- jBlog_admin_plugins.inc.php 15 Mar 2003 08:39:29 -0000 1.6
+++ jBlog_admin_plugins.inc.php 15 Mar 2003 22:03:28 -0000 1.7
@@ -126,8 +126,6 @@
}
}
-/* very simple configuration for the moment; just change the placement */
-$plugins = jblog_plugin_api::enum_plugins();
/* list of classes for creating instances */
$classes = jblog_plugin_api::enum_plugin_classes();
@@ -189,50 +187,56 @@
}
$sort_order = 0;
-$sort_idx = 0;
-foreach ($plugins as $plugin_data) {
- $plugin =& jblog_plugin_api::load_plugin($plugin_data['name']);
+/* Block display the plugins per placement location. */
+$plugin_placements = array('left','right','hide');
+foreach ($plugin_placements as $plugin_placement) {
+ $plugins = jblog_plugin_api::enum_plugins($plugin_placement);
+ $sort_idx = 0;
+ foreach ($plugins as $plugin_data) {
+ $plugin =& jblog_plugin_api::load_plugin($plugin_data['name']);
- $key = urlencode($plugin_data['name']);
+ $key = urlencode($plugin_data['name']);
- /* query for its name, description and configuration data */
- $bag = new jBlog_property_bag;
- $plugin->introspect($bag);
+ /* query for its name, description and configuration data */
+ $bag = new jBlog_property_bag;
+ $plugin->introspect($bag);
- $name = htmlentities($bag->get('name'));
- $desc = htmlentities($bag->get('description'));
- $place = placement_box("jBlog[placement][" . $plugin_data['name'] . "]", $plugin_data['placement']);
+ $name = htmlentities($bag->get('name'));
+ $desc = htmlentities($bag->get('description'));
+ $place = placement_box("jBlog[placement][" . $plugin_data['name'] . "]", $plugin_data['placement']);
- $title = "";
- ob_start();
- $plugin->generate_content($title);
- ob_end_clean();
- if (strlen(trim($title)) == 0) {
- $title = " ";
- }
+ $title = "";
+ ob_start();
+ $plugin->generate_content($title);
+ ob_end_clean();
+ if (strlen(trim($title)) == 0) {
+ $title = " ";
+ }
- if ($bag->is_set('configuration')) {
- $url = "?jBlog[adminModule]=plugins&jBlog[plugin_to_conf]=$key";
- $desc = "<a href=\"$url\">$desc</a>";
- $name = "<a href=\"$url\">$name</a>";
- $title = "<a href=\"$url\">$title</a>";
- }
+ if ($bag->is_set('configuration')) {
+ $url = "?jBlog[adminModule]=plugins&jBlog[plugin_to_conf]=$key";
+ $desc = "<a href=\"$url\">$desc</a>";
+ $name = "<a href=\"$url\">$name</a>";
+ $title = "<a href=\"$url\">$title</a>";
+ }
- if ($sort_idx == 0)
- $moveup = " ";
- else
- $moveup = "<a href=\"?jBlog[adminModule]=plugins&submit=move+up&jBlog[plugin_to_move]=$key\">UP</a>";
+ /* Only display UP/DOWN links if there's somewhere for the plugin to go */
+ if ($sort_idx == 0)
+ $moveup = " ";
+ else
+ $moveup = "<a href=\"?jBlog[adminModule]=plugins&submit=move+up&jBlog[plugin_to_move]=$key\">UP</a>";
- if ($sort_idx == (count($plugins)-1))
- $movedown = "";
- else
- $movedown = "<a href=\"?jBlog[adminModule]=plugins&submit=move+down&jBlog[plugin_to_move]=$key\">DOWN</a>";
+ if ($sort_idx == (count($plugins)-1))
+ $movedown = "";
+ else
+ $movedown = "<a href=\"?jBlog[adminModule]=plugins&submit=move+down&jBlog[plugin_to_move]=$key\">DOWN</a>";
- echo "<tr><td><input type=\"checkbox\" name=\"jBlog[plugin_to_remove][]\" value=\"$plugin_data[name]\"></td><td>$title</td><td>$name</td><td>$desc</td><td>$place $moveup $movedown</td></tr>\n";
+ echo "<tr><td><input type=\"checkbox\" name=\"jBlog[plugin_to_remove][]\" value=\"$plugin_data[name]\"></td><td>$title</td><td>$name</td><td>$desc</td><td>$place $moveup $movedown</td></tr>\n";
- $sort_idx++;
+ $sort_idx++;
+ }
}
?>
</table>
|