Commit ef1fced9 authored by François Billioud's avatar François Billioud

change the text editor for mobile phones

parent 9af62027
......@@ -30,6 +30,9 @@ var Xinha = function() {
var AlohaInterface = function() {
this.name = "Aloha";
this.load = function() {
GENTICS_Aloha_base="aloha/aloha/";
loadFile("aloha/aloha/aloha.js", "script", function(data) {
eval(data);
includeJS("aloha/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js");
includeJS("aloha/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js");
includeJS("aloha/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js");
......@@ -37,6 +40,7 @@ var AlohaInterface = function() {
$("div#page_content div.input").html("<div id='aloha_editable'>test</div>");
$("#aloha_editable").css("min-height","15em").css("border","5px solid #3399FF").css("overflow","auto");
$("#aloha_editable").aloha();
});
}
this.saveEdition = function() {
getCurrentDocument().saveEdition(GENTICS.Aloha.editables[0].getContents());
......@@ -48,6 +52,65 @@ var AlohaInterface = function() {
this.load();
}
var NicEdit = function() {
this.name = "NicEdit";
this.instance = null;
this.load = function() {
var nic = this;
loadFile("nicEdit/nicEdit.js","script",function(data) {
eval(data);
nic.instance = new nicEditor({iconsPath : 'nicEdit/nicEditorIcons.gif',fullPanel : true}).panelInstance('input_area');
});
}
this.saveEdition = function() {
getCurrentDocument().saveEdition($("div.input div.nicEdit-main").html());
}
this.loadContentFromDocument = function(doc) {
if(this.instance) {this.instance.removeInstance('input_area');this.instance=null}
$("#input_area").attr("value",doc.getContent());
this.instance = new nicEditor({iconsPath : 'nicEdit/nicEditorIcons.gif',fullPanel : true}).panelInstance('input_area');
}
this.load();
}
var TinyEdit = function() {
this.name = "TinyEdit";
this.load = function() {
loadFile("tinyEdit/tinyEdit.js","script",function(data) {
eval(data);
new TINY.editor.edit('editor',{
id:'input_area', // (required) ID of the textarea
width:584, // (optional) width of the editor
height:175, // (optional) heightof the editor
cssclass:'te', // (optional) CSS class of the editor
controlclass:'tecontrol', // (optional) CSS class of the buttons
rowclass:'teheader', // (optional) CSS class of the button rows
dividerclass:'tedivider', // (optional) CSS class of the button diviers
controls:['bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'orderedlist', 'unorderedlist', '|' ,'outdent' ,'indent', '|', 'leftalign', 'centeralign', 'rightalign', 'blockjustify', '|', 'unformat', '|', 'undo', 'redo', 'n', 'font', 'size', 'style', '|', 'image', 'hr', 'link', 'unlink', '|', 'cut', 'copy', 'paste', 'print'], // (required) options you want available, a '|' represents a divider and an 'n' represents a new row
footer:true, // (optional) show the footer
fonts:['Verdana','Arial','Georgia','Trebuchet MS'], // (optional) array of fonts to display
xhtml:true, // (optional) generate XHTML vs HTML
//cssfile:'style.css', // (optional) attach an external CSS file to the editor
content:'starting content', // (optional) set the starting content else it will default to the textarea content
css:'body{background-color:#ccc}', // (optional) attach CSS to the editor
bodyid:'editor', // (optional) attach an ID to the editor body
footerclass:'tefooter', // (optional) CSS class of the footer
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'}, // (optional) toggle to markup view options
resize:{cssclass:'resize'} // (optional) display options for the editor resize
});
});
}
this.saveEdition = function() {
getCurrentDocument().saveEdition($("#input").attr("value"));
}
this.loadContentFromDocument = function(doc) {
$("#input").attr("value",doc.getContent());
}
this.load();
}
/**
* Text documents
*
......
......@@ -61,7 +61,7 @@ Page.prototype = {
/* load the editor to work with and a new document to work on */
switch(this.name) {
case "text-editor":
editor = new AlohaInterface();
editor = new NicEdit();
doc=new JSONTextDocument();
break;
case "table-editor":
......
......@@ -28,13 +28,6 @@
<script type="text/javascript" src="js/theme-mobile.js"></script>
<script type="text/javascript">//hack for aloha
if(supportedDocuments[getCurrentDocument().getType()].editorPage=="text-editor") {
GENTICS_Aloha_base="aloha/aloha/"
includeJS("aloha/aloha/aloha.js");
}
</script>
<script type="text/javascript">
// initialize
var initPage = function() {
......@@ -49,11 +42,6 @@
var init = function() {
initPage();
waitBeforeSucceed(function() {return getCurrentPage().getXML();},initUser);
//$("script#jquery_loader").remove();
//$("script#jquery_loader2").remove();
//$("#author").aloha();
}
$(document).ready(init);
</script>
......@@ -129,7 +117,7 @@
<label>search_bar</label>
<div class="input"><div >
<a class="ung_docs" onclick="stopDocumentEdition()">
<a class="ung_docs" href="ung-mobile.html" onclick="stopDocumentEdition()">
<img src="images/ung/ung-logo.gif" alt="logo"/>
</a>
......@@ -179,11 +167,9 @@
<fieldset class="bottom editable">
<div id="page_content" class="field page"
title="Contenu de la page web.">
<div id="page_content" class="field page">
</div>
<div id="document_content" class="field hidden"
title="The content of the document considered as a text string">
<div id="document_content" class="field hidden">
</div>
</fieldset>
......
......@@ -229,11 +229,9 @@
<fieldset class="bottom editable">
<div id="page_content" class="field page"
title="Contenu de la page web.">
<div id="page_content" class="field page">
</div>
<div id="document_content" class="field hidden"
title="The content of the document considered as a text string">
<div id="document_content" class="field hidden">
</div>
</fieldset>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment