Overview
SHA1:ff34dde8e34d893233e7878531d998e8c91a7fde
Date: 2015-02-25 03:35:11
User: bohwaz
Comment:Refonte de l'éditeur du wiki avec prévisualisation, l'insertion de fichier suivra
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2015-03-10
02:51
[2b37f67952] Correction bug couleur non définie avec un nombre important de comptes (user: bohwaz, tags: trunk)
2015-02-25
03:35
[ff34dde8e3] Refonte de l'éditeur du wiki avec prévisualisation, l'insertion de fichier suivra (user: bohwaz, tags: trunk)
2015-02-24
03:33
[52d5f95d59] Le champ ID ne peut pas être supprimé, donc pas besoin de vérifier qu'il n'a pas été supprimé (user: bohwaz, tags: trunk)
Changes

Added src/templates/admin/wiki/_preview.tpl version [3ed71895c6].















>
>
>
>
>
>
>
1
2
3
4
5
6
7
{include file="admin/_head.tpl" title="Wiki" current="wiki" is_popup=1 body_id="transparent"}

<div class="wikiContent">
{$contenu|format_wiki|liens_wiki:'#'}
</div>

{include file="admin/_foot.tpl"}

Modified src/templates/admin/wiki/editer.tpl from [ff2422d963] to [dbb3dc8b75].

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
            <dd class="help">Le mot de passe n'est ni transmis ni enregistré, vous seul le connaissez,
                il n'est pas possible de retrouver le contenu si vous l'oubliez.</dd>
        </dl>
    </fieldset>


    <fieldset class="wikiText">
        <p>
            <textarea name="contenu" id="f_contenu" cols="70" rows="35">{form_field data=$page name=contenu}</textarea>
        </p>
    </fieldset>

    <fieldset class="wikiRevision">
        <dl>
            <dt><label for="f_modification">Résumé des modifications</label>  <i>(facultatif)</i></dt>
            <dd><input type="text" name="modification" id="f_modification" value="{form_field data=$page name=modification}" /></dd>
            {* FIXME







|

|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
            <dd class="help">Le mot de passe n'est ni transmis ni enregistré, vous seul le connaissez,
                il n'est pas possible de retrouver le contenu si vous l'oubliez.</dd>
        </dl>
    </fieldset>


    <fieldset class="wikiText">
        <div class="textEditor">
            <textarea name="contenu" id="f_contenu" cols="70" rows="35">{form_field data=$page name=contenu}</textarea>
        </div>
    </fieldset>

    <fieldset class="wikiRevision">
        <dl>
            <dt><label for="f_modification">Résumé des modifications</label>  <i>(facultatif)</i></dt>
            <dd><input type="text" name="modification" id="f_modification" value="{form_field data=$page name=modification}" /></dd>
            {* FIXME

Modified src/www/admin/static/admin.css from [bb9a3efdda] to [01a0c5d7e1].

38
39
40
41
42
43
44




45
46
47
48
49
50
51
...
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
...
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
...
733
734
735
736
737
738
739
740
741
742
743

744
745
746
747
748
749
750
...
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
    background: url("bg01.png") no-repeat left -100px, url("bg00.png") repeat-y left bottom, #fff;
    padding-bottom: 1em;
}

body#popup {
    background: url("bg01.png") no-repeat -140px -100px, url("bg00.png") repeat-y -140px bottom, #fff;
}





.header {
    color: #fff;
}

.header h1 {
    color: #9c4f15;
................................................................................
.loader img {
    position: absolute;
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 2;
}

input[type=button].icn {
    font-size: 1.2em;
    font-weight: bold;
    padding: 0 0.3em;
    font-family: "Courier New", Courier, monospace;
}

select.large {
    width: 95%;
}

select.large optgroup.niveau_1 {
    background: #333;
    color: #fff;
................................................................................
    border-bottom: 1pt solid #999;
}

#rapport h1 {
    text-align: center;
}

.icn {
    font-family: "gicon", sans-serif;
    font-style: normal;
    font-weight: normal;
    speak: none;
    font-variant: normal;
    text-transform: none;
    position: relative;
................................................................................
    clear: both;
}

