View | Details | Raw Unified | Return to bug 11584
Collapse All | Expand All

(-)a/admin/systempreferences.pl (+5 lines)
Lines 128-133 sub GetPrefParams { Link Here
128
        $data->{options} =~ /(.*)\|(.*)/;
128
        $data->{options} =~ /(.*)\|(.*)/;
129
        $params->{'cols'} = $1;
129
        $params->{'cols'} = $1;
130
        $params->{'rows'} = $2;
130
        $params->{'rows'} = $2;
131
    } elsif ( $data->{'type'} eq 'Htmlarea' ) {
132
        $params->{'type_htmlarea'} = 1;
133
        $data->{options} =~ /(.*)\|(.*)/;
134
        $params->{'cols'} = $1;
135
        $params->{'rows'} = $2;
131
    } elsif ( $data->{'type'} eq 'Themes' ) {
136
    } elsif ( $data->{'type'} eq 'Themes' ) {
132
        $params->{'type_choice'} = 1;
137
        $params->{'type_choice'} = 1;
133
        my $type = '';
138
        my $type = '';
(-)a/koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage/css/advimage.css (+13 lines)
Line 0 Link Here
1
#src_list, #over_list, #out_list {width:280px;}
2
.mceActionPanel {margin-top:7px;}
3
.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;}
4
.checkbox {border:0;}
5
.panel_wrapper div.current {height:305px;}
6
#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
7
#align, #classlist {width:150px;}
8
#width, #height {vertical-align:middle; width:50px; text-align:center;}
9
#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;}
10
#class_list {width:180px;}
11
input {width: 280px;}
12
#constrain, #onmousemovecheck {width:auto;}
13
#id, #dir, #lang, #usemap, #longdesc {width:200px;}
(-)a/koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage/editor_plugin.js (+1 lines)
Line 0 Link Here
1
(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})();
(-)a/koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage/editor_plugin_src.js (+50 lines)
Line 0 Link Here
1
/**
2
 * editor_plugin_src.js
3
 *
4
 * Copyright 2009, Moxiecode Systems AB
5
 * Released under LGPL License.
6
 *
7
 * License: http://tinymce.moxiecode.com/license
8
 * Contributing: http://tinymce.moxiecode.com/contributing
9
 */
10
11
(function() {
12
	tinymce.create('tinymce.plugins.AdvancedImagePlugin', {
13
		init : function(ed, url) {
14
			// Register commands
15
			ed.addCommand('mceAdvImage', function() {
16
				// Internal image object like a flash placeholder
17
				if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
18
					return;
19
20
				ed.windowManager.open({
21
					file : url + '/image.htm',
22
					width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),
23
					height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),
24
					inline : 1
25
				}, {
26
					plugin_url : url
27
				});
28
			});
29
30
			// Register buttons
31
			ed.addButton('image', {
32
				title : 'advimage.image_desc',
33
				cmd : 'mceAdvImage'
34
			});
35
		},
36
37
		getInfo : function() {
38
			return {
39
				longname : 'Advanced image',
40
				author : 'Moxiecode Systems AB',
41
				authorurl : 'http://tinymce.moxiecode.com',
42
				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
43
				version : tinymce.majorVersion + "." + tinymce.minorVersion
44
			};
45
		}
46
	});
47
48
	// Register plugin
49
	tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin);
50
})();
(-)a/koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage/image.htm (+235 lines)
Line 0 Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<head>
4
	<title>{#advimage_dlg.dialog_title}</title>
5
	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
	<script type="text/javascript" src="../../utils/mctabs.js"></script>
7
	<script type="text/javascript" src="../../utils/form_utils.js"></script>
8
	<script type="text/javascript" src="../../utils/validate.js"></script>
9
	<script type="text/javascript" src="../../utils/editable_selects.js"></script>
10
	<script type="text/javascript" src="js/image.js"></script>
11
	<link href="css/advimage.css" rel="stylesheet" type="text/css" />
12
</head>
13
<body id="advimage" style="display: none" role="application" aria-labelledby="app_title">
14
	<span id="app_title" style="display:none">{#advimage_dlg.dialog_title}</span>
15
	<form onsubmit="ImageDialog.insert();return false;" action="#">
16
		<div class="tabs">
17
			<ul>
18
				<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>
19
				<li id="appearance_tab" aria-controls="appearance_panel"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>
20
				<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>
21
			</ul>
22
		</div>
23
24
		<div class="panel_wrapper">
25
			<div id="general_panel" class="panel current">
26
				<fieldset>
27
						<legend>{#advimage_dlg.general}</legend>
28
29
						<table role="presentation" class="properties">
30
							<tr>
31
								<td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>
32
								<td colspan="2"><table role="presentation" border="0" cellspacing="0" cellpadding="0">
33
									<tr>
34
										<td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" aria-required="true" /></td>
35
										<td id="srcbrowsercontainer">&nbsp;</td>
36
									</tr>
37
								</table></td>
38
							</tr>
39
							<tr>
40
								<td><label for="src_list">{#advimage_dlg.image_list}</label></td>
41
								<td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;ImageDialog.showPreviewImage(this.options[this.selectedIndex].value);"><option value=""></option></select></td>
42
							</tr>
43
							<tr>
44
								<td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td>
45
								<td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
46
							</tr>
47
							<tr>
48
								<td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td>
49
								<td colspan="2"><input id="title" name="title" type="text" value="" /></td>
50
							</tr>
51
						</table>
52
				</fieldset>
53
54
				<fieldset>
55
					<legend>{#advimage_dlg.preview}</legend>
56
					<div id="prev"></div>
57
				</fieldset>
58
			</div>
59
60
			<div id="appearance_panel" class="panel">
61
				<fieldset>
62
					<legend>{#advimage_dlg.tab_appearance}</legend>
63
64
					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
65
						<tr>
66
							<td class="column1"><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td>
67
							<td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();">
68
									<option value="">{#not_set}</option>
69
									<option value="baseline">{#advimage_dlg.align_baseline}</option>
70
									<option value="top">{#advimage_dlg.align_top}</option>
71
									<option value="middle">{#advimage_dlg.align_middle}</option>
72
									<option value="bottom">{#advimage_dlg.align_bottom}</option>
73
									<option value="text-top">{#advimage_dlg.align_texttop}</option>
74
									<option value="text-bottom">{#advimage_dlg.align_textbottom}</option>
75
									<option value="left">{#advimage_dlg.align_left}</option>
76
									<option value="right">{#advimage_dlg.align_right}</option>
77
								</select>
78
							</td>
79
							<td rowspan="6" valign="top">
80
								<div class="alignPreview">
81
									<img id="alignSampleImg" src="img/sample.gif" alt="{#advimage_dlg.example_img}" />
82
									Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam
83
									nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum
84
									edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
85
									erat volutpat.
86
								</div>
87
							</td>
88
						</tr>
89
90
						<tr role="group" aria-labelledby="widthlabel">
91
							<td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>
92
							<td class="nowrap">
93
								<span style="display:none" id="width_voiceLabel">{#advimage_dlg.width}</span>
94
								<input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" aria-labelledby="width_voiceLabel" /> x
95
								<span style="display:none" id="height_voiceLabel">{#advimage_dlg.height}</span>
96
								<input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" aria-labelledby="height_voiceLabel" /> px
97
							</td>
98
						</tr>
99
100
						<tr>
101
							<td>&nbsp;</td>
102
							<td><table role="presentation" border="0" cellpadding="0" cellspacing="0">
103
									<tr>
104
										<td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
105
										<td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td>
106
									</tr>
107
								</table></td>
108
						</tr>
109
110
						<tr>
111
							<td class="column1"><label id="vspacelabel" for="vspace">{#advimage_dlg.vspace}</label></td>
112
							<td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" />
113
							</td>
114
						</tr>
115
116
						<tr>
117
							<td class="column1"><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td>
118
							<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td>
119
						</tr>
120
121
						<tr>
122
							<td class="column1"><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td>
123
							<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td>
124
						</tr>
125
126
						<tr>
127
							<td><label for="class_list">{#class_name}</label></td>
128
							<td colspan="2"><select id="class_list" name="class_list" class="mceEditableSelect"><option value=""></option></select></td>
129
						</tr>
130
131
						<tr>
132
							<td class="column1"><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td>
133
							<td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td>
134
						</tr>
135
136
						<!-- <tr>
137
							<td class="column1"><label id="classeslabel" for="classes">{#advimage_dlg.classes}</label></td>
138
							<td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
139
						</tr> -->
140
					</table>
141
				</fieldset>
142
			</div>
143
144
			<div id="advanced_panel" class="panel">
145
				<fieldset>
146
					<legend>{#advimage_dlg.swap_image}</legend>
147
148
					<input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" aria-controls="onmouseoversrc onmouseoutsrc" />
149
					<label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label>
150
151
					<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
152
							<tr>
153
								<td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td>
154
								<td><table role="presentation" border="0" cellspacing="0" cellpadding="0">
155
									<tr>
156
										<td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td>
157
										<td id="onmouseoversrccontainer">&nbsp;</td>
158
									</tr>
159
								</table></td>
160
							</tr>
161
							<tr>
162
								<td><label for="over_list">{#advimage_dlg.image_list}</label></td>
163
								<td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>
164
							</tr>
165
							<tr>
166
								<td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td>
167
								<td class="column2"><table role="presentation" border="0" cellspacing="0" cellpadding="0">
168
									<tr>
169
										<td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td>
170
										<td id="onmouseoutsrccontainer">&nbsp;</td>
171
									</tr>
172
								</table></td>
173
							</tr>
174
							<tr>
175
								<td><label for="out_list">{#advimage_dlg.image_list}</label></td>
176
								<td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>
177
							</tr>
178
					</table>
179
				</fieldset>
180
181
				<fieldset>
182
					<legend>{#advimage_dlg.misc}</legend>
183
184
					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
185
						<tr>
186
							<td class="column1"><label id="idlabel" for="id">{#advimage_dlg.id}</label></td>
187
							<td><input id="id" name="id" type="text" value="" /></td>
188
						</tr>
189
190
						<tr>
191
							<td class="column1"><label id="dirlabel" for="dir">{#advimage_dlg.langdir}</label></td>
192
							<td>
193
								<select id="dir" name="dir" onchange="ImageDialog.changeAppearance();">
194
										<option value="">{#not_set}</option>
195
										<option value="ltr">{#advimage_dlg.ltr}</option>
196
										<option value="rtl">{#advimage_dlg.rtl}</option>
197
								</select>
198
							</td>
199
						</tr>
200
201
						<tr>
202
							<td class="column1"><label id="langlabel" for="lang">{#advimage_dlg.langcode}</label></td>
203
							<td>
204
								<input id="lang" name="lang" type="text" value="" />
205
							</td>
206
						</tr>
207
208
						<tr>
209
							<td class="column1"><label id="usemaplabel" for="usemap">{#advimage_dlg.map}</label></td>
210
							<td>
211
								<input id="usemap" name="usemap" type="text" value="" />
212
							</td>
213
						</tr>
214
215
						<tr>
216
							<td class="column1"><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td>
217
							<td><table role="presentation" border="0" cellspacing="0" cellpadding="0">
218
									<tr>
219
										<td><input id="longdesc" name="longdesc" type="text" value="" /></td>
220
										<td id="longdesccontainer">&nbsp;</td>
221
									</tr>
222
							</table></td>
223
						</tr>
224
					</table>
225
				</fieldset>
226
			</div>
227
		</div>
228
229
		<div class="mceActionPanel">
230
			<input type="submit" id="insert" name="insert" value="{#insert}" />
231
			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
232
		</div>
233
	</form>
234
</body>
235
</html>
(-)a/koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage/js/image.js (+464 lines)
Line 0 Link Here
1
var ImageDialog = {
2
	preInit : function() {
3
		var url;
4
5
		tinyMCEPopup.requireLangPack();
6
7
		if (url = tinyMCEPopup.getParam("external_image_list_url"))
8
			document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
9
	},
10
11
	init : function(ed) {
12
		var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList');
13
14
		tinyMCEPopup.resizeToInnerSize();
15
		this.fillClassList('class_list');
16
		this.fillFileList('src_list', fl);
17
		this.fillFileList('over_list', fl);
18
		this.fillFileList('out_list', fl);
19
		TinyMCE_EditableSelects.init();
20
21
		if (n.nodeName == 'IMG') {
22
			nl.src.value = dom.getAttrib(n, 'src');
23
			nl.width.value = dom.getAttrib(n, 'width');
24
			nl.height.value = dom.getAttrib(n, 'height');
25
			nl.alt.value = dom.getAttrib(n, 'alt');
26
			nl.title.value = dom.getAttrib(n, 'title');
27
			nl.vspace.value = this.getAttrib(n, 'vspace');
28
			nl.hspace.value = this.getAttrib(n, 'hspace');
29
			nl.border.value = this.getAttrib(n, 'border');
30
			selectByValue(f, 'align', this.getAttrib(n, 'align'));
31
			selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);
32
			nl.style.value = dom.getAttrib(n, 'style');
33
			nl.id.value = dom.getAttrib(n, 'id');
34
			nl.dir.value = dom.getAttrib(n, 'dir');
35
			nl.lang.value = dom.getAttrib(n, 'lang');
36
			nl.usemap.value = dom.getAttrib(n, 'usemap');
37
			nl.longdesc.value = dom.getAttrib(n, 'longdesc');
38
			nl.insert.value = ed.getLang('update');
39
40
			if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))
41
				nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
42
43
			if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))
44
				nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
45
46
			if (ed.settings.inline_styles) {
47
				// Move attribs to styles
48
				if (dom.getAttrib(n, 'align'))
49
					this.updateStyle('align');
50
51
				if (dom.getAttrib(n, 'hspace'))
52
					this.updateStyle('hspace');
53
54
				if (dom.getAttrib(n, 'border'))
55
					this.updateStyle('border');
56
57
				if (dom.getAttrib(n, 'vspace'))
58
					this.updateStyle('vspace');
59
			}
60
		}
61
62
		// Setup browse button
63
		document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
64
		if (isVisible('srcbrowser'))
65
			document.getElementById('src').style.width = '260px';
66
67
		// Setup browse button
68
		document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');
69
		if (isVisible('overbrowser'))
70
			document.getElementById('onmouseoversrc').style.width = '260px';
71
72
		// Setup browse button
73
		document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');
74
		if (isVisible('outbrowser'))
75
			document.getElementById('onmouseoutsrc').style.width = '260px';
76
77
		// If option enabled default contrain proportions to checked
78
		if (ed.getParam("advimage_constrain_proportions", true))
79
			f.constrain.checked = true;
80
81
		// Check swap image if valid data
82
		if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)
83
			this.setSwapImage(true);
84
		else
85
			this.setSwapImage(false);
86
87
		this.changeAppearance();
88
		this.showPreviewImage(nl.src.value, 1);
89
	},
90
91
	insert : function(file, title) {
92
		var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
93
94
		if (f.src.value === '') {
95
			if (ed.selection.getNode().nodeName == 'IMG') {
96
				ed.dom.remove(ed.selection.getNode());
97
				ed.execCommand('mceRepaint');
98
			}
99
100
			tinyMCEPopup.close();
101
			return;
102
		}
103
104
		if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
105
			if (!f.alt.value) {
106
				tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {
107
					if (s)
108
						t.insertAndClose();
109
				});
110
111
				return;
112
			}
113
		}
114
115
		t.insertAndClose();
116
	},
117
118
	insertAndClose : function() {
119
		var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
120
121
		tinyMCEPopup.restoreSelection();
122
123
		// Fixes crash in Safari
124
		if (tinymce.isWebKit)
125
			ed.getWin().focus();
126
127
		if (!ed.settings.inline_styles) {
128
			args = {
129
				vspace : nl.vspace.value,
130
				hspace : nl.hspace.value,
131
				border : nl.border.value,
132
				align : getSelectValue(f, 'align')
133
			};
134
		} else {
135
			// Remove deprecated values
136
			args = {
137
				vspace : '',
138
				hspace : '',
139
				border : '',
140
				align : ''
141
			};
142
		}
143
144
		tinymce.extend(args, {
145
			src : nl.src.value.replace(/ /g, '%20'),
146
			width : nl.width.value,
147
			height : nl.height.value,
148
			alt : nl.alt.value,
149
			title : nl.title.value,
150
			'class' : getSelectValue(f, 'class_list'),
151
			style : nl.style.value,
152
			id : nl.id.value,
153
			dir : nl.dir.value,
154
			lang : nl.lang.value,
155
			usemap : nl.usemap.value,
156
			longdesc : nl.longdesc.value
157
		});
158
159
		args.onmouseover = args.onmouseout = '';
160
161
		if (f.onmousemovecheck.checked) {
162
			if (nl.onmouseoversrc.value)
163
				args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";
164
165
			if (nl.onmouseoutsrc.value)
166
				args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";
167
		}
168
169
		el = ed.selection.getNode();
170
171
		if (el && el.nodeName == 'IMG') {
172
			ed.dom.setAttribs(el, args);
173
		} else {
174
			tinymce.each(args, function(value, name) {
175
				if (value === "") {
176
					delete args[name];
177
				}
178
			});
179
180
			ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
181
			ed.undoManager.add();
182
		}
183
184
		tinyMCEPopup.editor.execCommand('mceRepaint');
185
		tinyMCEPopup.editor.focus();
186
		tinyMCEPopup.close();
187
	},
188
189
	getAttrib : function(e, at) {
190
		var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
191
192
		if (ed.settings.inline_styles) {
193
			switch (at) {
194
				case 'align':
195
					if (v = dom.getStyle(e, 'float'))
196
						return v;
197
198
					if (v = dom.getStyle(e, 'vertical-align'))
199
						return v;
200
201
					break;
202
203
				case 'hspace':
204
					v = dom.getStyle(e, 'margin-left')
205
					v2 = dom.getStyle(e, 'margin-right');
206
207
					if (v && v == v2)
208
						return parseInt(v.replace(/[^0-9]/g, ''));
209
210
					break;
211
212
				case 'vspace':
213
					v = dom.getStyle(e, 'margin-top')
214
					v2 = dom.getStyle(e, 'margin-bottom');
215
					if (v && v == v2)
216
						return parseInt(v.replace(/[^0-9]/g, ''));
217
218
					break;
219
220
				case 'border':
221
					v = 0;
222
223
					tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
224
						sv = dom.getStyle(e, 'border-' + sv + '-width');
225
226
						// False or not the same as prev
227
						if (!sv || (sv != v && v !== 0)) {
228
							v = 0;
229
							return false;
230
						}
231
232
						if (sv)
233
							v = sv;
234
					});
235
236
					if (v)
237
						return parseInt(v.replace(/[^0-9]/g, ''));
238
239
					break;
240
			}
241
		}
242
243
		if (v = dom.getAttrib(e, at))
244
			return v;
245
246
		return '';
247
	},
248
249
	setSwapImage : function(st) {
250
		var f = document.forms[0];
251
252
		f.onmousemovecheck.checked = st;
253
		setBrowserDisabled('overbrowser', !st);
254
		setBrowserDisabled('outbrowser', !st);
255
256
		if (f.over_list)
257
			f.over_list.disabled = !st;
258
259
		if (f.out_list)
260
			f.out_list.disabled = !st;
261
262
		f.onmouseoversrc.disabled = !st;
263
		f.onmouseoutsrc.disabled  = !st;
264
	},
265
266
	fillClassList : function(id) {
267
		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
268
269
		if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
270
			cl = [];
271
272
			tinymce.each(v.split(';'), function(v) {
273
				var p = v.split('=');
274
275
				cl.push({'title' : p[0], 'class' : p[1]});
276
			});
277
		} else
278
			cl = tinyMCEPopup.editor.dom.getClasses();
279
280
		if (cl.length > 0) {
281
			lst.options.length = 0;
282
			lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
283
284
			tinymce.each(cl, function(o) {
285
				lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
286
			});
287
		} else
288
			dom.remove(dom.getParent(id, 'tr'));
289
	},
290
291
	fillFileList : function(id, l) {
292
		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
293
294
		l = typeof(l) === 'function' ? l() : window[l];
295
		lst.options.length = 0;
296
297
		if (l && l.length > 0) {
298
			lst.options[lst.options.length] = new Option('', '');
299
300
			tinymce.each(l, function(o) {
301
				lst.options[lst.options.length] = new Option(o[0], o[1]);
302
			});
303
		} else
304
			dom.remove(dom.getParent(id, 'tr'));
305
	},
306
307
	resetImageData : function() {
308
		var f = document.forms[0];
309
310
		f.elements.width.value = f.elements.height.value = '';
311
	},
312
313
	updateImageData : function(img, st) {
314
		var f = document.forms[0];
315
316
		if (!st) {
317
			f.elements.width.value = img.width;
318
			f.elements.height.value = img.height;
319
		}
320
321
		this.preloadImg = img;
322
	},
323
324
	changeAppearance : function() {
325
		var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');
326
327
		if (img) {
328
			if (ed.getParam('inline_styles')) {
329
				ed.dom.setAttrib(img, 'style', f.style.value);
330
			} else {
331
				img.align = f.align.value;
332
				img.border = f.border.value;
333
				img.hspace = f.hspace.value;
334
				img.vspace = f.vspace.value;
335
			}
336
		}
337
	},
338
339
	changeHeight : function() {
340
		var f = document.forms[0], tp, t = this;
341
342
		if (!f.constrain.checked || !t.preloadImg) {
343
			return;
344
		}
345
346
		if (f.width.value == "" || f.height.value == "")
347
			return;
348
349
		tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;
350
		f.height.value = tp.toFixed(0);
351
	},
352
353
	changeWidth : function() {
354
		var f = document.forms[0], tp, t = this;
355
356
		if (!f.constrain.checked || !t.preloadImg) {
357
			return;
358
		}
359
360
		if (f.width.value == "" || f.height.value == "")
361
			return;
362
363
		tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;
364
		f.width.value = tp.toFixed(0);
365
	},
366
367
	updateStyle : function(ty) {
368
		var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});
369
370
		if (tinyMCEPopup.editor.settings.inline_styles) {
371
			// Handle align
372
			if (ty == 'align') {
373
				dom.setStyle(img, 'float', '');
374
				dom.setStyle(img, 'vertical-align', '');
375
376
				v = getSelectValue(f, 'align');
377
				if (v) {
378
					if (v == 'left' || v == 'right')
379
						dom.setStyle(img, 'float', v);
380
					else
381
						img.style.verticalAlign = v;
382
				}
383
			}
384
385
			// Handle border
386
			if (ty == 'border') {
387
				b = img.style.border ? img.style.border.split(' ') : [];
388
				bStyle = dom.getStyle(img, 'border-style');
389
				bColor = dom.getStyle(img, 'border-color');
390
391
				dom.setStyle(img, 'border', '');
392
393
				v = f.border.value;
394
				if (v || v == '0') {
395
					if (v == '0')
396
						img.style.border = isIE ? '0' : '0 none none';
397
					else {
398
						var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9);
399
400
						if (b.length == 3 && b[isOldIE ? 2 : 1])
401
							bStyle = b[isOldIE ? 2 : 1];
402
						else if (!bStyle || bStyle == 'none')
403
							bStyle = 'solid';
404
						if (b.length == 3 && b[isIE ? 0 : 2])
405
							bColor = b[isOldIE ? 0 : 2];
406
						else if (!bColor || bColor == 'none')
407
							bColor = 'black';
408
						img.style.border = v + 'px ' + bStyle + ' ' + bColor;
409
					}
410
				}
411
			}
412
413
			// Handle hspace
414
			if (ty == 'hspace') {
415
				dom.setStyle(img, 'marginLeft', '');
416
				dom.setStyle(img, 'marginRight', '');
417
418
				v = f.hspace.value;
419
				if (v) {
420
					img.style.marginLeft = v + 'px';
421
					img.style.marginRight = v + 'px';
422
				}
423
			}
424
425
			// Handle vspace
426
			if (ty == 'vspace') {
427
				dom.setStyle(img, 'marginTop', '');
428
				dom.setStyle(img, 'marginBottom', '');
429
430
				v = f.vspace.value;
431
				if (v) {
432
					img.style.marginTop = v + 'px';
433
					img.style.marginBottom = v + 'px';
434
				}
435
			}
436
437
			// Merge
438
			dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText), 'img');
439
		}
440
	},
441
442
	changeMouseMove : function() {
443
	},
444
445
	showPreviewImage : function(u, st) {
446
		if (!u) {
447
			tinyMCEPopup.dom.setHTML('prev', '');
448
			return;
449
		}
450
451
		if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
452
			this.resetImageData();
453
454
		u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
455
456
		if (!st)
457
			tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
458
		else
459
			tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
460
	}
461
};
462
463
ImageDialog.preInit();
464
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
(-)a/koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage/langs/en_dlg.js (+1 lines)
Line 0 Link Here
1
tinyMCE.addI18n('en.advimage_dlg',{"image_list":"Image List","align_right":"Right","align_left":"Left","align_textbottom":"Text Bottom","align_texttop":"Text Top","align_bottom":"Bottom","align_middle":"Middle","align_top":"Top","align_baseline":"Baseline",align:"Alignment",hspace:"Horizontal Space",vspace:"Vertical Space",dimensions:"Dimensions",border:"Border",list:"Image List",alt:"Image Description",src:"Image URL","dialog_title":"Insert/Edit Image","missing_alt":"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.","example_img":"Appearance Preview Image",misc:"Miscellaneous",mouseout:"For Mouse Out",mouseover:"For Mouse Over","alt_image":"Alternative Image","swap_image":"Swap Image",map:"Image Map",id:"ID",rtl:"Right to Left",ltr:"Left to Right",classes:"Classes",style:"Style","long_desc":"Long Description Link",langcode:"Language Code",langdir:"Language Direction","constrain_proportions":"Constrain Proportions",preview:"Preview",title:"Title",general:"General","tab_advanced":"Advanced","tab_appearance":"Appearance","tab_general":"General",width:"Width",height:"Height"});
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc (+61 lines)
Line 0 Link Here
1
[% #Enable tinymce for system preferences %]
2
<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script>
3
<script>
4
5
[%# Save TinyMCE content and trigger an event on the original element %]
6
function wysiwyg_change (ed){
7
    ed.save();
8
    var original_textarea = ed.getElement();
9
    $(original_textarea).trigger("input");
10
}
11
12
tinyMCE.init({
13
    setup : function(ed) {
14
        ed.onInit.add(function(editor){
15
            [%-
16
            #Ideally, it would be nice just to use the "oninput" event, which captures keyboard input, dragging, pasting, etc.
17
            #However, it doesn't work in IE when the event listener is for an element which is "contenteditable". Since TinyMCE
18
            #uses a "contenteditable" body element in an iframe element, it's never going to fire in IE.
19
20
            #We can get around this a bit by using "onkeyup" and "ondragend".
21
22
            #"ondragend" occurs after you drag content within the editor. "ondrop" is for when you drag content from outside the
23
            #editor but it doesn't "dirty" the editor, which makes it useless, as the editor won't save unless it's dirty.
24
            #"onpaste" is useless in this same way.
25
26
            #Reference:
27
            #https://developer.mozilla.org/en-US/docs/Web/Events/input
28
            #https://connect.microsoft.com/IE/feedbackdetail/view/794285
29
            -%]
30
31
            tinyMCE.dom.Event.bind(editor.getBody(), 'input keyup dragend', function(e){
32
                if (ed.isDirty()){
33
                    wysiwyg_change(ed);
34
                }
35
            });
36
        });
37
38
        // Register change when TinyMCE command returns isDirty()
39
        ed.onExecCommand.add(function(ed, cmd, ui, val) {
40
            if (ed.isDirty()){
41
                wysiwyg_change(ed);
42
            }
43
        });
44
45
    },
46
    mode : "specific_textareas",
47
    editor_selector : "mce",
48
    theme : "advanced",
49
    content_css : "[% themelang %]/css/tinymce.css",
50
    plugins : "table,save,advhr,advlink,contextmenu,advimage",
51
    theme_advanced_buttons1 : "bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,image,link,unlink,anchor,cleanup,help,code,advhr,",
52
    theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap|,forecolor,backcolor",
53
    theme_advanced_buttons3 : "",
54
    theme_advanced_toolbar_location : "top",
55
    theme_advanced_toolbar_align : "left",
56
    theme_advanced_path_location : "bottom",
57
    theme_advanced_resizing : true,
58
    apply_source_formatting : true
59
});
60
//]]>
61
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (+4 lines)
Lines 46-51 Link Here
46
<script src="[% interface %]/lib/jquery/plugins/humanmsg.js" type="text/javascript"></script>
46
<script src="[% interface %]/lib/jquery/plugins/humanmsg.js" type="text/javascript"></script>
47
<script src="[% themelang %]/js/ajax.js" type="text/javascript"></script>
47
<script src="[% themelang %]/js/ajax.js" type="text/javascript"></script>
48
<script src="[% themelang %]/js/pages/preferences.js" type="text/javascript"></script>
48
<script src="[% themelang %]/js/pages/preferences.js" type="text/javascript"></script>
49
[%# Add WYSIWYG editor for htmlarea system preferences %]
50
[% INCLUDE 'wysiwyg-systempreferences.inc' %]
49
</head>
51
</head>
50
<body id="admin_preferences" class="admin">
52
<body id="admin_preferences" class="admin">
51
[% INCLUDE 'header.inc' %]
53
[% INCLUDE 'header.inc' %]
Lines 135-140 Link Here
135
                    [% ELSIF ( CHUNK.type_textarea ) %]
137
                    [% ELSIF ( CHUNK.type_textarea ) %]
136
					<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
138
					<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
137
					<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
139
					<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
140
                    [% ELSIF ( CHUNK.type_htmlarea ) %]
141
					<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %] mce" rows="20" cols="60">[% CHUNK.value %]</textarea>
138
                    [% ELSIF ( CHUNK.type_languages ) %]
142
                    [% ELSIF ( CHUNK.type_languages ) %]
139
                    <dl>
143
                    <dl>
140
                    [% FOREACH language IN CHUNK.languages %]
144
                    [% FOREACH language IN CHUNK.languages %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt (-2 / +8 lines)
Lines 2-7 Link Here
2
<title>Koha &rsaquo; Administration &rsaquo; [% IF ( add_form ) %] System preferences &rsaquo; [% IF ( modify ) %]Modify system preference '[% searchfield %]'[% ELSE %]Add a system preference[% END %][% END %][% IF ( add_validate ) %] System preferences &rsaquo; Data added[% END %]
2
<title>Koha &rsaquo; Administration &rsaquo; [% IF ( add_form ) %] System preferences &rsaquo; [% IF ( modify ) %]Modify system preference '[% searchfield %]'[% ELSE %]Add a system preference[% END %][% END %][% IF ( add_validate ) %] System preferences &rsaquo; Data added[% END %]
3
[% IF ( delete_confirm ) %] System preferences &rsaquo; [% searchfield %] &rsaquo; Confirm deletion of parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System preferences &rsaquo; Parameter deleted[% END %][% IF ( else ) %]System preferences[% END %]</title>
3
[% IF ( delete_confirm ) %] System preferences &rsaquo; [% searchfield %] &rsaquo; Confirm deletion of parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System preferences &rsaquo; Parameter deleted[% END %][% IF ( else ) %]System preferences[% END %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
[%# Add WYSIWYG editor for htmlarea system preferences %]
6
[% INCLUDE 'wysiwyg-systempreferences.inc' %]
5
[% IF ( else ) %]
7
[% IF ( else ) %]
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'datatables.inc' %]
Lines 108-113 Link Here
108
                    <textarea id="value" name="value" cols="[% fieldlength %]">[% value |html %]</textarea>
110
                    <textarea id="value" name="value" cols="[% fieldlength %]">[% value |html %]</textarea>
109
                [% ELSIF ( type_upload ) %]
111
                [% ELSIF ( type_upload ) %]
110
                    <input type="file" name="value" />
112
                    <input type="file" name="value" />
113
                [% ELSIF ( type_htmlarea ) %]
114
                    <textarea class="mce" name="value" id="value" rows="[% rows %]" cols="[% cols %]">[% value |html %]</textarea>
111
                [% ELSIF ( type_textarea ) %]
115
                [% ELSIF ( type_textarea ) %]
112
                    <textarea name="value" id="value" rows="[% rows %]" cols="[% cols %]">[% value |html %]</textarea>
116
                    <textarea name="value" id="value" rows="[% rows %]" cols="[% cols %]">[% value |html %]</textarea>
113
                [% ELSIF ( type_choice ) %]
117
                [% ELSIF ( type_choice ) %]
Lines 200-206 Link Here
200
        <div class="hint">Note: you should have no reasons to modify the following default values</div>
204
        <div class="hint">Note: you should have no reasons to modify the following default values</div>
201
        <ol>
205
        <ol>
202
        <li><label for="preftype">Variable type:</label>
206
        <li><label for="preftype">Variable type:</label>
203
        <div class="hint"> (<span class="variabletype" id="Free">Free</span>, <span class="variabletype" id="Choice">Choice</span>, <span class="variabletype" id="YesNo">YesNo</span>, <span class="variabletype" id="Integer">Integer</span>, <span class="variabletype" id="Textarea">Textarea</span>, <span class="variabletype" id="Float">Float</span>, <span class="variabletype" id="Themes">Themes</span>, <span class="variabletype" id="Languages">Languages</span>, <span class="variabletype" id="Upload">Upload</span> or <span class="variabletype" id="ClassSources">ClassSources</span>)</div>
207
        <div class="hint"> (<span class="variabletype" id="Free">Free</span>, <span class="variabletype" id="Choice">Choice</span>, <span class="variabletype" id="YesNo">YesNo</span>, <span class="variabletype" id="Integer">Integer</span>, <span class="variabletype" id="Textarea">Textarea</span>, <span class="variabletype" id="Htmlarea">Htmlarea</span>, <span class="variabletype" id="Float">Float</span>, <span class="variabletype" id="Themes">Themes</span>, <span class="variabletype" id="Languages">Languages</span>, <span class="variabletype" id="Upload">Upload</span> or <span class="variabletype" id="ClassSources">ClassSources</span>)</div>
204
        <input type="text" name="preftype" id="preftype" value="[% preftype %]" size="40" maxlength="40" /></li>
208
        <input type="text" name="preftype" id="preftype" value="[% preftype %]" size="40" maxlength="40" /></li>
205
        <li><label for="prefoptions">Variable options:</label>
209
        <li><label for="prefoptions">Variable options:</label>
206
        <div class="hint">(a choice list for choice (separated by |) or cols|rows for texarea)</div>
210
        <div class="hint">(a choice list for choice (separated by |) or cols|rows for texarea)</div>
Lines 287-292 Link Here
287
                <a class="expand-textarea" style="display: none" href="#">Click to edit</a>
291
                <a class="expand-textarea" style="display: none" href="#">Click to edit</a>
288
                <textarea name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
292
                <textarea name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
289
                [% END %]
293
                [% END %]
294
                [% IF ( loo.type_htmlarea ) %]
295
                <textarea class="mce" name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
296
                [% END %]
290
                [% IF ( loo.type_choice ) %]
297
                [% IF ( loo.type_choice ) %]
291
                <select name="value">
298
                <select name="value">
292
                    [% FOREACH option IN loo.options %]
299
                    [% FOREACH option IN loo.options %]
293
- 

Return to bug 11584