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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
erp5
Commits
af3fb549
Commit
af3fb549
authored
Jun 15, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_gadget_interface_validator] JSLint
parent
fe9a9c94
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
550 additions
and
464 deletions
+550
-464
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_js.js
...r/PathTemplateItem/web_page_module/gadget_interface_js.js
+397
-325
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_js.xml
.../PathTemplateItem/web_page_module/gadget_interface_js.xml
+2
-2
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_form_js.js
...eb_page_module/gadget_interface_validator_page_form_js.js
+40
-33
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_form_js.xml
...b_page_module/gadget_interface_validator_page_form_js.xml
+2
-2
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_report_js.js
..._page_module/gadget_interface_validator_page_report_js.js
+93
-87
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_report_js.xml
...page_module/gadget_interface_validator_page_report_js.xml
+2
-2
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.js
...m/web_page_module/gadget_interface_validator_router_js.js
+12
-11
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.xml
.../web_page_module/gadget_interface_validator_router_js.xml
+2
-2
No files found.
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_js.js
View file @
af3fb549
This diff is collapsed.
Click to expand it.
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_js.xml
View file @
af3fb549
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.46289.58152.58624
</string>
</value>
<value>
<string>
9
68.15557.27071.42905
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
446475754.
4
</float>
<float>
1
529069154.3
4
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_form_js.js
View file @
af3fb549
/*global window, rJS, RSVP, Handlebars */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
)
{
/*global window, rJS, RSVP, Handlebars
, $, loopEventListener
*/
/*jslint nomen: true, indent: 2, maxerr: 3
, maxlen: 80
*/
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
$
,
loopEventListener
)
{
"
use strict
"
;
var
INTERFACE_GADGET_SCOPE
=
"
interface_gadget
"
;
var
INTERFACE_GADGET_SCOPE
=
"
interface_gadget
"
,
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
interface-validator-template
"
)
.
innerHTML
,
interface_validator_template
=
Handlebars
.
compile
(
source
);
function
fetchPageType
(
gadget_url
)
{
var
page_type
=
''
,
key
=
'
_page_
'
;
if
(
gadget_url
.
indexOf
(
key
)
>
-
1
)
{
if
(
gadget_url
.
indexOf
(
key
)
>
-
1
)
{
page_type
=
gadget_url
.
substring
(
gadget_url
.
indexOf
(
key
)
+
key
.
length
,
gadget_url
.
lastIndexOf
(
'
.
'
));
gadget_url
.
lastIndexOf
(
'
.
'
));
}
return
page_type
;
}
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
interface-validator-template
"
)
.
innerHTML
,
interface_validator_template
=
Handlebars
.
compile
(
source
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
...
...
@@ -38,7 +37,7 @@
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
,
g
.
props
.
element
=
element
;
g
.
props
.
content_element
=
element
.
querySelector
(
'
.appcache_form
'
);
});
})
...
...
@@ -56,10 +55,11 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
var
error_message
=
''
;
if
(
options
.
found
!==
undefined
&&
options
.
found
===
'
false
'
)
{
error_message
=
"
Error: Cannot load the appcache file. Please check and try again.
"
;
if
(
options
.
found
!==
undefined
&&
options
.
found
===
'
false
'
)
{
error_message
=
"
Error: Cannot load the appcache file.
"
+
"
Please check and try again.
"
;
}
gadget
.
props
.
content_element
.
innerHTML
=
interface_validator_template
({
...
...
@@ -76,7 +76,9 @@
.
declareService
(
function
()
{
////////////////////////////////////
// Form submit listening. Prevent browser to automatically handle the form submit in case of a bug
// Form submit listening.
// Prevent browser to automatically handle the form submit in
// case of a bug
////////////////////////////////////
var
gadget
=
this
;
function
formSubmit
(
submit_event
)
{
...
...
@@ -88,37 +90,42 @@
.
disabled
=
true
;
return
submit_event
.
target
[
0
].
value
;
})
.
push
(
function
(
submit_url
)
{
.
push
(
function
(
submit_url
)
{
appcache_url
=
submit_url
;
return
gadget
.
getDeclaredGadget
(
INTERFACE_GADGET_SCOPE
);
})
.
push
(
function
(
i_gadget
)
{
var
required_interface
=
'
gadget_interface_validator_reportpage_interface.html
'
,
.
push
(
function
(
i_gadget
)
{
var
required_interface
=
'
gadget_interface_validator_reportpage_interface.html
'
,
gadget_source_url
=
'
gadget_interface_validator.appcache
'
;
interface_gadget
=
i_gadget
;
return
interface_gadget
.
getGadgetListImplementingInterface
(
required_interface
,
gadget_source_url
);
return
interface_gadget
.
getGadgetListImplementingInterface
(
required_interface
,
gadget_source_url
);
})
.
push
(
function
(
gadget_list
)
{
if
(
gadget_list
.
length
>
0
)
{
.
push
(
function
(
gadget_list
)
{
if
(
gadget_list
.
length
>
0
)
{
var
page_type
=
fetchPageType
(
gadget_list
[
0
]);
return
gadget
.
redirect
({
page
:
page_type
,
appcache_url
:
appcache_url
});
}
else
{
return
gadget
.
redirect
({
found
:
false
});
}
return
gadget
.
redirect
({
found
:
false
});
});
}
// Listen to form submit
return
loopEventListener
(
gadget
.
props
.
content_element
.
querySelector
(
'
form.interface-validation-form
'
),
gadget
.
props
.
content_element
.
querySelector
(
'
form.interface-validation-form
'
),
'
submit
'
,
false
,
formSubmit
);
});
}(
window
,
rJS
,
RSVP
,
Handlebars
));
\ No newline at end of file
}(
window
,
rJS
,
RSVP
,
Handlebars
,
$
,
loopEventListener
));
\ No newline at end of file
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_form_js.xml
View file @
af3fb549
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.54877.22908.40635
</string>
</value>
<value>
<string>
9
68.15277.3815.5239
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
446717901.46
</float>
<float>
1
529052317.55
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_report_js.js
View file @
af3fb549
This diff is collapsed.
Click to expand it.
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_report_js.xml
View file @
af3fb549
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.54878.32293.23654
</string>
</value>
<value>
<string>
9
68.15263.39947.11758
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
446717974.43
</float>
<float>
1
529051525.57
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.js
View file @
af3fb549
/*global window, rJS */
/*jslint nomen: true, indent: 2 */
(
function
(
window
,
rJS
)
{
/*global window, rJS
, document, loopEventListener, RSVP
*/
/*jslint nomen: true, indent: 2
, maxlen: 80
*/
(
function
(
window
,
rJS
,
document
,
loopEventListener
,
RSVP
)
{
"
use strict
"
;
var
MAIN_PAGE_PREFIX
=
"
gadget_interface_validator_
"
,
var
MAIN_PAGE_PREFIX
=
"
gadget_interface_validator_
"
,
DEFAULT_PAGE
=
"
form
"
,
REDIRECT_TIMEOUT
=
5000
;
...
...
@@ -23,7 +23,8 @@
if
(
subhash
!==
''
)
{
keyvalue
=
subhash
.
split
(
'
=
'
);
if
(
keyvalue
.
length
===
2
)
{
args
[
decodeURIComponent
(
keyvalue
[
0
])]
=
decodeURIComponent
(
keyvalue
[
1
]);
args
[
decodeURIComponent
(
keyvalue
[
0
])]
=
decodeURIComponent
(
keyvalue
[
1
]);
}
}
}
...
...
@@ -52,7 +53,7 @@
};
})
.
declareMethod
(
"
getCommandUrlFor
"
,
function
(
options
)
{
.
declareMethod
(
"
getCommandUrlFor
"
,
function
(
options
)
{
var
prefix
=
''
,
result
,
key
;
...
...
@@ -60,7 +61,8 @@
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
)
&&
options
[
key
]
!==
undefined
)
{
// Don't keep empty values
result
+=
prefix
+
encodeURIComponent
(
key
)
+
"
=
"
+
encodeURIComponent
(
options
[
key
]);
result
+=
prefix
+
encodeURIComponent
(
key
)
+
"
=
"
+
encodeURIComponent
(
options
[
key
]);
prefix
=
'
&
'
;
}
}
...
...
@@ -79,8 +81,7 @@
})
.
declareMethod
(
'
route
'
,
function
(
options
)
{
var
gadget
=
this
,
args
=
options
.
args
,
var
args
=
options
.
args
,
page
;
page
=
args
.
page
||
DEFAULT_PAGE
;
...
...
@@ -105,4 +106,4 @@
});
});
}(
window
,
rJS
));
\ No newline at end of file
}(
window
,
rJS
,
document
,
loopEventListener
,
RSVP
));
\ No newline at end of file
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.xml
View file @
af3fb549
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
46.58912.52724.48776
</string>
</value>
<value>
<string>
9
68.15281.35451.28142
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
446805302.57
</float>
<float>
1
529052586.11
</float>
<string>
UTC
</string>
</tuple>
</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