my first commit: add or delete an categorie to the addresbokk entry. In a popup window, you can select, the categories zu want to modify. You can select more than one addresses.

This commit is contained in:
Stefan Becker 2008-03-10 16:33:17 +00:00
parent 694dbc443b
commit 889960567e
5 changed files with 144 additions and 15 deletions

View File

@ -32,6 +32,7 @@ class uicontacts extends bocontacts
'photo' => True,
'emailpopup'=> True,
'migrate2ldap' => True,
'cat_add' => True,
);
/**
* use a separate private addressbook (former private flag), for contacts not shareable via regular read acl
@ -260,6 +261,7 @@ class uicontacts extends bocontacts
'csv' => lang('Export as CSV'),
'vcard' => lang('Export as VCard'), // ToDo: move this to importexport framework
'merge' => lang('Merge into first or account, deletes all other!'),
'cat_add' => lang('Add or delete Categoies'), // add a categirie to multible addresses
);
if ($GLOBALS['egw_info']['user']['apps']['infolog'])
{
@ -273,8 +275,6 @@ class uicontacts extends bocontacts
}
$sel_options['action'][lang('Move to addressbook:')] = $m2a;
}
if (($add_lists = $this->get_lists(EGW_ACL_EDIT))) // do we have distribution lists?
{
$lists = array();
@ -287,6 +287,8 @@ class uicontacts extends bocontacts
$sel_options['action']['remove_from_list'] = lang('Remove selected contacts from distribution list');
$sel_options['action']['delete_list'] = lang('Delete selected distribution list!');
}
if ($this->prefs['document_dir'])
{
$sel_options['action'][lang('Insert in document').':'] = $this->get_document_actions();
@ -545,8 +547,8 @@ class uicontacts extends bocontacts
ExecMethod('addressbook.vcaladdressbook.export',$checked);
// does not return!
$Ok = false;
break;
break;
case 'infolog':
$GLOBALS['egw']->redirect_link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.index',
@ -583,6 +585,56 @@ class uicontacts extends bocontacts
case 'document':
$msg = $this->download_document($checked,$document);
return false;
case 'cat_add':
foreach($checked as $id)
{
if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_EDIT,$contact)))
{
$action_msg = lang('categorie');
$cat_ids = explode(",",$contact['cat_id']); //existing categiries
if (!is_array($cat_ids_new) && $cat_ids_new) $cat_ids_new = explode(",",$cat_ids_new);
//categarie add
if ((!($cat_ids_new = $GLOBALS['egw']->session->appsession('cat_add','addressbook')) && !($cat_ids_new = $GLOBALS['egw']->session->appsession('cat_delete','addressbook'))))
{
$action_msg = lang('no categories selected');
}
if ($GLOBALS['egw']->session->appsession('cat_add','addressbook'))
{
if (is_array($cat_ids_new) && ($ids_to_add = array_diff($cat_ids_new,$cat_ids)))
{
$cat_ids = array_merge($cat_ids,$ids_to_add);
$contact['cat_id'] = implode(",",$cat_ids);
$Ok = $this->save($contact);
$success++;
$action_msg = lang('categorie added');
}
else
{
$failed++;
}
}
//categories delete
if ($GLOBALS['egw']->session->appsession('cat_delete','addressbook'))
{
if (is_array($cat_ids_new) && ($ids_to_delete = array_diff($cat_ids,$cat_ids_new)) or ($cat_ids = $cat_ids_new))
{
$contact['cat_id'] = implode(",",$ids_to_delete);
$action_msg = lang('categorie delete');
$Ok = $this->save($contact);
$success++;
}
else
{
$failed++;
}
}
}
}
$checked = array(); // to not start the single actions
$GLOBALS['egw']->session->appsession('cat_add','addressbook',''); //delete stored categories to add
$GLOBALS['egw']->session->appsession('cat_delete','addressbook',''); //delete stored categories to delete
break;
}
foreach($checked as $id)
{
@ -2126,6 +2178,38 @@ $readonlys['button[vcard]'] = true;
//_debug_array($calendars);
return $calendars;
}
/**
* add a new categorie to any addressbock entry
*
* @author Stefan Becker <StefanBecker-AT-outdoor-training.de>
* @param array $content=null
*/
function cat_add($content=null)
{
if (is_array($content))
{
if ($content['cat_id']) //add categorie
{
if ($content['cat_add'])
{
$GLOBALS['egw']->session->appsession('cat_add','addressbook',$content['cat_id']);
$js = "opener.document.getElementById('exec[action]').value='cat_add'; opener.document.forms.eTemplate.submit();";
}
if ($content['cat_delete']) //delete categorie
{
$GLOBALS['egw']->session->appsession('cat_delete','addressbook',$content['cat_id']);
$js = "opener.document.getElementById('exec[action]').value='cat_add'; opener.document.forms.eTemplate.submit();";
}
}
echo "<html><head><script>$js window.close();</script></head><html>\n";
$GLOBALS['egw']->common->egw_exit();
}
$content['cat_tab'] = $this->config['cat_tab'];
$this->tmpl->read('addressbook.index.cat_add');
return $this->tmpl->exec('addressbook.uicontacts.cat_add',$content,$sel_options,$readonlys,$content, 2);
}
}
if (!function_exists('array_intersect_key')) // php5.1 function
@ -2143,5 +2227,5 @@ if (!function_exists('array_intersect_key')) // php5.1 function
}
return $intersection;
}
}

