<?php
-$string['amfdebug'] = 'AMF server debug mode';
$string['pluginname'] = 'AMF protocok';
--- /dev/null
+<?php
+
+$webservice_amf_capabilities = array(
+
+ 'webservice/amf:use' => array(
+ 'captype' => 'read', // in fact this may be considered read and write at the same time
+ 'contextlevel' => CONTEXT_COURSE, // the context level should be probably CONTEXT_MODULE
+ 'legacy' => array(
+ ),
+ ),
+
+);
+++ /dev/null
-<?php
-/**
- * Moodle - Modular Object-Oriented Dynamic Learning Environment
- * http://moodle.com
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details:
- *
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @category Moodle
- * @package webservice
- * @copyright Copyright (c) 1999 onwards Martin Dougiamas http://dougiamas.com
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL License
- */
-
-
-require_once($CFG->dirroot.'/webservice/lib.php');
-
-/*
- * AMF server class
- */
-final class amf_server extends webservice_server {
-
-
- public function __construct() {
- //set web service proctol name
- $this->set_protocolname("Amf");
- $this->set_protocolid("amf");
- }
-
- /**
- * Run the AMF server
- */
- public function run() {
- $enable = $this->get_enable();
- if (empty($enable)) {
- die;
- }
- include "Zend/Loader.php";
- Zend_Loader::registerAutoload();
-
- //retrieve the api name
- $classpath = optional_param('classpath','user',PARAM_ALPHA);
- require_once(dirname(__FILE__) . '/../../'.$classpath.'/external.php');
-
- /// run the Zend AMF server
- $server = new Zend_Amf_Server();
- $debugmode = get_config($this->get_protocolid(),'debug');
- if (!empty($debugmode)) {
- $server->setProduction(false);
- } else {
- $server->setProduction(true);
- }
- $server->setClass($classpath."_external");
- $response = $server->handle();
- echo $response;
- }
-
- /**
- * Names of the server settings
- * @return array
- */
- public static function get_setting_names() {
- return array('debug');
- }
-
- public function settings_form(&$mform) {
- $debug = get_config($this->get_protocolid(), 'debug');
- $debug = true;
- if (empty($debug)) {
- $debug = false;
- }
- $mform->addElement('checkbox', 'debug', get_string('amfdebug', 'webservice'));
- }
-}
-
-?>
--- /dev/null
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * AMF web service implementation classes and methods.
+ *
+ * @package webservice
+ * @copyright 2009 Moodle Pty Ltd (http://moodle.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once("$CFG->dirroot/webservice/lib.php");
+
+/**
+ * AMF service server implementation.
+ * @author Petr Skoda (skodak)
+ */
+class webservice_amf_server extends webservice_zend_server {
+ /**
+ * Contructor
+ * @param bool $simple use simple authentication
+ */
+ public function __construct($simple) {
+ require_once 'Zend/Amf/Server.php';
+ parent::__construct($simple, 'Zend_Amf_Server');
+ $this->wsname = 'amf';
+ }
+
+ /**
+ * Set up zend service class
+ * @return void
+ */
+ protected function init_zend_server() {
+ parent::init_zend_server();
+ // TODO: add some exception handling
+ }
+}
+
+// TODO: implement AMF test client somehow, maybe we could use moodle form to feed the data to the flash app somehow
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * Moodle - Modular Object-Oriented Dynamic Learning Environment
- * http://moodle.com
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details:
+ * AMF web service entry point. The authentication is done via tokens.
*
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @category Moodle
* @package webservice
- * @copyright Copyright (c) 1999 onwards Martin Dougiamas http://dougiamas.com
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL License
+ * @copyright 2009 Moodle Pty Ltd (http://moodle.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-/**
- * Moodle AMF server
- */
-require_once(dirname(__FILE__) . '/../../config.php');
-require_once('lib.php');
+define('NO_MOODLE_COOKIES', true);
+
+require('../../config.php');
+require_once("$CFG->dirroot/webservice/amf/locallib.php");
-if (empty($CFG->enablewebservices)) {
+if (!webservice_protocol_is_enabled('amf')) {
die;
}
-$server = new amf_server();
+$server = new webservice_amf_server(true);
$server->run();
+die;
-?>
\ No newline at end of file
--- /dev/null
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * AMF web service entry point. The authentication is done via tokens.
+ *
+ * @package webservice
+ * @copyright 2009 Moodle Pty Ltd (http://moodle.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_MOODLE_COOKIES', true);
+
+require('../../config.php');
+require_once("$CFG->dirroot/webservice/amf/locallib.php");
+
+//ob_start();
+
+//TODO: for now disable all mess in xml
+ini_set('display_errors', '0');
+ini_set('log_errors', '1');
+$CFG->debugdisplay = false;
+
+if (!webservice_protocol_is_enabled('amf')) {
+ die;
+}
+
+$server = new webservice_amf_server(true);
+$server->run();
+die;
+
+
<?php
require "../../../config.php";
+die('TODO');
$args['movie'] = $CFG->wwwroot.'/webservice/amf/testclient/moodleclient.swf';
$args['width'] = '100%';
--- /dev/null
+<?php
+
+$plugin->version = 2009101900;
if (empty($available_protocols[$p])) {
continue;
}
+ include_once($available_protocols[$p].'/locallib.php');
+ if (!class_exists('webservice_'.$p.'_test_client')) {
+ // test client support not implemented
+ continue;
+ }
$protocols[$p] = get_string('pluginname', 'webservice_'.$p);
}
if (!isset($protocols[$protocol])) { // whitelisting security