- Disable custom tab if there are no cfs defined

- Use link_title for resource accessories in list
- Pre-set category according to list filter or parent resource
This commit is contained in:
Nathan Gray 2012-12-03 20:20:42 +00:00
parent d0fa6110d1
commit 5aaaca3c81
4 changed files with 28 additions and 14 deletions

View File

@ -195,7 +195,7 @@ class resources_bo
$accessories = $this->get_acc_list($resource['res_id']);
foreach($accessories as $acc_id => $acc_name)
{
$resource['accessories'][] = array('acc_id' => $acc_id, 'name' => $acc_name);
$resource['accessories'][] = array('acc_id' => $acc_id, 'name' => $this->link_title($acc_id));
}
} elseif ($resource['accessory_of'] > 0) {
$resource['accessory_of_label'] = $this->link_title($resource['accessory_of']);

View File

@ -43,7 +43,6 @@ class resources_ui
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param array $content content from eTemplate callback
*
* FIXME don't translate cats in nextmach
*/
function index($content='')
{
@ -350,7 +349,7 @@ class resources_ui
if($resource['accessory_of'] > 0)
{
$resource['accessory_of'] = -1;
$this->bo->save($acc);
$this->bo->save($resource);
$promoted_accessories++;
continue;
}
@ -451,6 +450,16 @@ class resources_ui
'to_id' => $res_id,
'to_app' => 'resources'
);
} elseif ($accessory_of) {
// Pre-set according to parent
$owner = $this->bo->read($accessory_of);
$content['cat_id'] = $owner['cat_id'];
$content['bookable'] = true;
} else {
// New resource
$nm_session_data = $GLOBALS['egw']->session->appsession('session_data','resources_index_nm');
$content['cat_id'] = $nm_session_data['filter'];
$content['bookable'] = true;
}
if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
@ -469,7 +478,7 @@ class resources_ui
$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
}
$search_options = array('accessory_of' => -1);
$sel_options['accessory_of'] = array(-1 => lang('none')) + $this->bo->link_query('',$search_options);
$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options);
if($res_id) unset($sel_options['accessory_of'][$res_id]);
// $content['general|page|pictures|links'] = 'resources.edit_tabs.page'; //debug
@ -484,8 +493,9 @@ class resources_ui
{
$read_only['delete'] = true;
}
// Disable accessories tab for accessories
$readonly['tabs']['accessories'] = ($content['accessory_of'] != -1);
// Disable custom tab if there are no custom fields defined
$read_only['tabs']['custom'] = !(config::get_customfields('resources',true));
$preserv = $content;
$this->tmpl->read('resources.edit');

View File

