Commit 0533c55c authored by Vivek's avatar Vivek

wip

parent a9885b4a
......@@ -105,40 +105,32 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
\n
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta http-equiv="X-UA-Compatible" content="IE=Edge">\n
<meta charset="utf-8">\n
\n
<title>bootstrap-wysihtml5</title>\n
\n
<head>\n
<meta http-equiv="X-UA-Compatible" content="IE=Edge">\n
<meta charset="utf-8">\n
\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="bootstrap3-wysihtml5.min.css"></link>\n
<title>bootstrap-wysihtml5</title>\n
\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="bootstrap3-wysihtml5.min.css"></link>\n
\n
</head>\n
<body>\n
<div class="container" style=" width: 100%; height: 600px;">\n
<div class="jumbotron" style="margin-left:0px; height: 600px;">\n
<textarea class="textarea" placeholder="Enter text ..." style="width: 100%; height: 400px; font-size: 14px; line-height: 18px;"></textarea>\n
</div>\n
</div>\n
<link rel="http://www.renderjs.org/rel/interface" href="editor_interface.html">\n
\n
<script src="wysihtml5x-toolbar.min.js"></script>\n
<script src="jquery.js"></script>\n
<script src="bootstrap.min.js"></script>\n
<script src="handlebars.runtime.min.js"></script>\n
<script src="bootstrap3-wysihtml5.min.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap3-wysiwyg.js" type="text/javascript"></script>\n
\n
<script src="wysihtml5x-toolbar.min.js"></script>\n
<script src="jquery.js"></script>\n
<script src="bootstrap.min.js"></script>\n
<script src="handlebars.runtime.min.js"></script>\n
<script src="bootstrap3-wysihtml5.min.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap3-wysiwyg.js"></script>\n
</body>\n
</head>\n
<body></body>\n
</html>\n
......@@ -277,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56196.65369.51899</string> </value>
<value> <string>945.2018.8243.11827</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -295,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1438777350.44</float>
<float>1439468941.87</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -110,19 +110,21 @@
<html lang="en">\n
<head>\n
<meta charset="utf-8">\n
<title>title</title>\n
<title>bootstrap-wysiwhg</title>\n
\n
<link rel="stylesheet" href="bootstrap-combined.no-icons.min.css">\n
<link rel="stylesheet" href="bootstrap-responsive.css">\n
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css">\n
\n
<script src="jquery.js"></script>\n
<script src="jquery.hotkeys.js"></script>\n
<link rel="http://www.renderjs.org/rel/interface" href="editor_interface.html">\n
\n
<script src="jquery.js" type="text/javascript"></script>\n
<script src="jquery.hotkeys.js" type="text/javascript"></script>\n
<script src="bootstrap.min.js"></script>\n
<script src="bootstrap-wysiwyg.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap_wysiwyg.js"></script>\n
<script src="gadget_bootstrap_wysiwyg.js" type="text/javascript"></script>\n
\n
</head>\n
<body>\n
......@@ -333,7 +335,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.53506.33548.17937</string> </value>
<value> <string>945.2156.1335.48469</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -351,7 +353,7 @@
</tuple>
<state>
<tuple>
<float>1438615893.56</float>
<float>1439467063.04</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -99,7 +99,9 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*jslint indent: 2 */\n
<value> <string encoding="cdata"><![CDATA[
/*jslint indent: 2 */\n
/*global window, jQuery, rJS*/\n
"use strict";\n
\n
......@@ -115,16 +117,26 @@
.declareMethod(\'clearContent\', function () {\n
rJS(this).editor.html(\'\');\n
})\n
.ready(function (g) {\n
g.editor = $(\'.textarea\');\n
g.editor.wysihtml5({\n
.declareMethod(\'setEditor\', function () {\n
document.body.innerHTML =\'<div class="container" style=" width: 100%; height: 600px;">\'\n
+\'<div class="jumbotron" style="margin-left:0px; height: 600px;">\'\n
+\'<textarea class="textarea" placeholder="Enter text ..." \'\n
+\'style="width: 100%; height: 400px; font-size: 14px; line-height: 18px;">\'\n
+\'</textarea></div</div>\';\n
this.editor = $(\'.textarea\');\n
this.editor.wysihtml5({\n
toolbar: {\n
fa: true\n
}\n
});\n
})\n
\n
.ready(function (g) {\n
});\n
\n
}(window, jQuery, rJS));</string> </value>
}(window, jQuery, rJS));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -259,7 +271,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56186.56926.29952</string> </value>
<value> <string>945.1997.11510.44544</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -277,7 +289,7 @@
</tuple>
<state>
<tuple>
<float>1438777746.45</float>
<float>1439471143.4</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -157,12 +157,14 @@
.declareMethod(\'clearContent\', function () {\n
rJS(this).editor.html(\'\');\n
})\n
.ready(function (g) {\n
g.editor = $(\'#editor\');\n
.declareMethod(\'setEditor\', function () {\n
initToolbarBootstrapBindings();\n
g.editor.wysiwyg({\n
this.editor.wysiwyg({\n
fileUploadError: showErrorAlert\n
});\n
})\n
.ready(function (g) {\n
g.editor = $(\'#editor\');\n
});\n
\n
}(window, jQuery, rJS));
......@@ -302,7 +304,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.53151.60155.61457</string> </value>
<value> <string>944.63600.63717.14984</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -320,7 +322,7 @@
</tuple>
<state>
<tuple>
<float>1438594704.78</float>
<float>1439467049.96</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -112,7 +112,21 @@
<body>\n
<h1>Editor Interface</h1>\n
<h3>An interface defining the methods for text editor.</h3>\n
<dl></dl>\n
<dl>\n
<dt>getContent</dt>\n
<dd>to fetch the contect from the text editor</dd>\n
<dl></dl>\n
<dt>setContent</dt>\n
<dd>to set the contect to the text editor</dd>\n
<dl>\n
<dt data-parameter-required="required" data-parameter-type="string">content</dt>\n
<dd>the content to be set in the text editor</dd>\n
</dl>\n
</dd>\n
<dt>clearContent</dt>\n
<dd>to clear the contect of the text editor</dd>\n
<dl></dl>\n
</dl>\n
</body>\n
</html>
......@@ -251,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.48991.52289.15735</string> </value>
<value> <string>944.53144.2367.52957</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -269,7 +283,7 @@
</tuple>
<state>
<tuple>
<float>1438345024.7</float>
<float>1439192630.9</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -105,7 +105,6 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
\n
<!DOCTYPE html>\n
<html>\n
<head>\n
......@@ -121,46 +120,45 @@
<script type="text/javascript" src="jquery.js"></script>\n
<script type="text/javascript" src="rsvp.js"></script>\n
<script type="text/javascript" src="renderjs.js"></script>\n
<script type="text/javascript" src="handlebars.js"></script>\n
<script type="text/javascript" src="gadget_global.js" ></script>\n
<script src="gadget_global.js" ></script>\n
<script type="text/javascript" src="jquerymobile.js"></script>\n
<script type="text/javascript" src="i18next.js"></script>\n
\n
<!-- specific script -->\n
<script type="text/javascript" src="editor_test_gadget.js"></script>\n
\n
<script class="sub-gadget-template" type="text/x-handlebars-template">\n
</head>\n
<body>\n
<div data-role="page" class="ui-content gadget-content">\n
<div class="ui-grid-a ui-responsive">\n
<div class="ui-block-a" style="width:60%">\n
<div class="ui-content"></div>\n
</div>\n
<div class="ui-block-b" style="width:30%">\n
<form class="gadget-select-form">\n
<form class="main-gadget-select-form">\n
<div data-role="fieldcontain">\n
<label for="gadget_selector" >Main Gadget</label>\n
<select name="gadget_selector" class="select">\n
<option value="./bootstrap-wysiwyg.html">Text Editor 1</option>\n
<label for="main_gadget_selector" >Main Gadget</label>\n
<select name="main_gadget_selector" class="select">\n
<option value="./bootstrap3-wysiwyg.html">Text Editor 2</option>\n
<option value="./interface_test_correct_implemented_gadget.html">Dummy Gadget 1</option>\n
<option value="./interface_test_multiple_interface_correct_gadget.html">Dummy Gadget 2</option>\n
</select>\n
</div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n
</form>\n
<form class="similar-gadget-select-form">\n
<div data-role="fieldcontain">\n
<label for="similar_gadget_selector" >Similar Gadgets</label>\n
<select name="similar_gadget_selector" class="select">\n
</select>\n
</div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n
</form>\n
</div>\n
</div>\n
</script>\n
</head>\n
\n
<body>\n
<div data-role="page">\n
<div data-role="header" data-position="fixed" class="gadget-header" data-theme="b">\n
<h1></h1>\n
</div>\n
<div role="main" class="ui-content gadget-content"></div>\n
</div>\n
</body>\n
\n
</html>\n
\n
]]></string> </value>
......@@ -298,7 +296,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.57834.1936.52684</string> </value>
<value> <string>945.2226.34067.16605</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -316,7 +314,7 @@
</tuple>
<state>
<tuple>
<float>1438875522.58</float>
<float>1439471929.19</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -99,48 +99,131 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*jslint indent: 2, maxlen: 80, nomen: true */\n
<value> <string encoding="cdata"><![CDATA[
/*jslint indent: 2, maxlen: 80, nomen: true */\n
/*global console, window, document, rJS, RSVP, $ */\n
(function (window, document, rJS, Handlebars, promiseEventListener) {\n
(function (window, document, rJS, promiseEventListener) {\n
"use strict";\n
\n
var DEFAULT_EDITOR_GADGET = "./bootstrap-wysiwyg.html";\n
var DEFAULT_GADGET_URL = "./bootstrap3-wysiwyg.html",\n
INTERFACE_GADGET_URL = "./gadget_interfaces.html";\n
\n
function declareEditorGadget(gadget, editor_g) {\n
console.log("inside declareEditorGadget");\n
return gadget.declareGadget(editor_g, {\n
function declareInterfaceGadget(gadget) {\n
return gadget.declareGadget(INTERFACE_GADGET_URL, {\n
element: gadget.__element,\n
scope: "interface"\n
});\n
}\n
function declareSubGadget(gadget, sub_gadget_url) {\n
return gadget.declareGadget(sub_gadget_url, {\n
sandbox: \'iframe\',\n
element: document.body.querySelector("[data-role=page]"),\n
scope: "editor"\n
element: gadget.props.content_element.querySelector("div.ui-content"),\n
scope: "sub_gadget"\n
});\n
}\n
function getAvailableSubGadgetList(gadget) {\n
var main_gadget = gadget.props.content_element.querySelector(\'form.main-gadget-select-form\'),\n
gadget_option_list = main_gadget.main_gadget_selector.querySelectorAll(\'option\'),\n
gadget_list = [],\n
i;\n
for(i = 0; i < gadget_option_list.length; i += 1) {\n
gadget_list.push({\n
url: gadget_option_list[i].value,\n
display_name: gadget_option_list[i].innerText\n
});\n
}\n
return gadget_list;\n
}\n
function filterSimilarSubGadgetList(gadget, sub_gadget_url) {\n
var interface_gadget,\n
available_subgadget_list;\n
return RSVP.Queue()\n
.push(function() {\n
return gadget.getDeclaredGadget("interface");\n
})\n
.push(function(i_gadget) {\n
interface_gadget = i_gadget;\n
return interface_gadget.getVerifyGadget(sub_gadget_url);\n
})\n
.push(function(sub_gadget) {\n
return RSVP.all([\n
interface_gadget.getDeclaredGadgetInterfaceList(sub_gadget),\n
getAvailableSubGadgetList(gadget)\n
]);\n
})\n
.push(function(result_data) {\n
var interface_url_list = result_data[0],\n
item,\n
status_list = [];\n
available_subgadget_list = result_data[1];\n
for(item in available_subgadget_list) {\n
status_list.push(interface_gadget.verifyGadgetInterfaceListImplementation(available_subgadget_list[item].url, interface_url_list));\n
}\n
return RSVP.all(status_list);\n
})\n
.push(function(result_list) {\n
return [available_subgadget_list, result_list];\n
});\n
}\n
function updateSimilarGadgetOptionList(gadget, sub_gadget_url) {\n
return RSVP.Queue()\n
.push(function() {\n
return filterSimilarSubGadgetList(gadget, sub_gadget_url);\n
})\n
.push(function(filtered_list) {\n
var select = gadget.props.content_element.querySelector(\'form.similar-gadget-select-form\').similar_gadget_selector;\n
select.innerHTML = "";\n
var i;\n
for(i = 0; i < filtered_list[1].length; i += 1) {\n
if(filtered_list[1][i]) {\n
var option = document.createElement("option");\n
option.text = filtered_list[0][i].display_name;\n
option.value = filtered_list[0][i].url;\n
select.appendChild(option);\n
}\n
}\n
return;\n
});\n
}\n
function gadgetSwitchHandler(gadget) {\n
console.log("Listening");\n
return new RSVP.Queue()\n
.push(function() {\n
gadget.props.content_element.innerHTML =\n
gadget.props.sub_gadget_template({});\n
return promiseEventListener(\n
gadget.props.content_element.querySelector(\'form.gadget-select-form\'),\n
\'submit\',\n
false\n
);\n
})\n
return RSVP.any([\n
promiseEventListener(\n
gadget.props.content_element.querySelector(\'form.main-gadget-select-form\'),\n
\'submit\',\n
false\n
),\n
promiseEventListener(\n
gadget.props.content_element.querySelector(\'form.similar-gadget-select-form\'),\n
\'submit\',\n
false\n
)\n
]);\n
})\n
.push(function(submit_event) {\n
console.log("submit_event",submit_event);\n
var submit_source = submit_event.target.className;\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n
gadget.props.content_element.querySelector("div.ui-content").innerHTML = "";\n
console.log("Selected:", submit_event.target[0].value);\n
return declareEditorGadget(gadget,submit_event.target[0].value);\n
if(submit_source === \'main-gadget-select-form\') {\n
return RSVP.all([\n
declareSubGadget(gadget,submit_event.target[0].value),\n
updateSimilarGadgetOptionList(gadget, submit_event.target[0].value)\n
]);\n
} else {\n
return declareSubGadget(gadget,submit_event.target[0].value);\n
}\n
})\n
.push(function() {\n
return gadget.editor_setEditor();\n
})\n
.push(function(){\n
console.log("Calling self again");\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = false;\n
return gadgetSwitchHandler(gadget);\n
});\n
\n
}\n
\n
// block JQM auto-start\n
......@@ -152,54 +235,61 @@
rJS(window)\n
\n
.ready(function (g) {\n
console.log("test gadget ready");\n
g.props = {};\n
return g.getElement()\n
.push(function (element) {\n
$(element).trigger("create");\n
g.props.element = element;\n
g.props.header_element = element.querySelector(\'.gadget-header\');\n
g.props.content_element = element.querySelector(\'.gadget-content\');\n
g.props.sub_gadget_template = Handlebars.compile(\n
document.querySelector(".sub-gadget-template").innerHTML\n
);\n
});\n
})\n
\n
.declareMethod(\'render\', function () {\n
var gadget = this;\n
\n
return new RSVP.Queue()\n
.push(function() {\n
console.log("default gadget");\n
return declareEditorGadget(gadget, DEFAULT_EDITOR_GADGET);\n
return declareInterfaceGadget(gadget, DEFAULT_GADGET_URL);\n
})\n
.push(function() {\n
return declareSubGadget(gadget, DEFAULT_GADGET_URL);\n
})\n
.push(function() {\n
return gadget.editor_setEditor();\n
})\n
.push(function(){\n
return gadgetSwitchHandler(gadget);\n
});\n
\n
})\n
\n
/* ============================ EDITOR =============================== */\n
.declareMethod("editor_getContent", function (param_list) {\n
return this.getDeclaredGadget("editor")\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.getContent.apply(editor, param_list);\n
});\n
})\n
.declareMethod("editor_setContent", function (param_list) {\n
return this.getDeclaredGadget("editor")\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.setContent.apply(editor, param_list);\n
});\n
})\n
.declareMethod("editor_clearContent", function (param_list) {\n
return this.getDeclaredGadget("editor")\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.clearContent.apply(editor, param_list);\n
});\n
})\n
.declareMethod("editor_setEditor", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.setEditor.apply(editor, param_list);\n
});\n
});\n
\n
}(window, document, rJS, Handlebars, promiseEventListener));</string> </value>
}(window, document, rJS, promiseEventListener));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -334,7 +424,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.57850.5818.19541</string> </value>
<value> <string>945.2225.65299.39441</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -352,7 +442,7 @@
</tuple>
<state>
<tuple>
<float>1438876472.39</float>
<float>1439471855.78</float>
<string>GMT</string>
</tuple>
</state>
......
web_page_module/editor*
web_page_module/interface_gadget_interfaces*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo
web_site_module/editor_demo/**
\ No newline at end of file
web_page_module/editor*
web_page_module/interface_gadget_interfaces*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo
web_site_module/editor_demo/**
\ No newline at end of file
web_page_module/editor*
web_page_module/interface_gadget_interfaces*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo
web_site_module/editor_demo/**
\ No newline at end of file
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