Ticket #216 (closed defect: fixed)
InsertAnchor as dialog looks better and is consistent!
| Reported by: | gocher / udo.schmal@… | Owned by: | niko |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | |
| Severity: | normal | Keywords: | InsertAnchor |
| Cc: |
Description
insert-anchor.js changes:
InsertAnchor.prototype.buttonPress = function(editor) {
var outparam = null;
editor._popupDialog( "plugin://InsertAnchor/insert_anchor", function( param ) {
if ( param ) {
var anchor = param["name"];
if (anchor == "" || anchor == null) {
return;
}
try {
var doc = editor._doc;
var alink = doc.createElement("a");
alink.id = anchor;
alink.name = anchor;
alink.title = anchor;
alink.className = "anchor";
if (HTMLArea.is_ie) {
var sel = editor._getSelection();
var range = editor._createRange(sel);
range.pasteHTML(alink.outerHTML);
} else {
editor.insertNodeAtSelection(alink);
}
}
catch (e) { }
}
}, outparam);
}
New insert_anchor.html popup:
<html>
<head>
<title>Insert Anchor</title>
<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
<script type="text/javascript" src="../../../popups/popup.js"></script>
<script type="text/javascript">
window.resizeTo(300, 150);
function Init() {
__dlg_translate("InsertAnchor");
__dlg_init();
window.resizeTo(400, 180);
var param = window.dialogArguments;
if (param) {
document.getElementById("name").value = param["name"];
}
document.getElementById("name").focus();
};
function onOK() {
// pass data back to the calling window
var param = new Object();
param["name"] = document.getElementById("name").value;
__dlg_close(param);
return false;
};
function onCancel() {
__dlg_close(null);
return false;
};
</script>
</head>
<body onload="Init()">
<div class="title">Insert Anchor</div>
<form>
<table border="0" style="width: 100%;">
<tr>
<td class="label">Anchor name</td>
<td><input type="text" id="name" style="width: 100%" /></td>
</tr>
</table>
<div id="buttons">
<button type="submit" name="ok" onclick="return onOK();">OK</button>
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
</div>
</form>
</body>
</html>
I use a global CSS because it is easyer to change the outfit of all popups (look Ticket #147)! But if you want you can put the stylesheet lokal.
/*<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />*/
html, body {
background: ButtonFace;
color: ButtonText;
font: 11px Tahoma,Verdana,sans-serif;
margin: 0px;
padding: 0px;
}
body { padding: 5px; }
form { padding: 0px; margin: 0px; }
form p {
margin-top: 5px;
margin-bottom: 5px;
}
table {
font: 11px Tahoma,Verdana,sans-serif;
}
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
table .label { text-align: right; width: 8em; }
.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
fieldset { padding: 0px 10px 5px 5px; }
.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;
}
#buttons {
margin-top: 1em; border-top: 1px solid #999;
padding: 2px; text-align: right;
}
language file de.js:
// I18N constants
// LANG: "de", ENCODING: UTF-8
// translated: Raimund Meyer xinha@ray-of-light.org
{
"Insert Anchor": "Anker einfügen",
"Anchor name": "Name (ID)",
"OK": "OK",
"Cancel": "Abbrechen"
}
language file fr.js:
// I18N constants
// LANG: "fr", ENCODING: UTF-8
// Author: Laurent Vilday, mokhet@mokhet.com
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
{
"Insert Anchor": "Insérer ancre",
"Anchor name": "Nom de l'ancre",
"OK": "OK",
"Cancel": "Annuler"
}
Change History
Note: See
TracTickets for help on using
tickets.
