Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-reporting
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-reporting
Commits
a47d93c6
Commit
a47d93c6
authored
Dec 16, 2006
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- backported stuff from V3.2
parent
d1b216ed
Pipeline
#379
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
136 additions
and
1 deletion
+136
-1
intranet-reporting-procs.tcl
tcl/intranet-reporting-procs.tcl
+136
-1
No files found.
tcl/intranet-reporting-procs.tcl
View file @
a47d93c6
...
...
@@ -455,4 +455,139 @@ ad_proc im_report_skip_if_zero {
}
{
if
{
0 ==
$amount
}
{
return
""
}
return
$string
}
\ No newline at end of file
}
ad_proc im_report_write_http_headers
{
-output_format
}
{
Writes a suitable HTTP header to the connection.
We need this custom routine in order to deal with
strange IE5/6 and MS-Excel behaviour that require
Latin1
(
iso-8859-1
)
or other encodings, depending
on the country specific version of Excel...
}
{
set content_type
[
im_report_content_type -output_format
$output
_format
]
set http_encoding
[
im_report_http_encoding -output_format
$output
_format
]
# ad_return_complaint 1
$http
_encoding
# set content_type
"text/html"
append content_type
"; charset=
$http
_encoding"
set all_the_headers
"HTTP/1.0 200 OK
MIME-Version: 1.0
Content-Type:
$content
_type
\r\n
"
util_WriteWithExtraOutputHeaders
$all
_the_headers
ns_startcontent -type
$content
_type
}
ad_proc im_report_content_type
{
-output_format
}
{
Returns the suitable MIME type for the given output_format
}
{
# return
"text/html"
switch
$output
_format
{
html
{
return
"text/html"
}
csv
{
return
[
parameter::get_from_package_key
\
-package_key intranet-dw-light
\
-parameter CsvContentType
\
-default
"application/csv"
\
]
}
default
{
return
"text/plain"
}
}
}
ad_proc im_report_tcl_encoding
{
-output_format
}
{
Returns a suitable conversion for the 'encoding convertto' command.
Please see 'encoding list' for a list of values and the TCL manuals
for an introduction to character encoding.
Please note that the values are similar to the HTTP encodings,
but not identical.
}
{
switch
$output
_format
{
html
{
return
""
}
csv
{
return
[
parameter::get_from_package_key
\
-package_key intranet-dw-light
\
-parameter CsvTclCharacterEncoding
\
-default
"iso8859-1"
\
]
}
default
{
return
""
}
}
}
ad_proc im_report_http_encoding
{
-output_format
}
{
Returns a suitable HTTP
"Content-Type"
value.
Please note that the values are similar to the TCL encodings,
but not identical.
}
{
switch
$output
_format
{
html
{
return
"utf-8"
}
csv
{
return
[
parameter::get_from_package_key
\
-package_key intranet-dw-light
\
-parameter CsvHttpCharacterEncoding
\
-default
"iso-8859-1"
\
]
}
default
{
return
"utf-8"
}
}
}
# -------------------------------------------------------
# Pivot Table helper procs
# -------------------------------------------------------
ad_proc -public im_report_take_n_from_list
{
list n
}
{
returns n elements from list
}
{
if
{
$n
<= 0
}
{
return
[
list
$list
]
}
set result
[
list
]
for
{
set
i 0
}
{
$i
<
[
llength
$list
]}
{
incr
i
}
{
set elem
[
lindex
$list
$i
]
set left_rest
[
lrange
$list
0
[
expr
$i-1
]]
set right_rest
[
lrange
$list
[
expr
$i
+1
]
end
]
set rest
[
concat
$left
_rest
$right
_rest
]
set rest_perms
[
im_report_take_n_from_list
$rest
[
expr
$n-1
]]
foreach rest_perm
$rest
_perms
{
lappend result
$rest
_perm
}
}
return
[
lsort
-unique
$result
]
}
ad_proc -public im_report_take_all_ordered_permutations
{
list
}
{
returns all permutations of a list
}
{
set n
[
llength
$list
]
set result
[
list
]
for
{
set
i 0
}
{
$i
<
[
llength
$list
]}
{
incr
i
}
{
set result
[
concat
$result
[
im_report_take_n_from_list
$list
$i
]]
}
lappend result
[
list
]
return
$result
}
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