0 id must match with id of current user $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete //* Maybe we're writing in a response to another message $sm_default_recipient_id = ''; $sm_default_subject = ''; if(isset($_GET['reply'])) { $sm_msg_id = preg_replace("/[^0-9]/","",$_GET['reply']); $res = $app->db->queryOneRecord("SELECT sender_id, subject FROM support_message WHERE support_message_id=$sm_msg_id"); if($res['sender_id']) { $sm_default_recipient_id = $res['sender_id']; $sm_default_subject = (preg_match("/^Re:/",$res['subject'])?"":"Re: ") . $res['subject']; } } $authsql = $app->tform->getAuthSQL('r', 'client'); //* Begin of the form definition of the first tab. The name of the tab is called "message". We refer //* to this name in the $form["tab_default"] setting above. $form["tabs"]['message'] = array ( 'title' => "Message", // Title of the Tab 'width' => 100, // Tab width 'template' => "templates/support_message_edit.htm", // Template file name 'fields' => array ( ################################## # Begin Datatable fields ################################## 'recipient_id' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', 'default' => $sm_default_recipient_id, 'datasource' => array ( 'type' => 'SQL', 'querystring' => "SELECT sys_user.userid, CONCAT(sys_user.username,' :: ',client.company_name,' :: ',client.contact_name) 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", 'keyfield' => 'userid', 'valuefield' => 'contactname' ), 'validators' => array ( 0 => array ( 'type' => 'ISINT', 'errmsg'=> 'recipient_id_is_not_integer'), ), 'value' => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):'' ), 'sender_id' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', 'default' => '', 'datasource' => array ( 'type' => 'SQL', 'querystring' => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username', 'keyfield' => 'userid', 'valuefield' => 'username' ), 'validators' => array ( 0 => array ( 'type' => 'ISINT', 'errmsg'=> 'recipient_id_is_not_integer'), ), 'value' => '' ), 'subject' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'subject_is_empty'), ), 'default' => $sm_default_subject, 'value' => '', 'width' => '30', 'maxlength' => '255' ), 'message' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'TEXTAREA', 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'message_is_empty'), ), 'default' => '', 'value' => '', 'cols' => '30', 'rows' => '10', 'maxlength' => '255' ), 'tstamp' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', 'default' => time(), 'value' => '', 'width' => '30', 'maxlength' => '30' ), ################################## # ENDE Datatable fields ################################## ) ); ?>