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
8d3adfd6
Commit
8d3adfd6
authored
Jun 18, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: form for editing json_document added
parent
be0c98c3
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1613 additions
and
13 deletions
+1613
-13
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.html.html
...e_module/gadget_erp5_page_ojs_add_json_document.html.html
+18
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.html.xml
...ge_module/gadget_erp5_page_ojs_add_json_document.html.xml
+319
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.js.js
..._page_module/gadget_erp5_page_ojs_add_json_document.js.js
+62
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.js.xml
...page_module/gadget_erp5_page_ojs_add_json_document.js.xml
+319
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_schema_document_list.js.js
...ge_module/gadget_erp5_page_ojs_schema_document_list.js.js
+29
-13
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.html.html
...e_module/gadget_officejs_jio_json_document_view.html.html
+26
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.html.xml
...ge_module/gadget_officejs_jio_json_document_view.html.xml
+319
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.js.js
..._page_module/gadget_officejs_jio_json_document_view.js.js
+202
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.js.xml
...page_module/gadget_officejs_jio_json_document_view.js.xml
+319
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.html.html
0 → 100644
View file @
8d3adfd6
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
OfficeJS Add Json Document
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_erp5_page_ojs_add_json_document.js"
></script>
</head>
<body>
</body>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.html.xml
0 → 100644
View file @
8d3adfd6
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.js.js
0 → 100644
View file @
8d3adfd6
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
Blob
)
{
"
use strict
"
;
var
content_type
=
{
Spreadsheet
:
'
application/x-asc-spreadsheet
'
,
Presentation
:
'
application/x-asc-presentation
'
,
Text
:
'
application/x-asc-text
'
};
var
file_ext
=
{
Spreadsheet
:
'
xlsy
'
,
Presentation
:
'
ppty
'
,
Text
:
'
docy
'
};
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
var
portal_type
=
options
.
portal_type
,
ext
=
file_ext
[
portal_type
],
ret
=
{
title
:
"
Untitled Document
"
,
portal_type
:
"
JSON Document
"
,
schema
:
options
.
schema
,
parent_relative_url
:
"
document_module
"
,
content_type
:
content_type
[
portal_type
]
||
undefined
};
if
(
ext
)
{
ret
.
filename
=
"
default.
"
+
ext
;
}
return
gadget
.
jio_post
(
ret
);
})
.
push
(
function
(
id
)
{
return
gadget
.
jio_putAttachment
(
id
,
'
data
'
,
new
Blob
([
"
{}
"
]))
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
id
,
editable
:
true
}
});
});
});
});
}(
window
,
rJS
,
RSVP
,
Blob
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_add_json_document.js.xml
0 → 100644
View file @
8d3adfd6
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_ojs_schema_document_list.js.js
View file @
8d3adfd6
...
...
@@ -65,14 +65,14 @@
});
})
.
declareMethod
(
"
render
"
,
function
()
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
portal_type
=
options
.
portal_type
||
gadget
.
getSetting
(
"
portal_type
"
);
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_list
'
),
gadget
.
getSetting
(
"
portal_type
"
)
portal_type
]);
})
.
push
(
function
(
result
)
{
...
...
@@ -83,7 +83,12 @@
[
'
description
'
,
'
Description
'
],
[
'
version
'
,
'
Version
'
],
[
'
modification_date
'
,
'
Modification Date
'
]
];
],
query
=
'
portal_type:"
'
+
result
[
1
]
+
'
"
'
;
if
(
options
.
schema
)
{
query
+=
'
AND schema:"
'
+
options
.
schema
+
'
"
'
;
}
query
=
encodeURIComponent
(
query
);
return
result
[
0
].
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
...
...
@@ -96,13 +101,12 @@
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
30
,
"
list_method
"
:
"
portal_catalog
"
,
"
query
"
:
"
urn:jio:allDocs?query=portal_type%3A%22
"
+
result
[
1
]
+
"
%22
"
,
"
query
"
:
"
urn:jio:allDocs?query=
"
+
query
,
"
portal_type
"
:
[],
"
search_column_list
"
:
column_list
,
"
sort_column_list
"
:
column_list
,
"
sort
"
:
[[
'
modification_date
'
,
'
descending
'
]],
"
title
"
:
"
Schemas
"
,
"
title
"
:
options
.
schema_title
||
"
Schemas
"
,
"
type
"
:
"
ListBox
"
}
}},
...
...
@@ -122,14 +126,26 @@
});
})
.
push
(
function
()
{
return
RSVP
.
all
([
var
tasks
;
if
(
options
.
portal_type
===
"
JSON Document
"
)
{
tasks
=
[
gadget
.
getUrlFor
({
command
:
"
index
"
,
options
:
{
page
:
"
ojs_add_json_document
"
,
schema
:
options
.
schema
}}),
gadget
.
getSetting
(
'
document_title_plural
'
)
];
}
else
{
tasks
=
[
gadget
.
getUrlFor
({
command
:
"
index
"
,
options
:
{
"
page
"
:
"
ojs_multi_upload
"
}}),
gadget
.
getSetting
(
'
document_title_plural
'
)
]);
];
}
return
RSVP
.
all
(
tasks
);
})
.
push
(
function
(
result
)
{
return
gadget
.
updateHeader
({
page_title
:
result
[
1
],
page_title
:
options
.
schema_title
||
result
[
1
],
filter_action
:
true
,
add_url
:
result
[
0
]
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.html.html
0 → 100644
View file @
8d3adfd6
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
OfficeJS Jio Document View
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"handlebars.js"
></script>
<script
src=
"gadget_officejs_jio_json_document_view.js"
></script>
</head>
<body>
<form
class=
"save_form ui-body-c"
novalidate
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"form_view"
data-gadget-sandbox=
"public"
>
</div>
</form>
</body>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.html.xml
0 → 100644
View file @
8d3adfd6
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.js.js
0 → 100644
View file @
8d3adfd6
/*global window, rJS, RSVP, jIO, URL,
promiseEventListener, document*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
jIO
,
rJS
,
RSVP
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
updateDocument
"
,
"
updateDocument
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
gadget
.
changeState
({
jio_key
:
options
.
jio_key
,
doc
:
options
.
doc
});
})
.
onEvent
(
'
submit
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
content
)
{
var
list
=
[],
blob
;
if
(
content
.
file
)
{
blob
=
jIO
.
util
.
dataURItoBlob
(
content
.
file
.
url
);
content
.
title
=
content
.
file
.
file_name
;
delete
content
.
file
;
list
=
[
gadget
.
updateDocument
(
content
),
gadget
.
jio_putAttachment
(
gadget
.
state
.
jio_key
,
'
data
'
,
blob
)
];
}
else
if
(
content
.
data
)
{
blob
=
new
Blob
([
content
.
data
]);
delete
content
.
data
;
list
=
[
gadget
.
updateDocument
(
content
),
gadget
.
jio_putAttachment
(
gadget
.
state
.
jio_key
,
'
data
'
,
blob
)
];
}
else
{
list
=
[
gadget
.
updateDocument
(
content
)];
}
return
RSVP
.
all
(
list
);
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
},
function
(
error
)
{
if
(
error
.
target
&&
error
.
target
.
error
.
name
===
'
NotReadableError
'
)
{
return
gadget
.
notifySubmitted
({
message
:
error
.
target
.
error
.
message
,
status
:
'
fail
'
});
}
throw
error
;
}).
push
(
function
()
{
// debugger;
return
gadget
.
redirect
({
command
:
'
reload
'
});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
return
this
.
element
.
querySelector
(
'
button[type="submit"]
'
).
click
();
})
.
allowPublicAcquisition
(
"
downloadJSON
"
,
function
(
arr
)
{
var
g
=
this
,
url
=
arr
[
0
],
reference
,
args
;
// return g.jio_getAttachment(id, "data", {format: "json"});
if
(
url
.
startsWith
(
"
urn:jio:reference?
"
))
{
reference
=
decodeURIComponent
(
url
.
replace
(
"
urn:jio:reference?
"
,
""
));
args
=
{
query
:
'
(portal_type: "Json Schema") AND ((reference: "
'
+
reference
+
'
"))
'
,
limit
:
[
0
,
1
],
select_list
:
[],
sort_on
:
[[
"
modification_date
"
,
"
descending
"
]]
};
return
g
.
jio_allDocs
(
args
)
.
push
(
function
(
result
)
{
return
g
.
jio_getAttachment
(
result
.
data
.
rows
[
0
].
id
,
"
data
"
,
{
format
:
"
json
"
});
});
}
})
.
onStateChange
(
function
()
{
var
gadget
=
this
,
schema_obj
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_view
'
),
gadget
.
jio_getAttachment
(
gadget
.
state
.
jio_key
,
'
data
'
,
{
format
:
"
json
"
}),
gadget
.
jio_get
(
gadget
.
state
.
doc
.
schema
)
]);
})
.
push
(
function
(
result
)
{
schema_obj
=
result
[
2
];
return
result
[
0
].
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
my_title
"
:
{
"
description
"
:
""
,
"
title
"
:
"
Title
"
,
"
default
"
:
gadget
.
state
.
doc
.
title
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
title
"
,
"
hidden
"
:
0
,
"
type
"
:
"
StringField
"
},
"
my_file
"
:
{
"
description
"
:
""
,
"
title
"
:
"
Upload
"
,
"
default
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
0
,
"
editable
"
:
1
,
"
key
"
:
"
file
"
,
"
hidden
"
:
0
,
"
accept
"
:
"
application/json
"
,
"
type
"
:
"
FileField
"
},
"
my_content
"
:
{
"
default
"
:
result
[
1
],
"
css_class
"
:
""
,
"
required
"
:
0
,
"
editable
"
:
1
,
"
key
"
:
"
data
"
,
"
hidden
"
:
0
,
"
type
"
:
"
GadgetField
"
,
"
renderjs_extra
"
:
'
{"name": "data",
'
+
'
"schema_url": "urn:jio:reference?
'
+
schema_obj
.
reference
+
'
"}
'
,
"
url
"
:
"
jsonform.gadget.html
"
,
"
sandbox
"
:
"
public
"
}
}
},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}
},
form_definition
:
{
group_list
:
[[
"
left
"
,
[[
"
my_title
"
],
[
"
my_reference
"
],
[
"
my_file
"
]]
],
[
"
bottom
"
,
[[
"
my_content
"
]]
]]
}
});
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_schema_document_list
"
,
portal_type
:
"
JSON Document
"
,
schema
:
gadget
.
state
.
doc
.
schema
,
schema_title
:
schema_obj
.
title
}}),
gadget
.
getUrlFor
({
command
:
'
selection_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_next
'
})
]);
})
.
push
(
function
(
url_list
)
{
return
gadget
.
updateHeader
({
page_title
:
gadget
.
state
.
doc
.
title
,
save_action
:
true
,
selection_url
:
url_list
[
0
],
previous_url
:
url_list
[
1
],
next_url
:
url_list
[
2
]
});
});
});
}(
window
,
jIO
,
rJS
,
RSVP
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_json_document_view.js.xml
0 → 100644
View file @
8d3adfd6
This diff is collapsed.
Click to expand it.
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