mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
"MDL-13766, support iframe repository"
This commit is contained in:
parent
18729a5138
commit
1e08b5cf79
2 changed files with 28 additions and 2 deletions
|
@ -634,6 +634,10 @@ _client.dynload = function (node, fnLoadComplete) {
|
||||||
var trans = YAHOO.util.Connect.asyncRequest('POST',
|
var trans = YAHOO.util.Connect.asyncRequest('POST',
|
||||||
'$CFG->httpswwwroot/repository/ws.php?action=list', callback, _client.postdata(params));
|
'$CFG->httpswwwroot/repository/ws.php?action=list', callback, _client.postdata(params));
|
||||||
}
|
}
|
||||||
|
_client.viewiframe = function() {
|
||||||
|
var panel = new YAHOO.util.Element('panel-$suffix');
|
||||||
|
panel.get('element').innerHTML = "<iframe frameborder=\"0\" width=\"98%\" height=\"400px\" src=\""+_client.ds.iframe+"\" />";
|
||||||
|
}
|
||||||
_client.viewlist = function() {
|
_client.viewlist = function() {
|
||||||
_client.viewmode = 0;
|
_client.viewmode = 0;
|
||||||
var panel = new YAHOO.util.Element('panel-$suffix');
|
var panel = new YAHOO.util.Element('panel-$suffix');
|
||||||
|
@ -916,6 +920,8 @@ success: function(o) {
|
||||||
_client.ds = ret;
|
_client.ds = ret;
|
||||||
if(!_client.ds) {
|
if(!_client.ds) {
|
||||||
return;
|
return;
|
||||||
|
}else if(_client.ds.iframe) {
|
||||||
|
_client.viewiframe();
|
||||||
}else if(_client.ds && _client.ds.login) {
|
}else if(_client.ds && _client.ds.login) {
|
||||||
_client.print_login();
|
_client.print_login();
|
||||||
} else if(_client.ds.list) {
|
} else if(_client.ds.list) {
|
||||||
|
|
|
@ -705,9 +705,11 @@ abstract class repository {
|
||||||
$id = $DB->insert_record('repository_instances', $record);
|
$id = $DB->insert_record('repository_instances', $record);
|
||||||
$options = array();
|
$options = array();
|
||||||
$configs = call_user_func($classname . '::get_instance_option_names');
|
$configs = call_user_func($classname . '::get_instance_option_names');
|
||||||
|
if (!empty($configs)) {
|
||||||
foreach ($configs as $config) {
|
foreach ($configs as $config) {
|
||||||
$options[$config] = $params[$config];
|
$options[$config] = $params[$config];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
unset($options['name']);
|
unset($options['name']);
|
||||||
|
@ -1254,6 +1256,24 @@ function repository_move_to_filepool($path, $name, $itemid, $filearea = 'user_dr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function repository_download_btn($repo_id, $ctx_id, $sesskey, $title, $src, $returnurl = '') {
|
||||||
|
global $CFG;
|
||||||
|
if (empty($returnurl)) {
|
||||||
|
$returnurl = get_referer();
|
||||||
|
}
|
||||||
|
$str = '<form action="'.$CFG->httpswwwroot.'/repository/ws.php">';
|
||||||
|
$str .= ' <input type="hidden" name="sesskey" value="'.$sesskey.'" />';
|
||||||
|
$str .= ' <input type="hidden" name="ctx_id" value="'.$ctx_id.'" />';
|
||||||
|
$str .= ' <input type="hidden" name="repo_id" value="'.$repo_id.'" />';
|
||||||
|
$str .= ' <input type="hidden" name="file" value="'.$src.'" />';
|
||||||
|
$str .= ' <input type="hidden" name="action" value="download" />';
|
||||||
|
$str .= ' <input type="hidden" name="returnurl" value="'.$returnurl.'" />';
|
||||||
|
$str .= ' <input type="text" name="title" value="'.$title.'" />';
|
||||||
|
$str .= ' <input type="submit" value="Select it!" />';
|
||||||
|
$str .= '</form>';
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save file to local filesystem pool
|
* Save file to local filesystem pool
|
||||||
* @param string $elname name of element
|
* @param string $elname name of element
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue