You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/03/25 02:52:59 UTC

svn commit: r758123 - in /labs/magma/branches/0.0.1: website-dojo-pack/src/main/resources/dojo-1.2.0/ website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/ website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/ website-dojo-pack/src/main/resou...

Author: simoneg
Date: Wed Mar 25 01:52:58 2009
New Revision: 758123

URL: http://svn.apache.org/viewvc?rev=758123&view=rev
Log:
LABS-324 : Dojo editor plugin to handle image floating, border and margin

Added:
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/ImageFormatDialog.js
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/LinkOnlyDialog.js
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/ImageFormatDialog.js
    labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/LinkOnlyDialog.js
Modified:
    labs/magma/branches/0.0.1/website-dojo-textareas/src/main/java/org/apache/magma/dojo/InterceptTextareaFields.aj
    labs/magma/branches/0.0.1/website-dojo-textareas/src/main/resources/org/apache/magma/website/dojo/textareaField.js

Added: labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/ImageFormatDialog.js
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/ImageFormatDialog.js?rev=758123&view=auto
==============================================================================
--- labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/ImageFormatDialog.js (added)
+++ labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/ImageFormatDialog.js Wed Mar 25 01:52:58 2009
@@ -0,0 +1 @@
+({"set":"Set","text":"Description:","insertImageTitle":"Image Properties","url":"URL:", "position":"Positioning", "margin":"Margin", "border":"Border"})
\ No newline at end of file

Added: labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/LinkOnlyDialog.js
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/LinkOnlyDialog.js?rev=758123&view=auto
==============================================================================
--- labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/LinkOnlyDialog.js (added)
+++ labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/nls/LinkOnlyDialog.js Wed Mar 25 01:52:58 2009
@@ -0,0 +1 @@
+({"set":"Set","text":"Description:","createLinkTitle":"Link Properties","url":"URL:"})
\ No newline at end of file

Added: labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/ImageFormatDialog.js
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/ImageFormatDialog.js?rev=758123&view=auto
==============================================================================
--- labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/ImageFormatDialog.js (added)
+++ labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/ImageFormatDialog.js Wed Mar 25 01:52:58 2009
@@ -0,0 +1,178 @@
+/*
+	Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dijit._editor.plugins.ImageFormatDialog"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit._editor.plugins.ImageFormatDialog"] = true;
+dojo.provide("dijit._editor.plugins.ImageFormatDialog");
+
+dojo.require("dijit._Widget");
+dojo.require("dijit._Templated");
+dojo.require("dijit._editor._Plugin");
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.form.ValidationTextBox");
+dojo.require("dijit.form.FilteringSelect");
+dojo.require("dojo.i18n");
+dojo.require("dojo.string");
+dojo.requireLocalization("dijit._editor", "ImageFormatDialog", null, "zh,ca,pt,da,tr,ru,de,sv,ja,he,fi,nb,el,ar,pt-pt,cs,fr,es,ko,nl,zh-tw,pl,th,it,hu,sk,sl,ROOT");
+
+dojo.declare("dijit._editor.plugins.ImageFormatDialog",
+	dijit._editor._Plugin,
+	{
+		//	summary:
+		//		This plugin provides dialogs for inserting and formatting images
+	    //      better than the default dojo dialog
+		//
+		//	description:
+		//		The commands provided by this plugin are:
+		//		* insertImage
+
+		borderRex : /border:[^;]*(\d+)px/,
+		marginRex : /margin:[^;]*(\d+)px/,
+		positionRex : /((float:[^;]*)|(vertical-align:[^;]*))/,
+		buttonClass: dijit.form.DropDownButton,
+		useDefaultCommand: false,
+		urlRegExp: "((https?|ftps?)\\://|)(([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\\.)+(arpa|aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|eu|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])|(0[
 xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]|(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]|(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])|0[xX]0*[\\da-fA-F]{1,8}|([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}|([\\da-fA-F]{1,4}\\:){6}((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])))(\\:(0|[1-9]\\d*))?(/([^?#\\s/]+/)*)?([^?#\\s/]+(\\?[^?#\\s/]*)?(#[A-Za-z][\\w.:-]*)?)?",
+		linkDialogTemplate: [
+			"<table><tr><td>",
+			"<label for='${id}_urlInput'>${url}</label>",
+			"</td><td>",
+			"<input dojoType='dijit.form.ValidationTextBox' regExp='${urlRegExp}' required='true' id='${id}_urlInput' name='urlInput'>",
+			"</td></tr><tr><td>",
+			"<label for='${id}_textInput'>${text}</label>",
+			"</td><td>",
+			"<input dojoType='dijit.form.ValidationTextBox' required='true' id='${id}_textInput' name='textInput'>",
+			"</td></tr><tr><td>",
+			"<label for='${id}_positionInput'>${position}</label>",
+			"</td><td>",
+			"<select dojoType='dijit.form.FilteringSelect' id='${id}_positionInput' name='positionInput'>",
+			"<option value='float: left'>Left</option>",
+			"<option value=''>Normal</option>",
+			"<option value='float: right'>Right</option>",
+			"<option value='vertical-align: middle'>Middle</option>",
+			"</select>",
+			"</td></tr><tr><td>",
+			"<label for='${id}_marginInput'>${margin}</label>",
+			"</td><td>",
+			//  dojoType='dijit.form.NumberSpinner' smallDelta='1' constraints='{min:1, max:50,places:0}' 
+			"<input dojoType='dijit.form.ValidationTextBox' id='${id}_marginInput' name='marginInput'>",
+			"</td></tr><tr><td>",
+			"<label for='${id}_borderInput'>${border}</label>",
+			"</td><td>",
+			"<input dojoType='dijit.form.ValidationTextBox' id='${id}_borderInput' name='borderInput'>",
+			"</td></tr><tr><td colspan='2'>",
+			"<button dojoType='dijit.form.Button' type='submit'>${set}</button>",
+			"</td></tr></table>"
+		].join(""),
+
+		_initButton: function(){
+			var _this = this;
+			this.tag = 'img';
+			var messages = dojo.i18n.getLocalization("dijit._editor", "ImageFormatDialog", this.lang);
+			var dropDown = (this.dropDown = new dijit.TooltipDialog({
+				title: messages[this.command + "Title"],
+				execute: dojo.hitch(this, "setValue"),
+				onOpen: function(){
+					_this._onOpenDialog();
+					dijit.TooltipDialog.prototype.onOpen.apply(this, arguments);
+				},
+				onCancel: function(){
+					setTimeout(dojo.hitch(_this, "_onCloseDialog"),0);
+				},
+				onClose: dojo.hitch(this, "_onCloseDialog")
+			}));
+			messages.urlRegExp = this.urlRegExp;
+			messages.id = dijit.getUniqueId(this.editor.id);
+			this._setContent(dropDown.title + "<div style='border-bottom: 1px black solid;padding-bottom:2pt;margin-bottom:4pt'></div>" + dojo.string.substitute(this.linkDialogTemplate, messages));
+			dropDown.startup();
+
+			this.inherited(arguments);
+		},
+
+		_setContent: function(staticPanel){
+			this.dropDown.attr('content', staticPanel);
+		},
+
+		setValue: function(args){
+			// summary: callback from the dialog when user hits "set" button
+			//TODO: prevent closing popup if the text is empty
+			this._onCloseDialog();
+			if(dojo.isIE){ //see #4151
+				var a = dojo.withGlobal(this.editor.window, "getAncestorElement", dijit._editor.selection, [this.tag]);
+				if(a){
+					dojo.withGlobal(this.editor.window, "selectElement", dijit._editor.selection, [a]);
+				}
+			}
+			args.tag = this.tag;
+			args.refAttr = 'src';
+			//TODO: textInput should be formatted by escapeXml
+			var template = "<${tag} ${refAttr}='${urlInput}' _djrealurl='${urlInput}'" +
+				"alt='${textInput}' style='margin: ${marginInput}px; border: ${borderInput}px solid black; ${positionInput}'>" +
+				"</${tag}>";
+			this.editor.execCommand('inserthtml', dojo.string.substitute(template, args));
+ 		},
+
+		_onCloseDialog: function(){
+			this.editor.focus();
+		},
+
+		_onOpenDialog: function(){
+			var a = dojo.withGlobal(this.editor.window, "getAncestorElement", dijit._editor.selection, [this.tag]);
+			var url, text, position, border, margin;
+			border = 0;
+			margin = 0;
+			position = '';
+			if(a){
+				url = a.getAttribute('_djrealurl');
+				text = a.getAttribute('alt');
+				var style = a.getAttribute('style');
+				var match = null;
+				if (match = style.match(this.borderRex)) {
+					border = match[1];
+				}
+				if (match = style.match(this.marginRex)) {
+					margin = match[1];
+				}
+				if (match = style.match(this.positionRex)) {
+					position = match[0];
+				}
+				
+				dojo.withGlobal(this.editor.window, "selectElement", dijit._editor.selection, [a, true]);
+			}else{
+				text = dojo.withGlobal(this.editor.window, dijit._editor.selection.getSelectedText);
+			}
+
+			this.dropDown.reset();
+			this.dropDown.setValues({urlInput: url || '', textInput: text || '', borderInput: border, marginInput: margin, positionInput: position});
+			//dijit.focus(this.urlInput);
+		}/*,
+
+//TODO we don't show this state anymore
+		updateState: function(){
+			// summary: change shading on button if we are over a link (or not)
+
+			var _e = this.editor;
+			if(!_e || !_e.isLoaded){ return; }
+			if(this.button){
+				// display button differently if there is an existing link associated with the current selection
+				var hasA = dojo.withGlobal(this.editor.window, "hasAncestorElement", dijit._editor.selection, [this.tag]);
+				this.button.attr('checked', hasA);
+			}
+		}
+*/
+	}
+);
+
+dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){
+	if(o.plugin){ return; }
+	switch(o.args.name){
+	case "insertFormatImage":
+		o.plugin = new dijit._editor.plugins.ImageFormatDialog({command: "insertImage"});
+	}
+});
+
+}

Added: labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/LinkOnlyDialog.js
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/LinkOnlyDialog.js?rev=758123&view=auto
==============================================================================
--- labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/LinkOnlyDialog.js (added)
+++ labs/magma/branches/0.0.1/website-dojo-pack/src/main/resources/dojo-1.2.0/dijit/_editor/plugins/LinkOnlyDialog.js Wed Mar 25 01:52:58 2009
@@ -0,0 +1,141 @@
+/*
+	Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dijit._editor.plugins.LinkOnlyDialog"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit._editor.plugins.LinkOnlyDialog"] = true;
+dojo.provide("dijit._editor.plugins.LinkOnlyDialog");
+
+dojo.require("dijit._Widget");
+dojo.require("dijit._Templated");
+dojo.require("dijit._editor._Plugin");
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.form.ValidationTextBox");
+dojo.require("dojo.i18n");
+dojo.require("dojo.string");
+dojo.requireLocalization("dijit._editor", "LinkOnlyDialog", null, "zh,ca,pt,da,tr,ru,de,sv,ja,he,fi,nb,el,ar,pt-pt,cs,fr,es,ko,nl,zh-tw,pl,th,it,hu,sk,sl,ROOT");
+
+dojo.declare("dijit._editor.plugins.LinkOnlyDialog",
+	dijit._editor._Plugin,
+	{
+		//	summary:
+		//		This plugin provides dialogs for inserting links only, so that images
+	    //      can be handled more specifically
+		//
+		//	description:
+		//		The commands provided by this plugin are:
+		//		* createLink
+
+		buttonClass: dijit.form.DropDownButton,
+		useDefaultCommand: false,
+		urlRegExp: "((https?|ftps?)\\://|)(([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\\.)+(arpa|aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|eu|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])|(0[
 xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]|(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]|(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])|0[xX]0*[\\da-fA-F]{1,8}|([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}|([\\da-fA-F]{1,4}\\:){6}((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])))(\\:(0|[1-9]\\d*))?(/([^?#\\s/]+/)*)?([^?#\\s/]+(\\?[^?#\\s/]*)?(#[A-Za-z][\\w.:-]*)?)?",
+		linkDialogTemplate: [
+			"<table><tr><td>",
+			"<label for='${id}_urlInput'>${url}</label>",
+			"</td><td>",
+			"<input dojoType='dijit.form.ValidationTextBox' regExp='${urlRegExp}' required='true' id='${id}_urlInput' name='urlInput'>",
+			"</td></tr><tr><td>",
+			"<label for='${id}_textInput'>${text}</label>",
+			"</td><td>",
+			"<input dojoType='dijit.form.ValidationTextBox' required='true' id='${id}_textInput' name='textInput'>",
+			"</td></tr><tr><td colspan='2'>",
+			"<button dojoType='dijit.form.Button' type='submit'>${set}</button>",
+			"</td></tr></table>"
+		].join(""),
+
+		_initButton: function(){
+			var _this = this;
+			this.tag = 'a';
+			var messages = dojo.i18n.getLocalization("dijit._editor", "LinkOnlyDialog", this.lang);
+			var dropDown = (this.dropDown = new dijit.TooltipDialog({
+				title: messages[this.command + "Title"],
+				execute: dojo.hitch(this, "setValue"),
+				onOpen: function(){
+					_this._onOpenDialog();
+					dijit.TooltipDialog.prototype.onOpen.apply(this, arguments);
+				},
+				onCancel: function(){
+					setTimeout(dojo.hitch(_this, "_onCloseDialog"),0);
+				},
+				onClose: dojo.hitch(this, "_onCloseDialog")
+			}));
+			messages.urlRegExp = this.urlRegExp;
+			messages.id = dijit.getUniqueId(this.editor.id);
+			this._setContent(dropDown.title + "<div style='border-bottom: 1px black solid;padding-bottom:2pt;margin-bottom:4pt'></div>" + dojo.string.substitute(this.linkDialogTemplate, messages));
+			dropDown.startup();
+
+			this.inherited(arguments);
+		},
+
+		_setContent: function(staticPanel){
+			this.dropDown.attr('content', staticPanel);
+		},
+
+		setValue: function(args){
+			// summary: callback from the dialog when user hits "set" button
+			//TODO: prevent closing popup if the text is empty
+			this._onCloseDialog();
+			if(dojo.isIE){ //see #4151
+				var a = dojo.withGlobal(this.editor.window, "getAncestorElement", dijit._editor.selection, [this.tag]);
+				if(a){
+					dojo.withGlobal(this.editor.window, "selectElement", dijit._editor.selection, [a]);
+				}
+			}
+			args.tag = this.tag;
+			args.refAttr = 'href';
+			//TODO: textInput should be formatted by escapeXml
+			var template = "<${tag} ${refAttr}='${urlInput}' _djrealurl='${urlInput}'" +
+				">${textInput}" +
+				"</${tag}>";
+			this.editor.execCommand('inserthtml', dojo.string.substitute(template, args));
+ 		},
+
+		_onCloseDialog: function(){
+			this.editor.focus();
+		},
+
+		_onOpenDialog: function(){
+			var a = dojo.withGlobal(this.editor.window, "getAncestorElement", dijit._editor.selection, [this.tag]);
+			var url, text;
+			if(a){
+				url = a.getAttribute('_djrealurl');
+				text = a.textContent || a.innerText;
+				dojo.withGlobal(this.editor.window, "selectElement", dijit._editor.selection, [a, true]);
+			}else{
+				text = dojo.withGlobal(this.editor.window, dijit._editor.selection.getSelectedText);
+			}
+
+			this.dropDown.reset();
+			this.dropDown.setValues({urlInput: url || '', textInput: text || ''});
+			//dijit.focus(this.urlInput);
+		}/*,
+
+//TODO we don't show this state anymore
+		updateState: function(){
+			// summary: change shading on button if we are over a link (or not)
+
+			var _e = this.editor;
+			if(!_e || !_e.isLoaded){ return; }
+			if(this.button){
+				// display button differently if there is an existing link associated with the current selection
+				var hasA = dojo.withGlobal(this.editor.window, "hasAncestorElement", dijit._editor.selection, [this.tag]);
+				this.button.attr('checked', hasA);
+			}
+		}
+*/
+	}
+);
+
+dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){
+	if(o.plugin){ return; }
+	switch(o.args.name){
+	case "createOnlyLink":
+		o.plugin = new dijit._editor.plugins.LinkOnlyDialog({command: "createLink"});
+	}
+});
+
+}

