Index: openacs-4/packages/acs-tcl/lib/actions.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/lib/actions.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/lib/actions.adp 20 Mar 2005 00:47:07 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+ @actions.title_text@
+ @actions.long_text;noquote@
+
+
+ - @actions.text@
+ - @actions.long_text;noquote@
+
+
+
+
+
Index: openacs-4/packages/acs-tcl/lib/actions.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/lib/actions.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/lib/actions.tcl 20 Mar 2005 00:47:07 -0000 1.1
@@ -0,0 +1,30 @@
+# Generate an html version of the given package_id's admin actions.
+# expects to be in a conn.
+#
+# @param package_id
+# @param package_key
+# @param return_url
+
+set user_id [ad_conn user_id]
+
+multirow create actions type url_stub text title_text long_text
+
+if {![catch {
+ lindex [callback -catch -impl $package_key navigation::package_admin -user_id $user_id -package_id $package_id -return_url $return_url] 0
+} action_list]} {
+
+ foreach action $action_list {
+
+ if {[string equal [lindex $action 0] "LINK"]} {
+ foreach {type stub text title long} $action {break}
+ multirow append actions $type "$base_url$stub" $text $title $long
+
+ } elseif {[string equal [lindex $action 0] "SECTION"]} {
+ foreach {type title long} $action {break}
+ multirow append actions $type {} {} $title $long
+
+ } else {
+ error "actions.tcl: type [lindex $action 0] unknown"
+ }
+ }
+}
Index: openacs-4/packages/acs-tcl/tcl/navigation-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/navigation-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/navigation-callback-procs.tcl 20 Mar 2005 00:47:07 -0000 1.1
@@ -0,0 +1,61 @@
+ad_library {
+ Callback contract definitions for page rendering.
+
+ Typically the callbacks also have a corresponing
+ .adp for rendering their output, see the specific callbacks
+ for details.
+
+ @author Jeff Davis (davis@xarg.net)
+ @creation-date 2005-03-11
+ @cvs-id $Id: navigation-callback-procs.tcl,v 1.1 2005/03/20 00:47:07 jeffd Exp $
+}
+
+ad_proc -public -callback navigation::package_admin {
+ -package_id
+ -user_id
+ {-return_url {}}
+} {
+
Returns the list of available admin actions for the passed in
+ user on the passed in package_id.
+
+ {
+ {LINK url_stub text title_text long_text}
+ {SECTION title long_text}
+ }
+
+ Where LINK and SECTION are the literal strings.
+
+ For LINK the url and text are required, text and title should be plain text
+ but long_text should be html (and renderers should present it noquote).
+
+ For SECTION both title and long_text can be blank which for the
+ rendering agent would imply a section break with something like
+ blank space or an <hr> tag. Also keep in mind the rendering
+ agent may be creating dropdown menus which would only display the
+ link text and title or might be rendering in a page in which case
+ all things might be rendered so try to make sure the short "title"
+ and "text" fields are not abiguous. heading should be plain text
+ but long_text is treated as html.
+
+
+ url_stub should be relative to the package mountpoint
+ and without a leading / since the link may be prefixed by the
+ full path or by the vhost url depending on context.
+
+ The /pacakges/acs-tcl/lib/actions.adp file is an include which
+ will render admin actions returned by this callback.
+
+ @param package_id - the package for which to generate the admin links
+ @param user_id - the user_id for whom the list should be generated
+ @param return_url - a return_url provided by the rendering agent
+ for those actions which could come back
+
+ @return a list with one element, the list of actions
+ {{{LINK url_stub text title_text long_text} ... }}
+
+ @see callback::package::admin_actions::impl::forums
+ @see /packages/acs-tcl/lib/actions.adp
+ @see /packages/acs-tcl/lib/actions.tcl
+
+ @author Jeff Davis (davis@xarg.net)
+} -
Index: openacs-4/packages/forums/tcl/forums-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/tcl/forums-callback-procs.tcl 20 Mar 2005 00:47:07 -0000 1.1
@@ -0,0 +1,43 @@
+ad_library {
+ Navigation callbacks.
+
+ @author Jeff Davis
+ @creation-date 2005-03-11
+ @cvs-id $Id: forums-callback-procs.tcl,v 1.1 2005/03/20 00:47:07 jeffd Exp $
+}
+
+ad_proc -public -callback navigation::package_admin -impl forums {} {
+ return the admin actions for the forum package.
+} {
+ set actions {}
+
+ # Check for admin on the package...
+ if {[permission::permission_p -object_id $package_id -privilege admin -party_id $user_id]} {
+ lappend actions [list LINK admin/ [_ acs-kernel.common_Administration] {} [_ forums.Admin_for_all]]
+
+ lappend actions [list LINK \
+ [export_vars -base admin/permissions {{object_id $package_id}}] \
+ [_ acs-kernel.common_Permissions] {} [_ forums.Permissions_for_all]]
+ lappend actions [list LINK admin/forum-new [_ forums.Create_a_New_Forum] {} {}]
+ }
+
+ # check for admin on the individual forums.
+ db_foreach forums {
+ select forum_id, name, enabled_p
+ from forums_forums
+ where package_id = :package_id
+ and exists (select 1 from acs_object_party_privilege_map pm
+ where pm.object_id = forum_id
+ and pm.party_id = :user_id
+ and pm.privilege = 'admin')
+ } {
+ lappend actions [list SECTION "Forum $name ([ad_decode $enabled_p t [_ forums.enabled] [_ forums.disabled]])" {}]
+
+ lappend actions [list LINK [export_vars -base admin/forum-edit forum_id] \
+ [_ forums.Edit_forum_name] {} {}]
+ lappend actions [list LINK [export_vars -base admin/permissions {{object_id $forum_id} return_url}] \
+ [_ forums.Permission_forum_name] {} {}]
+ }
+ return $actions
+}
+