/* WIKI */

fieldset.wikiText {
    border: none;
}

fieldset.wikiText textarea, fieldset.skelEdit textarea {
    width: 100%;

}

fieldset.wikiMain, fieldset.wikiRights, fieldset.wikiEncrypt {
    float: right;
    width: 35%;
    margin-left: 3%;
    clear: right;
................................................................................
    list-style-type: disc;
}

.wikiContent ol {
    list-style-type: decimal;
}

.toolbar input {
    padding: .1em .2em;
    border: 1px solid #ccc;
    color: #000;
    background: #fff;
    cursor: pointer;
    margin: 0 .5em .5em .5em;
    border-bottom: 2px solid #9c4f15;
    border-radius: .2em;
}

.toolbar input:hover {
    color: #fff;
    background: #d98628;
    border-color: transparent;
}

.toolbar .title { font-size: 1.2em; }
.toolbar .bold { font-weight: bold; }
.toolbar .italic { font-style: italic; }
.toolbar .code { font-family: Courier New, Courier, mono; }
.toolbar .strike { text-decoration: line-through; }
.toolbar .link { color: blue; text-decoration: underline; }

.wikiFooter {
    font-size: 0.8em;
    color: #666;
    border-top: 0.1em solid #ccc;
    clear: both;
}








>
>
>
>







 







<
<
<
<
<
<
<







 







|







 







<
<
<
<
>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
...
257
258
259
260
261
262
263







264
265
266
267
268
269
270
...
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
...
730
731
732
733
734
735
736




737
738
739
740
741
742
743
744
...
791
792
793
794
795
796
797
























798
799
800
801
802
803
804
    background: url("bg01.png") no-repeat left -100px, url("bg00.png") repeat-y left bottom, #fff;
    padding-bottom: 1em;
}

body#popup {
    background: url("bg01.png") no-repeat -140px -100px, url("bg00.png") repeat-y -140px bottom, #fff;
}

body#transparent {
    background: transparent;
}

.header {
    color: #fff;
}

.header h1 {
    color: #9c4f15;
................................................................................
.loader img {
    position: absolute;
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 2;
}








select.large {
    width: 95%;
}

select.large optgroup.niveau_1 {
    background: #333;
    color: #fff;
................................................................................
    border-bottom: 1pt solid #999;
}

#rapport h1 {
    text-align: center;
}

.icn, .icnl {
    font-family: "gicon", sans-serif;
    font-style: normal;
    font-weight: normal;
    speak: none;
    font-variant: normal;
    text-transform: none;
    position: relative;
................................................................................
    clear: both;
}

/* WIKI */

fieldset.wikiText {
    border: none;




    padding: 0;
}

fieldset.wikiMain, fieldset.wikiRights, fieldset.wikiEncrypt {
    float: right;
    width: 35%;
    margin-left: 3%;
    clear: right;
................................................................................
    list-style-type: disc;
}

.wikiContent ol {
    list-style-type: decimal;
}

























.wikiFooter {
    font-size: 0.8em;
    color: #666;
    border-top: 0.1em solid #ccc;
    clear: both;
}

Added src/www/admin/static/scripts/text_editor.min.js version [1c434850a5].



>
1
(function(){window.textEditor=function(a){if(!document.getElementById(a))throw new Error("Invalid ID parameter: "+a);this.id=a;this.textarea=document.getElementById(a);this.shortcuts=[];this._key_map={8:'backspace',9:'tab',13:'enter',16:'shift',17:'ctrl',18:'alt',20:'capslock',27:'esc',32:'space',33:'pageup',34:'pagedown',35:'end',36:'home',37:'left',38:'up',39:'right',40:'down',45:'ins',46:'del',91:'meta',93:'meta',224:'meta',106:false,107:false,109:false,110:false,111:false,186:false,187:false,188:false,189:false,190:false,191:false,192:false,219:false,220:false,221:false,222:false};for(var b=1;b<20;++b)this._key_map[111+b]='f'+b;for(b=0;b<=9;++b)this._key_map[b+96]=b;this.preventKeyPress=false;this.textarea.addEventListener('keydown',this.keyEvent.bind(this),true);this.textarea.addEventListener('keypress',this.keyEvent.bind(this),true);};textEditor.prototype.keyEvent=function(a){var a=a||window.event;if(this.preventKeyPress&&a.type=='keypress'){this.preventKeyPress=false;return this.preventDefault(a);}for(var b in this.shortcuts){var c=this.shortcuts[b];if(a.metaKey)continue;if((a.ctrlKey&&!c.ctrl)||(c.ctrl&&!a.ctrlKey))continue;if((a.shiftKey&&!c.shift)||(c.shift&&!a.shiftKey))continue;if((a.altKey&&!c.alt)||(c.alt&&!a.altKey))continue;if(!(b=this.matchKeyPress(c.key,a)))continue;if(typeof c.callback!='function'){var d=(c.ctrl?'Ctrl-':'')+(c.alt?'Alt-':'');d+=(c.shift?'Shift-':'')+c;throw new Error("Invalid callback type for shortcut "+d);}var e=c.callback.call(this,a,b);if(a.type=='keydown'&&e)this.preventKeyPress=true;return e?this.preventDefault(a):true;}return true;};textEditor.prototype.matchKeyPress=function(a,b){if(b.which==null)var c=b.keyCode;else if(b.which!=0&&b.charCode!=0)var c=b.charCode;else return false;if(this._key_map[c]==a)return true;else if(a.toUpperCase()==String.fromCharCode(c).toUpperCase())return true;else return false;};textEditor.prototype.preventDefault=function(a){if(a.preventDefault)a.preventDefault();if(a.stopPropagation)a.stopPropagation();a.returnValue=false;a.cancelBubble=true;return false;};textEditor.prototype.getSelection=function(){var a=this.textarea;if('selectionStart' in a){var b=a.selectionEnd-a.selectionStart;return{start:a.selectionStart,end:a.selectionEnd,length:b,text:a.value.substr(a.selectionStart,b)};}else if(document.selection){a.focus();var c=document.selection.createRange();var d=a.createTextRange();var e=d.duplicate();e.moveToBookmark(c.getBookmark());d.setEndPoint('EndToStart',e);if(c==null||d==null)return{start:a.value.length,end:a.value.length,length:0,text:''};var f=c.text.replace(/[\r\n]/g,'.');var g=a.value.replace(/[\r\n]/g,'.');var h=g.indexOf(f,d.text.length);return{start:h,end:h+f.length,length:f.length,text:c.text};}else return{start:a.value.length,end:a.value.length,length:0,text:''};};textEditor.prototype.replaceSelection=function(a,b){var c=this.textarea;var d=a.start;var e=d+b.length;c.value=c.value.substr(0,d)+b+c.value.substr(a.end,c.value.length);this.setSelection(d,e);return{start:d,end:e,length:b.length,text:b};};textEditor.prototype.insertAtPosition=function(a,b,c){var d=a+b.length;var e=this.textarea;e.value=e.value.substr(0,a)+b+e.value.substr(a,e.value.length-a);if(!c)c=d;return this.setSelection(c,c);};textEditor.prototype.setSelection=function(a,b){var c=this.textarea;if('selectionStart' in c){c.focus();c.selectionStart=a;c.selectionEnd=b;}else if(document.selection){c.focus();var d=c.createTextRange();var e=a;for(i=0;i<e;i++)if(c.value[i].search(/[\r\n]/)!=-1)a=a-.5;e=b;for(i=0;i<e;i++)if(c.value[i].search(/[\r\n]/)!=-1)b=b-.5;d.moveEnd('textedit',-1);d.moveStart('character',a);d.moveEnd('character',b-a);d.select();}return this.getSelection();};textEditor.prototype.scrollToSelection=function(a){var b=this.textarea;var c=b.value.substr(a.end);b.value=b.value.substr(0,a.end);b.scrollTop=100000;var d=b.scrollTop;b.value+=c;b.scrollTop=d;this.setSelection(a.start,a.end);};textEditor.prototype.wrapSelection=function(a,b,c){var d=this.textarea;var e=d.scrollTop;var f=a.text;var a=this.replaceSelection(a,b+f+c);if(f=='')a=this.setSelection(a.start+b.length,a.start+b.length);d.scrollTop=e;return a;};}());

