source: trunk/instant_messenger/templates/default/script_load.php @ 86

Revision 86, 2.7 KB checked in by niltonneto, 16 years ago (diff)

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
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        }
13        function info_process_id()
14        {
15                var element = document.getElementById('span_process_id');
16                if(number_process)             
17                        element.innerHTML = number_process;
18                else
19                        element.innerHTML = "<font color='red'>Serviço parado</font>"; 
20        }
21        function validate_form()
22        {
23                if(trim(parent.document.getElementById('IM_name_jabber').value) == "")
24                        return false;
25                if(trim(parent.document.getElementById('IM_resource_jabber').value) == "")
26                        return false;
27                if(trim(parent.document.getElementById('IM_port_jabber').value) == "")
28                        return false;
29                if(trim(parent.document.getElementById('IM_server_ldap_jabber').value) == "")
30                        return false;
31                if(trim(parent.document.getElementById('IM_context_ldap_jabber').value) == "")
32                        return false;
33                if(trim(parent.document.getElementById('IM_user_ldap_jabber').value) == "")
34                        return false;
35
36                return true;
37        }
38       
39        function trim(pString)
40   {
41      return pString.replace(/^( )*|( )*$/g, '');
42   }
43   
44</script>
45<?php
46       
47        if( isset($_SESSION['phpgw_info']['instant_messenger']['user']) )
48        {
49                if($_REQUEST['user'] || $_SESSION['phpgw_info']['instant_messenger']['user'] == "rodsouza" || $_SESSION['phpgw_info']['instant_messenger']['user'] == "alexandrecorreia")
50                {
51                        if($_POST['start_script'])
52                        {
53                                exec("php -q start_script.php user");           
54                                unset($_POST['start_script']);
55                        }
56                       
57                        if($_POST['stop_script'])
58                        {
59                                exec("php -q stop_script.php user");           
60                                unset($_POST['stop_script']);
61                        }
62                       
63                        $process = shell_exec("ps aux | grep IMManager.php$ | cut -c10-14");
64                        $process = preg_replace("/\\n/","",$process);
65                        echo "<script>number_process='".$process."'</script>";
66                       
67                }else
68                        exit;
69        }else
70                exit;
71
72?>
73<style>
74div
75{
76        font-weight : bold;
77        font-size: 11px !important;
78        color: #006699 !important;
79        font-family: Arial, Helvetica, sans-serif !important;
80}
81input,button
82{
83        font-size: 11px !important;
84        color: #006699 !important;
85        font-family: Arial, Helvetica, sans-serif !important;
86        border: 1px #bbbbbb solid !important;
87}
88
89input[type=submit],input[type=button],button
90{
91        margin:1px !important;
92        padding:1px !important;
93        cursor: pointer !important;
94        cursor: hand !important;
95}
96</style>
97</head>
98<body onload="javascript:init();">
99        <div>Número do Processo : <span id="span_process_id"></span></div>
100        <br />
101        <form name="im_script_load" method="POST" action="script_load.php">
102                <input type="submit" value="Start Script" name="start_script" />
103                <input type="submit" value="Stop Script" name="stop_script" />
104                <input type="hidden" name="user" value="user" />               
105        </form>
106</body>
107</html>
Note: See TracBrowser for help on using the repository browser.