commit | author | age
|
aa1724
|
1 |
<?php |
T |
2 |
|
|
3 |
//* Title of the form |
b1a6a5
|
4 |
$form["title"] = "Support Message"; |
aa1724
|
5 |
|
T |
6 |
//* Description of the form (optional) |
b1a6a5
|
7 |
$form["description"] = ""; |
aa1724
|
8 |
|
T |
9 |
//* Name of the form. The name shall not contain spaces or foreign characters |
b1a6a5
|
10 |
$form["name"] = "support_message"; |
aa1724
|
11 |
|
T |
12 |
//* The file that is used to call the form in the browser |
b1a6a5
|
13 |
$form["action"] = "support_message_edit.php"; |
aa1724
|
14 |
|
T |
15 |
//* The name of the database table that shall be used to store the data |
b1a6a5
|
16 |
$form["db_table"] = "support_message"; |
aa1724
|
17 |
|
T |
18 |
//* The name of the database table index field, this field must be a numeric auto increment column |
b1a6a5
|
19 |
$form["db_table_idx"] = "support_message_id"; |
aa1724
|
20 |
|
T |
21 |
//* Shall changes to this table be stored in the database history (sys_datalog) table. |
|
22 |
//* This should be set to "yes" for all tables that store configuration information. |
b1a6a5
|
23 |
$form["db_history"] = "no"; // yes / no |
aa1724
|
24 |
|
T |
25 |
//* The name of the tab that is shown when the form is opened |
b1a6a5
|
26 |
$form["tab_default"] = "message"; |
aa1724
|
27 |
|
T |
28 |
//* The name of the default list file of this form |
b1a6a5
|
29 |
$form["list_default"] = "support_message_list.php"; |
aa1724
|
30 |
|
T |
31 |
//* Use the internal authentication system for this table. This should |
|
32 |
//* be set to yes in most cases |
b1a6a5
|
33 |
$form["auth"] = 'yes'; // yes / no |
aa1724
|
34 |
|
e1585f
|
35 |
//* Authentication presets. The defaults below does not need to be changed in most cases. |
aa1724
|
36 |
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user |
T |
37 |
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user |
|
38 |
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete |
|
39 |
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete |
|
40 |
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete |
|
41 |
|
e1585f
|
42 |
|
F |
43 |
//* Maybe we're writing in a response to another message |
|
44 |
$sm_default_recipient_id = ''; |
|
45 |
$sm_default_subject = ''; |
|
46 |
if(isset($_GET['reply'])) |
|
47 |
{ |
b1a6a5
|
48 |
$sm_msg_id = preg_replace("/[^0-9]/", "", $_GET['reply']); |
cc7a82
|
49 |
$res = $app->db->queryOneRecord("SELECT sender_id, subject FROM support_message WHERE support_message_id=?", $sm_msg_id); |
e1585f
|
50 |
if($res['sender_id']) |
F |
51 |
{ |
b1a6a5
|
52 |
$sm_default_recipient_id = $res['sender_id']; |
MC |
53 |
$sm_default_subject = (preg_match("/^Re:/", $res['subject'])?"":"Re: ") . $res['subject']; |
e1585f
|
54 |
} |
F |
55 |
} |
aa1724
|
56 |
|
472c2c
|
57 |
$authsql = $app->tform->getAuthSQL('r', 'client'); |
T |
58 |
|
aa1724
|
59 |
//* Begin of the form definition of the first tab. The name of the tab is called "message". We refer |
T |
60 |
//* to this name in the $form["tab_default"] setting above. |
|
61 |
$form["tabs"]['message'] = array ( |
b1a6a5
|
62 |
'title' => "Message", // Title of the Tab |
MC |
63 |
'width' => 100, // Tab width |
|
64 |
'template' => "templates/support_message_edit.htm", // Template file name |
|
65 |
'fields' => array ( |
|
66 |
//################################# |
|
67 |
// Begin Datatable fields |
|
68 |
//################################# |
aa1724
|
69 |
'recipient_id' => array ( |
b1a6a5
|
70 |
'datatype' => 'INTEGER', |
MC |
71 |
'formtype' => 'SELECT', |
|
72 |
'default' => $sm_default_recipient_id, |
|
73 |
'datasource' => array ( 'type' => 'SQL', |
|
74 |
'querystring' => "SELECT sys_user.userid, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_user, client WHERE sys_user.userid != 1 AND sys_user.client_id = client.client_id AND $authsql ORDER BY sys_user.username", |
|
75 |
'keyfield' => 'userid', |
|
76 |
'valuefield' => 'contactname' |
|
77 |
), |
|
78 |
'validators' => array ( 0 => array ( 'type' => 'ISINT', |
|
79 |
'errmsg'=> 'recipient_id_is_not_integer'), |
|
80 |
), |
|
81 |
'value' => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):'' |
aa1724
|
82 |
), |
T |
83 |
'sender_id' => array ( |
b1a6a5
|
84 |
'datatype' => 'INTEGER', |
MC |
85 |
'formtype' => 'SELECT', |
|
86 |
'default' => '', |
|
87 |
'datasource' => array ( 'type' => 'SQL', |
|
88 |
'querystring' => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username', |
|
89 |
'keyfield' => 'userid', |
|
90 |
'valuefield' => 'username' |
|
91 |
), |
|
92 |
'validators' => array ( 0 => array ( 'type' => 'ISINT', |
|
93 |
'errmsg'=> 'recipient_id_is_not_integer'), |
|
94 |
), |
|
95 |
'value' => '' |
aa1724
|
96 |
), |
T |
97 |
'subject' => array ( |
b1a6a5
|
98 |
'datatype' => 'VARCHAR', |
MC |
99 |
'formtype' => 'TEXT', |
|
100 |
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', |
|
101 |
'errmsg'=> 'subject_is_empty'), |
|
102 |
), |
|
103 |
'default' => $sm_default_subject, |
|
104 |
'value' => '', |
|
105 |
'width' => '30', |
|
106 |
'maxlength' => '255' |
aa1724
|
107 |
), |
T |
108 |
'message' => array ( |
b1a6a5
|
109 |
'datatype' => 'VARCHAR', |
MC |
110 |
'formtype' => 'TEXTAREA', |
|
111 |
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', |
|
112 |
'errmsg'=> 'message_is_empty'), |
|
113 |
), |
|
114 |
'default' => '', |
|
115 |
'value' => '', |
|
116 |
'cols' => '30', |
|
117 |
'rows' => '10', |
|
118 |
'maxlength' => '255' |
aa1724
|
119 |
), |
T |
120 |
'tstamp' => array ( |
b1a6a5
|
121 |
'datatype' => 'INTEGER', |
MC |
122 |
'formtype' => 'TEXT', |
|
123 |
'default' => time(), |
|
124 |
'value' => '', |
|
125 |
'width' => '30', |
|
126 |
'maxlength' => '30' |
aa1724
|
127 |
), |
b1a6a5
|
128 |
//################################# |
MC |
129 |
// ENDE Datatable fields |
|
130 |
//################################# |
aa1724
|
131 |
) |
T |
132 |
); |
|
133 |
|
|
134 |
|
|
135 |
|
e1585f
|
136 |
?> |