4 +-----------------------------------------------------------------------+
5 | program/steps/settings/edit_identity.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Show edit form for a identity record or to add a new one |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: edit_identity.inc 88 2005-12-03 16:54:12Z roundcube $
22 if (($_GET['_iid'] || $_POST['_iid']) && $_action=='edit-identity')
24 $id = $_POST['_iid'] ? $_POST['_iid'] : $_GET['_iid'];
25 $DB->query("SELECT * FROM ".get_table_name('identities')."
30 $_SESSION['user_id']);
32 $IDENTITY_RECORD = $DB->fetch_assoc();
34 if (is_array($IDENTITY_RECORD))
35 $OUTPUT->add_script(sprintf("%s.set_env('iid', '%s');", $JS_OBJECT_NAME, $IDENTITY_RECORD['identity_id']));
37 $PAGE_TITLE = rcube_label('edititem');
40 $PAGE_TITLE = rcube_label('newitem');
44 function rcube_identity_form($attrib)
46 global $IDENTITY_RECORD, $JS_OBJECT_NAME;
48 if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity')
49 return rcube_label('notfound');
51 // add some labels to client
52 rcube_add_label('noemailwarning');
53 rcube_add_label('nonamewarning');
56 list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id']));
57 unset($attrib['form']);
60 // list of available cols
61 $a_show_cols = array('name' => array('type' => 'text'),
62 'email' => array('type' => 'text'),
63 'organization' => array('type' => 'text'),
64 'reply-to' => array('type' => 'text', 'label' => 'replyto'),
65 'bcc' => array('type' => 'text'),
66 'signature' => array('type' => 'textarea'),
67 'standard' => array('type' => 'checkbox', 'label' => 'setdefault'));
70 // a specific part is requested
73 $colprop = $a_show_cols[$attrib['part']];
74 if (is_array($colprop))
77 $out .= rcmail_get_edit_field($attrib['part'], $IDENTITY_RECORD[$attrib['part']], $attrib, $colprop['type']);
85 // return the complete edit form as table
86 $out = "$form_start<table>\n\n";
88 foreach ($a_show_cols as $col => $colprop)
90 $attrib['id'] = 'rcmfd_'.$col;
91 $label = strlen($colprop['label']) ? $colprop['label'] : $col;
92 $value = rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $attrib, $colprop['type']);
94 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
96 rep_specialchars_output(rcube_label($label)),
100 $out .= "\n</table>$form_end";
107 if ($_action=='add-identity' && template_exists('addidentity'))
108 parse_template('addidentity');
110 parse_template('editidentity');