Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest-fs-openacs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest-fs-openacs
Commits
d6baa866
Commit
d6baa866
authored
Jan 07, 2019
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Now downloading and uploading
parent
6c6c538a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
317 additions
and
227 deletions
+317
-227
app.js
posync/app.js
+51
-166
Connection.js
posync/controller/Connection.js
+193
-37
File.js
posync/model/File.js
+31
-24
Files.js
posync/store/Files.js
+42
-0
No files found.
posync/app.js
View file @
d6baa866
This diff is collapsed.
Click to expand it.
posync/controller/Connection.js
View file @
d6baa866
This diff is collapsed.
Click to expand it.
posync/model/File.js
View file @
d6baa866
/*
* Data related to a file.
*
...
...
@@ -10,24 +9,35 @@ Ext.define('POSync.model.File', {
extend
:
'Ext.data.TreeModel'
,
idProperty
:
'id'
,
fields
:
[
'id'
,
// The system wide unique ID for this object (-> cr_items.item_id)
// FIXME: could better be file_id
'name'
,
// The name and extension (without path) of the file or folder
'version_id'
,
// The active version of the file (-> cr_revisions.revision_id) (empty string for folders)
'description'
,
// Description of the file or folder
'title'
,
// Title of the file or folder
'id'
,
// The system wide unique ID for this object (=file_id)
'name'
,
// The name (with extension) of the file or directory
'path'
,
// The absolute path relative to the project folder, excluding name
'extension'
,
// file extension
'type'
,
// 'file' or 'directory'
'mime_type'
,
// MIME type, empty for folders
'local_p'
,
// 't' for a local file (client), 'f' for remote (server) file
'title'
,
// Title of the file or folder
'description'
,
// Description of the file or folder
'content_length'
,
// File length in bytes (empty string for folders)
'creation_date'
,
// Date of first creation
'publish_date'
,
'modification_date'
,
// Date of last modification
'sha1'
,
// sha-1 hash of the content (empty string for folders)
// OpenACS properites
'file_id'
,
// ]po[ object_id of the file
'version_id'
,
// The version of the file (cr_revisions.revision_id), empty for folders
// Sencha properties
'level'
,
'children'
,
// FIXME: To be deleted
'iconCls'
,
// Used by ExtJS for the icon, seems to work
// FIXME: should be generated automatically from 'type' (icon-TYPE)
'content_length'
,
// File length in bytes (empty string for folders)
'sha1'
,
// sha-1 Hash of the content (empty string for folders)
'expanded'
,
// true or false (without quotes), default state for tree
'type'
,
// 'folder' for folders and the mime-type for file
'leaf'
,
// false for folders, true for files
// added by SALO
'level'
,
// FIXME: let ExtJS calculate this
'mime_type'
,
// FIXME: same as 'type' for files, and empty string for folders
'publish_date'
,
// empty string for folders
'children'
// undefined for files, a (possibly empty) array for folders
'expanded'
,
// default state for tree, true or false (without quotes)
'expandable'
,
// not sure
'leaf'
,
// true if node has no children
],
/**
...
...
@@ -38,14 +48,11 @@ Ext.define('POSync.model.File', {
// Skip the root and the 1st level folder, which refers to the project itself.
if
(
"root"
==
me
.
get
(
'id'
))
return
[];
if
(
"root"
==
me
.
get
(
'parentId'
))
return
[];
//
if ("root" == me.get('parentId')) return [];
var
fileType
=
me
.
get
(
'type'
);
var
parentId
=
me
.
get
(
'parentId'
);
if
(
!
parentId
)
return
[
me
.
get
(
'name'
)];
var
fileStore
=
Ext
.
StoreManager
.
get
(
'Files'
);
var
parent
=
fileStore
.
getById
(
parentId
);
if
(
!
parent
)
return
[
me
.
get
(
'name'
)];
var
parent
=
me
.
parentNode
;
if
(
!
parent
)
return
[];
var
parentPath
=
parent
.
getPathArray
();
// For a file return just the path (=parentPath)
...
...
posync/store/Files.js
View file @
d6baa866
...
...
@@ -12,6 +12,7 @@ Ext.define('POSync.store.Files', {
requires
:
'POSync.model.File'
,
model
:
'POSync.model.File'
,
nodeParam
:
'object_id'
,
root
:
{
expanded
:
true
,
children
:
[]
...
...
@@ -24,5 +25,46 @@ Ext.define('POSync.store.Files', {
type
:
'json'
,
root
:
'children'
}
},
/**
* Load the store with tree (from local directory)
*/
loadTree
:
function
(
tree
)
{
var
proxy
=
this
.
getProxy
();
proxy
.
data
=
tree
;
this
.
load
();
},
/**
* Check if a file with the given path exists
*/
searchUsingPathArray
:
function
(
pathArray
)
{
var
me
=
this
;
var
root
=
me
.
getRootNode
();
// root = root.childNodes[0]; // root is the project's root, so we need to start one below
// Iterate through the pathArray elements from
// the top to find the file in the local folder
var
node
=
root
;
for
(
var
i
=
0
;
i
<
pathArray
.
length
;
i
++
)
{
var
path
=
pathArray
[
i
];
// Check all children
var
child
=
null
;
var
children
=
node
.
childNodes
;
if
(
!
children
)
return
null
;
for
(
var
j
=
0
;
j
<
children
.
length
;
j
++
)
{
var
childName
=
children
[
j
].
get
(
'name'
);
if
(
path
===
childName
)
{
child
=
children
[
j
];
}
}
if
(
!
child
)
return
null
;
node
=
child
;
}
return
child
;
}
});
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