Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
3e1c3ce2
Commit
3e1c3ce2
authored
Oct 03, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Simplify page template rendering
parent
c9edbda4
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
391 additions
and
431 deletions
+391
-431
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.html
.../web_page_module/rjs_gadget_erp5_pt_form_dialog_html.html
+1
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.xml
...m/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
+148
-170
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_html.html
...em/web_page_module/rjs_gadget_erp5_pt_form_list_html.html
+2
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_html.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_list_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.js
...teItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.js
+96
-92
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.html
...ge_module/rjs_gadget_erp5_pt_form_view_editable_html.html
+0
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.xml
...age_module/rjs_gadget_erp5_pt_form_view_editable_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
...b_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
+94
-116
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
..._page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.html
...em/web_page_module/rjs_gadget_erp5_pt_form_view_html.html
+0
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.js
...teItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.js
+34
-28
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.html
View file @
3e1c3ce2
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_dialog.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_dialog.js"
type=
"text/javascript"
></script>
...
@@ -24,7 +23,7 @@
...
@@ -24,7 +23,7 @@
<!-- XXX action, method, fieldset -->
<!-- XXX action, method, fieldset -->
<form
class=
"dialog_form"
>
<form
class=
"dialog_form"
>
<button
type=
"submit"
data-i18n=
"Submit"
class=
"ui-btn ui-btn-b ui-btn-inline
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-action ui-btn-icon-right ui-screen-hidden"
>
Submit
</button>
ui-icon-action ui-btn-icon-right ui-screen-hidden"
>
Submit
</button>
<div
data-gadget-url=
"gadget_erp5_form.html"
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"erp5_form"
data-gadget-scope=
"erp5_form"
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.xml
View file @
3e1c3ce2
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.44927.40202.16725
</string>
</value>
<value>
<string>
9
54.5408.20833.21606
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60379182.9
4
</float>
<float>
14
75506475.7
4
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
3e1c3ce2
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, RSVP, URI,
loopEventListener, document,
calculatePageTitle */
/*global window, rJS, RSVP, URI, calculatePageTitle */
(
function
(
window
,
rJS
,
RSVP
,
URI
,
loopEventListener
,
calculatePageTitle
)
{
(
function
(
window
,
rJS
,
RSVP
,
URI
,
calculatePageTitle
)
{
"
use strict
"
;
"
use strict
"
;
/////////////////////////////////////////////////////////////////
rJS
(
window
)
// Handlebars
.
setState
({
/////////////////////////////////////////////////////////////////
title
:
""
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
// Assign the element to a variable
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
})
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// acquisition
// acquisition
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -35,7 +16,7 @@
...
@@ -35,7 +16,7 @@
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
.
declareAcquiredMethod
(
"
translate
Html
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
declareAcquiredMethod
(
"
displayFormulatorValidationError
"
,
.
declareAcquiredMethod
(
"
displayFormulatorValidationError
"
,
"
displayFormulatorValidationError
"
)
"
displayFormulatorValidationError
"
)
...
@@ -45,168 +26,165 @@
...
@@ -45,168 +26,165 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
this
.
props
.
element
.
querySelector
(
'
button
'
).
click
();
this
.
element
.
querySelector
(
'
button
'
).
click
();
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
erp5_document
=
options
.
erp5_document
,
var
state_dict
=
{
form_options
=
options
.
erp5_form
||
{},
id
:
options
.
jio_key
,
form_gadget
=
this
;
view
:
options
.
view
,
editable
:
options
.
editable
,
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
erp5_form
:
options
.
erp5_form
||
{}
};
return
this
.
changeState
(
state_dict
);
})
form_gadget
.
props
.
id
=
options
.
jio_key
;
.
declareMethod
(
'
updateDOM
'
,
function
()
{
form_gadget
.
props
.
view
=
options
.
view
;
var
form_gadget
=
this
,
form_gadget
.
props
.
editable
=
options
.
editable
;
icon
,
form_gadget
.
props
.
action
=
erp5_document
.
_embedded
.
_view
.
_actions
.
put
;
selector
=
form_gadget
.
element
.
querySelector
(
"
h3
"
),
form_gadget
.
props
.
form_id
=
erp5_document
.
_embedded
.
_view
.
form_id
;
title
,
i
,
view_list
=
this
.
state
.
erp5_document
.
_links
.
action_workflow
||
[];
title
=
this
.
state
.
form_definition
.
title
;
for
(
i
=
0
;
i
<
view_list
.
length
;
i
+=
1
)
{
if
(
view_list
[
i
].
name
===
this
.
state
.
view
)
{
title
=
view_list
[
i
].
title
;
}
}
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
// XXX hardcoded...
switch
(
form_gadget
.
state
.
title
)
{
case
"
Create User
"
:
icon
=
"
ui-icon-user
"
;
break
;
case
"
Create Document
"
:
icon
=
"
ui-icon-file-o
"
;
break
;
case
"
Change State
"
:
icon
=
"
ui-icon-share-alt
"
;
break
;
case
"
Submit
"
:
icon
=
"
ui-icon-check
"
;
break
;
default
:
icon
=
"
ui-icon-random
"
;
break
;
}
.
push
(
function
(
erp5_form
)
{
// Calculate the h3 properties
var
title
=
options
.
form_definition
.
title
,
return
form_gadget
.
translate
(
title
)
i
,
.
push
(
function
(
translated_title
)
{
icon
,
selector
.
textContent
=
"
\
u00A0
"
+
translated_title
;
span
=
document
.
createElement
(
"
span
"
),
selector
.
className
=
"
ui-content-title ui-body-c ui-icon ui-icon-custom
"
+
icon
;
section
=
form_gadget
.
__element
.
querySelector
(
"
section
"
),
selector
=
form_gadget
.
__element
.
querySelector
(
"
h3
"
),
view_list
=
erp5_document
.
_links
.
action_workflow
||
[];
for
(
i
=
0
;
i
<
view_list
.
length
;
i
+=
1
)
{
if
(
view_list
[
i
].
name
===
options
.
view
)
{
title
=
view_list
[
i
].
title
;
}
}
// XXX hardcoded...
// Render the erp5_from
switch
(
title
)
{
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
);
case
"
Create User
"
:
})
icon
=
"
ui-icon-user
"
;
.
push
(
function
(
erp5_form
)
{
break
;
var
form_options
=
form_gadget
.
state
.
erp5_form
;
case
"
Create Document
"
:
icon
=
"
ui-icon-file-o
"
;
break
;
case
"
Change State
"
:
icon
=
"
ui-icon-share-alt
"
;
break
;
case
"
Submit
"
:
icon
=
"
ui-icon-check
"
;
break
;
default
:
icon
=
"
ui-icon-random
"
;
break
;
}
span
.
className
=
"
ui-icon ui-icon-custom
"
+
icon
;
span
.
textContent
=
"
\
u00A0
"
;
selector
.
appendChild
(
span
);
selector
.
appendChild
(
document
.
createTextNode
(
title
));
selector
.
setAttribute
(
"
data-i18n
"
,
"
[last]
"
+
title
);
// <span class="ui-icon ui-icon-custom ui-icon-random"> </span>
// <span class="ui-icon ui-icon-custom ui-icon-random"> </span>
form_options
.
erp5_document
=
options
.
erp5_document
;
form_options
.
erp5_document
=
form_gadget
.
state
.
erp5_document
;
form_options
.
form_definition
=
options
.
form_definition
;
form_options
.
form_definition
=
form_gadget
.
state
.
form_definition
;
form_options
.
view
=
options
.
view
;
form_options
.
view
=
form_gadget
.
state
.
view
;
return
erp5_form
.
render
(
form_options
);
return
new
RSVP
.
Queue
()
})
.
push
(
function
()
{
.
push
(
function
()
{
return
form_gadget
.
translateHtml
(
section
.
innerHTML
);
// Render the headers
})
return
RSVP
.
all
([
.
push
(
function
(
my_translation_html
)
{
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
undefined
,
view
:
undefined
}}),
section
.
innerHTML
=
my_translation_html
;
calculatePageTitle
(
form_gadget
,
form_gadget
.
state
.
erp5_document
)
return
RSVP
.
all
([
]);
erp5_form
.
render
(
form_options
),
})
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
undefined
,
view
:
undefined
}}),
.
push
(
function
(
all_result
)
{
calculatePageTitle
(
form_gadget
,
options
.
erp5_document
)
return
form_gadget
.
updateHeader
({
]);
cancel_url
:
all_result
[
0
],
})
page_title
:
all_result
[
1
],
.
push
(
function
(
all_result
)
{
submit_action
:
true
return
form_gadget
.
updateHeader
({
});
cancel_url
:
all_result
[
1
],
page_title
:
all_result
[
2
],
submit_action
:
true
});
});
});
});
})
})
.
declareService
(
function
()
{
.
onEvent
(
'
submit
'
,
function
()
{
var
form_gadget
=
this
;
var
form_gadget
=
this
,
action
=
this
.
state
.
erp5_document
.
_embedded
.
_view
.
_actions
.
put
,
function
formSubmit
()
{
form_id
=
this
.
state
.
erp5_document
.
_embedded
.
_view
.
form_id
,
re
turn
form_gadget
.
notifySubmitting
()
re
direct_to_parent
;
.
push
(
function
()
{
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
);
return
form_gadget
.
notifySubmitting
()
})
.
push
(
function
()
{
.
push
(
function
(
erp5_form
)
{
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
);
return
erp5_form
.
getContent
();
})
})
.
push
(
function
(
erp5_form
)
{
.
push
(
function
(
content_dict
)
{
return
erp5_form
.
getContent
();
var
data
=
{},
})
key
;
.
push
(
function
(
content_dict
)
{
var
data
=
{},
data
[
form_gadget
.
props
.
form_id
.
key
]
=
key
;
form_gadget
.
props
.
form_id
[
'
default
'
];
// XXX Hardcoded
data
[
form_id
.
key
]
=
form_id
[
'
default
'
];
data
.
dialog_id
=
form_gadget
.
props
.
form_id
[
'
default
'
];
// XXX Hardcoded
data
.
dialog_method
=
form_gadget
.
props
.
action
.
action
;
data
.
dialog_id
=
form_id
[
'
default
'
]
;
//XXX hack for redirect, difined in form
data
.
dialog_method
=
action
.
action
;
form_gadget
.
props
.
redirect_to_parent
=
content_dict
.
field_your_redirect_to_parent
;
//XXX hack for redirect, difined in form
for
(
key
in
content_dict
)
{
redirect_to_parent
=
content_dict
.
field_your_redirect_to_parent
;
if
(
content_dict
.
hasOwnProperty
(
key
)
)
{
for
(
key
in
content_dict
)
{
data
[
key
]
=
content_dict
[
key
];
if
(
content_dict
.
hasOwnProperty
(
key
))
{
}
data
[
key
]
=
content_dict
[
key
];
}
}
}
return
form_gadget
.
jio_putAttachment
(
return
form_gadget
.
jio_putAttachment
(
form_gadget
.
props
.
id
,
form_gadget
.
state
.
id
,
form_gadget
.
props
.
action
.
href
,
action
.
href
,
data
data
);
);
})
})
.
push
(
function
(
evt
)
{
.
push
(
function
(
evt
)
{
var
location
=
evt
.
target
.
getResponseHeader
(
"
X-Location
"
),
var
location
=
evt
.
target
.
getResponseHeader
(
"
X-Location
"
),
jio_key
,
jio_key
,
list
=
[];
list
=
[];
list
.
push
(
form_gadget
.
notifySubmitted
());
list
.
push
(
form_gadget
.
notifySubmitted
());
if
(
form_gadget
.
props
.
redirect_to_parent
)
{
if
(
redirect_to_parent
)
{
list
.
push
(
form_gadget
.
redirect
({
command
:
'
history_previous
'
}));
list
.
push
(
form_gadget
.
redirect
({
command
:
'
history_previous
'
}));
}
else
{
if
(
location
===
undefined
||
location
===
null
)
{
// No redirection, stay on the same document
list
.
push
(
form_gadget
.
redirect
({
command
:
'
change
'
,
options
:
{
view
:
"
view
"
,
page
:
undefined
}}));
}
else
{
}
else
{
if
(
location
===
undefined
||
location
===
null
)
{
jio_key
=
new
URI
(
location
).
segment
(
2
);
// No redirection, stay on the same document
if
(
form_gadget
.
state
.
id
===
jio_key
)
{
list
.
push
(
form_gadget
.
redirect
({
command
:
'
change
'
,
options
:
{
view
:
"
view
"
,
page
:
undefined
}}));
// Do not update navigation history if dialog redirect to the same document
list
.
push
(
form_gadget
.
redirect
({
command
:
'
change
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
form_gadget
.
state
.
editable
}}));
}
else
{
}
else
{
jio_key
=
new
URI
(
location
).
segment
(
2
);
list
.
push
(
form_gadget
.
redirect
({
command
:
'
push_history
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
form_gadget
.
state
.
editable
}}));
if
(
form_gadget
.
props
.
id
===
jio_key
)
{
// Do not update navigation history if dialog redirect to the same document
list
.
push
(
form_gadget
.
redirect
({
command
:
'
change
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
form_gadget
.
props
.
editable
}}));
}
else
{
list
.
push
(
form_gadget
.
redirect
({
command
:
'
push_history
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
form_gadget
.
props
.
editable
}}));
}
}
}
}
}
return
RSVP
.
all
(
list
);
}
})
return
RSVP
.
all
(
list
);
.
push
(
undefined
,
function
(
error
)
{
})
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
400
))
{
.
push
(
undefined
,
function
(
error
)
{
return
form_gadget
.
notifySubmitted
()
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
400
))
{
.
push
(
function
()
{
return
form_gadget
.
notifySubmitted
()
return
form_gadget
.
notifyChange
();
.
push
(
function
()
{
})
return
form_gadget
.
notifyChange
();
.
push
(
function
()
{
})
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
error
.
target
.
responseText
));
.
push
(
function
()
{
});
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
error
.
target
.
responseText
));
}
});
throw
error
;
}
});
throw
error
;
}
});
},
false
,
true
);
// Listen to form submit
return
loopEventListener
(
form_gadget
.
props
.
element
.
querySelector
(
'
form
'
),
'
submit
'
,
false
,
formSubmit
);
});
}(
window
,
rJS
,
RSVP
,
URI
,
loopEventListener
,
calculatePageTitle
));
}(
window
,
rJS
,
RSVP
,
URI
,
calculatePageTitle
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
3e1c3ce2
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.30388.38115.23432
</string>
</value>
<value>
<string>
95
4.5593.38130.32665
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60476265.13
</float>
<float>
14
74544293.54
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_html.html
View file @
3e1c3ce2
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_list.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_list.js"
type=
"text/javascript"
></script>
...
@@ -19,13 +18,13 @@
...
@@ -19,13 +18,13 @@
<!-- XXX action, method, fieldset -->
<!-- XXX action, method, fieldset -->
<form
class=
"dialog_form"
>
<form
class=
"dialog_form"
>
<button
type=
"submit"
data-i18n=
"Submit"
class=
"ui-btn ui-btn-b ui-btn-inline
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-action ui-btn-icon-right ui-screen-hidden"
>
Submit
</button>
ui-icon-action ui-btn-icon-right ui-screen-hidden"
>
Submit
</button>
<div
data-gadget-url=
"gadget_erp5_searchfield.html"
<div
data-gadget-url=
"gadget_erp5_searchfield.html"
data-gadget-scope=
"erp5_searchfield"
data-gadget-scope=
"erp5_searchfield"
data-gadget-sandbox=
"public"
></div>
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_erp5_form.html"
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"erp5_form"
data-gadget-scope=
"erp5_form"
data-gadget-sandbox=
"public"
></div>
data-gadget-sandbox=
"public"
></div>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_html.xml
View file @
3e1c3ce2
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.44927.40202.16725
</string>
</value>
<value>
<string>
9
54.5635.22528.56337
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60379295.1
3
</float>
<float>
14
75506438.6
3
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.js
View file @
3e1c3ce2
/*global window, rJS, RSVP,
loopEventListener,
calculatePageTitle */
/*global window, rJS, RSVP, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
loopEventListener
,
calculatePageTitle
)
{
(
function
(
window
,
rJS
,
RSVP
,
calculatePageTitle
)
{
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
// Assign the element to a variable
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -33,67 +17,94 @@
...
@@ -33,67 +17,94 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
;
form_options
=
options
.
erp5_form
||
{},
return
gadget
.
getUrlParameter
(
'
extended_search
'
)
search_options
=
{};
.
push
(
function
(
extended_search
)
{
var
state_dict
=
{
id
:
options
.
jio_key
,
view
:
options
.
view
,
editable
:
options
.
editable
,
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
erp5_form
:
options
.
erp5_form
||
{},
extended_search
:
extended_search
};
return
gadget
.
changeState
(
state_dict
);
});
})
form_options
.
erp5_document
=
options
.
erp5_document
;
.
declareMethod
(
'
updateDOM
'
,
function
()
{
form_options
.
form_definition
=
options
.
form_definition
;
var
form_gadget
=
this
;
form_options
.
view
=
options
.
view
;
return
new
RSVP
.
Queue
()
// render the erp5 form
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
.
push
(
function
(
erp5_form
)
{
var
form_options
=
form_gadget
.
state
.
erp5_form
;
form_options
.
erp5_document
=
form_gadget
.
state
.
erp5_document
;
form_options
.
form_definition
=
form_gadget
.
state
.
form_definition
;
form_options
.
view
=
form_gadget
.
state
.
view
;
// XXX Hardcoded for listbox's hide functionality
form_options
.
form_definition
.
hide_enabled
=
true
;
// XXX not generic, fix later
if
(
form_gadget
.
state
.
extended_search
)
{
form_options
.
form_definition
.
extended_search
=
form_gadget
.
state
.
extended_search
;
}
return
erp5_form
.
render
(
form_options
);
})
// render the search field
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
getUrlParameter
(
'
extended_search
'
);
return
form_gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
);
})
})
.
push
(
function
(
extended_search
)
{
.
push
(
function
(
search_gadget
)
{
var
search_options
=
{};
// XXX not generic, fix later
// XXX not generic, fix later
if
(
extended_search
)
{
if
(
form_gadget
.
state
.
extended_search
)
{
form_options
.
form_definition
.
extended_search
=
extended_search
;
search_options
.
extended_search
=
form_gadget
.
state
.
extended_search
;
search_options
.
extended_search
=
extended_search
;
}
}
// XXX Hardcoded for listbox's hide functionality
return
search_gadget
.
render
(
search_options
);
form_options
.
form_definition
.
hide_enabled
=
true
;
})
var
new_content_action
=
options
.
erp5_document
.
_links
.
action_object_new_content_action
;
// render the header
.
push
(
function
()
{
var
new_content_action
=
form_gadget
.
state
.
erp5_document
.
_links
.
action_object_new_content_action
;
if
(
new_content_action
!==
undefined
)
{
if
(
new_content_action
!==
undefined
)
{
new_content_action
=
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
new_content_action
.
href
,
editable
:
true
}});
new_content_action
=
form_
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
new_content_action
.
href
,
editable
:
true
}});
}
else
{
}
else
{
new_content_action
=
""
;
new_content_action
=
""
;
}
}
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
),
gadget
.
getDeclaredGadget
(
"
erp5_form
"
),
new_content_action
,
new_content_action
,
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
form_
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
gadget
.
getUrlFor
({
command
:
'
display
'
,
options
:
{}}),
form_
gadget
.
getUrlFor
({
command
:
'
display
'
,
options
:
{}}),
calculatePageTitle
(
gadget
,
options
.
erp5_document
)
calculatePageTitle
(
form_gadget
,
form_gadget
.
state
.
erp5_document
)
]);
]);
})
})
.
push
(
function
(
all_gadget
)
{
.
push
(
function
(
all_gadget
)
{
return
RSVP
.
all
([
return
form_gadget
.
updateHeader
({
all_gadget
[
0
].
render
(
search_options
),
panel_action
:
true
,
all_gadget
[
1
].
render
(
form_options
),
jump_url
:
""
,
gadget
.
updateHeader
({
cut_url
:
""
,
panel_action
:
true
,
add_url
:
all_gadget
[
0
],
jump_url
:
""
,
actions_url
:
all_gadget
[
1
],
cut_url
:
""
,
export_url
:
""
,
add_url
:
all_gadget
[
2
],
page_title
:
all_gadget
[
3
],
actions_url
:
all_gadget
[
3
],
front_url
:
all_gadget
[
2
],
export_url
:
""
,
filter_action
:
true
page_title
:
all_gadget
[
5
],
});
front_url
:
all_gadget
[
4
],
filter_action
:
true
})
]);
});
});
})
})
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
var
gadget
=
this
,
var
gadget
=
this
,
extended_search
=
''
,
extended_search
=
''
;
options
=
{};
return
gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
)
return
gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
)
.
push
(
function
(
search_gadget
)
{
.
push
(
function
(
search_gadget
)
{
return
search_gadget
.
getContent
();
return
search_gadget
.
getContent
();
...
@@ -107,43 +118,36 @@
...
@@ -107,43 +118,36 @@
return
form_gadget
.
getListboxInfo
();
return
form_gadget
.
getListboxInfo
();
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
var
url
=
"
gadget_erp5_search_editor.html
"
;
return
gadget
.
renderEditorPanel
(
"
gadget_erp5_search_editor.html
"
,
{
options
.
extended_search
=
extended_search
;
extended_search
:
extended_search
,
options
.
begin_from
=
result
.
begin_from
;
begin_from
:
result
.
begin_from
,
options
.
search_column_list
=
result
.
search_column_list
;
search_column_list
:
result
.
search_column_list
return
gadget
.
renderEditorPanel
(
url
,
options
);
}
);
});
});
})
})
.
declareService
(
function
()
{
.
onEvent
(
'
submit
'
,
function
()
{
var
gadget
=
this
;
var
gadget
=
this
;
function
formSubmit
()
{
return
gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
)
return
gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
)
.
push
(
function
(
search_gadget
)
{
.
push
(
function
(
search_gadget
)
{
return
search_gadget
.
getContent
();
return
search_gadget
.
getContent
();
})
})
.
push
(
function
(
data
)
{
.
push
(
function
(
data
)
{
var
options
=
{
var
options
=
{
begin_from
:
undefined
,
begin_from
:
undefined
,
// XXX Hardcoded
// XXX Hardcoded
field_listbox_begin_from
:
undefined
field_listbox_begin_from
:
undefined
};
};
if
(
data
.
search
)
{
if
(
data
.
search
)
{
options
.
extended_search
=
data
.
search
;
options
.
extended_search
=
data
.
search
;
}
else
{
}
else
{
options
.
extended_search
=
undefined
;
options
.
extended_search
=
undefined
;
}
}
return
gadget
.
redirect
({
command
:
'
store_and_change
'
,
options
:
options
});
return
gadget
.
redirect
({
command
:
'
store_and_change
'
,
options
:
options
});
});
});
}
// Listen to form submit
},
false
,
true
);
return
loopEventListener
(
gadget
.
props
.
element
.
querySelector
(
'
form
'
),
}(
window
,
rJS
,
RSVP
,
calculatePageTitle
));
'
submit
'
,
\ No newline at end of file
false
,
formSubmit
);
});
}(
window
,
rJS
,
RSVP
,
loopEventListener
,
calculatePageTitle
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
View file @
3e1c3ce2
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.28943.57832.6053
5
</string>
</value>
<value>
<string>
95
4.5675.50023.5896
5
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60389440.4
</float>
<float>
14
74549231.17
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.html
View file @
3e1c3ce2
...
@@ -8,10 +8,8 @@
...
@@ -8,10 +8,8 @@
<!-- renderjs -->
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_view_editable.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_view_editable.js"
type=
"text/javascript"
></script>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.xml
View file @
3e1c3ce2
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.44927.40202.16725
</string>
</value>
<value>
<string>
9
52.64761.25287.18397
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60379409.7
2
</float>
<float>
14
75506409.1
2
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
View file @
3e1c3ce2
/*global window, rJS, RSVP,
loopEventListener, document,
calculatePageTitle */
/*global window, rJS, RSVP, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
loopEventListener
,
calculatePageTitle
)
{
(
function
(
window
,
rJS
,
RSVP
,
calculatePageTitle
)
{
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
// Assign the element to a variable
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
...
@@ -35,135 +19,129 @@
...
@@ -35,135 +19,129 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
this
.
props
.
element
.
querySelector
(
'
button
'
).
click
();
this
.
element
.
querySelector
(
'
button
'
).
click
();
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
erp5_document
=
options
.
erp5_document
,
form_gadget
=
this
,
action_dict
=
erp5_document
.
_embedded
.
_view
.
_actions
;
form_gadget
.
props
.
id
=
options
.
jio_key
;
.
declareMethod
(
'
render
'
,
function
(
options
)
{
form_gadget
.
props
.
view
=
options
.
view
;
var
state_dict
=
{
form_gadget
.
props
.
form_id
=
erp5_document
.
_embedded
.
_view
.
form_id
;
id
:
options
.
jio_key
,
view
:
options
.
view
,
editable
:
options
.
editable
,
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
erp5_form
:
options
.
erp5_form
||
{}
};
return
this
.
changeState
(
state_dict
);
})
if
(
action_dict
!==
undefined
)
{
.
declareMethod
(
'
updateDOM
'
,
function
()
{
form_gadget
.
props
.
action
=
erp5_document
.
_embedded
.
_view
.
_actions
.
put
;
var
form_gadget
=
this
;
}
// render the erp5 form
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
.
push
(
function
(
erp5_form
)
{
.
push
(
function
(
erp5_form
)
{
var
form_options
=
options
.
erp5_form
||
{},
var
form_options
=
form_gadget
.
state
.
erp5_form
;
new_content_action
,
delete_action
;
form_options
.
erp5_document
=
options
.
erp5_document
;
form_options
.
erp5_document
=
form_gadget
.
state
.
erp5_document
;
form_options
.
form_definition
=
options
.
form_definition
;
form_options
.
form_definition
=
form_gadget
.
state
.
form_definition
;
form_options
.
view
=
options
.
view
;
form_options
.
view
=
form_gadget
.
state
.
view
;
return
erp5_form
.
render
(
form_options
);
})
// render the header
.
push
(
function
()
{
var
new_content_action
=
form_gadget
.
state
.
erp5_document
.
_links
.
action_object_new_content_action
,
delete_action
=
form_gadget
.
state
.
erp5_document
.
_links
.
action_object_delete_action
,
save_action
=
false
;
if
(
form_gadget
.
state
.
erp5_document
.
_embedded
.
_view
.
_actions
!==
undefined
)
{
if
(
form_gadget
.
state
.
erp5_document
.
_embedded
.
_view
.
_actions
.
put
!==
undefined
)
{
save_action
=
true
;
}
}
new_content_action
=
options
.
erp5_document
.
_links
.
action_object_new_content_action
;
if
(
new_content_action
!==
undefined
)
{
if
(
new_content_action
!==
undefined
)
{
new_content_action
=
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
new_content_action
.
href
,
editable
:
true
}});
new_content_action
=
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
new_content_action
.
href
,
editable
:
true
}});
}
else
{
}
else
{
new_content_action
=
""
;
new_content_action
=
""
;
}
}
delete_action
=
options
.
erp5_document
.
_links
.
action_object_delete_action
;
if
(
delete_action
!==
undefined
)
{
if
(
delete_action
!==
undefined
)
{
delete_action
=
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
delete_action
.
href
,
editable
:
undefined
}});
delete_action
=
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
delete_action
.
href
,
editable
:
undefined
}});
}
else
{
}
else
{
delete_action
=
""
;
delete_action
=
""
;
}
}
return
RSVP
.
all
([
return
RSVP
.
all
([
erp5_form
.
render
(
form_options
),
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}}),
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}}),
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
,
editable
:
true
}}),
form_gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
,
editable
:
true
}}),
new_content_action
,
new_content_action
,
form_gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
form_gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
delete_action
,
delete_action
,
calculatePageTitle
(
form_gadget
,
options
.
erp5_document
)
save_action
,
calculatePageTitle
(
form_gadget
,
form_gadget
.
state
.
erp5_document
)
]);
]);
})
})
.
push
(
function
(
all_result
)
{
.
push
(
function
(
all_result
)
{
var
header_dict
=
{
return
form_gadget
.
updateHeader
(
{
tab_url
:
all_result
[
1
],
tab_url
:
all_result
[
0
],
actions_url
:
all_result
[
2
],
actions_url
:
all_result
[
1
],
add_url
:
all_result
[
3
],
add_url
:
all_result
[
2
],
selection_url
:
all_result
[
4
],
selection_url
:
all_result
[
3
],
delete_url
:
all_result
[
5
],
delete_url
:
all_result
[
4
],
cut_url
:
""
,
cut_url
:
""
,
page_title
:
all_result
[
6
]
page_title
:
all_result
[
6
],
};
save_action
:
all_result
[
5
]
if
(
form_gadget
.
props
.
action
!==
undefined
)
{
});
header_dict
.
save_action
=
true
;
}
return
form_gadget
.
updateHeader
(
header_dict
);
});
});
})
})
.
onEvent
(
'
submit
'
,
function
()
{
var
form_gadget
=
this
,
erp5_form
,
form_id
=
this
.
state
.
erp5_document
.
_embedded
.
_view
.
form_id
,
action
=
form_gadget
.
state
.
erp5_document
.
_embedded
.
_view
.
_actions
.
put
;
.
declareService
(
function
()
{
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
////////////////////////////////////
.
push
(
function
(
gadget
)
{
// Form submit listening
erp5_form
=
gadget
;
////////////////////////////////////
return
erp5_form
.
checkValidity
();
var
form_gadget
=
this
;
})
.
push
(
function
(
validity
)
{
if
(
validity
)
{
return
erp5_form
.
getContent
()
.
push
(
function
(
data
)
{
data
[
form_id
.
key
]
=
form_id
[
'
default
'
];
return
RSVP
.
all
([
form_gadget
.
notifySubmitting
(),
form_gadget
.
jio_putAttachment
(
form_gadget
.
state
.
id
,
action
.
href
,
data
)
]);
})
.
push
(
form_gadget
.
notifySubmitted
.
bind
(
form_gadget
))
.
push
(
function
()
{
return
form_gadget
.
redirect
({
command
:
'
reload
'
});
})
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
400
))
{
return
form_gadget
.
notifySubmitted
()
.
push
(
function
()
{
return
form_gadget
.
notifyChange
();
})
.
push
(
function
()
{
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
error
.
target
.
responseText
));
});
}
throw
error
;
});
}
});
function
formSubmit
()
{
},
false
,
true
);
var
erp5_form
;
if
(
form_gadget
.
props
.
action
===
undefined
)
{
}(
window
,
rJS
,
RSVP
,
calculatePageTitle
));
// If not action is defined on form, do nothing
\ No newline at end of file
return
;
}
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
.
push
(
function
(
gadget
)
{
erp5_form
=
gadget
;
return
erp5_form
.
checkValidity
();
})
.
push
(
function
(
validity
)
{
if
(
validity
)
{
return
erp5_form
.
getContent
()
.
push
(
function
(
data
)
{
data
[
form_gadget
.
props
.
form_id
.
key
]
=
form_gadget
.
props
.
form_id
[
'
default
'
];
return
RSVP
.
all
([
form_gadget
.
notifySubmitting
(),
form_gadget
.
jio_putAttachment
(
form_gadget
.
props
.
id
,
form_gadget
.
props
.
action
.
href
,
data
)
]);
})
.
push
(
form_gadget
.
notifySubmitted
.
bind
(
form_gadget
))
.
push
(
function
()
{
return
form_gadget
.
redirect
({
command
:
'
reload
'
});
})
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
400
))
{
return
form_gadget
.
notifySubmitted
()
.
push
(
function
()
{
return
form_gadget
.
notifyChange
();
})
.
push
(
function
()
{
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
error
.
target
.
responseText
));
});
}
throw
error
;
});
}
});
}
// Listen to form submit
return
loopEventListener
(
form_gadget
.
props
.
element
.
querySelector
(
'
form
'
),
'
submit
'
,
false
,
formSubmit
);
});
}(
window
,
rJS
,
RSVP
,
loopEventListener
,
calculatePageTitle
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
View file @
3e1c3ce2
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.28778.40365.28040
</string>
</value>
<value>
<string>
95
4.5631.5200.57036
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60380770.1
4
</float>
<float>
14
74549439.6
4
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.html
View file @
3e1c3ce2
...
@@ -8,10 +8,8 @@
...
@@ -8,10 +8,8 @@
<!-- renderjs -->
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_view.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_form_view.js"
type=
"text/javascript"
></script>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml
View file @
3e1c3ce2
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.44927.40202.16725
</string>
</value>
<value>
<string>
9
54.23068.50721.21589
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60379399.92
</float>
<float>
14
75506379.44
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.js
View file @
3e1c3ce2
...
@@ -3,18 +3,7 @@
...
@@ -3,18 +3,7 @@
(
function
(
window
,
rJS
,
RSVP
,
calculatePageTitle
)
{
(
function
(
window
,
rJS
,
RSVP
,
calculatePageTitle
)
{
"
use strict
"
;
"
use strict
"
;
// Precompile the templates while loading the first gadget instance
rJS
(
window
)
var
gadget_klass
=
rJS
(
window
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -25,11 +14,25 @@
...
@@ -25,11 +14,25 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
state_dict
=
{
id
:
options
.
jio_key
,
view
:
options
.
view
,
editable
:
options
.
editable
,
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
erp5_form
:
options
.
erp5_form
||
{}
};
return
this
.
changeState
(
state_dict
);
})
.
declareMethod
(
'
updateDOM
'
,
function
()
{
var
gadget
=
this
;
var
gadget
=
this
;
// render the erp5 form
return
this
.
getDeclaredGadget
(
"
erp5_form
"
)
return
this
.
getDeclaredGadget
(
"
erp5_form
"
)
.
push
(
function
(
form_gadget
)
{
.
push
(
function
(
erp5_form
)
{
var
form_options
=
options
.
erp5_form
||
{}
,
var
form_options
=
gadget
.
state
.
erp5_form
,
rendered_form
=
options
.
erp5_document
.
_embedded
.
_view
,
rendered_form
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
,
rendered_field
,
rendered_field
,
key
;
key
;
...
@@ -46,32 +49,35 @@
...
@@ -46,32 +49,35 @@
}
}
}
}
form_options
.
erp5_document
=
options
.
erp5_document
;
form_options
.
erp5_document
=
gadget
.
state
.
erp5_document
;
form_options
.
form_definition
=
options
.
form_definition
;
form_options
.
form_definition
=
gadget
.
state
.
form_definition
;
form_options
.
view
=
options
.
view
;
form_options
.
view
=
gadget
.
state
.
view
;
return
erp5_form
.
render
(
form_options
);
})
// render the header
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
form_gadget
.
render
(
form_options
),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_next
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_next
'
}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}}),
calculatePageTitle
(
gadget
,
options
.
erp5_document
)
calculatePageTitle
(
gadget
,
gadget
.
state
.
erp5_document
)
]);
]);
})
})
.
push
(
function
(
all_result
)
{
.
push
(
function
(
all_result
)
{
return
gadget
.
updateHeader
({
return
gadget
.
updateHeader
({
edit_url
:
all_result
[
1
],
edit_url
:
all_result
[
0
],
actions_url
:
all_result
[
2
],
actions_url
:
all_result
[
1
],
selection_url
:
all_result
[
3
],
selection_url
:
all_result
[
2
],
previous_url
:
all_result
[
4
],
previous_url
:
all_result
[
3
],
next_url
:
all_result
[
5
],
next_url
:
all_result
[
4
],
tab_url
:
all_result
[
6
],
tab_url
:
all_result
[
5
],
export_url
:
""
,
export_url
:
""
,
page_title
:
all_result
[
7
]
page_title
:
all_result
[
6
]
});
});
});
});
});
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml
View file @
3e1c3ce2
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
2.13100.46637.65024
</string>
</value>
<value>
<string>
95
4.5630.32927.153
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
67219125.65
</float>
<float>
14
74546509.43
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment