source: github/program/steps/settings/edit_identity.inc @ 338551d

HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
Last change on this file since 338551d was 4315b00, checked in by svncommit <devs@…>, 5 years ago

added ability to insert attached images in HTML editor

  • Property mode set to 100644
File size: 5.1 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/settings/edit_identity.inc                              |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Show edit form for a identity record or to add a new one            |
13 |                                                                       |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16 +-----------------------------------------------------------------------+
17
18 $Id$
19
20*/
21
22if (($_GET['_iid'] || $_POST['_iid']) && $_action=='edit-identity')
23  {
24  $IDENTITY_RECORD = $USER->get_identity(get_input_value('_iid', RCUBE_INPUT_GPC));
25 
26  if (is_array($IDENTITY_RECORD))
27    $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
28
29  $OUTPUT->set_pagetitle(rcube_label('edititem'));
30  }
31else
32  $OUTPUT->set_pagetitle(rcube_label('newitem'));
33
34
35$OUTPUT->include_script('list.js');
36
37
38function rcube_identity_form($attrib)
39  {
40  global $IDENTITY_RECORD, $OUTPUT;
41
42  $OUTPUT->include_script('tiny_mce/tiny_mce_src.js');
43  $OUTPUT->add_script("tinyMCE.init({ mode : 'specific_textareas'," .
44                                    "apply_source_formatting : true," .
45                                    "content_css : '\$__skin_path' + '/editor_content.css'," .
46                                    "editor_css : '\$__skin_path' + '/editor_ui.css'," .
47                                    "theme : 'advanced'," .
48                                    "theme_advanced_toolbar_location : 'top'," .
49                                    "theme_advanced_toolbar_align : 'left'," .
50                                    "theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr'," .
51                                    "theme_advanced_buttons2 : 'link,unlink,code,forecolor,fontselect,fontsizeselect'," .
52                                    "theme_advanced_buttons3 : '' });");
53
54  if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity')
55    return rcube_label('notfound');
56
57  // add some labels to client
58  rcube_add_label('noemailwarning', 'nonamewarning');
59
60
61  list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id']));
62  unset($attrib['form']);
63
64
65  // list of available cols
66  $a_show_cols = array('name'         => array('type' => 'text'),
67                       'email'        => array('type' => 'text'),
68                       'organization' => array('type' => 'text'),
69                       'reply-to'     => array('type' => 'text', 'label' => 'replyto'),
70                       'bcc'          => array('type' => 'text'),
71                       'signature'        => array('type' => 'textarea', 'size' => "40", 'rows' => "6"),
72                       'html_signature'=>array('type' => 'checkbox', 'label' => 'htmlsignature', 'onclick' => 'return rcmail.toggle_editor(this, \'_signature\');'),
73                       'standard'     => array('type' => 'checkbox', 'label' => 'setdefault'));
74
75
76  // a specific part is requested
77  if ($attrib['part'])
78    {
79    $colprop = $a_show_cols[$attrib['part']];
80    if (is_array($colprop))
81      {
82      $out = $form_start;
83      $out .= rcmail_get_edit_field($attrib['part'], $IDENTITY_RECORD[$attrib['part']], $attrib, $colprop['type']);
84      return $out;
85      }
86    else
87      return '';
88    }
89
90
91  // return the complete edit form as table
92  $out = "$form_start<table>\n\n";
93
94  foreach ($a_show_cols as $col => $colprop)
95    {
96    $attrib['id'] = 'rcmfd_'.$col;
97
98    if (strlen($colprop['onclick']))
99      $attrib['onclick'] = $colprop['onclick'];
100    else
101      unset($attrib['onclick']);
102
103    if ($col == 'signature')
104      {
105      $attrib['size'] = $colprop['size'];
106      $attrib['rows'] = $colprop['rows'];
107      $attrib['mce_editable'] = $IDENTITY_RECORD['html_signature'] ? "true" : "false";
108      }
109    else
110      {
111      unset($attrib['size']);
112      unset($attrib['rows']);
113      unset($attrib['mce_editable']);
114      }
115
116    $label = strlen($colprop['label']) ? $colprop['label'] : $col;
117    $value = rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $attrib, $colprop['type']);
118
119    $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
120                    $attrib['id'],
121                    Q(rcube_label($label)),
122                    $value);
123    }
124
125  $out .= "\n</table>$form_end";
126
127  return $out; 
128  }
129
130$OUTPUT->add_handler('identityform', 'rcube_identity_form');
131
132if ($_action=='add-identity' && template_exists('addidentity'))
133  parse_template('addidentity');
134
135parse_template('editidentity');
136?>
Note: See TracBrowser for help on using the repository browser.