Added svn:eol-style native property for various files

git-svn-id: http://redmine.rubyforge.org/svn/trunk@419 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-04-04 18:20:45 +00:00
parent 8e11dac375
commit f7d5141251
14 changed files with 2548 additions and 2548 deletions
+32 -32
View File
@@ -1,33 +1,33 @@
function checkAll (id, checked) {
var el = document.getElementById(id);
for (var i = 0; i < el.elements.length; i++) {
if (el.elements[i].disabled==false) {
el.elements[i].checked = checked;
}
}
}
function addFileField() {
var f = document.createElement("input");
f.type = "file";
f.name = "attachments[]";
f.size = 30;
p = document.getElementById("attachments_p");
p.appendChild(document.createElement("br"));
p.appendChild(f);
}
function showTab(name) {
var f = $$('div#content .tab-content');
for(var i=0; i<f.length; i++){
Element.hide(f[i]);
}
var f = $$('div.tabs a');
for(var i=0; i<f.length; i++){
Element.removeClassName(f[i], "selected");
}
Element.show('tab-content-' + name);
Element.addClassName('tab-' + name, "selected");
return false;
function checkAll (id, checked) {
var el = document.getElementById(id);
for (var i = 0; i < el.elements.length; i++) {
if (el.elements[i].disabled==false) {
el.elements[i].checked = checked;
}
}
}
function addFileField() {
var f = document.createElement("input");
f.type = "file";
f.name = "attachments[]";
f.size = 30;
p = document.getElementById("attachments_p");
p.appendChild(document.createElement("br"));
p.appendChild(f);
}
function showTab(name) {
var f = $$('div#content .tab-content');
for(var i=0; i<f.length; i++){
Element.hide(f[i]);
}
var f = $$('div.tabs a');
for(var i=0; i<f.length; i++){
Element.removeClassName(f[i], "selected");
}
Element.show('tab-content-' + name);
Element.addClassName('tab-' + name, "selected");
return false;
}
@@ -31,10 +31,10 @@ Calendar._DN = new Array
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 1;
Calendar._FD = 1;
// short day names
Calendar._SDN = new Array
@@ -44,10 +44,10 @@ Calendar._SDN = new Array
"Ven",
"Sam",
"Dim");
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 1;
Calendar._FD = 1;
// full month names
Calendar._MN = new Array
+127 -127
View File
@@ -1,127 +1,127 @@
// ** I18N
// Calendar EN language
// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
// Encoding: any
// Distributed under the same terms as the calendar itself.
// For translators: please use UTF-8 if possible. We strongly believe that
// Unicode is the answer to a real internationalized world. Also please
// include your contact information in the header, as can be seen above.
// full day names
Calendar._DN = new Array
("Domenica",
"Lunedì",
"Martedì",
"Mercoledì",
"Giovedì",
"Venerdì",
"Sabato",
"Domenica");
// Please note that the following array of short day names (and the same goes
// for short month names, _SMN) isn't absolutely necessary. We give it here
// for exemplification on how one can customize the short day names, but if
// they are simply the first N letters of the full name you can simply say:
//
// Calendar._SDN_len = N; // short day name length
// Calendar._SMN_len = N; // short month name length
//
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.
// short day names
Calendar._SDN = new Array
("Dom",
"Lun",
"Mar",
"Mer",
"Gio",
"Ven",
"Sab",
"Dom");
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 1;
// full month names
Calendar._MN = new Array
("Gennaio",
"Febbraio",
"Marzo",
"Aprile",
"Maggio",
"Giugno",
"Luglio",
"Agosto",
"Settembre",
"Ottobre",
"Novembre",
"Dicembre");
// short month names
Calendar._SMN = new Array
("Gen",
"Feb",
"Mar",
"Apr",
"Mag",
"Giu",
"Lug",
"Ago",
"Set",
"Ott",
"Nov",
"Dic");
// tooltips
Calendar._TT = {};
Calendar._TT["INFO"] = "Informazioni sul calendario";
Calendar._TT["ABOUT"] =
"DHTML Date/Time Selector\n" +
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"Date selection:\n" +
"- Use the \xab, \xbb buttons to select year\n" +
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"] = "Anno prec. (tieni premuto per menu)";
Calendar._TT["PREV_MONTH"] = "Mese prec. (tieni premuto per menu)";
Calendar._TT["GO_TODAY"] = "Oggi";
Calendar._TT["NEXT_MONTH"] = "Mese succ. (tieni premuto per menu)";
Calendar._TT["NEXT_YEAR"] = "Anno succ. (tieni premuto per menu)";
Calendar._TT["SEL_DATE"] = "Seleziona data";
Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostare";
Calendar._TT["PART_TODAY"] = " (oggi)";
// the following is to inform that "%s" is to be the first day of week
// %s will be replaced with the day name.
Calendar._TT["DAY_FIRST"] = "Mostra %s per primo";
// This may be locale-dependent. It specifies the week-end days, as an array
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "0,6";
Calendar._TT["CLOSE"] = "Chiudi";
Calendar._TT["TODAY"] = "Oggi";
Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per modificare";
// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
Calendar._TT["WK"] = "sett";
Calendar._TT["TIME"] = "Ora:";
// ** I18N
// Calendar EN language
// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
// Encoding: any
// Distributed under the same terms as the calendar itself.
// For translators: please use UTF-8 if possible. We strongly believe that
// Unicode is the answer to a real internationalized world. Also please
// include your contact information in the header, as can be seen above.
// full day names
Calendar._DN = new Array
("Domenica",
"Lunedì",
"Martedì",
"Mercoledì",
"Giovedì",
"Venerdì",
"Sabato",
"Domenica");
// Please note that the following array of short day names (and the same goes
// for short month names, _SMN) isn't absolutely necessary. We give it here
// for exemplification on how one can customize the short day names, but if
// they are simply the first N letters of the full name you can simply say:
//
// Calendar._SDN_len = N; // short day name length
// Calendar._SMN_len = N; // short month name length
//
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.
// short day names
Calendar._SDN = new Array
("Dom",
"Lun",
"Mar",
"Mer",
"Gio",
"Ven",
"Sab",
"Dom");
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 1;
// full month names
Calendar._MN = new Array
("Gennaio",
"Febbraio",
"Marzo",
"Aprile",
"Maggio",
"Giugno",
"Luglio",
"Agosto",
"Settembre",
"Ottobre",
"Novembre",
"Dicembre");
// short month names
Calendar._SMN = new Array
("Gen",
"Feb",
"Mar",
"Apr",
"Mag",
"Giu",
"Lug",
"Ago",
"Set",
"Ott",
"Nov",
"Dic");
// tooltips
Calendar._TT = {};
Calendar._TT["INFO"] = "Informazioni sul calendario";
Calendar._TT["ABOUT"] =
"DHTML Date/Time Selector\n" +
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"Date selection:\n" +
"- Use the \xab, \xbb buttons to select year\n" +
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"] = "Anno prec. (tieni premuto per menu)";
Calendar._TT["PREV_MONTH"] = "Mese prec. (tieni premuto per menu)";
Calendar._TT["GO_TODAY"] = "Oggi";
Calendar._TT["NEXT_MONTH"] = "Mese succ. (tieni premuto per menu)";
Calendar._TT["NEXT_YEAR"] = "Anno succ. (tieni premuto per menu)";
Calendar._TT["SEL_DATE"] = "Seleziona data";
Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostare";
Calendar._TT["PART_TODAY"] = " (oggi)";
// the following is to inform that "%s" is to be the first day of week
// %s will be replaced with the day name.
Calendar._TT["DAY_FIRST"] = "Mostra %s per primo";
// This may be locale-dependent. It specifies the week-end days, as an array
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "0,6";
Calendar._TT["CLOSE"] = "Chiudi";
Calendar._TT["TODAY"] = "Oggi";
Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per modificare";
// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
Calendar._TT["WK"] = "sett";
Calendar._TT["TIME"] = "Ora:";
+127 -127
View File
@@ -1,127 +1,127 @@
// ** I18N
// Calendar Chinese language
// Author: Andy Wu, <andywu.zh@gmail.com>
// Encoding: any
// Distributed under the same terms as the calendar itself.
// For translators: please use UTF-8 if possible. We strongly believe that
// Unicode is the answer to a real internationalized world. Also please
// include your contact information in the header, as can be seen above.
// full day names
Calendar._DN = new Array
("星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
"星期日");
// Please note that the following array of short day names (and the same goes
// for short month names, _SMN) isn't absolutely necessary. We give it here
// for exemplification on how one can customize the short day names, but if
// they are simply the first N letters of the full name you can simply say:
//
// Calendar._SDN_len = N; // short day name length
// Calendar._SMN_len = N; // short month name length
//
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.
// short day names
Calendar._SDN = new Array
("日",
"一",
"二",
"三",
"四",
"五",
"六",
"日");
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 0;
// full month names
Calendar._MN = new Array
("1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月");
// short month names
Calendar._SMN = new Array
("1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月");
// tooltips
Calendar._TT = {};
Calendar._TT["INFO"] = "关于日历";
Calendar._TT["ABOUT"] =
"DHTML Date/Time Selector\n" +
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"Date selection:\n" +
"- Use the \xab, \xbb buttons to select year\n" +
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"] = "上年 (hold for menu)";
Calendar._TT["PREV_MONTH"] = "上月 (hold for menu)";
Calendar._TT["GO_TODAY"] = "回到今天";
Calendar._TT["NEXT_MONTH"] = "下月 (hold for menu)";
Calendar._TT["NEXT_YEAR"] = "下年 (hold for menu)";
Calendar._TT["SEL_DATE"] = "选择日期";
Calendar._TT["DRAG_TO_MOVE"] = "拖动";
Calendar._TT["PART_TODAY"] = " (今日)";
// the following is to inform that "%s" is to be the first day of week
// %s will be replaced with the day name.
Calendar._TT["DAY_FIRST"] = "Display %s first";
// This may be locale-dependent. It specifies the week-end days, as an array
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "0,6";
Calendar._TT["CLOSE"] = "关闭";
Calendar._TT["TODAY"] = "今天";
Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
Calendar._TT["WK"] = "wk";
Calendar._TT["TIME"] = "Time:";
// ** I18N
// Calendar Chinese language
// Author: Andy Wu, <andywu.zh@gmail.com>
// Encoding: any
// Distributed under the same terms as the calendar itself.
// For translators: please use UTF-8 if possible. We strongly believe that
// Unicode is the answer to a real internationalized world. Also please
// include your contact information in the header, as can be seen above.
// full day names
Calendar._DN = new Array
("星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
"星期日");
// Please note that the following array of short day names (and the same goes
// for short month names, _SMN) isn't absolutely necessary. We give it here
// for exemplification on how one can customize the short day names, but if
// they are simply the first N letters of the full name you can simply say:
//
// Calendar._SDN_len = N; // short day name length
// Calendar._SMN_len = N; // short month name length
//
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.
// short day names
Calendar._SDN = new Array
("日",
"一",
"二",
"三",
"四",
"五",
"六",
"日");
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 0;
// full month names
Calendar._MN = new Array
("1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月");
// short month names
Calendar._SMN = new Array
("1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月");
// tooltips
Calendar._TT = {};
Calendar._TT["INFO"] = "关于日历";
Calendar._TT["ABOUT"] =
"DHTML Date/Time Selector\n" +
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"Date selection:\n" +
"- Use the \xab, \xbb buttons to select year\n" +
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"] = "上年 (hold for menu)";
Calendar._TT["PREV_MONTH"] = "上月 (hold for menu)";
Calendar._TT["GO_TODAY"] = "回到今天";
Calendar._TT["NEXT_MONTH"] = "下月 (hold for menu)";
Calendar._TT["NEXT_YEAR"] = "下年 (hold for menu)";
Calendar._TT["SEL_DATE"] = "选择日期";
Calendar._TT["DRAG_TO_MOVE"] = "拖动";
Calendar._TT["PART_TODAY"] = " (今日)";
// the following is to inform that "%s" is to be the first day of week
// %s will be replaced with the day name.
Calendar._TT["DAY_FIRST"] = "Display %s first";
// This may be locale-dependent. It specifies the week-end days, as an array
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "0,6";
Calendar._TT["CLOSE"] = "关闭";
Calendar._TT["TODAY"] = "今天";
Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
Calendar._TT["WK"] = "wk";
Calendar._TT["TIME"] = "Time:";
+464 -464
View File
@@ -1,464 +1,464 @@
/* ***** BEGIN LICENSE BLOCK *****
* This file is part of DotClear.
* Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All
* rights reserved.
*
* DotClear is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* DotClear is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DotClear; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ***** END LICENSE BLOCK *****
*/
/* Modified by JP LANG for textile formatting */
function jsToolBar(textarea) {
if (!document.createElement) { return; }
if (!textarea) { return; }
if ((typeof(document["selection"]) == "undefined")
&& (typeof(textarea["setSelectionRange"]) == "undefined")) {
return;
}
this.textarea = textarea;
this.editor = document.createElement('div');
this.editor.className = 'jstEditor';
this.textarea.parentNode.insertBefore(this.editor,this.textarea);
this.editor.appendChild(this.textarea);
this.toolbar = document.createElement("div");
this.toolbar.className = 'jstElements';
this.editor.parentNode.insertBefore(this.toolbar,this.editor);
// Dragable resizing (only for gecko)
if (this.editor.addEventListener)
{
this.handle = document.createElement('div');
this.handle.className = 'jstHandle';
var dragStart = this.resizeDragStart;
var This = this;
this.handle.addEventListener('mousedown',function(event) { dragStart.call(This,event); },false);
// fix memory leak in Firefox (bug #241518)
window.addEventListener('unload',function() {
var del = This.handle.parentNode.removeChild(This.handle);
delete(This.handle);
},false);
this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling);
}
this.context = null;
this.toolNodes = {}; // lorsque la toolbar est dessinée , cet objet est garni
// de raccourcis vers les éléments DOM correspondants aux outils.
}
function jsButton(title, fn, scope, className) {
this.title = title || null;
this.fn = fn || function(){};
this.scope = scope || null;
this.className = className || null;
}
jsButton.prototype.draw = function() {
if (!this.scope) return null;
var button = document.createElement('button');
button.setAttribute('type','button');
if (this.className) button.className = this.className;
button.title = this.title;
var span = document.createElement('span');
span.appendChild(document.createTextNode(this.title));
button.appendChild(span);
if (this.icon != undefined) {
button.style.backgroundImage = 'url('+this.icon+')';
}
if (typeof(this.fn) == 'function') {
var This = this;
button.onclick = function() { try { This.fn.apply(This.scope, arguments) } catch (e) {} return false; };
}
return button;
}
function jsSpace(id) {
this.id = id || null;
this.width = null;
}
jsSpace.prototype.draw = function() {
var span = document.createElement('span');
if (this.id) span.id = this.id;
span.appendChild(document.createTextNode(String.fromCharCode(160)));
span.className = 'jstSpacer';
if (this.width) span.style.marginRight = this.width+'px';
return span;
}
function jsCombo(title, options, scope, fn, className) {
this.title = title || null;
this.options = options || null;
this.scope = scope || null;
this.fn = fn || function(){};
this.className = className || null;
}
jsCombo.prototype.draw = function() {
if (!this.scope || !this.options) return null;
var select = document.createElement('select');
if (this.className) select.className = className;
select.title = this.title;
for (var o in this.options) {
//var opt = this.options[o];
var option = document.createElement('option');
option.value = o;
option.appendChild(document.createTextNode(this.options[o]));
select.appendChild(option);
}
var This = this;
select.onchange = function() {
try {
This.fn.call(This.scope, this.value);
} catch (e) { alert(e); }
return false;
}
return select;
}
jsToolBar.prototype = {
base_url: '',
mode: 'wiki',
elements: {},
getMode: function() {
return this.mode;
},
setMode: function(mode) {
this.mode = mode || 'wiki';
},
switchMode: function(mode) {
mode = mode || 'wiki';
this.draw(mode);
},
button: function(toolName) {
var tool = this.elements[toolName];
if (typeof tool.fn[this.mode] != 'function') return null;
var b = new jsButton(tool.title, tool.fn[this.mode], this, 'jstb_'+toolName);
if (tool.icon != undefined) b.icon = tool.icon;
return b;
},
space: function(toolName) {
var tool = new jsSpace(toolName)
if (this.elements[toolName].width !== undefined)
tool.width = this.elements[toolName].width;
return tool;
},
combo: function(toolName) {
var tool = this.elements[toolName];
var length = tool[this.mode].list.length;
if (typeof tool[this.mode].fn != 'function' || length == 0) {
return null;
} else {
var options = {};
for (var i=0; i < length; i++) {
var opt = tool[this.mode].list[i];
options[opt] = tool.options[opt];
}
return new jsCombo(tool.title, options, this, tool[this.mode].fn);
}
},
draw: function(mode) {
this.setMode(mode);
// Empty toolbar
while (this.toolbar.hasChildNodes()) {
this.toolbar.removeChild(this.toolbar.firstChild)
}
this.toolNodes = {}; // vide les raccourcis DOM/**/
// Draw toolbar elements
var b, tool, newTool;
for (var i in this.elements) {
b = this.elements[i];
var disabled =
b.type == undefined || b.type == ''
|| (b.disabled != undefined && b.disabled)
|| (b.context != undefined && b.context != null && b.context != this.context);
if (!disabled && typeof this[b.type] == 'function') {
tool = this[b.type](i);
if (tool) newTool = tool.draw();
if (newTool) {
this.toolNodes[i] = newTool; //mémorise l'accès DOM pour usage éventuel ultérieur
this.toolbar.appendChild(newTool);
}
}
}
},
singleTag: function(stag,etag) {
stag = stag || null;
etag = etag || stag;
if (!stag || !etag) { return; }
this.encloseSelection(stag,etag);
},
encloseSelection: function(prefix, suffix, fn) {
this.textarea.focus();
prefix = prefix || '';
suffix = suffix || '';
var start, end, sel, scrollPos, subst, res;
if (typeof(document["selection"]) != "undefined") {
sel = document.selection.createRange().text;
} else if (typeof(this.textarea["setSelectionRange"]) != "undefined") {
start = this.textarea.selectionStart;
end = this.textarea.selectionEnd;
scrollPos = this.textarea.scrollTop;
sel = this.textarea.value.substring(start, end);
}
if (sel.match(/ $/)) { // exclude ending space char, if any
sel = sel.substring(0, sel.length - 1);
suffix = suffix + " ";
}
if (typeof(fn) == 'function') {
res = (sel) ? fn.call(this,sel) : fn('');
} else {
res = (sel) ? sel : '';
}
subst = prefix + res + suffix;
if (typeof(document["selection"]) != "undefined") {
var range = document.selection.createRange().text = subst;
this.textarea.caretPos -= suffix.length;
} else if (typeof(this.textarea["setSelectionRange"]) != "undefined") {
this.textarea.value = this.textarea.value.substring(0, start) + subst +
this.textarea.value.substring(end);
if (sel) {
this.textarea.setSelectionRange(start + subst.length, start + subst.length);
} else {
this.textarea.setSelectionRange(start + prefix.length, start + prefix.length);
}
this.textarea.scrollTop = scrollPos;
}
},
stripBaseURL: function(url) {
if (this.base_url != '') {
var pos = url.indexOf(this.base_url);
if (pos == 0) {
url = url.substr(this.base_url.length);
}
}
return url;
}
};
/** Resizer
-------------------------------------------------------- */
jsToolBar.prototype.resizeSetStartH = function() {
this.dragStartH = this.textarea.offsetHeight + 0;
};
jsToolBar.prototype.resizeDragStart = function(event) {
var This = this;
this.dragStartY = event.clientY;
this.resizeSetStartH();
document.addEventListener('mousemove', this.dragMoveHdlr=function(event){This.resizeDragMove(event);}, false);
document.addEventListener('mouseup', this.dragStopHdlr=function(event){This.resizeDragStop(event);}, false);
};
jsToolBar.prototype.resizeDragMove = function(event) {
this.textarea.style.height = (this.dragStartH+event.clientY-this.dragStartY)+'px';
};
jsToolBar.prototype.resizeDragStop = function(event) {
document.removeEventListener('mousemove', this.dragMoveHdlr, false);
document.removeEventListener('mouseup', this.dragStopHdlr, false);
};
// Elements definition ------------------------------------
// strong
jsToolBar.prototype.elements.strong = {
type: 'button',
title: 'Strong emphasis',
fn: {
wiki: function() { this.singleTag('*') }
}
}
// em
jsToolBar.prototype.elements.em = {
type: 'button',
title: 'Emphasis',
fn: {
wiki: function() { this.singleTag("_") }
}
}
// ins
jsToolBar.prototype.elements.ins = {
type: 'button',
title: 'Inserted',
fn: {
wiki: function() { this.singleTag('+') }
}
}
// del
jsToolBar.prototype.elements.del = {
type: 'button',
title: 'Deleted',
fn: {
wiki: function() { this.singleTag('-') }
}
}
// quote
jsToolBar.prototype.elements.quote = {
type: 'button',
title: 'Inline quote',
fn: {
wiki: function() { this.singleTag('??') }
}
}
// code
jsToolBar.prototype.elements.code = {
type: 'button',
title: 'Code',
fn: {
wiki: function() { this.singleTag('@') }
}
}
// spacer
jsToolBar.prototype.elements.space1 = {type: 'space'}
// heading
jsToolBar.prototype.elements.heading = {
type: 'button',
title: 'Heading',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return 'h2. '+str.replace(/\n/g,"\n* ");
});
}
}
}
// br
//jsToolBar.prototype.elements.br = {
// type: 'button',
// title: 'Line break',
// fn: {
// wiki: function() { this.encloseSelection("%%%\n",'') }
// }
//}
// spacer
jsToolBar.prototype.elements.space2 = {type: 'space'}
// ul
jsToolBar.prototype.elements.ul = {
type: 'button',
title: 'Unordered list',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return '* '+str.replace(/\n/g,"\n* ");
});
}
}
}
// ol
jsToolBar.prototype.elements.ol = {
type: 'button',
title: 'Ordered list',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return '# '+str.replace(/\n/g,"\n# ");
});
}
}
}
// spacer
jsToolBar.prototype.elements.space3 = {type: 'space'}
// link
/*
jsToolBar.prototype.elements.link = {
type: 'button',
title: 'Link',
fn: {},
href_prompt: 'Please give page URL:',
hreflang_prompt: 'Language of this page:',
default_hreflang: '',
prompt: function(href,hreflang) {
href = href || '';
hreflang = hreflang || this.elements.link.default_hreflang;
href = window.prompt(this.elements.link.href_prompt,href);
if (!href) { return false; }
hreflang = ""
return { href: this.stripBaseURL(href), hreflang: hreflang };
}
}
jsToolBar.prototype.elements.link.fn.wiki = function() {
var link = this.elements.link.prompt.call(this);
if (link) {
var stag = '"';
var etag = '":'+link.href;
this.encloseSelection(stag,etag);
}
};
*/
// link or wiki page
jsToolBar.prototype.elements.link = {
type: 'button',
title: 'Link',
fn: {
wiki: function() { this.encloseSelection("[[", "]]") }
}
}
/* ***** BEGIN LICENSE BLOCK *****
* This file is part of DotClear.
* Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All
* rights reserved.
*
* DotClear is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* DotClear is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DotClear; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ***** END LICENSE BLOCK *****
*/
/* Modified by JP LANG for textile formatting */
function jsToolBar(textarea) {
if (!document.createElement) { return; }
if (!textarea) { return; }
if ((typeof(document["selection"]) == "undefined")
&& (typeof(textarea["setSelectionRange"]) == "undefined")) {
return;
}
this.textarea = textarea;
this.editor = document.createElement('div');
this.editor.className = 'jstEditor';
this.textarea.parentNode.insertBefore(this.editor,this.textarea);
this.editor.appendChild(this.textarea);
this.toolbar = document.createElement("div");
this.toolbar.className = 'jstElements';
this.editor.parentNode.insertBefore(this.toolbar,this.editor);
// Dragable resizing (only for gecko)
if (this.editor.addEventListener)
{
this.handle = document.createElement('div');
this.handle.className = 'jstHandle';
var dragStart = this.resizeDragStart;
var This = this;
this.handle.addEventListener('mousedown',function(event) { dragStart.call(This,event); },false);
// fix memory leak in Firefox (bug #241518)
window.addEventListener('unload',function() {
var del = This.handle.parentNode.removeChild(This.handle);
delete(This.handle);
},false);
this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling);
}
this.context = null;
this.toolNodes = {}; // lorsque la toolbar est dessinée , cet objet est garni
// de raccourcis vers les éléments DOM correspondants aux outils.
}
function jsButton(title, fn, scope, className) {
this.title = title || null;
this.fn = fn || function(){};
this.scope = scope || null;
this.className = className || null;
}
jsButton.prototype.draw = function() {
if (!this.scope) return null;
var button = document.createElement('button');
button.setAttribute('type','button');
if (this.className) button.className = this.className;
button.title = this.title;
var span = document.createElement('span');
span.appendChild(document.createTextNode(this.title));
button.appendChild(span);
if (this.icon != undefined) {
button.style.backgroundImage = 'url('+this.icon+')';
}
if (typeof(this.fn) == 'function') {
var This = this;
button.onclick = function() { try { This.fn.apply(This.scope, arguments) } catch (e) {} return false; };
}
return button;
}
function jsSpace(id) {
this.id = id || null;
this.width = null;
}
jsSpace.prototype.draw = function() {
var span = document.createElement('span');
if (this.id) span.id = this.id;
span.appendChild(document.createTextNode(String.fromCharCode(160)));
span.className = 'jstSpacer';
if (this.width) span.style.marginRight = this.width+'px';
return span;
}
function jsCombo(title, options, scope, fn, className) {
this.title = title || null;
this.options = options || null;
this.scope = scope || null;
this.fn = fn || function(){};
this.className = className || null;
}
jsCombo.prototype.draw = function() {
if (!this.scope || !this.options) return null;
var select = document.createElement('select');
if (this.className) select.className = className;
select.title = this.title;
for (var o in this.options) {
//var opt = this.options[o];
var option = document.createElement('option');
option.value = o;
option.appendChild(document.createTextNode(this.options[o]));
select.appendChild(option);
}
var This = this;
select.onchange = function() {
try {
This.fn.call(This.scope, this.value);
} catch (e) { alert(e); }
return false;
}
return select;
}
jsToolBar.prototype = {
base_url: '',
mode: 'wiki',
elements: {},
getMode: function() {
return this.mode;
},
setMode: function(mode) {
this.mode = mode || 'wiki';
},
switchMode: function(mode) {
mode = mode || 'wiki';
this.draw(mode);
},
button: function(toolName) {
var tool = this.elements[toolName];
if (typeof tool.fn[this.mode] != 'function') return null;
var b = new jsButton(tool.title, tool.fn[this.mode], this, 'jstb_'+toolName);
if (tool.icon != undefined) b.icon = tool.icon;
return b;
},
space: function(toolName) {
var tool = new jsSpace(toolName)
if (this.elements[toolName].width !== undefined)
tool.width = this.elements[toolName].width;
return tool;
},
combo: function(toolName) {
var tool = this.elements[toolName];
var length = tool[this.mode].list.length;
if (typeof tool[this.mode].fn != 'function' || length == 0) {
return null;
} else {
var options = {};
for (var i=0; i < length; i++) {
var opt = tool[this.mode].list[i];
options[opt] = tool.options[opt];
}
return new jsCombo(tool.title, options, this, tool[this.mode].fn);
}
},
draw: function(mode) {
this.setMode(mode);
// Empty toolbar
while (this.toolbar.hasChildNodes()) {
this.toolbar.removeChild(this.toolbar.firstChild)
}
this.toolNodes = {}; // vide les raccourcis DOM/**/
// Draw toolbar elements
var b, tool, newTool;
for (var i in this.elements) {
b = this.elements[i];
var disabled =
b.type == undefined || b.type == ''
|| (b.disabled != undefined && b.disabled)
|| (b.context != undefined && b.context != null && b.context != this.context);
if (!disabled && typeof this[b.type] == 'function') {
tool = this[b.type](i);
if (tool) newTool = tool.draw();
if (newTool) {
this.toolNodes[i] = newTool; //mémorise l'accès DOM pour usage éventuel ultérieur
this.toolbar.appendChild(newTool);
}
}
}
},
singleTag: function(stag,etag) {
stag = stag || null;
etag = etag || stag;
if (!stag || !etag) { return; }
this.encloseSelection(stag,etag);
},
encloseSelection: function(prefix, suffix, fn) {
this.textarea.focus();
prefix = prefix || '';
suffix = suffix || '';
var start, end, sel, scrollPos, subst, res;
if (typeof(document["selection"]) != "undefined") {
sel = document.selection.createRange().text;
} else if (typeof(this.textarea["setSelectionRange"]) != "undefined") {
start = this.textarea.selectionStart;
end = this.textarea.selectionEnd;
scrollPos = this.textarea.scrollTop;
sel = this.textarea.value.substring(start, end);
}
if (sel.match(/ $/)) { // exclude ending space char, if any
sel = sel.substring(0, sel.length - 1);
suffix = suffix + " ";
}
if (typeof(fn) == 'function') {
res = (sel) ? fn.call(this,sel) : fn('');
} else {
res = (sel) ? sel : '';
}
subst = prefix + res + suffix;
if (typeof(document["selection"]) != "undefined") {
var range = document.selection.createRange().text = subst;
this.textarea.caretPos -= suffix.length;
} else if (typeof(this.textarea["setSelectionRange"]) != "undefined") {
this.textarea.value = this.textarea.value.substring(0, start) + subst +
this.textarea.value.substring(end);
if (sel) {
this.textarea.setSelectionRange(start + subst.length, start + subst.length);
} else {
this.textarea.setSelectionRange(start + prefix.length, start + prefix.length);
}
this.textarea.scrollTop = scrollPos;
}
},
stripBaseURL: function(url) {
if (this.base_url != '') {
var pos = url.indexOf(this.base_url);
if (pos == 0) {
url = url.substr(this.base_url.length);
}
}
return url;
}
};
/** Resizer
-------------------------------------------------------- */
jsToolBar.prototype.resizeSetStartH = function() {
this.dragStartH = this.textarea.offsetHeight + 0;
};
jsToolBar.prototype.resizeDragStart = function(event) {
var This = this;
this.dragStartY = event.clientY;
this.resizeSetStartH();
document.addEventListener('mousemove', this.dragMoveHdlr=function(event){This.resizeDragMove(event);}, false);
document.addEventListener('mouseup', this.dragStopHdlr=function(event){This.resizeDragStop(event);}, false);
};
jsToolBar.prototype.resizeDragMove = function(event) {
this.textarea.style.height = (this.dragStartH+event.clientY-this.dragStartY)+'px';
};
jsToolBar.prototype.resizeDragStop = function(event) {
document.removeEventListener('mousemove', this.dragMoveHdlr, false);
document.removeEventListener('mouseup', this.dragStopHdlr, false);
};
// Elements definition ------------------------------------
// strong
jsToolBar.prototype.elements.strong = {
type: 'button',
title: 'Strong emphasis',
fn: {
wiki: function() { this.singleTag('*') }
}
}
// em
jsToolBar.prototype.elements.em = {
type: 'button',
title: 'Emphasis',
fn: {
wiki: function() { this.singleTag("_") }
}
}
// ins
jsToolBar.prototype.elements.ins = {
type: 'button',
title: 'Inserted',
fn: {
wiki: function() { this.singleTag('+') }
}
}
// del
jsToolBar.prototype.elements.del = {
type: 'button',
title: 'Deleted',
fn: {
wiki: function() { this.singleTag('-') }
}
}
// quote
jsToolBar.prototype.elements.quote = {
type: 'button',
title: 'Inline quote',
fn: {
wiki: function() { this.singleTag('??') }
}
}
// code
jsToolBar.prototype.elements.code = {
type: 'button',
title: 'Code',
fn: {
wiki: function() { this.singleTag('@') }
}
}
// spacer
jsToolBar.prototype.elements.space1 = {type: 'space'}
// heading
jsToolBar.prototype.elements.heading = {
type: 'button',
title: 'Heading',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return 'h2. '+str.replace(/\n/g,"\n* ");
});
}
}
}
// br
//jsToolBar.prototype.elements.br = {
// type: 'button',
// title: 'Line break',
// fn: {
// wiki: function() { this.encloseSelection("%%%\n",'') }
// }
//}
// spacer
jsToolBar.prototype.elements.space2 = {type: 'space'}
// ul
jsToolBar.prototype.elements.ul = {
type: 'button',
title: 'Unordered list',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return '* '+str.replace(/\n/g,"\n* ");
});
}
}
}
// ol
jsToolBar.prototype.elements.ol = {
type: 'button',
title: 'Ordered list',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return '# '+str.replace(/\n/g,"\n# ");
});
}
}
}
// spacer
jsToolBar.prototype.elements.space3 = {type: 'space'}
// link
/*
jsToolBar.prototype.elements.link = {
type: 'button',
title: 'Link',
fn: {},
href_prompt: 'Please give page URL:',
hreflang_prompt: 'Language of this page:',
default_hreflang: '',
prompt: function(href,hreflang) {
href = href || '';
hreflang = hreflang || this.elements.link.default_hreflang;
href = window.prompt(this.elements.link.href_prompt,href);
if (!href) { return false; }
hreflang = ""
return { href: this.stripBaseURL(href), hreflang: hreflang };
}
}
jsToolBar.prototype.elements.link.fn.wiki = function() {
var link = this.elements.link.prompt.call(this);
if (link) {
var stag = '"';
var etag = '":'+link.href;
this.encloseSelection(stag,etag);
}
};
*/
// link or wiki page
jsToolBar.prototype.elements.link = {
type: 'button',
title: 'Link',
fn: {
wiki: function() { this.encloseSelection("[[", "]]") }
}
}
+556 -556
View File
File diff suppressed because it is too large Load Diff