1 | <html> |
---|
2 | <head> |
---|
3 | <script type="text/javascript"> |
---|
4 | var number_process = ""; |
---|
5 | |
---|
6 | function init() |
---|
7 | { |
---|
8 | info_process_id(); |
---|
9 | if(!validate_form() || number_process != "") |
---|
10 | document.im_script_load.start_script.disabled = true; |
---|
11 | } |
---|
12 | function info_process_id() |
---|
13 | { |
---|
14 | var element = document.getElementById('span_process_id'); |
---|
15 | if(number_process) |
---|
16 | element.innerHTML = number_process; |
---|
17 | else |
---|
18 | element.innerHTML = "<font color='red'>Serviço parado</font>"; |
---|
19 | } |
---|
20 | function validate_form() |
---|
21 | { |
---|
22 | if(trim(parent.document.getElementById('IM_name_jabber').value) == "") |
---|
23 | return false; |
---|
24 | if(trim(parent.document.getElementById('IM_resource_jabber').value) == "") |
---|
25 | return false; |
---|
26 | if(trim(parent.document.getElementById('IM_port_jabber').value) == "") |
---|
27 | return false; |
---|
28 | if(trim(parent.document.getElementById('IM_server_ldap_jabber').value) == "") |
---|
29 | return false; |
---|
30 | if(trim(parent.document.getElementById('IM_context_ldap_jabber').value) == "") |
---|
31 | return false; |
---|
32 | if(trim(parent.document.getElementById('IM_user_ldap_jabber').value) == "") |
---|
33 | return false; |
---|
34 | |
---|
35 | return true; |
---|
36 | } |
---|
37 | |
---|
38 | function trim(pString) |
---|
39 | { |
---|
40 | return pString.replace(/^( )*|( )*$/g, ''); |
---|
41 | } |
---|
42 | |
---|
43 | </script> |
---|
44 | <?php |
---|
45 | |
---|
46 | if($_POST['start_script']) |
---|
47 | { |
---|
48 | exec("php -q start_script.php"); |
---|
49 | unset($_POST['start_script']); |
---|
50 | } |
---|
51 | |
---|
52 | if($_POST['stop_script']) |
---|
53 | { |
---|
54 | exec("php -q stop_script.php"); |
---|
55 | unset($_POST['stop_script']); |
---|
56 | } |
---|
57 | |
---|
58 | $process = shell_exec("ps aux | grep IMManager.php$ | cut -c10-14"); |
---|
59 | $process = preg_replace("/\\n/","",$process); |
---|
60 | echo "<script>number_process='".$process."'</script>"; |
---|
61 | ?> |
---|
62 | <style> |
---|
63 | div |
---|
64 | { |
---|
65 | font-weight : bold; |
---|
66 | font-size: 11px !important; |
---|
67 | color: #006699 !important; |
---|
68 | font-family: Arial, Helvetica, sans-serif !important; |
---|
69 | } |
---|
70 | input,button |
---|
71 | { |
---|
72 | font-size: 11px !important; |
---|
73 | color: #006699 !important; |
---|
74 | font-family: Arial, Helvetica, sans-serif !important; |
---|
75 | border: 1px #bbbbbb solid !important; |
---|
76 | } |
---|
77 | |
---|
78 | input[type=submit],input[type=button],button |
---|
79 | { |
---|
80 | margin:1px !important; |
---|
81 | padding:1px !important; |
---|
82 | cursor: pointer !important; |
---|
83 | cursor: hand !important; |
---|
84 | } |
---|
85 | </style> |
---|
86 | </head> |
---|
87 | <body onload="javascript:init();"> |
---|
88 | <div>Número do Processo : <span id="span_process_id"></span></div> |
---|
89 | <br /> |
---|
90 | <form name="im_script_load" method="POST" action="script_load.php"> |
---|
91 | <input type="submit" value="Start Script" name="start_script" /> |
---|
92 | <input type="submit" value="Stop Script" name="stop_script" /> |
---|
93 | </form> |
---|
94 | </body> |
---|
95 | </html> |
---|