summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-03-20 22:47:24 +0000
committerthomascube <thomas@roundcube.net>2012-03-20 22:47:24 +0000
commit4cf42fde05ff891f6961ba60dbb1c2e4c91c39c6 (patch)
tree75e1520d4dbf92a9b8c0ae9ab3136fa2623d4172 /program/steps/addressbook
parenta71a97fa49fb1c7fbe5e042b2cf6239f7372acb4 (diff)
Add support for read-only address book records
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/edit.inc4
-rw-r--r--program/steps/addressbook/func.inc8
-rw-r--r--program/steps/addressbook/show.inc1
3 files changed, 9 insertions, 4 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index 5f8a4ec2c..abed2c566 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -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;
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 5a7213ca4..eb8a0e597 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -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));
}
}
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index 5086a7bcd..bf65bebe4 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -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']);
}