Added src/www/admin/static/scripts/wiki_editor.css version [e0a0321c5b].





















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.textEditor {
    border-radius: .5em;
    background: #ccc;
    padding: 1%;
    overflow: hidden;
    position: relative;
}

.textEditor textarea {
    border: none;
    margin: 0;
    background: #eee;
    border-radius: .5em;
    height: 96%;
    width: 98%;
}

nav.te {
    margin-bottom: .5em;
    height: 30px;
}

nav.te input {
    margin: 4px .5em;
    padding: 0;
    height: 24px;
    border: none;
    border-bottom: 1px solid #999;
    border-radius: .2em;
    cursor: pointer;
    background: transparent no-repeat center center;
    display: inline-block;
    vertical-align: bottom;
    transition: all .2s;
}

nav.te input:hover { background-color: #fff; }

nav.te .bold, nav.te .italic, nav.te .title, nav.te .link {
    font-family: Georgia, "Times New Roman", serif;
}

nav.te .bold { font-weight: bold; }
nav.te .italic { font-style: italic; }
nav.te .link { text-decoration: underline; color: blue; }
nav.te .title { font-size: 1.2em; }

nav.te .ext {
    border: 1px solid #999;
    box-shadow: 2px 2px 5px #999;
    min-width: 24px;
}

nav.te .fullscreen {
    text-indent: -70em;
    overflow: hidden; 
}

nav.te .icnl {
    font-size: 18px;
}

nav.te .ext.icnl {
    width: 24px;
    line-height: 5px;
    overflow: hidden;
}

nav.te .file {
    margin-left: 2em;
}

nav.te .fullscreen {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABMTFFOTlBOTlCQ1uMHAAAAA3RSTlMAOcKBmOr4AAAAQUlEQVQI12P4/4D7P8N/B0Yo8XsC23+GZw+4pzM4TmBzYsAGgBKODNcecM9m+D+B7T3DPwfG/Qz/G5iABlzg+g8ANzMax/3kkQoAAAAASUVORK5CYII=");
    float: right;
}

nav.te .preview {
    margin-left: 2em;
}

.textEditor.fullscreen nav.te .fullscreen {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABNTVFOTlBOTlBLB/faAAAAA3RSTlMAOsPdsomtAAAAQElEQVQI12NIEWCRZNi5gTePIe8D/08G6Q/8Txj0P/B/YVj/gf8fAzawHyQhD1ICJvI/8O9k2FnAl8eQosAiCQCgixb13aKGIwAAAABJRU5ErkJggg==");
}

.textEditor nav input.close {
    display: none;
    float: right;
}

.textEditor nav input.reload {
    display: none;
    float: left;
}

.textEditor.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 98%;
    height: 98%;
    padding: 1%;
    border-radius: 0;
}

.textEditor.fullscreen textarea {
    height: 90%;
}

.textEditor.iframe textarea {
    display: none;
}

.textEditor.iframe nav input {
    display: none;
}

.textEditor.iframe nav input.close, .textEditor.iframe nav input.reload {
    display: inline-block;
}

.textEditor iframe {
    border: none;
    background: #eee;
    border-radius: .5em;
    padding: 1%;
    width: 98%;
}

.textEditor iframe.hidden {
    visibility: hidden;
    width: 0px;
    height: 0px;
    position: absolute;
    top: -1000px;
}

Added src/www/admin/static/scripts/wiki_editor.js version [b910651671].

















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
(function () {
	g.style('scripts/wiki_editor.css');

	g.script('scripts/text_editor.min.js').onload = function () {
		var t = new textEditor('f_contenu');
		t.parent = t.textarea.parentNode;

		var toolbar = document.createElement('nav');
		toolbar.className = 'te';

		var toggleFullscreen = function (e)
		{
			var classes = t.parent.className.split(' ');

			for (var i = 0; i < classes.length; i++)
			{
				if (classes[i] == 'fullscreen')
				{
					classes.splice(i, 1);
					t.parent.className = classes.join(' ');
					t.fullscreen = false;
					return true;
				}
			}
			
			classes.push('fullscreen');
			t.parent.className = classes.join(' ');
			t.fullscreen = true;
			return true;
		};

		var openPreview = function ()
		{
			openIFrame('');
			var form = document.createElement('form');
			form.appendChild(t.textarea.cloneNode(true));
			form.firstChild.value = t.textarea.value;
			form.target = 'editorFrame';
			form.action = g.admin_url + 'wiki/_preview.php?id=' + window.location.search.match(/id=(\d+)/)[1];
			form.style.display = 'none';
			form.method = 'post';
			document.body.appendChild(form);
			form.submit();
			//document.body.removeChild(form);
		};

		var openSyntaxHelp = function ()
		{
			openIFrame(g.admin_url + 'wiki/_syntaxe.html');
		};

		var openIFrame = function(url)
		{
			if (t.iframe && t.iframe.src == t.base_url + url)
			{
				t.iframe.className = '';
				t.parent.className += ' iframe';
				return true;
			}
			else if (t.iframe)
			{
				t.parent.removeChild(t.iframe);
				t.iframe = null;
			}

			var w = t.textarea.offsetWidth,
				h = t.textarea.offsetHeight;

			var iframe = document.createElement('iframe');
			iframe.width = w;
			iframe.height = h;
			iframe.src = url;
			iframe.name = 'editorFrame';
			iframe.frameborder = '0';
			iframe.scrolling = 'yes';

			t.parent.appendChild(iframe);
			t.parent.className += ' iframe';
			t.iframe = iframe;
		};

		var closeIFrame = function ()
		{
			t.parent.className = t.parent.className.replace(/ iframe$/, '');
			t.iframe.className = 'hidden';
		};


		var appendButton = function (name, title, action, altTitle)
		{
			var btn = document.createElement('input');
			btn.type = 'button';
			btn.title = altTitle ? altTitle : title;
			btn.value = title;
			btn.className = name;
			btn.onclick = function () { action.call(); return false; };

			toolbar.appendChild(btn);
			return btn;
		};

		var wrapTags = function (left, right)
		{
			t.wrapSelection(t.getSelection(), left, right);
			return true;
		};

		appendButton('title', "== Titre", function () { wrapTags("== ", ""); } );
		appendButton('bold', '**gras**', function () { wrapTags('**', '**'); } );
		appendButton('italic', "''italique''", function () { wrapTags("''", "''"); } );
		appendButton('link', "[[lien|http://]]", function () { 
			if (url = window.prompt('Adresse URL ?')) 
				wrapTags("[[", "|" + url + ']]'); 
		} );
		appendButton('icnl file', "📎", function () {}, 'Insérer fichier / image');

		appendButton('ext icnl preview', '⎙', openPreview, 'Prévisualiser');

		appendButton('ext icnl help', '❓', openSyntaxHelp, 'Aide sur la syntaxe');
		appendButton('ext fullscreen', 'Plein écran', toggleFullscreen, 'Plein écran');
		appendButton('ext close', 'Fermer', closeIFrame);
		
		t.parent.insertBefore(toolbar, t.parent.firstChild);

		t.shortcuts.push({key: 'F11', callback: toggleFullscreen});
		t.shortcuts.push({ctrl: true, key: 'b', callback: function () { return wrapTags('**', '**'); } });
		t.shortcuts.push({ctrl: true, key: 'g', callback: function () { return wrapTags('**', '**'); } });
		t.shortcuts.push({ctrl: true, key: 'i', callback: function () { return wrapTags("''", "''"); } });

		if (window.location.hash.match(/fullscreen/))
		{
			t.toggleFullscreen();
			window.location.hash = '';
		}
	};
}());

