jader
committed
on 18 Sep 04
Bump version number to release new version. When toggling status of projects,
also toggles status of corresponding project manager project w… Show more
Bump version number to release new version. When toggling status of projects,

also toggles status of corresponding project manager project when

appropriate (behavior is the same if no project-manager is installed)

Show less

openacs-4/.../logger/lib/entries.tcl (+7 -8)
49 49 # project-manager. The most important distinction is whether or not
50 50 # filter options are going to be shown. If they are, then a lot more
51 51 # computation has to be done.
52 52
53 53 # Because this can be called from other packages as well, the URLs we
54 54 # compute have to be fully qualified.
55 55
56 56 if {[info exists url]} {
57 57     set base_url $url
58 58 } else {
59 59     set base_url [ad_conn package_url]
60 60 }
61 61
62 62 # Testing:
63 63 # --------
64 64 # use cases to test for:
65 65 # using logger with and without project-manager
66 66 # when using project-manager, both integrated and not integrated with PM
67 67 # using logger with categories and without
68 68
69  
70 69 set package_id [ad_conn package_id]
71 70 set current_user_id [ad_conn user_id]
72 71 set admin_p [permission::permission_p -object_id $package_id -privilege admin]
73 72
74 73 if { [empty_string_p $variable_id] } {
75 74     ad_return_template "no-projects"
76 75     return
77 76 }
78 77
79 78 # Get variable info
80 79 logger::variable::get -variable_id $variable_id -array variable
81 80
82 81 # These are used to construct the values for the date filter
83 82 set weekdayno [clock format [clock seconds] -format %w]
84 83 set monthdayno [string trimleft [clock format [clock seconds] -format %d] 0]
85 84
86 85 # -----------------------
87 86 # PREPARATION FOR FILTERS
88 87 # -----------------------
89 88
90 89 # 1. get category-trees mapped to projects in this logger
91 90
92 91 # the logger::package::all_projects_in_package proc may be able to be
93 92 # optimized in some way? If you have thousands of projects, it tends
94 93 # to be a bit slow. Perhaps limit the results to only open projects?
95 94
96   if {[exists_and_not_null project_id] && !$filters_p} {
  95 if {[exists_and_not_null project_id] && [string is false $filters_p]} {
97 96     set project_ids [list $project_id]
98 97 }  else {
99 98     set project_ids [logger::package::all_projects_in_package -package_id [ad_conn package_id]]
100 99 }
101 100
102 101 array set tree_id_array [list]
103 102
104 103 set elm_forest [category_tree::get_mapped_trees_from_object_list $project_ids]
105 104
106 105 foreach elm $elm_forest {
107 106     set tree_id_array([lindex $elm 0]) .
108 107 }
109 108
110 109 set tree_ids [array names tree_id_array]
111 110
112 111
113 112 # Projections
114 113 set projection_values [list]
115 114 if { [exists_and_not_null project_id] } {
116 115     db_foreach select_projections {} -column_array row {
117 116         lappend projection_values \
118 117             [list $row(name) [list [list projection_id $row(projection_id)] \
119 118                                   [list time_stamp:multiple [list $row(start_date_ansi) $row(end_date_ansi)]]]]
120 119     }
121 120 }
122 121
123 122 # Projects
124 123
125 124 # we don't need to show all the project options if this is being
126 125 # displayed in an include, and we're not showing the filters.
127   if {$filters_p} {
  126 if {[string is true $filters_p]} {
128 127     set project_where ""
129 128
130       set project_status_values [list]
131   } else {
132       set project_where "and lp.project_id = :project_id"
133  
134 129     if {[exists_and_not_null project_status]} {
135 130         append project_where " and lp.active_p = :project_status "
136 131     }
137 132
138       set project_status_values [list [list "True true"] [list "False false"]]
  133     set project_status_values [list [list "Open" "t"] [list "Closed" "f"]]
  134 } else {
  135     set project_where "and lp.project_id = :project_id"
  136
  137     set project_status_values [list]
139 138 }
140 139
141 140 set project_values [db_list_of_lists select_projects {}]
142 141
143 142 if { ([exists_and_not_null start_date] || [exists_and_not_null end_date]) && ![exists_and_not_null time_stamp] } {
144 143     # HACK: The filter is called 'time_stamp', but the variables passed are called start_date/end_date.
145 144     set time_stamp "foo"
146 145 }
147 146
148 147 #----------------------------------------------------------------------
149 148 # Define list elements
150 149 #----------------------------------------------------------------------
151 150
152 151 set elements {
153 152     edit {
154 153         label {}
155 154         display_template {
156 155            <if @entries.edit_p@ true>
157 156             <a href="@entries.edit_url@" title="Edit this log entry"
158 157             ><img src="/shared/images/Edit16.gif" height="16" width="16"