diff options
author | thomascube <thomas@roundcube.net> | 2011-02-09 10:33:26 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-02-09 10:33:26 +0000 |
commit | ce988a0778aee7fb42ce5fc42e2986d562b6ccbb (patch) | |
tree | 6a5147dfd3300938d0595da5388e8ddf683a77b7 /program/steps/addressbook/func.inc | |
parent | 829cbfe88cb4cd86072cf2a2b926868e9d4558cf (diff) |
Always generate valid DOM identifiers using html_identifier() write original identifier string to rel attribute where possible
Diffstat (limited to 'program/steps/addressbook/func.inc')
-rw-r--r-- | program/steps/addressbook/func.inc | 14 |
1 files changed, 11 insertions, 3 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'); |