Use horde-based prefs api script
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 25 Jul 2009 18:15:46 +0000 (12:15 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 25 Jul 2009 18:15:46 +0000 (12:15 -0600)
kronolith/pref_api.php [deleted file]
kronolith/templates/javascript_defs.php
skoli/pref_api.php [deleted file]
skoli/templates/list/headers.inc
skoli/templates/panel.inc
skoli/templates/search/headers.inc

diff --git a/kronolith/pref_api.php b/kronolith/pref_api.php
deleted file mode 100644 (file)
index 887a76e..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Copyright 2006-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- */
-
-require_once dirname(__FILE__) . '/lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
-
-$registry = Horde_Registry::singleton();
-
-/* Which application. */
-$app = Horde_Util::getFormData('app');
-if (!$app) {
-    echo '<ul id="app">';
-    foreach ($registry->listApps() as $app) {
-        echo '<li>' . htmlspecialchars($app) . '</li>';
-    }
-    echo '</ul>';
-    exit;
-}
-
-/* Load $app's base environment, but don't request that the app perform
- * authentication beyond Horde's. */
-$authentication = 'none';
-$appbase = $registry->get('fileroot', $app);
-require_once $appbase . '/lib/base.php';
-
-/* Which preference. */
-$pref = Horde_Util::getFormData('pref');
-if (!$pref) {
-    $_prefs = array();
-    extract(Horde::loadConfiguration('prefs.php', array('_prefs'), $app));
-
-    echo '<ul id="pref">';
-    foreach ($_prefs as $pref => $params) {
-        switch ($params['type']) {
-        case 'special':
-        case 'link':
-            break;
-
-        default:
-            echo '<li preftype="' . htmlspecialchars($params['type']) . '">' . htmlspecialchars($pref) . '</li>';
-        }
-    }
-    echo '</ul>';
-}
-
-/* Which action. */
-if (Horde_Util::getPost('pref') == $pref) {
-    /* POST for saving a pref. */
-    $prefs->setValue($pref, Horde_Util::getPost('value'));
-}
-
-/* GET returns the current value, POST returns the new value. */
-header('Content-type: text/plain');
-echo $prefs->getValue($pref);
index 34999cd..ff1500f 100644 (file)
@@ -8,7 +8,7 @@ $charset = Horde_Nls::getCharset();
 /* Variables used in core javascript files. */
 $var = array(
     'view_url' => Horde::applicationUrl('view.php'),
-    'pref_api_url' => Horde::applicationUrl('pref_api.php', true),
+    'pref_api_url' => Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/prefs/', true, -1),
     'calendar_info_url' => Horde::applicationUrl('calendars/info.php', true),
     'page_title' => $GLOBALS['registry']->get('name') . ' :: ',
 );
diff --git a/skoli/pref_api.php b/skoli/pref_api.php
deleted file mode 100644 (file)
index 5e1ab14..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * $Horde: skoli/pref_api.php,v 0.1 $
- *
- * Copyright 2006-2008 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- */
-
-@define('HORDE_BASE', dirname(dirname(__FILE__)));
-require_once HORDE_BASE . '/lib/core.php';
-
-$registry = Horde_Registry::singleton();
-
-/* Which application. */
-$app = Horde_Util::getFormData('app');
-if (!$app) {
-    echo '<ul id="app">';
-    foreach ($registry->listApps() as $app) {
-        echo '<li>' . htmlspecialchars($app) . '</li>';
-    }
-    echo '</ul>';
-    exit;
-}
-
-/* Load $app's base environment, but don't request that the app perform
- * authentication beyond Horde's. */
-$authentication = 'none';
-$appbase = $registry->get('fileroot', $app);
-require_once $appbase . '/lib/base.php';
-
-/* Which preference. */
-$pref = Horde_Util::getFormData('pref');
-if (!$pref) {
-    $_prefs = array();
-    extract(Horde::loadConfiguration('prefs.php', array('_prefs'), $app));
-
-    echo '<ul id="pref">';
-    foreach ($_prefs as $pref => $params) {
-        switch ($params['type']) {
-        case 'special':
-        case 'link':
-            break;
-
-        default:
-            echo '<li preftype="' . htmlspecialchars($params['type']) . '">' . htmlspecialchars($pref) . '</li>';
-        }
-    }
-    echo '</ul>';
-}
-
-/* Which action. */
-if (Horde_Util::getPost('pref') == $pref) {
-    /* POST for saving a pref. */
-    $prefs->setValue($pref, Horde_Util::getPost('value'));
-}
-
-/* GET returns the current value, POST returns the new value. */
-header('Content-type: text/plain');
-echo $prefs->getValue($pref);
index cbd9e1f..a4e5245 100644 (file)
@@ -16,7 +16,7 @@ function table_sortCallback(tableId, column, sortDown)
 
 function doPrefsUpdate(column, sortDown)
 {
-    baseurl = '<?php echo Horde::applicationUrl('pref_api.php', true) ?>';
+    baseurl = '<?php echo Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/prefs/', true, -1) ?>';
     try {
         column = column.substring(1);
         prefscope = 'class';
index 5e1493e..a65b4d6 100644 (file)
@@ -27,7 +27,7 @@ function sbarToggle()
         Element.addClassName(document.body, 'rightPanel');
     }
 
-    new Ajax.Request('<?php echo Horde::applicationUrl('pref_api.php', true) ?>', { parameters: { app: 'skoli', pref: 'show_panel', value: pref_value } });
+    new Ajax.Request('<?php echo Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/prefs/', true, -1) ?>', { parameters: { app: 'skoli', pref: 'show_panel', value: pref_value } });
 }
 </script>
 <a id="sbarShow" href="#" onclick="sbarToggle(); return false;"><?php echo _("Classes") ?></a>
index 601d5ab..fbf3345 100644 (file)
@@ -15,7 +15,7 @@ function table_sortCallback(tableId, column, sortDown)
 
 function doPrefsUpdate(column, sortDown)
 {
-    baseurl = '<?php echo Horde::applicationUrl('pref_api.php', true) ?>';
+    baseurl = '<?php echo Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/prefs/', true, -1) ?>';
     try {
         column = column.substring(1);
         new Ajax.Request(baseurl, { parameters: { app: 'skoli', pref: 'sortby', value: encodeURIComponent(column) } });