Home: Fix missing templates & sneaky failures with some favorite combinations

This commit is contained in:
nathan 2023-03-13 09:25:55 -06:00
parent d8cc92efe4
commit ebdf3310c2
6 changed files with 244 additions and 42 deletions

View File

@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
<overlay>
<!-- Separate file so home can find it -->
<template id="addressbook.index.rows" template="" lang="" group="0" version="1.9.005">
<grid width="100%">
<columns>
<column width="20"/>
<column width="40%" minWidth="150"/>
<column width="70"/>
<column width="100"/>
<column width="60"/>
<column width="80"/>
<column width="180"/>
<column width="180"/>
<column width="180"/>
<column width="180"/>
<column width="40"/>
<column width="80" disabled="@no_customfields"/>
<column width="120"/>
<column width="60%" minWidth="100"/>
<column width="80" disabled="@no_distribution_list"/>
<column width="80"/>
<column width="50"/>
<column width="80" disabled="@no_event_column"/>
<column width="120"/>
</columns>
<rows>
<row class="th">
<nextmatch-header label="Type" id="type"/>
<grid spacing="0" padding="0">
<columns>
<column/>
<column/>
</columns>
<rows>
<row disabled="!@order=n_fileas">
<nextmatch-sortheader label="own sorting" id="n_fileas" span="all"/>
</row>
<row disabled="!@order=n_given">
<nextmatch-sortheader label="Firstname" id="n_given"/>
<nextmatch-sortheader label="Name" id="n_family"/>
</row>
<row disabled="!@order=n_family">
<nextmatch-sortheader label="Name" id="n_family"/>
<nextmatch-sortheader label="Firstname" id="n_given"/>
</row>
<row>
<nextmatch-sortheader label="Organisation" id="org_name" span="all"/>
</row>
<row disabled="!@order=/^(org_name|n_fileas|adr_one_postalcode|contact_modified|contact_created|#)/">
<nextmatch-sortheader label="Name" id="n_family"/>
<nextmatch-sortheader label="Firstname" id="n_given" class="leftPad5"/>
</row>
<row disabled="@order=n_fileas">
<nextmatch-sortheader label="own sorting" id="n_fileas" span="all"/>
</row>
</rows>
</grid>
<nextmatch-header label="role" id="role"/>
<nextmatch-header label="Category" id="cat_id"/>
<nextmatch-header label="Photo" id="photo"/>
<nextmatch-header label="Birthday" id="bday"/>
<et2-vbox>
<nextmatch-header label="Business address" id="business"/>
<et2-nextmatch-header-custom id="adr_one_countrycode" class="countrySelect"
widgetType="select-country" emptyLabel="Country"/>
<nextmatch-sortheader label="zip code" id="adr_one_postalcode"/>
</et2-vbox>
<et2-vbox>
<nextmatch-header label="Home address" id="home"/>
<et2-nextmatch-header-custom id="adr_two_countrycode" class="countrySelect"
widgetType="select-country" emptyLabel="Country"/>
<nextmatch-sortheader label="zip code" id="adr_two_postalcode"/>
</et2-vbox>
<et2-vbox>
<nextmatch-header label="Business phone" id="tel_work"/>
<nextmatch-header label="Mobile phone" id="tel_cell"/>
<nextmatch-header label="Home phone" id="tel_home"/>
<et2-description value="Fax"></et2-description>
</et2-vbox>
<et2-vbox>
<nextmatch-header label="Url" id="url"/>
<nextmatch-header label="Business email" id="email"/>
<nextmatch-header label="Home email" id="email_home"/>
</et2-vbox>
<nextmatch-header label="Room" id="room"/>
<nextmatch-customfields id="customfields"/>
<nextmatch-header label="Kanban" id="kanban"/>
<nextmatch-header label="Note" id="note"/>
<nextmatch-header label="Distribution lists" id="distribution_list"/>
<et2-vbox>
<nextmatch-header label="Addressbook" id="owner"/>
<et2-nextmatch-header-account id="shared_with" emptyLabel="Shared with" accountType="both"/>
</et2-vbox>
<nextmatch-sortheader label="ID" id="contact_id"/>
<et2-vbox>
<nextmatch-header label="Last date" id="calendar"/>
<nextmatch-header label="Next date" id="calendar"/>
</et2-vbox>
<et2-vbox>
<nextmatch-sortheader label="Created" id="contact_created" sortmode="DESC"/>
<nextmatch-sortheader label="Last modified" id="contact_modified" sortmode="DESC"/>
</et2-vbox>
</row>
<row class="$row_cont[class] $row_cont[cat_id]" valign="top">
<et2-image align="center" label="$row_cont[type_label]" src="$row_cont[type]" noLang="1"/>
<et2-vbox id="${row}[id]">
<et2-description id="${row}[line1]" noLang="1"></et2-description>
<et2-description id="${row}[line2]" noLang="1"></et2-description>
<et2-description id="${row}[org_unit]" noLang="1"></et2-description>
<et2-description id="${row}[title]" noLang="1"></et2-description>
<et2-description id="${row}[first_org]" noLang="1"></et2-description>
</et2-vbox>
<et2-description id="${row}[role]"></et2-description>
<et2-select-cat id="${row}[cat_id]" readonly="true" rows="2" multiple="1"></et2-select-cat>
<et2-lavatar src="$row_cont[photo]" contactId="$row_cont[id]" lname="$row_cont[n_family]"
fname="$row_cont[n_given]"></et2-lavatar>
<et2-date id="${row}[bday]" readonly="true" dataFormat="Y-m-d"></et2-date>
<et2-vbox>
<et2-description id="${row}[adr_one_street]" noLang="1"></et2-description>
<et2-description id="${row}[adr_one_street2]" noLang="1"></et2-description>
<et2-hbox>
<et2-description id="${row}[adr_one_postalcode]" noLang="1"></et2-description>
<et2-description value=" " id="${row}[adr_one_locality]" class="leftPad5"
noLang="1"></et2-description>
<et2-description id="${row}[adr_one_region]" class="leftPad5" noLang="1"></et2-description>
</et2-hbox>
<et2-description id="${row}[adr_one_countryname]" noLang="1"></et2-description>
<et2-select-country id="${row}[adr_one_countrycode]" readonly="true"></et2-select-country>
</et2-vbox>
<et2-vbox>
<et2-description id="${row}[adr_two_street]" noLang="1"></et2-description>
<et2-description id="${row}[adr_two_street2]" noLang="1"></et2-description>
<et2-hbox>
<et2-description id="${row}[adr_two_postalcode]" noLang="1"></et2-description>
<et2-description value=" " id="${row}[adr_two_locality]" class="leftPad5"
noLang="1"></et2-description>
<et2-description id="${row}[adr_two_region]" class="leftPad5" noLang="1"></et2-description>
</et2-hbox>
<et2-description id="${row}[adr_two_countryname]" noLang="1"></et2-description>
<et2-select-country id="${row}[adr_two_countrycode]" readonly="true"></et2-select-country>
</et2-vbox>
<et2-vbox>
<et2-url-phone id="${row}[tel_work]" readonly="true" class="telNumbers"
statustext="Business phone"></et2-url-phone>
<et2-url-phone id="${row}[tel_cell]" readonly="true" class="telNumbers"
statustext="Mobile phone"></et2-url-phone>
<et2-url-phone id="${row}[tel_home]" readonly="true" class="telNumbers"
statustext="Home phone"></et2-url-phone>
<et2-url-phone id="${row}[tel_cell_private]" readonly="true" class="telNumbers"
statustext="Mobile phone (private)"></et2-url-phone>
<et2-url-fax id="${row}[tel_fax]" readonly="true" statustext="Fax"></et2-url-fax>
<et2-url-phone id="${row}[tel_prefered]" readonly="true" class="telNumbers"
statustext="$row_cont[tel_prefer_label]"></et2-url-phone>
</et2-vbox>
<et2-vbox>
<et2-url id="${row}[url]" readonly="true" class="fixedHeight"></et2-url>
<et2-url-email id="${row}[email]" readonly="true" class="fixedHeight"></et2-url-email>
<et2-url-email id="${row}[email_home]" readonly="true" class="fixedHeight"></et2-url-email>
</et2-vbox>
<et2-description id="${row}[room]"></et2-description>
<customfields-list id="$row" class="customfields"/>
<et2-link-string entryId="${row_cont[id]}" application="addressbook"
onlyApp="kanban"></et2-link-string>
<et2-textarea id="${row}[note]" readonly="true" noLang="1"></et2-textarea>
<et2-description id="${row}[distrib_lists]"></et2-description>
<et2-vbox>
<et2-select-account id="${row}[owner]" readonly="true"></et2-select-account>
<et2-select-account id="${row}[shared_with]" readonly="true"
multiple="true"></et2-select-account>
</et2-vbox>
<et2-description id="${row}[id]" class="contactid"></et2-description>
<et2-vbox>
<et2-link id="${row}[last_link]" app=""></et2-link>
<et2-link id="${row}[next_link]" app=""></et2-link>
</et2-vbox>
<et2-vbox>
<et2-date-time id="${row}[created]" readonly="true" class="noWrap"></et2-date-time>
<et2-select-account id="${row}[creator]" readonly="true"></et2-select-account>
<et2-date-time id="${row}[modified]" readonly="true" class="noBreak"></et2-date-time>
<et2-select-account id="${row}[modifier]" readonly="true"></et2-select-account>
</et2-vbox>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -122,6 +122,7 @@ class home_favorite_portlet extends home_portlet
$content = $this->context + array('nm' => $this->nm_settings);
$content['header_node'] = "home-index_{$id}_header";
unset($content['template']);
$sel_options = $content['sel_options'] ? $content['sel_options'] : array();
unset($content['sel_options']);
$etemplate->setElementAttribute('nm', 'template',$this->nm_settings['template']);

