Big update for the editor!
Code is closer to HTMLArea 3.0 RC1. - Updated dialog behavior (no more showModalDialogs) - Cleaner XHTML coding in dialogs - Unnecessary comment stripped off from htmlarea.php - New anchor feature.
This commit is contained in:
+15
-26
@@ -6,25 +6,13 @@ function Dialog(url, action, init) {
|
||||
if (typeof init == "undefined") {
|
||||
init = window; // pass this window object by default
|
||||
}
|
||||
if (document.all) { // here we hope that Mozilla will never support document.all
|
||||
var value =
|
||||
showModalDialog(url, init,
|
||||
//window.open(url, '_blank',
|
||||
"resizable: no; help: no; status: no; scroll: no");
|
||||
if (action) {
|
||||
action(value);
|
||||
}
|
||||
} else {
|
||||
return Dialog._geckoOpenModal(url, action, init);
|
||||
}
|
||||
Dialog._geckoOpenModal(url, action, init);
|
||||
};
|
||||
|
||||
Dialog._parentEvent = function(ev) {
|
||||
if (Dialog._modal && !Dialog._modal.closed) {
|
||||
// we get here in Mozilla only, anyway, so we can safely use
|
||||
// the DOM version.
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
Dialog._modal.focus();
|
||||
HTMLArea._stopEvent(ev);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -44,12 +32,13 @@ Dialog._geckoOpenModal = function(url, action, init) {
|
||||
switch(file) {
|
||||
case "insert_image": x = 730; y = 540; break;
|
||||
case "link_std": x = 400; y = 180; break;
|
||||
case "dlg_ins_smile": x = 330; y = 360; break;
|
||||
case "dlg_ins_char": x = 450; y = 270; break;
|
||||
case "dlg_ins_smile": x = 330; y = 300; break;
|
||||
case "dlg_ins_char": x = 480; y = 270; break;
|
||||
case "select_color": x = 238; y = 188; break;
|
||||
case "insert_table": x = 410; y = 240; break;
|
||||
case "insert_table": x = 420; y = 240; break;
|
||||
case "link_std": x = 420; y = 210; break;
|
||||
case "insert_image_std": x = 450; y = 230; break;
|
||||
case "createanchor": x = 300; y = 130; break;
|
||||
default: x = 50; y = 50;
|
||||
}
|
||||
|
||||
@@ -61,19 +50,19 @@ Dialog._geckoOpenModal = function(url, action, init) {
|
||||
|
||||
// capture some window's events
|
||||
function capwin(w) {
|
||||
w.addEventListener("click", Dialog._parentEvent, true);
|
||||
w.addEventListener("mousedown", Dialog._parentEvent, true);
|
||||
w.addEventListener("focus", Dialog._parentEvent, true);
|
||||
HTMLArea._addEvent(w, "click", Dialog._parentEvent);
|
||||
HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent);
|
||||
HTMLArea._addEvent(w, "focus", Dialog._parentEvent);
|
||||
};
|
||||
// release the captured events
|
||||
function relwin(w) {
|
||||
w.removeEventListener("focus", Dialog._parentEvent, true);
|
||||
w.removeEventListener("mousedown", Dialog._parentEvent, true);
|
||||
w.removeEventListener("click", Dialog._parentEvent, true);
|
||||
HTMLArea._removeEvent(w, "click", Dialog._parentEvent);
|
||||
HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent);
|
||||
HTMLArea._removeEvent(w, "focus", Dialog._parentEvent);
|
||||
};
|
||||
capwin(window);
|
||||
// capture other frames
|
||||
//for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
|
||||
for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
|
||||
// make up a function to be called when the Dialog ends.
|
||||
Dialog._return = function (val) {
|
||||
if (val && action) {
|
||||
@@ -81,7 +70,7 @@ Dialog._geckoOpenModal = function(url, action, init) {
|
||||
}
|
||||
relwin(window);
|
||||
// capture other frames
|
||||
//for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
|
||||
for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
|
||||
Dialog._modal = null;
|
||||
};
|
||||
};
|
||||
|
||||
+53
-168
@@ -132,15 +132,6 @@ HTMLArea.Config = function () {
|
||||
this.imgURL = "images/";
|
||||
this.popupURL = "popups/";
|
||||
|
||||
/** CUSTOMIZING THE TOOLBAR
|
||||
* -------------------------
|
||||
*
|
||||
* It is recommended that you customize the toolbar contents in an
|
||||
* external file (i.e. the one calling HTMLArea) and leave this one
|
||||
* unchanged. That's because when we (InteractiveTools.com) release a
|
||||
* new official version, it's less likely that you will have problems
|
||||
* upgrading HTMLArea.
|
||||
*/
|
||||
this.toolbar = [
|
||||
[ "fontname", "space",
|
||||
"fontsize", "space",
|
||||
@@ -153,7 +144,7 @@ HTMLArea.Config = function () {
|
||||
"lefttoright", "righttoleft", "separator",
|
||||
"insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
|
||||
"forecolor", "hilitecolor", "separator",
|
||||
"inserthorizontalrule", "createlink", "unlink", "insertimage", "inserttable",
|
||||
"inserthorizontalrule", "createanchor", "createlink", "unlink", "insertimage", "inserttable",
|
||||
"insertsmile", "insertchar", "separator", "htmlmode", "separator", "popupeditor" ]
|
||||
];
|
||||
|
||||
@@ -164,7 +155,7 @@ HTMLArea.Config = function () {
|
||||
"Tahoma": 'tahoma,arial,helvetica,sans-serif',
|
||||
"Times New Roman": 'times new roman,times,serif',
|
||||
"Verdana": 'verdana,arial,helvetica,sans-serif',
|
||||
"impact": 'impact',
|
||||
"Impact": 'impact',
|
||||
"WingDings": 'wingdings'
|
||||
};
|
||||
|
||||
@@ -196,20 +187,6 @@ HTMLArea.Config = function () {
|
||||
e.execCommand(cmd);
|
||||
};
|
||||
|
||||
// ADDING CUSTOM BUTTONS: please read below!
|
||||
// format of the btnList elements is "ID: [ ToolTip, Icon, Enabled in text mode?, ACTION ]"
|
||||
// - ID: unique ID for the button. If the button calls document.execCommand
|
||||
// it's wise to give it the same name as the called command.
|
||||
// - ACTION: function that gets called when the button is clicked.
|
||||
// it has the following prototype:
|
||||
// function(editor, buttonName)
|
||||
// - editor is the HTMLArea object that triggered the call
|
||||
// - buttonName is the ID of the clicked button
|
||||
// These 2 parameters makes it possible for you to use the same
|
||||
// handler for more HTMLArea objects or for more different buttons.
|
||||
// - ToolTip: default tooltip, for cases when it is not defined in the -lang- file (HTMLArea.I18N)
|
||||
// - Icon: path to an icon image file for the button (TODO: use one image for all buttons!)
|
||||
// - Enabled in text mode: if false the button gets disabled for text-only mode; otherwise enabled all the time.
|
||||
this.btnList = {
|
||||
bold: [ "Bold", "ed_format_bold.gif", false, function(e) {e.execCommand("bold");} ],
|
||||
italic: [ "Italic", "ed_format_italic.gif", false, function(e) {e.execCommand("italic");} ],
|
||||
@@ -228,6 +205,7 @@ HTMLArea.Config = function () {
|
||||
forecolor: [ "Font Color", "ed_color_fg.gif", false, function(e) {e.execCommand("forecolor");} ],
|
||||
hilitecolor: [ "Background Color", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ],
|
||||
inserthorizontalrule: [ "Horizontal Rule", "ed_hr.gif", false, function(e) {e.execCommand("inserthorizontalrule");} ],
|
||||
createanchor: [ "Create anchor", "ed_anchor.gif", false, function(e) {e.execCommand("createanchor", true);} ],
|
||||
createlink: [ "Insert Web Link", "ed_link.gif", false, function(e) {e.execCommand("createlink", true);} ],
|
||||
unlink: [ "Remove Link", "ed_unlink.gif", false, function(e) {e.execCommand("unlink");} ],
|
||||
insertimage: [ "Insert/Modify Image", "ed_image.gif", false, function(e) {e.execCommand("insertimage");} ],
|
||||
@@ -247,29 +225,7 @@ HTMLArea.Config = function () {
|
||||
insertsmile: ["Insert Smiley", "em.icon.smile.gif", false, function(e) {e.execCommand("insertsmile");} ],
|
||||
insertchar: [ "Insert Char", "icon_ins_char.gif", false, function(e) {e.execCommand("insertchar");} ]
|
||||
};
|
||||
/* ADDING CUSTOM BUTTONS
|
||||
* ---------------------
|
||||
*
|
||||
* It is recommended that you add the custom buttons in an external
|
||||
* file and leave this one unchanged. That's because when we
|
||||
* (InteractiveTools.com) release a new official version, it's less
|
||||
* likely that you will have problems upgrading HTMLArea.
|
||||
*
|
||||
* Example on how to add a custom button when you construct the HTMLArea:
|
||||
*
|
||||
* var editor = new HTMLArea("your_text_area_id");
|
||||
* var cfg = editor.config; // this is the default configuration
|
||||
* cfg.btnList["my-hilite"] =
|
||||
* [ function(editor) { editor.surroundHTML('<span style="background:yellow">', '</span>'); }, // action
|
||||
* "Highlight selection", // tooltip
|
||||
* "my_hilite.gif", // image
|
||||
* false // disabled in text mode
|
||||
* ];
|
||||
* cfg.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar
|
||||
*
|
||||
* An alternate (also more convenient and recommended) way to
|
||||
* accomplish this is to use the registerButton function below.
|
||||
*/
|
||||
|
||||
// initialize tooltips from the I18N module and generate correct image path
|
||||
for (var i in this.btnList) {
|
||||
var btn = this.btnList[i];
|
||||
@@ -280,23 +236,6 @@ HTMLArea.Config = function () {
|
||||
}
|
||||
};
|
||||
|
||||
/** Helper function: register a new button with the configuration. It can be
|
||||
* called with all 5 arguments, or with only one (first one). When called with
|
||||
* only one argument it must be an object with the following properties: id,
|
||||
* tooltip, image, textMode, action. Examples:
|
||||
*
|
||||
* 1. config.registerButton("my-hilite", "Hilite text", "my-hilite.gif", false, function(editor) {...});
|
||||
* 2. config.registerButton({
|
||||
* id : "my-hilite", // the ID of your button
|
||||
* tooltip : "Hilite text", // the tooltip
|
||||
* image : "my-hilite.gif", // image to be displayed in the toolbar
|
||||
* textMode : false, // disabled in text mode
|
||||
* action : function(editor) { // called when the button is clicked
|
||||
* editor.surroundHTML('<span class="hilite">', '</span>');
|
||||
* },
|
||||
* context : "p" // will be disabled if outside a <p> element
|
||||
* });
|
||||
*/
|
||||
HTMLArea.Config.prototype.registerButton = function(id, tooltip, image, textMode, action, context) {
|
||||
var the_id;
|
||||
if (typeof id == "string") {
|
||||
@@ -320,12 +259,6 @@ HTMLArea.Config.prototype.registerButton = function(id, tooltip, image, textMode
|
||||
}
|
||||
};
|
||||
|
||||
/** The following helper function registers a dropdown box with the editor
|
||||
* configuration. You still have to add it to the toolbar, same as with the
|
||||
* buttons. Call it like this:
|
||||
*
|
||||
* FIXME: add example
|
||||
*/
|
||||
HTMLArea.Config.prototype.registerDropdown = function(object) {
|
||||
// check for existing id
|
||||
if (typeof this.customSelects[object.id] != "undefined") {
|
||||
@@ -337,16 +270,6 @@ HTMLArea.Config.prototype.registerDropdown = function(object) {
|
||||
this.customSelects[object.id] = object;
|
||||
};
|
||||
|
||||
/** Call this function to remove some buttons/drop-down boxes from the toolbar.
|
||||
* Pass as the only parameter a string containing button/drop-down names
|
||||
* delimited by spaces. Note that the string should also begin with a space
|
||||
* and end with a space. Example:
|
||||
*
|
||||
* config.hideSomeButtons(" fontname fontsize textindicator ");
|
||||
*
|
||||
* It's useful because it's easier to remove stuff from the defaul toolbar than
|
||||
* create a brand new toolbar ;-)
|
||||
*/
|
||||
HTMLArea.Config.prototype.hideSomeButtons = function(remove) {
|
||||
var toolbar = this.toolbar;
|
||||
for (var i in toolbar) {
|
||||
@@ -404,9 +327,6 @@ HTMLArea.prototype._createToolbar = function () {
|
||||
// init first line
|
||||
newLine();
|
||||
|
||||
// updates the state of a toolbar element. This function is member of
|
||||
// a toolbar element object (unnamed objects created by createButton or
|
||||
// createSelect functions below).
|
||||
function setButtonStatus(id, newval) {
|
||||
var oldval = this[id];
|
||||
var el = this.element;
|
||||
@@ -433,10 +353,6 @@ HTMLArea.prototype._createToolbar = function () {
|
||||
}
|
||||
}; // END of function: setButtonStatus
|
||||
|
||||
// this function will handle creation of combo boxes. Receives as
|
||||
// parameter the name of a button as defined in the toolBar config.
|
||||
// This function is called from createButton, above, if the given "txt"
|
||||
// doesn't match a button.
|
||||
function createSelect(txt) {
|
||||
var options = null;
|
||||
var el = null;
|
||||
@@ -447,13 +363,6 @@ HTMLArea.prototype._createToolbar = function () {
|
||||
case "fontsize":
|
||||
case "fontname":
|
||||
case "formatblock":
|
||||
// the following line retrieves the correct
|
||||
// configuration option because the variable name
|
||||
// inside the Config object is named the same as the
|
||||
// button/select in the toolbar. For instance, if txt
|
||||
// == "formatblock" we retrieve config.formatblock (or
|
||||
// a different way to write it in JS is
|
||||
// config["formatblock"].
|
||||
options = editor.config[txt];
|
||||
cmd = txt;
|
||||
break;
|
||||
@@ -717,9 +626,6 @@ HTMLArea.prototype.generate = function () {
|
||||
|
||||
if (!HTMLArea.is_ie) {
|
||||
iframe.style.borderWidth = "1px";
|
||||
// iframe.frameBorder = "1";
|
||||
// iframe.marginHeight = "0";
|
||||
// iframe.marginWidth = "0";
|
||||
}
|
||||
|
||||
// size the IFRAME according to user's prefs or initial textarea
|
||||
@@ -795,9 +701,6 @@ HTMLArea.prototype.generate = function () {
|
||||
}
|
||||
|
||||
if (HTMLArea.is_ie) {
|
||||
// enable editable mode for IE. For some reason this
|
||||
// doesn't work if done in the same place as for Gecko
|
||||
// (above).
|
||||
doc.body.contentEditable = true;
|
||||
}
|
||||
|
||||
@@ -899,14 +802,8 @@ HTMLArea.prototype.setFullHTML = function(html) {
|
||||
}
|
||||
};
|
||||
|
||||
/***************************************************
|
||||
* Category: PLUGINS
|
||||
***************************************************/
|
||||
// Category: PLUGINS
|
||||
|
||||
// this is the variant of the function above where the plugin arguments are
|
||||
// already packed in an array. Externally, it should be only used in the
|
||||
// full-screen editor code, in order to initialize plugins with the same
|
||||
// parameters as in the opener window.
|
||||
HTMLArea.prototype.registerPlugin2 = function(plugin, args) {
|
||||
if (typeof plugin == "string")
|
||||
plugin = eval(plugin);
|
||||
@@ -932,9 +829,6 @@ HTMLArea.prototype.registerPlugin = function() {
|
||||
this.registerPlugin2(plugin, args);
|
||||
};
|
||||
|
||||
// static function that loads the required plugin and lang file, based on the
|
||||
// language loaded already for HTMLArea. You better make sure that the plugin
|
||||
// _has_ that language, otherwise shit might happen ;-)
|
||||
HTMLArea.loadPlugin = function(pluginName) {
|
||||
var dir = _editor_url + "plugins/" + pluginName;
|
||||
var plugin = pluginName.replace(/([a-z])([A-Z])([a-z])/g,
|
||||
@@ -958,9 +852,7 @@ HTMLArea.loadStyle = function(style, plugin) {
|
||||
};
|
||||
HTMLArea.loadStyle("htmlarea.css");
|
||||
|
||||
/***************************************************
|
||||
* Category: EDITOR UTILITIES
|
||||
***************************************************/
|
||||
// Category: EDITOR UTILITIES
|
||||
|
||||
// The following function is a slight variation of the word cleaner code posted
|
||||
// by Weeezl (user @ InteractiveTools forums).
|
||||
@@ -1185,10 +1077,6 @@ HTMLArea.prototype.updateToolbar = function(noStatus) {
|
||||
// FIXME: what do we do here?
|
||||
break;
|
||||
}
|
||||
// HACK -- retrieve the config option for this
|
||||
// combo box. We rely on the fact that the
|
||||
// variable in config has the same name as
|
||||
// button name in the toolbar.
|
||||
var options = this.config[cmd];
|
||||
var k = 0;
|
||||
// btn.element.selectedIndex = 0;
|
||||
@@ -1308,11 +1196,6 @@ HTMLArea.prototype.getParentElement = function() {
|
||||
switch (sel.type) {
|
||||
case "Text":
|
||||
case "None":
|
||||
// It seems that even for selection of type "None",
|
||||
// there _is_ a parent element and it's value is not
|
||||
// only correct, but very important to us. MSIE is
|
||||
// certainly the buggiest browser in the world and I
|
||||
// wonder, God, how can Earth stand it?
|
||||
return range.parentElement();
|
||||
case "Control":
|
||||
return range.item(0);
|
||||
@@ -1370,9 +1253,8 @@ HTMLArea.prototype.selectNodeContents = function(node, pos) {
|
||||
}
|
||||
};
|
||||
|
||||
/** Call this function to insert HTML code at the current position. It deletes
|
||||
* the selection, if any.
|
||||
*/
|
||||
// Call this function to insert HTML code at the current position. It deletes
|
||||
// the selection, if any.
|
||||
HTMLArea.prototype.insertHTML = function(html) {
|
||||
var sel = this._getSelection();
|
||||
var range = this._createRange(sel);
|
||||
@@ -1392,10 +1274,8 @@ HTMLArea.prototype.insertHTML = function(html) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to surround the existing HTML code in the selection with
|
||||
* your tags. FIXME: buggy! This function will be deprecated "soon".
|
||||
*/
|
||||
// Call this function to surround the existing HTML code in the selection with
|
||||
// your tags. FIXME: buggy! This function will be deprecated "soon".
|
||||
HTMLArea.prototype.surroundHTML = function(startTag, endTag) {
|
||||
var html = this.getSelectedHTML();
|
||||
// the following also deletes the selection
|
||||
@@ -1423,17 +1303,31 @@ HTMLArea.prototype.hasSelectedText = function() {
|
||||
|
||||
HTMLArea.prototype._createLink = function(link) {
|
||||
var editor = this;
|
||||
var allinks = editor._doc.getElementsByTagName('A');
|
||||
var anchors = new Array();
|
||||
for(var i = 0; i < allinks.length; i++) {
|
||||
var attrname = allinks[i].getAttribute('name');
|
||||
if((HTMLArea.is_ie ? attrname.length > 0 : attrname != null)) {
|
||||
anchors[i] = allinks[i].getAttribute('name');
|
||||
}
|
||||
}
|
||||
var outparam = null;
|
||||
if (typeof link == "undefined") {
|
||||
link = this.getParentElement();
|
||||
if (link && !/^a$/i.test(link.tagName))
|
||||
link = null;
|
||||
}
|
||||
if (link) outparam = {
|
||||
if (link) {
|
||||
outparam = {
|
||||
f_href : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"),
|
||||
f_title : link.title,
|
||||
f_target : link.target
|
||||
f_target : link.target,
|
||||
f_anchors: anchors
|
||||
};
|
||||
} else {
|
||||
outparam = {
|
||||
f_anchors:anchors };
|
||||
}
|
||||
this._popupDialog("link_std.php?id=<?php echo $id; ?>", function(param) {
|
||||
if (!param)
|
||||
return false;
|
||||
@@ -1587,11 +1481,8 @@ HTMLArea.prototype._insertTable = function() {
|
||||
return true;
|
||||
}, null);
|
||||
};
|
||||
/******************************************************************
|
||||
* Moodle hack - insertSmile
|
||||
******************************************************************/
|
||||
/// since method insertimage doesn't work the same way in mozilla
|
||||
/// as it does in IE, let's go around this for both browsers.
|
||||
|
||||
/// Moodle hack - insertSmile
|
||||
HTMLArea.prototype._insertSmile = function() {
|
||||
var sel = this._getSelection();
|
||||
var range = this._createRange(sel);
|
||||
@@ -1603,7 +1494,6 @@ HTMLArea.prototype._insertSmile = function() {
|
||||
if (HTMLArea.is_ie) {
|
||||
range.pasteHTML(imgString);
|
||||
} else {
|
||||
// insert the table
|
||||
editor.insertHTML(imgString);
|
||||
}
|
||||
return true;
|
||||
@@ -1636,12 +1526,30 @@ HTMLArea.prototype._removelink = function() {
|
||||
this._doc.execCommand("unlink", false, null);
|
||||
this.focusEditor();
|
||||
};
|
||||
/************************************************************************
|
||||
* Moodle hack's ends
|
||||
************************************************************************/
|
||||
/***************************************************
|
||||
* Category: EVENT HANDLERS
|
||||
***************************************************/
|
||||
|
||||
HTMLArea.prototype._createanchor = function () {
|
||||
var editor = this;
|
||||
var sel = this._getSelection();
|
||||
var rng = this._createRange(sel);
|
||||
var len = HTMLArea.is_ie ? rng.text.toString().length : sel.toString().length;
|
||||
if(len < 1) {
|
||||
alert("You must select text first!");
|
||||
return false;
|
||||
}
|
||||
this._popupDialog("createanchor.php", function(objAn) {
|
||||
if(!objAn) {
|
||||
return false;
|
||||
}
|
||||
var str = '<a name="'+ objAn.anchor+'">';
|
||||
str += HTMLArea.is_ie ? rng.text : sel ;
|
||||
str += '</a>';
|
||||
editor.insertHTML(str);
|
||||
},null);
|
||||
};
|
||||
|
||||
/// Moodle hack's ends
|
||||
//
|
||||
// Category: EVENT HANDLERS
|
||||
|
||||
// el is reference to the SELECT object
|
||||
// txt is the name of the select field, as in config.toolbar
|
||||
@@ -1683,6 +1591,7 @@ HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
|
||||
}
|
||||
}, HTMLArea._colorToRgb(this._doc.queryCommandValue(cmdID)));
|
||||
break;
|
||||
case "createanchor": this._createanchor(); break;
|
||||
case "createlink":
|
||||
this._createLink();
|
||||
break;
|
||||
@@ -1691,7 +1600,6 @@ HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
|
||||
// this object will be passed to the newly opened window
|
||||
HTMLArea._object = this;
|
||||
if (HTMLArea.is_ie) {
|
||||
//if (confirm(HTMLArea.I18N.msg["IE-sucks-full-screen"]))
|
||||
{
|
||||
window.open(this.popupURL("fullscreen.php?id=<?php print($id);?>"), "ha_fullscreen",
|
||||
"toolbar=no,location=no,directories=no,status=no,menubar=no," +
|
||||
@@ -2114,13 +2022,6 @@ HTMLArea.getHTML = function(root, outputRoot, editor) {
|
||||
}
|
||||
var value;
|
||||
if (name != "style") {
|
||||
// IE5.5 reports 25 when cellSpacing is
|
||||
// 1; other values might be doomed too.
|
||||
// For this reason we extract the
|
||||
// values directly from the root node.
|
||||
// I'm starting to HATE JavaScript
|
||||
// development. Browser differences
|
||||
// suck.
|
||||
//
|
||||
// Using Gecko the values of href and src are converted to absolute links
|
||||
// unless we get them using nodeValue()
|
||||
@@ -2128,9 +2029,6 @@ HTMLArea.getHTML = function(root, outputRoot, editor) {
|
||||
value = root[a.nodeName];
|
||||
} else {
|
||||
value = a.nodeValue;
|
||||
// IE seems not willing to return the original values - it converts to absolute
|
||||
// links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href")
|
||||
// So we have to strip the baseurl manually -/
|
||||
if (HTMLArea.is_ie && (name == "href" || name == "src")) {
|
||||
value = editor.stripBaseURL(value);
|
||||
}
|
||||
@@ -2250,11 +2148,6 @@ HTMLArea._colorToRgb = function(v) {
|
||||
return null;
|
||||
};
|
||||
|
||||
// modal dialogs for Mozilla (for IE we're using the showModalDialog() call).
|
||||
|
||||
// receives an URL to the popup dialog and a function that receives one value;
|
||||
// this function will get called after the dialog is closed, with the return
|
||||
// value of the dialog.
|
||||
HTMLArea.prototype._popupDialog = function(url, action, init) {
|
||||
Dialog(this.popupURL(url), action, init);
|
||||
};
|
||||
@@ -2294,11 +2187,3 @@ HTMLArea.getElementById = function(tag, id) {
|
||||
return el;
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// EOF
|
||||
// Local variables: //
|
||||
// c-basic-offset:8 //
|
||||
// indent-tabs-mode:t //
|
||||
// End: //
|
||||
|
||||
+2304
-2011
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
<?php // $Id$
|
||||
include("../../../config.php");
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
|
||||
<title>Create anchor</title>
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
var required = {
|
||||
"f_anc": "You must enter the URL where this link points to"
|
||||
};
|
||||
var txt = document.forms[0].anc.value;
|
||||
if (!txt) {
|
||||
alert(required[f_anc]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
// pass data back to the calling window
|
||||
var param = new Object();
|
||||
param.anchor = txt;
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
};
|
||||
|
||||
function onCancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
};
|
||||
// -->
|
||||
</script>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body { background: ButtonFace; font-family: Tahoma, sans-serif; }
|
||||
td, button, input { font-family: Tahoma, verdana, sans-serif; font-size: 8pt; }
|
||||
button { width: 70px; }
|
||||
.title { background: #ddf; color: #000; font-weight: bold; font-size: 10pt; padding: 3px 10px; margin-bottom: 10px;
|
||||
border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
.note { font-size: 8pt; }
|
||||
// -->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="title"><?php print_string("createanchor","editor");?></div>
|
||||
<form name="fie">
|
||||
<table border="0" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td><?php print_string("anchorname","editor");?>: <input id="f_anc" name="anc" type="text" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<br />
|
||||
<button onclick="return onOK();" type="button"><?php print_string("ok","editor");?></button> <button onclick="return onCancel();" type="button"><?php print_string("cancel","editor");?></button>
|
||||
<button type="button" onclick="javascript: void(0); alert('This only creates an anchor.\nYou still need to create a link manually.');">Help</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -47,44 +47,28 @@
|
||||
<?php
|
||||
include("../../../config.php");
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html style="height: 270px;">
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>">
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
body { padding: 5px; }
|
||||
table {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
form p {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
<!--
|
||||
body { background: ButtonFace; color: ButtonText; font: 11px Tahoma,Verdana,sans-serif;
|
||||
margin: 0px; padding: 0px; }
|
||||
form p { margin-top: 5px; margin-bottom: 5px; }
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
button { width: 70px; }
|
||||
.space { padding: 2px; }
|
||||
|
||||
.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
|
||||
border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
.title { background: #ddf; color: #000; font-weight: bold; font-size: 14px; padding: 3px 10px; margin-bottom: 10px;
|
||||
border-bottom: 1px solid black; letter-spacing: 2px; }
|
||||
form { padding: 0px; margin: 0px; }
|
||||
.chr {
|
||||
background-color: transparent;
|
||||
border: 1px solid #dcdcdc;
|
||||
font-family: "Times New Roman", times;
|
||||
font-size: small;
|
||||
}
|
||||
.chr { background-color: transparent; border: 1px solid #dcdcdc; font-family: "Times New Roman", times;
|
||||
font-size: small; }
|
||||
// -->
|
||||
</style>
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
@@ -126,7 +110,7 @@ function cancel() {
|
||||
return false;
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
</script>
|
||||
<title><?php print_string("choosechar","editor");?></title>
|
||||
</head>
|
||||
<body onload="Init()">
|
||||
@@ -138,11 +122,11 @@ function cancel() {
|
||||
<tr valign="top">
|
||||
<td>
|
||||
|
||||
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
document.write(tab(7,32))
|
||||
//-->
|
||||
</SCRIPT>
|
||||
</script>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -33,16 +33,16 @@
|
||||
'evil' => '}-]' );
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
|
||||
<meta name=vs_targetSchema content="HTML 4.0">
|
||||
<meta name="GENERATOR" content="Microsoft Visual Studio 7.0">
|
||||
<LINK rel="stylesheet" type="text/css" href="dialog.css">
|
||||
<title><?php print_string('insertsmile', 'editor') ?> </title>
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<title><?php print_string('insertsmile', 'editor') ?></title>
|
||||
<link rel="stylesheet" href="dialog.css" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
}
|
||||
@@ -65,23 +65,18 @@ function cancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
};
|
||||
// -->
|
||||
</script>
|
||||
<style type="text/css">
|
||||
body {
|
||||
width: 330;
|
||||
height: 360;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init()">
|
||||
<table class="dlg" cellpadding="0" cellspacing="2" width="100%" height="100%">
|
||||
<table class="dlg" cellpadding="0" cellspacing="2" width="100%">
|
||||
<tr><td><table width="100%"><tr><td class="title" nowrap><?php print_string("chooseicon","editor") ?></td></tr></table></td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" align="center" cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<table border="0" align="center">
|
||||
<table border="0">
|
||||
<?php
|
||||
$list = array('smiley', 'biggrin', 'wink', 'mixed', 'thoughtful',
|
||||
'tongueout', 'cool', 'approve', 'wideeyes', 'surprise');
|
||||
@@ -124,7 +119,7 @@ body {
|
||||
</tr>
|
||||
<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>
|
||||
<tr><td align="right">
|
||||
<button type="button" onclick="cancel()"><?php print_string("close","editor") ?></button></td></tr>
|
||||
<button type="button" onclick="return cancel();"><?php print_string("close","editor") ?></button></td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,24 +9,27 @@
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
|
||||
<title><?php print_string("insertimage","editor");?></title>
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var preview_window = null;
|
||||
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
var param = window.dialogArguments;
|
||||
if (param) {
|
||||
var alt = param["f_url"].substring(param["f_url"].lastIndexOf('/') + 1);
|
||||
document.getElementById("f_url").value = param["f_url"];
|
||||
document.getElementById("f_alt").value = param["f_alt"];
|
||||
document.getElementById("f_border").value = param["f_border"];
|
||||
document.getElementById("f_alt").value = param["f_alt"] ? param["f_alt"] : alt;
|
||||
document.getElementById("f_border").value = parseInt(param["f_border"] || 0);
|
||||
document.getElementById("f_align").value = param["f_align"];
|
||||
document.getElementById("f_vert").value = param["f_vert"];
|
||||
document.getElementById("f_horiz").value = param["f_horiz"];
|
||||
document.getElementById("f_vert").value = param["f_vert"] != -1 ? param["f_vert"] : 0;
|
||||
document.getElementById("f_horiz").value = param["f_horiz"] != -1 ? param["f_horiz"] : 0;
|
||||
document.getElementById("f_width").value = param["f_width"];
|
||||
document.getElementById("f_height").value = param["f_height"];
|
||||
window.ipreview.location.replace('preview.php?id='+ <?php print($course->id);?> +'&imageurl='+ param.f_url);
|
||||
@@ -144,8 +147,6 @@ function submit_form(dothis) {
|
||||
</script>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
width: 730;
|
||||
height: 540;
|
||||
margin: 2px;
|
||||
background-color: rgb(212,208,200);
|
||||
font-family: Tahoma, Verdana, sans-serif;
|
||||
@@ -168,9 +169,7 @@ button { width: 70px; }
|
||||
.space { padding: 2px; }
|
||||
form { margin-bottom: 0px; margin-top: 0px; }
|
||||
</style>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body onload="Init()">
|
||||
<div class="title"><?php print_string("insertimage","editor");?></div>
|
||||
<div class="space"></div>
|
||||
@@ -264,12 +263,12 @@ form { margin-bottom: 0px; margin-top: 0px; }
|
||||
print_string("filebrowser","editor");
|
||||
} else {
|
||||
print "";
|
||||
}?><br>
|
||||
}?><br />
|
||||
<?php print(isteacher($id))?
|
||||
"<iframe id=\"ibrowser\" name=\"ibrowser\" src=\"".$CFG->wwwroot."/lib/editor/coursefiles.php?usecheckboxes=true&id=".$course->id."\" style=\"width: 100%; height: 200px;\"></iframe>":
|
||||
"";?>
|
||||
</td>
|
||||
<td width="45%" valign="top"><?php print_string("preview","editor");?>:<br>
|
||||
<td width="45%" valign="top"><?php print_string("preview","editor");?>:<br />
|
||||
<iframe id="ipreview" name="ipreview" src="about:blank" style="width: 100%; height: 200px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -293,7 +292,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
|
||||
<input type="hidden" name="action" value="rename" />
|
||||
<input name="btnRename" type="submit" id="btnRename" value="<?php print_string("rename","editor");?>" /></form></td>
|
||||
<tr></table>
|
||||
<br>
|
||||
<br />
|
||||
<?php
|
||||
} else {
|
||||
print "";
|
||||
@@ -336,6 +335,6 @@ form { margin-bottom: 0px; margin-top: 0px; }
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,14 +9,16 @@
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
|
||||
<title><?php print_string("insertimage","editor");?></title>
|
||||
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
<script language="javascript" type="text/javascript">
|
||||
var preview_window = null;
|
||||
|
||||
function Init() {
|
||||
@@ -109,8 +111,6 @@ function onPreview() {
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
width: 450;
|
||||
height: 230;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
@@ -137,9 +137,7 @@ border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
form { padding: 0px; margin: 0px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="Init()">
|
||||
|
||||
<div class="title"><?php print_string("insertimage","editor");?></div>
|
||||
@@ -161,12 +159,10 @@ form { padding: 0px; margin: 0px; }
|
||||
<td><input type="text" name="alt" id="f_alt" style="width:100%"
|
||||
title="For browsers that don't support images" /></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p />
|
||||
|
||||
<fieldset style="float: left; margin-left: 5px;">
|
||||
<legend><?php print_string("layout","editor");?></legend>
|
||||
|
||||
@@ -221,8 +217,6 @@ title="Vertical padding" />
|
||||
<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor");?></button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?php
|
||||
include("../../../config.php");
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
|
||||
<title><?php print_string("inserttable","editor");?></title>
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
@@ -47,8 +49,6 @@ function onCancel() {
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
width: 410;
|
||||
height: 240;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
@@ -75,9 +75,7 @@ border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
form { padding: 0px; margin: 0px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="Init()">
|
||||
|
||||
<div class="title"><?php print_string("inserttable","editor") ?></div>
|
||||
@@ -99,7 +97,7 @@ form { padding: 0px; margin: 0px; }
|
||||
<td style="width: 4em; text-align: right"><?php print_string("width","editor") ?>:</td>
|
||||
<td><input type="text" name="f_width" id="f_width" size="5" title="Width of the table" value="100" /></td>
|
||||
<td><select size="1" name="f_unit" id="f_unit" title="Width unit">
|
||||
<option value="%" selected="1" ><?php print_string("percent","editor") ?></option>
|
||||
<option value="%" selected="selected" ><?php print_string("percent","editor") ?></option>
|
||||
<option value="px" ><?php print_string("pixels","editor") ?></option>
|
||||
<option value="em" >Em</option>
|
||||
</select></td>
|
||||
@@ -118,7 +116,7 @@ form { padding: 0px; margin: 0px; }
|
||||
<div class="fl"><?php print_string("alignment","editor") ?>:</div>
|
||||
<select size="1" name="f_align" id="f_align"
|
||||
title="Positioning of this image">
|
||||
<option value="" selected="1" ><?php print_string("notset","editor") ?></option>
|
||||
<option value="" selected="selected" ><?php print_string("notset","editor") ?></option>
|
||||
<option value="left" ><?php print_string("left","editor") ?></option>
|
||||
<option value="right" ><?php print_string("right","editor") ?></option>
|
||||
<option value="texttop" ><?php print_string("texttop","editor") ?></option>
|
||||
@@ -169,8 +167,6 @@ title="Space between content and border in cell" />
|
||||
<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor") ?></button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor") ?></button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+23
-23
@@ -9,12 +9,13 @@
|
||||
$course->fullname = ""; // Just to keep display happy, though browsing may fail
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<!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; <?php print_string("thischarset");?>">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<meta http-equiv="Content-Type" content="text/html; <?php print_string("thischarset");?>" />
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function onCancel() {
|
||||
window.close();
|
||||
@@ -74,7 +75,6 @@ color: black;
|
||||
form { margin-bottom: 1px; margin-top: 1px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="title"><?php print_string("insertlink","editor");?></div>
|
||||
<table width="450" border="0" cellspacing="0" cellpadding="2">
|
||||
@@ -103,17 +103,17 @@ form { margin-bottom: 1px; margin-top: 1px; }
|
||||
<table border="0" cellpadding="2" cellspacing="0">
|
||||
<tr><td><?php print_string("selection","editor");?>: </td>
|
||||
<td><form name="idelete" id="idelete">
|
||||
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');"></form></td>
|
||||
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
|
||||
<td><form name="imove" id="imove">
|
||||
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');"></form></td>
|
||||
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></form></td>
|
||||
<td><form name="izip" id="izip">
|
||||
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');"></form></td>
|
||||
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
|
||||
<td><form name="irename" id="irename" method="post" action="../coursefiles.php" target="fbrowser">
|
||||
<input type="hidden" name="id" value="<?php print($course->id);?>">
|
||||
<input type="hidden" name="wdir" value="">
|
||||
<input type="hidden" name="file" value="">
|
||||
<input type="hidden" name="action" value="rename">
|
||||
<input name="btnRename" type="submit" id="btnRename" value="<?php print_string("rename","editor");?>"></form></td>
|
||||
<input type="hidden" name="id" value="<?php print($course->id);?>" />
|
||||
<input type="hidden" name="wdir" value="" />
|
||||
<input type="hidden" name="file" value="" />
|
||||
<input type="hidden" name="action" value="rename" />
|
||||
<input name="btnRename" type="submit" id="btnRename" value="<?php print_string("rename","editor");?>" /></form></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
@@ -127,19 +127,19 @@ form { margin-bottom: 1px; margin-top: 1px; }
|
||||
<td height="22"><?php
|
||||
if(isteacher($id)) { ?>
|
||||
<form name="cfolder" id="cfolder" action="../coursefiles.php" method="post" target="fbrowser">
|
||||
<input type="hidden" name="id" value="<?php print($course->id);?>">
|
||||
<input type="hidden" name="wdir" value="">
|
||||
<input type="hidden" name="action" value="mkdir">
|
||||
<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');">
|
||||
<input type="hidden" name="id" value="<?php print($course->id);?>" />
|
||||
<input type="hidden" name="wdir" value="" />
|
||||
<input type="hidden" name="action" value="mkdir" />
|
||||
<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($course->id);?>" method="post" enctype="multipart/form-data" name="uploader" 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($course->id);?>">
|
||||
<input type="hidden" name="wdir" value="">
|
||||
<input type="hidden" name="action" value="upload">
|
||||
<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");?>">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
|
||||
<input type="hidden" name="id" VALUE="<?php print($course->id);?>" />
|
||||
<input type="hidden" name="wdir" value="" />
|
||||
<input type="hidden" name="action" value="upload" />
|
||||
<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 {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
$course->fullname = ""; // Just to keep display happy, though browsing may fail
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; <?php print_string("thischarset");?>">
|
||||
<meta http-equiv="Content-Type" content="text/html; <?php print_string("thischarset");?>" />
|
||||
<title><?php print_string("insertlink","editor");?></title>
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script language="javascript" type="text/javascript" src="popup.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
function onTargetChanged() {
|
||||
var f = document.getElementById("f_other_target");
|
||||
if (this.value == "_other") {
|
||||
@@ -25,13 +25,23 @@ function onTargetChanged() {
|
||||
f.focus();
|
||||
} else f.style.visibility = "hidden";
|
||||
};
|
||||
|
||||
function Init() {
|
||||
//__dlg_translate(I18N);
|
||||
__dlg_init();
|
||||
|
||||
var param = window.dialogArguments;
|
||||
if(param.f_anchors) {
|
||||
//anchors = param.f_anchors;
|
||||
var anchor = document.getElementById('f_anchors');
|
||||
for(var a in param.f_anchors) {
|
||||
var opti = document.createElement('option');
|
||||
opti.value = '#' + param.f_anchors[a];
|
||||
opti.innerHTML = opti.value;
|
||||
anchor.appendChild(opti);
|
||||
}
|
||||
}
|
||||
var target_select = document.getElementById("f_target");
|
||||
if (param) {
|
||||
if (param.f_href) {
|
||||
document.getElementById("f_href").value = param["f_href"];
|
||||
document.getElementById("f_title").value = param["f_title"];
|
||||
//comboSelectValue(target_select, param["f_target"]);
|
||||
@@ -103,12 +113,17 @@ function onBrowse() {
|
||||
var newwin = window.open("link.php?id=<?php echo $id; ?>","",""+ settings +" left="+ lx +", top="+ tx +"");
|
||||
return false;
|
||||
}
|
||||
function seturl() {
|
||||
var sel = document.getElementById('f_anchors');
|
||||
var txt = sel.options[sel.selectedIndex].text;
|
||||
if(txt != '----') {
|
||||
var f_url = document.getElementById('f_href');
|
||||
f_url.value = txt;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
width: 400px;
|
||||
height: 180px;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
@@ -130,13 +145,16 @@ border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
padding: 2px; text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="Init()">
|
||||
<div class="title"><?php print_string("insertlink","editor");?></div>
|
||||
|
||||
<table border="0" style="width: 100%;">
|
||||
<tr>
|
||||
<td class="label"><?php print_string("anchors","editor");?>:</td>
|
||||
<td><select id="f_anchors" onchange="seturl()">
|
||||
<option value="">----</option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><?php print_string("linkurl","editor");?>:</td>
|
||||
<td><input type="text" id="f_href" style="width: 100%" /></td>
|
||||
@@ -159,7 +177,7 @@ border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
</table>
|
||||
|
||||
<div id="buttons">
|
||||
<?php print(isteacher($id))? "<button type=\"button\" name=\"browse\" onclick=\"return onBrowse();\">".get_string("browse", "editor")."...</button>" : ""; ?>
|
||||
<?php print(isteacher($id))? "<button type=\"button\" name=\"browse\" onclick=\"return onBrowse();\">".get_string("browse","editor")."</button>" : ""; ?>
|
||||
<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor");?></button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button>
|
||||
</div>
|
||||
|
||||
+75
-34
@@ -1,45 +1,86 @@
|
||||
function __dlg_onclose() {
|
||||
if (!document.all) {
|
||||
opener.Dialog._return(null);
|
||||
// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
|
||||
// This copyright notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Portions (c) dynarch.com, 2003
|
||||
//
|
||||
// A free WYSIWYG editor replacement for <textarea> fields.
|
||||
// For full source code and docs, visit http://www.interactivetools.com/
|
||||
//
|
||||
// Version 3.0 developed by Mihai Bazon.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id$
|
||||
|
||||
function getAbsolutePos(el) {
|
||||
var r = { x: el.offsetLeft, y: el.offsetTop };
|
||||
if (el.offsetParent) {
|
||||
var tmp = getAbsolutePos(el.offsetParent);
|
||||
r.x += tmp.x;
|
||||
r.y += tmp.y;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
function __dlg_init() {
|
||||
if (!document.all) {
|
||||
// init dialogArguments, as IE gets it
|
||||
window.dialogArguments = opener.Dialog._arguments;
|
||||
window.sizeToContent();
|
||||
window.sizeToContent(); // for reasons beyond understanding,
|
||||
// only if we call it twice we get the
|
||||
// correct size.
|
||||
window.addEventListener("unload", __dlg_onclose, true);
|
||||
// center on parent
|
||||
var px1 = opener.screenX;
|
||||
var px2 = opener.screenX + opener.outerWidth;
|
||||
var py1 = opener.screenY;
|
||||
var py2 = opener.screenY + opener.outerHeight;
|
||||
var x = (px2 - px1 - window.outerWidth) / 2;
|
||||
var y = (py2 - py1 - window.outerHeight) / 2;
|
||||
var body = document.body;
|
||||
window.innerHeight = body.offsetHeight + 10;
|
||||
window.innerWidth = body.offsetWidth + 10;
|
||||
//window.moveTo(((screen.width - window.innerWidth) / 2), ((screen.height - window.innerHeight)/2));
|
||||
//window.resizeTo(window.innerWidth, window.innerHeight);
|
||||
window.focus();
|
||||
} else {
|
||||
var body = document.body;
|
||||
window.dialogWidth = body.offsetWidth + "px";
|
||||
window.dialogHeight = body.offsetHeight + 50 + "px";
|
||||
window.resizeTo(window.dialogWidth, window.dialogHeight);
|
||||
function comboSelectValue(c, val) {
|
||||
var ops = c.getElementsByTagName("option");
|
||||
for (var i = ops.length; --i >= 0;) {
|
||||
var op = ops[i];
|
||||
op.selected = (op.value == val);
|
||||
}
|
||||
c.value = val;
|
||||
};
|
||||
|
||||
function __dlg_onclose() {
|
||||
opener.Dialog._return(null);
|
||||
};
|
||||
|
||||
function __dlg_init(bottom) {
|
||||
var body = document.body;
|
||||
var body_height = 0;
|
||||
if (typeof bottom == "undefined") {
|
||||
var div = document.createElement("div");
|
||||
body.appendChild(div);
|
||||
var pos = getAbsolutePos(div);
|
||||
body_height = pos.y;
|
||||
} else {
|
||||
var pos = getAbsolutePos(bottom);
|
||||
body_height = pos.y + bottom.offsetHeight;
|
||||
}
|
||||
window.dialogArguments = opener.Dialog._arguments;
|
||||
|
||||
document.body.onkeypress = __dlg_close_on_esc;
|
||||
window.focus();
|
||||
};
|
||||
|
||||
function __dlg_translate(i18n) {
|
||||
var types = ["span", "option", "td", "button", "div"];
|
||||
for (var type in types) {
|
||||
var spans = document.getElementsByTagName(types[type]);
|
||||
for (var i = spans.length; --i >= 0;) {
|
||||
var span = spans[i];
|
||||
if (span.firstChild && span.firstChild.data) {
|
||||
var txt = i18n[span.firstChild.data];
|
||||
if (txt)
|
||||
span.firstChild.data = txt;
|
||||
}
|
||||
}
|
||||
}
|
||||
var txt = i18n[document.title];
|
||||
if (txt)
|
||||
document.title = txt;
|
||||
};
|
||||
|
||||
// closes the dialog and passes the return info upper.
|
||||
function __dlg_close(val) {
|
||||
if (document.all) { // IE
|
||||
window.returnValue = val;
|
||||
} else {
|
||||
opener.Dialog._return(val);
|
||||
}
|
||||
window.close();
|
||||
};
|
||||
|
||||
function __dlg_close_on_esc(ev) {
|
||||
ev || (ev = window.event);
|
||||
if (ev.keyCode == 27) {
|
||||
window.close();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
$width = round($width / $division);
|
||||
$height = 190;
|
||||
}
|
||||
|
||||
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
|
||||
echo "\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<title>Preview</title>\n";
|
||||
|
||||
Reference in New Issue
Block a user