$string['configenablestats'] = 'If you choose \'yes\' here, Moodle\'s cronjob will process the logs and gather some statistics. Depending on the amount of traffic on your site, this can take awhile. If you enable this, you will be able to see some interesting graphs and statistics about each of your courses, or on a sitewide basis.';
$string['configenabletrusttext'] = 'By default Moodle will always thoroughly clean text that comes from users to remove any possible bad scripts, media etc that could be a security risk. The Trusted Content system is a way of giving particular users that you trust the ability to include these advanced features in their content without interference. To enable this system, you need to first enable this setting, and then grant the Trusted Content permission to a specific Moodle role. Texts created or uploaded by such users will be marked as trusted and will not be cleaned before display.';
$string['configenablewebservices'] = 'Web services enable other systems to log in to this Moodle and perform operations. For extra security this feature should be disabled unless you are really using it.';
+$string['configenablewsdocumentation'] = 'Enable auto-generation of web services documentation. A web service user can access to his own documentation without login into Moodle. It display the documentation for the enabled protocols only.';
$string['configenrolmentplugins'] = 'Please choose the enrolment plugins you wish to use. Don\'t forget to configure the settings properly.<br /><br />You have to indicate which plugins are enabled, and <strong>one</strong> plugin can be set as the default plugin for <em>interactive</em> enrolment. To disable interactive enrolment, set \"enrollable\" to \"No\" in required courses.';
$string['configerrorlevel'] = 'Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice.';
$string['configexperimentalsplitrestore'] = 'If enabled, course backup files will be checked for XML errors and split into smaller parts for use in the restore process. This will result in improvements to restore robustness and execution times, particularly for medium to large course backups.';
$string['enablestats'] = 'Enable statistics';
$string['enabletrusttext'] = 'Enable Trusted Content';
$string['enablewebservices'] = 'Enable web services';
+$string['enablewsdocumentation'] = 'Web services documentation';
$string['allowbeforeblock'] = 'Allowed list will be processed first';
$string['allowbeforeblockdesc'] = 'By Default, blocked list will be processed first, if this option enabled, allowed IPs list will be processed before blocked list.';
$string['encoding'] = 'Encoding';
$restresponsehtml = "";
+ $restresponsehtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;\">";
$restresponsehtml .= "<pre>";
- $restresponsehtml .= "<div style=\"border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;\">";
$restresponsehtml .= '<b>'.get_string('restcode', 'webservice').'</b><br/>';
$brakeline = <<<EOF
$content .= $this->description_in_indented_xml_format($returndescription);
$content .="</RESPONSE>".$brakeline;
$restresponsehtml .= $brakeline.htmlentities($content).$brakeline;
- $restresponsehtml .= "</div>";
- $restresponsehtml .= "</pre>";
+ $restresponsehtml .= "</pre></div></ins>";
return $restresponsehtml;
}
$required = $paramdesc->required?get_string('required', 'webservice'):get_string('optional', 'webservice');
$documentationhtml .= "<b>".$paramname . "</b> (" .$required. ")<br/>";
$documentationhtml .= " ".$paramdesc->desc." <br/><br/>";
+ $documentationhtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#FFF1BC;color:#222222;padding:4px;\">";
$documentationhtml .= "<pre>";
- $documentationhtml .= "<div style=\"border:solid 1px #DEDEDE;background:#FFF1BC;color:#222222;padding:4px;\">";
- //$documentationhtml .= print_collapsible_region_start('', 'aera_'.$functionname."_".$paramname,'<b>'.get_string('generalstructure', 'webservice').'</b>',false,true,true);
$documentationhtml .= '<b>'.get_string('generalstructure', 'webservice').'</b><br/>';
$documentationhtml .= $brakeline.$this->detailed_description_html($paramdesc);
- //$documentationhtml .= print_collapsible_region_end(true);
- $documentationhtml .= "</div>";
- $documentationhtml .= "</pre><br/>";
+ $documentationhtml .= "</pre></div></ins><br/>";
if (!empty($activatedprotocol['xmlrpc'])) {
+ $documentationhtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#DFEEE7;color:#222222;padding:4px;\">";
$documentationhtml .= "<pre>";
- $documentationhtml .= "<div style=\"border:solid 1px #DEDEDE;background:#DFEEE7;color:#222222;padding:4px;\">";
$documentationhtml .= '<b>'.get_string('phpparam', 'webservice').'</b><br/>';
$documentationhtml .= $brakeline.'['.$paramname.'] =>'.htmlentities($this->xmlrpc_param_description_html($paramdesc)). $brakeline. $brakeline;
- $documentationhtml .= "</div><br/>";
- $documentationhtml .= "</pre>";
+ $documentationhtml .= "</pre></div></ins><br/>";
}
if (!empty($activatedprotocol['rest'])) {
+ $documentationhtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;\">";
$documentationhtml .= "<pre>";
- $documentationhtml .= "<div style=\"border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;\">";
$documentationhtml .= '<b>'.get_string('restparam', 'webservice').'</b><br/>';
$documentationhtml .= $brakeline.htmlentities($this->rest_param_description_html($paramdesc,$paramname)). $brakeline. $brakeline;
- $documentationhtml .= "</div>";
- $documentationhtml .= "</pre>";
+ $documentationhtml .= "</pre></div></ins>";
}
$documentationhtml .= "</span>";
}
}
if (!empty($description->returns_desc)) {
+ $documentationhtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#FFF1BC;color:#222222;padding:4px;\">";
$documentationhtml .= "<pre>";
- $documentationhtml .= "<div style=\"border:solid 1px #DEDEDE;background:#FFF1BC;color:#222222;padding:4px;\">";
- //$documentationhtml .= print_collapsible_region_start('', 'aera_'.$functionname."_xmlrpc_return",'<b>'.get_string('generalstructure', 'webservice').'</b>',false,true,true);
$documentationhtml .= '<b>'.get_string('generalstructure', 'webservice').'</b><br/>';
$documentationhtml .= $brakeline.$this->detailed_description_html($description->returns_desc);
- //$documentationhtml .= print_collapsible_region_end(true);
- $documentationhtml .= "</div>";
- $documentationhtml .= "</pre><br/>";
+ $documentationhtml .= "</pre></div></ins><br/>";
if (!empty($activatedprotocol['xmlrpc'])) {
+ $documentationhtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#DFEEE7;color:#222222;padding:4px;\">";
$documentationhtml .= "<pre>";
- $documentationhtml .= "<div style=\"border:solid 1px #DEDEDE;background:#DFEEE7;color:#222222;padding:4px;\">";
$documentationhtml .= '<b>'.get_string('phpresponse', 'webservice').'</b><br/>';
$documentationhtml .= htmlentities($this->xmlrpc_param_description_html($description->returns_desc)).$brakeline.$brakeline;
- $documentationhtml .= "</div>";
- $documentationhtml .= "</pre><br/>";
+ $documentationhtml .= "</pre></div></ins><br/>";
}
if (!empty($activatedprotocol['rest'])) {
$documentationhtml .= $this->rest_response_html($functionname, $description->returns_desc);
if (!empty($activatedprotocol['rest'])) {
$documentationhtml .= "<span style=\"color:#EA33A6\">".get_string('errorcodes', 'webservice')."</span><br/>";
- $documentationhtml .= "<span style=\"font-size:80%\">";
+ $documentationhtml .= "<br/><span style=\"font-size:80%\">";
+ $documentationhtml .= "<ins><div style=\"border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;\">";
$documentationhtml .= "<pre>";
- $documentationhtml .= "<div style=\"border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;\">";
-
$documentationhtml .= '<b>'.get_string('restexception', 'webservice').'</b><br/>';
$errormessage = get_string('invalidparameter', 'debug');
$restexceptiontext =<<<EOF
</EXCEPTION>
EOF;
$documentationhtml .= $brakeline.htmlentities($restexceptiontext);
- $documentationhtml .= "</div>";
- $documentationhtml .= "</pre><br/>";
+ $documentationhtml .= "</pre></div></ins><br/>";
$documentationhtml .= "</span>";
}
$documentationhtml .= "<br/><br/>";
/**
* Run the documentation generation
- * @param bool $simple use simple authentication
* @return void
*/
public function run() {
* Generate and display the documentation
*/
protected function display_documentation_html() {
- global $PAGE, $OUTPUT, $SITE;
+ global $PAGE, $OUTPUT, $SITE, $CFG;
$PAGE->set_url('/webservice/wsdoc');
$PAGE->set_docs_path('');
$PAGE->set_title($SITE->fullname." ".get_string('wsdocumentation', 'webservice'));
$PAGE->set_heading($SITE->fullname." ".get_string('wsdocumentation', 'webservice'));
$PAGE->set_pagelayout('popup');
+ $PAGE->set_pagetype('webservice-doc-generator');
+ $PAGE->requires->css('webservice/wsdoc.css');
+
echo $OUTPUT->header();
$activatedprotocol = array();
$PAGE->set_title($SITE->fullname." ".get_string('wsdocumentation', 'webservice'));
$PAGE->set_heading($SITE->fullname." ".get_string('wsdocumentation', 'webservice'));
$PAGE->set_pagelayout('popup');
+ $PAGE->set_pagetype('webservice-doc-generator-login');
+
+ $PAGE->requires->css('webservice/wsdoc.css');
echo $OUTPUT->header();
- $renderer = $PAGE->get_renderer('core', 'wsdoc');
+
+ $renderer = $PAGE->get_renderer('core', 'webservice');
echo $renderer->login_page_html($errormessage);
+
echo $OUTPUT->footer();
}
/////// RUN THE SCRIPT ////
///////////////////////////
+if (empty($CFG->enablewsdocumentation)) {
+ echo get_string('wsdocumentationdisable', 'webservice');
+ die;
+}
+
//run the documentation generator
$generator = new webservice_documentation_generator();
$generator->run();