alvaror
committed
on 30 Oct 09
Fix the name of a variable that is used inside a message
openacs-4/.../project-manager-portlet/lib/tasks.tcl (+30 -6)
153 153                                  ] \
154 154                  instance_id [list \
155 155                                   where_clause "p.object_package_id = :instance_id"
156 156                              ] \
157 157                 ]
158 158
159 159 foreach element $elements {
160 160
161 161     # Special treatement for days / hours
162 162
163 163     if {$element == "remaining"} {
164 164         set element "${days_string}_remaining"
165 165     }
166 166     if {$element == "worked"} {
167 167         set element "actual_${days_string}_worked"
168 168     }
169 169
170 170
171 171     # We need to filter by the user if a party_id is given
172 172     if {[exists_and_not_null party_id]} {
173           set party_where_clause "and t.party_id = :party_id"
  173         set party_where_clause "and 1 = ( select 1 from dual where t.party_id = :user_id or :user_id in (
  174                                         select object_id_two from acs_rels where object_id_one = t.party_id and rel_type = 'membership_rel'))"
174 175     } else {
175 176         set party_where_clause ""
176 177     }
177 178
178 179
179 180     # If we display the items of a single user, show the role. Otherwise
180 181     # show all players.
181 182
182 183     if {$element == "role"} {
183 184         if {[exists_and_not_null party_id]
184 185             && $user_id == $party_id} {
185 186             set element "role"
186 187             lappend filters [list role_id [list \
187 188                                                label "[_ project-manager.Roles]" \
188 189                                                values {[pm::role::select_list_filter]} \
189 190                                                where_clause "ta.role_id = :role_id"
190 191                                           ]
191 192                             ]
192 193         } else {
193 194             set element "party_id"
 
238 239         title {
239 240             label "[_ project-manager.Subject_1]"
240 241         }
241 242         parent_task_id {
242 243             label "[_ project-manager.Dep]"
243 244             display_template {<a href="@tasks.base_url@task-one?task_id=@tasks.parent_task_id@">@tasks.parent_task_id@</a>
244 245             }
245 246         }
246 247         priority {
247 248             label "[_ project-manager.Priority_1]"
248 249             display_template {
249 250                 @tasks.priority@
250 251             }
251 252         }
252 253         slack_time {
253 254             label "[_ project-manager.Slack_1]"
254 255             display_template "<if @tasks.slack_time@ gt 1>@tasks.slack_time@</if><else><font color=\"red\">@tasks.slack_time@</font></else>"
255 256         }
256 257         party_id {
257 258             label "[_ project-manager.Who]"
258               display_template {<group column="task_item_id"> <if @tasks.person_id@ eq @tasks.my_user_id@> <span class="selected"> </if> <if @tasks.is_lead_p@><i></if> <a href="@tasks.base_url@@tasks.user_url@">@tasks.first_names@ @tasks.last_name@</a> <if @tasks.is_lead_p@></i></if> <if @tasks.person_id@ eq @tasks.my_user_id@> </span> </if> <br> </group>
  259             display_template {<group column="task_item_id"> <if @tasks.party_id@ eq @tasks.my_user_id@> <span class="selected"> </if> <if @tasks.is_lead_p@><i></if> <a href="@tasks.base_url@@tasks.user_url@">@tasks.name@</a> <if @tasks.is_lead_p@></i></if> <if @tasks.party_id@ eq @tasks.my_user_id@> </span> </if> <br> </group>
259 260             }
260 261         }
261 262         role {
262 263             label "[_ project-manager.Role]"
263 264         }
264 265         earliest_start {
265 266             label "[_ project-manager.Earliest_Start]"
266 267             display_template "<if @tasks.days_to_earliest_start@ gt 1 or @tasks.status_type@ ne o>@tasks.earliest_start_pretty@</if><else><font color=\"00ff00\">@tasks.earliest_start_pretty@</font></else>"
267 268         }
268 269         earliest_finish {
269 270             label "[_ project-manager.Earliest_Finish]"
270 271             display_template "<if @tasks.days_to_earliest_finish@ gt 1 or @tasks.status_type@ ne o>@tasks.earliest_finish_pretty@</if><else><font color=\"00ff00\">@tasks.earliest_finish_pretty@</font></else>"
271 272         }
272 273         latest_start {
273 274             label "[_ project-manager.Latest_Start]"
274 275             display_template "<if @tasks.days_to_latest_start@ gt 1 or @tasks.status_type@ ne o>@tasks.latest_start_pretty@</if><else><font color=\"red\">@tasks.latest_start_pretty@</font></else>"
275 276         }
276 277         latest_finish {
277 278             label "[_ project-manager.Latest_Finish]"
278 279             display_template "<if @tasks.days_to_latest_finish@ gt 1 or @tasks.status_type@ ne o>@tasks.latest_finish_pretty@</if><else><font color=\"red\">@tasks.latest_finish_pretty@</font></else>"
 
304 305         }
305 306         actual_hours_worked {
306 307             label "[_ project-manager.Hours_worked]"
307 308             html {
308 309                 align right
309 310             }
310 311         }
311 312         project_item_id {
312 313             label "[_ project-manager.Project_1]"
313 314             display_template {<a href="@tasks.project_url@">@tasks.project_name@</a>}
314 315             hide_p {[ad_decode [exists_and_not_null project_item_id] 1 1 0]}
315 316         }
316 317         edit_url {
317 318             display_template {<a href="@tasks.base_url@@tasks.edit_url@">E</a>}
318 319         }
319 320         percent_complete {
320 321             label "[_ project-manager.Percent_complete]"
321 322         }
322 323         last_name {
323 324             label "[_ project-manager.Who]"
324               display_template {<group column="task_item_id"> <if @tasks.person_id@ eq @tasks.my_user_id@> <span class="selected"> </if> <if @tasks.is_lead_p@><i></if>
325                   @tasks.first_names@&nbsp;@tasks.last_name@ <if @tasks.is_lead_p@></i></if> <if @tasks.person_id@ eq @tasks.my_user_id@> </span> </if> <br> </group>
  325             display_template {<group column="task_item_id"> <if @tasks.party_id@ eq @tasks.my_user_id@> <span class="selected"> </if> <if @tasks.is_lead_p@><i></if>
  326                 @tasks.name@ <if @tasks.is_lead_p@></i></if> <if @tasks.party_id@ eq @tasks.my_user_id@> </span> </if> <br> </group>
326 327             }
327 328         }
328 329     } \
329 330     -sub_class {
330 331         narrow
331 332     } \
332 333     -filters $filters \
333 334     -actions $actions \
334 335     -bulk_actions $bulk_actions \
335 336     -bulk_action_export_vars $bulk_action_export_vars \
336 337     -html {
337 338         width 100%
338 339     } \
339 340     -formats {
340 341         normal {
341 342             label "[_ project-manager.Table]"
342 343             layout table
343 344             row $row_list
344 345         }
345 346         csv {
346 347             label "[_ project-manager.CSV]"
347 348             output csv
348 349             page_size 0
349 350             row $row_list
350 351         }
351 352     }
352 353
353 354
354 355 set count 0
355 356 set more_p 0
356 357
  358 # We ge the package_id of the pm instance to get the value of the parameter
357 359
358   db_multirow -extend {item_url earliest_start_pretty earliest_finish_pretty end_date_pretty latest_start_pretty latest_finish_pretty slack_time edit_url hours_remaining days_remaining actual_days_worked my_user_id user_url base_url task_close_url project_url} tasks tasks {} {
  360 set pm_package_id [dotlrn_community::get_package_id_from_package_key \
  361                        -package_key "project-manager" \
  362                        -community_id [dotlrn_community::get_community_id]]
359 363
  364 set assign_group_p [parameter::get -parameter "AssignGroupP" -default 0 -package_id $pm_package_id]
  365
  366 db_multirow -extend {item_url earliest_start_pretty earliest_finish_pretty end_date_pretty latest_start_pretty latest_finish_pretty slack_time edit_url hours_remaining days_remaining actual_days_worked my_user_id user_url base_url task_close_url project_url name} tasks tasks {} {
  367    
  368     if { $assign_group_p } {
  369         # We are going to show all asignees including groups
  370         if { [catch {set name [person::name -person_id $party_id] } err] } {
  371             # person::name give us an error so its probably a group so we get
  372             # the title
  373             set name [group::title -group_id $party_id]
  374         }
  375     } else {
  376         if { [catch {set name [person::name -person_id $party_id] } err] } {
  377             # person::name give us an error so its probably a group, here we don't want
  378             # to show any group so we just continue the multirow
  379             continue
  380         }
  381     }
  382
  383
360 384     incr count
361 385     if { [string equal $count 26] } {
362 386         set more_p 1
363 387         break
364 388     }
365 389
366 390     set item_url [export_vars \
367 391                       -base "task-one" {{task_id $task_item_id}}]
368 392
369 393     set edit_url [export_vars \
370 394                       -base "task-add-edit" {{task_id $task_item_id} project_item_id return_url}]
371 395
372 396     if {[parameter::get -parameter "UseDayInsteadOfHour"] == "f"} {
373 397         set fmt "%x %X"
374 398     } else {
375 399         set fmt "%x"
376 400     }
377 401
378 402     set earliest_start_pretty [lc_time_fmt $earliest_start $fmt]
379 403     set earliest_finish_pretty [lc_time_fmt $earliest_finish $fmt]
 
398 422         [pm::task::hours_remaining \
399 423              -estimated_hours_work $estimated_hours_work \
400 424              -estimated_hours_work_min $estimated_hours_work_min \
401 425              -estimated_hours_work_max $estimated_hours_work_max \
402 426              -percent_complete $percent_complete]
403 427
404 428     set days_remaining \
405 429         [pm::task::days_remaining \
406 430              -estimated_hours_work $estimated_hours_work \
407 431              -estimated_hours_work_min $estimated_hours_work_min \
408 432              -estimated_hours_work_max $estimated_hours_work_max \
409 433              -percent_complete $percent_complete]
410 434
411 435     if {[exists_and_not_null actual_hours_worked]} {
412 436         set actual_days_worked [expr $actual_hours_worked / 24]
413 437     } else {
414 438         set actual_days_worked ""
415 439     }
416 440     set my_user_id $user_id
417 441     set user_url [export_vars \
418                         -base "${contacts_url}contact" {{party_id $person_id}}]
  442                       -base "${contacts_url}contact" {{party_id $party_id}}]
419 443
420 444     acs_object::get -object_id $task_item_id -array task_array
421 445     set base_url [lindex [site_node::get_url_from_object_id -object_id $task_array(package_id)] 0]
422 446     set task_close_url [export_vars -base "${base_url}task-close" -url {task_item_id return_url}]
423 447     set project_url [export_vars -base "${base_url}one" {project_item_id $tasks(project_item_id)}]
424 448 }
425 449
426 450 # ------------------------- END OF FILE -------------------------