Subversion Repositories oidplus

Rev

Rev 337 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 337 Rev 360
Line 54... Line 54...
54
        }
54
        }
55
 
55
 
56
        public function gui($id, &$out, &$handled) {
56
        public function gui($id, &$out, &$handled) {
57
                if ($id === 'oidplus:automated_ajax_information_admin') {
57
                if ($id === 'oidplus:automated_ajax_information_admin') {
58
                        $handled = true;
58
                        $handled = true;
59
                        $out['title'] = 'Automated AJAX calls';
59
                        $out['title'] = _L('Automated AJAX calls');
60
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
60
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
61
 
61
 
62
                        if (!OIDplus::authUtils()::isAdminLoggedIn()) {
62
                        if (!OIDplus::authUtils()::isAdminLoggedIn()) {
63
                                $out['icon'] = 'img/error_big.png';
63
                                $out['icon'] = 'img/error_big.png';
64
                                $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as administrator.</p>';
64
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login')).'</p>';
65
                                return;
65
                                return;
66
                        }
66
                        }
67
 
67
 
68
                        $out['text'] .= '<p>You can make automated calls to your OIDplus account by calling the AJAX API.</p>';
68
                        $out['text'] .= '<p>'._L('You can make automated calls to your OIDplus account by calling the AJAX API.').'</p>';
69
                        $out['text'] .= '<p>The URL for the AJAX script is:</p>';
69
                        $out['text'] .= '<p>'._L('The URL for the AJAX script is:').':</p>';
70
                        $out['text'] .= '<p><b>'.OIDplus::getSystemUrl().'ajax.php</b></p>';
70
                        $out['text'] .= '<p><b>'.OIDplus::getSystemUrl().'ajax.php</b></p>';
71
                        $out['text'] .= '<p>You must at least provide following fields:</p>';
71
                        $out['text'] .= '<p>'._L('You must at least provide following fields').':</p>';
72
                        $out['text'] .= '<p><pre>';
72
                        $out['text'] .= '<p><pre>';
73
                        $out['text'] .= 'batch_login_username  = "admin"'."\n";
73
                        $out['text'] .= 'batch_login_username  = "admin"'."\n";
74
                        $out['text'] .= 'batch_login_password  = "........."'."\n";
74
                        $out['text'] .= 'batch_login_password  = "........."'."\n";
75
                        $out['text'] .= 'batch_ajax_unlock_key = "'.$this->getUnlockKey('admin').'"'."\n";
75
                        $out['text'] .= 'batch_ajax_unlock_key = "'.$this->getUnlockKey('admin').'"'."\n";
76
                        $out['text'] .= '</pre></p>';
76
                        $out['text'] .= '</pre></p>';
77
                        $out['text'] .= '<p>Please keep this information confidential!</p>';
77
                        $out['text'] .= '<p>'._L('Please keep this information confidential!').'</p>';
78
                        $out['text'] .= '<p>The batch-fields will automatically perform a one-time-login to fulfill the request. The other fields are the normal fields which are called during the usual operation of OIDplus.</p>';
78
                        $out['text'] .= '<p>'._L('The batch-fields will automatically perform a one-time-login to fulfill the request. The other fields are the normal fields which are called during the usual operation of OIDplus.').'</p>';
79
                        $out['text'] .= '<p>Currently, there is no documentation for the AJAX calls. However, you can look at the <b>script.js</b> files of the plugins to see the field names being used. You can also enable network analysis in your web browser debugger (F12) to see the request headers sent to the server during the operation of OIDplus.</p>';
79
                        $out['text'] .= '<p>'._L('Currently, there is no documentation for the AJAX calls. However, you can look at the <b>script.js</b> files of the plugins to see the field names being used. You can also enable network analysis in your web browser debugger (F12) to see the request headers sent to the server during the operation of OIDplus.').'</p>';
80
                        $out['text'] .= '<h2>Example for adding OID 2.999.123 using JavaScript</h2>';
80
                        $out['text'] .= '<h2>'._L('Example for adding OID 2.999.123 using JavaScript').'</h2>';
81
                        $out['text'] .= '<pre>'.htmlentities(file_get_contents(__DIR__.'/examples/example_js.html')).'</pre>';
81
                        $out['text'] .= '<pre>'.htmlentities(file_get_contents(__DIR__.'/examples/example_js.html')).'</pre>';
82
                        $out['text'] .= '<h2>Example for adding OID 2.999.123 using PHP (located at a foreign server)</h2>';
82
                        $out['text'] .= '<h2>'._L('Example for adding OID 2.999.123 using PHP (located at a foreign server)').'</h2>';
83
                        $out['text'] .= '<pre>'.preg_replace("@<br.*>@ismU","",highlight_file(__DIR__.'/examples/example_php.phps',true)).'</pre>';
83
                        $out['text'] .= '<pre>'.preg_replace("@<br.*>@ismU","",highlight_file(__DIR__.'/examples/example_php.phps',true)).'</pre>';
84
                }
84
                }
85
        }
85
        }
86
 
86
 
87
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
87
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
Line 94... Line 94...
94
                }
94
                }
95
 
95
 
96
                $json[] = array(
96
                $json[] = array(
97
                        'id' => 'oidplus:automated_ajax_information_admin',
97
                        'id' => 'oidplus:automated_ajax_information_admin',
98
                        'icon' => $tree_icon,
98
                        'icon' => $tree_icon,
99
                        'text' => 'Automated AJAX calls'
99
                        'text' => _L('Automated AJAX calls')
100
                );
100
                );
101
 
101
 
102
                return true;
102
                return true;
103
        }
103
        }
104
 
104