forked from extern/egroupware
rendering quick-add menu on clientside and content-security safe, thought not yet in idots template, also removed not used inline javascript from idots
This commit is contained in:
parent
364fbd0f66
commit
16191d4db4
@ -481,26 +481,7 @@ abstract class egw_framework
|
||||
*/
|
||||
protected static function _get_quick_add()
|
||||
{
|
||||
$apps = egw_link::app_list('add');
|
||||
asort($apps); // sort them alphabetic
|
||||
|
||||
$options = array(lang('Add').' ...');
|
||||
foreach($apps as $app => $label)
|
||||
{
|
||||
$link = egw::link('/index.php',egw_link::add($app,$GLOBALS['egw_info']['flags']['currentapp'],$GLOBALS['egw_info']['flags']['currentid'])+
|
||||
(is_array($GLOBALS['egw_info']['flags']['quick_add']) ? $GLOBALS['egw_info']['flags']['quick_add'] : array()));
|
||||
if (($popup = egw_link::is_popup($app,'add')))
|
||||
{
|
||||
list($w,$h) = explode('x',$popup);
|
||||
$action = "egw_openWindowCentered2('$link','_blank',$w,$h,'yes','$app');";
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = "egw_link_handler('$link','$app');";
|
||||
}
|
||||
$options[$action] = $label;
|
||||
}
|
||||
return html::select('quick_add','',$options,true,$options=' onchange="eval(this.value); this.value=0; return false;"');
|
||||
return '<span id="quick_add" />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,9 @@
|
||||
egw_core;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @augments Class
|
||||
*/
|
||||
egw.extend('links', egw.MODULE_GLOBAL, function() {
|
||||
|
||||
/**
|
||||
@ -54,6 +57,7 @@ egw.extend('links', egw.MODULE_GLOBAL, function() {
|
||||
* @param string $app app-name
|
||||
* @param string $name name / key in the registry, eg. 'view'
|
||||
* @return boolean|string false if $app is not registered, otherwise string with the value for $name
|
||||
* @memberOf egw
|
||||
*/
|
||||
link_get_registry: function(_app, _name)
|
||||
{
|
||||
@ -418,6 +422,35 @@ egw.extend('links', egw.MODULE_GLOBAL, function() {
|
||||
delete title_queue[app][id];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Create quick add selectbox
|
||||
*
|
||||
* @param _parent parent to create selectbox in
|
||||
* @returns
|
||||
*/
|
||||
link_quick_add: function(_parent)
|
||||
{
|
||||
var select = jQuery(document.createElement('select'));
|
||||
jQuery(typeof _parent == 'string' ? '#'+_parent : _parent).append(select);
|
||||
|
||||
var self = this;
|
||||
// bind change handler
|
||||
select.change(function(){
|
||||
if (this.value) self.open('', this.value, 'add');
|
||||
this.value = '';
|
||||
});
|
||||
// need to load common translations for app-names
|
||||
this.includeJS([this.webserverUrl+'/phpgwapi/lang.php?app=common&lang='+this.preference('lang')], function(){
|
||||
select.append(jQuery(document.createElement('option')).attr('value', '').text(self.lang('Add')+' ...'));
|
||||
var apps = self.link_app_list('add');
|
||||
for(var app in apps)
|
||||
{
|
||||
var option = jQuery(document.createElement('option')).attr('value', app).text(self.lang(apps[app]));
|
||||
select.append(option);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
<!-- BEGIN app_extra_icons_div -->
|
||||
<script language="javascript">
|
||||
new ypSlideOutMenu("menu1", "down", 10, {menu1top}, 180, 200,'right');
|
||||
egw_LAB.wait(function(){egw.link_quick_add('quick_add');});
|
||||
</script>
|
||||
|
||||
<div id="menu1Container">
|
||||
|
@ -1,43 +1,3 @@
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function opacity(id, opacStart, opacEnd, millisec) {
|
||||
//speed for each frame
|
||||
var speed = Math.round(millisec / 100);
|
||||
var timer = 0;
|
||||
|
||||
//determine the direction for the blending, if start and end are the same nothing happens
|
||||
if(opacStart > opacEnd) {
|
||||
for(i = opacStart; i >= opacEnd; i--) {
|
||||
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
|
||||
timer++;
|
||||
}
|
||||
}
|
||||
else if(opacStart < opacEnd) {
|
||||
for(i = opacStart; i <= opacEnd; i++)
|
||||
{
|
||||
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
|
||||
timer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//change the opacity for different browsers
|
||||
function changeOpac(opacity, id) {
|
||||
var object = document.getElementById(id).style;
|
||||
object.opacity = (opacity / 100);
|
||||
object.MozOpacity = (opacity / 100);
|
||||
object.KhtmlOpacity = (opacity / 100);
|
||||
object.filter = "alpha(opacity=" + opacity + ")";
|
||||
}
|
||||
function shiftOpacity(id, millisec) {
|
||||
//if an element is invisible, make it visible, else make it ivisible
|
||||
if(document.getElementById(id).style.opacity == 0) {
|
||||
opacity(id, 0, 100, millisec);
|
||||
} else {
|
||||
opacity(id, 100, 0, millisec);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="topmenu">
|
||||
<div id="topmenu_items">
|
||||
<?php foreach($this->menuitems as $mitems):?>
|
||||
@ -64,11 +24,3 @@
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<?php foreach($this->info_icons as $iicon):?>
|
||||
<?php if($iicon['blink']):?>
|
||||
setInterval("shiftOpacity('<?php print $iicon['id']?>', 500)",1500);
|
||||
<?php endif?>
|
||||
<?php endforeach?>
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user