Changeset 3933 in subversion
- Timestamp:
- Sep 2, 2010 6:51:23 AM (3 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 3 edited
-
CHANGELOG (modified) (1 diff)
-
program/steps/settings/edit_identity.inc (modified) (3 diffs)
-
program/steps/settings/func.inc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r3920 r3933 18 18 - Fix timezone string in sent mail (#1486961) 19 19 - Show disabled checkboxes for protected folders instead of dots (#1485498) 20 - Added fieldsets in Identity form, added 'identity_form' hook 20 21 21 22 RELEASE 0.4 -
trunk/roundcubemail/program/steps/settings/edit_identity.inc
r3780 r3933 25 25 if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') { 26 26 $IDENTITY_RECORD = $USER->get_identity(get_input_value('_iid', RCUBE_INPUT_GPC)); 27 27 28 28 if (is_array($IDENTITY_RECORD)) 29 29 $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']); … … 49 49 50 50 function rcube_identity_form($attrib) 51 {51 { 52 52 global $IDENTITY_RECORD, $RCMAIL, $OUTPUT; 53 53 54 // Add HTML editor script(s) 54 55 rcube_html_editor('identity'); 55 56 … … 61 62 $t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40; 62 63 63 list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', intval($IDENTITY_RECORD['identity_id']), array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id'])); 64 unset($attrib['form']); 64 // list of available cols 65 $form = array( 66 'addressing' => array( 67 'name' => rcube_label('settings'), 68 'content' => array( 69 'name' => array('type' => 'text', 'size' => $i_size), 70 'email' => array('type' => 'text', 'size' => $i_size), 71 'organization' => array('type' => 'text', 'size' => $i_size), 72 'reply-to' => array('type' => 'text', 'size' => $i_size), 73 'bcc' => array('type' => 'text', 'size' => $i_size), 74 'standard' => array('type' => 'checkbox', 'label' => rcube_label('setdefault')), 75 )), 76 'signature' => array( 77 'name' => rcube_label('signature'), 78 'content' => array( 79 'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows, 80 'spellcheck' => true), 81 'html_signature' => array('type' => 'checkbox', 'label' => rcube_label('htmlsignature'), 82 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'), 83 )) 84 ); 65 85 66 // list of available cols 67 $a_show_cols = array('name' => array('type' => 'text', 'size' => $i_size), 68 'email' => array('type' => 'text', 'size' => $i_size), 69 'organization' => array('type' => 'text', 'size' => $i_size), 70 'reply-to' => array('type' => 'text', 'label' => 'reply-to', 'size' => $i_size), 71 'bcc' => array('type' => 'text', 'size' => $i_size), 72 'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows), 73 'html_signature'=>array('type' => 'checkbox', 'label' => 'htmlsignature', 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'), 74 'standard' => array('type' => 'checkbox', 'label' => 'setdefault')); 86 // Enable TinyMCE editor 87 if ($IDENTITY_RECORD['html_signature']) { 88 $form['signature']['content']['signature']['class'] = 'mce_editor'; 89 } 75 90 76 91 // disable some field according to access level 77 92 if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) { 78 $ a_show_cols['email']['disabled'] = true;79 $ a_show_cols['email']['class'] = 'disabled';93 $form['adressing']['content']['email']['disabled'] = true; 94 $form['adressing']['content']['email']['class'] = 'disabled'; 80 95 } 81 82 // a specific part is requested 83 if ($attrib['part']) 84 { 85 $colprop = $a_show_cols[$attrib['part']]; 86 if (is_array($colprop)) 87 { 88 $out = $form_start; 89 $out .= rcmail_get_edit_field($attrib['part'], $IDENTITY_RECORD[$attrib['part']], $attrib, $colprop['type']); 90 return $out; 96 97 // Allow plugins to modify identity form content 98 $plugin = $RCMAIL->plugins->exec_hook('identity_form', array( 99 'form' => $form, 'record' => $IDENTITY_RECORD)); 100 101 $form = $plugin['form']; 102 $IDENTITY_RECORD = $plugin['record']; 103 104 // Set form tags and hidden fields 105 list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', 106 intval($IDENTITY_RECORD['identity_id']), 107 array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id'])); 108 109 unset($plugin); 110 unset($attrib['form']); 111 112 // return the complete edit form as table 113 $out = "$form_start\n"; 114 115 foreach ($form as $fieldset) { 116 if (empty($fieldset['content'])) 117 continue; 118 119 $content = ''; 120 if (is_array($fieldset['content'])) { 121 $table = new html_table(array('cols' => 2)); 122 foreach ($fieldset['content'] as $col => $colprop) { 123 $colprop['id'] = 'rcmfd_'.$col; 124 125 $label = !empty($colprop['label']) ? $colprop['label'] : rcube_label($col); 126 $value = !empty($colprop['value']) ? $colprop['value'] : 127 rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']); 128 129 $table->add('title', sprintf('<label for="%s">%s</label>', $colprop['id'], Q($label))); 130 $table->add(null, $value); 91 131 } 92 else 93 return ''; 132 $content = $table->show(); 133 } 134 else { 135 $content = $fieldset['content']; 94 136 } 95 137 138 $out .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $content) ."\n"; 139 } 96 140 97 // return the complete edit form as table 98 $out = "$form_start<table>\n\n"; 141 $out .= $form_end; 99 142 100 foreach ($a_show_cols as $col => $colprop) 101 { 102 $colprop['id'] = 'rcmfd_'.$col; 103 104 if ($col == 'signature') 105 { 106 $colprop['spellcheck'] = true; 107 if ($IDENTITY_RECORD['html_signature']) 108 { 109 $colprop['class'] = 'mce_editor'; 110 } 111 } 112 113 $label = strlen($colprop['label']) ? $colprop['label'] : $col; 114 $value = rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']); 115 116 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 117 $colprop['id'], 118 Q(rcube_label($label)), 119 $value); 120 } 121 122 $out .= "\n</table>$form_end"; 123 124 return $out; 125 } 143 return $out; 144 } 126 145 127 146 $OUTPUT->include_script('list.js'); -
trunk/roundcubemail/program/steps/settings/func.inc
r3840 r3933 26 26 // similar function as /steps/settings/identities.inc::rcmail_identity_frame() 27 27 function rcmail_preferences_frame($attrib) 28 {28 { 29 29 global $OUTPUT; 30 30 … … 38 38 39 39 return html::iframe($attrib); 40 }40 } 41 41 42 42 43 43 function rcmail_sections_list($attrib) 44 {44 { 45 45 global $RCMAIL; 46 46 … … 59 59 60 60 return $out; 61 }61 } 62 62 63 63 64 64 function rcmail_identities_list($attrib) 65 {65 { 66 66 global $OUTPUT, $USER, $RCMAIL; 67 67 … … 88 88 89 89 return $out; 90 }90 } 91 91 92 92 93 93 // similar function as in /steps/addressbook/edit.inc 94 94 function get_form_tags($attrib, $action, $id = null, $hidden = null) 95 {95 { 96 96 global $EDIT_FORM, $RCMAIL; 97 97 … … 101 101 $request_key = $action . (isset($id) ? '.'.$id : ''); 102 102 $form_start = $RCMAIL->output->request_form(array( 103 'name' => 'form', 'method' => 'post', 104 'task' => $RCMAIL->task, 'action' => $action, 105 'request' => $request_key, 'noclose' => true) + $attrib); 103 'name' => 'form', 104 'method' => 'post', 105 'task' => $RCMAIL->task, 106 'action' => $action, 107 'request' => $request_key, 108 'noclose' => true 109 ) + $attrib); 106 110 107 111 if (is_array($hidden)) { … … 117 121 118 122 return array($form_start, $form_end); 119 }123 } 120 124 121 125
Note: See TracChangeset
for help on using the changeset viewer.
