3232//* be set to yes in most cases
3333$ form ["auth " ] = 'yes ' ; // yes / no
3434
35- //* Authentocation presets. The defaults below does not need to be changed in most cases.
35+ //* Authentication presets. The defaults below does not need to be changed in most cases.
3636$ form ["auth_preset " ]["userid " ] = 0 ; // 0 = id of the user, > 0 id must match with id of current user
3737$ form ["auth_preset " ]["groupid " ] = 0 ; // 0 = default groupid of the user, > 0 id must match with groupid of current user
3838$ form ["auth_preset " ]["perm_user " ] = 'riud ' ; //r = read, i = insert, u = update, d = delete
3939$ form ["auth_preset " ]["perm_group " ] = 'riud ' ; //r = read, i = insert, u = update, d = delete
4040$ form ["auth_preset " ]["perm_other " ] = '' ; //r = read, i = insert, u = update, d = delete
4141
4242
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+ {
48+ $ sm_msg_id = preg_replace ("/[^0-9]/ " ,"" ,$ _GET ['reply ' ]);
49+ $ res = $ app ->db ->queryOneRecord ("SELECT sender_id, subject FROM support_message WHERE support_message_id= $ sm_msg_id " );
50+ if ($ res ['sender_id ' ])
51+ {
52+ $ sm_default_recipient_id = $ res ['sender_id ' ];
53+ $ sm_default_subject = (preg_match ("/^Re:/ " ,$ res ['subject ' ])?"" :"Re: " ) . $ res ['subject ' ];
54+ }
55+ }
56+
4357//* Begin of the form definition of the first tab. The name of the tab is called "message". We refer
4458//* to this name in the $form["tab_default"] setting above.
4559$ form ["tabs " ]['message ' ] = array (
5367 'recipient_id ' => array (
5468 'datatype ' => 'INTEGER ' ,
5569 'formtype ' => 'SELECT ' ,
56- 'default ' => '' ,
70+ 'default ' => $ sm_default_recipient_id ,
5771 'datasource ' => array ( 'type ' => 'SQL ' ,
5872 'querystring ' => 'SELECT userid,username FROM sys_user WHERE userid != 1 AND {AUTHSQL} ORDER BY username ' ,
5973 'keyfield ' => 'userid ' ,
8498 'validators ' => array ( 0 => array ( 'type ' => 'NOTEMPTY ' ,
8599 'errmsg ' => 'subject_is_empty ' ),
86100 ),
87- 'default ' => '' ,
101+ 'default ' => $ sm_default_subject ,
88102 'value ' => '' ,
89103 'width ' => '30 ' ,
90104 'maxlength ' => '255 '
117131
118132
119133
120- ?>
134+ ?>
0 commit comments