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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
erp5
Commits
2952a078
Commit
2952a078
authored
Nov 23, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_xhtml_style/erp5_web_renderjs_ui: update to renderJS 0.12.0
parent
3562b3bc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
388 additions
and
78 deletions
+388
-78
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js
...js_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js
+23
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
...s_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
+2
-2
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js
...TemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js
+363
-65
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.xml
...emplateItem/portal_skins/erp5_xhtml_style/renderjs.js.xml
+0
-8
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js
View file @
2952a078
...
@@ -1120,6 +1120,7 @@ if (typeof document.contains !== 'function') {
...
@@ -1120,6 +1120,7 @@ if (typeof document.contains !== 'function') {
};
};
RenderJSGadget
.
setState
=
function
(
state_dict
)
{
RenderJSGadget
.
setState
=
function
(
state_dict
)
{
var
json_state
=
JSON
.
stringify
(
state_dict
);
var
json_state
=
JSON
.
stringify
(
state_dict
);
this
.
prototype
.
__json_state
=
json_state
;
return
this
.
ready
(
function
()
{
return
this
.
ready
(
function
()
{
this
.
state
=
JSON
.
parse
(
json_state
);
this
.
state
=
JSON
.
parse
(
json_state
);
});
});
...
@@ -1250,7 +1251,8 @@ if (typeof document.contains !== 'function') {
...
@@ -1250,7 +1251,8 @@ if (typeof document.contains !== 'function') {
.
declareMethod
(
'
changeState
'
,
function
(
state_dict
)
{
.
declareMethod
(
'
changeState
'
,
function
(
state_dict
)
{
var
key
,
var
key
,
modified
=
false
,
modified
=
false
,
modification_dict
=
{};
modification_dict
=
{},
context
=
this
;
for
(
key
in
state_dict
)
{
for
(
key
in
state_dict
)
{
if
(
state_dict
[
key
]
!==
this
.
state
[
key
])
{
if
(
state_dict
[
key
]
!==
this
.
state
[
key
])
{
this
.
state
[
key
]
=
state_dict
[
key
];
this
.
state
[
key
]
=
state_dict
[
key
];
...
@@ -1259,7 +1261,18 @@ if (typeof document.contains !== 'function') {
...
@@ -1259,7 +1261,18 @@ if (typeof document.contains !== 'function') {
}
}
}
}
if
(
modified
&&
this
.
__state_change_callback
!==
undefined
)
{
if
(
modified
&&
this
.
__state_change_callback
!==
undefined
)
{
return
this
.
__state_change_callback
(
modification_dict
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
context
.
__state_change_callback
(
modification_dict
);
})
.
push
(
undefined
,
function
(
error
)
{
if
(
context
.
__json_state
!==
undefined
)
{
context
.
state
=
JSON
.
parse
(
context
.
__json_state
);
}
else
{
context
.
state
=
{};
}
throw
error
;
});
}
}
});
});
...
@@ -1622,7 +1635,14 @@ if (typeof document.contains !== 'function') {
...
@@ -1622,7 +1635,14 @@ if (typeof document.contains !== 'function') {
gadget_loading_klass
=
undefined
;
gadget_loading_klass
=
undefined
;
throw
e
;
throw
e
;
});
});
local_loading_klass_promise
=
loading_klass_promise
;
//gadget loading should not be interrupted
//if not, gadget's definition will not be complete
//.then will return another promise
//so loading_klass_promise can't be cancel
local_loading_klass_promise
=
loading_klass_promise
.
then
(
function
(
gadget_instance
)
{
return
gadget_instance
;
});
queue
=
new
RSVP
.
Queue
()
queue
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
View file @
2952a078
...
@@ -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
4.33025.37475.1638
</string>
</value>
<value>
<string>
95
5.29626.47611.24814
</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>
147
6192938.84
</float>
<float>
147
9897063.05
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js
View file @
2952a078
...
@@ -673,7 +673,7 @@ if (typeof document.contains !== 'function') {
...
@@ -673,7 +673,7 @@ if (typeof document.contains !== 'function') {
* http://www.renderjs.org/documentation
* http://www.renderjs.org/documentation
*/
*/
(
function
(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
(
function
(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
FileReader
,
Blob
)
{
Node
,
FileReader
,
Blob
,
navigator
,
Event
)
{
"
use strict
"
;
"
use strict
"
;
function
readBlobAsDataURL
(
blob
)
{
function
readBlobAsDataURL
(
blob
)
{
...
@@ -689,6 +689,66 @@ if (typeof document.contains !== 'function') {
...
@@ -689,6 +689,66 @@ if (typeof document.contains !== 'function') {
});
});
}
}
function
loopEventListener
(
target
,
type
,
useCapture
,
callback
,
prevent_default
)
{
//////////////////////////
// Infinite event listener (promise is never resolved)
// eventListener is removed when promise is cancelled/rejected
//////////////////////////
var
handle_event_callback
,
callback_promise
;
if
(
prevent_default
===
undefined
)
{
prevent_default
=
true
;
}
function
cancelResolver
()
{
if
((
callback_promise
!==
undefined
)
&&
(
typeof
callback_promise
.
cancel
===
"
function
"
))
{
callback_promise
.
cancel
();
}
}
function
canceller
()
{
if
(
handle_event_callback
!==
undefined
)
{
target
.
removeEventListener
(
type
,
handle_event_callback
,
useCapture
);
}
cancelResolver
();
}
function
itsANonResolvableTrap
(
resolve
,
reject
)
{
var
result
;
handle_event_callback
=
function
(
evt
)
{
if
(
prevent_default
)
{
evt
.
stopPropagation
();
evt
.
preventDefault
();
}
cancelResolver
();
try
{
result
=
callback
(
evt
);
}
catch
(
e
)
{
result
=
RSVP
.
reject
(
e
);
}
callback_promise
=
result
;
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
result
;
})
.
push
(
undefined
,
function
(
error
)
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
canceller
();
reject
(
error
);
}
});
};
target
.
addEventListener
(
type
,
handle_event_callback
,
useCapture
);
}
return
new
RSVP
.
Promise
(
itsANonResolvableTrap
,
canceller
);
}
function
ajax
(
url
)
{
function
ajax
(
url
)
{
var
xhr
;
var
xhr
;
function
resolver
(
resolve
,
reject
)
{
function
resolver
(
resolve
,
reject
)
{
...
@@ -737,7 +797,19 @@ if (typeof document.contains !== 'function') {
...
@@ -737,7 +797,19 @@ if (typeof document.contains !== 'function') {
renderJS
,
renderJS
,
Monitor
,
Monitor
,
scope_increment
=
0
,
scope_increment
=
0
,
isAbsoluteOrDataURL
=
new
RegExp
(
'
^(?:[a-z]+:)?//|data:
'
,
'
i
'
);
isAbsoluteOrDataURL
=
new
RegExp
(
'
^(?:[a-z]+:)?//|data:
'
,
'
i
'
),
is_page_unloaded
=
false
,
error_list
=
[];
window
.
addEventListener
(
'
error
'
,
function
(
error
)
{
error_list
.
push
(
error
);
});
window
.
addEventListener
(
'
beforeunload
'
,
function
()
{
// XXX If another listener cancel the page unload,
// it will not restore renderJS crash report
is_page_unloaded
=
true
;
});
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Helper functions
// Helper functions
...
@@ -751,23 +823,111 @@ if (typeof document.contains !== 'function') {
...
@@ -751,23 +823,111 @@ if (typeof document.contains !== 'function') {
}
}
function
letsCrash
(
e
)
{
function
letsCrash
(
e
)
{
if
(
e
.
constructor
===
XMLHttpRequest
)
{
var
i
,
e
=
{
body
,
readyState
:
e
.
readyState
,
container
,
status
:
e
.
status
,
paragraph
,
statusText
:
e
.
statusText
,
link
,
response_headers
:
e
.
getAllResponseHeaders
()
error
;
};
if
(
is_page_unloaded
)
{
/*global console*/
console
.
info
(
'
-- Error dropped, as page is unloaded
'
);
console
.
info
(
e
);
return
;
}
}
if
(
e
.
constructor
===
Array
||
e
.
constructor
===
String
||
error_list
.
push
(
e
);
e
.
constructor
===
Object
)
{
// Add error handling stack
try
{
error_list
.
push
(
new
Error
(
'
stopping renderJS
'
));
e
=
JSON
.
stringify
(
e
);
}
catch
(
ignore
)
{
body
=
document
.
getElementsByTagName
(
'
body
'
)[
0
];
while
(
body
.
firstChild
)
{
body
.
removeChild
(
body
.
firstChild
);
}
container
=
document
.
createElement
(
"
section
"
);
paragraph
=
document
.
createElement
(
"
h1
"
);
paragraph
.
textContent
=
'
Unhandled Error
'
;
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
Please report this error to the support team
'
;
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
Location:
'
;
link
=
document
.
createElement
(
"
a
"
);
link
.
href
=
link
.
textContent
=
window
.
location
.
toString
();
paragraph
.
appendChild
(
link
);
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
User-agent:
'
+
navigator
.
userAgent
;
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
Date:
'
+
new
Date
(
Date
.
now
()).
toISOString
();
container
.
appendChild
(
paragraph
);
body
.
appendChild
(
container
);
for
(
i
=
0
;
i
<
error_list
.
length
;
i
+=
1
)
{
error
=
error_list
[
i
];
if
(
error
instanceof
Event
)
{
error
=
{
string
:
error
.
toString
(),
message
:
error
.
message
,
type
:
error
.
type
,
target
:
error
.
target
};
if
(
error
.
target
!==
undefined
)
{
error_list
.
splice
(
i
+
1
,
0
,
error
.
target
);
}
}
if
(
error
instanceof
XMLHttpRequest
)
{
error
=
{
message
:
error
.
toString
(),
readyState
:
error
.
readyState
,
status
:
error
.
status
,
statusText
:
error
.
statusText
,
response
:
error
.
response
,
responseUrl
:
error
.
responseUrl
,
response_headers
:
error
.
getAllResponseHeaders
()
};
}
}
if
(
error
.
constructor
===
Array
||
error
.
constructor
===
String
||
error
.
constructor
===
Object
)
{
try
{
error
=
JSON
.
stringify
(
error
);
}
catch
(
ignore
)
{
}
}
container
=
document
.
createElement
(
"
section
"
);
paragraph
=
document
.
createElement
(
"
h2
"
);
paragraph
.
textContent
=
error
.
message
||
error
;
container
.
appendChild
(
paragraph
);
if
(
error
.
fileName
!==
undefined
)
{
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
File:
'
+
error
.
fileName
+
'
:
'
+
error
.
lineNumber
;
container
.
appendChild
(
paragraph
);
}
if
(
error
.
stack
!==
undefined
)
{
paragraph
=
document
.
createElement
(
"
pre
"
);
paragraph
.
textContent
=
'
Stack:
'
+
error
.
stack
;
container
.
appendChild
(
paragraph
);
}
body
.
appendChild
(
container
);
}
}
document
.
getElementsByTagName
(
'
body
'
)[
0
].
textContent
=
e
;
// XXX Do not crash the application if it fails
// XXX Do not crash the application if it fails
// Where to write the error?
// Where to write the error?
/*global console*/
/*global console*/
...
@@ -908,6 +1068,9 @@ if (typeof document.contains !== 'function') {
...
@@ -908,6 +1068,9 @@ if (typeof document.contains !== 'function') {
g
.
__monitor
.
cancel
();
g
.
__monitor
.
cancel
();
}
}
g
.
__monitor
=
new
Monitor
();
g
.
__monitor
=
new
Monitor
();
g
.
__job_dict
=
{};
g
.
__job_list
=
[];
g
.
__job_triggered
=
false
;
g
.
__monitor
.
fail
(
function
(
error
)
{
g
.
__monitor
.
fail
(
function
(
error
)
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
return
g
.
aq_reportServiceError
(
error
);
return
g
.
aq_reportServiceError
(
error
);
...
@@ -924,7 +1087,7 @@ if (typeof document.contains !== 'function') {
...
@@ -924,7 +1087,7 @@ if (typeof document.contains !== 'function') {
}
}
function
loadSubGadgetDOMDeclaration
(
g
)
{
function
loadSubGadgetDOMDeclaration
(
g
)
{
var
element_list
=
g
.
__
element
.
querySelectorAll
(
'
[data-gadget-url]
'
),
var
element_list
=
g
.
element
.
querySelectorAll
(
'
[data-gadget-url]
'
),
element
,
element
,
promise_list
=
[],
promise_list
=
[],
scope
,
scope
,
...
@@ -955,25 +1118,90 @@ if (typeof document.contains !== 'function') {
...
@@ -955,25 +1118,90 @@ if (typeof document.contains !== 'function') {
this
.
__ready_list
.
push
(
callback
);
this
.
__ready_list
.
push
(
callback
);
return
this
;
return
this
;
};
};
RenderJSGadget
.
setState
=
function
(
state_dict
)
{
var
json_state
=
JSON
.
stringify
(
state_dict
);
this
.
prototype
.
__json_state
=
json_state
;
return
this
.
ready
(
function
()
{
this
.
state
=
JSON
.
parse
(
json_state
);
});
};
RenderJSGadget
.
onStateChange
=
function
(
callback
)
{
this
.
prototype
.
__state_change_callback
=
callback
;
return
this
;
};
RenderJSGadget
.
__service_list
=
[];
RenderJSGadget
.
__service_list
=
[];
RenderJSGadget
.
declareService
=
function
(
callback
)
{
RenderJSGadget
.
declareService
=
function
(
callback
)
{
this
.
__service_list
.
push
(
callback
);
this
.
__service_list
.
push
(
callback
);
return
this
;
return
this
;
};
};
RenderJSGadget
.
onEvent
=
function
(
type
,
callback
,
use_capture
,
prevent_default
)
{
this
.
__service_list
.
push
(
function
()
{
return
loopEventListener
(
this
.
element
,
type
,
use_capture
,
callback
.
bind
(
this
),
prevent_default
);
});
return
this
;
};
function
runJob
(
gadget
,
name
,
callback
,
argument_list
)
{
var
job_promise
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
callback
.
apply
(
gadget
,
argument_list
);
});
if
(
gadget
.
__job_dict
.
hasOwnProperty
(
name
))
{
gadget
.
__job_dict
[
name
].
cancel
();
}
gadget
.
__job_dict
[
name
]
=
job_promise
;
gadget
.
__monitor
.
monitor
(
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
job_promise
;
})
.
push
(
undefined
,
function
(
error
)
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
throw
error
;
}
}));
}
function
startService
(
gadget
)
{
function
startService
(
gadget
)
{
gadget
.
__monitor
.
monitor
(
new
RSVP
.
Queue
()
gadget
.
__monitor
.
monitor
(
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
var
i
,
var
i
,
service_list
=
gadget
.
constructor
.
__service_list
;
service_list
=
gadget
.
constructor
.
__service_list
,
job_list
=
gadget
.
__job_list
;
for
(
i
=
0
;
i
<
service_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
service_list
.
length
;
i
+=
1
)
{
gadget
.
__monitor
.
monitor
(
service_list
[
i
].
apply
(
gadget
));
gadget
.
__monitor
.
monitor
(
service_list
[
i
].
apply
(
gadget
));
}
}
for
(
i
=
0
;
i
<
job_list
.
length
;
i
+=
1
)
{
runJob
(
gadget
,
job_list
[
i
][
0
],
job_list
[
i
][
1
],
job_list
[
i
][
2
]);
}
gadget
.
__job_list
=
[];
gadget
.
__job_triggered
=
true
;
})
})
);
);
}
}
/////////////////////////////////////////////////////////////////
// RenderJSGadget.declareJob
// gadget internal method, which trigger execution
// of a function inside a service
/////////////////////////////////////////////////////////////////
RenderJSGadget
.
declareJob
=
function
(
name
,
callback
)
{
this
.
prototype
[
name
]
=
function
()
{
var
context
=
this
,
argument_list
=
arguments
;
if
(
context
.
__job_triggered
)
{
runJob
(
context
,
name
,
callback
,
argument_list
);
}
else
{
context
.
__job_list
.
push
([
name
,
callback
,
argument_list
]);
}
};
// Allow chain
return
this
;
};
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// RenderJSGadget.declareMethod
// RenderJSGadget.declareMethod
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -1014,10 +1242,38 @@ if (typeof document.contains !== 'function') {
...
@@ -1014,10 +1242,38 @@ if (typeof document.contains !== 'function') {
})
})
.
declareMethod
(
'
getElement
'
,
function
()
{
.
declareMethod
(
'
getElement
'
,
function
()
{
// Returns the DOM Element of a gadget
// Returns the DOM Element of a gadget
if
(
this
.
__element
===
undefined
)
{
// XXX Kept for compatibility. Use element property directly
if
(
this
.
element
===
undefined
)
{
throw
new
Error
(
"
No element defined
"
);
throw
new
Error
(
"
No element defined
"
);
}
}
return
this
.
__element
;
return
this
.
element
;
})
.
declareMethod
(
'
changeState
'
,
function
(
state_dict
)
{
var
key
,
modified
=
false
,
modification_dict
=
{},
context
=
this
;
for
(
key
in
state_dict
)
{
if
(
state_dict
[
key
]
!==
this
.
state
[
key
])
{
this
.
state
[
key
]
=
state_dict
[
key
];
modification_dict
[
key
]
=
state_dict
[
key
];
modified
=
true
;
}
}
if
(
modified
&&
this
.
__state_change_callback
!==
undefined
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
context
.
__state_change_callback
(
modification_dict
);
})
.
push
(
undefined
,
function
(
error
)
{
if
(
context
.
__json_state
!==
undefined
)
{
context
.
state
=
JSON
.
parse
(
context
.
__json_state
);
}
else
{
context
.
state
=
{};
}
throw
error
;
});
}
});
});
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -1106,8 +1362,14 @@ if (typeof document.contains !== 'function') {
...
@@ -1106,8 +1362,14 @@ if (typeof document.contains !== 'function') {
RenderJSGadget
.
__service_list
.
slice
();
RenderJSGadget
.
__service_list
.
slice
();
RenderJSEmbeddedGadget
.
ready
=
RenderJSEmbeddedGadget
.
ready
=
RenderJSGadget
.
ready
;
RenderJSGadget
.
ready
;
RenderJSEmbeddedGadget
.
setState
=
RenderJSGadget
.
setState
;
RenderJSEmbeddedGadget
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
RenderJSEmbeddedGadget
.
declareService
=
RenderJSEmbeddedGadget
.
declareService
=
RenderJSGadget
.
declareService
;
RenderJSGadget
.
declareService
;
RenderJSEmbeddedGadget
.
onEvent
=
RenderJSGadget
.
onEvent
;
RenderJSEmbeddedGadget
.
prototype
=
new
RenderJSGadget
();
RenderJSEmbeddedGadget
.
prototype
=
new
RenderJSGadget
();
RenderJSEmbeddedGadget
.
prototype
.
constructor
=
RenderJSEmbeddedGadget
;
RenderJSEmbeddedGadget
.
prototype
.
constructor
=
RenderJSEmbeddedGadget
;
...
@@ -1136,9 +1398,10 @@ if (typeof document.contains !== 'function') {
...
@@ -1136,9 +1398,10 @@ if (typeof document.contains !== 'function') {
template_node_list
=
Klass
.
__template_element
.
body
.
childNodes
;
template_node_list
=
Klass
.
__template_element
.
body
.
childNodes
;
gadget_loading_klass
=
Klass
;
gadget_loading_klass
=
Klass
;
gadget_instance
=
new
Klass
();
gadget_instance
=
new
Klass
();
gadget_instance
.
__element
=
options
.
element
;
gadget_instance
.
element
=
options
.
element
;
gadget_instance
.
state
=
{};
for
(
i
=
0
;
i
<
template_node_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
template_node_list
.
length
;
i
+=
1
)
{
gadget_instance
.
__
element
.
appendChild
(
gadget_instance
.
element
.
appendChild
(
template_node_list
[
i
].
cloneNode
(
true
)
template_node_list
[
i
].
cloneNode
(
true
)
);
);
}
}
...
@@ -1180,9 +1443,15 @@ if (typeof document.contains !== 'function') {
...
@@ -1180,9 +1443,15 @@ if (typeof document.contains !== 'function') {
RenderJSIframeGadget
.
__ready_list
=
RenderJSGadget
.
__ready_list
.
slice
();
RenderJSIframeGadget
.
__ready_list
=
RenderJSGadget
.
__ready_list
.
slice
();
RenderJSIframeGadget
.
ready
=
RenderJSIframeGadget
.
ready
=
RenderJSGadget
.
ready
;
RenderJSGadget
.
ready
;
RenderJSIframeGadget
.
setState
=
RenderJSGadget
.
setState
;
RenderJSIframeGadget
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
RenderJSIframeGadget
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
RenderJSIframeGadget
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
RenderJSIframeGadget
.
declareService
=
RenderJSIframeGadget
.
declareService
=
RenderJSGadget
.
declareService
;
RenderJSGadget
.
declareService
;
RenderJSIframeGadget
.
onEvent
=
RenderJSGadget
.
onEvent
;
RenderJSIframeGadget
.
prototype
=
new
RenderJSGadget
();
RenderJSIframeGadget
.
prototype
=
new
RenderJSGadget
();
RenderJSIframeGadget
.
prototype
.
constructor
=
RenderJSIframeGadget
;
RenderJSIframeGadget
.
prototype
.
constructor
=
RenderJSIframeGadget
;
...
@@ -1210,7 +1479,8 @@ if (typeof document.contains !== 'function') {
...
@@ -1210,7 +1479,8 @@ if (typeof document.contains !== 'function') {
// gadget_instance.element.setAttribute("seamless", "seamless");
// gadget_instance.element.setAttribute("seamless", "seamless");
iframe
.
setAttribute
(
"
src
"
,
url
);
iframe
.
setAttribute
(
"
src
"
,
url
);
gadget_instance
.
__path
=
url
;
gadget_instance
.
__path
=
url
;
gadget_instance
.
__element
=
options
.
element
;
gadget_instance
.
element
=
options
.
element
;
gadget_instance
.
state
=
{};
// Attach it to the DOM
// Attach it to the DOM
options
.
element
.
appendChild
(
iframe
);
options
.
element
.
appendChild
(
iframe
);
...
@@ -1273,7 +1543,13 @@ if (typeof document.contains !== 'function') {
...
@@ -1273,7 +1543,13 @@ if (typeof document.contains !== 'function') {
iframe_loading_deferred
.
promise
,
iframe_loading_deferred
.
promise
,
// Timeout to prevent non renderJS embeddable gadget
// Timeout to prevent non renderJS embeddable gadget
// XXX Maybe using iframe.onload/onerror would be safer?
// XXX Maybe using iframe.onload/onerror would be safer?
RSVP
.
timeout
(
5000
)
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
timeout
(
5000
);
})
.
push
(
undefined
,
function
()
{
throw
new
Error
(
'
Timeout while loading:
'
+
url
);
})
]);
]);
}
}
...
@@ -1359,7 +1635,14 @@ if (typeof document.contains !== 'function') {
...
@@ -1359,7 +1635,14 @@ if (typeof document.contains !== 'function') {
gadget_loading_klass
=
undefined
;
gadget_loading_klass
=
undefined
;
throw
e
;
throw
e
;
});
});
local_loading_klass_promise
=
loading_klass_promise
;
//gadget loading should not be interrupted
//if not, gadget's definition will not be complete
//.then will return another promise
//so loading_klass_promise can't be cancel
local_loading_klass_promise
=
loading_klass_promise
.
then
(
function
(
gadget_instance
)
{
return
gadget_instance
;
});
queue
=
new
RSVP
.
Queue
()
queue
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -1373,10 +1656,17 @@ if (typeof document.contains !== 'function') {
...
@@ -1373,10 +1656,17 @@ if (typeof document.contains !== 'function') {
function
ready_wrapper
()
{
function
ready_wrapper
()
{
return
gadget_instance
;
return
gadget_instance
;
}
}
function
ready_executable_wrapper
(
fct
)
{
return
function
(
g
)
{
return
fct
.
call
(
g
,
g
);
};
}
for
(
i
=
0
;
i
<
gadget_instance
.
constructor
.
__ready_list
.
length
;
for
(
i
=
0
;
i
<
gadget_instance
.
constructor
.
__ready_list
.
length
;
i
+=
1
)
{
i
+=
1
)
{
// Put a timeout?
// Put a timeout?
queue
.
push
(
gadget_instance
.
constructor
.
__ready_list
[
i
]);
queue
.
push
(
ready_executable_wrapper
(
gadget_instance
.
constructor
.
__ready_list
[
i
]
));
// Always return the gadget instance after ready function
// Always return the gadget instance after ready function
queue
.
push
(
ready_wrapper
);
queue
.
push
(
ready_wrapper
);
}
}
...
@@ -1392,16 +1682,16 @@ if (typeof document.contains !== 'function') {
...
@@ -1392,16 +1682,16 @@ if (typeof document.contains !== 'function') {
}
}
}
}
parent_gadget
.
__sub_gadget_dict
[
scope
]
=
gadget_instance
;
parent_gadget
.
__sub_gadget_dict
[
scope
]
=
gadget_instance
;
gadget_instance
.
__
element
.
setAttribute
(
"
data-gadget-scope
"
,
gadget_instance
.
element
.
setAttribute
(
"
data-gadget-scope
"
,
scope
);
scope
);
// Put some attribute to ease page layout comprehension
// Put some attribute to ease page layout comprehension
gadget_instance
.
__
element
.
setAttribute
(
"
data-gadget-url
"
,
url
);
gadget_instance
.
element
.
setAttribute
(
"
data-gadget-url
"
,
url
);
gadget_instance
.
__
element
.
setAttribute
(
"
data-gadget-sandbox
"
,
gadget_instance
.
element
.
setAttribute
(
"
data-gadget-sandbox
"
,
options
.
sandbox
);
options
.
sandbox
);
gadget_instance
.
__
element
.
_gadget
=
gadget_instance
;
gadget_instance
.
element
.
_gadget
=
gadget_instance
;
if
(
document
.
contains
(
gadget_instance
.
__
element
))
{
if
(
document
.
contains
(
gadget_instance
.
element
))
{
// Put a timeout
// Put a timeout
queue
.
push
(
startService
);
queue
.
push
(
startService
);
}
}
...
@@ -1554,14 +1844,22 @@ if (typeof document.contains !== 'function') {
...
@@ -1554,14 +1844,22 @@ if (typeof document.contains !== 'function') {
tmp_constructor
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
tmp_constructor
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
tmp_constructor
.
declareMethod
=
tmp_constructor
.
declareMethod
=
RenderJSGadget
.
declareMethod
;
RenderJSGadget
.
declareMethod
;
tmp_constructor
.
declareJob
=
RenderJSGadget
.
declareJob
;
tmp_constructor
.
declareAcquiredMethod
=
tmp_constructor
.
declareAcquiredMethod
=
RenderJSGadget
.
declareAcquiredMethod
;
RenderJSGadget
.
declareAcquiredMethod
;
tmp_constructor
.
allowPublicAcquisition
=
tmp_constructor
.
allowPublicAcquisition
=
RenderJSGadget
.
allowPublicAcquisition
;
RenderJSGadget
.
allowPublicAcquisition
;
tmp_constructor
.
ready
=
tmp_constructor
.
ready
=
RenderJSGadget
.
ready
;
RenderJSGadget
.
ready
;
tmp_constructor
.
setState
=
RenderJSGadget
.
setState
;
tmp_constructor
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
tmp_constructor
.
declareService
=
tmp_constructor
.
declareService
=
RenderJSGadget
.
declareService
;
RenderJSGadget
.
declareService
;
tmp_constructor
.
onEvent
=
RenderJSGadget
.
onEvent
;
tmp_constructor
.
prototype
=
new
RenderJSGadget
();
tmp_constructor
.
prototype
=
new
RenderJSGadget
();
tmp_constructor
.
prototype
.
constructor
=
tmp_constructor
;
tmp_constructor
.
prototype
.
constructor
=
tmp_constructor
;
tmp_constructor
.
prototype
.
__path
=
url
;
tmp_constructor
.
prototype
.
__path
=
url
;
...
@@ -1701,9 +1999,6 @@ if (typeof document.contains !== 'function') {
...
@@ -1701,9 +1999,6 @@ if (typeof document.contains !== 'function') {
last_acquisition_gadget
=
new
RenderJSGadget
();
last_acquisition_gadget
=
new
RenderJSGadget
();
last_acquisition_gadget
.
__acquired_method_dict
=
{
last_acquisition_gadget
.
__acquired_method_dict
=
{
getTopURL
:
function
()
{
return
url
;
},
reportServiceError
:
function
(
param_list
)
{
reportServiceError
:
function
(
param_list
)
{
letsCrash
(
param_list
[
0
]);
letsCrash
(
param_list
[
0
]);
}
}
...
@@ -1730,15 +2025,20 @@ if (typeof document.contains !== 'function') {
...
@@ -1730,15 +2025,20 @@ if (typeof document.contains !== 'function') {
RenderJSGadget
.
call
(
this
);
RenderJSGadget
.
call
(
this
);
};
};
tmp_constructor
.
declareMethod
=
RenderJSGadget
.
declareMethod
;
tmp_constructor
.
declareMethod
=
RenderJSGadget
.
declareMethod
;
tmp_constructor
.
declareJob
=
RenderJSGadget
.
declareJob
;
tmp_constructor
.
declareAcquiredMethod
=
tmp_constructor
.
declareAcquiredMethod
=
RenderJSGadget
.
declareAcquiredMethod
;
RenderJSGadget
.
declareAcquiredMethod
;
tmp_constructor
.
allowPublicAcquisition
=
tmp_constructor
.
allowPublicAcquisition
=
RenderJSGadget
.
allowPublicAcquisition
;
RenderJSGadget
.
allowPublicAcquisition
;
tmp_constructor
.
__ready_list
=
RenderJSGadget
.
__ready_list
.
slice
();
tmp_constructor
.
__ready_list
=
RenderJSGadget
.
__ready_list
.
slice
();
tmp_constructor
.
ready
=
RenderJSGadget
.
ready
;
tmp_constructor
.
ready
=
RenderJSGadget
.
ready
;
tmp_constructor
.
setState
=
RenderJSGadget
.
setState
;
tmp_constructor
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
tmp_constructor
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
tmp_constructor
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
tmp_constructor
.
declareService
=
tmp_constructor
.
declareService
=
RenderJSGadget
.
declareService
;
RenderJSGadget
.
declareService
;
tmp_constructor
.
onEvent
=
RenderJSGadget
.
onEvent
;
tmp_constructor
.
prototype
=
new
RenderJSGadget
();
tmp_constructor
.
prototype
=
new
RenderJSGadget
();
tmp_constructor
.
prototype
.
constructor
=
tmp_constructor
;
tmp_constructor
.
prototype
.
constructor
=
tmp_constructor
;
tmp_constructor
.
prototype
.
__path
=
url
;
tmp_constructor
.
prototype
.
__path
=
url
;
...
@@ -1815,30 +2115,19 @@ if (typeof document.contains !== 'function') {
...
@@ -1815,30 +2115,19 @@ if (typeof document.contains !== 'function') {
});
});
return
;
return
;
}
}
// Get Top URL
connection_ready
=
true
;
return
tmp_constructor
.
prototype
.
__aq_parent
(
'
getTopURL
'
,
[])
notifyReady
();
.
then
(
function
(
topURL
)
{
//the channel is ok
var
base
=
document
.
createElement
(
'
base
'
);
//so bind calls to renderJS method on the instance
base
.
href
=
topURL
;
embedded_channel
.
bind
(
"
methodCall
"
,
function
(
trans
,
v
)
{
base
.
target
=
"
_top
"
;
root_gadget
[
v
[
0
]].
apply
(
root_gadget
,
v
[
1
])
document
.
head
.
appendChild
(
base
);
.
then
(
function
(
g
)
{
connection_ready
=
true
;
trans
.
complete
(
g
);
notifyReady
();
}).
fail
(
function
(
e
)
{
//the channel is ok
trans
.
error
(
e
.
toString
());
//so bind calls to renderJS method on the instance
embedded_channel
.
bind
(
"
methodCall
"
,
function
(
trans
,
v
)
{
root_gadget
[
v
[
0
]].
apply
(
root_gadget
,
v
[
1
])
.
then
(
function
(
g
)
{
trans
.
complete
(
g
);
}).
fail
(
function
(
e
)
{
trans
.
error
(
e
.
toString
());
});
trans
.
delayReturn
(
true
);
});
});
})
trans
.
delayReturn
(
true
);
.
fail
(
function
(
error
)
{
});
throw
error
;
});
}
}
});
});
...
@@ -1872,6 +2161,10 @@ if (typeof document.contains !== 'function') {
...
@@ -1872,6 +2161,10 @@ if (typeof document.contains !== 'function') {
tmp_constructor
.
declareService
=
tmp_constructor
.
declareService
=
RenderJSGadget
.
declareService
;
RenderJSGadget
.
declareService
;
tmp_constructor
.
declareJob
=
RenderJSGadget
.
declareJob
;
tmp_constructor
.
onEvent
=
RenderJSGadget
.
onEvent
;
tmp_constructor
.
declareAcquiredMethod
=
tmp_constructor
.
declareAcquiredMethod
=
RenderJSGadget
.
declareAcquiredMethod
;
RenderJSGadget
.
declareAcquiredMethod
;
tmp_constructor
.
allowPublicAcquisition
=
tmp_constructor
.
allowPublicAcquisition
=
...
@@ -1894,10 +2187,11 @@ if (typeof document.contains !== 'function') {
...
@@ -1894,10 +2187,11 @@ if (typeof document.contains !== 'function') {
}
}
}
}
tmp_constructor
.
__template_element
=
document
.
createElement
(
"
div
"
);
tmp_constructor
.
__template_element
=
document
.
createElement
(
"
div
"
);
root_gadget
.
__element
=
document
.
body
;
root_gadget
.
element
=
document
.
body
;
for
(
j
=
0
;
j
<
root_gadget
.
__element
.
childNodes
.
length
;
j
+=
1
)
{
root_gadget
.
state
=
{};
for
(
j
=
0
;
j
<
root_gadget
.
element
.
childNodes
.
length
;
j
+=
1
)
{
tmp_constructor
.
__template_element
.
appendChild
(
tmp_constructor
.
__template_element
.
appendChild
(
root_gadget
.
__
element
.
childNodes
[
j
].
cloneNode
(
true
)
root_gadget
.
element
.
childNodes
[
j
].
cloneNode
(
true
)
);
);
}
}
RSVP
.
all
([
root_gadget
.
getRequiredJSList
(),
RSVP
.
all
([
root_gadget
.
getRequiredJSList
(),
...
@@ -2001,7 +2295,11 @@ if (typeof document.contains !== 'function') {
...
@@ -2001,7 +2295,11 @@ if (typeof document.contains !== 'function') {
function
ready_wrapper
()
{
function
ready_wrapper
()
{
return
root_gadget
;
return
root_gadget
;
}
}
function
ready_executable_wrapper
(
fct
)
{
return
function
(
g
)
{
return
fct
.
call
(
g
,
g
);
};
}
tmp_constructor
.
ready
(
function
(
g
)
{
tmp_constructor
.
ready
(
function
(
g
)
{
return
startService
(
g
);
return
startService
(
g
);
});
});
...
@@ -2010,7 +2308,7 @@ if (typeof document.contains !== 'function') {
...
@@ -2010,7 +2308,7 @@ if (typeof document.contains !== 'function') {
for
(
i
=
0
;
i
<
tmp_constructor
.
__ready_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
tmp_constructor
.
__ready_list
.
length
;
i
+=
1
)
{
// Put a timeout?
// Put a timeout?
loading_gadget_promise
loading_gadget_promise
.
push
(
tmp_constructor
.
__ready_list
[
i
]
)
.
push
(
ready_executable_wrapper
(
tmp_constructor
.
__ready_list
[
i
])
)
// Always return the gadget instance after ready function
// Always return the gadget instance after ready function
.
push
(
ready_wrapper
);
.
push
(
ready_wrapper
);
}
}
...
@@ -2047,4 +2345,4 @@ if (typeof document.contains !== 'function') {
...
@@ -2047,4 +2345,4 @@ if (typeof document.contains !== 'function') {
bootstrap
();
bootstrap
();
}(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
}(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
FileReader
,
Blob
));
FileReader
,
Blob
,
navigator
,
Event
));
\ No newline at end of file
\ No newline at end of file
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.xml
View file @
2952a078
...
@@ -10,10 +10,6 @@
...
@@ -10,10 +10,6 @@
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
<value>
<string>
http_cache
</string>
</value>
</item>
</item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts65978087.08
</string>
</value>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
renderjs.js
</string>
</value>
<value>
<string>
renderjs.js
</string>
</value>
...
@@ -26,10 +22,6 @@
...
@@ -26,10 +22,6 @@
<key>
<string>
precondition
</string>
</key>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
77916
</int>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
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