diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis
index 9814b49..1a8b42b 100644
--- a/view/view_table_renderer.anubis
+++ b/view/view_table_renderer.anubis
@@ -176,11 +176,27 @@ define String
editurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"',
iconSet: \"fontAwesome\",
autowidth:true,
- shrinkToFit:true,
- rowNum:10,
+ shrinkToFit:false,
+ rowNum:30,
+ rowList:[5,10,30,50],
cellEdit: false,
cellsubmit: 'remote',
- cellurl: '?aws_controller=hk_c&aws_action=update_row&table_name="+rows.table_name+"',
+ cellurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"',
+ editurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"',
+ onSelectRow: function (rowid, status, e) {
+ var $self = $(this), savedRow = $self.jqGrid(\"getGridParam\", \"savedRow\");
+ if (savedRow.length > 0 && savedRow[0].id !== rowid) {
+ $self.jqGrid(\"restoreRow\", savedRow[0].id);
+ }
+ },
+ ondblClickRow: function (rowid, iRow, iCol, e) {
+ var $self = $(this), savedRow = $self.jqGrid(\"getGridParam\", \"savedRow\");
+ if (savedRow.length > 0 && savedRow[0].id !== rowid) {
+ $self.jqGrid(\"restoreRow\", savedRow[0].id);
+ }
+ $self.jqGrid(\"editRow\", rowid, { focusField: e.target });
+ },
+
pager: '#"+uid+"_pager',
caption:"+to_JSON_String(_T(to_upper(rows.table_name)))+",
actionsNavOptions: {
@@ -218,7 +234,7 @@ public define HTML_Partial_Content
)=
with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause),
with referer_arg = "&"+to_Web_arg(table_referer, ""),
- with js = js_inline(jquery_ready("$(\"#"+uid+"_grid\").jqGrid({\n"+
+ with js = js_inline(jquery_ready("var lastSel;$(\"#"+uid+"_grid\").jqGrid({\n"+
"url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&view_name="+rows.view_name+filter_clause+referer_arg+"',"+
"datatype: \"json\","+
to_jqGrid_ColModel(db, table_referer, _T, rows.view_model.list)+","+
@@ -234,6 +250,24 @@ public define HTML_Partial_Content
}
function unformatColor(cellValue, options, cellObject) {
return $(cellObject.html()).css(\"backgroundColor\").substring(1);
+ }
+ function formatPhone(cellValue, options, rowObject) {
+ var phoneInput = '
' + cellValue + '';
+ return phoneInput;
+ }
+ function unformatPhone(cellValue, options, cellObject) {
+ var jqo = $(cellObject);
+ var ret = jqo.text();
+ return ret;
+ }
+ function formatEmail(cellValue, options, rowObject) {
+ var phoneInput = '
' + cellValue + '';
+ return phoneInput;
+ }
+ function unformatEmail(cellValue, options, cellObject) {
+ var jqo = $(cellObject);
+ var ret = jqo.text();
+ return ret;
}")),
partial_content(jqgrid_init(lang) + [js],
@@ -443,6 +477,10 @@ public define List(CXM_Form_Field)
[input([class("datetimepicker")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(value), custom(18), mandatory), help_line(help, _T)],
color( s_name, c_name, value, help) then
[input([class("jscolor")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
+ phone( s_name, c_name, value, help) then
+ [input([class("hk_input_phone")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
+ email( s_name, c_name, value, help) then
+ [input([class("hk_input_email")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
},
edit_form_lines(db, fk_clause, table_referer, _T, t, new_entry, reverse(line)+so_far)
}.
@@ -542,25 +580,33 @@ public define HTML_Partial_Content
with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"),
partial_content(
- [ js(js_file("js/jscolor.min.js"))
+ [ js(js_file("js/jscolor.min.js")),
+ js(js_file("js/dropzone.js")),
+ js_inline(jquery_ready("Dropzone.options.myAwesomeDropzone = {
+ maxFiles: 100,
+ dictDefaultMessage : \""+_T("DROP_FILE_HERE")+"\",
+ dictFileTooBig : \""+_T("FILE_TOO_BIG")+"\",
+ };
+ $('#my-awesome-dropzone').dropzone(); ")),
]+
jq_datetimepicker_init(lang) +
get_editor_header(list_entries), //add editor header if need. Like init ck_editor
sequence([
cxm_form( table_name, lwa,
- edit_form_lines(db, "", table_referer, _T, list_entries, create, [])+
+
[ one_line_fields([
submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),
submit(hkc_cancel, failure, _T("CANCEL"))
- ])
- ]
- )]+
- if id = "none" then
+ ]),
+ hr
+ ]+edit_form_lines(db, "", table_referer, _T, list_entries, create, [])
+ +
+ (if id = "none" then
[]
else
map( (HK_Form_Tab tab)
- |->
+ |->
since tab is hk_form_tab(fk_table_name, fk_col_name, list_view_name),
with referer = hk_referer(table_name, id, fk_table_name, fk_col_name),
if table_in_list_view_only(db, _T, lang, web_site_directory, fk_table_name, list_view_name, "edit", "", referer, fk_clause, vtm) is
@@ -569,7 +615,18 @@ public define HTML_Partial_Content
success(p_content) then partial(p_content)
}
//text("Foreign Key from table ["+fk_table_name+"] columns ["+fk_col_name+"] view to use ["+list_view_name+"]")
- ,list_tabs)
+ ,list_tabs))+
+ [ hr,
+ one_line_fields([
+ submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
+ submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),
+ submit(hkc_cancel, failure, _T("CANCEL"))
+ ])
+ ]
+ ),
+
+ form("my-awesome-dropzone",[class("dropzone")], "upload_csv_file&step=2&format=csv&table_name="+table_name, [], literal("")),
+ ]
)).
//Edit table part
@@ -639,6 +696,11 @@ public define List(CXM_Form_Field)
[input([class("datetimepicker")], no_label, html_Id(c_name), wan(c_name), init(value), custom(18), mandatory), help_line(help, _T)],
color( s_name, c_name, value, help) then
[input([class("jscolor")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
+ phone( s_name, c_name, value, help) then
+ [input([class("hk_input_phone")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
+ email( s_name, c_name, value, help) then
+ [input([class("hk_input_email")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
+
}.
define List(Cell_Option)
@@ -691,8 +753,15 @@ define CXM_Form_Field
)
)
.
+public define List(CXM_Form_Field)
+ get_hidden
+ (
+ List(HK_Form_Table_Attribute) table_attrs
+ )=
+ map((HK_Form_Table_Attribute attr) |-> since attr is hidden(n, v), hidden(html_Id(""), wan(n), wav(v)), table_attrs)
+.
-public define HTML_Partial_Content
+public define HTML_Partial_Content
renderer_edit_table_form
(
SQLite3DataBase db,
@@ -721,7 +790,8 @@ public define HTML_Partial_Content
jq_datetimepicker_init(lang) +
get_editor_header(table_form.form_lines), //add editor header if need. Like init ck_editor
sequence([
- cxm_form( table_name, [], lwa,
+ cxm_form( table_name, [], lwa,
+ get_hidden(table_form.table_attr)+
[construct_edit_form_table(db, table_referer, _T, lwa, table_form.form_lines, create)]+
[ one_line_fields([
submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
--
libgit2 0.21.4