Add support for read-only address book records

This commit is contained in:
thomascube
2012-03-20 22:47:24 +00:00
parent a71a97fa49
commit 4cf42fde05
7 changed files with 22 additions and 13 deletions

View File

@@ -36,8 +36,8 @@ if ($RCMAIL->action == 'edit') {
$OUTPUT->set_env('cid', $record['ID']);
}
// adding not allowed here
if ($CONTACTS->readonly) {
// editing not allowed here
if ($CONTACTS->readonly || $record['readonly']) {
$OUTPUT->show_message('sourceisreadonly');
rcmail_overwrite_action('show');
return;

View File

@@ -5,7 +5,7 @@
| program/steps/addressbook/func.inc |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2007, The Roundcube Dev Team |
| Copyright (C) 2005-2012, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -339,6 +339,7 @@ function rcmail_js_contacts_list($result, $prefix='')
while ($row = $result->next()) {
$a_row_cols = array();
$classes = array('person'); // org records will follow some day
// build contact ID with source ID
if (isset($row['sourceid'])) {
@@ -351,7 +352,10 @@ function rcmail_js_contacts_list($result, $prefix='')
$a_row_cols[$col] = Q($val);
}
$OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols);
if ($row['readonly'])
$classes[] = 'readonly';
$OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes));
}
}

View File

@@ -33,6 +33,7 @@ $SOURCE_ID = $source;
// read contact record
if ($cid && ($record = $CONTACTS->get_record($cid, true))) {
$OUTPUT->set_env('readonly', $CONTACTS->readonly || $record['readonly']);
$OUTPUT->set_env('cid', $record['ID']);
}

View File

@@ -45,7 +45,7 @@ if ($CONTACTS && $CONTACTS->ready) {
$row_id = 'G'.$group['ID'];
$jsresult[$row_id] = format_email_recipient($email, $group['name']);
$OUTPUT->command('add_contact_row', $row_id, array(
'contactgroup' => html::span(array('title' => $email), Q($group['name']))));
'contactgroup' => html::span(array('title' => $email), Q($group['name']))), 'group');
}
}
// show group with count
@@ -53,7 +53,7 @@ if ($CONTACTS && $CONTACTS->ready) {
$row_id = 'E'.$group['ID'];
$jsresult[$row_id] = $group['name'];
$OUTPUT->command('add_contact_row', $row_id, array(
'contactgroup' => Q($group['name'] . ' (' . intval($result->count) . ')')));
'contactgroup' => Q($group['name'] . ' (' . intval($result->count) . ')')), 'group');
}
}
}
@@ -75,7 +75,7 @@ if ($CONTACTS && $CONTACTS->ready) {
$row_id = $row['ID'].$i;
$jsresult[$row_id] = format_email_recipient($email, $name);
$OUTPUT->command('add_contact_row', $row_id, array(
'contact' => html::span(array('title' => $email), Q($name ? $name : $email))));
'contact' => html::span(array('title' => $email), Q($name ? $name : $email))), 'person');
}
}
}