using jQueryUI resizable to resize sidebox, getting it to work under CSP that way

This commit is contained in:
Ralf Becker 2013-10-08 12:06:07 +00:00
parent f46754cd1a
commit 6cfd7b22b7
5 changed files with 5 additions and 76 deletions

View File

@ -1,12 +0,0 @@
function dragSidebar()
{
if(!dd.obj.sideresizeStart) { dd.obj.sideresizeStart = dd.obj.x; }
var mainbox = dd.elements.thesideboxcolumn;
mainbox.resizeTo(dd.obj.x-dd.obj.sideresizeStart+parseInt(dd.obj.my_sideboxwidth), mainbox.h);
}
function dropSidebar()
{
var mainbox = dd.elements.thesideboxcolumn;
xajax_doXMLHTTP("preferences.ajaxpreferences.storeEGWPref",egw_appName,"idotssideboxwidth",mainbox.w);
}

View File

@ -310,8 +310,6 @@ egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['acc
$var['sideboxcolend'] = '</div></td>';
$this->tplsav2->assign('sideboxwidth', $sideboxwidth);
$GLOBALS['egw_info']['flags']['need_footer'] .= $this->tplsav2->fetch('sidebox_dhtml.tpl.php');
}
}
else

View File

@ -76,5 +76,10 @@
// return false to not execute link itself, which would violate CSP
return false;
});
// make sidebox resizable with jQueryUI resizable
jQuery('#thesideboxcolumn').resizable({handles: 'e', minWidth: 200, stop: function(event, ui){
egw.set_preference(egw_appName, 'idotssideboxwidth', ui.size.width);
}});
});
})();

View File

@ -1,26 +0,0 @@
<?php
require_once(EGW_INCLUDE_ROOT . '/phpgwapi/inc/class.dragdrop.inc.php');
if($GLOBALS['egw_info']['user']['preferences']['common']['enable_dragdrop'])
{
$dragdrop = new dragdrop();
$maxOffLeft = $this->sideboxwidth - 200;
$maxOffRight = 500 - $this->sideboxwidth;
$maxOffLeft < 0 && $maxOffLeft = 0;
$maxOffRight < 0 && $maxOffRight = 0;
$dragdrop->addCustom(
'thesideboxcolumn',
array('NO_DRAG')
);
$dragdrop->addCustom(
'sideresize',
array('CURSOR_W_RESIZE','HORIZONTAL','MAXOFFLEFT+'.$maxOffLeft,'MAXOFFRIGHT+'.$maxOffRight),
array('sideboxwidth'=>$this->sideboxwidth),
'phpgwapi.dragDropFunctions.dragSidebar',
'phpgwapi.dragDropFunctions.dropSidebar'
);
$dragdrop->setJSCode();
}

View File

@ -1,36 +0,0 @@
<?php
/**
* EGroupware - set presonal preferences via ajax
*
* @package preferences
* @copyright Lingewoud B.V.
* @link http://www.egroupware.org
* @author Pim Snel <pim-AT-lingewoud-DOT-nl>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Script which is called to store prefs using AJAX
*/
class ajaxpreferences
{
/**
* storeEGWPref
*
* @param mixed $appname appname
* @param mixed $key name of preference
* @param mixed $value new value
* @access public
* @return mixed returns null when no erro, else return error message.
*/
function storeEGWPref($appname,$key,$value)
{
$response = new xajaxResponse();
$GLOBALS['egw']->preferences->read_repository();
$GLOBALS['egw']->preferences->add($appname,$key,$value);
$GLOBALS['egw']->preferences->save_repository(True);
//$response->addAlert(__METHOD__."('$appname','$key','$value')");
return $response->getXML();
}
}