Skip to content

Commit

Permalink
[jan] Remember currently open tab when switching between contact view…
Browse files Browse the repository at this point in the history
…ing and editing (Request #12609).
  • Loading branch information
yunosh committed Oct 16, 2013
1 parent 9713ed6 commit 9f28496
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 19 deletions.
6 changes: 3 additions & 3 deletions turba/contact.php
Expand Up @@ -80,20 +80,20 @@
array('tabname' => 'Contact',
'id' => 'tabContact',
'class' => 'horde-icon',
'onclick' => 'return ShowTab(\'Contact\');'));
'onclick' => 'return TurbaTabs.showTab(\'Contact\');'));
if ($contact->hasPermission(Horde_Perms::EDIT)) {
$tabs->addTab(_("_Edit"), $url,
array('tabname' => 'EditContact',
'id' => 'tabEditContact',
'class' => 'horde-icon',
'onclick' => 'return ShowTab(\'EditContact\');'));
'onclick' => 'return TurbaTabs.showTab(\'EditContact\');'));
}
if ($contact->hasPermission(Horde_Perms::DELETE)) {
$tabs->addTab(_("De_lete"), $url,
array('tabname' => 'DeleteContact',
'id' => 'tabDeleteContact',
'class' => 'horde-icon',
'onclick' => 'return ShowTab(\'DeleteContact\');'));
'onclick' => 'return TurbaTabs.showTab(\'DeleteContact\');'));
}

@list($own_source, $own_id) = explode(';', $prefs->getValue('own_contact'));
Expand Down
2 changes: 2 additions & 0 deletions turba/docs/CHANGES
Expand Up @@ -2,6 +2,8 @@
v4.2.0-git
----------

[jan] Remember currently open tab when switching between contact viewing and
editing (Request #12609).
[jan] Replace categories with tags (Request #9544).


Expand Down
50 changes: 34 additions & 16 deletions turba/js/contact_tabs.js
@@ -1,19 +1,37 @@
var contactTabs = null;
function ShowTab(tab)
{
if (contactTabs == null) {
contactTabs = $('page').select('.horde-buttonbar')[0].down();
}
var TurbaTabs = {
// Properties: current, tabs

showTab: function(tab)
{
var next, id;

this.tabs.each(function(item) {
id = item.id.substring(3);
if (id == tab) {
item.addClassName('horde-active');
$(id).show();
next = id;
} else {
item.removeClassName('horde-active');
if ($(id).visible() &&
!Object.isUndefined(window['sections_Turba_View_' + id])) {
this.current = window['sections_Turba_View_' + id]._get();
}
$(id).hide();
}
}, this);

contactTabs.select('li').each(function(item) {
if (item.id == 'tab' + tab) {
item.addClassName('horde-active');
$(item.id.substring(3)).show();
} else {
item.removeClassName('horde-active');
$(item.id.substring(3)).hide();
if (this.current &&
!Object.isUndefined(window['sections_Turba_View_' + next])) {
window['sections_Turba_View_' + next].toggle(this.current);
}
});

return false;
}
return false;
},

onDomLoad: function() {
this.tabs = $('page').select('.horde-buttonbar')[0].down().select('li');
}
};

document.observe('dom:loaded', TurbaTabs.onDomLoad.bind(TurbaTabs));
2 changes: 2 additions & 0 deletions turba/package.xml
Expand Up @@ -40,6 +40,7 @@
</stability>
<license uri="http://www.horde.org/licenses/asl">ASL</license>
<notes>
* [jan] Remember currently open tab when switching between contact viewing and editing (Request #12609).
* [jan] Replace categories with tags (Request #9544).
</notes>
<contents>
Expand Down Expand Up @@ -1734,6 +1735,7 @@
<date>2013-08-15</date>
<license uri="http://www.horde.org/licenses/asl">ASL</license>
<notes>
* [jan] Remember currently open tab when switching between contact viewing and editing (Request #12609).
* [jan] Replace categories with tags (Request #9544).
</notes>
</release>
Expand Down

0 comments on commit 9f28496

Please sign in to comment.