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 57... Line 57...
57
                if (explode('$',$id)[0] == 'oidplus:automated_ajax_information_ra') {
57
                if (explode('$',$id)[0] == 'oidplus:automated_ajax_information_ra') {
58
                        $handled = true;
58
                        $handled = true;
59
 
59
 
60
                        $ra_email = explode('$',$id)[1];
60
                        $ra_email = explode('$',$id)[1];
61
 
61
 
62
                        $out['title'] = 'Automated AJAX calls';
62
                        $out['title'] = _L('Automated AJAX calls');
63
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
63
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
64
 
64
 
65
                        if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) {
65
                        if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) {
66
                                $out['icon'] = 'img/error_big.png';
66
                                $out['icon'] = 'img/error_big.png';
67
                                $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b> or as admin.</p>';
67
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login'),'<b>'.htmlentities($ra_email).'</b>').'</p>';
68
                                return;
68
                                return;
69
                        }
69
                        }
70
 
70
 
71
                        $out['text'] .= '<p>You can make automated calls to your OIDplus account by calling the AJAX API.</p>';
71
                        $out['text'] .= '<p>'._L('You can make automated calls to your OIDplus account by calling the AJAX API.').'</p>';
72
                        $out['text'] .= '<p>The URL for the AJAX script is:</p>';
72
                        $out['text'] .= '<p>'._L('The URL for the AJAX script is:').':</p>';
73
                        $out['text'] .= '<p><b>'.OIDplus::getSystemUrl().'ajax.php</b></p>';
73
                        $out['text'] .= '<p><b>'.OIDplus::getSystemUrl().'ajax.php</b></p>';
74
                        $out['text'] .= '<p>You must at least provide following fields:</p>';
74
                        $out['text'] .= '<p>'._L('You must at least provide following fields').':</p>';
75
                        $out['text'] .= '<p><pre>';
75
                        $out['text'] .= '<p><pre>';
76
                        $out['text'] .= 'batch_login_username  = "'.htmlentities($ra_email).'"'."\n";
76
                        $out['text'] .= 'batch_login_username  = "'.htmlentities($ra_email).'"'."\n";
77
                        $out['text'] .= 'batch_login_password  = "........."'."\n";
77
                        $out['text'] .= 'batch_login_password  = "........."'."\n";
78
                        $out['text'] .= 'batch_ajax_unlock_key = "'.$this->getUnlockKey($ra_email).'"'."\n";
78
                        $out['text'] .= 'batch_ajax_unlock_key = "'.$this->getUnlockKey($ra_email).'"'."\n";
79
                        $out['text'] .= '</pre></p>';
79
                        $out['text'] .= '</pre></p>';
80
                        $out['text'] .= '<p>Please keep this information confidential!</p>';
80
                        $out['text'] .= '<p>'._L('Please keep this information confidential!').'</p>';
81
                        $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>';
81
                        $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>';
82
                        $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>';
82
                        $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>';
83
                        $out['text'] .= '<h2>Example for adding OID 2.999.123 using JavaScript</h2>';
83
                        $out['text'] .= '<h2>'._L('Example for adding OID 2.999.123 using JavaScript').'</h2>';
84
                        $out['text'] .= '<pre>'.htmlentities(file_get_contents(__DIR__.'/examples/example_js.html')).'</pre>';
84
                        $out['text'] .= '<pre>'.htmlentities(file_get_contents(__DIR__.'/examples/example_js.html')).'</pre>';
85
                        $out['text'] .= '<h2>Example for adding OID 2.999.123 using PHP (located at a foreign server)</h2>';
85
                        $out['text'] .= '<h2>'._L('Example for adding OID 2.999.123 using PHP (located at a foreign server)').'</h2>';
86
                        $out['text'] .= '<pre>'.preg_replace("@<br.*>@ismU","",highlight_file(__DIR__.'/examples/example_php.phps',true)).'</pre>';
86
                        $out['text'] .= '<pre>'.preg_replace("@<br.*>@ismU","",highlight_file(__DIR__.'/examples/example_php.phps',true)).'</pre>';
87
                }
87
                }
88
        }
88
        }
89
 
89
 
90
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
90
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
Line 98... Line 98...
98
                }
98
                }
99
 
99
 
100
                $json[] = array(
100
                $json[] = array(
101
                        'id' => 'oidplus:automated_ajax_information_ra$'.$ra_email,
101
                        'id' => 'oidplus:automated_ajax_information_ra$'.$ra_email,
102
                        'icon' => $tree_icon,
102
                        'icon' => $tree_icon,
103
                        'text' => 'Automated AJAX calls'
103
                        'text' => _L('Automated AJAX calls')
104
                );
104
                );
105
 
105
 
106
                return true;
106
                return true;
107
        }
107
        }
108
 
108