Commit 30b6820e authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: support languages translated

parent 580c359e
...@@ -148,16 +148,16 @@ ...@@ -148,16 +148,16 @@
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<form class="delete">\n <form class="delete">\n
<button data-rel="close" type="submit" class="close responsive ui-first-child ui-btn ui-btn-icon-left ui-icon-times">Close</button>\n <button data-rel="close" type="submit" data-i18n="Close" class="close responsive ui-first-child ui-btn ui-btn-icon-left ui-icon-times">Close</button>\n
</form>\n </form>\n
</div>\n </div>\n
</div>\n </div>\n
\n \n
<h1 class="ui-title" role="heading" aria-level="1">Filter Editor</h1>\n <h1 class="ui-title" role="heading" data-i18n="Filter Editor" aria-level="1">Filter Editor</h1>\n
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<form class="submit">\n <form class="submit">\n
<button data-rel="save" type="submit" class="submit responsive ui-last-child ui-btn ui-btn-icon-left ui-icon-check">Submit</button>\n <button data-rel="save" data-i18n="submit" type="submit" class="submit responsive ui-last-child ui-btn ui-btn-icon-left ui-icon-check">Submit</button>\n
</form>\n </form>\n
</div>\n </div>\n
</div>\n </div>\n
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
\n \n
\n \n
<section class="ui-content-header-plain">\n <section class="ui-content-header-plain">\n
<h3 class="ui-content-title ui-body-c">\n <h3 class="ui-content-title ui-body-c" data-i18n="Custom Filter">\n
<span class="ui-icon ui-icon-custom">&nbsp;</span>\n <span class="ui-icon ui-icon-custom">&nbsp;</span>\n
Custom Filter\n Custom Filter\n
</h3>\n </h3>\n
...@@ -174,12 +174,12 @@ ...@@ -174,12 +174,12 @@
<fieldset data-role="controlgroup" class="ui-controlgroup ui-corner-all">\n <fieldset data-role="controlgroup" class="ui-controlgroup ui-corner-all">\n
\n \n
<div class="ui-radio">\n <div class="ui-radio">\n
<label class="ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-radio-on">All criterions(AND)</label>\n <label class="ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-radio-on" data-i18n="All criterions(AND)">All criterions(AND)</label>\n
<input type="radio" value="Off" name="heard_about" id="heard_about_a" class="and checkboxradio" data-cacheval="true" data-enhanced="true">\n <input type="radio" value="Off" name="heard_about" id="heard_about_a" class="and checkboxradio" data-cacheval="true" data-enhanced="true">\n
</div>\n </div>\n
\n \n
<div class="ui-radio">\n <div class="ui-radio">\n
<label class="ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-radio-off">At lease one(OR)</label>\n <label class="ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-radio-off" data-i18n="At lease one(OR)">At lease one(OR)</label>\n
<input type="radio" value="Off" name="heard_about" id="heard_about_b" class="or checkboxradio" data-cacheval="false" data-enhanced="true">\n <input type="radio" value="Off" name="heard_about" id="heard_about_b" class="or checkboxradio" data-cacheval="false" data-enhanced="true">\n
</div>\n </div>\n
\n \n
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
\n \n
\n \n
<section class="ui-content-header-plain">\n <section class="ui-content-header-plain">\n
<h3 class="ui-content-title ui-body-c">\n <h3 class="ui-content-title ui-body-c" data-i18n="Predefined Filter">\n
<span class="ui-icon ui-icon-custom">&nbsp;</span>\n <span class="ui-icon ui-icon-custom">&nbsp;</span>\n
Predefined Filter\n Predefined Filter\n
</h3>\n </h3>\n
...@@ -349,7 +349,7 @@ ...@@ -349,7 +349,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.58401.24333.56064</string> </value> <value> <string>946.2931.62817.63914</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -367,7 +367,7 @@ ...@@ -367,7 +367,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442993681.59</float> <float>1443620387.19</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -328,15 +328,9 @@ ...@@ -328,15 +328,9 @@
}\n }\n
\n \n
\n \n
function createFilterItem(gadget, simple_query) {\n function createSelectOperator(type, operator) {\n
var div = document.createElement("div"),\n var html = "",\n
container = document.createElement("form"),\n select_operator = document.createElement("select"),\n
minus_button = document.createElement("span"),\n
div_text = document.createElement("div"),\n
select_reference = document.createElement("select"),\n
i,\n
tmp = "",\n
default_select = "Searchable Text",\n
select_options,\n select_options,\n
select_options_value,\n select_options_value,\n
options_map = {\n options_map = {\n
...@@ -347,39 +341,14 @@ ...@@ -347,39 +341,14 @@
"other": ["Exact Match", "keyword"],\n "other": ["Exact Match", "keyword"],\n
"other_value": ["", "keyword"]\n "other_value": ["", "keyword"]\n
},\n },\n
\n
text = document.createElement("input"),\n
select_operator = document.createElement("select");\n
\n
if (simple_query === undefined) {\n
simple_query = {};\n
}\n
\n
minus_button.setAttribute("class", "ui-icon ui-icon-delete ui-icon-shadow");\n
div_text.setAttribute("class", "ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset");\n
container.appendChild(select_reference);\n
container.appendChild(select_operator);\n
div_text.appendChild(text);\n
container.appendChild(div_text);\n
container.appendChild(minus_button);\n
container.setAttribute("class", "filterForm");\n
div.appendChild(container);\n
function createSelectOperator(event) {\n
var html = "",\n
j;\n j;\n
if (event.target.value.indexOf(\'date\') !== -1) {\n \n
text.setAttribute("type", "date");\n if (type.indexOf(\'date\') !== -1 ||\n
simple_query.value = simple_query.value ? simple_query.value.replace(/\\//g, "-") : "";\n type.indexOf(\'quantity\') !== -1 ||\n
} else {\n type.indexOf(\'price\') !== -1) {\n
text.setAttribute("type", "text");\n
}\n
text.setAttribute("value", simple_query.value || "");\n
if (event.target.value.indexOf(\'date\') !== -1 ||\n
event.target.value.indexOf(\'quantity\') !== -1 ||\n
event.target.value.indexOf(\'price\') !== -1) {\n
select_options = options_map.date_float;\n select_options = options_map.date_float;\n
select_options_value = options_map.date_float_value;\n select_options_value = options_map.date_float_value;\n
} else if (event.target.value === "Searchable Text") {\n } else if (type === "Searchable Text") {\n
select_options = options_map.searchable_text;\n select_options = options_map.searchable_text;\n
select_options_value = options_map.searchable_text_value;\n select_options_value = options_map.searchable_text_value;\n
} else {\n } else {\n
...@@ -388,7 +357,7 @@ ...@@ -388,7 +357,7 @@
}\n }\n
\n \n
for (j = 0; j < select_options.length; j += 1) {\n for (j = 0; j < select_options.length; j += 1) {\n
if (simple_query.operator === select_options_value[j]) {\n if (operator === select_options_value[j]) {\n
html += selected_option_template({\n html += selected_option_template({\n
value: select_options_value[j],\n value: select_options_value[j],\n
text: select_options[j]\n text: select_options[j]\n
...@@ -401,16 +370,35 @@ ...@@ -401,16 +370,35 @@
}\n }\n
}\n }\n
select_operator.innerHTML = html;\n select_operator.innerHTML = html;\n
$(select_operator).selectmenu();\n return select_operator;\n
$(select_operator).selectmenu(\'refresh\');\n
}\n }\n
\n \n
\n
function createFilterItem(gadget, simple_query) {\n
var div = document.createElement("div"),\n
container = document.createElement("form"),\n
minus_button = document.createElement("span"),\n
div_text = document.createElement("div"),\n
select_reference = document.createElement("select"),\n
i,\n
operator,\n
tmp = "",\n
default_select = "Searchable Text",\n
text = document.createElement("input");\n
\n
if (simple_query === undefined) {\n
simple_query = {};\n
}\n
\n
minus_button.setAttribute("class", "ui-icon ui-icon-delete ui-icon-shadow");\n
div_text.setAttribute("class", "ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset");\n
\n \n
tmp = "";\n tmp = "";\n
tmp += option_template({\n tmp += option_template({\n
value: "Searchable Text",\n value: "Searchable Text",\n
text: "Searchable Text"\n text: "Searchable Text"\n
});\n });\n
\n
for (i = 0; i < gadget.props.column_list.length; i += 1) {\n for (i = 0; i < gadget.props.column_list.length; i += 1) {\n
if (simple_query.key === gadget.props.column_list[i][0]) {\n if (simple_query.key === gadget.props.column_list[i][0]) {\n
default_select = gadget.props.column_list[i][0];\n default_select = gadget.props.column_list[i][0];\n
...@@ -425,36 +413,84 @@ ...@@ -425,36 +413,84 @@
});\n });\n
}\n }\n
}\n }\n
\n
select_reference.innerHTML = tmp;\n select_reference.innerHTML = tmp;\n
createSelectOperator({"target": {"value": default_select}});\n if (simple_query.key && simple_query.key.indexOf(\'date\') !== -1) {\n
text.setAttribute("type", "date");\n
simple_query.value = simple_query.value ? simple_query.value.replace(/\\//g, "-") : "";\n
} else {\n
text.setAttribute("type", "text");\n
}\n
text.setAttribute("value", simple_query.value || "");\n
operator = createSelectOperator(default_select, simple_query.operator);\n
container.appendChild(select_reference);\n
container.appendChild(operator);\n
div_text.appendChild(text);\n
container.appendChild(div_text);\n
container.appendChild(minus_button);\n
container.setAttribute("class", "filterForm");\n
div.appendChild(container);\n
return div;\n
}\n
\n \n
$(select_reference).selectmenu();\n \n
loopEventListener(\n function createTranslatedItem(gadget, value) {\n
minus_button,\n var container = gadget.props.element.querySelector(".filter_item_container"),\n
"click",\n item = createFilterItem(gadget, value);\n
false,\n return new RSVP.Queue()\n
function () {\n .push(function () {\n
div.parentElement.removeChild(div);\n return gadget.translateHtml(item.innerHTML);\n
})\n
.push(function (innerHTML) {\n
var select_list,\n
i;\n
item.innerHTML = innerHTML;\n
select_list = item.querySelectorAll("select");\n
for (i = 0; i < select_list.length; i += 1) {\n
$(select_list[i]).selectmenu();\n
}\n }\n
);\n container.insertBefore(item, container.lastChild);\n
\n
loopEventListener(\n loopEventListener(\n
select_reference,\n select_list[0],\n
"change",\n "change",\n
false,\n false,\n
createSelectOperator\n function (event) {\n
return new RSVP.Queue()\n
.push(function () {\n
var tmp = document.createElement("div");\n
tmp.appendChild(createSelectOperator(event.target.value));\n
if (event.target.value.indexOf(\'date\') !== -1) {\n
item.querySelector("input").setAttribute("type", "date");\n
} else {\n
item.querySelector("input").setAttribute("type", "text");\n
}\n
return gadget.translateHtml(tmp.innerHTML);\n
})\n
.push(function (innerHTML) {\n
select_list[1].innerHTML = innerHTML;\n
$(select_list[1]).selectmenu(\'refresh\');\n
});\n
}\n
);\n );\n
loopEventListener(\n loopEventListener(\n
container,\n item.querySelector(".filterForm"),\n
"submit",\n "submit",\n
false,\n false,\n
function () {\n function () {\n
return submitFilterQuery(gadget);\n return submitFilterQuery(gadget);\n
}\n }\n
);\n );\n
return div;\n
}\n
\n \n
loopEventListener(\n
item.querySelector(".ui-icon-delete"),\n
"click",\n
false,\n
function () {\n
container.removeChild(item);\n
}\n
);\n
});\n
}\n
\n \n
gadget_klass\n gadget_klass\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -509,11 +545,9 @@ ...@@ -509,11 +545,9 @@
})\n })\n
\n \n
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var container = this.props.element.querySelector(".filter_item_container"),\n var i,\n
i,\n
gadget = this,\n gadget = this,\n
domain_tree,\n domain_tree,\n
item,\n
and = gadget.props.element.querySelector(".and"),\n and = gadget.props.element.querySelector(".and"),\n
or = gadget.props.element.querySelector(".or"),\n or = gadget.props.element.querySelector(".or"),\n
query = "";\n query = "";\n
...@@ -530,10 +564,30 @@ ...@@ -530,10 +564,30 @@
.push(function (result) {\n .push(function (result) {\n
var query_list,\n var query_list,\n
query_item_list,\n query_item_list,\n
queue = new RSVP.Queue(),\n
domain_tree_map = result._embedded._view.listbox.domain_tree_map,\n domain_tree_map = result._embedded._view.listbox.domain_tree_map,\n
domain_tree_query_list;\n domain_tree_query_list;\n
gadget.props.column_list = result._embedded._view.listbox.column_list;\n gadget.props.column_list = result._embedded._view.listbox.column_list;\n
gadget.props.domain_tree_map = result._embedded._view.listbox.domain_tree_map;\n gadget.props.domain_tree_map = result._embedded._view.listbox.domain_tree_map;\n
\n
if (domain_tree !== "") {\n
domain_tree_query_list = QueryFactory.create(domain_tree);\n
domain_tree_query_list = domain_tree_query_list.query_list || [domain_tree_query_list];\n
for (i = 0; i < domain_tree_query_list.length; i += 1) {\n
if (Object.keys(domain_tree_map).length !== 0) {\n
createDomainTree(gadget, domain_tree_map, domain_tree_query_list[i].value);\n
}\n
domain_tree_map = domain_tree_map[domain_tree_query_list[i].value].sub_categories;\n
}\n
if (Object.keys(domain_tree_map).length !== 0) {\n
createDomainTree(gadget, domain_tree_map, "--");\n
}\n
} else {\n
createDomainTree(gadget);\n
}\n
\n
\n
\n
if (query !== "") {\n if (query !== "") {\n
query_list = QueryFactory.create(query);\n query_list = QueryFactory.create(query);\n
if (query_list.operator === "OR" || query_list.operator === "NOT") {\n if (query_list.operator === "OR" || query_list.operator === "NOT") {\n
...@@ -551,33 +605,17 @@ ...@@ -551,33 +605,17 @@
}\n }\n
for (i = 0; i < query_item_list.length; i += 1) {\n for (i = 0; i < query_item_list.length; i += 1) {\n
if (or.checked && query_list.operator === "NOT") {\n if (or.checked && query_list.operator === "NOT") {\n
item = createFilterItem(gadget, query_item_list[i].query_list[0]);\n queue.push(createTranslatedItem(gadget, query_item_list[i].query_list[0]));\n
} else {\n } else {\n
item = createFilterItem(gadget, query_item_list[i]);\n queue.push(createTranslatedItem(gadget, query_item_list[i]));\n
}\n }\n
container.insertBefore(item, container.lastChild);\n
}\n }\n
} else {\n } else {\n
and.checked = true;\n and.checked = true;\n
and.parentElement.children[0].setAttribute("class", "ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-radio-on");\n and.parentElement.children[0].setAttribute("class", "ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-radio-on");\n
container.insertBefore(createFilterItem(gadget), container.lastChild);\n queue.push(createTranslatedItem(gadget));\n
}\n
\n
if (domain_tree !== "") {\n
domain_tree_query_list = QueryFactory.create(domain_tree);\n
domain_tree_query_list = domain_tree_query_list.query_list || [domain_tree_query_list];\n
for (i = 0; i < domain_tree_query_list.length; i += 1) {\n
if (Object.keys(domain_tree_map).length !== 0) {\n
createDomainTree(gadget, domain_tree_map, domain_tree_query_list[i].value);\n
}\n
domain_tree_map = domain_tree_map[domain_tree_query_list[i].value].sub_categories;\n
}\n
if (Object.keys(domain_tree_map).length !== 0) {\n
createDomainTree(gadget, domain_tree_map, "--");\n
}\n
} else {\n
createDomainTree(gadget);\n
}\n }\n
return queue;\n
});\n });\n
})\n })\n
\n \n
...@@ -585,21 +623,17 @@ ...@@ -585,21 +623,17 @@
// declared services\n // declared services\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareService(function () {\n .declareService(function () {\n
var gadget = this,\n var gadget = this;\n
item;\n
function closeFilterEditor() {\n function closeFilterEditor() {\n
gadget.props.jelement.panel("toggle");\n gadget.props.jelement.panel("toggle");\n
}\n }\n
\n
\n \n
loopEventListener(\n loopEventListener(\n
gadget.props.element.querySelector(".plus"),\n gadget.props.element.querySelector(".plus"),\n
"submit",\n "submit",\n
false,\n false,\n
function () {\n function () {\n
var container = gadget.props.element.querySelector(".filter_item_container");\n createTranslatedItem(gadget);\n
item = createFilterItem(gadget);\n
container.insertBefore(item, container.lastChild);\n
}\n }\n
);\n );\n
loopEventListener(\n loopEventListener(\n
...@@ -755,7 +789,7 @@ ...@@ -755,7 +789,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.4378.65397.6826</string> </value> <value> <string>946.5968.16440.8482</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -773,7 +807,7 @@ ...@@ -773,7 +807,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443533150.45</float> <float>1443627977.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -234,6 +234,7 @@ ...@@ -234,6 +234,7 @@
select_list = [],\n select_list = [],\n
dataset,\n dataset,\n
counter,\n counter,\n
paging_info_counter,\n
hide_item = gadget.props.hide_item,\n hide_item = gadget.props.hide_item,\n
sort_list = gadget.props.sort_list || [],\n sort_list = gadget.props.sort_list || [],\n
i,\n i,\n
...@@ -441,6 +442,7 @@ ...@@ -441,6 +442,7 @@
len;\n len;\n
\n \n
th.setAttribute("colspan", field_json.column_list.length);\n th.setAttribute("colspan", field_json.column_list.length);\n
th.setAttribute("class", "foot_colspan");\n
// NOTE: Romain: paging menu with 3+ buttons should have another class name (like ui-paging-grid)\n // NOTE: Romain: paging menu with 3+ buttons should have another class name (like ui-paging-grid)\n
paging_menu.className = "ui-controlgroup ui-controlgroup-horizontal ui-corner-all ui-paging-menu";\n paging_menu.className = "ui-controlgroup ui-controlgroup-horizontal ui-corner-all ui-paging-menu";\n
paging_wrap.className = "ui-controlgroup-controls";\n paging_wrap.className = "ui-controlgroup-controls";\n
...@@ -449,18 +451,18 @@ ...@@ -449,18 +451,18 @@
paging_prev.textContent = "Previous";\n paging_prev.textContent = "Previous";\n
paging_prev.setAttribute("data-i18n", "Previous");\n paging_prev.setAttribute("data-i18n", "Previous");\n
paging_prev.href = url_list[0];\n paging_prev.href = url_list[0];\n
paging_info.className = "ui-btn ui-disabled";\n paging_info.className = "paging_info ui-btn ui-disabled";\n
if ((begin_from === 0) && (counter === 0)) {\n if ((begin_from === 0) && (counter === 0)) {\n
paging_info.textContent = "No records";\n paging_info.textContent = "No records";\n
paging_info.setAttribute("data-i18n", "No Records");\n paging_info.setAttribute("data-i18n", "No Records");\n
} else if ((dataset.data.rows.length <= lines) && (begin_from === 0)) {\n } else if ((dataset.data.rows.length <= lines) && (begin_from === 0)) {\n
paging_info.setAttribute("data-i18n", "[last]Record(s)");\n paging_info.setAttribute("data-i18n", "[last]Record(s)");\n
paging_info.appendChild(document.createTextNode(counter));\n paging_info_counter = "1 -" + counter;\n
paging_info.appendChild(document.createTextNode("Record(s)"));\n paging_info.appendChild(document.createTextNode("Record(s) "));\n
} else {\n } else {\n
paging_info.setAttribute("data-i18n", "[node]Record(s)");\n paging_info.setAttribute("data-i18n", "[node]Record(s)");\n
paging_info.appendChild(document.createTextNode("Records "));\n paging_info.appendChild(document.createTextNode("Records "));\n
paging_info.appendChild(document.createTextNode((((begin_from + lines) / lines - 1) * lines + 1) + " - " + (((begin_from + lines) / lines - 1) * lines + counter)));\n paging_info_counter = (((begin_from + lines) / lines - 1) * lines + 1) + " - " + (((begin_from + lines) / lines - 1) * lines + counter);\n
}\n }\n
// paging_info.textContent = "Page " + ((begin_from + lines) / lines);\n // paging_info.textContent = "Page " + ((begin_from + lines) / lines);\n
paging_next.className = "ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child";\n paging_next.className = "ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child";\n
...@@ -492,15 +494,17 @@ ...@@ -492,15 +494,17 @@
temp_table.appendChild(fragment);\n temp_table.appendChild(fragment);\n
temp.appendChild(temp_table);\n temp.appendChild(temp_table);\n
table.appendChild(temp.querySelector("tbody"));\n table.appendChild(temp.querySelector("tbody"));\n
return gadget.translateHtml(temp.querySelector("tfoot").innerHTML);\n temp.appendChild(document.createElement("tbody"));\n
return gadget.translateHtml(temp.innerHTML);\n
})\n })\n
.push(function (my_translated_html) {\n .push(function (my_translated_html) {\n
var temp = document.createElement("tfoot");\n var temp = document.createElement("table");\n
temp.innerHTML = my_translated_html;\n temp.innerHTML = my_translated_html;\n
table.appendChild(temp);\n temp.querySelector(".paging_info").appendChild(document.createTextNode(paging_info_counter));\n
table.appendChild(temp.querySelector("tfoot"));\n
})\n })\n
.fail(function (error) {\n .fail(function (error) {\n
if (error.target.status === 500) {\n if (error.target && error.target.status === 500) {\n
return gadget.showQueryError(" Unsupportred Query");\n return gadget.showQueryError(" Unsupportred Query");\n
}\n }\n
throw error;\n throw error;\n
...@@ -537,6 +541,8 @@ ...@@ -537,6 +541,8 @@
hide_submit_form = document.createElement("form"),\n hide_submit_form = document.createElement("form"),\n
hide_show_all = document.createElement("button"),\n hide_show_all = document.createElement("button"),\n
query_list = [],\n query_list = [],\n
translate_div,\n
colspan = gadget.props.element.querySelector(".foot_colspan"),\n
checkbox;\n checkbox;\n
all_hide_form_elements = gadget.props.element.querySelectorAll(".hide_form_element");\n all_hide_form_elements = gadget.props.element.querySelectorAll(".hide_form_element");\n
hide_form_elements = gadget.props.element.querySelectorAll(".hide_form_element:checked");\n hide_form_elements = gadget.props.element.querySelectorAll(".hide_form_element:checked");\n
...@@ -544,6 +550,7 @@ ...@@ -544,6 +550,7 @@
if (all_hide_form_elements.length > 0) {\n if (all_hide_form_elements.length > 0) {\n
//if nothing is selected, show all\n //if nothing is selected, show all\n
if (hide_form_elements.length === 0) {\n if (hide_form_elements.length === 0) {\n
colspan.setAttribute("colspan", parseInt(colspan.getAttribute("colspan"), 10) - 1);\n
return gadget.redirect({jio_key: gadget.props.jio_key,\n return gadget.redirect({jio_key: gadget.props.jio_key,\n
"extended_search": gadget.props.extended_search || "",\n "extended_search": gadget.props.extended_search || "",\n
"domain_tree": gadget.props.domain_tree || "",\n "domain_tree": gadget.props.domain_tree || "",\n
...@@ -553,6 +560,7 @@ ...@@ -553,6 +560,7 @@
//all selected\n //all selected\n
//no need to submit\n //no need to submit\n
if (hide_form_elements.length + 1 === all_hide_form_elements.length) {\n if (hide_form_elements.length + 1 === all_hide_form_elements.length) {\n
colspan.setAttribute("colspan", parseInt(colspan.getAttribute("colspan"), 10) - 1);\n
for (i = 0; i < all_hide_form_elements.length; i += 1) {\n for (i = 0; i < all_hide_form_elements.length; i += 1) {\n
all_hide_form_elements[i].parentElement.removeChild(all_hide_form_elements[i]);\n all_hide_form_elements[i].parentElement.removeChild(all_hide_form_elements[i]);\n
}\n }\n
...@@ -582,11 +590,19 @@ ...@@ -582,11 +590,19 @@
}\n }\n
\n \n
hide_show_all.setAttribute("type", "submit");\n hide_show_all.setAttribute("type", "submit");\n
hide_show_all.textContent = "Show All";\n hide_show_all.setAttribute("data-i18n", "Show All");\n
hide_show_all.className = "ui-btn responsive ui-last-child";\n hide_show_all.className = "ui-btn responsive ui-last-child";\n
hide_submit_form.appendChild(hide_show_all);\n translate_div = document.createElement("div");\n
translate_div.appendChild(hide_show_all);\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.translateHtml(translate_div.innerHTML);\n
})\n
.push(function (innerHTML) {\n
translate_div.innerHTML = innerHTML;\n
hide_submit_form.innerHTML = innerHTML;\n
th = document.createElement("th");\n th = document.createElement("th");\n
\n colspan.setAttribute("colspan", parseInt(colspan.getAttribute("colspan"), 10) + 1);\n
th.setAttribute("class", "hide_form_element");\n th.setAttribute("class", "hide_form_element");\n
th.appendChild(hide_submit_form);\n th.appendChild(hide_submit_form);\n
loopEventListener(\n loopEventListener(\n
...@@ -608,6 +624,7 @@ ...@@ -608,6 +624,7 @@
checkbox.setAttribute("class", "hide_form_element");\n checkbox.setAttribute("class", "hide_form_element");\n
tr_list[i].insertBefore(checkbox, tr_list[i].firstChild);\n tr_list[i].insertBefore(checkbox, tr_list[i].firstChild);\n
}\n }\n
});\n
}\n }\n
);\n );\n
})\n })\n
...@@ -789,7 +806,7 @@ ...@@ -789,7 +806,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.4415.55526.9147</string> </value> <value> <string>946.5543.47694.6075</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -807,7 +824,7 @@ ...@@ -807,7 +824,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443535241.5</float> <float>1443622529.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -136,16 +136,16 @@ ...@@ -136,16 +136,16 @@
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<form class="delete">\n <form class="delete">\n
<button data-rel="close" type="submit" class="close responsive ui-first-child ui-btn ui-btn-icon-left ui-icon-times">Close</button>\n <button data-i18n="Close" data-rel="close" type="submit" class="close responsive ui-first-child ui-btn ui-btn-icon-left ui-icon-times">Close</button>\n
</form>\n </form>\n
</div>\n </div>\n
</div>\n </div>\n
\n \n
<h1 class="ui-title" role="heading" aria-level="1">Sort Editor</h1>\n <h1 class="ui-title" role="heading" data-i18n="sort Editor" aria-level="1">Sort Editor</h1>\n
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<form class="submit">\n <form class="submit">\n
<button data-rel="save" type="submit" class="submit responsive ui-last-child ui-btn ui-btn-icon-left ui-icon-check">Submit</button>\n <button data-rel="save" data-i18n="Submit" type="submit" class="submit responsive ui-last-child ui-btn ui-btn-icon-left ui-icon-check">Submit</button>\n
</form>\n </form>\n
</div>\n </div>\n
</div>\n </div>\n
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.60934.57457.64460</string> </value> <value> <string>946.4096.6867.34269</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443515526.27</float> <float>1443620255.9</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -153,7 +153,6 @@ ...@@ -153,7 +153,6 @@
}\n }\n
}\n }\n
select_reference.innerHTML = tmp;\n select_reference.innerHTML = tmp;\n
$(select_reference).selectmenu();\n
tmp = "";\n tmp = "";\n
if (sort_value_list[1] === "ascending") {\n if (sort_value_list[1] === "ascending") {\n
tmp += selected_option_template({\n tmp += selected_option_template({\n
...@@ -180,17 +179,35 @@ ...@@ -180,17 +179,35 @@
}\n }\n
\n \n
select_operator.innerHTML = tmp;\n select_operator.innerHTML = tmp;\n
$(select_operator).selectmenu();\n
\n \n
return div;\n
}\n
\n
function createTranslatedItem(gadget, key) {\n
var container = gadget.props.element.querySelector(".sort_item_container"),\n
sort_item = createSortItem(gadget, key);\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.translateHtml(sort_item.innerHTML);\n
})\n
.push(function (innerHTML) {\n
var select_list,\n
i;\n
sort_item.innerHTML = innerHTML;\n
select_list = sort_item.querySelectorAll("select");\n
for (i = 0; i < select_list.length; i += 1) {\n
$(select_list[i]).selectmenu();\n
}\n
container.insertBefore(sort_item, container.lastChild);\n
loopEventListener(\n loopEventListener(\n
minus_button,\n sort_item.querySelector(".ui-icon-delete"),\n
"click",\n "click",\n
false,\n false,\n
function () {\n function () {\n
div.parentElement.removeChild(div);\n container.removeChild(sort_item);\n
}\n }\n
);\n );\n
return div;\n });\n
}\n }\n
\n \n
\n \n
...@@ -245,7 +262,6 @@ ...@@ -245,7 +262,6 @@
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var gadget = this,\n var gadget = this,\n
i,\n i,\n
container = gadget.props.element.querySelector(".sort_item_container"),\n
sort_form_list;\n sort_form_list;\n
sort_form_list = gadget.props.element.querySelectorAll(".sortForm");\n sort_form_list = gadget.props.element.querySelectorAll(".sortForm");\n
for (i = 0; i < sort_form_list.length; i += 1) {\n for (i = 0; i < sort_form_list.length; i += 1) {\n
...@@ -259,29 +275,29 @@ ...@@ -259,29 +275,29 @@
return gadget.jio_getAttachment(options.jio_key, options.view);\n return gadget.jio_getAttachment(options.jio_key, options.view);\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var key;\n var key,\n
queue = new RSVP.Queue();\n
gadget.props.column_list = result._embedded._view.listbox.column_list;\n gadget.props.column_list = result._embedded._view.listbox.column_list;\n
for (key in options.form_definition.sort_list) {\n for (key in options.form_definition.sort_list) {\n
if (options.form_definition.sort_list.hasOwnProperty(key)) {\n if (options.form_definition.sort_list.hasOwnProperty(key)) {\n
if (options.form_definition.sort_list[key] !== "") {\n if (options.form_definition.sort_list[key] !== "") {\n
container.insertBefore(createSortItem(gadget, options.form_definition.sort_list[key]), container.lastChild);\n queue.push(createTranslatedItem(gadget, options.form_definition.sort_list[key]));\n
}\n }\n
}\n }\n
}\n }\n
return queue;\n
});\n });\n
})\n })\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareService(function () {\n .declareService(function () {\n
var gadget = this;\n var gadget = this;\n
function plusItem() {\n
var container = gadget.props.element.querySelector(".sort_item_container");\n
container.insertBefore(createSortItem(gadget), container.lastChild);\n
}\n
loopEventListener(\n loopEventListener(\n
gadget.props.element.querySelector(".plus"),\n gadget.props.element.querySelector(".plus"),\n
"submit",\n "submit",\n
false,\n false,\n
plusItem\n function () {\n
return createTranslatedItem(gadget);\n
}\n
);\n );\n
\n \n
loopEventListener(\n loopEventListener(\n
...@@ -459,7 +475,7 @@ ...@@ -459,7 +475,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.62441.17317.23193</string> </value> <value> <string>946.6000.3675.35362</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -477,7 +493,7 @@ ...@@ -477,7 +493,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443515446.86</float> <float>1443629882.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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