View File

@ -76,8 +76,19 @@ class home_ui
{
$id = $p_data['id'];
if(!$id) continue;
$portlet = $this->get_portlet($id, $p_data, $content, $attrs, true);
if(!$id)
{
continue;
}
try
{
$portlet = $this->get_portlet($id, $p_data, $content, $attrs, true);
}
catch (Exception $e)
{
error_log($e);
}
}
}
@ -302,6 +313,7 @@ class home_ui
if($full_exec)
{
$content = $portlet->exec($id, $etemplate, $full_exec ? 2 : -1);
Etemplate::reset_request();
}
return $portlet;
@ -407,15 +419,16 @@ class home_ui
}
foreach($classes[$appname] as $portlet)
{
$instance = new $portlet();
$context = ['id' => $portlet];
$instance = new $portlet($context);
$desc = $instance->get_description();
$add_to[$portlet] = array(
'id' => $portlet,
'caption' => $desc['displayName'],
'hint' => $desc['description'],
'onExecute' => 'javaScript:app.home.add',
'acceptedTypes' => $instance->accept_drop(),
'id' => $portlet,
'caption' => $desc['displayName'],
'hint' => $desc['description'],
'onExecute' => 'javaScript:app.home.add',
'acceptedTypes' => $instance->accept_drop(),
'allowOnMultiple' => $instance->accept_multiple()
);
}