@ -2,7 +2,7 @@
/**
* EGroupware - eTemplates for Application resources
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2012-11-27 11:06
* generated by soetemplate::dump4setup() 2012-12-03 13:18
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package resources
@ -32,11 +32,11 @@ $templ_data[] = array('name' => 'resources.edit.page','template' => '','lang' =>
$templ_data[] = array('name' => 'resources.edit.pictures','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:4:",top";s:2:"h2";s:4:"100%";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:2:{s:4:"type";s:5:"image";s:4:"name";s:16:"resource_picture";}i:2;a:1:{s:4:"type";s:5:"label";}}i:2;a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";i:1;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:0:{}i:1;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:26:"Use general resources icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"gen_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:12:"gen_src_list";}}i:2;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:23:"Use the category\'s icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"cat_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:15:"Use own picture";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"own_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:2:{s:4:"type";s:4:"file";s:4:"name";s:8:"own_file";}}}s:4:"rows";i:3;s:4:"cols";i:3;}s:5:"label";s:14:"picture source";}}}i:2;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:1;s:4:"size";s:7:"700,380";s:7:"options";a:2:{i:0;s:3:"700";i:1;s:3:"380";}}}','size' => '700,380','style' => '','modified' => '1352913451',);
$templ_data[] = array('name' => 'resources.edit_buttons','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:1:"D";s:4:"100%";}i:1;a:4:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";s:4:"help";s:21:"Saves entry and exits";}s:1:"B";a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:5:"apply";}s:1:"C";a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:7:"onclick";s:15:"window.close();";}s:1:"D";a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:5:"align";s:5:"right";s:4:"name";s:6:"delete";s:7:"onclick";s:61:"return confirm(\'Do you really want do delte this resource?\');";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:4:"100%";s:4:"name";s:6:"button";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '','modified' => '1093597552',);
$templ_data[] = array('name' => 'resources.edit_buttons','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:1:"D";s:4:"100%";}i:1;a:4:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";s:4:"help";s:21:"Saves entry and exits";}i:2;a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:5:"apply";}s:4:"span";s:1:"3";i:3;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:7:"onclick";s:15:"window.close();";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:5:"align";s:5:"right";s:4:"name";s:6:"delete";s:7:"onclick";s:61:"return confirm(\'Do you really want do delte this resource?\');";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:4:"100%";s:4:"name";s:6:"button";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '','modified' => '1093597552',);
$templ_data[] = array('name' => 'resources.edit_pictures','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:3:{s:2:"c1";s:3:"nmr";s:2:"c2";s:3:"nmr";s:2:"c3";s:3:"nmr";}i:1;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:26:"Use general resources icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"gen_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:12:"gen_src_list";}}i:2;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:23:"Use the category\'s icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"cat_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:15:"Use own picture";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"own_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:2:{s:4:"type";s:4:"file";s:4:"name";s:8:"own_file";}}}s:4:"rows";i:3;s:4:"cols";i:3;}}','size' => '','style' => '','modified' => '1108638846',);
$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:7:"row_off";s:1:"A";s:3:"700";s:2:"h2";s:4:"100%";}i:1;a:3:{s:1:"A";a:5:{s:4:"type";s:3:"tab";s:4:"span";s:3:"all";s:5:"label";s:40:"General|Description|Picture|Links|Custom";s:4:"name";s:34:"general|page|pictures|links|custom";s:4:"help";s:164:"General informations about resource|Informations about the location of resource|Prizeing information for booking or buying|Web-Page of resource|Pictures or resource";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:2;a:3:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:3;s:4:"size";s:4:",380";s:7:"options";a:1:{i:1;s:3:"380";}}}','size' => ',380','style' => '','modified' => '1116664222',);
$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:7:"row_off";s:1:"A";s:3:"700";s:2:"h2";s:4:"100%";}i:1;a:3:{s:1:"A";a:5:{s:4:"type";s:3:"tab";s:4:"span";s:3:"all";s:5:"label";s:40:"General|Description|Picture|Links|Custom";s:4:"name";s:39:"tabs=general|page|pictures|links|custom";s:4:"help";s:164:"General informations about resource|Informations about the location of resource|Prizeing information for booking or buying|Web-Page of resource|Pictures or resource";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:2;a:3:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:3;s:4:"size";s:4:",380";s:7:"options";a:1:{i:1;s:3:"380";}}}','size' => ',380','style' => '','modified' => '1116664222',);
$templ_data[] = array('name' => 'resources.edit_tabs.accessories','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:9:"nextmatch";s:4:"name";s:2:"nm";s:4:"size";s:19:"resources.show.rows";}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1109668181',);

View File

@ -49,7 +49,7 @@
<row>
<description value="Accessory of"/>
<menulist>
<menupopup id="accessory_of" no_lang="1" options="None"/>
<menupopup id="accessory_of" no_lang="1"/>
</menulist>
<description/>
<description/>
@ -180,7 +180,7 @@
</columns>
<rows>
<row class="row_off">
<tabbox id="general|page|pictures|links|custom" span="all">
<tabbox id="tabs" span="all">
<tabs>
<tab id="general" label="General" statustext="General informations about resource"/>
<tab id="page" label="Description" statustext="Informations about the location of resource"/>
@ -204,16 +204,20 @@
</grid>
</template>
<template id="resources.edit_buttons" template="" lang="" group="0" version="">
<grid width="100%">
<grid width="100%" id="button">
<columns>
<column/>
<column/>
<column/>
<column width="100%"/>
</columns>
<rows>
<row>
<button statustext="Saves entry and exits" label="Save" id="save"/>
<button label="Cancel" onclick="window.close();"/>
<hbox span="3">
<button statustext="Saves entry and exits" label="Save" id="save"/>
<button label="Apply" id="apply"/>
<button label="Cancel" onclick="window.close();"/>
</hbox>
<button align="right" label="Delete" id="delete" onclick="return confirm('Do you really want do delte this resource?');"/>
</row>
</rows>