Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
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
Ivan Tyagov
jio
Commits
80087264
Commit
80087264
authored
Nov 23, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complex example has been modified according to the new JIO API
parent
2b579525
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
78 deletions
+118
-78
examples/complex_example.html
examples/complex_example.html
+118
-78
No files found.
examples/complex_example.html
View file @
80087264
...
@@ -42,76 +42,97 @@ var clearlog = function () {
...
@@ -42,76 +42,97 @@ var clearlog = function () {
};
};
//-->
//-->
</script>
</script>
<div
id=
"main"
>
<table
border=
"1"
style=
"width: 100%;"
>
<table>
<tr
style=
"font-style:italic;"
>
<tr
style=
"font-style:italic;"
>
<th>
simple storage
</th><th>
multi storage
</th><th>
distant storage
</th>
<th>
simple storage
</th><th>
multi storage
</th><th>
distant storage
</th>
<th>
conflict managing
</th><th>
custom storage description
</th>
<th>
conflict managing
</th><th>
custom storage description
</th>
</tr>
</tr>
<tr>
<tr>
<th>
local
</th><th>
crypt
&
local
</th><th>
dav
</th>
<th>
local
</th><th>
crypt
&
local
</th><th>
dav
</th>
<th>
conflictmanager
&
local
</th><th>
custom
</th>
<th>
conflictmanager
&
local
</th><th>
custom
</th>
</tr>
</tr>
<tr>
<tr>
<th>
<th>
<input
type=
"text"
id=
"localuser"
value=
"localuser"
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"localuser"
value=
"localuser"
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"localapp"
value=
"localapp"
placeholder=
"applicationname"
/><br
/>
<input
type=
"text"
id=
"localapp"
value=
"localapp"
placeholder=
"applicationname"
/><br
/>
</th>
</th>
<th>
<th>
<input
type=
"text"
id=
"cryptuser"
value=
"cryptuser"
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"cryptuser"
value=
"cryptuser"
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"cryptapp"
value=
"cryptapp"
placeholder=
"applicationname"
/><br
/>
<input
type=
"text"
id=
"cryptapp"
value=
"cryptapp"
placeholder=
"applicationname"
/><br
/>
<input
type=
"password"
id=
"cryptpassword"
value=
"pwd"
placeholder=
"password"
/><br
/>
<input
type=
"password"
id=
"cryptpassword"
value=
"pwd"
placeholder=
"password"
/><br
/>
</th>
</th>
<th>
<th>
<input
type=
"text"
id=
"davuser"
value=
""
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"davuser"
value=
""
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"davapp"
value=
""
placeholder=
"applicationname"
/><br
/>
<input
type=
"text"
id=
"davapp"
value=
""
placeholder=
"applicationname"
/><br
/>
<input
type=
"password"
id=
"davpassword"
value=
""
placeholder=
"password"
/><br
/>
<input
type=
"password"
id=
"davpassword"
value=
""
placeholder=
"password"
/><br
/>
<input
type=
"text"
id=
"davurl"
value=
""
placeholder=
"url"
/><br
/>
<input
type=
"text"
id=
"davurl"
value=
""
placeholder=
"url"
/><br
/>
</th>
</th>
<th>
<th>
<input
type=
"text"
id=
"conflictuser"
value=
"localuser"
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"conflictuser"
value=
"localuser"
placeholder=
"username"
/><br
/>
<input
type=
"text"
id=
"conflictapp"
value=
"localapp"
placeholder=
"applicationname"
/><br
/>
<input
type=
"text"
id=
"conflictapp"
value=
"localapp"
placeholder=
"applicationname"
/><br
/>
</th>
</th>
<th
style=
"width:100%;"
>
<th
style=
"width:100%;"
>
<textarea
id=
"customstorage"
style=
"width:98%;"
>
{
"
type
"
:
"
local
"
,
"
username
"
:
"
customuser
"
,
"
applicationname
"
:
"
customapp
"
,
"
customkey
"
:
"
customvalue
"
}
</textarea>
<textarea
id=
"customstorage"
style=
"width:100%;"
>
{
"
type
"
:
"
local
"
,
"
username
"
:
"
customuser
"
,
"
applicationname
"
:
"
customapp
"
,
"
customkey
"
:
"
customvalue
"
}
</textarea>
</th>
</th>
</tr>
</tr>
<tr>
<tr>
<th><button
onclick=
"newLocalJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newLocalJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newCryptJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newCryptJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newDavJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newDavJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newConflictJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newConflictJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newCustomJio()"
>
Create New jIO
</button></th>
<th><button
onclick=
"newCustomJio()"
>
Create New jIO
</button></th>
</tr>
</tr>
</table>
</table>
</div>
<hr
/>
<input
type=
"text"
id=
"filepath"
value=
""
placeholder=
"filepath"
/>
<input
type=
"text"
id=
"content"
value=
""
placeholder=
"content"
/>
<input
type=
"text"
id=
"prev_rev"
value=
""
placeholder=
"previous revision"
/>
<br
/>
<br
/>
<label
for=
"show_conflicts"
>
Show Conflicts
</label>
<table
border=
"1"
style=
"width: 100%;"
>
<input
type=
"checkbox"
id=
"show_conflicts"
/>
,
<tr>
<label
for=
"show_revision_history"
>
Show Revision History
</label>
<td
style=
"width: 50%;"
>
<input
type=
"checkbox"
id=
"show_revision_history"
/>
,
<label
for=
"metadata"
>
Metadata or document id:
</label>
<label
for=
"show_revision_info"
>
Show Revision Info
</label>
<textarea
id=
"metadata"
rows=
"3"
style=
"width: 98%;"
>
{}
</textarea>
<input
type=
"checkbox"
id=
"show_revision_info"
/>
,
</td>
<label
for=
"last_revision"
>
Remove Last Revision
</label>
<td
style=
"width: 50%;"
>
<input
type=
"checkbox"
id=
"last_revision"
/>
,
<br
/>
<label
for=
"document_id"
>
Document Id:
</label>
<label
for=
"max_retry"
>
Max Retry
</label>
<input
type=
"text"
id=
"document_id"
value=
""
/>
<input
type=
"number"
id=
"max_retry"
value=
"0"
style=
"width:30px;"
/>
<label
for=
"mimetype"
>
Mime Type:
</label>
(0 = infinite),
<input
type=
"text"
id=
"mimetype"
value=
""
/><br
/>
<label
for=
"metadata_only"
>
Metadata Only
</label>
<label
for=
"content"
>
Content:
</label>
<input
type=
"checkbox"
id=
"metadata_only"
/>
<textarea
id=
"content"
rows=
"3"
style=
"width: 98%;"
></textarea><br
/>
<hr
/>
</td>
<button
onclick=
"post()"
>
post
</button>
</tr>
<button
onclick=
"put()"
>
put
</button>
<tr>
<button
onclick=
"get()"
>
get
</button>
<td
colspan=
"2"
style=
"text-align: center;"
>
<button
onclick=
"remove()"
>
remove
</button>
<label
for=
"prev_rev"
>
Previous revision:
</label>
<button
onclick=
"allDocs()"
>
allDocs
</button><br
/>
<input
type=
"text"
id=
"prev_rev"
value=
""
style=
"width: 40em;"
/><br
/>
<button
onclick=
"printLocalStorage()"
>
print localStorage
</button>
<label
for=
"show_conflicts"
>
Show Conflicts
</label>
<button
onclick=
"localStorage.clear()"
>
clear localStorage
</button><br
/>
<input
type=
"checkbox"
id=
"show_conflicts"
/>
,
<button
onclick=
"clearlog()"
>
Clear Log
</button>
<label
for=
"show_revision_history"
>
Show Revision History
</label>
<input
type=
"checkbox"
id=
"show_revision_history"
/>
,
<label
for=
"show_revision_info"
>
Show Revision Info
</label>
<input
type=
"checkbox"
id=
"show_revision_info"
/>
,
<br
/>
<label
for=
"max_retry"
>
Max Retry
</label>
<input
type=
"number"
id=
"max_retry"
value=
"0"
style=
"width:30px;"
/>
(0 = infinite)
</td>
</tr>
<tr>
<td
style=
"text-align: center;"
>
<button
onclick=
"post()"
>
post
</button>
<button
onclick=
"put()"
>
put
</button>
<button
onclick=
"get()"
>
get
</button>
<button
onclick=
"remove()"
>
remove
</button>
<button
onclick=
"allDocs()"
>
allDocs
</button>
</td>
<td
style=
"text-align: center;"
>
<button
onclick=
"putAttachment()"
>
putAttachment
</button>
</td>
</tr>
</table>
<br
/>
<div
style=
"text-align: center;"
>
<button
onclick=
"printLocalStorage()"
>
print localStorage
</button>
<button
onclick=
"localStorage.clear()"
>
clear localStorage
</button><br
/>
<button
onclick=
"clearlog()"
>
Clear Log
</button>
</div>
<hr
/>
<hr
/>
<div
id=
"log"
>
<div
id=
"log"
>
</div>
</div>
...
@@ -195,7 +216,7 @@ var callback = function (err,val,begin_date) {
...
@@ -195,7 +216,7 @@ var callback = function (err,val,begin_date) {
log
(
'
return :
'
+
JSON
.
stringify
(
val
));
log
(
'
return :
'
+
JSON
.
stringify
(
val
));
};
};
var
command
=
function
(
method
)
{
var
command
=
function
(
method
)
{
var
begin_date
=
Date
.
now
(),
doc
=
{},
opts
=
{};
var
begin_date
=
Date
.
now
(),
doc
=
{},
opts
=
{}
,
other
=
{}
;
log
(
method
);
log
(
method
);
if
(
!
my_jio
)
{
if
(
!
my_jio
)
{
return
error
(
'
no jio set
'
);
return
error
(
'
no jio set
'
);
...
@@ -205,27 +226,35 @@ var command = function (method) {
...
@@ -205,27 +226,35 @@ var command = function (method) {
opts
.
revs
=
$
(
'
#show_revision_history
'
).
attr
(
'
checked
'
)?
true
:
false
;
opts
.
revs
=
$
(
'
#show_revision_history
'
).
attr
(
'
checked
'
)?
true
:
false
;
opts
.
revs_info
=
$
(
'
#show_revision_info
'
).
attr
(
'
checked
'
)?
true
:
false
;
opts
.
revs_info
=
$
(
'
#show_revision_info
'
).
attr
(
'
checked
'
)?
true
:
false
;
opts
.
max_retry
=
parseInt
(
$
(
'
#max_retry
'
).
attr
(
'
value
'
)
||
'
0
'
);
opts
.
max_retry
=
parseInt
(
$
(
'
#max_retry
'
).
attr
(
'
value
'
)
||
'
0
'
);
opts
.
metadata_only
=
$
(
'
#metadata_only
'
).
attr
(
'
checked
'
)?
true
:
false
;
switch
(
method
)
{
switch
(
method
)
{
case
'
putAttachment
'
:
other
.
docid
=
$
(
'
#document_id
'
).
attr
(
'
value
'
);
other
.
revision
=
$
(
'
#prev_rev
'
).
attr
(
'
value
'
);
other
.
content
=
$
(
'
#content
'
).
attr
(
'
value
'
);
other
.
mimetype
=
$
(
'
#mimetype
'
).
attr
(
'
value
'
);
log
(
'
docid:
'
+
other
.
docid
);
log
(
'
revision:
'
+
other
.
revision
);
log
(
'
content:
'
+
other
.
content
);
log
(
'
mimetype:
'
+
other
.
mimetype
);
case
'
post
'
:
case
'
post
'
:
case
'
put
'
:
case
'
put
'
:
doc
.
content
=
$
(
'
#content
'
).
attr
(
'
value
'
);
doc
=
JSON
.
parse
(
$
(
'
#metadata
'
).
attr
(
'
value
'
));
doc
.
_id
=
$
(
'
#filepath
'
).
attr
(
'
value
'
);
log
(
'
doc:
'
+
JSON
.
stringify
(
doc
));
doc
.
_rev
=
$
(
'
#prev_rev
'
).
attr
(
'
value
'
)
||
undefined
;
break
;
break
;
case
'
remove
'
:
case
'
remove
'
:
doc
.
_id
=
$
(
'
#filepath
'
).
attr
(
'
value
'
);
doc
=
JSON
.
parse
(
$
(
'
#metadata
'
).
attr
(
'
value
'
)
);
opts
.
rev
=
(
$
(
'
#last_revision
'
).
attr
(
'
checked
'
)?
'
last
'
:
undefined
)
||
opts
.
rev
=
(
$
(
'
#last_revision
'
).
attr
(
'
checked
'
)?
'
last
'
:
undefined
)
||
$
(
'
#prev_rev
'
).
attr
(
'
value
'
)
||
undefined
;
$
(
'
#prev_rev
'
).
attr
(
'
value
'
)
||
undefined
;
log
(
'
doc:
'
+
JSON
.
stringify
(
doc
));
break
;
break
;
case
'
get
'
:
case
'
get
'
:
doc
=
$
(
'
#filepath
'
).
attr
(
'
value
'
);
doc
=
$
(
'
#metadata
'
).
attr
(
'
value
'
);
log
(
'
docid:
'
+
doc
)
case
'
allDocs
'
:
case
'
allDocs
'
:
break
;
break
;
}
}
log
(
'
doc:
'
+
JSON
.
stringify
(
doc
));
log
(
'
opts:
'
+
JSON
.
stringify
(
opts
));
log
(
'
opts:
'
+
JSON
.
stringify
(
opts
));
switch
(
method
)
{
switch
(
method
)
{
...
@@ -242,6 +271,14 @@ var command = function (method) {
...
@@ -242,6 +271,14 @@ var command = function (method) {
callback
(
err
,
val
,
begin_date
);
callback
(
err
,
val
,
begin_date
);
});
});
break
;
break
;
case
'
putAttachment
'
:
my_jio
[
method
](
other
.
docid
,
other
.
revision
,
other
.
content
,
other
.
mimetype
,
opts
,
function
(
err
,
val
)
{
callback
(
err
,
val
,
begin_date
);
}
);
break
;
}
}
};
};
var
post
=
function
()
{
var
post
=
function
()
{
...
@@ -258,7 +295,10 @@ var remove = function () {
...
@@ -258,7 +295,10 @@ var remove = function () {
};
};
var
allDocs
=
function
()
{
var
allDocs
=
function
()
{
command
(
'
allDocs
'
);
command
(
'
allDocs
'
);
}
};
var
putAttachment
=
function
()
{
command
(
'
putAttachment
'
);
};
//-->
//-->
</script>
</script>
</body>
</body>
...
...
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