Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-core
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-core
Commits
9075564e
Commit
9075564e
authored
Aug 25, 2004
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Allowing to delete menus
parent
94e07668
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
7 deletions
+97
-7
index.tcl
www/admin/menus/index.tcl
+34
-7
menu-action.tcl
www/admin/menus/menu-action.tcl
+63
-0
No files found.
www/admin/menus/index.tcl
View file @
9075564e
...
...
@@ -18,6 +18,7 @@ ad_page_contract {
@author frank.bergmann@project-open.com
}
{
{
return_url
"/intranet/admin/menus/index"
}
}
# ------------------------------------------------------
...
...
@@ -51,12 +52,15 @@ set bgcolor(1) " class=roweven"
set
group_list_sql
{
select DISTINCT
g.group_name,
g.group_id
g.group_id,
p.profile_gif
from
acs_objects o,
groups g
groups g,
im_profiles p
where
g.group_id = o.object_id
and g.group_id = p.profile_id
and o.object_type = 'im_profile'
order by lower
(
g.group_name
)
}
...
...
@@ -70,16 +74,24 @@ set table_header "
<td width=20></td>
<td width=20></td>
<td width=20></td>
<td class=rowtitle>Package</td>
"
<td class=rowtitle>Package</td>
\n
"
set
main_sql_select
""
set
num_profiles 0
db_foreach group_list
$group
_list_sql
{
lappend group_ids
$group
_id
lappend group_names
$group
_name
append main_sql_select
"
\t
acs_permission.permission_p(m.menu_id,
$group
_id, 'read') as p
${group_id}
_read_p,
\n
"
append table_header
"<td class=rowtitle><A href=
$group
_url?group_id=
$group
_id>
$group
_name</A></td>
\n
"
append table_header
"
<td class=rowtitle><A href=
$group
_url?group_id=
$group
_id>
[
im_gif
$profile
_gif
$group
_name
]
</A></td>
\n
"
incr num_profiles
}
append
table_header
"</th>
\n
"
append
table_header
"
<td class=rowtitle>
[
im_gif del
"Delete Menu"
]
</td>
</tr>
"
# ------------------------------------------------------
...
...
@@ -106,6 +118,8 @@ connect by
set
table
"
<form action=menu-action method=post>
[
export_form_vars return_url
]
<table>
$table
_header
\n
"
...
...
@@ -142,7 +156,20 @@ db_foreach menus $main_sql {
}
append table
"
<td>
<input type=checkbox name=menu_id.
$menu
_id>
</td>
</tr>
"
}
append
table
"</table>
\n
"
append
table
"
<tr>
<td colspan=
[
expr
$num
_profiles + 5
]
> </td>
<td>
<input type=submit value='Del'>
</td>
</tr>
</table>
</form>
"
www/admin/menus/menu-action.tcl
0 → 100755
View file @
9075564e
# /packages/intranet-core/www/admin/menus/menu-action.tcl
#
# Copyright (C
)
2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_page_contract
{
Delete selected menus
@param return_url the url to return to
@param menu_id The list of menus to delete
@author frank.bergmann@project-open.com
}
{
menu_id:array,optional
{
submit
"delete"
}
{
return_url
"/intranet/admin/menus"
}
}
set
user_id
[
ad_maybe_redirect_for_registration
]
set
user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
if
{
!$user_is_admin_p
}
{
ad_return_complaint 1
"You have insufficient privileges to use this page"
return
}
set
menu_list
[
array
names menu_id
]
ns_log Notice
"menu-action: menu_list=
$menu
_list"
if
{
0 ==
[
llength
$menu
_list
]}
{
ad_returnredirect
$return
_url
}
# Convert the list of selected menus into a
# "menu_id in (1,2,3,4...
)
" clause
#
set menu_in_clause "
and menu_id in
(
"
append menu_in_clause
[
join
$menu
_list
", "
]
append menu_in_clause "
)
\n
"
ns_log Notice "
menu-action: menu_in_clause=$menu_in_clause
"
switch
$submit
{
"
delete
" {
set sql "
delete from im_menus
where 1=1
$menu
_in_clause
"
if {
[
catch
{
db_dml del_menus
$sql
}
err_msg
]
} {
ad_return_complaint 1 "
<li>Error deleting menus. Perhaps you try to delete menus that still have submenus. Here is the error:<br><pre>$err_msg</pre>
"
return
}
}
default {
ad_return_complaint 1 "
<li>Unknown value for submit: '$submit'
"
}
}
ad_returnredirect
$return
_url
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