Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26400
Modified Files:
serendipity_admin_plugins.inc.php
serendipity_sidebar_items.php
Log Message:
- Fix b0rked TOP EXITS/TOP REFERRERS
- added "tristate" config variable type
- some cleanup in radio button generation
- some cleanup in top exit/top referrer default generation
- NOTE: patch incomplete, but s9y will run
-- will add: english translation upgrade
-- config still not written (must find out how)
Index: serendipity_sidebar_items.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_sidebar_items.php,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- serendipity_sidebar_items.php 26 Jul 2004 13:52:02 -0000 1.77
+++ serendipity_sidebar_items.php 28 Jul 2004 17:59:47 -0000 1.78
@@ -131,7 +131,7 @@
break;
case 'use_links':
- $propbag->add('type', 'boolean');
+ $propbag->add('type', 'tristate');
$propbag->add('name', INSTALL_TOP_AS_LINKS);
$propbag->add('description', INSTALL_TOP_AS_LINKS_DESC);
$propbag->add('default', false);
@@ -148,12 +148,15 @@
$title = TOP_REFERRER;
- $use_links = $this->get_config('use_links', 'none');
- if ($use_links == 'none' && !serendipity_get_config_var('top_as_links', false, true)) {
- // If the user made no selection and he has 'top_as_links' switched off, we will not emit a link!
- $use_links = false;
- } elseif (serendipity_db_bool($use_links) === false) {
- $use_links = false;
+ // get local configuration (default, true, false)
+ $use_links = $this->get_config('use_links', 'default');
+ // get global configuration (true, false)
+ $global_use_link = serendipity_db_bool(serendipity_get_config_var('top_as_links', false, true));
+ // if local configuration say to use global default, do so
+ if ($use_links == 'default') {
+ $use_links = $global_use_link;
+ } else {
+ $use_links = serendipity_db_bool($use_links);
}
echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links);
@@ -179,7 +182,7 @@
break;
case 'use_links':
- $propbag->add('type', 'boolean');
+ $propbag->add('type', 'tristate');
$propbag->add('name', INSTALL_TOP_AS_LINKS);
$propbag->add('description', INSTALL_TOP_AS_LINKS_DESC);
$propbag->add('default', true);
@@ -196,15 +199,18 @@
$title = TOP_EXITS;
- $use_links = $this->get_config('use_links', 'none');
- if ($use_links == 'none' && !serendipity_get_config_var('top_as_links', true)) {
- // If the user made no selection and he has 'top_as_links' switched off, we will not emit a link!
- $use_links = false;
- } elseif (serendipity_db_bool($use_links) === false) {
- $use_links = false;
+ // get local configuration (default, true, false)
+ $use_links = $this->get_config('use_links', 'default');
+ // get global configuration (true, false)
+ $global_use_link = serendipity_db_bool(serendipity_get_config_var('top_as_links', false, true));
+ // if local configuration say to use global default, do so
+ if ($use_links == 'default') {
+ $use_links = $global_use_link;
+ } else {
+ $use_links = serendipity_db_bool($use_links);
}
- echo serendipity_displayTopExits($this->get_config('limit', 10), $use_links);
+ echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links);
}
}
Index: serendipity_admin_plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_plugins.inc.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- serendipity_admin_plugins.inc.php 27 Jul 2004 11:48:36 -0000 1.38
+++ serendipity_admin_plugins.inc.php 28 Jul 2004 17:59:47 -0000 1.39
@@ -394,6 +394,11 @@
<?php
break;
+ case 'tristate':
+ $per_row = 3;
+ $radio['value'][] = 'default';
+ $radio['desc'][] = USE_DEFAULT;
+
case 'boolean':
$radio['value'][] = 'true';
$radio['desc'][] = YES;
@@ -406,9 +411,11 @@
$radio = $cbag->get('radio');
}
- $per_row = $cbag->get('radio_per_row');
if (empty($per_row)) {
- $per_row = 2;
+ $per_row = $cbag->get('radio_per_row');
+ if (empty($per_row)) {
+ $per_row = 2;
+ }
}
?>
<tr>
@@ -427,13 +434,20 @@
foreach($radio['value'] AS $radio_index => $radio_value) {
$id = htmlspecialchars($config_item . $radio_value);
$counter++;
+ $checked = "";
+ if ($radio_value == 'true' && $hvalue === true)
+ $checked = " checked";
+ if ($radio_value == 'false' && $is_unset == false && hvalue === false)
+ $checked = " checked";
+ if ($radio_value == $hvalue)
+ $checked = " checked";
if ($counter == 1) {
?>
<div>
<?php
}
?>
- <input type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo (($radio_value == $hvalue || ($radio_value == 'true' && $hvalue == true) || ($radio_value == 'false' && $is_unset == false && $hvalue == false)) ? 'checked="checked"' : ''); ?> title="<?php echo htmlspecialchars($radio['desc'][$radio_index]); ?>" />
+ <input type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo $checked ?> title="<?php echo htmlspecialchars($radio['desc'][$radio_index]); ?>" />
<label for="serendipity_plugin_<?php echo $id; ?>"><?php echo htmlspecialchars($radio['desc'][$radio_index]); ?></label>
<?php
if ($counter == $per_row) {
|