Commit f8faabf0 authored by Frank Bergmann's avatar Frank Bergmann

- Gustaf changes

parent 08df66c8
......@@ -255,14 +255,14 @@ proc intranet_download { folder_type } {
set platform [lindex $tcl_platform(platform) 0]
set url "[ns_conn url]"
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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 [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
# 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]
......
......@@ -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
......@@ -28,7 +28,7 @@ ad_page_contract {
}
# User id already verified by filters
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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)\">
......
......@@ -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 [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
# Get the list of all relevant roles and profiles for permissions
set roles [im_filestorage_roles $user_id $object_id]
......
......@@ -20,7 +20,7 @@ ad_page_contract {
return_url:notnull
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
set base_path [im_filestorage_base_path $folder_type $object_id]
......
......@@ -99,7 +99,7 @@ where
# -------------------------------------------------------
# User id already verified by filters
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
# Get the list of all relevant roles and profiles for permissions
set roles [im_filestorage_roles $user_id $object_id]
......
......@@ -31,7 +31,7 @@ ad_page_contract {
}
# User id already verified by filters
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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 "/"]
......
......@@ -17,7 +17,7 @@ ad_page_contract {
project_id:integer {The project_id specified doesn't look like an integer.}
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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"
......
......@@ -19,7 +19,7 @@ ad_page_contract {
project_id:integer {The project_id specified doesn't look like an integer.}
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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"
......
......@@ -11,7 +11,7 @@ ad_page_contract {
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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
}
......
......@@ -13,7 +13,7 @@ ad_page_contract {
return_url:notnull
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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 ""
}
......
......@@ -11,7 +11,7 @@ ad_page_contract {
return_url
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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"
......
......@@ -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
......@@ -38,7 +38,7 @@ ad_page_contract {
{ file_id 0 }
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
set return_url "/intranet-filestorage/"
set current_url_without_vars [ns_conn url]
......
......@@ -19,7 +19,7 @@ ad_page_contract {
{description ""}
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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
}
......
......@@ -20,7 +20,7 @@ ad_page_contract {
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment