Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
48b5f8f5
Commit
48b5f8f5
authored
Feb 15, 2017
by
Robert Lyon
Committed by
Gerrit Code Review
Feb 15, 2017
Browse files
Merge "Bug 1633808: Webservices logs form display institution field"
parents
edfbb8f2
4376ab2b
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/webservice/admin/webservicelogs.php
View file @
48b5f8f5
...
...
@@ -52,7 +52,7 @@ else {
list
(
$html
,
$columns
,
$searchurl
,
$pagination
)
=
build_webservice_log_search_results
(
$search
);
$institutionselect
=
''
;
$institutionselect
=
false
;
if
(
count
(
$institutions
)
>
1
)
{
$selecttype
=
$USER
->
get
(
'admin'
)
?
'institution'
:
'institution_requested'
;
$options
=
array
(
'all'
=>
get_string
(
'All'
));
...
...
@@ -80,66 +80,68 @@ $authtypeoptions = array('all' => get_string('All'));
foreach
(
$authtypes
as
$authtype
)
{
$authtypeoptions
[
$authtype
]
=
$authtype
;
}
$elements
=
array
();
$elements
[
'userquery'
]
=
array
(
'type'
=>
'autocomplete'
,
'title'
=>
get_string
(
'userauth'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$userquery
)
?
$userquery
:
null
,
'ajaxurl'
=>
get_config
(
'wwwroot'
)
.
'webservice/admin/users.json.php'
,
'initfunction'
=>
'translate_ids_to_names'
,
'multiple'
=>
true
,
'ajaxextraparams'
=>
array
(),
'extraparams'
=>
array
(
'maximumSelectionLength'
=>
1
),
'width'
=>
'280px'
,
);
if
(
$institutionselect
)
{
$elements
[
$selecttype
]
=
$institutionselect
;
}
$elements
[
'protocol'
]
=
array
(
'type'
=>
'select'
,
'title'
=>
get_string
(
'protocol'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$search
->
protocol
)
?
$search
->
protocol
:
'all'
,
'options'
=>
$protocoloptions
,
);
$elements
[
'authtype'
]
=
array
(
'type'
=>
'select'
,
'title'
=>
get_string
(
'sauthtype'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$search
->
authtype
)
?
$search
->
authtype
:
'all'
,
'options'
=>
$authtypeoptions
,
);
$elements
[
'functionquery'
]
=
array
(
'type'
=>
'autocomplete'
,
'title'
=>
get_string
(
'function'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$functionquery
)
?
$functionquery
:
''
,
'ajaxurl'
=>
get_config
(
'wwwroot'
)
.
'webservice/admin/functions.json.php'
,
'initfunction'
=>
'translate_ids_to_functions'
,
'multiple'
=>
true
,
'ajaxextraparams'
=>
array
(),
'extraparams'
=>
array
(
'maximumSelectionLength'
=>
1
),
'width'
=>
'280px'
,
);
$elements
[
'onlyerrors'
]
=
array
(
'type'
=>
'switchbox'
,
'class'
=>
'last'
,
'title'
=>
get_string
(
'errors'
,
'auth.webservice'
),
'defaultvalue'
=>
$search
->
onlyerrors
,
);
$elements
[
'submit'
]
=
array
(
'type'
=>
'submit'
,
'class'
=>
'btn-primary'
,
'value'
=>
get_string
(
'go'
),
);
$form
=
array
(
'name'
=>
'logsearchform'
,
'method'
=>
'post'
,
'successcallback'
=>
'logsearchform_submit'
,
'renderer'
=>
'div'
,
'elements'
=>
array
(
'userquery'
=>
array
(
'type'
=>
'autocomplete'
,
'title'
=>
get_string
(
'userauth'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$userquery
)
?
$userquery
:
null
,
'ajaxurl'
=>
get_config
(
'wwwroot'
)
.
'webservice/admin/users.json.php'
,
'initfunction'
=>
'translate_ids_to_names'
,
'multiple'
=>
true
,
'ajaxextraparams'
=>
array
(),
'extraparams'
=>
array
(
'maximumSelectionLength'
=>
1
),
'width'
=>
'280px'
,
),
$institutionselect
,
'protocol'
=>
array
(
'type'
=>
'select'
,
'title'
=>
get_string
(
'protocol'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$search
->
protocol
)
?
$search
->
protocol
:
'all'
,
'options'
=>
$protocoloptions
,
),
'authtype'
=>
array
(
'type'
=>
'select'
,
'title'
=>
get_string
(
'sauthtype'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$search
->
authtype
)
?
$search
->
authtype
:
'all'
,
'options'
=>
$authtypeoptions
,
),
'functionquery'
=>
array
(
'type'
=>
'autocomplete'
,
'title'
=>
get_string
(
'function'
,
'auth.webservice'
),
'defaultvalue'
=>
!
empty
(
$functionquery
)
?
$functionquery
:
''
,
'ajaxurl'
=>
get_config
(
'wwwroot'
)
.
'webservice/admin/functions.json.php'
,
'initfunction'
=>
'translate_ids_to_functions'
,
'multiple'
=>
true
,
'ajaxextraparams'
=>
array
(),
'extraparams'
=>
array
(
'maximumSelectionLength'
=>
1
),
'width'
=>
'280px'
,
),
'onlyerrors'
=>
array
(
'type'
=>
'switchbox'
,
'class'
=>
'last'
,
'title'
=>
get_string
(
'errors'
,
'auth.webservice'
),
'defaultvalue'
=>
$search
->
onlyerrors
,
),
'submit'
=>
array
(
'type'
=>
'submit'
,
'class'
=>
'btn-primary'
,
'value'
=>
get_string
(
'go'
),
),
),
'elements'
=>
$elements
,
);
unset
(
$form
[
'elements'
][
0
]);
$form
=
pieform
(
$form
);
$smarty
=
smarty
(
array
(
'paginator'
));
setpageicon
(
$smarty
,
'icon-puzzle-piece'
);
...
...
htdocs/webservice/lib.php
View file @
48b5f8f5
...
...
@@ -588,7 +588,7 @@ class external_api {
$result
[
$key
]
=
self
::
validate_parameters
(
$subdesc
,
$params
[
$key
]);
}
catch
(
WebserviceInvalidParameterException
$e
)
{
//it's ok to display debug info as here the information is useful for ws client/dev
throw
new
WebserviceParameterException
(
'invalidextparam'
,
"key:
$key
- "
.
$e
->
getMessage
()
.
(
isset
(
$e
->
debuginfo
)
?
" (debuginfo: "
.
$e
->
debuginfo
.
") "
:
""
));
throw
new
WebserviceParameterException
(
get_string
(
'invalidextparam'
,
'auth.webservice'
,
"key:
$key
- "
.
$e
->
getMessage
()
.
(
isset
(
$e
->
debuginfo
)
?
" (debuginfo: "
.
$e
->
debuginfo
.
") "
:
""
))
)
;
}
}
unset
(
$params
[
$key
]);
...
...
htdocs/webservice/testclient.php
View file @
48b5f8f5
...
...
@@ -142,6 +142,7 @@ if (!empty($authtype)) {
$title
=
preg_replace
(
'/^(.*?)_NUM_/'
,
''
,
$var
[
'name'
]);
$title
=
preg_replace
(
'/_NUM_/'
,
' / '
,
$title
);
$type
=
(
trim
(
$var
[
'type'
])
==
'bool'
)
?
'switchbox'
:
'text'
;
$type
=
(
trim
(
$var
[
'type'
])
==
'file'
)
?
'file'
:
$type
;
if
(
$title
==
'institution'
)
{
// Let see if we can fetch the exact allowed values
$elements
[
$name
]
=
get_institution_selector
();
...
...
@@ -326,9 +327,13 @@ function testclient_parameters($paramdescription, $paramstring) {
case
PARAM_FLOAT
:
$type
=
'double'
;
break
;
case
PARAM_FILE
:
$type
=
'file'
;
break
;
default
:
$type
=
'string'
;
}
return
$paramstring
.
" "
.
$type
.
$brakeline
;
}
}
...
...
htdocs/webservice/wsdoc.php
View file @
48b5f8f5
...
...
@@ -107,8 +107,7 @@ function wsdoc_detailed_description_html($params, $indentlevel = 0) {
else
if
(
!
is_scalar
(
$params
->
default
))
{
$params
->
default
=
'<'
.
gettype
(
$params
->
default
)
.
'>'
;
}
$required
=
'<span class="wsrequired">'
.
get_string
(
'required'
,
'auth.webservice'
)
.
'</span> '
.
'<span class="wsoptional">'
.
get_string
(
'default'
,
'auth.webservice'
,
$params
->
default
)
.
'</span> '
;
$required
=
'<span class="wsoptional">'
.
get_string
(
'default'
,
'auth.webservice'
,
$params
->
default
)
.
'</span> '
;
break
;
case
VALUE_OPTIONAL
:
...
...
@@ -117,8 +116,10 @@ function wsdoc_detailed_description_html($params, $indentlevel = 0) {
.
'</span> '
;
break
;
// Don't need to print anything for a required param
case
VALUE_REQUIRED
:
$required
=
'<span class="wsrequired">'
.
get_string
(
'required'
,
'auth.webservice'
)
.
'</span> '
;
break
;
default
:
$required
=
''
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment