File: 0.01.1a/pages/sysadmin.php (View as HTML)

  1: <?php
  2: /* -------------------------------------------------------------
  3: This file is part of FreeDESK
  4: 
  5: FreeDESK is (C) Copyright 2012 David Cutting
  6: 
  7: FreeDESK is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeDESK is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeDESK.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freedesk/
 21: -------------------------------------------------------------- */
 22: 
 23: /**
 24:  * System Administration Page
 25: **/
 26: 
 27: global $DESK;
 28: 
 29: header("Content-type: text/xml");
 30: header("Expires: Tue, 27 Jul 1997 01:00:00 GMT");
 31: header("Cache-Control: no-store, no-cache, must-revalidate");
 32: header("Cache-Control: post-check=0, pre-check=0", false);
 33: header("Pragma: no-cache");
 34: 
 35: echo "<!DOCTYPE html>\n";
 36: echo "<html>\n";
 37: 
 38: if (!$DESK->ContextManager->Permission("system_admin"))
 39: {
 40: 	echo "<h3>".$DESK->Lang->Get("permission_denied")."</h3>\n";
 41: 	echo "</html>\n";
 42: 	exit();
 43: }
 44: 
 45: function sa_link($text,$opts=array())
 46: {
 47: 	$opt = "";
 48: 	$first=true;
 49: 	foreach($opts as $key => $item)
 50: 	{
 51: 		if ($first)
 52: 			$first=false;
 53: 		else
 54: 			$opt.="&";
 55: 		$opt.=$key."=".$item;
 56: 	}
 57: 	$out = "<a href=\"#\" onclick=\"DESK.loadSubpage('sysadmin'";
 58: 	if ($opt != "")
 59: 		$out.=",'".$opt."'";
 60: 	$out.=");\">".$text."</a>";
 61: 	return $out;
 62: }
 63: 
 64: 
 65: if (isset($_REQUEST['mode']))
 66: 	$mode=$_REQUEST['mode'];
 67: else
 68: 	$mode="";
 69: 	
 70: if ($mode == "")
 71: {
 72: 	echo "<h3>".$DESK->Lang->Get("system_admin")."</h3>\n";
 73: 	
 74: 	if ($DESK->ContextManager->Permission("user_admin"))
 75: 	{
 76: 		echo sa_link($DESK->Lang->Get("admin_user"), array("mode"=>"user"))."<br /><br />\n";
 77: 		echo sa_link($DESK->Lang->Get("admin_group"), array("mode"=>"group"))."<br /><br />\n";
 78: 		echo sa_link($DESK->Lang->Get("teams"), array("mode"=>"teams"))."<br /><br />\n";
 79: 		echo sa_link($DESK->Lang->Get("request_status"), array("mode"=>"status"))."<br /><br />\n";
 80: 		echo sa_link($DESK->Lang->Get("request_class"), array("mode"=>"requestclass"))."<br /><br />\n";
 81: 		echo sa_link($DESK->Lang->Get("request_priority"), array("mode"=>"priorities"))."<br /><br />\n";
 82: 		if ($DESK->ContextManager->Permission("email_accounts"))
 83: 			echo sa_link($DESK->Lang->Get("email_accounts"), array("mode"=>"emailaccounts"))."<br /><br />\n";
 84: 		if ($DESK->ContextManager->Permission("email_templates"))
 85: 			echo sa_link($DESK->Lang->Get("email_templates"), array("mode"=>"emailtemplates"))."<br /><br />\n";
 86: 		if ($DESK->ContextManager->Permission("sysadmin_plugins"))
 87: 			echo sa_link($DESK->Lang->Get("plugin_manager"), array("mode"=>"plugins"))."<br /><br />\n";
 88: 		if ($DESK->ContextManager->Permission("sysadmin_advanced"))
 89: 			echo sa_link($DESK->Lang->Get("system_vars"), array("mode"=>"sysvars"))."<br /><br />\n";
 90: 	}
 91: 	
 92: }
 93: 
 94: else if ($mode == "user")
 95: {
 96: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
 97: 	echo "<h3>".$DESK->Lang->Get("admin_user")."</h3>\n";
 98: 	
 99: 	// TODO: PUT INTO CORE
100: 	$q="SELECT username,realname FROM ".$DESK->Database->Table("user");
101: 	$r=$DESK->Database->Query($q);
102: 	while ($row=$DESK->Database->FetchAssoc($r))
103: 	{
104: 		echo "<form id=\"delete_".$row['username']."\" onsubmit=\"return false;\">";
105: 		
106: 		echo "<input type=\"hidden\" name=\"mode\" value=\"delete_user\" />\n";
107: 		echo "<input type=\"hidden\" name=\"username\" value=\"".$row['username']."\" />\n";
108: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if (confirm('Delete user ".$row['username']."')) DESK.formAPI('delete_".$row['username']."',false,false,DESK.refreshSubpage);\" />\n";
109: 		
110: 		$oa = array("mode" => "useredit", "username" => $row['username']);
111: 		echo sa_link($row['username'].": ".$row['realname'], $oa)." ";
112: 		
113: 		echo "</form>";
114: 		
115: 		//echo "<br />";
116: 	}
117: 	$DESK->Database->Free($r);
118: 	
119: 	echo "<br /><b>".$DESK->Lang->Get("user_create")."</b><br /><br />\n";
120: 	echo "<form id=\"create_user\" onsubmit=\"return false;\">\n";
121: 	echo "<input type=\"hidden\" name=\"mode\" value=\"create_user\">\n";
122: 	echo $DESK->Lang->Get("username")." ";
123: 	echo "<input type=\"text\" name=\"username\" value=\"\" /> \n";
124: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('create_user',false,false,DESK.refreshSubpage);\" />\n";
125: 	echo "</form>\n";
126: 	
127: }
128: else if ($mode == "useredit")
129: {
130: 	$q="SELECT * FROM ".$DESK->Database->Table("user")." WHERE ".$DESK->Database->Field("username")."=".$DESK->Database->SafeQuote($_REQUEST['username']);
131: 	$r=$DESK->Database->Query($q);
132: 	$row=$DESK->Database->FetchAssoc($r);
133: 	$DESK->Database->Free($r);
134: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))." \n";
135: 	echo sa_link("&lt;&lt; ".$DESK->Lang->Get("admin_user"),array("mode"=>"user"))."<br />\n";
136: 	
137: 	echo "<h3>".$row['realname']."</h3>\n";
138: 	
139: 	echo "<form id=\"user_admin\" action=\"#\" onsubmit=\"return false;\">\n";
140: 	echo "<table>\n";
141: 	echo "<input type=\"hidden\" name=\"mode\" value=\"user_edit\" />\n";
142: 	echo "<input type=\"hidden\" name=\"original_username\" value=\"".$row['username']."\" />\n";
143: 	
144: 	echo "<tr><td>\n";
145: 	echo $DESK->Lang->Get("username");
146: 	echo "</td><td>\n";
147: 	echo "<input type=\"text\" name=\"username\" value=\"".$row['username']."\" />\n";
148: 	echo "</td></tr>\n";
149: 	
150: 	echo "<tr><td>\n";
151: 	echo $DESK->Lang->Get("realname");
152: 	echo "</td><td>\n";
153: 	echo "<input type=\"text\" name=\"realname\" value=\"".$row['realname']."\" />\n";
154: 	echo "</td></tr>\n";
155: 	
156: 	echo "<tr><td>\n";
157: 	echo $DESK->Lang->Get("email");
158: 	echo "</td><td>\n";
159: 	echo "<input type=\"text\" name=\"email\" value=\"".$row['email']."\" />\n";
160: 	echo "</td></tr>\n";
161: 	
162: 	$q="SELECT * FROM ".$DESK->Database->Table("teamuserlink")." WHERE ".$DESK->Database->Field("username")."=".$DESK->Database->SafeQuote($row['username']);
163: 	$r=$DESK->Database->Query($q);
164: 	$teams=array();
165: 	while ($trow = $DESK->Database->FetchAssoc($r))
166: 	{
167: 		$teams[$trow['teamid']] = true;
168: 	}
169: 	$DESK->Database->Free($r);
170: 	
171: 	echo "<tr><td>\n";
172: 	echo $DESK->Lang->Get("team_membership");
173: 	echo "</td><td>\n";
174: 	
175: 	$tq="SELECT * FROM ".$DESK->Database->Table("team");
176: 	$tr=$DESK->Database->Query($tq);
177: 	$first=false;
178: 	while ($trow = $DESK->Database->FetchAssoc($tr))
179: 	{
180: 		if ($first)
181: 			$first=false;
182: 		else echo "<br />";
183: 		
184: 		$s = "<input type=\"checkbox\" name=\"team[]\" value=\"".$trow['teamid']."\"";
185: 		if (isset($teams[$trow['teamid']]))
186: 			$s.=" checked";
187: 		$s.="> ".$trow['teamname'];
188: 		echo $s;
189: 	}
190: 	
191: 	echo "</td></tr>\n";
192: 	
193: 	
194: 	
195: 	echo "<tr><td>\n";
196: 	echo $DESK->Lang->Get("permgroup");
197: 	echo "</td><td>\n";
198: 	$pg = $row['permgroup'];
199: 	if ($pg == "")
200: 		$pg = 0;
201: 	
202: 	$groups = array ( 0 => "None" );
203: 	
204: 	$pgq="SELECT * FROM ".$DESK->Database->Table("permgroup");
205: 	$pgr=$DESK->Database->Query($pgq);
206: 	while($pgrow = $DESK->Database->FetchAssoc($pgr))
207: 	{
208: 		$groups[$pgrow['permgroupid']] = $pgrow['groupname'];
209: 	}
210: 	$DESK->Database->Free($pgr);
211: 	
212: 	echo "<select name=\"permgroup\">\n";
213: 	foreach($groups as $id => $name)
214: 	{
215: 		$o = "<option value=\"".$id."\"";
216: 		if ($id == $pg)
217: 			$o.=" selected";
218: 		$o.=">".$name."</option>\n";
219: 		echo $o;
220: 	}
221: 	echo "</select>\n";
222: 	
223: 	echo "</td></tr>\n";
224: 	
225: 	echo "<tr><td>\n";
226: 	echo $DESK->Lang->Get("password");
227: 	echo "</td><td>\n";
228: 	echo "<input type=\"text\" name=\"password\" value=\"\">\n";
229: 	echo "</td></tr>\n";
230: 	
231: 	echo "<tr><td>&nbsp;</td>\n";
232: 	echo "<td><input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('user_admin');\"></td></tr>\n";
233: 	
234: 	echo "</table></form>";
235: 	
236: 	echo "<h3>".$DESK->Lang->Get("permissions")."</h3>\n";
237: 	
238: 	echo "<form id=\"permission_form\" onsubmit=\"return false;\">\n";
239: 	echo "<input type=\"hidden\" name=\"mode\" value=\"permission_save\" />\n";
240: 	echo "<input type=\"hidden\" name=\"type\" value=\"user\" />\n";
241: 	echo "<input type=\"hidden\" name=\"username\" value=\"".$_REQUEST['username']."\" />\n";
242: 	echo "<table class=\"searchList\">\n";
243: 	
244: 	$perms = $DESK->PermissionManager->UserPermissionList($_REQUEST['username']);
245: 	
246: 	$row=0;
247: 	
248: 	foreach($perms as $perm => $allowed)
249: 	{
250: 		// HTML-Safe
251: 		$permhtml = str_replace(".","#",$perm);
252: 	
253: 		$class = "row".$row++;
254: 		if ($row>1) $row=0;
255: 		echo "<tr class=\"".$class."\">";
256: 		
257: 		echo "<td>\n";
258: 		echo $perm;
259: 		echo "</td>\n";
260: 		
261: 		echo "<td>\n";
262: 		echo "<input type=\"radio\" name=\"".$permhtml."\" value=\"-1\"";
263: 		if ($allowed == -1)
264: 			echo " checked";
265: 		echo " />";
266: 		echo $DESK->Lang->Get("undefined");
267: 		echo "</td>";
268: 		
269: 		echo "<td>\n";
270: 		echo "<input type=\"radio\" name=\"".$permhtml."\" value=\"0\"";
271: 		if ($allowed == 0)
272: 			echo " checked";
273: 		echo " />";
274: 		echo $DESK->Lang->Get("denied");
275: 		echo "</td>";
276: 		
277: 		echo "<td>\n";
278: 		echo "<input type=\"radio\" name=\"".$permhtml."\" value=\"1\"";
279: 		if ($allowed == 1)
280: 			echo " checked";
281: 		echo " />";
282: 		echo $DESK->Lang->Get("allowed");
283: 		echo "</td>";
284: 		
285: 		
286: 		echo "</tr>";
287: 	}
288: 	
289: 	echo "<tr><td> </td><td>\n";
290: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('permission_form');\" />\n";
291: 	echo "</td></tr>";
292: 	
293: 	echo "</table>\n";
294: 	echo "</form>\n";
295: 	
296: 	//echo memory_get_usage();
297: }
298: else if ($mode == "group")
299: {
300: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
301: 	echo "<h3>".$DESK->Lang->Get("admin_group")."</h3>\n";
302: 	$groups = $DESK->PermissionManager->GroupList();
303: 	
304: 	foreach($groups as $id => $name)
305: 	{
306: 		echo "<form id=\"delete_group_".$id."\" onsubmit=\"return false;\" />\n";
307: 		echo "<input type=\"hidden\" name=\"mode\" value=\"permgroup_delete\" />\n";
308: 		echo "<input type=\"hidden\" name=\"permgroupid\" value=\"".$id."\" />\n";
309: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('Delete group ".$id."')) DESK.formAPI('delete_group_".$id."',false,false,DESK.refreshSubpage);\" />\n";
310: 		echo " ";
311: 		$opts = array("mode" => "groupedit", "permgroupid" => $id);
312: 		echo sa_link($id.": ".$name,$opts);
313: 		echo "\n</form>\n";
314: 	}
315: 	
316: 	echo "<br />";
317: 	echo "<form id=\"create_group\" onsubmit=\"return false;\">\n";
318: 	echo "<input type=\"hidden\" name=\"mode\" value=\"permgroup_create\">\n";
319: 	echo $DESK->Lang->Get("admin_group")." ";
320: 	echo "<input type=\"text\" name=\"groupname\" value=\"\" /> \n";
321: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('create_group',false,false,DESK.refreshSubpage);\" />\n";
322: 	echo "</form>\n";
323: }
324: else if ($mode == "groupedit")
325: {
326: 	$groups = $DESK->PermissionManager->GroupList();
327: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))." \n";
328: 	echo sa_link("&lt;&lt; ".$DESK->Lang->Get("admin_group"),array("mode"=>"group"))."<br />\n";
329: 	$group = $groups[$_REQUEST['permgroupid']];
330: 	$id=$_REQUEST['permgroupid'];
331: 	echo "<h3>".$id.": ".$group."</h3>\n";
332: 	
333: 	echo "<form id=\"permission_form\" onsubmit=\"return false;\">\n";
334: 	echo "<input type=\"hidden\" name=\"mode\" value=\"permission_save\" />\n";
335: 	echo "<input type=\"hidden\" name=\"type\" value=\"group\" />\n";
336: 	echo "<input type=\"hidden\" name=\"groupid\" value=\"".$id."\" />\n";
337: 	echo "<table class=\"searchList\">\n";
338: 	
339: 	$perms = $DESK->PermissionManager->GroupPermissionList($id);
340: 	
341: 	$row=0;
342: 	
343: 	foreach($perms as $perm => $allowed)
344: 	{
345: 		// HTML-Safe
346: 		$permhtml = str_replace(".","#",$perm);
347: 	
348: 		$class = "row".$row++;
349: 		if ($row>1) $row=0;
350: 		echo "<tr class=\"".$class."\">";
351: 		
352: 		echo "<td>\n";
353: 		echo $perm;
354: 		echo "</td>\n";
355: 		
356: 		echo "<td>\n";
357: 		echo "<input type=\"radio\" name=\"".$permhtml."\" value=\"-1\"";
358: 		if ($allowed == -1)
359: 			echo " checked";
360: 		echo " />";
361: 		echo $DESK->Lang->Get("undefined");
362: 		echo "</td>";
363: 		
364: 		echo "<td>\n";
365: 		echo "<input type=\"radio\" name=\"".$permhtml."\" value=\"0\"";
366: 		if ($allowed == 0)
367: 			echo " checked";
368: 		echo " />";
369: 		echo $DESK->Lang->Get("denied");
370: 		echo "</td>";
371: 		
372: 		echo "<td>\n";
373: 		echo "<input type=\"radio\" name=\"".$permhtml."\" value=\"1\"";
374: 		if ($allowed == 1)
375: 			echo " checked";
376: 		echo " />";
377: 		echo $DESK->Lang->Get("allowed");
378: 		echo "</td>";
379: 		
380: 		
381: 		echo "</tr>";
382: 	}
383: 	
384: 	echo "<tr><td> </td><td>\n";
385: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('permission_form');\" />\n";
386: 	echo "</td></tr>";
387: 	
388: 	echo "</table>\n";
389: 	echo "</form>\n";
390: }
391: else if ($mode == "teams")
392: {
393: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
394: 	echo "<table>";
395: 	$teams = $DESK->RequestManager->TeamList();
396: 	foreach($teams as $id => $teamname)
397: 	{
398: 		echo "<tr><td>";
399: 		echo "<form id=\"team_delete_".$id."\" onsubmit=\"return false;\">\n";
400: 		echo "<input type=\"hidden\" name=\"mode\" value=\"team_delete\" />\n";
401: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
402: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('Delete team ".$teamname."')) DESK.formAPI('team_delete_".$id."',false,false,DESK.refreshSubpage);\" />\n";
403: 		echo "</form>\n";
404: 		echo "</td><td>";
405: 		echo "<form id=\"team_update_".$id."\" onsubmit=\"return false;\">\n";
406: 		echo "<input type=\"hidden\" name=\"mode\" value=\"team_update\" />\n";
407: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
408: 		echo $id." : ";
409: 		echo "<input type=\"text\" name=\"teamname\" value=\"".$teamname."\" /> \n";
410: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('team_update_".$id."',false,false,DESK.refreshSubpage);\" />\n";
411: 		echo "</form>\n";
412: 		echo "</td></tr>";
413: 	}
414: 	echo "</table>";
415: 	echo "<br />";
416: 	echo "<form id=\"team_create\" onsubmit=\"return false;\">\n";
417: 	echo "<input type=\"hidden\" name=\"mode\" value=\"team_create\" />\n";
418: 	echo "<input type=\"text\" name=\"teamname\" value=\"\" /> \n";
419: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('team_create',false,false,DESK.refreshSubpage);\" />\n";
420: 	echo "</form>\n";
421: }
422: else if ($mode == "status")
423: {
424: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
425: 	$status = $DESK->RequestManager->StatusList();
426: 	echo "<table>";
427: 	foreach($status as $id => $name)
428: 	{
429: 		echo "<tr><td>";
430: 		if ($id>0)
431: 		{
432: 			echo "<form id=\"status_delete_".$id."\" onsubmit=\"return false;\">\n";
433: 			echo "<input type=\"hidden\" name=\"mode\" value=\"status_delete\" />\n";
434: 			echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
435: 			echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('Delete ".$name."')) DESK.formAPI('status_delete_".$id."',false,false,DESK.refreshSubpage);\" />\n";
436: 			echo "</form>";
437: 		}
438: 		else
439: 			echo "  ";
440: 		echo "</td><td>\n";
441: 		echo "<form id=\"status_update_".$id."\" onsubmit=\"return false;\">\n";
442: 		echo "<input type=\"hidden\" name=\"mode\" value=\"status_update\" />\n";
443: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
444: 		echo "<input type=\"text\" name=\"name\" value=\"".$name."\" /> \n";
445: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('status_update_".$id."',false,false,DESK.refreshSubpage);\" />\n";
446: 		echo "</form>\n";
447: 		echo "</td></tr>\n";
448: 	}
449: 	echo "</table>\n";
450: 	echo "<br /><br />";
451: 	echo "<form id=\"status_create\" onsubmit=\"return false;\">\n";
452: 	echo "<input type=\"hidden\" name=\"mode\" value=\"status_create\" />\n";
453: 	echo "<input type=\"text\" name=\"name\" value=\"\" /> \n";
454: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('status_create',false,false,DESK.refreshSubpage);\" />\n";
455: 	echo "</form>\n";
456: }
457: else if ($mode == "plugins")
458: {
459: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
460: 	echo "<h3>".$DESK->Lang->Get("plugin_manager")."</h3>\n";
461: 	
462: 	$pims = $DESK->PluginManager->ListPIMS();
463: 	
464: 	echo "<table>";
465: 	
466: 	foreach($pims as $id => $data)
467: 	{
468: 		echo "<tr>\n";
469: 		echo "<td>\n";
470: 		echo $id."\n";
471: 		echo "</td>\n";
472: 		
473: 		if ($data['installed'])
474: 		{
475: 			if ($data['data']['active'])
476: 			{
477: 				echo "<td>\n";
478: 				echo "<form id=\"deact_".$id."\" onsubmit=\"return false;\">\n";
479: 				echo "<input type=\"hidden\" name=\"mode\" value=\"plugin_deactivate\" />\n";
480: 				echo "<input type=\"hidden\" name=\"id\" value=\"".$data['data']['id']."\" />\n";
481: 				echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("deactivate")."\" onclick=\"DESK.formAPI('deact_".$id."',false,false,DESK.refreshSubpage);\" />\n";
482: 				echo "</form>\n";
483: 				echo "</td>";
484: 			}
485: 			else
486: 			{
487: 				echo "<td>\n";
488: 				echo "<form id=\"act_".$id."\" onsubmit=\"return false;\">\n";
489: 				echo "<input type=\"hidden\" name=\"mode\" value=\"plugin_activate\" />\n";
490: 				echo "<input type=\"hidden\" name=\"id\" value=\"".$data['data']['id']."\" />\n";
491: 				echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("activate")."\" onclick=\"DESK.formAPI('act_".$id."',false,false,DESK.refreshSubpage);\" />\n";
492: 				echo "</form>\n";
493: 				echo "<td>\n";
494: 				
495: 				echo "<td>\n";
496: 				echo "<form id=\"uninst_".$id."\" onsubmit=\"return false;\">\n";
497: 				echo "<input type=\"hidden\" name=\"mode\" value=\"plugin_uninstall\" />\n";
498: 				echo "<input type=\"hidden\" name=\"id\" value=\"".$data['data']['id']."\" />\n";
499: 				echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("uninstall")."\" onclick=\"DESK.formAPI('uninst_".$id."',false,false,DESK.refreshSubpage);\" />\n";
500: 				echo "</form>\n";
501: 				echo "<td>\n";
502: 			}
503: 		}
504: 		else
505: 		{
506: 			echo "<td>\n";
507: 			echo "<form id=\"inst_".$id."\" onsubmit=\"return false;\">\n";
508: 			echo "<input type=\"hidden\" name=\"mode\" value=\"plugin_install\" />\n";
509: 			echo "<input type=\"hidden\" name=\"plugin\" value=\"".$id."\" />\n";
510: 			echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("install")."\" onclick=\"DESK.formAPI('inst_".$id."',false,false,DESK.refreshSubpage);\" />\n";
511: 			echo "</form>\n";
512: 			echo "<td>\n";
513: 		}
514: 		
515: 		
516: 		
517: 		
518: 		echo "</tr>";
519: 	}
520: 	
521: 	echo "</table>";
522: }
523: else if ($mode == "sysvars")
524: {
525: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
526: 	echo "<h3>".$DESK->Lang->Get("system_vars")."</h3>\n";
527: 	
528: 	if ($DESK->ContextManager->Permission("sysadmin_advanced"))
529: 	{
530: 		$items = $DESK->Configuration->GetAll();
531: 	
532: 		echo "<table>\n";
533: 	
534: 		foreach($items as $id => $val)
535: 		{
536: 			echo "<tr>\n";
537: 			echo "<td>".$id."</td>\n";
538: 			echo "<td>\n";
539: 			echo "<form id=\"save_".$id."\" onsubmit=\"return false;\">\n";
540: 			echo "<input type=\"hidden\" name=\"mode\" value=\"sysvar_save\" />\n";
541: 			echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
542: 			echo "<input type=\"text\" name=\"value\" value=\"".$val."\" />\n";
543: 			echo "</td>\n";
544: 			echo "<td>\n";
545: 			echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('save_".$id."',false,false,DESK.refreshSubpage);\" />\n";
546: 			echo "</form>\n";
547: 			echo "</td>";
548: 			echo "<td>\n";
549: 			echo "<form id=\"delete_".$id."\" onsubmit=\"return false;\">\n";
550: 			echo "<input type=\"hidden\" name=\"mode\" value=\"sysvar_delete\" />\n";
551: 			echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
552: 			echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('".$DESK->Lang->Get("delete")."?')) DESK.formAPI('delete_".$id."',false,false,DESK.refreshSubpage);\" />\n";
553: 			echo "</form>\n";
554: 			echo "</td></tr>\n";
555: 		}
556: 	
557: 		echo "<tr><td colspan=\"2\">\n";
558: 		echo "<form id=\"create_sysvar\" onsubmit=\"return false;\">";
559: 		echo "<input type=\"hidden\" name=\"mode\" value=\"sysvar_create\" />\n";
560: 		echo "<input type=\"text\" name=\"id\" value=\"\" /> \n";
561: 		//echo "</td><td>\n";
562: 		echo "<input type=\"text\" name=\"value\" value=\"\" />\n";
563: 		echo "</td><td>\n";
564: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('create_sysvar',false,false,DESK.refreshSubpage);\" />\n";
565: 		echo "</td></tr>\n";
566: 		echo "</form>\n";
567: 	
568: 		echo "</table>";
569: 	}
570: }
571: else if ($mode == "requestclass")
572: {
573: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
574: 	echo "<h3>".$DESK->Lang->Get("request_class")."</h3>\n";
575: 
576: 	$classes = $DESK->RequestManager->GetRequestClasses();
577: 	echo "<table>\n";
578: 	
579: 	$reqs = $DESK->PluginManager->GetType("request");
580: 		$classnames = array("");
581: 		foreach($reqs as $req)
582: 			if ($req['classname']!="")
583: 				$classnames[]=$req['classname'];
584: 	
585: 	foreach($classes as $id => $class)
586: 	{
587: 		echo "<tr>\n";
588: 		echo "<td>\n";
589: 		echo "<form id=\"save_".$id."\" onsubmit=\"return false;\">\n";
590: 		echo $id."\n";
591: 		echo " <input type=\"text\" name=\"classname\" value=\"".$class['classname']."\" />\n";
592: 	
593: 		
594: 		echo " <select name=\"classclass\">\n";
595: 		foreach($classnames as $classclass)
596: 		{
597: 			$s="";
598: 			if ($classclass == $row['classclass'])
599: 				$s=" selected";
600: 			echo "<option value=\"".$classclass."\"".$s.">".$classclass."</option>\n";
601: 		}
602: 		echo "</select>";
603: 		echo "\n";
604: 		
605: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
606: 		echo "<input type=\"hidden\" name=\"mode\" value=\"reqclass_save\" />\n";
607: 		echo " <input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('save_".$id."',false,false,DESK.refreshSubpage);\" />\n";
608: 		echo "</form></td>\n";
609: 		
610: 		echo "<td>\n";
611: 		echo "<form id=\"delete_".$id."\" onsubmit=\"return false;\">\n";
612: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
613: 		echo "<input type=\"hidden\" name=\"mode\" value=\"reqclass_delete\" />\n";
614: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('".$DESK->Lang->Get("delete")."?')) DESK.formAPI('delete_".$id."',false,false,DESK.refreshSubpage);\" />\n";
615: 		echo "</form>\n";
616: 		echo "</td>\n";
617: 		echo "</tr>\n";
618: 	}
619: 	echo "</table>\n";
620: 	
621: 	echo "<form id=\"create_rc\" onsubmit=\"return false;\">\n";
622: 	echo "<input type=\"hidden\" name=\"mode\" value=\"reqclass_create\" />\n";
623: 	echo "<table>\n";
624: 	echo "<tr><td>&nbsp;</td>\n";
625: 	echo "<td><input type=\"text\" name=\"classname\" /></td>\n";
626: 	echo "<td><select name=\"classclass\">\n";
627: 	foreach($classnames as $classclass)
628: 	{
629: 		echo "<option value=\"".$classclass."\">".$classclass."</option>\n";
630: 	}
631: 	echo "</select>";
632: 	echo "</td>\n";
633: 	echo "<td><input type=\"submit\" value=\"".$DESK->Lang->Get("create")."\" onclick=\"DESK.formAPI('create_rc',false,false,DESK.refreshSubpage);\" /></td>\n";
634: 	echo "</tr>\n";
635: 	
636: 	echo "</table>\n";
637: 	echo "</form>\n";
638: }
639: else if ($mode=="priorities")
640: {
641: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
642: 	echo "<h3>".$DESK->Lang->Get("request_priority")."</h3>\n";
643: 
644: 	$priorities = $DESK->RequestManager->GetPriorityList();
645: 	echo "<table>\n";
646: 	
647: 	foreach($priorities as $id => $priority)
648: 	{
649: 		$seconds = $priority['resolutionsla'];
650: 		$hours = 0;
651: 		$mins = 0;
652: 		$secs = 0;
653: 		
654: 		if ($seconds>=3600)
655: 		{
656: 			$hours = (int)($seconds/3600);
657: 			$seconds -= ($hours*3600);
658: 		}
659: 		if ($seconds>=60)
660: 		{
661: 			$minutes = (int)($seconds/60);
662: 			$seconds -= ($minutes*60);
663: 		}
664: 		$secs = $seconds;
665: 		
666: 		echo "<tr>\n";
667: 		echo "<td><form id=\"save_".$id."\" onsubmit=\"return false;\">\n";
668: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
669: 		echo "<input type=\"hidden\" name=\"mode\" value=\"priority_save\" />\n";
670: 		echo $id."\n";
671: 		echo " <input type=\"text\" name=\"name\" value=\"".$priority['priorityname']."\" />\n";
672: 		
673: 		echo " <input type=\"text\" name=\"hours\" size=\"3\" onchange=\"DESK.formToSeconds('save_".$id."','hours','minutes','seconds','sla');\" value=\"".$hours."\" />:\n";
674: 		echo " <input type=\"text\" name=\"minutes\" size=\"3\" onchange=\"DESK.formToSeconds('save_".$id."','hours','minutes','seconds','sla');\" value=\"".$minutes."\" />:\n";
675: 		echo " <input type=\"text\" name=\"seconds\" size=\"3\" onchange=\"DESK.formToSeconds('save_".$id."','hours','minutes','seconds','sla');\" value=\"".$secs."\" />:\n";
676: 		
677: 		echo " <input type=\"text\" name=\"sla\" size=\"5\" value=\"".$priority['resolutionsla']."\" readonly=\"1\"/>\n";
678: 		echo " <input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('save_".$id."',false,false,DESK.refreshSubpage);\" />\n";
679: 		echo "</form></td>\n";
680: 		echo "<td><form id=\"delete_".$id."\" onsubmit=\"return false;\">\n";
681: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
682: 		echo "<input type=\"hidden\" name=\"mode\" value=\"priority_delete\" />\n";
683: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('".$DESK->Lang->Get("delete")."?')) DESK.formAPI('delete_".$id."',false,false,DESK.refreshSubpage);\" />\n";
684: 		echo "</form></td>\n";
685: 		echo "</tr>\n";
686: 	}
687: 	echo "</table>\n";
688: 	
689: 	echo "<form id=\"create_priority\" onsubmit=\"return false;\">\n";
690: 	echo "<input type=\"hidden\" name=\"mode\" value=\"priority_create\" />\n";
691: 	echo "<table>\n";
692: 	echo "<tr>\n";
693: 	
694: 	echo "<td>&nbsp;";
695: 	echo "</td>\n";
696: 	echo "<td><input type=\"text\" name=\"name\" /></td>\n";
697: 	echo "<td><input type=\"text\" name=\"hours\" size=\"3\" onchange=\"DESK.formToSeconds('create_priority','hours','minutes','seconds','sla');\" value=\"0\" />:</td>\n";
698: 	echo "<td><input type=\"text\" name=\"minutes\" size=\"3\" onchange=\"DESK.formToSeconds('create_priority','hours','minutes','seconds','sla');\" value=\"00\" />:</td>\n";
699: 	echo "<td><input type=\"text\" name=\"seconds\" size=\"3\" onchange=\"DESK.formToSeconds('create_priority','hours','minutes','seconds','sla');\" value=\"00\" />=</td>\n";
700: 	echo "<td><input type=\"text\" name=\"sla\" size=\"5\" readonly=\"1\" value=\"0\" /></td>\n";
701: 	echo "<td><input type=\"submit\" value=\"".$DESK->Lang->Get("create")."\" onclick=\"DESK.formAPI('create_priority',false,false,DESK.refreshSubpage);\" /></td>\n";
702: 	
703: 	echo "</tr>\n";
704: 	
705: 	echo "</table>\n";
706: 	
707: 	echo "</form>\n";
708: 		
709: }
710: 
711: else if ($mode == "emailaccounts") // p: email_accounts
712: {
713: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
714: 	echo "<h3>".$DESK->Lang->Get("email_accounts")."</h3>\n";
715: 	
716: 	$accounts = $DESK->Email->GetAccounts();
717: 	
718: 	echo "<table>\n";
719: 	foreach($accounts as $id => $account)
720: 	{
721: 		echo "<tr>\n";
722: 		echo "<td>".$account['name']."</td>\n";
723: 		echo "<td>&lt;".$account['from']."&gt;</td>\n";
724: 		echo "<td>".sa_link($DESK->Lang->Get("edit"),array("mode"=>"emailaccounts","edit"=>$id))."</td>\n";
725: 		echo "<td>\n";
726: 		echo "<form id=\"delete_opt_".$id."\" onsubmit=\"return false;\">\n";
727: 		echo "<input type=\"hidden\" name=\"mode\" value=\"email_delete\" />\n";
728: 		echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
729: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("delete")."\" onclick=\"if(confirm('".$DESK->Lang->Get("delete")."?')) DESK.formAPI('delete_opt_".$id."',false,false,DESK.refreshSubpage);\" />\n";
730: 		echo "</form>\n";
731: 		echo "</td>\n";
732: 		echo "</tr>\n";
733: 	}
734: 	echo "</table>\n";
735: 	echo "<br />";
736: 	echo "<form id=\"email_create\" onsubmit=\"return false;\">\n";
737: 	echo "<input type=\"text\" name=\"name\" value=\"Account Name\" /> ";
738: 	echo "<input type=\"hidden\" name=\"mode\" value=\"email_create\" />\n";
739: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("create")."\" onclick=\"DESK.formAPI('email_create',false,false,DESK.refreshSubpage);\" />\n";
740: 	echo "</form>\n";
741: 	echo "<br /><br />";
742: 	
743: 	if (isset($_REQUEST['edit']))
744: 	{
745: 		$id=$_REQUEST['edit'];
746: 		
747: 		if (isset($accounts[$id]))
748: 		{
749: 			$acc = $accounts[$id];
750: 			echo "<h3>".$DESK->Lang->Get("edit").": ".$acc['name']."</h3>\n";
751: 			
752: 			echo "<form id=\"save_email\" onsubmit=\"return false;\">\n";
753: 			echo "<input type=\"hidden\" name=\"mode\" value=\"email_save\" />\n";
754: 			echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
755: 			echo "<table>\n";
756: 		
757: 			echo "<tr>\n";
758: 			echo "<td>".$DESK->Lang->Get("name")."</td>\n";
759: 			echo "<td><input type=\"text\" name=\"name\" value=\"".$acc['name']."\" /></td>\n";
760: 			echo "</tr>\n";
761: 		
762: 			echo "<tr>\n";
763: 			echo "<td>".$DESK->Lang->Get("host")."</td>\n";
764: 			echo "<td><input type=\"text\" name=\"host\" value=\"".$acc['host']."\" /></td>\n";
765: 			echo "</tr>\n";
766: 			echo "<tr><td colspan=\"2\">".$DESK->Lang->Get("hostdesc")."</td></tr>\n";
767: 			
768: 			echo "<tr>\n";
769: 			echo "<td>".$DESK->Lang->Get("from")."</td>\n";
770: 			echo "<td><input type=\"text\" name=\"from\" value=\"".$acc['from']."\" /></td>\n";
771: 			echo "</tr>\n";
772: 			
773: 			echo "<tr>\n";
774: 			echo "<td>".$DESK->Lang->Get("fromname")."</td>\n";
775: 			echo "<td><input type=\"text\" name=\"fromname\" value=\"".$acc['fromname']."\" /></td>\n";
776: 			echo "</tr>\n";
777: 			
778: 			echo "<tr>\n";
779: 			echo "<td>".$DESK->Lang->Get("wordwrap")."</td>\n";
780: 			echo "<td><input type=\"text\" name=\"wordwrap\" value=\"".$acc['wordwrap']."\" size=\"5\" /></td>\n";
781: 			echo "</tr>\n";
782: 			
783: 			echo "<tr>\n";
784: 			echo "<td>".$DESK->Lang->Get("auth")."</td>\n";
785: 			echo "<td>\n";
786: 			echo "<select name=\"auth\">\n";
787: 			$opts = array( 1 => $DESK->Lang->Get("yes"), 0 => $DESK->Lang->Get("no") );
788: 			foreach($opts as $key => $val)
789: 			{
790: 				if ($acc['auth'] == $key)
791: 					$s="selected";
792: 				else
793: 					$s="";
794: 				echo "<option value=\"".$key."\"".$s.">".$val."</option>\n";
795: 			}
796: 			echo "</select>\n";
797: 			echo "</td>\n";
798: 			echo "</tr>\n";
799: 			
800: 			echo "<tr>\n";
801: 			echo "<td>".$DESK->Lang->Get("username")."</td>\n";
802: 			echo "<td><input type=\"text\" name=\"username\" value=\"".$acc['username']."\" /></td>\n";
803: 			echo "</tr>\n";
804: 			
805: 			echo "<tr>\n";
806: 			echo "<td>".$DESK->Lang->Get("password")."</td>\n";
807: 			echo "<td><input type=\"text\" name=\"password\" value=\"".$acc['password']."\" /></td>\n";
808: 			echo "</tr>\n";
809: 			
810: 			echo "<tr>\n";
811: 			echo "<td>".$DESK->Lang->Get("smtpsec")."</td>\n";
812: 			echo "<td>\n";
813: 			echo "<select name=\"smtpsec\">\n";
814: 			$opts = array( "" => $DESK->Lang->Get("none"), "ssl" => "SSL", "tls" => "TLS" );
815: 			foreach($opts as $key => $val)
816: 			{
817: 				if ($acc['smtpsec'] == $key)
818: 					$s="selected";
819: 				else
820: 					$s="";
821: 				echo "<option value=\"".$key."\"".$s.">".$val."</option>\n";
822: 			}
823: 			echo "</select>\n";
824: 			echo "</td>\n";
825: 			echo "</tr>\n";
826: 			
827: 			echo "<tr>\n";
828: 			echo "<td>&nbsp;</td>\n";
829: 			echo "<td>\n";
830: 			echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('save_email',false,false,DESK.refreshSubpage);\" />\n";
831: 			echo "</td>\n";
832: 			echo "</tr>\n";
833: 			
834: 			echo "</table>\n";
835: 			echo "</form>\n";
836: 		}
837: 	}
838: 	
839: 	if ($DESK->Email->hasAccounts())
840: 	{
841: 		echo "<br /><h3>".$DESK->Lang->Get("test")."</h3>\n";
842: 	
843: 		echo "<form id=\"email_test\" onsubmit=\"return false;\">\n";
844: 		echo "<input type=\"hidden\" name=\"mode\" value=\"email_test\" />\n";
845: 		
846: 		echo "<select name=\"id\">";
847: 		foreach($accounts as $id => $account)
848: 		{
849: 			echo "<option value=\"".$id."\">".$account['name']." &lt;".$account['from']."&gt;</option>\n";
850: 		}
851: 		echo "</select> \n";
852: 		echo "<input type=\"text\" name=\"to\"> \n";
853: 		echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("test")."\" onclick=\"DESK.formAPI('email_test',false,false,DESK.refreshSubpage);\" />\n";
854: 		
855: 		echo "</form>\n";
856: 	}
857: 	
858: }
859: 
860: else if ($mode == "emailtemplates") // p: email_templates
861: {
862: 	echo "<br />".sa_link("&lt;&lt; ".$DESK->Lang->Get("system_admin"))."<br />\n";
863: 	echo "<h3>".$DESK->Lang->Get("email_templates")."</h3>\n";
864: 	
865: 	echo $DESK->Lang->Get("available_macro").": %requestid%, %customer%, %update%<br /><br />\n";
866: 	
867: 	$id = "open";
868: 	echo "<h3>".$DESK->Lang->Get("template_open")."</h3>";
869: 	$t = $DESK->Email->GetTemplate($id);
870: 	if ($t === false)
871: 	{
872: 		$sub = "";
873: 		$body = "";
874: 	}
875: 	else
876: 	{
877: 		$sub=$t['subject'];
878: 		$body=$t['body'];
879: 	}
880: 	echo "<form id=\"template_".$id."\" onsubmit=\"return false;\">\n";
881: 	echo "<input type=\"hidden\" name=\"mode\" value=\"template_save\" />\n";
882: 	echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
883: 	echo "<input type=\"text\" name=\"subject\" value=\"".$sub."\" size=\"50\" /><br />\n";
884: 	echo "<textarea name=\"body\" rows=\"10\" cols=\"50\">".$body."</textarea><br />\n";
885: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('template_".$id."',false,false,DESK.refreshSubpage);\" />\n";
886: 	echo "</form><br /><br />";
887: 	
888: 	
889: 	$id = "update";
890: 	echo "<h3>".$DESK->Lang->Get("template_update")."</h3>";
891: 	$t = $DESK->Email->GetTemplate($id);
892: 	if ($t === false)
893: 	{
894: 		$sub = "";
895: 		$body = "";
896: 	}
897: 	else
898: 	{
899: 		$sub=$t['subject'];
900: 		$body=$t['body'];
901: 	}
902: 	echo "<form id=\"template_".$id."\" onsubmit=\"return false;\">\n";
903: 	echo "<input type=\"hidden\" name=\"mode\" value=\"template_save\" />\n";
904: 	echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
905: 	echo "<input type=\"text\" name=\"subject\" value=\"".$sub."\" size=\"50\" /><br />\n";
906: 	echo "<textarea name=\"body\" rows=\"10\" cols=\"50\">".$body."</textarea><br />\n";
907: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('template_".$id."',false,false,DESK.refreshSubpage);\" />\n";
908: 	echo "</form><br /><br />";
909: 	
910: 	
911: 	$id = "close";
912: 	echo "<h3>".$DESK->Lang->Get("template_close")."</h3>";
913: 	$t = $DESK->Email->GetTemplate($id);
914: 	if ($t === false)
915: 	{
916: 		$sub = "";
917: 		$body = "";
918: 	}
919: 	else
920: 	{
921: 		$sub=$t['subject'];
922: 		$body=$t['body'];
923: 	}
924: 	echo "<form id=\"template_".$id."\" onsubmit=\"return false;\">\n";
925: 	echo "<input type=\"hidden\" name=\"mode\" value=\"template_save\" />\n";
926: 	echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\" />\n";
927: 	echo "<input type=\"text\" name=\"subject\" value=\"".$sub."\" size=\"50\" /><br />\n";
928: 	echo "<textarea name=\"body\" rows=\"10\" cols=\"50\">".$body."</textarea><br />\n";
929: 	echo "<input type=\"submit\" value=\"".$DESK->Lang->Get("save")."\" onclick=\"DESK.formAPI('template_".$id."',false,false,DESK.refreshSubpage);\" />\n";
930: 	echo "</form><br /><br />";
931: 	
932: }
933: 
934: else
935: {
936: 	echo "<h3>".$DESK->Lang->Get("system_admin")."</h3>\n";
937: 	echo ErrorCode::UnknownMode.": ".$DESK->Lang->Get("action_invalid")." (".$mode.")<br />\n";
938: 	exit();
939: }
940: echo "</html>";
941: ?>
942: