- changed name of app in link-add widget to add_app, to be able to set it idependent of the other link-widgets

- added the ability to specify a default app for link-add
This commit is contained in:
Ralf Becker 2006-12-11 07:53:16 +00:00
parent 93396fe850
commit 806cc84b1e
3 changed files with 13 additions and 10 deletions

View File

@ -204,13 +204,13 @@
case 'link-add':
$apps = $this->link->app_list($type == 'link-add' ? 'add' : '');
if (!$apps) // cant do an add without apps or already created entry
if (!$apps || !$value['to_id'] || is_array($value['to_id'])) // cant do an add without apps or already created entry
{
$cell = $tmpl->empty_cell();
return;
}
asort($apps); // sort them alphabetic
$value['options-app'] = array();
$value['options-add_app'] = array();
foreach($apps as $app => $label)
{
$link = $GLOBALS['egw']->link('/index.php',$this->link->add($app,$value['to_app'],$value['to_id'])+
@ -224,7 +224,9 @@
{
$action = "location.href = '$link';";
}
$value['options-app'][$action] = $label;
$value['options-add_app'][$action] = $label;
// modify add_app default to the action used as value
if (isset($value['add_app']) && $app == $value['add_app']) $value['add_app'] = $action;
}
$tpl =& new etemplate('etemplate.link_widget.add');
break;

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="etemplate.link_widget.add" template="" lang="" group="0" version="1.3.001">
<template id="etemplate.link_widget.add" template="" lang="" group="0" version="1.3.002">
<grid>
<columns>
<column/>
@ -10,9 +10,9 @@
<rows>
<row>
<menulist>
<menupopup id="app" statustext="Add a new entry of the selected application" label="Add new" no_lang="1"/>
<menupopup id="add_app" statustext="Add a new entry of the selected application" label="Add new" no_lang="1"/>
</menulist>
<button label="Add" id="add" statustext="Add a new entry of the selected application" onclick="eval(this.form.elements[form::name('app')].value); return false;"/>
<button label="Add" id="add" statustext="Add a new entry of the selected application" onclick="eval(this.form.elements[form::name('add_app')].value); return false;"/>
</row>
</rows>
</grid>