Author: kevinshen
Date: 2009-06-01 04:48:58 +0200 (Mon, 01 Jun 2009)
New Revision: 35534
Added:
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/CreateLink/
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/CreateLink/insertinline_link.html
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/InsertImage/
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/InsertImage/insertinline_image.html
Log:
CMSC-893 Replace the current Rich Text Editor with a better one , change file's
dir
Added:
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/CreateLink/insertinline_link.html
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/CreateLink/insertinline_link.html
(rev 0)
+++
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/CreateLink/insertinline_link.html
2009-06-01 02:48:58 UTC (rev 35534)
@@ -0,0 +1,267 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+<head>
+ <title>Insert/Modify Link</title>
+<script type="text/javascript" src="../../popups/popup.js"></script>
+<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
+
+ <script type="text/javascript">
+ window.resizeTo(500, 400);
+Xinha = window.opener.Xinha;
+
+function i18n(str) {
+ return (Xinha._lc(str, 'cmscrichtext'));
+}
+
+function onTargetChanged() {
+ var f = document.getElementById("f_other_target");
+ if (this.value == "_other") {
+ f.style.visibility = "visible";
+ f.select();
+ f.focus();
+ } else f.style.visibility = "hidden";
+}
+
+function Init() {
+ __dlg_translate('cmscrichtext');
+ __dlg_init();
+
+ // Make sure the translated string appears in the drop down. (for gecko)
+ document.getElementById("f_target").selectedIndex = 1;
+ document.getElementById("f_target").selectedIndex = 0;
+
+ var param = window.dialogArguments;
+ var target_select = document.getElementById("f_target");
+ var use_target = true;
+
+ if (param) {
+ if ( typeof param["f_usetarget"] != "undefined" ) {
+ use_target = param["f_usetarget"];
+ }
+ if ( typeof param["f_href"] != "undefined" ) {
+ document.getElementById("f_href").value = param["f_href"];
+ document.getElementById("f_title").value = param["f_title"];
+ document.getElementById("f_tooltip").value =
param["f_tooltip"];
+ document.getElementById("f_destination").value =
param["f_destination"];
+ comboSelectValue(target_select, param["f_target"]);
+
+ if (target_select.value != param.f_target) {
+ var opt = document.createElement("option");
+ opt.value = param.f_target;
+ opt.innerHTML = opt.value;
+ target_select.appendChild(opt);
+ opt.selected = true;
+ }
+ }
+ }
+ if (! use_target) {
+ document.getElementById("f_target_label").style.visibility =
"hidden";
+ document.getElementById("f_target").style.visibility = "hidden";
+ document.getElementById("f_target_other").style.visibility =
"hidden";
+ }
+ var opt = document.createElement("option");
+ opt.value = "_other";
+ opt.innerHTML = i18n("Other");
+ target_select.appendChild(opt);
+ target_select.onchange = onTargetChanged;
+ document.getElementById("f_href").focus();
+ document.getElementById("f_href").select();
+}
+
+function onOK() {
+ var elhref = document.getElementById("f_href");
+ var re = new RegExp("\://|javascript\:|mailto\:");
+ var destination = document.getElementById("f_destination");
+ if(!elhref.value.match(re) && !destination.value ){
+ if (!elhref.value.match(re)) {
+ var message = i18n("URL is missing protocol (eg http://)");
+ alert(message);
+ elhref.focus();
+ return false;
+ }
+ if(!destination.value) {
+ var message = i18n("You must select an item");
+ alert(message);
+ return false;
+ }
+ }
+ var tmpLinkName = document.getElementById("f_title");
+ if(!tmpLinkName.value){
+ // set the defult linkname the same as href's value
+ tmpLinkName.value = elhref.value;
+ }
+ // pass data back to the calling window
+ var fields = ["f_href", "f_title", "f_tooltip", "f_target",
"f_destination" ];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ if (param.f_target == "_other"){
+ param.f_target = document.getElementById("f_other_target").value;
+ }
+ __dlg_close(param);
+ return false;
+}
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+};
+
+function onElement() {
+
openPopupWindow('../../../../../../editors/repository/select/index.jsp','filterwindow2',950,550);
+ return false;
+};
+
+function onPage() {
+
openPopupWindow('../../../../../../editors/site/select/SelectorPage.do','filterwindow2',340,
400);
+ return false;
+};
+
+
+function onAsset() {
+
openPopupWindow('../../../../../../editors/repository/HighFrequencyAsset.do?action=often&offset=0&channelid=current&assettypes=attachments','filterwindow2',750,600);
+ return false;
+};
+
+function onUrl() {
+
openPopupWindow('../../../../../../editors/repository/HighFrequencyAsset.do?action=often&offset=0&channelid=current&assettypes=urls','filterwindow2',750,600);
+ return false;
+};
+
+function onNewUrl() {
+ var elhref = document.getElementById("f_href");
+ if (Xinha.is_ie) {
+ elhref.readOnly = false;
+ }
+ else {
+ elhref.removeAttribute("readonly");
+ }
+ elhref.value = "http://";
+ elhref.focus();
+ document.getElementById("f_destination").value = '';
+ return false;
+};
+
+function selectElement(element_id, title, url) {
+ document.getElementById("f_destination").value = element_id;
+ var elhref = document.getElementById("f_href");
+
+ if (Xinha.is_ie) {
+ elhref.readOnly = true;
+ }
+ else {
+ elhref.setAttribute("readonly", "true");
+ }
+
+ if (url != undefined && url.length != 0 ) {
+ document.getElementById("f_href").value = url;
+ }
+ sourceTitle = document.getElementById("f_title").value;
+ if(sourceTitle == undefined || sourceTitle.length == 0 ){
+ if(title != undefined && title.length != 0 ) {
+ document.getElementById("f_title").value = title;
+ }
+ }
+}
+
+function selectPage(element_id, url) {
+ document.getElementById("f_destination").value = element_id;
+ var elhref = document.getElementById("f_href");
+
+ if (Xinha.is_ie) {
+ elhref.readOnly = true;
+ }
+ else {
+ elhref.setAttribute("readonly", "true");
+ }
+
+ if (url != undefined && url.length != 0 ) {
+ document.getElementById("f_href").value = url;
+ }
+}
+
+function openPopupWindow(url, windowName, width, height) {
+ debug = false;
+ if (!width) {w = 750;} else { w = width; }
+ if (!height) {h = 750;} else { h = height; }
+ var left = (screen.availWidth - w)/2;
+ var top = (screen.availHeight - h)/2;
+ if (screen.availWidth < w) {
+ w = screen.availWidth;
+ left = 0;
+ }
+ if (screen.availHeight < h) {
+ h = screen.availHeight - 25;
+ top = 0;
+ }
+ if (debug) {
+ alert("width: " + w + " " + left);
+ alert("height: " + h + " " + top);
+ }
+ str = 'window.open(url,"' + windowName + '","width=' + w + ',height=' + h +
',left=' + left + ',top=' + top +
',scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,resizable=yes")';
+
+ if (debug) {
+ alert(str);
+ }
+
+ obj = eval(str);
+ if (document.all) {
+ // set a opener for ie because its a dialog and not a popup (unlike
mozilla)
+ obj.opener = this;
+ }
+
+ return true;
+}
+</script>
+
+</head>
+
+<body class="dialog" onLoad="Init()">
+<div class="title">Insert/Modify Link</div>
+
+<form name="inlineLinkForm" action="#">
+ <input type="hidden" name="destination" id="f_destination" />
+
+<table border="0" style="width: 100%;">
+ <tr>
+ <td class="label">URL:</td>
+ <td><input type="text" id="f_href" style="width: 100%" readonly /></td>
+ </tr>
+ <tr>
+ <td class="label">Title:</td>
+ <td><input type="text" id="f_title" style="width: 100%" /></td>
+ </tr>
+ <tr>
+ <td class="label">Tooltip:</td>
+ <td><input type="text" id="f_tooltip" style="width: 100%" /></td>
+ </tr>
+ <tr>
+ <td class="label"><span id="f_target_label">Target:</span></td>
+ <td><select id="f_target">
+ <option value="">None (use implicit)</option>
+ <option value="_blank">New window (_blank)</option>
+ <option value="_self">Same frame (_self)</option>
+ <option value="_top">Top frame (_top)</option>
+ </select>
+ <input type="text" name="f_other_target" id="f_other_target" size="10"
style="visibility: hidden" />
+ </td>
+ </tr>
+</table>
+ <button name="asset" onClick="return onAsset();" title="Search for an
asset">Attachment</button>
+ <button name="element" onClick="return onElement();" title="Search for
an element">Element</button>
+ <button name="page" onClick="return onPage();" title="Search for a
page">Page</button>
+ <button name="urlelement" onClick="return onUrl();" title="Search for an
URL">URL</button>
+ <button name="newurlelement" onClick="return onNewUrl();" title="Enter
new URL" style="width: 90px;">New URL</button>
+<div id="buttons">
+ <button type="button" name="ok" onClick="return onOK();">OK</button>
+ <button type="button" name="cancel" onClick="return
onCancel();">Cancel</button>
+</div>
+
+</form>
+
+</body>
+</html>
Added:
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/InsertImage/insertinline_image.html
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/InsertImage/insertinline_image.html
(rev 0)
+++
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/modules/InsertImage/insertinline_image.html
2009-06-01 02:48:58 UTC (rev 35534)
@@ -0,0 +1,296 @@
+<html>
+<META http-equiv="Content-Type" content="text/html; charset=utf-8">
+<head>
+ <title>Insert Inline Image</title>
+ <link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
+ <script src="../../popups/popup.js" type="text/javascript"><!--help
IE--></script>
+ <script type="text/javascript">
+ window.resizeTo(450, 100);
+
+Xinha = window.opener.Xinha;
+function i18n(str) {
+ return (Xinha._lc(str, 'cmscrichtext'));
+}
+
+var IMAGE_WIDTH_LEFT = 160;
+var IMAGE_WIDTH_RIGHT = 160;
+var IMAGE_WIDTH_FULL = 450;
+
+function Init() {
+ __dlg_translate('cmscrichtext');
+ __dlg_init();
+ // Make sure the translated string appears in the drop down. (for gecko)
+ document.getElementById("f_align").selectedIndex = 1;
+ document.getElementById("f_align").selectedIndex = 5;
+ var param = window.dialogArguments;
+ if (param) {
+ 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_align").value = param["f_align"];
+ document.getElementById("f_width").value = param["f_width"];
+ document.getElementById("f_height").value = param["f_height"];
+ document.getElementById("f_destination").value = param["f_destination"];
+ //Store the original sizes of image for aspect ratio
+ saveOriginalSizes();
+ }
+ if (document.getElementById("f_width").value == "") {
+ document.getElementById("f_align").value = "left";
+ }
+ if (document.getElementById("f_url").value == "") {
+ document.getElementById("f_width").disabled = true;
+ document.getElementById("f_height").disabled = true;
+ document.getElementById("f_border").disabled = true;
+ document.getElementById("f_align").disabled = true;
+ }
+
+
+ document.getElementById("f_url").focus();
+}
+
+function onOK() {
+ var required = {
+ "f_url": i18n("You must enter the URL")
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var fields = ["f_url", "f_alt", "f_align", "f_border",
+ "f_width", "f_height", "f_destination"];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ __dlg_close(param);
+ return false;
+}
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+}
+
+function onSelect() {
+
openPopupWindow('../../../../../../editors/repository/HighFrequencyAsset.do?action=often&offset=0&channelid=current&assettypes=images','filterwindow2',750,600);
+ return false;
+};
+
+function selectElement(element_id, title, url, width, height, description) {
+ document.getElementById("f_destination").value = element_id;
+
+ if (url != undefined && url.length != 0 ) {
+ document.getElementById("f_url").value = url;
+ document.getElementById("f_width").disabled = false;
+ document.getElementById("f_height").disabled = false;
+ document.getElementById("f_border").disabled = false;
+ document.getElementById("f_align").disabled = false;
+ ratio = "";
+ }
+ if (document.getElementById("f_alt").value == undefined
+ || document.getElementById("f_alt").value.length == 0 ) {
+ document.getElementById("f_alt").value = title;
+ }
+ var imagePosition = document.getElementById("f_align").value
+ if ("left" == imagePosition) {
+ if (width && height) {
+ if (width > IMAGE_WIDTH_LEFT) {
+ height = Math.round((IMAGE_WIDTH_LEFT / width) * height);
+ width = IMAGE_WIDTH_LEFT;
+ }
+ document.getElementById("f_width").value = width;
+ document.getElementById("f_height").value = height;
+ }
+ }
+ if ("right" == imagePosition) {
+ if (width && height) {
+ if (width > IMAGE_WIDTH_RIGHT) {
+ height = Math.round((IMAGE_WIDTH_RIGHT / width) * height);
+ width = IMAGE_WIDTH_RIGHT;
+ }
+ document.getElementById("f_width").value = IMAGE_WIDTH_RIGHT;
+ document.getElementById("f_height").value = width;
+ }
+ }
+ if ("" == imagePosition) {
+ if (width && height) {
+ if (width > IMAGE_WIDTH_FULL) {
+ height = Math.round((IMAGE_WIDTH_FULL / width) * height);
+ width = IMAGE_WIDTH_FULL;
+ }
+ document.getElementById("f_width").value = width;
+ document.getElementById("f_height").value = height;
+ }
+ }
+
+ //Store the original sizes of image for aspect ratio
+ saveOriginalSizes();
+}
+
+function onSelectPosition() {
+ var width = document.getElementById("f_width").value;
+ var height = document.getElementById("f_height").value;
+ var imagePosition = document.getElementById("f_align").value
+ if ("left" == imagePosition) {
+ document.getElementById("f_width").value = IMAGE_WIDTH_LEFT;
+ if (height) {
+ height = (IMAGE_WIDTH_LEFT / width) * height;
+ document.getElementById("f_height").value = height;
+ }
+ }
+ if ("right" == imagePosition) {
+ document.getElementById("f_width").value = IMAGE_WIDTH_RIGHT;
+ if (height) {
+ height = (IMAGE_WIDTH_RIGHT / width) * height;
+ document.getElementById("f_height").value = height;
+ }
+ }
+ if ("" == imagePosition) {
+ document.getElementById("f_width").value = IMAGE_WIDTH_FULL;
+ if (height) {
+ height = (IMAGE_WIDTH_FULL / width) * height;
+ document.getElementById("f_height").value = height;
+ }
+ }
+}
+
+function openPopupWindow(url, windowName, width, height) {
+ debug = false;
+ if (!width) {w = 750;} else { w = width; }
+ if (!height) {h = 750;} else { h = height; }
+ var left = (screen.availWidth - w)/2;
+ var top = (screen.availHeight - h)/2;
+ if (screen.availWidth < w) {
+ w = screen.availWidth;
+ left = 0;
+ }
+ if (screen.availHeight < h) {
+ h = screen.availHeight - 25;
+ top = 0;
+ }
+ if (debug) {
+ alert("width: " + w + " " + left);
+ alert("height: " + h + " " + top);
+ }
+ str = 'window.open(url,"' + windowName + '","width=' + w + ',height=' + h +
',left=' + left + ',top=' + top +
',scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,resizable=yes")';
+
+ if (debug) {
+ alert(str);
+ }
+
+ obj = eval(str);
+ if (document.all) {
+ // set a opener for ie because its a dialog and not a popup (unlike
mozilla)
+ obj.opener = this;
+ }
+
+ return true;
+}
+
+</script>
+
+
+
+<script type="text/javascript">
+ var width_orig = 1;
+ var height_orig = 1;
+
+ function saveOriginalSizes() {
+ width_orig = document.getElementById("f_width").value;
+ height_orig = document.getElementById("f_height").value;
+}
+
+ function calculateWidth() {
+ if ( document.getElementById("f_lock_ratio").checked ) {
+ var height = document.getElementById("f_height").value;
+ if (!isNaN(height) && height > 0) {
+ document.getElementById("f_width").value = Math.round
((width_orig / height_orig) * height);
+ }
+ }
+ }
+
+ function calculateHeight() {
+ if ( document.getElementById("f_lock_ratio").checked ) {
+ var width = document.getElementById("f_width").value;
+ if (!isNaN(width) && width > 0) {
+ document.getElementById("f_height").value = Math.round
((height_orig / width_orig) * width);
+ }
+ }
+ }
+</script>
+
+</head>
+
+<body class="dialog" onload="Init()">
+ <div class="title">Insert Image</div>
+ <form name="inlineImageForm" action="" method="get">
+ <input type="hidden" name="destination" id="f_destination" />
+ <table border="0" width="100%" style="padding: 0px; margin: 0px">
+ <tbody>
+ <tr>
+ <td style="width: 7em; text-align: right">Image URL:</td>
+ <td>
+ <input type="text" name="url" id="f_url"
style="width:75%" readonly />
+ <button name="select" onclick="return onSelect();"
title="Search for an image">Search</button>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 7em; text-align: right">Alternate
text:</td>
+ <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>Layout</legend>
+ <div class="space"></div>
+
+ <div class="fl">Alignment:</div>
+ <select size="1" name="align" id="f_align" title="Positioning
of this image" onchange="onSelectPosition()">
+ <option value="">Not set</option>
+ <option value="left">Left</option>
+ <option value="right">Right</option>
+ <option value="texttop">Text top</option>
+ <option value="absmiddle">Abs middle</option>
+ <option value="baseline">Baseline</option>
+ <option value="absbottom">Abs bottom</option>
+ <option value="bottom">Bottom</option>
+ <option value="middle">Middle</option>
+ <option value="top">Top</option>
+ </select>
+ <p />
+ <div class="fl">Border thickness:</div>
+ <input type="text" name="border" id="f_border" size="5"
title="Leave empty for no border" />
+ <div class="space"></div>
+ </fieldset>
+
+ <fieldset style="float:right; margin-right: 5px;">
+ <legend>Size</legend>
+ <div class="fr">Width:</div>
+ <input type="text" name="width" id="f_width" size="5"
title="Width" onblur="calculateHeight();" />
+ <p />
+ <div class="fr">Height:</div>
+ <input type="text" name="height" id="f_height" size="5"
title="Height" onblur="calculateWidth();" />
+ <p />
+ <div class="fr">Lock ratio:</div>
+ <input type="checkbox" name="lock_ratio" id="f_lock_ratio"
title="Lock aspect ratio" checked="checked" />
+ <div class="space"></div>
+ </fieldset>
+ <div class="space"></div>
+ <div style="margin-top: 85px; text-align: right;">
+ <hr />
+ <button type="button" name="ok" onclick="return
onOK();">OK</button>
+ <button type="button" name="cancel" onclick="return
onCancel();">Cancel</button>
+ </div>
+ </form>
+ </body>
+</html>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs