summaryrefslogtreecommitdiff
path: root/lib/viewers/odf/editor/widgets/dialogWidgets
diff options
context:
space:
mode:
Diffstat (limited to 'lib/viewers/odf/editor/widgets/dialogWidgets')
-rw-r--r--lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.html20
-rw-r--r--lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.js57
-rw-r--r--lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.html30
-rw-r--r--lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.js103
-rw-r--r--lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.html24
-rw-r--r--lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.js45
6 files changed, 190 insertions, 89 deletions
diff --git a/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.html b/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.html
index 8829fa5..56d9dea 100644
--- a/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.html
+++ b/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.html
@@ -4,22 +4,22 @@
<body>
<div data-dojo-type="dijit/form/Form" id="alignmentPaneForm" data-dojo-id="alignmentPaneForm">
- <h3 text-i18n="options">Options</h3>
+ <h3 text-i18n="Options">Options</h3>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioLeft" checked value="left"/>
- <label text-i18n="left" for="radioLeft">Left</label> <br/>
+ <label text-i18n="Left" for="radioLeft"></label> <br/>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioCenter" value="center"/>
- <label text-i18n="center" for="radioCenter">Center</label> <br/>
+ <label text-i18n="Center" for="radioCenter"></label> <br/>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioRight" value="right"/>
- <label text-i18n="right" for="radioRight">Right</label> <br/>
+ <label text-i18n="Right" for="radioRight"></label> <br/>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioJustified" value="justify"/>
- <label text-i18n="justified" for="radioJustified">Justified</label> <br/>
+ <label text-i18n="Justified" for="radioJustified"></label> <br/>
- <h3><span text-i18n="spacing">Spacing</span> <small>(mm)</small></h3>
+ <h3><span text-i18n="Spacing"></span> <small>(mm)</small></h3>
<div style = "margin-top: 10px;">
<div style = "float: right; margin-right: 200px;">
- <label text-i18n="top" for="topMargin">Top</label>
+ <label text-i18n="Top" for="topMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="topMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
@@ -28,7 +28,7 @@
</div>
<br><br>
<div style = "float: left;">
- <label text-i18n="left" for="leftMargin">Left</label>
+ <label text-i18n="Left" for="leftMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="leftMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
@@ -36,7 +36,7 @@
/>
</div>
<div style = "float: right; margin-right: 50px;">
- <label text-i18n="right" for="rightMargin">Right</label>
+ <label text-i18n="Right" for="rightMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="rightMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
@@ -45,7 +45,7 @@
</div>
<br/><br>
<div style = "float: right; margin-right: 200px;">
- <label text-i18n="bottom" for="bottomMargin">Bottom</label>
+ <label text-i18n="Bottom" for="bottomMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="bottomMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
diff --git a/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.js b/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.js
index 5cb79e5..e17d1cf 100644
--- a/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.js
+++ b/lib/viewers/odf/editor/widgets/dialogWidgets/alignmentPane.js
@@ -1,47 +1,34 @@
/**
- * @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
- * The JavaScript code in this page is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Affero General Public License
- * (GNU AGPL) as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version. The code is distributed
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+ * This file is part of WebODF.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this code. If not, see <http://www.gnu.org/licenses/>.
- *
- * As additional permission under GNU AGPL version 3 section 7, you
- * may distribute non-source (e.g., minimized or compacted) forms of
- * that code without the copy of the GNU GPL normally required by
- * section 4, provided you include this license notice and a URL
- * through which recipients can access the Corresponding Source.
+ * WebODF is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
*
- * As a special exception to the AGPL, any HTML file which merely makes function
- * calls to this code, and for that purpose includes it by reference shall be
- * deemed a separate work for copyright law purposes. In addition, the copyright
- * holders of this code give you permission to combine this code with free
- * software libraries that are released under the GNU LGPL. You may copy and
- * distribute such a system following the terms of the GNU AGPL for this code
- * and the LGPL for the libraries. If you modify this code, you may extend this
- * exception to your version of the code, but you are not obligated to do so.
- * If you do not wish to do so, delete this exception statement from your
- * version.
+ * WebODF 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 Affero General Public License for more details.
*
- * This license applies to this entire compilation.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
+ *
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
-/*global runtime,core,define,require,document,dijit */
-
-runtime.loadClass("core.CSSUnits");
+/*global runtime,core,define,require,dijit */
define("webodf/editor/widgets/dialogWidgets/alignmentPane", [], function () {
"use strict";
+
+ runtime.loadClass("core.CSSUnits");
+
var AlignmentPane = function (callback) {
var self = this,
editorSession,
@@ -66,10 +53,10 @@ define("webodf/editor/widgets/dialogWidgets/alignmentPane", [], function () {
s_textAlign;
if (style !== undefined) {
- s_topMargin = parseFloat(cssUnits.convertMeasure(style['fo:margin-top'], 'mm'));
- s_leftMargin = parseFloat(cssUnits.convertMeasure(style['fo:margin-left'], 'mm'));
- s_rightMargin = parseFloat(cssUnits.convertMeasure(style['fo:margin-right'], 'mm'));
- s_bottomMargin = parseFloat(cssUnits.convertMeasure(style['fo:margin-bottom'], 'mm'));
+ s_topMargin = cssUnits.convertMeasure(style['fo:margin-top'], 'mm');
+ s_leftMargin = cssUnits.convertMeasure(style['fo:margin-left'], 'mm');
+ s_rightMargin = cssUnits.convertMeasure(style['fo:margin-right'], 'mm');
+ s_bottomMargin = cssUnits.convertMeasure(style['fo:margin-bottom'], 'mm');
s_textAlign = style['fo:text-align'];
form.attr('value', {
@@ -106,13 +93,13 @@ define("webodf/editor/widgets/dialogWidgets/alignmentPane", [], function () {
runtime.assert(editorBase, "webodf/editor path not defined in dojoConfig");
ready(function () {
contentPane = new ContentPane({
- title: document.translator("alignment"),
+ title: runtime.tr("Alignment"),
href: editorBase+"/widgets/dialogWidgets/alignmentPane.html",
preload: true
});
contentPane.onLoad = function () {
form = dijit.byId('alignmentPaneForm');
- document.translateContent(form.domNode);
+ runtime.translateContent(form.domNode);
};
return cb();
});
diff --git a/lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.html b/lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.html
new file mode 100644
index 0000000..49bb1fa
--- /dev/null
+++ b/lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.html
@@ -0,0 +1,30 @@
+<html>
+ <head></head>
+ <body>
+ <div data-dojo-type="dijit/form/Form" id="editHyperlinkPaneForm" data-dojo-id="editHyperlinkPaneForm">
+ <div>
+ <label text-i18n="Display Text" for="linkDisplayText"></label><br/>
+ <input data-dojo-type="dijit/form/TextBox" id="linkDisplayText"
+ value=""
+ data-dojo-props="trim:true"
+ name="linkDisplayText" />
+ <input data-dojo-type="dijit/form/TextBox" id="isReadOnlyText"
+ type ="hidden"
+ value=""
+ data-dojo-props="trim:true"
+ name="isReadOnlyText" />
+ </div>
+ <div>
+ <label text-i18n="URL" for="linkUrl"></label><br/>
+ <input data-dojo-type="dijit/form/TextBox" id="linkUrl"
+ value="http://"
+ data-dojo-props="trim:true, intermediateChanges:true"
+ name="linkUrl" />
+ </div>
+ <div>
+ <button data-dojo-type="dijit/form/Button" id="saveHyperlinkChangeButton" type="submit">Ok</button>
+ <button data-dojo-type="dijit/form/Button" id="cancelHyperlinkChangeButton" data-dojo-id="cancelHyperlinkChangeButton">Cancel</button>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.js b/lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.js
new file mode 100644
index 0000000..6037828
--- /dev/null
+++ b/lib/viewers/odf/editor/widgets/dialogWidgets/editHyperlinkPane.js
@@ -0,0 +1,103 @@
+/**
+ * Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
+ *
+ * @licstart
+ * This file is part of WebODF.
+ *
+ * WebODF is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * WebODF 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with WebODF. If not, see <http://www.gnu.org/licenses/>.
+ * @licend
+ *
+ * @source: http://www.webodf.org/
+ * @source: https://github.com/kogmbh/WebODF/
+ */
+
+/*global runtime,core,define,require,document,dijit */
+
+define("webodf/editor/widgets/dialogWidgets/editHyperlinkPane", [
+ "dojo",
+ "dijit/layout/ContentPane"],
+
+ function (dojo, ContentPane) {
+ "use strict";
+
+ runtime.loadClass("core.CSSUnits");
+
+ var EditHyperlinkPane = function () {
+ var self = this,
+ editorBase = dojo.config && dojo.config.paths && dojo.config.paths['webodf/editor'],
+ contentPane,
+ form,
+ displayTextField,
+ linkField,
+ initialValue;
+
+ runtime.assert(editorBase, "webodf/editor path not defined in dojoConfig");
+
+ function onSave() {
+ if (self.onSave) {
+ self.onSave();
+ }
+ return false;
+ }
+
+ function onCancel() {
+ form.set('value', initialValue);
+ if (self.onCancel) {
+ self.onCancel();
+ }
+ }
+
+ contentPane = new ContentPane({
+ title: runtime.tr("editLink"),
+ href: editorBase+"/widgets/dialogWidgets/editHyperlinkPane.html",
+ preload: true,
+ onLoad : function () {
+ form = dijit.byId('editHyperlinkPaneForm');
+ form.onSubmit = onSave;
+ dijit.byId('cancelHyperlinkChangeButton').onClick = onCancel;
+ displayTextField = dijit.byId('linkDisplayText');
+ linkField = dijit.byId('linkUrl');
+ linkField.on("change", function(value) {
+ displayTextField.set('placeHolder', value);
+ });
+
+ runtime.translateContent(form.domNode);
+ if (initialValue) {
+ form.set('value', initialValue);
+ displayTextField.set('disabled', initialValue.isReadOnlyText);
+ initialValue = undefined;
+ }
+ displayTextField.set('placeHolder', linkField.value);
+ }
+ });
+
+ this.widget = function () {
+ return contentPane;
+ };
+
+ this.value = function () {
+ return form && form.get('value');
+ };
+
+ this.set = function (value) {
+ initialValue = value;
+ if (form) {
+ form.set('value', value);
+ displayTextField.set('disabled', value.isReadOnlyText);
+ }
+ };
+ };
+
+ return EditHyperlinkPane;
+});
diff --git a/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.html b/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.html
index 5a0c899..4978583 100644
--- a/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.html
+++ b/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.html
@@ -4,23 +4,23 @@
<body>
<div data-dojo-type="dijit/form/Form" id="fontEffectsPaneForm" data-dojo-id="fontEffectsPaneForm">
- <h3 text-i18n="style">Style</h3>
+ <h3 text-i18n="Style"></h3>
<input data-dojo-type="dijit/form/CheckBox" name="textStyle" id="radioBold" value="bold"/>
- <label text-i18n="bold" for="radioBold">Bold</label> <br/>
+ <label text-i18n="Bold" for="radioBold"></label> <br/>
<input data-dojo-type="dijit/form/CheckBox" name="textStyle" id="radioItalic" value="italic"/>
- <label text-i18n="italic" for="radioItalic">Italic</label> <br/>
+ <label text-i18n="Italic" for="radioItalic"></label> <br/>
<input data-dojo-type="dijit/form/CheckBox" name="textStyle" id="radioUnderline" value="underline"/>
- <label text-i18n="underline" for="radioUnderline">Underline</label> <br/>
+ <label text-i18n="Underline" for="radioUnderline"></label> <br/>
- <h3 text-i18n="font">Font</h3>
+ <h3 text-i18n="Font"></h3>
<br>
<div id = 'fontPicker' class="labeledSelect" style = "float: left;">
- <label text-i18n="family" for="fontName">Family:</label>
+ <label text-i18n="Family" for="fontName"></label>
</div>
<div style = "float: left; margin-left: 30px;">
- <label for="fontSize"><span text-i18n="size">Size</span> (pt) </label>
+ <label for="fontSize"><span text-i18n="Size"></span> (pt) </label>
<input data-dojo-type="dijit/form/NumberSpinner" id="fontSize"
value="12"
data-dojo-props="smallDelta:1, constraints:{min:6,max:96}"
@@ -29,13 +29,11 @@
</div>
<br /><br />
- <h3 text-i18n="color">Color</h3>
+ <h3 text-i18n="Color"></h3>
<br>
<input data-dojo-type="dijit/form/TextBox" name = "color" id = "textColorTB" style="display: none;"/>
<div data-dojo-type="dijit/form/DropDownButton">
- <span><span text-i18n="text" id = "textColor">
- Text
- </span></span>
+ <span><span text-i18n="Text" id = "textColor"></span></span>
<div data-dojo-type="dijit/TooltipDialog">
<div data-dojo-type="dojox.widget.ColorPicker" id="textColorPicker"></div>
</div>
@@ -43,9 +41,7 @@
<input data-dojo-type="dijit/form/TextBox" name = "backgroundColor" id = "backgroundColorTB" style="display: none;"/>
<div data-dojo-type="dijit/form/DropDownButton">
- <span><span text-i18n="background" id = "backgroundColor">
- Background
- </span></span>
+ <span><span text-i18n="Background" id = "backgroundColor"></span></span>
<div data-dojo-type="dijit/TooltipDialog">
<div data-dojo-type="dojox.widget.ColorPicker" id="backgroundColorPicker"></div>
</div>
diff --git a/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.js b/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.js
index 292dda0..b4281e7 100644
--- a/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.js
+++ b/lib/viewers/odf/editor/widgets/dialogWidgets/fontEffectsPane.js
@@ -1,37 +1,23 @@
/**
- * @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
- * The JavaScript code in this page is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Affero General Public License
- * (GNU AGPL) as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version. The code is distributed
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+ * This file is part of WebODF.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this code. If not, see <http://www.gnu.org/licenses/>.
- *
- * As additional permission under GNU AGPL version 3 section 7, you
- * may distribute non-source (e.g., minimized or compacted) forms of
- * that code without the copy of the GNU GPL normally required by
- * section 4, provided you include this license notice and a URL
- * through which recipients can access the Corresponding Source.
+ * WebODF is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
*
- * As a special exception to the AGPL, any HTML file which merely makes function
- * calls to this code, and for that purpose includes it by reference shall be
- * deemed a separate work for copyright law purposes. In addition, the copyright
- * holders of this code give you permission to combine this code with free
- * software libraries that are released under the GNU LGPL. You may copy and
- * distribute such a system following the terms of the GNU AGPL for this code
- * and the LGPL for the libraries. If you modify this code, you may extend this
- * exception to your version of the code, but you are not obligated to do so.
- * If you do not wish to do so, delete this exception statement from your
- * version.
+ * WebODF 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 Affero General Public License for more details.
*
- * This license applies to this entire compilation.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
+ *
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
@@ -126,13 +112,12 @@ define("webodf/editor/widgets/dialogWidgets/fontEffectsPane", [], function () {
"dojox/widget/ColorPicker",
"webodf/editor/widgets/fontPicker"
], function (dojo, ready, domConstruct, ContentPane, ColorPicker, FontPicker) {
- var translator = document.translator,
- editorBase = dojo.config && dojo.config.paths &&
+ var editorBase = dojo.config && dojo.config.paths &&
dojo.config.paths['webodf/editor'];
runtime.assert(editorBase, "webodf/editor path not defined in dojoConfig");
ready(function () {
contentPane = new ContentPane({
- title: translator("fontEffects"),
+ title: runtime.tr("Font Effects"),
href: editorBase+"/widgets/dialogWidgets/fontEffectsPane.html",
preload: true
});
@@ -142,7 +127,7 @@ define("webodf/editor/widgets/dialogWidgets/fontEffectsPane", [], function () {
backgroundColorTB = dijit.byId('backgroundColorTB');
form = dijit.byId('fontEffectsPaneForm');
- document.translateContent(form.domNode);
+ runtime.translateContent(form.domNode);
preview = document.getElementById('previewText');
textColorPicker = dijit.byId('textColorPicker');