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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alain Takoudjou
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
Show 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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<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>
1
446475754.
4
</float>
<float>
1
529069154.3
4
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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 */
/*global window, rJS, RSVP, Handlebars
, $, loopEventListener
*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3
, maxlen: 80
*/
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
)
{
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
$
,
loopEventListener
)
{
"
use strict
"
;
"
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
)
{
function
fetchPageType
(
gadget_url
)
{
var
page_type
=
''
,
var
page_type
=
''
,
key
=
'
_page_
'
;
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
,
page_type
=
gadget_url
.
substring
(
gadget_url
.
indexOf
(
key
)
+
key
.
length
,
gadget_url
.
lastIndexOf
(
'
.
'
));
gadget_url
.
lastIndexOf
(
'
.
'
));
}
}
return
page_type
;
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
gadget_klass
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// ready
// ready
...
@@ -38,7 +37,7 @@
...
@@ -38,7 +37,7 @@
.
ready
(
function
(
g
)
{
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
return
g
.
getElement
()
.
push
(
function
(
element
)
{
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
,
g
.
props
.
element
=
element
;
g
.
props
.
content_element
=
element
.
querySelector
(
'
.appcache_form
'
);
g
.
props
.
content_element
=
element
.
querySelector
(
'
.appcache_form
'
);
});
});
})
})
...
@@ -56,10 +55,11 @@
...
@@ -56,10 +55,11 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
var
error_message
=
''
;
var
error_message
=
''
;
if
(
options
.
found
!==
undefined
&&
options
.
found
===
'
false
'
)
{
if
(
options
.
found
!==
undefined
&&
options
.
found
===
'
false
'
)
{
error_message
=
"
Error: Cannot load the appcache file. Please check and try again.
"
;
error_message
=
"
Error: Cannot load the appcache file.
"
+
"
Please check and try again.
"
;
}
}
gadget
.
props
.
content_element
.
innerHTML
=
gadget
.
props
.
content_element
.
innerHTML
=
interface_validator_template
({
interface_validator_template
({
...
@@ -76,7 +76,9 @@
...
@@ -76,7 +76,9 @@
.
declareService
(
function
()
{
.
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
;
var
gadget
=
this
;
function
formSubmit
(
submit_event
)
{
function
formSubmit
(
submit_event
)
{
...
@@ -88,37 +90,42 @@
...
@@ -88,37 +90,42 @@
.
disabled
=
true
;
.
disabled
=
true
;
return
submit_event
.
target
[
0
].
value
;
return
submit_event
.
target
[
0
].
value
;
})
})
.
push
(
function
(
submit_url
)
{
.
push
(
function
(
submit_url
)
{
appcache_url
=
submit_url
;
appcache_url
=
submit_url
;
return
gadget
.
getDeclaredGadget
(
INTERFACE_GADGET_SCOPE
);
return
gadget
.
getDeclaredGadget
(
INTERFACE_GADGET_SCOPE
);
})
})
.
push
(
function
(
i_gadget
)
{
.
push
(
function
(
i_gadget
)
{
var
required_interface
=
'
gadget_interface_validator_reportpage_interface.html
'
,
var
required_interface
=
'
gadget_interface_validator_reportpage_interface.html
'
,
gadget_source_url
=
'
gadget_interface_validator.appcache
'
;
gadget_source_url
=
'
gadget_interface_validator.appcache
'
;
interface_gadget
=
i_gadget
;
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
)
{
.
push
(
function
(
gadget_list
)
{
if
(
gadget_list
.
length
>
0
)
{
if
(
gadget_list
.
length
>
0
)
{
var
page_type
=
fetchPageType
(
gadget_list
[
0
]);
var
page_type
=
fetchPageType
(
gadget_list
[
0
]);
return
gadget
.
redirect
({
return
gadget
.
redirect
({
page
:
page_type
,
page
:
page_type
,
appcache_url
:
appcache_url
appcache_url
:
appcache_url
});
});
}
else
{
}
return
gadget
.
redirect
({
return
gadget
.
redirect
({
found
:
false
found
:
false
});
});
}
});
});
}
}
// Listen to form submit
// Listen to form submit
return
loopEventListener
(
return
loopEventListener
(
gadget
.
props
.
content_element
.
querySelector
(
'
form.interface-validation-form
'
),
gadget
.
props
.
content_element
.
querySelector
(
'
form.interface-validation-form
'
),
'
submit
'
,
'
submit
'
,
false
,
false
,
formSubmit
formSubmit
);
);
});
});
}(
window
,
rJS
,
RSVP
,
Handlebars
));
}(
window
,
rJS
,
RSVP
,
Handlebars
,
$
,
loopEventListener
));
\ No newline at end of file
\ 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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<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>
1
446717901.46
</float>
<float>
1
529052317.55
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<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>
1
446717974.43
</float>
<float>
1
529051525.57
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.js
View file @
af3fb549
/*global window, rJS */
/*global window, rJS
, document, loopEventListener, RSVP
*/
/*jslint nomen: true, indent: 2 */
/*jslint nomen: true, indent: 2
, maxlen: 80
*/
(
function
(
window
,
rJS
)
{
(
function
(
window
,
rJS
,
document
,
loopEventListener
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
var
MAIN_PAGE_PREFIX
=
"
gadget_interface_validator_
"
,
var
MAIN_PAGE_PREFIX
=
"
gadget_interface_validator_
"
,
...
@@ -23,7 +23,8 @@
...
@@ -23,7 +23,8 @@
if
(
subhash
!==
''
)
{
if
(
subhash
!==
''
)
{
keyvalue
=
subhash
.
split
(
'
=
'
);
keyvalue
=
subhash
.
split
(
'
=
'
);
if
(
keyvalue
.
length
===
2
)
{
if
(
keyvalue
.
length
===
2
)
{
args
[
decodeURIComponent
(
keyvalue
[
0
])]
=
decodeURIComponent
(
keyvalue
[
1
]);
args
[
decodeURIComponent
(
keyvalue
[
0
])]
=
decodeURIComponent
(
keyvalue
[
1
]);
}
}
}
}
}
}
...
@@ -52,7 +53,7 @@
...
@@ -52,7 +53,7 @@
};
};
})
})
.
declareMethod
(
"
getCommandUrlFor
"
,
function
(
options
)
{
.
declareMethod
(
"
getCommandUrlFor
"
,
function
(
options
)
{
var
prefix
=
''
,
var
prefix
=
''
,
result
,
result
,
key
;
key
;
...
@@ -60,7 +61,8 @@
...
@@ -60,7 +61,8 @@
for
(
key
in
options
)
{
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
)
&&
options
[
key
]
!==
undefined
)
{
if
(
options
.
hasOwnProperty
(
key
)
&&
options
[
key
]
!==
undefined
)
{
// Don't keep empty values
// Don't keep empty values
result
+=
prefix
+
encodeURIComponent
(
key
)
+
"
=
"
+
encodeURIComponent
(
options
[
key
]);
result
+=
prefix
+
encodeURIComponent
(
key
)
+
"
=
"
+
encodeURIComponent
(
options
[
key
]);
prefix
=
'
&
'
;
prefix
=
'
&
'
;
}
}
}
}
...
@@ -79,8 +81,7 @@
...
@@ -79,8 +81,7 @@
})
})
.
declareMethod
(
'
route
'
,
function
(
options
)
{
.
declareMethod
(
'
route
'
,
function
(
options
)
{
var
gadget
=
this
,
var
args
=
options
.
args
,
args
=
options
.
args
,
page
;
page
;
page
=
args
.
page
||
DEFAULT_PAGE
;
page
=
args
.
page
||
DEFAULT_PAGE
;
...
@@ -105,4 +106,4 @@
...
@@ -105,4 +106,4 @@
});
});
});
});
}(
window
,
rJS
));
}(
window
,
rJS
,
document
,
loopEventListener
,
RSVP
));
\ No newline at end of file
\ 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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<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>
1
446805302.57
</float>
<float>
1
529052586.11
</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