new more egw-conform calling of xajax

This commit is contained in:
Pim Snel 2007-01-04 16:34:23 +00:00
parent a6131d726e
commit e95007db37
3 changed files with 4 additions and 65 deletions

View File

@ -1,55 +0,0 @@
<?php
/**
* eGW idots template ajax server
*
* @link http://www.egroupware.org
* @author Pim Snel <pim@lingewoud.nl> author of the idots template set
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage framework
* @access public
* @abstract script which is called by idots template set to store prefs using AJAX
* @version $Id$
*/
if(!$_GET['currentapp'])
{
$_GET['currentapp']='preferences';
}
$egw_flags = Array(
'currentapp' => $_GET['currentapp'],
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True,
'nofooter' => True
);
$GLOBALS['egw_info']['flags'] = $egw_flags;
require('../../../header.inc.php');
require_once(EGW_API_INC.'/xajax.inc.php');
$xajax = new xajax($GLOBALS['egw_info']['server']['webserver_url']."/phpgwapi/templates/idots/ajaxStorePrefs.php");
$xajax->registerFunction("storeEGWPref");
/**
* storeEGWPref
*
* @param mixed $repository egroupware preferences repository
* @param mixed $key key to preference
* @param mixed $value new value
* @access public
* @return mixed returns null when no erro, else return error message.
*/
function storeEGWPref($repository,$key,$value)
{
$objResponse = new xajaxResponse();
$GLOBALS['egw']->preferences->read_repository();
$GLOBALS['egw']->preferences->change($repository,$key,$value);
$GLOBALS['egw']->preferences->save_repository(True);
return $objResponse;
}
$xajax->processRequests();
?>

View File

@ -52,6 +52,8 @@ class idots_framework extends egw_framework
*/
function idots_framework($template='idots')
{
$GLOBALS['egw_info']['flags']['include_xajax'] = True;
$this->egw_framework($template); // call the constructor of the extended class
}
@ -180,7 +182,6 @@ class idots_framework extends egw_framework
$var['sideboxcolstart'] = '<td id="tdSidebox" valign="top"><div id="thesideboxcolumn" style="width:'.$sideboxwidth.'px">';
$var['sideboxcolstart'] .= '<div style="width:13px;height:13px;right:1px;top:1px;position:absolute;z-index:9999;" id="sideresize">
<img src="'.$GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/default/images'.'/resize.png" alt="resize"/>
</div>';
$var['remove_padding'] = '';
$this->tpl->set_var($var);
@ -199,13 +200,7 @@ class idots_framework extends egw_framework
$GLOBALS['egw_info']['flags']['wz_dragdrop_included'] = True;
}
require_once(EGW_API_INC.'/xajax.inc.php');
$xajax = new xajax($GLOBALS['egw_info']['server']['webserver_url']."/phpgwapi/templates/idots/ajaxStorePrefs.php");
$xajax->registerFunction("storeEGWPref");
$this->tplsav2->assign('sideboxwidth', $sideboxwidth);
$this->tplsav2->assign('xajaxobj',&$xajax);
$this->tplsav2->assign('xajaxincdir',$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js');
$GLOBALS['egw_info']['flags']['need_footer'] .= $this->tplsav2->fetch('sidebox_dhtml.tpl.php');
}

View File

@ -1,5 +1,4 @@
<!-- Savant template - sidebox dhtml -->
<?php $this->xajaxobj->printJavascript($this->xajaxincdir); ?>
<script language="JavaScript" type="text/javascript">SET_DHTML("thesideboxcolumn"+NO_DRAG)</script>
<script language="JavaScript" type="text/javascript">ADD_DHTML("sideresize"+CURSOR_W_RESIZE+MAXOFFBOTTOM+0+MAXOFFTOP+0+MAXOFFLEFT+1000+MAXOFFRIGHT+1000)</script>
<script language="JavaScript" type="text/javascript">
@ -17,6 +16,6 @@
function my_DropFunc()
{
xajax_storeEGWPref('common','idotssideboxwidth',mainbox.w);
xajax_doXMLHTTP("preferences.ajaxpreferences.storeEGWPref","common","idotssideboxwidth",mainbox.w);
}
</script>