Modified: labs/magma/branches/0.0.1/website-dojo-textareas/src/main/java/org/apache/magma/dojo/InterceptTextareaFields.aj
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.1/website-dojo-textareas/src/main/java/org/apache/magma/dojo/InterceptTextareaFields.aj?rev=758123&r1=758122&r2=758123&view=diff
==============================================================================
--- labs/magma/branches/0.0.1/website-dojo-textareas/src/main/java/org/apache/magma/dojo/InterceptTextareaFields.aj (original)
+++ labs/magma/branches/0.0.1/website-dojo-textareas/src/main/java/org/apache/magma/dojo/InterceptTextareaFields.aj Wed Mar 25 01:52:58 2009
@@ -95,10 +95,10 @@
 							writer.append(",'|','insertOrderedList','insertUnorderedList'");
 						}
 						if (rcv.isPermitLinks()) {
-							writer.append(",'|','createLink', 'unlink'");
+							writer.append(",'|','createOnlyLink', 'unlink'");
 						}
 						if (rcv.isPermitImages()) {
-							writer.append(",'|','insertImage'");
+							writer.append(",'|','insertFormatImage'");
 						}
 						if (rcv.isPermitTables()) {
 							writer.append(",'|',{name: 'dojox.editor.plugins.TablePlugins', command: 'insertTable'}, {name: 'dojox.editor.plugins.TablePlugins', command: 'colorTableCell'}, {name: 'dojox.editor.plugins.TablePlugins', command: 'tableContextMenu'}");

Modified: labs/magma/branches/0.0.1/website-dojo-textareas/src/main/resources/org/apache/magma/website/dojo/textareaField.js
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.1/website-dojo-textareas/src/main/resources/org/apache/magma/website/dojo/textareaField.js?rev=758123&r1=758122&r2=758123&view=diff
==============================================================================
--- labs/magma/branches/0.0.1/website-dojo-textareas/src/main/resources/org/apache/magma/website/dojo/textareaField.js (original)
+++ labs/magma/branches/0.0.1/website-dojo-textareas/src/main/resources/org/apache/magma/website/dojo/textareaField.js Wed Mar 25 01:52:58 2009
@@ -1,6 +1,7 @@
 dojo.require("dijit.form.Textarea");
 dojo.require("dijit.Editor");
-dojo.require("dijit._editor.plugins.LinkDialog");
+dojo.require("dijit._editor.plugins.LinkOnlyDialog");
+dojo.require("dijit._editor.plugins.ImageFormatDialog");
 dojo.require("dijit._editor.plugins.TextColor");
 dojo.require("dojox.editor.plugins.TablePlugins");
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org