$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
+ $authmethod = array('simple' => 'simple', 'token' => 'token');
+ $mform->addElement('select', 'authmethod', get_string('authmethod', 'webservice'), $authmethod);
+
$mform->addElement('select', 'protocol', get_string('protocol', 'webservice'), $protocols);
$mform->addElement('select', 'function', get_string('function', 'webservice'), $functions);
global $CFG;
$mform = $this->_form;
+
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
+
$mform->addElement('text', 'courseid', 'courseid');
$mform->addElement('text', 'name', 'name');
$mform->addElement('text', 'description', 'description');
$mform->addElement('hidden', 'protocol');
$mform->setType('protocol', PARAM_SAFEDIR);
+
+
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
$this->add_action_buttons(true, get_string('execute', 'webservice'));
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['groups'] = array();
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
$mform->addElement('text', 'groupids[0]', 'groupids[0]');
$mform->addElement('text', 'groupids[1]', 'groupids[1]');
$mform->addElement('text', 'groupids[2]', 'groupids[2]');
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['groupids'] = array();
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
$mform->addElement('text', 'courseid', 'courseid');
$mform->addElement('hidden', 'function');
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['courseid'] = $data->courseid;
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
$mform->addElement('text', 'groupids[0]', 'groupids[0]');
$mform->addElement('text', 'groupids[1]', 'groupids[1]');
$mform->addElement('text', 'groupids[2]', 'groupids[2]');
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['groupids'] = array();
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
$mform->addElement('text', 'groupids[0]', 'groupids[0]');
$mform->addElement('text', 'groupids[1]', 'groupids[1]');
$mform->addElement('text', 'groupids[2]', 'groupids[2]');
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['groupids'] = array();
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
$mform->addElement('text', 'userid[0]', 'userid[0]');
$mform->addElement('text', 'groupid[0]', 'groupid[0]');
$mform->addElement('text', 'userid[1]', 'userid[1]');
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['members'] = array();
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
- $mform->addElement('text', 'wsusername', 'wsusername');
- $mform->addElement('text', 'wspassword', 'wspassword');
+ $data = $this->_customdata;
+ if ($data['authmethod'] == 'simple') {
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ } else if ($data['authmethod'] == 'token') {
+ $mform->addElement('text', 'token', 'token');
+ }
+
+ $mform->addElement('hidden', 'authmethod', $data['authmethod']);
+ $mform->setType('authmethod', PARAM_SAFEDIR);
$mform->addElement('text', 'userid[0]', 'userid[0]');
$mform->addElement('text', 'groupid[0]', 'groupid[0]');
$mform->addElement('text', 'userid[1]', 'userid[1]');
unset($data->function);
unset($data->wsusername);
unset($data->wspassword);
+ unset($data->token);
+ unset($data->authmethod);
$params = array();
$params['members'] = array();