View File

@ -20,6 +20,7 @@ add a single entry by passing the fields. addressbook de Hinzufügen eines einze
add business email of whole distribution list? addressbook de E-Mail geschäftl. der kompletten Liste hinzufügen?
add custom field addressbook de Benutzerdefiniertes Feld hinzufügen
add emails of whole distribution list? addressbook de E-Mails der gesamten Verteilerliste hinzufügen?
add or delete categoies addressbook de Kategorien hinzufügen oder löschen
add to distribution list: addressbook de Hinzufügen zu Verteiler:
added addressbook de hinzugefügt
added by synchronisation addressbook de Hinzugefügt über die Synchronisation
@ -66,6 +67,9 @@ calendar fields: addressbook de Kalender Felder:
calendar uri addressbook de Kalender URI
can be changed via setup >> configuration admin de Kann über Setup >> Konfiguration geändert werden
car phone addressbook de Autotelefon
categorie addressbook de Kategorie
categorie added addressbook de Kategorie (n) hinzugefügt
categorie delete addressbook de Kategorie (n) gelöscht
categories, notes, ... addressbook de Kategorien, Notizen, ...
category tree admin de Kategoriebaum
cell phone addressbook de Mobiltelefon
@ -125,6 +129,7 @@ deletes the photo addressbook de Löscht das Foto
department common de Abteilung
departments addressbook de Abteilungen
directory with documents to insert contacts addressbook de Verzeichnis mit Dokumenten zum Einfügen von Kontakten
display contact addressbook de Kontakte Anzeigen
displays a remider for birthdays on the startpage (page you get when you enter egroupware or click on the homepage icon). addressbook de Zeigt auf der Startseite eine Geburtstags Erinnerung an. Die Startseite ist die Seite die Sie sehen, wenn Sie eGroupWare betreten oder auf das Startseiten Icon (Haus) klicken.
distribution list deleted addressbook de Verteiler gelöscht
distribution lists addressbook de Verteilerlisten
@ -256,6 +261,7 @@ name of current user, all other contact fields are valid too addressbook de Name
name, address addressbook de Name, Adresse
new contact submitted by %1 at %2 addressbook de Neuer Kontakt eingetragen von %1 am %2
next date addressbook de Nächster Termin
no categories selected addressbook de keine Kategorien ausgewählt
no vcard addressbook de Keine VCard
number addressbook de Nummer
number of records to read (%1) addressbook de Anzahl der einzulesenden Datensätze (%1)

View File

@ -20,6 +20,7 @@ add a single entry by passing the fields. addressbook en Add a single entry by p
add business email of whole distribution list? addressbook en Add business email of whole distribution list?
add custom field addressbook en Add Custom Field
add emails of whole distribution list? addressbook en Add emails of whole distribution list?
add or delete categoies addressbook en Add or delete Categoies
add to distribution list: addressbook en Add to distribution list:
added addressbook en added
added by synchronisation addressbook en added by synchronisation
@ -66,6 +67,9 @@ calendar fields: addressbook en Calendar fields:
calendar uri addressbook en Calendar URI
can be changed via setup >> configuration admin en Can be changed via Setup >> Configuration
car phone addressbook en Car Phone
categorie addressbook en categorie
categorie added addressbook en categorie added
categorie delete addressbook en categorie delete
categories, notes, ... addressbook en Categories, Notes, ...
category tree admin en Category tree
cell phone addressbook en Mobile phone
@ -125,6 +129,7 @@ deletes the photo addressbook en Deletes the photo
department common en Department
departments addressbook en departments
directory with documents to insert contacts addressbook en Directory with documents to insert contacts
display contact addressbook en Display Contact
displays a remider for birthdays on the startpage (page you get when you enter egroupware or click on the homepage icon). addressbook en Displays a remider for birthdays on the startpage (page you get when you enter eGroupWare or click on the homepage icon).
distribution list deleted addressbook en Distribution list deleted
distribution lists addressbook en Distribution lists
@ -256,6 +261,7 @@ name of current user, all other contact fields are valid too addressbook en Name
name, address addressbook en Name, Address
new contact submitted by %1 at %2 addressbook en New contact submitted by %1 at %2
next date addressbook en Next date
no categories selected addressbook en no categories selected
no vcard addressbook en No VCard
number addressbook en Number
number of records to read (%1) addressbook en Number of records to read (%1)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="addressbook.index.cat_add" template="" lang="" group="0" version="1.5.001">
<grid width="100%" height="300" overflow="auto">
<columns>
<column/>
<column/>
<column disabled="@cat_tab=Tree"/>
<column disabled="!@cat_tab=Tree"/>
</columns>
<rows>
<row valign="top">
<image src="folder"/>
<description value="Categories"/>
<listbox type="select-cat" id="cat_id" rows="013" options=",width:99%"/>
<tree-cat id="cat_id" options="13,,width:99%"/>
</row>
<row>
<hbox span="all">
<button label="add" id="cat_add"/>
<button label="delete" id="cat_delete"/>
<button label="cancel" id="cat_cancel" onclick="window.close();"/>
</hbox>
</row>
</rows>
</grid>
</template>
</overlay>