Deleted src/www/admin/static/scripts/wikitoolbar.js version [5b59fbc8fd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
(function () {
	// Source: http://stackoverflow.com/questions/401593/textarea-selection
	var selection =
	{
		get: function (e)
		{
			//Mozilla and DOM 3.0
			if('selectionStart' in e)
			{
				var l = e.selectionEnd - e.selectionStart;
				return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) };
			}
			//IE
			else if(document.selection)
			{
				e.focus();
				var r = document.selection.createRange();
				var tr = e.createTextRange();
				var tr2 = tr.duplicate();
				tr2.moveToBookmark(r.getBookmark());
				tr.setEndPoint('EndToStart',tr2);
				if (r == null || tr == null) return { start: e.value.length, end: e.value.length, length: 0, text: '' };
				var text_part = r.text.replace(/[\r\n]/g,'.'); //for some reason IE doesn't always count the \n and \r in the length
				var text_whole = e.value.replace(/[\r\n]/g,'.');
				var the_start = text_whole.indexOf(text_part,tr.text.length);
				return { start: the_start, end: the_start + text_part.length, length: text_part.length, text: r.text };
			}
			//Browser not supported
			else return { start: e.value.length, end: e.value.length, length: 0, text: '' };
		},

		replace: function (e, replace_str)
		{
			var selection = this.get(e);
			var start_pos = selection.start;
			var end_pos = start_pos + replace_str.length;
			e.value = e.value.substr(0, start_pos) + replace_str + e.value.substr(selection.end, e.value.length);
			this.set(e,start_pos,end_pos);
			return {start: start_pos, end: end_pos, length: replace_str.length, text: replace_str};
		},

		set: function (e, start_pos,end_pos)
		{
			//Mozilla and DOM 3.0
			if('selectionStart' in e)
			{
				e.focus();
				e.selectionStart = start_pos;
				e.selectionEnd = end_pos;
			}
			//IE
			else if(document.selection)
			{
				e.focus();
				var tr = e.createTextRange();

				//Fix IE from counting the newline characters as two seperate characters
				var stop_it = start_pos;
				for (i=0; i < stop_it; i++) if( e.value[i].search(/[\r\n]/) != -1 ) start_pos = start_pos - .5;
				stop_it = end_pos;
				for (i=0; i < stop_it; i++) if( e.value[i].search(/[\r\n]/) != -1 ) end_pos = end_pos - .5;

				tr.moveEnd('textedit',-1);
				tr.moveStart('character',start_pos);
				tr.moveEnd('character',end_pos - start_pos);
				tr.select();
			}
			return this.get(e);
		},

		wrap: function (e, left_str, right_str, sel_offset, sel_length)
		{
			var scroll = e.scrollTop;
			var the_sel_text = this.get(e).text;
			var selection =  this.replace(e, left_str + the_sel_text + right_str );
			if(sel_offset !== undefined && sel_length !== undefined) selection = this.set(e, selection.start +  sel_offset, selection.start +  sel_offset + sel_length);
			else if(the_sel_text == '') selection = this.set(e, selection.start + left_str.length, selection.start + left_str.length);
			e.scrollTop = scroll;
			return selection;
		}
	};

	function openImageBrowser()
	{
		window.open('_images.php?page=' + document.getElementById('f_id').value, 'browseImages',
            'width=500,height=600,top=150,left=150,scrollbars=1,location=false');
	}

	function openFileBrowser()
	{
		window.open('_fichiers.php?page=' + document.getElementById('f_id').value, 'browseFiles',
            'width=500,height=600,top=150,left=150,scrollbars=1,location=false');
	}

	function launchToolbar()
	{
		function addBtn(className, label, action)
		{
			var btn = document.createElement('input');
			btn.type = 'button';
			btn.className = className;
			btn.value = label;
			btn.onclick = action;
			toolbar.appendChild(btn);
		}

		var txt = document.getElementById('f_contenu');
		var parent = txt.parentNode.parentNode;
		var toolbar = document.createElement('div');
		toolbar.className = "toolbar";

		addBtn('title', 'Titre', function () { selection.wrap(txt, '=== ', " ===\n"); } );
		addBtn('italic', 'Italique', function () { selection.wrap(txt, "''", "''"); } );
		addBtn('bold', 'Gras', function () { selection.wrap(txt, '**', '**'); } );
		addBtn('strike', 'Barré', function () { selection.wrap(txt, '--', '--'); } );
		addBtn('code', 'Chasse fixe', function () { selection.wrap(txt, "[[[\n", "\n]]]"); } );
		addBtn('link', 'Lien', function () {
				if (url = window.prompt('Adresse du lien ?'))
				{
						selection.wrap(txt, '[[', ' | ' + url + ']]');
				}
			} );

		addBtn('image', 'Image', function () {
			window.open('_images.php?page=' + document.getElementById('f_id').value, 'browseImages',
            	'width=500,height=600,top=150,left=150,scrollbars=1,location=false');
		});
		addBtn('file', 'Fichier', function () {
			window.open('_fichiers.php?page=' + document.getElementById('f_id').value, 'browseFiles',
            	'width=500,height=600,top=150,left=150,scrollbars=1,location=false');
		});

		parent.insertBefore(toolbar, txt.parentNode);
	}

	g.onload(launchToolbar);
} () );
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































