summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-02-09 10:33:26 +0000
committerthomascube <thomas@roundcube.net>2011-02-09 10:33:26 +0000
commitce988a0778aee7fb42ce5fc42e2986d562b6ccbb (patch)
tree6a5147dfd3300938d0595da5388e8ddf683a77b7 /program/steps/addressbook
parent829cbfe88cb4cd86072cf2a2b926868e9d4558cf (diff)
Always generate valid DOM identifiers using html_identifier() write original identifier string to rel attribute where possible
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/func.inc14
-rw-r--r--program/steps/addressbook/save.inc2
2 files changed, 12 insertions, 4 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 7597fa75a..3397d3712 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -120,6 +120,7 @@ function rcmail_directory_list($attrib)
$line_templ = html::tag('li', array(
'id' => 'rcmli%s', 'class' => 'addressbook %s'),
html::a(array('href' => '%s',
+ 'rel' => '%s',
'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s'));
// currently selected is the first address source in the list
@@ -129,9 +130,11 @@ function rcmail_directory_list($attrib)
foreach ((array)$OUTPUT->env['address_sources'] as $j => $source) {
$id = strval($source['id'] ? $source['id'] : $j);
$js_id = JQ($id);
- $dom_id = preg_replace('/[^a-z0-9\-_]/i', '_', $id);
- $out .= sprintf($line_templ, $dom_id, ($current === $id ? 'selected' : ''),
+ $out .= sprintf($line_templ,
+ html_identifier($id),
+ ($current === $id ? 'selected' : ''),
Q(rcmail_url(null, array('_source' => $id))),
+ $source['id'],
$js_id, (!empty($source['name']) ? Q($source['name']) : Q($id)));
$groupdata = array('out' => $out, 'jsdata' => $jsdata, 'source' => $id);
@@ -158,11 +161,16 @@ function rcmail_contact_groups($args)
$line_templ = html::tag('li', array(
'id' => 'rcmliG%s', 'class' => 'contactgroup'),
html::a(array('href' => '#',
+ 'rel' => '%s:%s',
'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s'));
$jsdata = array();
foreach ($groups as $group) {
- $args['out'] .= sprintf($line_templ, asciiwords($args['source'] . $group['ID'], true, '_'), $args['source'], $group['ID'], Q($group['name']));
+ $args['out'] .= sprintf($line_templ,
+ html_identifier($args['source'] . $group['ID']),
+ $args['source'], $group['ID'],
+ $args['source'], $group['ID'], Q($group['name'])
+ );
$args['jsdata']['G'.$args['source'].$group['ID']] = array(
'source' => $args['source'], 'id' => $group['ID'],
'name' => $group['name'], 'type' => 'group');
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 10155a1a9..aa45a4e15 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -249,7 +249,7 @@ else {
$result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);
rcmail_js_contacts_list($result, 'parent.');
- $OUTPUT->command('parent.contact_list.select', $insert_id);
+ $OUTPUT->command('parent.contact_list.select', html_identifier($insert_id));
// update record count display
$CONTACTS->reset();