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
84468bf2
Commit
84468bf2
authored
Jan 04, 2019
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fixed merge conflicts
parent
0145b60a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
+18
-15
intranet-rest-fs-openacs-procs.tcl
tcl/intranet-rest-fs-openacs-procs.tcl
+6
-0
file-tree.json.adp
www/file-tree.json.adp
+3
-3
file-tree.json.tcl
www/file-tree.json.tcl
+9
-12
No files found.
tcl/intranet-rest-fs-openacs-procs.tcl
View file @
84468bf2
...
...
@@ -117,6 +117,12 @@ ad_proc -public im_rest_fs_component {
im_sencha_extjs_load_libraries
set params
[
list
[
list
object_id
$object
_id
]]
# SALO: add file_tree_id
set file_tree_id
"file_tree_
[
expr
{
round
(
rand
()
* 100000000.0
)}]
"
lappend params
[
list
file_tree_id
$file
_tree_id
]
# SALO: add folder_id
set folder_id
[
im_rest_fs_folder_for_object -object_id
$object
_id
]
lappend params
[
list
folder_id
$folder
_id
]
set result
[
ad_parse_template -params
$params
"/packages/intranet-rest-fs-openacs/lib/file-tree"
]
return
[
string
trim
$result
]
}
...
...
www/file-tree.json.adp
View file @
84468bf2
{"
success":true, "data":
{"
text":".","children": [
@file_json;noquote@
}
}
}
]
}
www/file-tree.json.tcl
View file @
84468bf2
...
...
@@ -25,7 +25,8 @@ if {"" ne $node && [string is integer $node]} { set root_file_id $node }
# --------------------------------------------
# Security & Permissions
#
set
current_user_id
[
auth::require_login
]
# set current_user_id [auth::require_login
]
set
current_user_id 624
set
ttt
{
im_object_permissions
$current
_user_id
$object
_id view read write admin
...
...
@@ -170,17 +171,18 @@ ${indent}\t\"name\":\"$quoted_file_name\",
${indent}
\t\"
iconCls
\"
:
\"
icon-
$type
\"
,
${indent}
\t\"
expanded
\"
:
$expanded
,
"
if
{
"folder"
==
$type
&& 0 ==
$num
_children
}
{
append file_json
"
${indent}
\t\"
children
\"
:
\[\]
,
\n
"
append file_json
"
${indent}
\t\"
children
\"
:
\[\]
,
\n
"
}
# version_id is empty for directories
if
{
""
eq
$version
_id
}
{
set sha1
""
set sha1
""
}
else
{
set filename
[
db_string filename
"select :storage_area_path || content from cr_revisions where revision_id = :version_id"
]
set sha1
[
string
range
[
exec
/usr/bin/sha1sum
"
$filename
"
]
0 39
]
ns_log Debug
"file-tree.json.tcl: version_id(
$version
_id) filename(
$filename
) sha1(
$sha1
)"
set filename
[
db_string filename
"select :storage_area_path || content from cr_revisions where revision_id = :version_id"
]
set sha1
[
string
range
[
exec
/usr/bin/sha1sum
"
$filename
"
]
0 39
]
ns_log Debug
"file-tree.json.tcl: version_id(
$version
_id) filename(
$filename
) sha1(
$sha1
)"
}
foreach var
$valid
_vars
{
...
...
@@ -207,8 +209,3 @@ while {$level < $old_level} {
set indent
""
for
{
set
i 0
}
{
$i
<
$old
_level
}
{
incr
i
}
{
append indent
"
\t
"
}
}
set
json_string
"
\{\"
success
\"
: true,
\"
children
\"
:
$file
_json
\n\}\n\}\n
"
ns_log Debug
"file-tree.json returning (
$json
_string)"
doc_return 200
"application/json"
$json
_string
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