MDL-14741: following the commits in MDL-13766, we can remove the old filemanager code.

This commit is contained in:
scyrma
2008-07-31 03:08:12 +00:00
parent feaaa80e9a
commit df9b1b6629
7 changed files with 0 additions and 327 deletions
@@ -1 +0,0 @@
(function(){tinymce.create('tinymce.plugins.MoodleLinkPlugin',{init:function(ed,url){course_id=tinyMCE.activeEditor.getParam('moodleimage_course_id');ed.addCommand('mceMoodleLink',function(){ed.windowManager.open({file:url+'/link.php?id='+course_id,width:600+ed.getLang('example.delta_width',0),height:500+ed.getLang('example.delta_height',0),inline:1},{plugin_url:url,some_custom_arg:'custom arg'});});ed.addButton('moodlelink',{title:'Insert Link',cmd:'mceMoodleLink',image:url+'/img/link.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('moodlelink',n.nodeName=='IMG');});},createControl:function(n,cm){return null;},getInfo:function(){return{longname:'Moodle Link plugin',author:'Glen Davies',authorurl:'http://www.canterbury.ac.nz',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',version:"1.0"};}});tinymce.PluginManager.add('moodlelink',tinymce.plugins.MoodleLinkPlugin);})();
@@ -1,78 +0,0 @@
(function() {
// Load plugin specific language pack
//tinymce.PluginManager.requireLangPack('example');
tinymce.create('tinymce.plugins.MoodleLinkPlugin', {
/**
* Initializes the plugin, this will be executed after the plugin has been created.
* This call is done before the editor instance has finished it's initialization so use the onInit event
* of the editor instance to intercept that event.
*
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
* @param {string} url Absolute URL to where the plugin is located.
*/
init : function(ed, url) {
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
course_id = tinyMCE.activeEditor.getParam('moodleimage_course_id');
ed.addCommand('mceMoodleLink', function() {
ed.windowManager.open({
file : url + '/link.php?id=' + course_id,
//file : '/moodle/lib/editor/htmlarea/popups/insert_image.php?id=' + course_id,
width : 600 + ed.getLang('example.delta_width', 0),
height : 500 + ed.getLang('example.delta_height', 0),
inline : 1
}, {
plugin_url : url, // Plugin absolute URL
some_custom_arg : 'custom arg' // Custom argument
});
});
// Register example button
ed.addButton('moodlelink', {
title : 'Insert Link',
cmd : 'mceMoodleLink',
image : url + '/img/link.gif'
});
// Add a node change handler, selects the button in the UI when a image is selected
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('moodlelink', n.nodeName == 'IMG');
});
},
/**
* Creates control instances based in the incomming name. This method is normally not
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
* method can be used to create those.
*
* @param {String} n Name of the control to create.
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
* @return {tinymce.ui.Control} New control instance or null if no control was created.
*/
createControl : function(n, cm) {
return null;
},
/**
* Returns information about the plugin as a name/value array.
* The current keys are longname, author, authorurl, infourl and version.
*
* @return {Object} Name/value array containing information about the plugin.
*/
getInfo : function() {
return {
longname : 'Moodle Link plugin',
author : 'Glen Davies',
authorurl : 'http://www.canterbury.ac.nz',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
version : "1.0"
};
}
});
// Register plugin
tinymce.PluginManager.add('moodlelink', tinymce.plugins.MoodleLinkPlugin);
})();
Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

@@ -1,71 +0,0 @@
tinyMCEPopup.requireLangPack();
var MoodleLinkDialog = {
init : function(ed) {
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
tinyMCEPopup.resizeToInnerSize();
},
insert : function(file, title) {
var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
if (f.f_url.value === '') {
ed.dom.remove(ed.selection.getNode());
ed.execCommand('mceRepaint');
tinyMCEPopup.close();
return;
}
if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
if (!f.f_alt.value) {
tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('moodleimage_dlg.missing_alt'), function(s) {
if (s)
t.insertAndClose();
});
return;
}
}
t.insertAndClose();
},
insertAndClose : function() {
var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
// Fixes crash in Safari
if (tinymce.isWebKit)
ed.getWin().focus();
tinymce.extend(args, {
src : nl.f_url.value,
width : nl.f_width.value,
height : nl.f_height.value,
alt : nl.f_alt.value,
vspace : nl.f_vert.value,
hspace : nl.f_horiz.value,
border : nl.f_border.value,
align : getSelectValue(f, 'f_align')
});
el = ed.selection.getNode();
if (el && el.nodeName == 'IMG') {
ed.dom.setAttribs(el, args);
} else {
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />');
ed.dom.setAttribs('__mce_tmp', args);
ed.dom.setAttrib('__mce_tmp', 'id', '');
}
tinyMCEPopup.close();
}
};
tinyMCEPopup.onInit.add(MoodleLinkDialog.init, MoodleLinkDialog);
@@ -1,3 +0,0 @@
tinyMCE.addI18n('en.moodlelink_dlg',{
title:"Choose file to link"
});
@@ -1,174 +0,0 @@
<?php // $Id$
require("../../../../../../../config.php");
$id = optional_param('id', SITEID, PARAM_INT);
require_course_login($id);
@header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php print_string("insertlink","editor");?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/moodlelink.js"></script>
<script type="text/javascript">
var FileBrowserDialogue = {
init : function () {
// Here goes your code for setting your custom things onLoad.
},
mySubmit : function (link_url) {
//call this function only after page has loaded
//otherwise tinyMCEPopup.close will close the
//"Insert/Edit Image" or "Insert/Edit Link" window instead
//var URL = document.my_form.my_field.value;
var win = tinyMCEPopup.getWindowArg("window");
// insert information now
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = link_url;
// for image browsers: update image dimensions
if (win.getImageData) win.getImageData();
// close popup window
tinyMCEPopup.close();
}
}
tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
//<![CDATA[
function checkvalue(elm,formname) {
var el = document.getElementById(elm);
if(!el.value) {
alert("Nothing to do!");
el.focus();
return false;
}
}
function submit_form(dothis) {
if(dothis == "delete") {
window.fbrowser.document.dirform.action.value = "delete";
}
if(dothis == "move") {
window.fbrowser.document.dirform.action.value = "move";
}
if(dothis == "zip") {
window.fbrowser.document.dirform.action.value = "zip";
}
window.fbrowser.document.dirform.submit();
return false;
}
//]]>
</script>
<style type="text/css">
html, body {
margin: 2px;
background-color: #F0F0EE;
font-size: 11px;
}
.title {
background-color: #ddddff;
padding: 5px;
border-bottom: 1px solid black;
font-family: Tahoma, sans-serif;
font-weight: bold;
font-size: 14px;
color: black;
}
td, input, select, button {
font-family: Tahoma, Verdana, sans-serif;
font-size: 11px;
}
button { width: 70px; }
.space { padding: 2px; }
form { margin-bottom: 0px; margin-top: 0px; }
</style>
</head>
<body>
<table width="450" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="450" valign="top"><fieldset>
<legend><?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) {
print_string("filebrowser","editor");
} else {
print "";
}?></legend>
<div class="space"></div>
<?php print(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id)))?
"<iframe id=\"fbrowser\" name=\"fbrowser\" src=\"../../../../coursefiles.php?id=".$id."\" width=\"420\" height=\"180\"></iframe>":
""; ?>
<p>
</p>
<div class="space"></div>
</fieldset>&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="0">
<tr><td><?php print_string("selection","editor");?>: </td>
<td><form id="idelete">
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
<td><form id="imove">
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></form></td>
<td><form id="izip">
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
<td><form id="irename" method="post" action="../../../../coursefiles.php" target="fbrowser">
<input type="hidden" name="id" value="<?php print($id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="file" value="" />
<input type="hidden" name="action" value="rename" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>" />
<input name="btnRename" type="submit" id="btnRename" value="<?php print_string("rename","editor");?>" /></form></td>
</tr>
</table>
</td>
<td>
<button type="button" name="close" onclick="tinyMCEPopup.close();"><?php print_string("close","editor");?></button>
</td>
</tr>
</table>
<table border="0" cellpadding="1" cellspacing="1">
<tr>
<td height="22"><?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<form id="cfolder" action="../../../../coursefiles.php" method="post" target="fbrowser">
<input type="hidden" name="id" value="<?php print($id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="action" value="mkdir" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>" />
<input name="name" type="text" id="foldername" size="35" />
<input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" />
</form>
<form action="../../../../coursefiles.php?id=<?php print($id);?>" method="post" enctype="multipart/form-data" target="fbrowser" id="uploader">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
<input type="hidden" name="id" VALUE="<?php print($id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="action" value="upload" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>" />
<input type="file" name="userfile" id="userfile" size="35" />
<input name="save" type="submit" id="save" onclick="return checkvalue('userfile','uploader');" value="<?php print_string("upload","editor");?>" />
</form>
<?php
} else {
print "";
} ?>
</td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>