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
Boris Kocherov
erp5
Commits
7f35ac87
Commit
7f35ac87
authored
Jan 30, 2017
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: dos2unix file convert
parent
06eb9e4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
191 additions
and
191 deletions
+191
-191
bt5/erp5_officejs/PathTemplateItem/web_page_module/codeeditor_gadget_officejs_page_jio_erp5_configurator_js.js
...deeditor_gadget_officejs_page_jio_erp5_configurator_js.js
+191
-191
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/codeeditor_gadget_officejs_page_jio_erp5_configurator_js.js
View file @
7f35ac87
/*global window, rJS, RSVP, URI, location,
loopEventListener, btoa */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
function
setjIOERP5Configuration
(
gadget
)
{
var
erp5_url
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='erp5_url']
"
).
value
;
var
version
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='version']
"
).
value
;
return
gadget
.
getSetting
(
"
portal_type
"
)
.
push
(
function
(
portal_type
)
{
return
gadget
.
setSetting
(
'
jio_storage_description
'
,
{
type
:
"
replicate
"
,
// XXX This drop the signature lists...
query
:
{
query
:
'
portal_type: ("Web Page","Web Script","Web Manifest","Web Style")
'
,
limit
:
[
0
,
1234567890
],
sort_on
:
[[
"
modification_date
"
,
"
descending
"
]]
},
signature_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
version
+
"
_hash
"
}
},
use_remote_post
:
false
,
conflict_handling
:
1
,
check_local_modification
:
true
,
check_local_creation
:
true
,
check_local_deletion
:
false
,
check_remote_modification
:
true
,
check_remote_creation
:
true
,
check_remote_deletion
:
false
,
local_sub_storage
:
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
version
}
}
},
remote_sub_storage
:
{
type
:
"
mapping
"
,
map_id
:
[
"
equalSubProperty
"
,
"
url_string
"
],
mapping_dict
:
{
"
relative_url
"
:
[
"
ignore
"
],
"
version
"
:
[
"
equalValue
"
,
version
]
},
sub_storage
:
{
type
:
"
erp5
"
,
url
:
(
new
URI
(
"
hateoas
"
))
.
absoluteTo
(
erp5_url
)
.
toString
(),
default_view_reference
:
"
jio_view
"
}
}
}
);
})
.
push
(
function
()
{
return
gadget
.
setSetting
(
'
jio_storage_name
'
,
"
ERP5
"
);
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
setGlobalSetting
(
'
erp5_url
'
,
erp5_url
),
gadget
.
setGlobalSetting
(
'
document_version
'
,
version
)
]);
})
.
push
(
function
()
{
return
gadget
.
reload
();
})
.
push
(
function
()
{
return
gadget
.
redirect
({
page
:
'
sync
'
,
auto_repair
:
'
true
'
});
});
}
var
gadget_klass
=
rJS
(
window
);
gadget_klass
.
ready
(
function
(
g
)
{
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
g
.
props
.
deferred
=
RSVP
.
defer
();
});
})
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
reload
"
,
"
reload
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareMethod
(
"
getGlobalSetting
"
,
function
(
key
)
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
"
global_setting_gadget
"
)
.
push
(
function
(
global_setting_gadget
)
{
return
global_setting_gadget
.
getSetting
(
key
);
});
})
.
declareMethod
(
"
setGlobalSetting
"
,
function
(
key
,
value
)
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
"
global_setting_gadget
"
)
.
push
(
function
(
global_setting_gadget
)
{
return
global_setting_gadget
.
setSetting
(
key
,
value
);
});
})
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
;
return
gadget
.
updateHeader
({
title
:
"
Connect To ERP5 Storage
"
,
back_url
:
"
#page=jio_code_editor_configurator
"
,
panel_action
:
false
})
.
push
(
function
()
{
return
gadget
.
getSetting
(
'
jio_storage_name
'
);
})
.
push
(
function
(
jio_storage_name
)
{
if
(
!
jio_storage_name
)
{
gadget
.
props
.
element
.
querySelector
(
"
.document-access
"
).
setAttribute
(
"
style
"
,
"
display: none;
"
);
}
})
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
resolve
();
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.
declareService
(
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
promise
;
})
.
push
(
function
()
{
return
loopEventListener
(
gadget
.
props
.
element
.
querySelector
(
'
form
'
),
'
submit
'
,
true
,
function
()
{
return
setjIOERP5Configuration
(
gadget
);
}
);
});
})
.
declareService
(
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
promise
;
})
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
global_setting_gadget_url
"
);
})
.
push
(
function
(
global_setting_gadget_url
)
{
return
gadget
.
declareGadget
(
global_setting_gadget_url
,
{
scope
:
"
global_setting_gadget
"
,
sandbox
:
"
iframe
"
,
element
:
gadget
.
props
.
element
.
querySelector
(
"
.global_setting_gadget
"
)
}
);
})
.
push
(
function
(
global_setting_gadget
)
{
return
RSVP
.
all
([
global_setting_gadget
.
getSetting
(
"
erp5_url
"
),
global_setting_gadget
.
getSetting
(
"
document_version
"
)
]);
})
.
push
(
function
(
result
)
{
var
erp5_url_input
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='erp5_url']
"
),
document_version
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='version']
"
);
document_version
.
value
=
result
[
1
]
||
"
codeeditor
"
;
erp5_url_input
.
value
=
result
[
0
]
||
"
https://www.example.org
"
;
erp5_url_input
.
removeAttribute
(
"
disabled
"
);
erp5_url_input
.
parentNode
.
classList
.
remove
(
'
ui-state-disabled
'
);
erp5_url_input
.
focus
();
});
});
/*global window, rJS, RSVP, URI, location,
loopEventListener, btoa */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
function
setjIOERP5Configuration
(
gadget
)
{
var
erp5_url
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='erp5_url']
"
).
value
;
var
version
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='version']
"
).
value
;
return
gadget
.
getSetting
(
"
portal_type
"
)
.
push
(
function
(
portal_type
)
{
return
gadget
.
setSetting
(
'
jio_storage_description
'
,
{
type
:
"
replicate
"
,
// XXX This drop the signature lists...
query
:
{
query
:
'
portal_type: ("Web Page","Web Script","Web Manifest","Web Style")
'
,
limit
:
[
0
,
1234567890
],
sort_on
:
[[
"
modification_date
"
,
"
descending
"
]]
},
signature_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
version
+
"
_hash
"
}
},
use_remote_post
:
false
,
conflict_handling
:
1
,
check_local_modification
:
true
,
check_local_creation
:
true
,
check_local_deletion
:
false
,
check_remote_modification
:
true
,
check_remote_creation
:
true
,
check_remote_deletion
:
false
,
local_sub_storage
:
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
version
}
}
},
remote_sub_storage
:
{
type
:
"
mapping
"
,
map_id
:
[
"
equalSubProperty
"
,
"
url_string
"
],
mapping_dict
:
{
"
relative_url
"
:
[
"
ignore
"
],
"
version
"
:
[
"
equalValue
"
,
version
]
},
sub_storage
:
{
type
:
"
erp5
"
,
url
:
(
new
URI
(
"
hateoas
"
))
.
absoluteTo
(
erp5_url
)
.
toString
(),
default_view_reference
:
"
jio_view
"
}
}
}
);
})
.
push
(
function
()
{
return
gadget
.
setSetting
(
'
jio_storage_name
'
,
"
ERP5
"
);
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
setGlobalSetting
(
'
erp5_url
'
,
erp5_url
),
gadget
.
setGlobalSetting
(
'
document_version
'
,
version
)
]);
})
.
push
(
function
()
{
return
gadget
.
reload
();
})
.
push
(
function
()
{
return
gadget
.
redirect
({
page
:
'
sync
'
,
auto_repair
:
'
true
'
});
});
}
var
gadget_klass
=
rJS
(
window
);
gadget_klass
.
ready
(
function
(
g
)
{
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
g
.
props
.
deferred
=
RSVP
.
defer
();
});
})
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
reload
"
,
"
reload
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareMethod
(
"
getGlobalSetting
"
,
function
(
key
)
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
"
global_setting_gadget
"
)
.
push
(
function
(
global_setting_gadget
)
{
return
global_setting_gadget
.
getSetting
(
key
);
});
})
.
declareMethod
(
"
setGlobalSetting
"
,
function
(
key
,
value
)
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
"
global_setting_gadget
"
)
.
push
(
function
(
global_setting_gadget
)
{
return
global_setting_gadget
.
setSetting
(
key
,
value
);
});
})
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
;
return
gadget
.
updateHeader
({
title
:
"
Connect To ERP5 Storage
"
,
back_url
:
"
#page=jio_code_editor_configurator
"
,
panel_action
:
false
})
.
push
(
function
()
{
return
gadget
.
getSetting
(
'
jio_storage_name
'
);
})
.
push
(
function
(
jio_storage_name
)
{
if
(
!
jio_storage_name
)
{
gadget
.
props
.
element
.
querySelector
(
"
.document-access
"
).
setAttribute
(
"
style
"
,
"
display: none;
"
);
}
})
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
resolve
();
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.
declareService
(
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
promise
;
})
.
push
(
function
()
{
return
loopEventListener
(
gadget
.
props
.
element
.
querySelector
(
'
form
'
),
'
submit
'
,
true
,
function
()
{
return
setjIOERP5Configuration
(
gadget
);
}
);
});
})
.
declareService
(
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
promise
;
})
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
global_setting_gadget_url
"
);
})
.
push
(
function
(
global_setting_gadget_url
)
{
return
gadget
.
declareGadget
(
global_setting_gadget_url
,
{
scope
:
"
global_setting_gadget
"
,
sandbox
:
"
iframe
"
,
element
:
gadget
.
props
.
element
.
querySelector
(
"
.global_setting_gadget
"
)
}
);
})
.
push
(
function
(
global_setting_gadget
)
{
return
RSVP
.
all
([
global_setting_gadget
.
getSetting
(
"
erp5_url
"
),
global_setting_gadget
.
getSetting
(
"
document_version
"
)
]);
})
.
push
(
function
(
result
)
{
var
erp5_url_input
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='erp5_url']
"
),
document_version
=
gadget
.
props
.
element
.
querySelector
(
"
input[name='version']
"
);
document_version
.
value
=
result
[
1
]
||
"
codeeditor
"
;
erp5_url_input
.
value
=
result
[
0
]
||
"
https://www.example.org
"
;
erp5_url_input
.
removeAttribute
(
"
disabled
"
);
erp5_url_input
.
parentNode
.
classList
.
remove
(
'
ui-state-disabled
'
);
erp5_url_input
.
focus
();
});
});
}(
window
,
rJS
,
RSVP
));
\ No newline at end of file
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