View File

@ -32,28 +32,28 @@ class infolog_favorite_portlet extends home_favorite_portlet
$context['appname'] = 'infolog';
// Let parent handle the basic stuff
parent::__construct($context,$need_reload);
parent::__construct($context, $need_reload);
$ui = new infolog_ui();
$this->context['template'] = 'infolog.index.rows';
$this->context['sel_options'] = array(
'info_type' => $ui->bo->enums['type'],
'pm_id' => array(lang('No project')),
'pm_id' => array(lang('No project')),
'info_priority' => $ui->bo->enums['priority'],
);
$this->nm_settings += array(
'get_rows' => 'infolog_favorite_portlet::get_rows',
$this->nm_settings = array_merge($this->nm_settings, array(
'get_rows' => 'infolog_favorite_portlet::get_rows',
// Use a different template so it can be accessed from client side
'template' => 'infolog.home',
'default_cols' => self::$default_cols,
'template' => 'infolog.home',
'default_cols' => self::$default_cols,
// Don't overwrite infolog
'session_for' => 'home',
'no_filter2' => true,
'options-filter'=> $ui->filters,
'session_for' => 'home',
'no_filter2' => true,
'options-filter' => $ui->filters,
// Allow add actions even when there's no rows
'placeholder_actions' => array(),
);
'placeholder_actions' => array(),
));
}
/**

View File

@ -28,24 +28,24 @@ class resources_favorite_portlet extends home_favorite_portlet
$context['appname'] = 'resources';
// Let parent handle the basic stuff
parent::__construct($context,$need_reload);
parent::__construct($context, $need_reload);
$this->context['template'] = 'resources.show.rows';
$this->nm_settings += array(
'get_rows' => 'resources.resources_bo.get_rows',
$this->nm_settings = array_merge($this->nm_settings, array(
'get_rows' => 'resources.resources_bo.get_rows',
// Use a different template so it can be accessed from client side
'template' => 'resources.show.rows',
'template' => 'resources.show.rows',
// Don't store in session, there's no point
'store_state' => false,
'store_state' => false,
// Use a reduced column set for home, user can change if needed
'default_cols' => 'image,name_short_description,useable_quantity',
'row_id' => 'res_id',
'row_modified' => 'ts_modified',
'default_cols' => 'image,name_short_description,useable_quantity',
'row_id' => 'res_id',
'row_modified' => 'ts_modified',
'no_cat' => true,
'filter_label' => lang('Category'),
'filter2' => -1,
);
'no_cat' => true,
'filter_label' => lang('Category'),
'filter2' => -1,
));
}
public function exec($id = null, Etemplate &$etemplate = null)

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
<overlay>
<template id="resources.show.rows" template="" lang="" group="0" version="1.9.003">
<grid width="100%">
<columns>
<column width="70"/>
<column width="50%"/>
<column width="50"/>
<column width="15%"/>
<column width="15%"/>
<column width="15%"/>
<column width="15%" disabled="@no_customfields"/>
</columns>
<template id="resources.show.rows" lang="" group="0" version="1.9.003">
<grid width="100%">
<columns>
<column width="70"/>
<column width="50%"/>
<column width="50"/>
<column width="15%"/>
<column width="15%"/>
<column width="15%"/>
<column width="15%" disabled="@no_customfields"/>
</columns>
<rows>
<row class="th">
<nextmatch-sortheader label="Image" id="image"/>