From: Michael M Slusarz Date: Sat, 25 Jul 2009 18:15:46 +0000 (-0600) Subject: Use horde-based prefs api script X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bd3edffd0fa66238356ad14882ed6a5c4955714f;p=horde.git Use horde-based prefs api script --- diff --git a/kronolith/pref_api.php b/kronolith/pref_api.php deleted file mode 100644 index 887a76e86..000000000 --- a/kronolith/pref_api.php +++ /dev/null @@ -1,61 +0,0 @@ - - */ - -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 ''; - 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 ''; -} - -/* 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); diff --git a/kronolith/templates/javascript_defs.php b/kronolith/templates/javascript_defs.php index 34999cd98..ff1500f04 100644 --- a/kronolith/templates/javascript_defs.php +++ b/kronolith/templates/javascript_defs.php @@ -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 index 5e1ab148e..000000000 --- a/skoli/pref_api.php +++ /dev/null @@ -1,63 +0,0 @@ - - */ - -@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 ''; - 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 ''; -} - -/* 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); diff --git a/skoli/templates/list/headers.inc b/skoli/templates/list/headers.inc index cbd9e1f74..a4e5245d5 100644 --- a/skoli/templates/list/headers.inc +++ b/skoli/templates/list/headers.inc @@ -16,7 +16,7 @@ function table_sortCallback(tableId, column, sortDown) function doPrefsUpdate(column, sortDown) { - baseurl = ''; + baseurl = 'get('webroot', 'horde') . '/services/prefs/', true, -1) ?>'; try { column = column.substring(1); prefscope = 'class'; diff --git a/skoli/templates/panel.inc b/skoli/templates/panel.inc index 5e1493e34..a65b4d65a 100644 --- a/skoli/templates/panel.inc +++ b/skoli/templates/panel.inc @@ -27,7 +27,7 @@ function sbarToggle() Element.addClassName(document.body, 'rightPanel'); } - new Ajax.Request('', { parameters: { app: 'skoli', pref: 'show_panel', value: pref_value } }); + new Ajax.Request('get('webroot', 'horde') . '/services/prefs/', true, -1) ?>', { parameters: { app: 'skoli', pref: 'show_panel', value: pref_value } }); } diff --git a/skoli/templates/search/headers.inc b/skoli/templates/search/headers.inc index 601d5ab8a..fbf3345fe 100644 --- a/skoli/templates/search/headers.inc +++ b/skoli/templates/search/headers.inc @@ -15,7 +15,7 @@ function table_sortCallback(tableId, column, sortDown) function doPrefsUpdate(column, sortDown) { - baseurl = ''; + baseurl = 'get('webroot', 'horde') . '/services/prefs/', true, -1) ?>'; try { column = column.substring(1); new Ajax.Request(baseurl, { parameters: { app: 'skoli', pref: 'sortby', value: encodeURIComponent(column) } });