Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-filestorage
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-filestorage
Commits
f8faabf0
Commit
f8faabf0
authored
Nov 24, 2015
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Gustaf changes
parent
08df66c8
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
49 additions
and
49 deletions
+49
-49
intranet-filestorage-procs.tcl
tcl/intranet-filestorage-procs.tcl
+16
-16
action.adp
www/action.adp
+2
-2
action.tcl
www/action.tcl
+10
-10
add-perms-2.tcl
www/add-perms-2.tcl
+1
-1
create-folder-2.tcl
www/create-folder-2.tcl
+1
-1
del-perms-2.tcl
www/del-perms-2.tcl
+1
-1
delete.tcl
www/delete.tcl
+2
-2
download.tcl
www/download.tcl
+2
-2
download.tcl
www/filestorage/download.tcl
+2
-2
upload-2.tcl
www/filestorage/upload-2.tcl
+2
-2
upload.tcl
www/filestorage/upload.tcl
+2
-2
folder_status_update.tcl
www/folder_status_update.tcl
+2
-2
index.adp
www/index.adp
+1
-1
index.tcl
www/index.tcl
+1
-1
upload-2.tcl
www/upload-2.tcl
+2
-2
upload-zip-2.tcl
www/upload-zip-2.tcl
+2
-2
No files found.
tcl/intranet-filestorage-procs.tcl
View file @
f8faabf0
...
...
@@ -255,14 +255,14 @@ proc intranet_download { folder_type } {
set platform
[
lindex
$tcl
_platform
(
platform
)
0
]
set url
"
[
ns_conn url
]
"
set user_id
[
a
d_maybe_redirect_for_registratio
n
]
set user_id
[
a
uth::require_logi
n
]
ns_log Notice
"intranet_download: url=
$url
"
# /intranet/download/projects/1934/source_en_US/help.rtf?
# Using the group_id as selector for various storage types.
set path_list
[
split
$url
{
/
}]
set len
[
expr
[
llength
$path
_list
]
- 1
]
set len
[
expr
{[
llength
$path
_list
]
- 1
}
]
# skip: +0:/ +1:intranet, +2:download, +3:folder_type, +4:<object_id>, +5:...
set group_id
[
lindex
$path
_list 4
]
...
...
@@ -1123,7 +1123,7 @@ where
foreach workflow_dir
$workflow
_dirs
{
foreach target_language
$target
_languages
{
if
{
[
string
equal
$target
_language
"none"
]
}
{
continue
}
if
{
$target
_language eq
"none"
}
{
continue
}
set dir
"
$project
_dir/
${workflow_dir}
_
$target
_language"
ns_log Notice
"im_filestorage_create_directories: dir=
$dir
"
if
{
!
[
file
exists
$dir
]}
{
...
...
@@ -1258,7 +1258,7 @@ ad_proc -private im_filestorage_merge_perms { perms1 perms2 } {
for
{
set
ctr 0
}
{
$ctr
<= 3
}
{
incr
ctr
}
{
set perm1
[
lindex
$perms1
$ctr
]
set perm2
[
lindex
$perms2
$ctr
]
lappend perms
[
expr
$perm1
+$perm2
]
lappend perms
[
expr
{
$perm1
+$perm2
}
]
}
return
$perms
}
...
...
@@ -1555,7 +1555,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
set find_cmd
[
im_filestorage_find_cmd
]
set current_url_without_vars
[
ns_conn url
]
set user_id
[
a
d_maybe_redirect_for_registratio
n
]
set user_id
[
a
uth::require_logi
n
]
# Extract the bread_crum variable and delete from URL variables
set bind_vars
[
ns_conn form
]
...
...
@@ -1579,7 +1579,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
set user_is_customer_p
[
im_user_is_customer_p
$user
_id
]
# Customer shouldn't see their filestorage
if
{
[
string
equal
"customer"
$folder
_type
]
||
[
string
equal
"user"
$folder
_type
]
}
{
if
{
"customer"
eq
$folder
_type ||
"user"
eq
$folder
_type
}
{
if
{
!$user_is_employee_p
}
{
return
""
}
}
...
...
@@ -1679,7 +1679,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
# Hash: Path -> folder_id
set folder_id_hash
(
$path
)
$folder
_id
set last_folder_id
[
expr
$folder
_id * 10
]
set last_folder_id
[
expr
{
$folder
_id * 10
}
]
# ns_log Notice
"im_filestorage_base_component:
$path
->
$folder
_id"
}
...
...
@@ -1741,7 +1741,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
set current_depth
[
llength
$rel
_path_list
]
# Get more information about the file
set file_body
[
lindex
$rel
_path_list
[
expr
$current
_depth -1
]
]
set file_body
[
lindex
$rel
_path_list
$current
_depth-1
]
set file_type
"file"
set file_size 0
set file_modified
"invalid"
...
...
@@ -1755,7 +1755,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
#
}
if
{
[
catch
{
set file_type
[
file
type
$file
]
set file_size
[
expr
[
file
size
$file
]
/ 1024
]
set file_size
[
expr
{[
file
size
$file
]
/ 1024
}
]
set file_modified
[
ns_fmttime
[
file
mtime
$file
]
"%d/%m/%Y"
]
set file_extension
[
file
extension
$file
]
}
err_msg
]
}
{
...
...
@@ -1783,7 +1783,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
# is open or not.
set visible_p
$open
_p_hash
(
$last
_parent_path
)
if
{
[
string
equal
"o"
$visible
_p
]
}
{
if
{
"o"
eq
$visible
_p
}
{
# Our parent was open, so this subdirectory becomes
# the new last_parent.
set last_parent_path
$rel
_path
...
...
@@ -1801,7 +1801,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
}
# Now we know that we need to render this line.
if
{
!
[
string
equal
"o"
$visible
_p
]
}
{
continue
}
if
{
"o"
ne
$visible
_p
}
{
continue
}
# ----------------------------------------------------
...
...
@@ -1819,11 +1819,11 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
# We need this counter to mark rows as even/odd alternatingly
# and to provide a unique identifier for each line for the
# file_id/dir_id/id_path construction.
set rowclass
$bgcolor
([
expr
$ctr
% 2
])
set rowclass
$bgcolor
([
expr
{
$ctr
% 2
}
])
incr ctr
# Actions executed if the file type is
"directory"
if
{
[
string
compare
$file
_type
"directory"
]
== 0
}
{
if
{
$file
_type eq
"directory"
}
{
set dir_bread_crum_list
[
lrange
$file
_paths
$base
_path_depth
[
llength
$file
_paths
]]
set dir_bread_crum_path
[
join
$dir
_bread_crum_list
"/"
]
...
...
@@ -1877,7 +1877,7 @@ ad_proc -public im_filestorage_base_component { user_id object_id object_name ba
}
else
{
# Skip the line if it's not a file
if
{
!
[
string
equal
$file
_type
"file"
]
}
{
continue
}
if
{
$file
_type ne
"file"
}
{
continue
}
append files_html
[
im_filestorage_file_row
\
$file
_body
\
$base
_path
\
...
...
@@ -1983,9 +1983,9 @@ ad_proc im_filestorage_dir_row {
incr i
}
set status
$open
_p
append line_html
"<a href=/intranet-filestorage/
folder_status_update?
[
export_vars -url
{
status object_id rel_path return_url
}]
>"
append line_html
"<a href=/intranet-filestorage/
[
export_vars -base folder_status_update
{
status object_id rel_path return_url
}]
>"
if
{
$open
_p
==
"o"
}
{
if
{
$open
_p
eq
"o"
}
{
append line_html
[
im_gif foldin2
]
}
else
{
append line_html
[
im_gif foldout2
]
...
...
www/action.adp
View file @
f8faabf0
...
...
@@ -3,7 +3,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<master src="../../intranet-core/www/master">
<property name="
title">@page_title
@</property>
<property name="context">@context_bar@</property>
<property name="
doc(title)">@page_title;literal
@</property>
<property name="context">@context_bar
;literal
@</property>
@page_content;noquote@
\ No newline at end of file
www/action.tcl
View file @
f8faabf0
...
...
@@ -28,7 +28,7 @@ ad_page_contract {
}
# User id already verified by filters
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
base_path
[
im_filestorage_base_path
$folder
_type
$object
_id
]
set
context_bar
""
set
page_title
""
...
...
@@ -90,7 +90,7 @@ switch $actions {
set profiles
[
im_filestorage_profiles
$user
_id
$object
_id
]
set roles
[
im_filestorage_roles
$user
_id
$object
_id
]
set tds
[
im_filestorage_profile_tds
$user
_id
$object
_id
]
set num_profiles
[
expr
[
llength
$roles
]
+
[
llength
$profiles
]
]
set num_profiles
[
expr
{[
llength
$roles
]
+
[
llength
$profiles
]}
]
set dirs_html
""
set ctr 0
...
...
@@ -106,7 +106,7 @@ switch $actions {
incr ctr
append dirs_html
"
<tr
$bgcolor
(
[
expr
$ctr
% 2
]
)>
<tr
$bgcolor
(
[
expr
{
$ctr
% 2
}
]
)>
<td>
<input type=checkbox name=dir_id.
$id
$checked
>
<input type=hidden name=id_path.
$id
value=
\"
$id
_path(
$id
)
\"
>
...
...
@@ -211,7 +211,7 @@ switch $actions {
set profiles
[
im_filestorage_profiles
$user
_id
$object
_id
]
set roles
[
im_filestorage_roles
$user
_id
$object
_id
]
set tds
[
im_filestorage_profile_tds
$user
_id
$object
_id
]
set num_profiles
[
expr
[
llength
$roles
]
+
[
llength
$profiles
]
]
set num_profiles
[
expr
{[
llength
$roles
]
+
[
llength
$profiles
]}
]
set dirs_html
""
set ctr 0
...
...
@@ -227,7 +227,7 @@ switch $actions {
incr ctr
append dirs_html
"
<tr
$bgcolor
(
[
expr
$ctr
% 2
]
)>
<tr
$bgcolor
(
[
expr
{
$ctr
% 2
}
]
)>
<td>
<input type=checkbox name=dir_id.
$id
$checked
>
<input type=hidden name=id_path.
$id
value=
\"
$id
_path(
$id
)
\"
>
...
...
@@ -440,7 +440,7 @@ switch $actions {
ns_log Notice
"intranet-filestorage/action: file_readable=
$file
_readable, zip_file_path=
$zip
_file_path, redirecting to /intranet/download/zip/0/
$zip
_file"
if
$file
_readable
{
if
{
$file
_readable
}
{
ad_returnredirect
"/intranet/download/zip/0/
$zip
_file"
}
else
{
ad_return_complaint 1
"
[
_ intranet-filestorage.lt_Did_not_find_the_spec
]
<br><pre>
$path
</pre>"
...
...
@@ -571,7 +571,7 @@ switch $actions {
# --------------------- Up-Folder ---------------------
set bread_crum_list
[
split
$bread
_crum_path
"/"
]
set bread_crum_list_upfolder
[
lrange
$bread
_crum_list 0
[
expr
[
llength
$bread
_crum_list
]
-2
]
]
set bread_crum_list_upfolder
[
lrange
$bread
_crum_list 0
[
llength
$bread
_crum_list
]
-2
]
set bread_crum_path_upfolder
[
join
$bread
_crum_list_upfolder
"/"
]
ns_set put
$bind
_vars bread_crum_path
$bread
_crum_path_upfolder
...
...
@@ -590,7 +590,7 @@ switch $actions {
set file_path
$id
_path
(
$id
)
set file_path_list
[
split
$file
_path
{
/
}]
set len
[
expr
[
llength
$file
_path_list
]
- 2
]
set len
[
expr
{[
llength
$file
_path_list
]
- 2
}
]
set path_list
[
lrange
$file
_path_list 0
$len
]
set path
[
join
$path
_list
"/"
]
...
...
@@ -600,7 +600,7 @@ switch $actions {
if
{
!$admin_p
}
{
continue
}
incr ctr
append files_html
"<tr
$bgcolor
(
[
expr
$ctr
% 2
]
)>
append files_html
"<tr
$bgcolor
(
[
expr
{
$ctr
% 2
}
]
)>
<td>
<input type=checkbox name=file_id.
$id
checked>
<input type=hidden name=id_path.
$id
value=
\"
$id
_path(
$id
)
\"
>
...
...
@@ -625,7 +625,7 @@ switch $actions {
set checked
""
}
incr ctr
append dirs_html
"<tr
$bgcolor
(
[
expr
$ctr
% 2
]
)>
append dirs_html
"<tr
$bgcolor
(
[
expr
{
$ctr
% 2
}
]
)>
<td>
<input type=checkbox name=dir_id.
$id
$checked
>
<input type=hidden name=id_path.
$id
value=
\"
$id
_path(
$id
)
\"
>
...
...
www/add-perms-2.tcl
View file @
f8faabf0
...
...
@@ -47,7 +47,7 @@ ns_log Notice "add-perms-2: dir_id=[array get dir_id]"
# -------------------------------------------------------
# User id already verified by filters
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
# Get the list of all relevant roles and profiles for permissions
set
roles
[
im_filestorage_roles
$user
_id
$object
_id
]
...
...
www/create-folder-2.tcl
View file @
f8faabf0
...
...
@@ -20,7 +20,7 @@ ad_page_contract {
return_url:notnull
}
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
base_path
[
im_filestorage_base_path
$folder
_type
$object
_id
]
...
...
www/del-perms-2.tcl
View file @
f8faabf0
...
...
@@ -99,7 +99,7 @@ where
# -------------------------------------------------------
# User id already verified by filters
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
# Get the list of all relevant roles and profiles for permissions
set
roles
[
im_filestorage_roles
$user
_id
$object
_id
]
...
...
www/delete.tcl
View file @
f8faabf0
...
...
@@ -31,7 +31,7 @@ ad_page_contract {
}
# User id already verified by filters
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
base_path
[
im_filestorage_base_path
$folder
_type
$object
_id
]
...
...
@@ -61,7 +61,7 @@ foreach id [array names file_id] {
set file_path
$id
_path
(
$id
)
set file_path_list
[
split
$file
_path
{
/
}]
set len
[
expr
[
llength
$file
_path_list
]
- 2
]
set len
[
expr
{[
llength
$file
_path_list
]
- 2
}
]
set path_list
[
lrange
$file
_path_list 0
$len
]
set path
[
join
$path
_list
"/"
]
...
...
www/download.tcl
View file @
f8faabf0
...
...
@@ -17,7 +17,7 @@ ad_page_contract {
project_id:integer
{
The project_id specified doesn't look like an integer.
}
}
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
project_path
[
im_filestorage_project_path
$project
_id
]
set
file
"
$project
_path/
$file
_name"
...
...
@@ -42,7 +42,7 @@ insert into im_fs_actions (
)"
if
[
file
readable
$file
]
{
if
{[
file
readable
$file
]}
{
ad_returnfile 200
$guessed
_file_type
$file
}
else
{
ad_returnredirect
"/error.tcl"
...
...
www/filestorage/download.tcl
View file @
f8faabf0
...
...
@@ -19,7 +19,7 @@ ad_page_contract {
project_id:integer
{
The project_id specified doesn't look like an integer.
}
}
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
project_path
[
im_filestorage_project_path
$project
_id
]
set
file
"
$project
_path/
$file
_name"
...
...
@@ -44,7 +44,7 @@ insert into im_fs_actions (
)"
if
[
file
readable
$file
]
{
if
{[
file
readable
$file
]}
{
ad_returnfile 200
$guessed
_file_type
$file
}
else
{
ad_returnredirect
"/error.tcl"
...
...
www/filestorage/upload-2.tcl
View file @
f8faabf0
...
...
@@ -11,7 +11,7 @@ ad_page_contract {
}
set user_id
[
a
d_maybe_redirect_for_registratio
n
]
set user_id
[
a
uth::require_logi
n
]
set
user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
set
page_title
"Upload into '
$folder
'"
...
...
@@ -55,7 +55,7 @@ set guessed_file_type [ns_guesstype $upload_file]
set
n_bytes
[
file
size
$tmp
_filename
]
# strip off the C:\directories... crud and just get the file name
if
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]
{
if
{
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]}
{
# couldn't find a match
set client_filename
$upload
_file
}
...
...
www/filestorage/upload.tcl
View file @
f8faabf0
...
...
@@ -13,7 +13,7 @@ ad_page_contract {
return_url:notnull
}
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
page_title
"Upload New File/URL"
set
context_bar
[
im_context_bar
[
list
"/intranet/projects/"
"Projects"
]
[
list
"/intranet/projects/view?group_id=
$project
_id"
"One Project"
]
"Upload File"
]
...
...
@@ -24,7 +24,7 @@ if {"" == $folder_type} {
}
# replace the "root" folder "/" with an empty string
if
{
[
string
compare
$folder
"/"
]
== 0
}
{
if
{
$folder
eq
"/"
}
{
set folder
""
}
...
...
www/folder_status_update.tcl
View file @
f8faabf0
...
...
@@ -11,7 +11,7 @@ ad_page_contract {
return_url
}
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
ns_log Notice
"folder_status_update: return_url=
$return
_url"
# ToDo: No permissions yet.
...
...
@@ -20,7 +20,7 @@ ns_log Notice "folder_status_update: return_url=$return_url"
# change the folder status from open to close and vice versa
if
{
$status
==
"o"
}
{
if
{
$status
eq
"o"
}
{
set status
"c"
}
else
{
set status
"o"
...
...
www/index.adp
View file @
f8faabf0
...
...
@@ -3,7 +3,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<master src="../../intranet-core/www/master">
<property name="
title">@page_title
@</property>
<property name="
doc(title)">@page_title;literal
@</property>
<br>
@page_body;noquote@
\ No newline at end of file
www/index.tcl
View file @
f8faabf0
...
...
@@ -38,7 +38,7 @@ ad_page_contract {
{
file_id 0
}
}
set
user_id
[
a
d_maybe_redirect_for_registratio
n
]
set
user_id
[
a
uth::require_logi
n
]
set
return_url
"/intranet-filestorage/"
set
current_url_without_vars
[
ns_conn url
]
...
...
www/upload-2.tcl
View file @
f8faabf0
...
...
@@ -19,7 +19,7 @@ ad_page_contract {
{
description
""
}
}
set user_id
[
a
d_maybe_redirect_for_registratio
n
]
set user_id
[
a
uth::require_logi
n
]
set
user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
set
page_title
"Upload into '
$bread
_crum_path'"
set
context_bar
[
im_context_bar
[
list
"/intranet/projects/"
"Projects"
]
[
list
"/intranet/projects/view?group_id=
$object
_id"
"One Project"
]
"Upload File"
]
...
...
@@ -102,7 +102,7 @@ set guessed_file_type [ns_guesstype $upload_file]
set
n_bytes
[
file
size
$tmp
_filename
]
# strip off the C:\directories... crud and just get the file name
if
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]
{
if
{
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]}
{
# couldn't find a match
set client_filename
$upload
_file
}
...
...
www/upload-zip-2.tcl
View file @
f8faabf0
...
...
@@ -20,7 +20,7 @@ ad_page_contract {
}
set user_id
[
a
d_maybe_redirect_for_registratio
n
]
set user_id
[
a
uth::require_logi
n
]
set
user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
set
page_title
"Upload into '
$bread
_crum_path'"
set
context_bar
[
im_context_bar
[
list
"/intranet/projects/"
"Projects"
]
[
list
"/intranet/projects/view?group_id=
$object
_id"
"One Project"
]
"Upload File"
]
...
...
@@ -91,7 +91,7 @@ set guessed_file_type [ns_guesstype $upload_file]
set
n_bytes
[
file
size
$tmp
_filename
]
# strip off the C:\directories... crud and just get the file name
if
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]
{
if
{
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]}
{
# couldn't find a match
set client_filename
$upload
_file
}
...
...
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