Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-confdb
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-confdb
Commits
579f7c2d
Commit
579f7c2d
authored
May 15, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- New style of showing ConfItems.
The old one didn't work, so this one can only be better...
parent
e01d08bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
51 deletions
+36
-51
intranet-confdb-procs.tcl
tcl/intranet-confdb-procs.tcl
+36
-51
No files found.
tcl/intranet-confdb-procs.tcl
View file @
579f7c2d
...
...
@@ -348,6 +348,7 @@ ad_proc -public im_conf_item_update_sql {
# ----------------------------------------------------------------------
# Delete a conf item
# ---------------------------------------------------------------------
ad_proc -public im_conf_item_delete
{
-conf_item_id:required
}
{
...
...
@@ -449,20 +450,18 @@ ad_proc -public im_conf_item_list_component {
{
-restrict_to_member_id 0
}
{
-restrict_to_type_id 0
}
{
-restrict_to_status_id 0
}
{
-max_entries_per_page 50
}
{
-max_entries_per_page 50
00
}
{
-export_var_list
{}
}
{
-return_url
""
}
}
{
Creates a HTML table showing a list of configuration items associated with
a project, a user or a ticket.
a project, a
task, a
user or a ticket.
}
{
# ---------------------- Security - Show the comp? -------------------------------
set
user_id
[
ad_conn user_id
]
set user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
set
current_user_id
[
auth::require_login
]
set user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$
current
_
user_id
]
if
{
""
==
$member
_id || 0 ==
$member
_id
}
{
set member_id
$restrict
_to_member_id
}
set include_subconf_items 0
if
{
""
==
$order
_by
}
{
set order_by
[
parameter::get_from_package_key -package_key intranet-confdb -parameter ConfItemComponentDefaultSortOrder -default
"tree_sortkey"
]
}
...
...
@@ -615,39 +614,16 @@ ad_proc -public im_conf_item_list_component {
set criteria
[
list
]
if
{[
string
is integer
$restrict
_to_status_id
]
&&
$restrict
_to_status_id > 0
}
{
lappend criteria
"ci.conf_item_status_id in (
[
join
[
im_sub_categories
$restrict
_to_status_id
]
","
]
)"
lappend criteria
"
sub_
ci.conf_item_status_id in (
[
join
[
im_sub_categories
$restrict
_to_status_id
]
","
]
)"
}
if
{[
string
is integer
$restrict
_to_type_id
]
&&
$restrict
_to_type_id > 0
}
{
lappend criteria
"ci.conf_item_type_id in (
[
join
[
im_sub_categories
$restrict
_to_type_id
]
","
]
)"
}
# Associated Object
if
{[
string
is integer
$object
_id
]
&&
$object
_id > 0
}
{
lappend criteria
"ci.conf_item_id in (
-- Generic relationship between object and conf item
select r.object_id_two
from acs_rels r,
im_conf_item_project_rels cipr
where r.rel_id = cipr.rel_id and
r.object_id_one = :object_id
UNION
-- object is the owner of the conf item
select cf.conf_item_id
from im_conf_items cf
where cf.conf_item_owner_id = :object_id
UNION
-- object is the user who created the conf item
select object_id
from acs_objects
where object_type = 'im_conf_item' and
creation_user = :object_id
)"
lappend criteria
"sub_ci.conf_item_type_id in (
[
join
[
im_sub_categories
$restrict
_to_type_id
]
","
]
)"
}
# Owner is stictly the owner_id of the conf_item
if
{[
string
is integer
$owner
_id
]
&&
$owner
_id > 0
}
{
lappend criteria
"ci.conf_item_owner_id = :owner_id"
lappend criteria
"
sub_
ci.conf_item_owner_id = :owner_id"
}
# Member is anybody associated with the conf item + the owner.
...
...
@@ -685,24 +661,24 @@ ad_proc -public im_conf_item_list_component {
}
# Restrict to this list of direct members and their parents
lappend criteria
"ci.conf_item_id in (
[
join
$result
_list
","
]
)"
lappend criteria
"
sub_
ci.conf_item_id in (
[
join
$result
_list
","
]
)"
}
if
{
!
[
im_permission
$user
_id
"view_conf_items_all"
]}
{
lappend criteria
"ci.conf_item_id in (
if
{
!
[
im_permission
$
current
_
user_id
"view_conf_items_all"
]}
{
lappend criteria
"
sub_
ci.conf_item_id in (
select ci.conf_item_id
from im_conf_items ci,
acs_rels r
where r.object_id_one = ci.conf_item_id and
r.object_id_two = :user_id
r.object_id_two = :
current_
user_id
)
"
lappend criteria
"
parent
.conf_item_id in (
lappend criteria
"
main_ci
.conf_item_id in (
select ci.conf_item_id
from im_conf_items ci,
acs_rels r
where r.object_id_one = ci.conf_item_id and
r.object_id_two = :user_id
r.object_id_two = :
current_
user_id
)
"
}
...
...
@@ -725,28 +701,37 @@ ad_proc -public im_conf_item_list_component {
# ---------------------- Get the SQL Query -------------------------
set sql
"
select
ci.*,
tree_level(
ci.tree_sortkey) - tree_level(parent
.tree_sortkey) as conf_item_level,
im_category_from_id(ci.conf_item_status_id) as conf_item_status,
im_category_from_id(ci.conf_item_type_id) as conf_item_type
sub_
ci.*,
tree_level(
sub_ci.tree_sortkey) - tree_level(main_ci
.tree_sortkey) as conf_item_level,
im_category_from_id(
sub_
ci.conf_item_status_id) as conf_item_status,
im_category_from_id(
sub_
ci.conf_item_type_id) as conf_item_type
$extra
_select
from
im_conf_items parent,
im_conf_items ci
acs_rels r,
im_conf_items main_ci,
im_conf_items sub_ci,
im_projects main_p,
im_projects sub_p
$extra
_from
where
parent.conf_item_parent_id is null and
ci.tree_sortkey between parent.tree_sortkey and tree_right(parent.tree_sortkey) and
ci.conf_item_status_id not in (
[
im_conf_item_status_deleted
]
)
main_p.project_id =
$object
_id and
main_p.project_id = 48410 and
sub_p.tree_sortkey between main_p.tree_sortkey and tree_right(main_p.tree_sortkey) and
sub_p.project_id = r.object_id_one and
r.object_id_two = main_ci.conf_item_id and
sub_ci.tree_sortkey between main_ci.tree_sortkey and tree_right(main_ci.tree_sortkey)
$restriction
_clause
$extra
_where
"
# fraber 150113: Sorting breaks the query!!!
# Maybe the table needs an index on tree_sortkey?
set ttt
{
order by ci.tree_sortkey
}
# ad_return_complaint 1 "<pre>[im_ad_hoc_query $sql
]
\n\n\n
$sql
</pre>
"
db_multirow conf_item_list_multirow conf_item_list_sql
$sql
{
# Perform the following steps in addition to calculating the multirow:
...
...
@@ -771,7 +756,7 @@ ad_proc -public im_conf_item_list_component {
select ohs.object_id
from im_biz_object_tree_status ohs
where ohs.open_p = 'c' and
ohs.user_id = :user_id and
ohs.user_id = :
current_
user_id and
ohs.page_url = 'default' and
ohs.object_id in
(
select conf_item_id
...
...
@@ -820,10 +805,10 @@ ad_proc -public im_conf_item_list_component {
if {
[
info
exists closed_conf_items_hash
(
$conf
_item_id
)]
} {
# Closed conf_item
set gif_html
"<a href='
[
export_vars -base
$open
_close_url
{
user_id
{
page_url
"default"
}
{
object_id
$conf
_item_id
}
{
open_p
"o"
}
return_url
}]
'>
[
im_gif
"plus_9"
]
</a>"
set gif_html "
<a href='
[
export_vars -base
$open
_close_url
{
{
user_id
$current
_user_id
}
{
page_url
"default"
}
{
object_id
$conf
_item_id
}
{
open_p
"o"
}
return_url
}]
'>
[
im_gif
"plus_9"
]
</a>
"
} else {
# So this is an open conf_item - show a "
(
-
)
", unless the conf_item is a leaf.
set gif_html
"<a href='
[
export_vars -base
$open
_close_url
{
user_id
{
page_url
"default"
}
{
object_id
$conf
_item_id
}
{
open_p
"c"
}
return_url
}]
'>
[
im_gif
"minus_9"
]
</a>"
set gif_html "
<a href='
[
export_vars -base
$open
_close_url
{
{
user_id
$current
_user_id
}
{
page_url
"default"
}
{
object_id
$conf
_item_id
}
{
open_p
"c"
}
return_url
}]
'>
[
im_gif
"minus_9"
]
</a>
"
if {
[
info
exists leafs_hash
(
$conf
_item_id
)]
} { set gif_html "
 
;
" }
}
...
...
@@ -1000,7 +985,7 @@ ad_proc -public im_conf_item_options {
Returns a list of all Conf Items.
}
{
set var_list
[
list
type_id
$type
_id status_id
$status
_id project_id
$project
_id owner_id
$owner
_id cost_center_id
$cost
_center_id
]
set options_sql
[
im_conf_item_select_sql -var_list
$var
_list
]
set options_sql
[
im_conf_item_select_sql -
treelevel 2 -
var_list
$var
_list
]
set options
[
list
]
if
{
$include
_empty_p
}
{
lappend options
[
list
$include
_empty_name
""
]
}
...
...
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