[nag] PATCH: Add show_external to prefs page
Jason M. Felice
jfelice at cronosys.com
Wed Jun 4 12:12:35 PDT 2003
There is a new file, nag/templates/prefs/show_external.inc, in the patch.
Since cvs diff doesn't seem to be able to add a new file when you don't
have write access to the repo, I did the last file with plain old diff.
Hope it works.
-Jay 'Eraserhead' Felice
-------------- next part --------------
Index: nag/prefs.php
===================================================================
RCS file: /repository/nag/prefs.php,v
retrieving revision 1.28
diff -u -u -r1.28 prefs.php
--- nag/prefs.php 23 May 2003 03:56:11 -0000 1.28
+++ nag/prefs.php 4 Jun 2003 18:54:40 -0000
@@ -17,6 +17,17 @@
}
}
+function handle_show_external($updated)
+{
+ global $prefs;
+
+ $show_external = Horde::getFormData('show_external');
+ if (!is_array($show_external)) {
+ $show_external = array();
+ }
+ $prefs->setValue('show_external', serialize($show_external));
+}
+
function handle_category_management($updated)
{
$actionID = Horde::getFormData('managementActionID');
Index: nag/lib/Nag.php
===================================================================
RCS file: /repository/nag/lib/Nag.php,v
retrieving revision 1.76
diff -u -u -r1.76 Nag.php
--- nag/lib/Nag.php 4 Jun 2003 03:38:54 -0000 1.76
+++ nag/lib/Nag.php 4 Jun 2003 18:54:40 -0000
@@ -131,12 +131,9 @@
$apps = @unserialize($prefs->getValue('show_external'));
if (is_array($apps)) {
foreach ($apps as $app) {
- if ($app != 'nag' && $registry->hasMethod('getListTypes', $app)) {
- $types = $registry->callByPackage($app, 'getListTypes');
- if (!empty($types['taskHash'])) {
- $newtasks = $registry->callByPackage($app, 'listAs', array('taskHash'));
- $tasks = array_merge($tasks, $newtasks);
- }
+ if ($registry->hasMethod('getListTypes', $app)) {
+ $newtasks = $registry->callByPackage($app, 'listAs', array('taskHash'));
+ $tasks = array_merge($tasks, $newtasks);
}
}
}
--- nag/templates/prefs/show_external.inc.orig 1969-12-31 19:00:00.000000000 -0500
+++ nag/templates/prefs/show_external.inc 2003-06-04 15:01:11.000000000 -0400
@@ -0,0 +1,22 @@
+<?php
+
+global $registry;
+$apps = $registry->listApps();
+foreach ($apps as $app) {
+ if ($app != 'nag' && $registry->hasMethod('getListTypes', $app)) {
+ $types = $registry->callByPackage($app, 'getListTypes');
+ if (!empty ($types['taskHash'])) {
+ $options[$app] = $registry->getParam('name', $app) . ' ('.$app.')';
+ }
+ }
+}
+
+$current = @unserialize($prefs->getValue($pref));
+
+?><?php echo $_prefs[$pref]['desc'] ?> <?php echo $helplink ?><br />
+<select multiple="multiple" size="4" name="<?php echo $pref ?>[]">
+<?php foreach ($options as $key => $val): ?>
+<option<?php echo in_array($key,$current) ? ' selected="selected" ' : '' ?> value="<?php echo $key ?>"><?php echo $val ?></option>
+<?php endforeach ?>
+</select>
+<br />
More information about the nag
mailing list