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
Noah Brackenbury
erp5
Commits
c8c19219
Commit
c8c19219
authored
Apr 06, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: add web site officejs_export prototype
parent
2e82312a
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1742 additions
and
49 deletions
+1742
-49
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.js
...web_page_module/gadget_officejs_jio_appcachestorage_js.js
+34
-42
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.xml
...eb_page_module/gadget_officejs_jio_appcachestorage_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_html.html
...tem/web_page_module/gadget_officejs_page_export_html.html
+74
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_html.xml
...Item/web_page_module/gadget_officejs_page_export_html.xml
+321
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_js.js
...ateItem/web_page_module/gadget_officejs_page_export_js.js
+87
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_js.xml
...teItem/web_page_module/gadget_officejs_page_export_js.xml
+317
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/jio_filesystemstorage_js.js
...hTemplateItem/web_page_module/jio_filesystemstorage_js.js
+78
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/jio_filesystemstorage_js.xml
...TemplateItem/web_page_module/jio_filesystemstorage_js.xml
+329
-0
bt5/erp5_officejs/PathTemplateItem/web_site_module/officejs_export.xml
...cejs/PathTemplateItem/web_site_module/officejs_export.xml
+492
-0
bt5/erp5_officejs/bt/template_keep_last_workflow_history_only_path_list
...ejs/bt/template_keep_last_workflow_history_only_path_list
+3
-2
bt5/erp5_officejs/bt/template_keep_workflow_path_list
bt5/erp5_officejs/bt/template_keep_workflow_path_list
+3
-2
bt5/erp5_officejs/bt/template_path_list
bt5/erp5_officejs/bt/template_path_list
+2
-1
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.js
View file @
c8c19219
...
...
@@ -5,13 +5,15 @@
function
AppCacheStorage
(
spec
)
{
this
.
_manifest
=
spec
.
manifest
;
this
.
_url
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
this
.
_origin_url
=
spec
.
origin_url
!==
undefined
?
spec
.
origin_url
:
(
window
.
location
.
origin
+
window
.
location
.
pathname
+
(
window
.
location
.
pathname
.
endsWith
(
'
/
'
)
?
''
:
'
/
'
)
+
spec
.
version
+
(
spec
.
version
.
endsWith
(
'
/
'
)
?
''
:
'
/
'
);
this
.
_url_list
=
[
"
/
"
];
((
spec
.
version
!==
undefined
)
?
(
spec
.
version
+
(
spec
.
version
.
endsWith
(
'
/
'
)
?
''
:
'
/
'
))
:
""
));
this
.
_relative_url_list
=
[
this
.
_origin_url
,
spec
.
manifest
];
}
AppCacheStorage
.
prototype
.
get
=
function
(
url
)
{
AppCacheStorage
.
prototype
.
get
=
function
(
id
)
{
return
{};
};
...
...
@@ -21,74 +23,64 @@
AppCacheStorage
.
prototype
.
getAttachment
=
function
(
doc_id
,
attachment_id
)
{
var
storage
=
this
,
url
=
attachment_id
;
if
(
this
.
_url
===
doc_id
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
url
:
(
url
.
startsWith
(
"
http
"
)
||
url
.
startsWith
(
"
//
"
))
?
url
:
storage
.
_url
+
url
,
dataType
:
"
blob
"
});
})
.
push
(
function
(
result
)
{
return
result
.
target
.
response
;
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
target
.
status
===
404
)
{
throw
new
jIO
.
util
.
jIOError
(
"
Can't find attachment:
"
+
url
,
404
);
}
throw
error
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
url
:
(
url
.
startsWith
(
"
http
"
)
||
url
.
startsWith
(
"
//
"
))
?
url
:
storage
.
_origin_url
+
url
,
dataType
:
"
blob
"
});
}
throw
new
jIO
.
util
.
jIOError
(
"
Can not find
"
+
doc_id
,
404
);
})
.
push
(
function
(
result
)
{
return
result
.
target
.
response
;
});
};
AppCacheStorage
.
prototype
.
allAttachments
=
function
(
url
)
{
var
result
=
{},
i
,
len
=
this
.
_url_list
.
length
;
var
result
=
{},
i
,
len
=
this
.
_
relative_
url_list
.
length
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
result
[
this
.
_url_list
[
i
]]
=
{};
result
[
this
.
_
relative_
url_list
[
i
]]
=
{};
}
return
result
;
};
AppCacheStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
return
[{
id
:
this
.
_url
,
doc
:
{},
value
:
{}}];
return
[{
id
:
"
/
"
,
doc
:
{},
value
:
{}}];
};
AppCacheStorage
.
prototype
.
repair
=
function
()
{
var
storage
=
this
;
console
.
log
(
"
start getting cache
"
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
url
:
storage
.
_url
+
storage
.
_manifest
url
:
storage
.
_
origin_
url
+
storage
.
_manifest
});
})
.
push
(
function
(
response
)
{
var
text
=
response
.
target
.
responseText
,
url_list
=
text
.
split
(
'
\r\n
'
),
relative_
url_list
=
text
.
split
(
'
\r\n
'
),
i
,
take
=
false
;
if
(
url_list
.
length
===
1
)
{
url_list
=
text
.
split
(
'
\n
'
);
if
(
relative_
url_list
.
length
===
1
)
{
relative_
url_list
=
text
.
split
(
'
\n
'
);
}
if
(
url_list
.
length
===
1
)
{
url_list
=
text
.
split
(
'
\r
'
);
if
(
relative_
url_list
.
length
===
1
)
{
relative_
url_list
=
text
.
split
(
'
\r
'
);
}
for
(
i
=
0
;
i
<
url_list
.
length
;
i
+=
1
)
{
if
(
url_list
[
i
].
indexOf
(
"
NETWORK:
"
)
>=
0
)
{
for
(
i
=
0
;
i
<
relative_
url_list
.
length
;
i
+=
1
)
{
if
(
relative_
url_list
[
i
].
indexOf
(
"
NETWORK:
"
)
>=
0
)
{
take
=
false
;
}
if
(
take
&&
url_list
[
i
]
!==
""
&&
url_list
[
i
].
charAt
(
0
)
!==
'
#
'
&&
url_list
[
i
].
charAt
(
0
)
!==
'
'
)
{
url_list
[
i
].
replace
(
"
\r
"
,
""
);
storage
.
_
url_list
.
push
(
url_list
[
i
]);
relative_
url_list
[
i
]
!==
""
&&
relative_
url_list
[
i
].
charAt
(
0
)
!==
'
#
'
&&
relative_
url_list
[
i
].
charAt
(
0
)
!==
'
'
)
{
relative_
url_list
[
i
].
replace
(
"
\r
"
,
""
);
storage
.
_
relative_url_list
.
push
(
relative_
url_list
[
i
]);
}
if
(
url_list
[
i
].
indexOf
(
"
CACHE:
"
)
>=
0
)
{
if
(
relative_
url_list
[
i
].
indexOf
(
"
CACHE:
"
)
>=
0
)
{
take
=
true
;
}
}
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.xml
View file @
c8c19219
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
958.
24259.25538.2109
4
</string>
</value>
<value>
<string>
958.
41792.31362.131
4
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
149
1383378.56
</float>
<float>
149
2082677.03
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_html.html
0 → 100644
View file @
c8c19219
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
OfficeJS Export Page
</title>
<link
rel=
"stylesheet"
href=
"gadget_erp5_nojqm.css"
>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"jiodev.js"
></script>
<script
src=
"gadget_global.js"
></script>
<script
src=
"gadget_officejs_page_export.js"
></script>
<script
src=
"zipfilestorage-with-jszip.js"
></script>
<script
src=
"jio_filesystemstorage.js"
></script>
<script
src=
"jio_appcachestorage.js"
></script>
</head>
<body>
<article
class=
"ui-content ui-body-c"
>
<section
class=
"ui-content-header-plain"
>
<h3
class=
"ui-content-title ui-body-c"
>
<span
class=
"ui-icon ui-icon-custom ui-icon-database"
>
</span>
Export
</h3>
</section>
<section
class=
"ui-body-c ui-content-section"
>
<form
class=
"export-form"
>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Cache File:"
>
Cache File:
</label>
<input
name=
"cachefile"
required
/>
</div>
</div>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Site Url:"
>
Site Url:
</label>
<input
name=
"site_url"
required
/>
</div>
</div>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Storage format for Export:"
>
Storage format for export:
</label>
<select
name=
"storage_type"
>
<option
value=
"zipfile"
>
Export as zipfile
</option>
</select>
</div>
</div>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"File Name:"
>
File Name:
</label>
<input
name=
"filename"
/>
</div>
</div>
<div
class=
"select-storage ui-controlgroup ui-controlgroup-horizontal"
>
<div
class=
"ui-grid-b ui-responsive"
>
<div
class=
"ui-block-a"
></div>
<div
class=
"ui-block-b"
></div>
<div
class=
"ui-block-c"
>
<button
type=
"submit"
data-i18n=
"Export"
class=
"ui-btn-btn-right"
>
Export
</button>
</div>
</div>
</div>
</form>
</section>
</article>
<div
id=
"global_setting_gadget"
style=
"display: none;"
></div>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_html.xml
0 → 100644
View file @
c8c19219
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_js.js
0 → 100644
View file @
c8c19219
/*globals window, RSVP, rJS, loopEventListener, URL, document
FileReader, console */
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
RSVP
,
rJS
,
jIO
)
{
"
use strict
"
;
function
exportZip
(
gadget
)
{
var
cache_file
=
gadget
.
props
.
element
.
querySelector
(
'
form input[name="cachefile"]
'
).
value
,
site_url
=
gadget
.
props
.
element
.
querySelector
(
'
form input[name="site_url"]
'
).
value
;
return
gadget
.
exportZip
(
cache_file
,
site_url
)
.
push
(
function
(
zip_file
)
{
var
element
=
gadget
.
props
.
element
,
a
=
document
.
createElement
(
"
a
"
),
url
=
URL
.
createObjectURL
(
zip_file
),
zip_name
=
gadget
.
props
.
element
.
querySelector
(
'
form input[name="filename"]
'
).
value
||
"
source_code
"
;
element
.
appendChild
(
a
);
a
.
style
=
"
display: none
"
;
a
.
href
=
url
;
a
.
download
=
zip_name
+
"
.zip
"
;
a
.
click
();
element
.
removeChild
(
a
);
URL
.
revokeObjectURL
(
url
);
});
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
.
declareMethod
(
"
exportZip
"
,
function
(
cache_file
,
site_url
)
{
var
gadget
=
this
,
file_storage
=
jIO
.
createJIO
({
type
:
"
replicate
"
,
check_remote_attachment_creation
:
true
,
check_local_creation
:
false
,
check_local_modification
:
false
,
check_local_deletion
:
false
,
check_remote_deletion
:
false
,
check_remote_modification
:
false
,
remote_sub_storage
:
{
type
:
"
filesystem
"
,
document
:
site_url
,
sub_storage
:
{
type
:
"
appcache
"
,
manifest
:
cache_file
,
url
:
site_url
}
},
signature_storage
:
{
type
:
"
memory
"
},
local_sub_storage
:
{
type
:
"
zipfile
"
}
});
return
file_storage
.
repair
()
.
push
(
function
()
{
return
file_storage
.
getAttachment
(
'
/
'
,
'
/
'
);
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.
declareService
(
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
loopEventListener
(
gadget
.
props
.
element
.
querySelector
(
'
form.export-form
'
),
'
submit
'
,
true
,
function
(
event
)
{
return
exportZip
(
gadget
);
}
);
});
});
}(
window
,
RSVP
,
rJS
,
jIO
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_export_js.xml
0 → 100644
View file @
c8c19219
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/jio_filesystemstorage_js.js
0 → 100644
View file @
c8c19219
/*jslint indent:2, maxlen: 80, nomen: true */
/*global jIO, RSVP, window, console, Blob */
(
function
(
window
,
jIO
,
RSVP
,
console
,
Blob
)
{
"
use strict
"
;
function
FileSystemStorage
(
spec
)
{
this
.
_document
=
spec
.
document
;
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
this
.
_id_dict
=
{
"
/
"
:
{
"
index.html
"
:
{}}};
}
FileSystemStorage
.
prototype
.
get
=
function
(
url
)
{
return
{};
};
FileSystemStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
return
(
name
===
"
list
"
);
};
FileSystemStorage
.
prototype
.
getAttachment
=
function
(
doc_id
,
attachment_id
)
{
return
this
.
_sub_storage
.
getAttachment
(
this
.
_document
,
(
attachment_id
===
"
index.html
"
)
?
"
/
"
:
(
doc_id
===
"
/
"
)
?
attachment_id
:
doc_id
+
attachment_id
);
};
FileSystemStorage
.
prototype
.
allAttachments
=
function
(
doc_id
)
{
return
this
.
_id_dict
[
doc_id
]
||
{};
};
FileSystemStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
var
id
,
result
=
[],
context
=
this
;
for
(
id
in
context
.
_id_dict
)
{
if
(
context
.
_id_dict
.
hasOwnProperty
(
id
))
{
result
.
push
({
id
:
id
});
}
}
return
result
;
};
FileSystemStorage
.
prototype
.
repair
=
function
()
{
// Transform id attachment ( file path ) to id list / attachments
var
context
=
this
;
return
context
.
_sub_storage
.
repair
()
.
push
(
function
()
{
return
context
.
_sub_storage
.
allAttachments
(
context
.
_document
);
})
.
push
(
function
(
result
)
{
var
id
,
path
,
last_slash_index
,
filename
;
for
(
id
in
result
)
{
if
(
result
.
hasOwnProperty
(
id
))
{
last_slash_index
=
id
.
lastIndexOf
(
"
/
"
)
+
1
;
if
(
last_slash_index
===
0
)
{
path
=
"
/
"
;
filename
=
id
;
}
else
{
path
=
id
.
substring
(
0
,
last_slash_index
);
filename
=
id
.
substring
(
last_slash_index
);
}
}
if
(
!
path
.
startsWith
(
"
http
"
)
&&
id
!==
"
/
"
)
{
if
(
path
.
charAt
(
0
)
!==
'
/
'
)
{
path
=
'
/
'
+
path
;
}
if
(
!
context
.
_id_dict
.
hasOwnProperty
(
path
))
{
context
.
_id_dict
[
path
]
=
{};
}
else
{
context
.
_id_dict
[
path
][
filename
]
=
{};
}
}
}
});
};
jIO
.
addStorage
(
'
filesystem
'
,
FileSystemStorage
);
}(
window
,
jIO
,
RSVP
,
console
,
Blob
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/jio_filesystemstorage_js.xml
0 → 100644
View file @
c8c19219
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_site_module/officejs_export.xml
0 → 100644
View file @
c8c19219
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/bt/template_keep_last_workflow_history_only_path_list
View file @
c8c19219
...
...
@@ -2,7 +2,7 @@ web_page_module/ckeditor_*
image_module/ckeditor_*
web_page_module/gadget_ckeditor_*
web_page_module/gadget_officejs_*
web_page_module/jio_
mappingstorage_js
web_page_module/jio_
*
web_site_module/officejs_bookmark_manager
web_site_module/officejs_bookmark_manager/**
web_site_module/officejs_text_editor
...
...
@@ -21,4 +21,5 @@ web_site_module/officejs_codemirror
web_site_module/officejs_codemirror/**
web_site_module/officejs_cribjs
web_site_module/officejs_cribjs/**
web_site_module/officejs_whiteboard
\ No newline at end of file
web_site_module/officejs_whiteboard
web_site_module/officejs_export
\ No newline at end of file
bt5/erp5_officejs/bt/template_keep_workflow_path_list
View file @
c8c19219
...
...
@@ -2,7 +2,7 @@ web_page_module/ckeditor_*
image_module/ckeditor_*
web_page_module/gadget_ckeditor_*
web_page_module/gadget_officejs_*
web_page_module/jio_
mappingstorage_js
web_page_module/jio_
*
web_site_module/officejs_bookmark_manager
web_site_module/officejs_bookmark_manager/**
web_site_module/officejs_text_editor
...
...
@@ -21,4 +21,5 @@ web_site_module/officejs_codemirror
web_site_module/officejs_codemirror/**
web_site_module/officejs_cribjs
web_site_module/officejs_cribjs/**
web_site_module/officejs_whiteboard
\ No newline at end of file
web_site_module/officejs_whiteboard
web_site_module/officejs_export
\ No newline at end of file
bt5/erp5_officejs/bt/template_path_list
View file @
c8c19219
...
...
@@ -2,7 +2,7 @@ image_module/ckeditor_*
web_page_module/ckeditor_*
web_page_module/gadget_ckeditor_*
web_page_module/gadget_officejs_*
web_page_module/jio_
mappingstorage_js
web_page_module/jio_
*
web_site_module/officejs_bookmark_manager
web_site_module/officejs_bookmark_manager/**
web_site_module/officejs_ckeditor_gadget
...
...
@@ -11,6 +11,7 @@ web_site_module/officejs_codemirror
web_site_module/officejs_codemirror/**
web_site_module/officejs_cribjs
web_site_module/officejs_cribjs/**
web_site_module/officejs_export
web_site_module/officejs_pdf_viewer
web_site_module/officejs_pdf_viewer/**
web_site_module/officejs_pdf_viewer_gadget
...
...
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