Added src/www/admin/wiki/_preview.php version [0e6ea2fd1d].



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

if ($user['droits']['wiki'] < Membres::DROIT_ECRITURE)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$tpl->assign('contenu', Utils::post('contenu'));

$tpl->display('admin/wiki/_preview.tpl');

Added src/www/admin/wiki/_syntaxe.html version [4f5b72c0af].



































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>Syntaxe SkrivML</title>
	<style type="text/css">
	body, form, p, div, hr, fieldset, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6 {
	    margin: 0;
	    padding: 0;
	}
	h1  { font-size: 2em; }
	h2  { font-size: 1.5em; }
	h3  { font-size: 1.2em; }
	h4  { font-size: 1em; }
	h5  { font-size: 0.9em; }
	h6  { font-size: 0.8em; }
	article, aside, figure, footer, header, hgroup, menu, nav, section { display: block; }

	body {
		font-family: "Trebuchet MS", Arial, Helvetica, Sans-serif;
		padding: .8em;
	}
	pre, samp {
		display: block;
		background: #ccc;
		color: #000;
		border-radius: .5em;
		padding: .4em;
		white-space: normal;
	}

	samp {
		background: #999;
		font-family: "Trebuchet MS", Arial, Helvetica, Sans-serif;
	}

	p, header, article {
		margin: .8em 0;
		clear: both;
	}

	h1, h2, h3, h4, samp, pre {
		margin: .4em 0;
	}

	ul, ol {
		margin-left: 1.5em;
	}

	table {
		border-collapse: collapse;
	}
	table td, table th {
		border: 1px solid #666;
		padding: .3em;
	}

	a {
		color: blue;
		text-decoration: underline;
		cursor: pointer;
	}

	</style>
</head>

<body>

<header>
	<p>Garradin utilise la syntaxe <a href="http://markup.skriv.org/language/syntax">SkrivML</a> pour 
		le formatage du texte dans le wiki.</p>
</header>

<section>
	<h2>Styles de base</h2>
	<article>
		<h3>Gras</h3>
		<pre>Utiliser **deux astérisques**.</pre>
		<samp>Utiliser <b>deux astérisques</b>.</samp>
	</article>

	<article>
		<h3>Italique</h3>
		<pre>Pourquoi pas des ''guillemets''.</pre>
		<samp>Pourquoi pas des <i>guillemets</i>.</samp>
	</article>

	<article>
		<h3>Souligné</h3>
		<pre>Il faut des __tirets bas__ pour souligner.</pre>
		<samp>Il faut des <u>tirets bas</u> pour souligner.</samp>
	</article>

	<article>
		<h3>Barré</h3>
		<pre>--Tirets hauts-- pour barrer.</pre>
		<samp><s>Tirets hauts</s> pour barrer.</samp>
	</article>

	<article>
		<h3>Exposant</h3>
		<pre>XXI^^ème^^ siècle</pre>
		<samp>XXI<sup>ème</sup> siècle.</samp>
	</article>


	<article>
		<h3>Indice</h3>
		<pre>CO,,2,,</pre>
		<samp>CO<sub>2</sub></samp>
	</article>

	<article>
		<p>Attention, ces styles ne fonctionnent que si le code entoure des mots complets, ça ne fonctionne pas au milieu de mots.</p>
		<pre>Un **mot** en gras. Mais on ne peut pas cou**per** un mot avec du gras.</pre>
		<samp>Un <b>mot</b> en gras. Mais on ne peut pas cou**per** un mot avec du gras.</samp>
	</article>
</section>

<section>
	<h2>Titres</h2>
	<article>
		<p>Doivent être précédé d'un ou plusieurs signe égal. Peuvent aussi être suivi du même nombre de signe égal.</p>
		<pre>= Titre niveau 1<br />== Titre niveau 2<br />=== Titre niveau 3 ===<br />==== Titre de niveau 4 ====</pre>
		<samp><h1>Titre niveau 1</h1><h2>Titre niveau 2</h2><h3>Titre niveau 3</h3><h4>Titre de niveau 4</h4></samp>
	</article>
</section>


<section>
	<h2>Listes</h2>
	<article>
		<h3>Listes non ordonnées</h3>
		<pre>* Item 1<br />* Item 2<br />** Sub-item 2.1<br />** Sub-item 2.2<br />*** Sub-item 2.2.1</pre>
		<samp><ul><li>Item 1</li><li>Item 2<ul><li>Sub-item 2.1</li><li>Sub-item 2.2<ul><li>Sub-item 2.2.1</li></ul></li></ul></li></ul></samp>
	</article>
	<article>
		<h3>Listes ordonnées</h3>
		<pre># Item 1<br /># Item 2<br />## Sub-item 2.1<br />## Sub-item 2.2<br />### Sub-item 2.2.1</pre>
		<samp><ol><li>Item 1</li><li>Item 2<ol><li>Sub-item 2.1</li><li>Sub-item 2.2<ol><li>Sub-item 2.2.1</li></ol></li></ol></li></ol></samp>
	</article>
</section>

<section>
	<h2>Liens</h2>
	<article>
		<h3>Lien wiki</h3>
		<pre>[[Autre page du wiki]]</pre>
		<samp><a title="Autre_page_du_wiki">Autre page du wiki</a></samp>
	</article>
	<article>
		<h3>Lien wiki avec libellé différent</h3>
		<pre>Voir [[cette page|Autre page du wiki]]</pre>
		<samp>Voir <a title="Autre_page_du_wiki">cette page</a></samp>
	</article>
	<article>
		<h3>Lien externe</h3>
		<pre>[[http://garradin.eu/]]</pre>
		<samp><a>http://garradin.eu/</a></samp>
	</article>
</section>

<section>
	<h2>Tableaux</h2>
	<article>
		<pre>!! Colonne 1 !! Colonne 2<br />|| Cellule 1 || Cellule 2<br />|| Cellule 3 || Cellule 4</pre>
		<samp><table><thead><tr><th>Colonne 1</th><th>Colonne 2</th></tr></thead><tbody><tr><td>Cellule 1</td><td>Cellule 2</td></tr><tr><td>Cellule 3</td><td>Cellule 4</td></tr></tbody></table></samp>
	</article>
</section>

<section>
	<h3>Autres</h3>
	<p>Consulter la documentation de <a href="http://markup.skriv.org/language/syntax">SkrivML</a>.</p>
</section>

</body>
</html>

Modified src/www/admin/wiki/editer.php from [7de34b2e99] to [05f72ccbc6].

81
82
83
84
85
86
87
88
89
90
91
92

$tpl->assign('error', $error);
$tpl->assign('page', $page);

$tpl->assign('time', time());
$tpl->assign('date', $date ? $date : $page['date_creation']);

$tpl->assign('custom_js', ['wikitoolbar.js', 'wiki-encryption.js']);

$tpl->display('admin/wiki/editer.tpl');

?>







|

|
<
<
81
82
83
84
85
86
87
88
89
90



$tpl->assign('error', $error);
$tpl->assign('page', $page);

$tpl->assign('time', time());
$tpl->assign('date', $date ? $date : $page['date_creation']);

$tpl->assign('custom_js', ['wiki_editor.js', 'wiki-encryption.js']);

$tpl->display('admin/wiki/editer.tpl');