Commit a491e94a authored by Frank Bergmann's avatar Frank Bergmann

- Started creating a list of "my-stuff" objects of a given user

parent 913ec905
<if @show_template_p@>
<master>
<property name="title">@page_title@</property>
<property name="context_bar">@context_bar@</property>
<property name="sub_navbar">@sub_navbar_html;noquote@</property>
</if>
<script type="text/javascript">
Thumbs_up_pale = new Image();
Thumbs_up_pale.src = "@thumbs_up_pale_24_gif;noquote@";
Thumbs_up_pressed = new Image();
Thumbs_up_pressed.src = "@thumbs_up_pressed_24_gif;noquote@";
function thumbs_change (name, object) {
window.document.images[name].src = object.src;
}
</script>
<if @show_template_p@>
<table>
<tr valign=top>
<td width="100%">
</if>
<h1>@page_title@</h1>
<p>#intranet-wall.Description_of_activities#</p>
<form method=post action="/intranet-helpdesk/action">
<%= [export_form_vars {return_url} ] %>
<table class="list">
<tr class="list-header">
<th class="list-narrow">#intranet-wall.User#</th>
<th class="list-narrow">#intranet-wall.Object#</th>
<th class="list-narrow">#intranet-wall.Name#</th>
</tr>
<multiple name=my_stuff>
<if @my_stuff.rownum@ odd><tr class="list-odd" valign=top></if>
<else><tr class="list-even" valign=top></else>
<td align=center>
<%= [im_portrait_html $user_id] %>
</td>
<td align=left>
<a href=@container_url@>@container_type_l10n@ @container_name@</a> /<br>
<a href=@object_url@>@object_type_l10n@ @object_name@</a>
</td>
<td class="list-narrow">
@my_stuff.message@
</td>
</tr>
</multiple>
</table>
</form>
<if @show_template_p@>
</td>
</tr>
</table>
</if>
# /packages/intranet-wall/www/my-stuff.tcl
#
# Copyright (c) 2011 ]project-open[
# All rights reserved
# ---------------------------------------------------------------
# Page Contract
# ---------------------------------------------------------------
ad_page_contract {
Shows the list of all objects related to the current user.
@author frank.bergmann@ticket-open.com
} {
}
# ---------------------------------------------------------------
# Defaults & Security
# ---------------------------------------------------------------
set current_user_id [ad_get_user_id]
set page_title [lang::message::lookup "" intranet-wall.Project_Wall "My Stuff"]
set context_bar [im_context_bar $page_title]
set page_focus "im_header_form.keywords"
set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $current_user_id]
set return_url [im_url_with_query]
# Parameter passing from XoWiki includelet:
# Allow the includelet to disable the "master" on this page.
if {![info exists show_template_p]} { set show_template_p 1 }
# ---------------------------------------------------------------
# Main SQL
# ---------------------------------------------------------------
set my_stuff_sql ""
# ---------------------------------------------------------------
# Create the my-stuff multirow
# ---------------------------------------------------------------
set user_id 0
db_multirow -extend { container_url } my_stuff my_stuff_query $my_stuff_sql {
set container_url [util_memoize [list db_string container_url "
select url
from im_biz_object_urls
where object_type = '$container_type' and
url_type = 'view'
"]]
append container_url $container_id
set container_type_l10n [lang::message::lookup "" intranet-core.$container_type $container_type]
set object_url [util_memoize [list db_string object_url "
select url
from im_biz_object_urls
where object_type = '$object_type' and
url_type = 'view'
"]]
append object_url $object_id
set object_type_l10n [lang::message::lookup "" intranet-core.$object_type $object_type]
set creator_url [export_vars -base "/intranet/users/view" {{user_id $user_id}}]
}
# Define a few GIFs that are used in the ADP
set comment_gif [im_gif comments]
set thumbs_up_pale_24 [im_gif "thumbs_up.pale.24"]
set thumbs_down_pale_24 [im_gif "thumbs_down.pale.24"]
set thumbs_up_pressed_24 [im_gif "thumbs_up.pressed.24"]
set thumbs_down_pressed_24 [im_gif "thumbs_down.pressed.24"]
regexp {src=\"([a-z0-9A-Z_\./]*)\"} $thumbs_up_pale_24 match thumbs_up_pale_24_gif
regexp {src=\"([a-z0-9A-Z_\./]*)\"} $thumbs_up_pressed_24 match thumbs_up_pressed_24_gif
# ---------------------------------------------------------------
# Count how many surveys the user has filled out
# ---------------------------------------------------------------
set survey_count [db_string survey_count "
select count(*)
from survsimp_responses sr,
acs_objects o
where sr.response_id = o.object_id and
o.creation_user = :current_user_id and
survey_id in (438275, 438249, 305439)
"]
# ---------------------------------------------------------------
# Sub-Navbar
# ---------------------------------------------------------------
set next_page_url ""
set previous_page_url ""
set menu_select_label "wall"
set wall_navbar_html ""
# [im_wall_navbar $letter "/intranet-wall/index" $next_page_url $previous_page_url [list start_idx order_by how_many view_name letter] $menu_select_label]
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