Enable proper actions on both organisations and contacts when expanding an organisation

This commit is contained in:
Nathan Gray 2015-03-10 15:41:53 +00:00
parent 60f1ca4033
commit aa5564d569
2 changed files with 81 additions and 73 deletions

View File

@ -141,7 +141,7 @@ class addressbook_ui extends addressbook_bo
{
$msg = lang('You need to select some contacts first');
}
elseif ($content['nm']['action'] == 'view') // org-view via context menu
elseif ($content['nm']['action'] == 'view_org') // org-view via context menu
{
$content['nm']['org_view'] = array_shift($content['nm']['selected']);
}
@ -360,9 +360,7 @@ class addressbook_ui extends addressbook_bo
*/
public function get_actions($tid_filter=null, $org_view=null)
{
// we have no org view (view of one org has context menu like regular "add contacts" view, as it shows contacts
if (!isset($this->org_views[(string) $org_view]))
{
// Contact view
$actions = array(
'view' => array(
'caption' => 'CRM-View',
@ -370,6 +368,8 @@ class addressbook_ui extends addressbook_bo
'allowOnMultiple' => false,
'group' => $group=1,
'onExecute' => 'javaScript:app.addressbook.view',
'disableClass' => 'contact_organisation',
'hideOnDisabled' => true,
// Children added below
'children' => array()
),
@ -377,6 +377,8 @@ class addressbook_ui extends addressbook_bo
'caption' => 'Open',
'default' => $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list'] == '~edit~',
'allowOnMultiple' => false,
'disableClass' => 'contact_organisation',
'hideOnDisabled' => true,
'url' => 'menuaction=addressbook.addressbook_ui.edit&contact_id=$id',
'popup' => egw_link::get_registry('addressbook', 'edit_popup'),
'group' => $group,
@ -384,6 +386,8 @@ class addressbook_ui extends addressbook_bo
'add' => array(
'caption' => 'Add',
'group' => $group,
'disableClass' => 'contact_organisation',
'hideOnDisabled' => true,
'children' => array(
'new' => array(
'caption' => 'New',
@ -418,25 +422,27 @@ class addressbook_ui extends addressbook_bo
);
}
}
}
else // org view
{
$actions = array(
'view' => array(
// org view
$actions += array(
'view_org' => array(
'caption' => 'View',
'default' => true,
'allowOnMultiple' => false,
'group' => $group=1,
'disableClass' => 'contact_contact',
'hideOnDisabled' => true
),
'add' => array(
'add_org' => array(
'caption' => 'Add',
'group' => $group,
'allowOnMultiple' => false,
'disableClass' => 'contact_contact',
'hideOnDisabled' => true,
'url' => 'menuaction=addressbook.addressbook_ui.edit&org=$id',
'popup' => egw_link::get_registry('addressbook', 'add_popup'),
),
);
}
++$group; // other AB related stuff group: lists, AB's, categories
// categories submenu
@ -1612,6 +1618,7 @@ window.egw_LAB.wait(function() {
$row['class'] .= 'rowNoDelete ';
}
$row['class'] .= 'rowNoEdit '; // no edit in OrgView
$row['class'] .= 'contact_organisation ';
}
else
{
@ -1645,6 +1652,7 @@ window.egw_LAB.wait(function() {
{
$row['class'] .= 'rowNoEdit ';
}
$row['class'] .= 'contact_contact ';
unset($row['jpegphoto']); // unused and messes up json encoding (not utf-8)

View File

@ -32,7 +32,7 @@
<nextmatch-header label="Home email" id="email_home"/>
</vbox>
</row>
<row class="row" valign="top">
<row class="$row_cont[cat_id] $row_cont[class]" valign="top">
<image label="$row_cont[type_label]" src="${row}[type]" align="center" no_lang="1"/>
<int id="${row}[org_count]" readonly="true" align="center"/>
<vbox>