@@ -119,25 +119,40 @@ function onShowEnd() {
119119 /*
120120 * Now we have to check, if we should use the domain-module to select the domain
121121 * or not
122- */
122+ */
123123 $ app ->uses ('ini_parser,getconf ' );
124124 $ settings = $ app ->getconf ->get_global_config ('domains ' );
125125 if ($ settings ['use_domain_module ' ] == 'y ' ) {
126+ /*
127+ * The domain-module is in use.
128+ */
126129 $ client_group_id = $ _SESSION ["s " ]["user " ]["default_group " ];
127- $ sql = "SELECT domain FROM domain WHERE sys_groupid = " . $ client_group_id . " ORDER BY domain " ;
130+ /*
131+ * The admin can select ALL domains, the user only the domains assigned to him
132+ */
133+ $ sql = "SELECT domain FROM domain " ;
134+ if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' ) {
135+ $ sql .= "WHERE sys_groupid = " . $ client_group_id ;
136+ }
137+ $ sql .= " ORDER BY domain " ;
128138 $ domains = $ app ->db ->queryAllRecords ($ sql );
129139 $ domain_select = '' ;
130- if (is_array ($ domains )) {
140+ if (is_array ($ domains ) && sizeof ($ domains ) > 0 ) {
141+ /* We have domains in the list, so create the drop-down-list */
131142 foreach ( $ domains as $ domain ) {
132- $ domain_select .= "<option value= " . $ domain ['domain ' ] . "> " . $ domain ['domain ' ] . "</option> \r\n" ;
143+ $ domain_select .= "<option value= " . $ domain ['domain ' ] ;
144+ if ($ domain ['domain ' ] == $ this ->dataRecord ["domain " ]) {
145+ $ domain_select .= " selected " ;
146+ }
147+ $ domain_select .= "> " . $ domain ['domain ' ] . "</option> \r\n" ;
133148 }
134-
135- } else {
149+ }
150+ else {
136151 /*
137152 * We have no domains in the domain-list. This means, we can not add ANY new domain.
138153 * To avoid, that the variable "domain_option" is empty and so the user can
139154 * free enter a domain, we have to create a empty option!
140- */
155+ */
141156 $ domain_select .= "<option value=''></option> \r\n" ;
142157 }
143158 $ app ->tpl ->setVar ("domain_option " ,$ domain_select );
0 commit comments