Compare commits

..
114 Commits
Author SHA1 Message Date
Jean-Philippe Lang a84920ca70 Merged r3865 and r3866 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3868 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-07-25 09:34:13 +00:00
Eric Davis 21d2de48b7 Merged r3836 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3838 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-07-08 03:54:53 +00:00
Eric Davis a19a37b600 Merged r3835 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3837 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-07-08 03:54:48 +00:00
Eric Davis 29e7b8d9ea Merged r3832 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3834 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-07-08 03:48:40 +00:00
Eric Davis f3b9c0027f Merged r3831 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3833 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-07-08 03:48:35 +00:00
Eric Davis a146c2d03f Merged r3815 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3817 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-28 02:48:12 +00:00
Eric Davis a62ff0841f Merged r3814 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3816 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-28 02:48:06 +00:00
Eric Davis d7ec02691f Merged r3811 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3812 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-24 02:39:21 +00:00
Eric Davis e7790bb6b5 Fix nil method error when no issue params are submitted. #5123
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3796 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-20 03:24:38 +00:00
Eric Davis 34f73b005b Merged r3785 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3795 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 23:03:12 +00:00
Eric Davis ba42e1e2ff Merged r3786 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3794 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 23:03:07 +00:00
Eric Davis 14074da8b1 Merged r3784 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3793 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 23:03:01 +00:00
Eric Davis 44851d079f Merged r3787 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3792 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 23:02:55 +00:00
Eric Davis e6d053c3fd Merged r3783 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3791 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 23:02:50 +00:00
Eric Davis f17924c60d Merged r3775 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3781 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 18:47:18 +00:00
Eric Davis 90e23e4d5d Merged r3777 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3780 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 18:47:13 +00:00
Eric Davis 88a2792778 Merged r3776 from trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3779 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 18:47:08 +00:00
Eric Davis 4c881d54a7 Merged r3659 from trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3778 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-06-19 18:47:03 +00:00
Jean-Philippe Lang a6d45cc68f Merged r3740 and r3741 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3742 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-05-22 08:55:56 +00:00
Jean-Philippe Lang f58f7e0e41 Merged r3727 from trunk for 0.9.4 release.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3728 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-05-01 12:38:44 +00:00
Jean-Philippe Lang 473366f887 Merged r3725 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3726 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-05-01 12:33:27 +00:00
Jean-Philippe Lang f6d2a4c29f Backported r3683 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3717 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-30 17:32:42 +00:00
Jean-Philippe Lang b26d0fe041 Merged r3705 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3715 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-30 17:20:59 +00:00
Jean-Philippe Lang 98f3e98d82 Merged r3702 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3714 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-30 17:19:40 +00:00
Jean-Philippe Lang 7b27280c9b Backported r3692 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3713 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-30 14:22:52 +00:00
Jean-Philippe Lang d287436627 Merged r3678 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3712 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-30 14:06:45 +00:00
Jean-Philippe Lang 666d3d6472 Merged r3682 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3711 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-30 14:05:37 +00:00
Eric Davis 36063f16ee Merged r3698 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3699 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-29 23:30:21 +00:00
Jean-Philippe Lang 4a295e723e Merged r3668 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3697 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-29 22:05:49 +00:00
Jean-Philippe Lang 6e67d76194 Merged r3613 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3662 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 15:24:49 +00:00
Jean-Philippe Lang eb55efd604 Merged r3612 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3661 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 15:23:30 +00:00
Jean-Philippe Lang 390eb7849c Merged r3611 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3660 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 15:21:08 +00:00
Jean-Philippe Lang 1588f3f6dc Merged r3397 from trunk to fix sqlite3 and pgsql test environments.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3658 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 15:06:43 +00:00
Jean-Philippe Lang 5ef8e8d45f Merged r3635 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3657 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:53:54 +00:00
Jean-Philippe Lang cd15eb77d9 Merged r3625 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3656 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:44:18 +00:00
Jean-Philippe Lang 3b699806d9 Merged r3614 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3655 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:43:29 +00:00
Jean-Philippe Lang d2367ccf53 Merged r3517 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3654 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:42:44 +00:00
Jean-Philippe Lang 9c00b8aa21 Merged r3530 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3653 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:41:59 +00:00
Jean-Philippe Lang bbb00b0bc4 Merged r3616 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3652 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:41:15 +00:00
Jean-Philippe Lang feac751318 Merged r3615 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3651 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:39:14 +00:00
Jean-Philippe Lang eb4a7f9f2e Merged r3566 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3650 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:37:59 +00:00
Jean-Philippe Lang 7ce9ba9e28 Merged r3562 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3649 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:34:05 +00:00
Jean-Philippe Lang 53880a4e08 Merged r3571 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3648 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:32:29 +00:00
Jean-Philippe Lang f92aa00705 Merged r3550 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3647 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:31:40 +00:00
Jean-Philippe Lang b240da3833 Merged r3532 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3646 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:30:50 +00:00
Jean-Philippe Lang da8624f7c7 Merged r3524 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3645 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:29:59 +00:00
Jean-Philippe Lang 46be83cd5e Merged r3537 and r3572 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3644 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:29:02 +00:00
Jean-Philippe Lang 667f7927a7 Merged r3494 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3643 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:21:47 +00:00
Jean-Philippe Lang 3e6f42e46d Backported r3608 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3642 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:20:40 +00:00
Jean-Philippe Lang 30c45a6187 Merged r3529 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3641 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:10:01 +00:00
Jean-Philippe Lang 32288ed5d7 Merged r3514 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3640 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:09:11 +00:00
Jean-Philippe Lang beb89eb8bb Merged r3558 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3639 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:08:03 +00:00
Jean-Philippe Lang 62d8016c4f Merged r3513 and r3531 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3638 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:06:10 +00:00
Jean-Philippe Lang 5a7a3b2392 Merged r3603 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3637 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:04:37 +00:00
Jean-Philippe Lang a2ad66a5c0 Merged r3539 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3636 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-04-11 14:03:28 +00:00
Jean-Philippe Lang bfd9164c0a Merged r3506 for 0.9.3 release.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3507 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-28 10:21:33 +00:00
Jean-Philippe Lang d80fb751fd Merged r3469, r3472 and r3473 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3505 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-28 10:10:55 +00:00
Jean-Philippe Lang aacabbe645 Merged r3498 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3504 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-28 09:59:31 +00:00
Jean-Philippe Lang 8eafcbede9 Merged r3481 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3503 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-28 09:58:33 +00:00
Jean-Philippe Lang 43c1481998 Merged r3446 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3502 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-28 09:56:55 +00:00
Jean-Philippe Lang 17f60af490 Merged r3394, r3466, r3467, r3468 and r3471 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3501 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-28 09:51:10 +00:00
Jean-Philippe Lang e5e5ad6b7a Merged r3398 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3465 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-20 10:40:02 +00:00
Jean-Philippe Lang 13fb739b56 Merged r3409 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3464 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-20 10:26:49 +00:00
Jean-Philippe Lang 73e849be58 Merged r3451 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3463 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-20 10:22:06 +00:00
Jean-Philippe Lang 0b7d4e818a Merged r3452 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3462 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-20 10:20:52 +00:00
Jean-Philippe Lang 40a4b111fa Merged r3447 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3461 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-20 10:19:02 +00:00
Jean-Philippe Lang 7d913f93c3 Merged r3448 and r3455 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3460 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-20 10:16:08 +00:00
Jean-Philippe Lang 864fd9c6a1 Merged bug fixes r3423 and r3427.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3433 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-14 15:57:56 +00:00
Jean-Philippe Lang 57dcbd7376 Merged bug fixes r3412 to r3414.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3432 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-14 15:55:00 +00:00
Jean-Philippe Lang 0ef11ef4fe Merged bug fixes r3402, r3405 to r3408 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3431 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-14 15:48:28 +00:00
Jean-Philippe Lang b5ee8c08ca Merged r3392 from trunk (0.9.2 update).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3393 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 12:48:56 +00:00
Jean-Philippe Lang 9487d8dd80 Merged r3389 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3391 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 12:37:12 +00:00
Jean-Philippe Lang f3bf588c82 Translations updated to trunk r3388.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3390 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 12:36:12 +00:00
Jean-Philippe Lang bd38623cca Merged r3379 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3387 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:58:42 +00:00
Jean-Philippe Lang bae86dc558 Merged r3377 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3386 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:57:49 +00:00
Jean-Philippe Lang 884c5be200 Backported r3368 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3385 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:56:49 +00:00
Jean-Philippe Lang ad24563b1e Merged r3378 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3384 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:53:17 +00:00
Jean-Philippe Lang cb8933ae55 Merged r3376 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3383 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:52:09 +00:00
Jean-Philippe Lang 5d75879046 Merged r3375 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3382 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:50:56 +00:00
Jean-Philippe Lang 69e5d91a2d Backported r3354 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3381 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:49:40 +00:00
Jean-Philippe Lang 7c1e877209 Merged r3357 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3380 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-07 11:45:31 +00:00
Eric Davis 76d9d01db0 Merged the Object Daddy exemplars from trunk. r3337, r3340, r3342
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3359 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-02-02 16:03:05 +00:00
Jean-Philippe Lang 27fa40d283 Merged r3351 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3352 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-30 11:24:10 +00:00
Jean-Philippe Lang 20a6d7eb86 Merged r3348 from trunk (version set to 0.9.1).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3349 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-30 10:54:45 +00:00
Jean-Philippe Lang b87cf0c91c Merged r3346 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3347 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-30 10:37:05 +00:00
Jean-Philippe Lang 14ee72def2 Merged r3341 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3345 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-30 10:28:26 +00:00
Jean-Philippe Lang a843cfff36 Merged r3343 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3344 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-30 10:26:30 +00:00
Jean-Philippe Lang 3d7cb0f40e Merged r3333 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3334 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-18 18:01:19 +00:00
Jean-Philippe Lang 92b267a608 Merged r3328 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3329 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-17 12:01:33 +00:00
Jean-Philippe Lang c1be8bcf9f Merged r3325 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3326 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-17 11:18:04 +00:00
Jean-Philippe Lang ff9aa9db59 Merged r3323 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3324 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-17 11:09:29 +00:00
Jean-Philippe Lang 65ee523852 Merged r3312 and r3320 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3321 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-17 10:34:47 +00:00
Jean-Philippe Lang 1f5d95b027 Merged r3309 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3318 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-17 10:28:06 +00:00
Jean-Philippe Lang c5a59aff5b Merged r3305, r3306, r3307, r3311 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3317 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-16 13:57:41 +00:00
Eric Davis f60881518a Merged r3315 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3316 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-14 23:33:48 +00:00
Jean-Philippe Lang 1efb25a433 Merged r3298 to r3302 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3303 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-10 10:22:03 +00:00
Jean-Philippe Lang eaaa471d6a Merged r3295 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3296 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-09 11:50:31 +00:00
Jean-Philippe Lang 2b6d8125d1 Merged r3293 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3294 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-09 11:47:38 +00:00
Jean-Philippe Lang 12b75ded08 Locales updated to trunk @ r3291.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3292 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-09 10:41:27 +00:00
Jean-Philippe Lang 46bf2b9276 Merged r3289 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3290 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-09 10:27:50 +00:00
Jean-Philippe Lang 9d82bff1a8 Merged r3282 to r3284 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3287 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-09 10:04:21 +00:00
Jean-Philippe Lang 4c75864948 Merged r3258 and r3281 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3286 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-09 10:02:16 +00:00
Jean-Philippe Lang 9d2474c234 Merged r3277 to r3279 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3280 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-03 11:47:25 +00:00
Jean-Philippe Lang 7193817dea Translation updates.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3276 e93f8b46-1217-0410-a6f0-8f06a7374b81
2010-01-03 10:32:37 +00:00
Eric Davis 610d7d4ba4 Merged r3267 from trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3268 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-30 00:51:08 +00:00
Eric Davis 4b41788848 Merged r3265 from trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3266 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-30 00:26:48 +00:00
Eric Davis e1423c7c23 Merged r3263 from trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3264 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-29 23:33:46 +00:00
Eric Davis 9c9f6722f6 Merged r3261 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3262 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-29 17:58:21 +00:00
Jean-Philippe Lang a8be47295a Merged r3259 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3260 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-29 14:56:17 +00:00
Eric Davis ba98197637 Merged r3256 from trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3257 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-29 00:44:28 +00:00
Jean-Philippe Lang a23399f220 Merged r3249 to r3252 and r3254 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3255 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-27 12:41:27 +00:00
Jean-Philippe Lang 718cd596e0 Merged r3246 and r3247 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3248 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-26 13:54:57 +00:00
Jean-Philippe Lang c5ccfede6d Set VERSION::BRANCH to stable.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3245 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-26 10:27:46 +00:00
Jean-Philippe Lang 7702bdcdab 0.9-stable branch created
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3244 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-12-26 10:22:16 +00:00
525 changed files with 5347 additions and 18179 deletions
-1
View File
@@ -17,4 +17,3 @@
/tmp/sockets/* /tmp/sockets/*
/tmp/test/* /tmp/test/*
/vendor/rails /vendor/rails
*.rbc
+1 -1
View File
@@ -2,4 +2,4 @@
Redmine is a flexible project management web application written using Ruby on Rails framework. Redmine is a flexible project management web application written using Ruby on Rails framework.
More details can be found at in the doc directory or on the official website http://www.redmine.org More details can be found at http://www.redmine.org
+6 -10
View File
@@ -27,7 +27,12 @@ class AccountController < ApplicationController
if request.get? if request.get?
logout_user logout_user
else else
authenticate_user # Authenticate user
if Setting.openid? && using_open_id?
open_id_authenticate(params[:openid_url])
else
password_authentication
end
end end
end end
@@ -135,14 +140,6 @@ class AccountController < ApplicationController
end end
end end
def authenticate_user
if Setting.openid? && using_open_id?
open_id_authenticate(params[:openid_url])
else
password_authentication
end
end
def password_authentication def password_authentication
user = User.try_to_login(params[:username], params[:password]) user = User.try_to_login(params[:username], params[:password])
@@ -218,7 +215,6 @@ class AccountController < ApplicationController
end end
def invalid_credentials def invalid_credentials
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash.now[:error] = l(:notice_account_invalid_creditentials) flash.now[:error] = l(:notice_account_invalid_creditentials)
end end
+31 -100
View File
@@ -22,7 +22,6 @@ class ApplicationController < ActionController::Base
include Redmine::I18n include Redmine::I18n
layout 'base' layout 'base'
exempt_from_layout 'builder'
# Remove broken cookie after upgrade from 0.8.x (#4292) # Remove broken cookie after upgrade from 0.8.x (#4292)
# See https://rails.lighthouseapp.com/projects/8994/tickets/3360 # See https://rails.lighthouseapp.com/projects/8994/tickets/3360
@@ -46,7 +45,7 @@ class ApplicationController < ActionController::Base
include Redmine::MenuManager::MenuController include Redmine::MenuManager::MenuController
helper Redmine::MenuManager::MenuHelper helper Redmine::MenuManager::MenuHelper
Redmine::Scm::Base.all.each do |scm| REDMINE_SUPPORTED_SCM.each do |scm|
require_dependency "repository/#{scm.underscore}" require_dependency "repository/#{scm.underscore}"
end end
@@ -71,8 +70,8 @@ class ApplicationController < ActionController::Base
elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action]) elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
# RSS key authentication does not start a session # RSS key authentication does not start a session
User.find_by_rss_key(params[:key]) User.find_by_rss_key(params[:key])
elsif Setting.rest_api_enabled? && ['xml', 'json'].include?(params[:format]) elsif Setting.rest_api_enabled? && ['xml', 'json'].include?(params[:format]) && accept_key_auth_actions.include?(params[:action])
if params[:key].present? && accept_key_auth_actions.include?(params[:action]) if params[:key].present?
# Use API key # Use API key
User.find_by_api_key(params[:key]) User.find_by_api_key(params[:key])
else else
@@ -129,9 +128,8 @@ class ApplicationController < ActionController::Base
respond_to do |format| respond_to do |format|
format.html { redirect_to :controller => "account", :action => "login", :back_url => url } format.html { redirect_to :controller => "account", :action => "login", :back_url => url }
format.atom { redirect_to :controller => "account", :action => "login", :back_url => url } format.atom { redirect_to :controller => "account", :action => "login", :back_url => url }
format.xml { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' } format.xml { head :unauthorized }
format.js { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' } format.json { head :unauthorized }
format.json { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
end end
return false return false
end end
@@ -161,47 +159,7 @@ class ApplicationController < ActionController::Base
def authorize_global(ctrl = params[:controller], action = params[:action], global = true) def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
authorize(ctrl, action, global) authorize(ctrl, action, global)
end end
# Find project of id params[:id]
def find_project
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
# Find a project based on params[:project_id]
# TODO: some subclasses override this, see about merging their logic
def find_optional_project
@project = Project.find(params[:project_id]) unless params[:project_id].blank?
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
allowed ? true : deny_access
rescue ActiveRecord::RecordNotFound
render_404
end
# Finds and sets @project based on @object.project
def find_project_from_association
render_404 unless @object.present?
@project = @object.project
rescue ActiveRecord::RecordNotFound
render_404
end
def find_model_object
model = self.class.read_inheritable_attribute('model_object')
if model
@object = model.find(params[:id])
self.instance_variable_set('@' + controller_name.singularize, @object) if @object
end
rescue ActiveRecord::RecordNotFound
render_404
end
def self.model_object(model)
write_inheritable_attribute('model_object', model)
end
# make sure that the user is a member of the project (or admin) if project is private # make sure that the user is a member of the project (or admin) if project is private
# used as a before_filter for actions that do not require any particular permission on the project # used as a before_filter for actions that do not require any particular permission on the project
def check_project_privacy def check_project_privacy
@@ -237,44 +195,21 @@ class ApplicationController < ActionController::Base
def render_403 def render_403
@project = nil @project = nil
respond_to do |format| render :template => "common/403", :layout => (request.xhr? ? false : 'base'), :status => 403
format.html { render :template => "common/403", :layout => (request.xhr? ? false : 'base'), :status => 403 }
format.atom { head 403 }
format.xml { head 403 }
format.js { head 403 }
format.json { head 403 }
end
return false return false
end end
def render_404 def render_404
respond_to do |format| render :template => "common/404", :layout => !request.xhr?, :status => 404
format.html { render :template => "common/404", :layout => !request.xhr?, :status => 404 }
format.atom { head 404 }
format.xml { head 404 }
format.js { head 404 }
format.json { head 404 }
end
return false return false
end end
def render_error(msg) def render_error(msg)
respond_to do |format| flash.now[:error] = msg
format.html { render :text => '', :layout => !request.xhr?, :status => 500
flash.now[:error] = msg
render :text => '', :layout => !request.xhr?, :status => 500
}
format.atom { head 500 }
format.xml { head 500 }
format.js { head 500 }
format.json { head 500 }
end
end end
def invalid_authenticity_token def invalid_authenticity_token
if api_request?
logger.error "Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)."
end
render_error "Invalid form authenticity token." render_error "Invalid form authenticity token."
end end
@@ -295,6 +230,27 @@ class ApplicationController < ActionController::Base
self.class.read_inheritable_attribute('accept_key_auth_actions') || [] self.class.read_inheritable_attribute('accept_key_auth_actions') || []
end end
# TODO: move to model
def attach_files(obj, attachments)
attached = []
unsaved = []
if attachments && attachments.is_a?(Hash)
attachments.each_value do |attachment|
file = attachment['file']
next unless file && file.size > 0
a = Attachment.create(:container => obj,
:file => file,
:description => attachment['description'].to_s.strip,
:author => User.current)
a.new_record? ? (unsaved << a) : (attached << a)
end
if unsaved.any?
flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
end
end
attached
end
# Returns the number of objects that should be displayed # Returns the number of objects that should be displayed
# on the paginated list # on the paginated list
def per_page_option def per_page_option
@@ -335,29 +291,4 @@ class ApplicationController < ActionController::Base
def filename_for_content_disposition(name) def filename_for_content_disposition(name)
request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
end end
def api_request?
%w(xml json).include? params[:format]
end
# Renders a warning flash if obj has unsaved attachments
def render_attachment_warning_if_needed(obj)
flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present?
end
# Rescues an invalid query statement. Just in case...
def query_statement_invalid(exception)
logger.error "Query::StatementInvalid: #{exception.message}" if logger
session.delete(:query)
sort_clear if respond_to?(:sort_clear)
render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
end
# Converts the errors on an ActiveRecord object into a common JSON format
def object_errors_to_json(object)
object.errors.collect do |attribute, error|
{ attribute => error }
end.to_json
end
end end
+18 -21
View File
@@ -20,42 +20,45 @@ class AuthSourcesController < ApplicationController
before_filter :require_admin before_filter :require_admin
def index
list
render :action => 'list' unless request.xhr?
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ], verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :template => :index } :redirect_to => { :action => :list }
def index def list
@auth_source_pages, @auth_sources = paginate auth_source_class.name.tableize, :per_page => 10 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
render "auth_sources/index" render :action => "list", :layout => false if request.xhr?
end end
def new def new
@auth_source = auth_source_class.new @auth_source = AuthSourceLdap.new
render 'auth_sources/new'
end end
def create def create
@auth_source = auth_source_class.new(params[:auth_source]) @auth_source = AuthSourceLdap.new(params[:auth_source])
if @auth_source.save if @auth_source.save
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'index' redirect_to :action => 'list'
else else
render 'auth_sources/new' render :action => 'new'
end end
end end
def edit def edit
@auth_source = AuthSource.find(params[:id]) @auth_source = AuthSource.find(params[:id])
render 'auth_sources/edit'
end end
def update def update
@auth_source = AuthSource.find(params[:id]) @auth_source = AuthSource.find(params[:id])
if @auth_source.update_attributes(params[:auth_source]) if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'index' redirect_to :action => 'list'
else else
render 'auth_sources/edit' render :action => 'edit'
end end
end end
@@ -65,9 +68,9 @@ class AuthSourcesController < ApplicationController
@auth_method.test_connection @auth_method.test_connection
flash[:notice] = l(:notice_successful_connection) flash[:notice] = l(:notice_successful_connection)
rescue => text rescue => text
flash[:error] = l(:error_unable_to_connect, text.message) flash[:error] = "Unable to connect (#{text})"
end end
redirect_to :action => 'index' redirect_to :action => 'list'
end end
def destroy def destroy
@@ -76,12 +79,6 @@ class AuthSourcesController < ApplicationController
@auth_source.destroy @auth_source.destroy
flash[:notice] = l(:notice_successful_delete) flash[:notice] = l(:notice_successful_delete)
end end
redirect_to :action => 'index' redirect_to :action => 'list'
end
protected
def auth_source_class
AuthSource
end end
end end
+4 -13
View File
@@ -17,7 +17,7 @@
class BoardsController < ApplicationController class BoardsController < ApplicationController
default_search_scope :messages default_search_scope :messages
before_filter :find_project, :find_board_if_available, :authorize before_filter :find_project, :authorize
helper :messages helper :messages
include MessagesHelper include MessagesHelper
@@ -68,33 +68,24 @@ class BoardsController < ApplicationController
@board.project = @project @board.project = @project
if request.post? && @board.save if request.post? && @board.save
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to_settings_in_projects redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
end end
end end
def edit def edit
if request.post? && @board.update_attributes(params[:board]) if request.post? && @board.update_attributes(params[:board])
redirect_to_settings_in_projects redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
end end
end end
def destroy def destroy
@board.destroy @board.destroy
redirect_to_settings_in_projects redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
end end
private private
def redirect_to_settings_in_projects
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
end
def find_project def find_project
@project = Project.find(params[:project_id]) @project = Project.find(params[:project_id])
rescue ActiveRecord::RecordNotFound
render_404
end
def find_board_if_available
@board = @project.boards.find(params[:id]) if params[:id] @board = @project.boards.find(params[:id]) if params[:id]
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
-38
View File
@@ -1,38 +0,0 @@
class CalendarsController < ApplicationController
before_filter :find_optional_project
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
helper :issues
helper :projects
helper :queries
include QueriesHelper
def show
if params[:year] and params[:year].to_i > 1900
@year = params[:year].to_i
if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
@month = params[:month].to_i
end
end
@year ||= Date.today.year
@month ||= Date.today.month
@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
retrieve_query
@query.group_by = nil
if @query.valid?
events = []
events += @query.issues(:include => [:tracker, :assigned_to, :priority],
:conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
)
events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
@calendar.events = events
end
render :layout => false if request.xhr?
end
end
+1 -1
View File
@@ -56,7 +56,7 @@ class CustomFieldsController < ApplicationController
@custom_field = CustomField.find(params[:id]).destroy @custom_field = CustomField.find(params[:id]).destroy
redirect_to :action => 'index', :tab => @custom_field.class.name redirect_to :action => 'index', :tab => @custom_field.class.name
rescue rescue
flash[:error] = l(:error_can_not_delete_custom_field) flash[:error] = "Unable to delete custom field"
redirect_to :action => 'index' redirect_to :action => 'index'
end end
end end
+11 -9
View File
@@ -17,10 +17,8 @@
class DocumentsController < ApplicationController class DocumentsController < ApplicationController
default_search_scope :documents default_search_scope :documents
model_object Document
before_filter :find_project, :only => [:index, :new] before_filter :find_project, :only => [:index, :new]
before_filter :find_model_object, :except => [:index, :new] before_filter :find_document, :except => [:index, :new]
before_filter :find_project_from_association, :except => [:index, :new]
before_filter :authorize before_filter :authorize
helper :attachments helper :attachments
@@ -49,8 +47,7 @@ class DocumentsController < ApplicationController
def new def new
@document = @project.documents.build(params[:document]) @document = @project.documents.build(params[:document])
if request.post? and @document.save if request.post? and @document.save
attachments = Attachment.attach_files(@document, params[:attachments]) attach_files(@document, params[:attachments])
render_attachment_warning_if_needed(@document)
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'index', :project_id => @project redirect_to :action => 'index', :project_id => @project
end end
@@ -70,10 +67,8 @@ class DocumentsController < ApplicationController
end end
def add_attachment def add_attachment
attachments = Attachment.attach_files(@document, params[:attachments]) attachments = attach_files(@document, params[:attachments])
render_attachment_warning_if_needed(@document) Mailer.deliver_attachments_added(attachments) if !attachments.empty? && Setting.notified_events.include?('document_added')
Mailer.deliver_attachments_added(attachments[:files]) if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
redirect_to :action => 'show', :id => @document redirect_to :action => 'show', :id => @document
end end
@@ -83,4 +78,11 @@ private
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
def find_document
@document = Document.find(params[:id])
@project = @document.project
rescue ActiveRecord::RecordNotFound
render_404
end
end end
-45
View File
@@ -1,45 +0,0 @@
class GanttsController < ApplicationController
before_filter :find_optional_project
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
helper :issues
helper :projects
helper :queries
include QueriesHelper
helper :sort
include SortHelper
include Redmine::Export::PDF
def show
@gantt = Redmine::Helpers::Gantt.new(params)
retrieve_query
@query.group_by = nil
if @query.valid?
events = []
# Issues that have start and due dates
events += @query.issues(:include => [:tracker, :assigned_to, :priority],
:order => "start_date, due_date",
:conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
)
# Issues that don't have a due date but that are assigned to a version with a date
events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
:order => "start_date, effective_date",
:conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
)
# Versions
events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
@gantt.events = events
end
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
respond_to do |format|
format.html { render :action => "show", :layout => !request.xhr? }
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
end
end
end
+3 -2
View File
@@ -57,7 +57,7 @@ class GroupsController < ApplicationController
# GET /groups/1/edit # GET /groups/1/edit
def edit def edit
@group = Group.find(params[:id], :include => :projects) @group = Group.find(params[:id])
end end
# POST /groups # POST /groups
@@ -138,7 +138,8 @@ class GroupsController < ApplicationController
def edit_membership def edit_membership
@group = Group.find(params[:id]) @group = Group.find(params[:id])
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group) @membership = params[:membership_id] ? Member.find(params[:membership_id]) : Member.new(:principal => @group)
@membership.attributes = params[:membership]
@membership.save if request.post? @membership.save if request.post?
respond_to do |format| respond_to do |format|
format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' } format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }
+4 -41
View File
@@ -17,41 +17,10 @@
class IssueCategoriesController < ApplicationController class IssueCategoriesController < ApplicationController
menu_item :settings menu_item :settings
model_object IssueCategory before_filter :find_project, :authorize
before_filter :find_model_object, :except => :new
before_filter :find_project_from_association, :except => :new
before_filter :find_project, :only => :new
before_filter :authorize
verify :method => :post, :only => :destroy verify :method => :post, :only => :destroy
def new
@category = @project.issue_categories.build(params[:category])
if request.post?
if @category.save
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
end
format.js do
# IE doesn't support the replace_html rjs method for select box options
render(:update) {|page| page.replace "issue_category_id",
content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]')
}
end
end
else
respond_to do |format|
format.html
format.js do
render(:update) {|page| page.alert(@category.errors.full_messages.join('\n')) }
end
end
end
end
end
def edit def edit
if request.post? and @category.update_attributes(params[:category]) if request.post? and @category.update_attributes(params[:category])
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
@@ -74,16 +43,10 @@ class IssueCategoriesController < ApplicationController
end end
private private
# Wrap ApplicationController's find_model_object method to set
# @category instead of just @issue_category
def find_model_object
super
@category = @object
end
def find_project def find_project
@project = Project.find(params[:project_id]) @category = IssueCategory.find(params[:id])
@project = @category.project
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
end end
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueRelationsController < ApplicationController class IssueRelationsController < ApplicationController
before_filter :find_issue, :find_project_from_association, :authorize before_filter :find_project, :authorize
def new def new
@relation = IssueRelation.new(params[:relation]) @relation = IssueRelation.new(params[:relation])
@@ -52,8 +52,9 @@ class IssueRelationsController < ApplicationController
end end
private private
def find_issue def find_project
@issue = @object = Issue.find(params[:issue_id]) @issue = Issue.find(params[:issue_id])
@project = @issue.project
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
+13 -8
View File
@@ -21,11 +21,16 @@ class IssueStatusesController < ApplicationController
before_filter :require_admin before_filter :require_admin
verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ], verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ],
:redirect_to => { :action => :index } :redirect_to => { :action => :list }
def index def index
list
render :action => 'list' unless request.xhr?
end
def list
@issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position" @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position"
render :action => "index", :layout => false if request.xhr? render :action => "list", :layout => false if request.xhr?
end end
def new def new
@@ -36,7 +41,7 @@ class IssueStatusesController < ApplicationController
@issue_status = IssueStatus.new(params[:issue_status]) @issue_status = IssueStatus.new(params[:issue_status])
if @issue_status.save if @issue_status.save
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'index' redirect_to :action => 'list'
else else
render :action => 'new' render :action => 'new'
end end
@@ -50,7 +55,7 @@ class IssueStatusesController < ApplicationController
@issue_status = IssueStatus.find(params[:id]) @issue_status = IssueStatus.find(params[:id])
if @issue_status.update_attributes(params[:issue_status]) if @issue_status.update_attributes(params[:issue_status])
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'index' redirect_to :action => 'list'
else else
render :action => 'edit' render :action => 'edit'
end end
@@ -58,10 +63,10 @@ class IssueStatusesController < ApplicationController
def destroy def destroy
IssueStatus.find(params[:id]).destroy IssueStatus.find(params[:id]).destroy
redirect_to :action => 'index' redirect_to :action => 'list'
rescue rescue
flash[:error] = l(:error_unable_delete_issue_status) flash[:error] = "Unable to delete issue status"
redirect_to :action => 'index' redirect_to :action => 'list'
end end
def update_issue_done_ratio def update_issue_done_ratio
@@ -70,6 +75,6 @@ class IssueStatusesController < ApplicationController
else else
flash[:error] = l(:error_issue_done_ratios_not_updated) flash[:error] = l(:error_issue_done_ratios_not_updated)
end end
redirect_to :action => 'index' redirect_to :action => 'list'
end end
end end
+226 -173
View File
@@ -16,16 +16,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssuesController < ApplicationController class IssuesController < ApplicationController
menu_item :new_issue, :only => [:new, :create] menu_item :new_issue, :only => :new
default_search_scope :issues default_search_scope :issues
before_filter :find_issue, :only => [:show, :edit, :update, :reply] before_filter :find_issue, :only => [:show, :edit, :reply]
before_filter :find_issues, :only => [:bulk_edit, :move, :destroy] before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
before_filter :find_project, :only => [:new, :create, :update_form, :preview, :auto_complete] before_filter :find_project, :only => [:new, :update_form, :preview]
before_filter :authorize, :except => [:index, :changes, :preview, :context_menu] before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :context_menu]
before_filter :find_optional_project, :only => [:index, :changes] before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create]
accept_key_auth :index, :show, :changes accept_key_auth :index, :show, :changes
rescue_from Query::StatementInvalid, :with => :query_statement_invalid rescue_from Query::StatementInvalid, :with => :query_statement_invalid
@@ -49,17 +47,14 @@ class IssuesController < ApplicationController
helper :timelog helper :timelog
include Redmine::Export::PDF include Redmine::Export::PDF
verify :method => [:post, :delete], verify :method => :post,
:only => :destroy, :only => :destroy,
:render => { :nothing => true, :status => :method_not_allowed } :render => { :nothing => true, :status => :method_not_allowed }
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
def index def index
retrieve_query retrieve_query
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns) sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h}))
if @query.valid? if @query.valid?
limit = case params[:format] limit = case params[:format]
@@ -81,8 +76,6 @@ class IssuesController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? } format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
format.xml { render :layout => false }
format.json { render :text => @issues.to_json, :layout => false }
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') } format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') }
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') } format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
@@ -98,7 +91,7 @@ class IssuesController < ApplicationController
def changes def changes
retrieve_query retrieve_query
sort_init 'id', 'desc' sort_init 'id', 'desc'
sort_update(@query.sortable_columns) sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h}))
if @query.valid? if @query.valid?
@journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC",
@@ -122,8 +115,6 @@ class IssuesController < ApplicationController
@time_entry = TimeEntry.new @time_entry = TimeEntry.new
respond_to do |format| respond_to do |format|
format.html { render :template => 'issues/show.rhtml' } format.html { render :template => 'issues/show.rhtml' }
format.xml { render :layout => false }
format.json { render :text => @issue.to_json, :layout => false }
format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' } format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") } format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
end end
@@ -132,32 +123,47 @@ class IssuesController < ApplicationController
# Add a new issue # Add a new issue
# The new issue will be created from an existing one if copy_from parameter is given # The new issue will be created from an existing one if copy_from parameter is given
def new def new
render :action => 'new', :layout => !request.xhr? @issue = Issue.new
end @issue.copy_from(params[:copy_from]) if params[:copy_from]
@issue.project = @project
def create # Tracker must be set before custom field values
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue }) @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
if @issue.save if @issue.tracker.nil?
attachments = Attachment.attach_files(@issue, params[:attachments]) render_error l(:error_no_tracker_in_project)
render_attachment_warning_if_needed(@issue)
flash[:notice] = l(:notice_successful_create)
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
respond_to do |format|
format.html {
redirect_to(params[:continue] ? { :action => 'new', :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } :
{ :action => 'show', :id => @issue })
}
format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'issues', :action => 'show', :id => @issue) }
format.json { render :text => @issue.to_json, :status => :created, :location => url_for(:controller => 'issues', :action => 'show'), :layout => false }
end
return return
else
respond_to do |format|
format.html { render :action => 'new' }
format.xml { render(:xml => @issue.errors, :status => :unprocessable_entity); return }
format.json { render :text => object_errors_to_json(@issue), :status => :unprocessable_entity, :layout => false }
end
end end
if params[:issue].is_a?(Hash)
@issue.attributes = params[:issue]
@issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
end
@issue.author = User.current
default_status = IssueStatus.default
unless default_status
render_error l(:error_no_default_issue_status)
return
end
@issue.status = default_status
@allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq
if request.get? || request.xhr?
@issue.start_date ||= Date.today
else
requested_status = IssueStatus.find_by_id(params[:issue][:status_id]) if params[:issue]
# Check that the user is allowed to apply the requested status
@issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
if @issue.save
attach_files(@issue, params[:attachments])
flash[:notice] = l(:notice_successful_create)
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } :
{ :action => 'show', :id => @issue })
return
end
end
@priorities = IssuePriority.all
render :layout => !request.xhr?
end end
# Attributes that can be updated on workflow transition (without :edit permission) # Attributes that can be updated on workflow transition (without :edit permission)
@@ -165,39 +171,47 @@ class IssuesController < ApplicationController
UPDATABLE_ATTRS_ON_TRANSITION = %w(status_id assigned_to_id fixed_version_id done_ratio) unless const_defined?(:UPDATABLE_ATTRS_ON_TRANSITION) UPDATABLE_ATTRS_ON_TRANSITION = %w(status_id assigned_to_id fixed_version_id done_ratio) unless const_defined?(:UPDATABLE_ATTRS_ON_TRANSITION)
def edit def edit
update_issue_from_params @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@priorities = IssuePriority.all
@journal = @issue.current_journal @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@time_entry = TimeEntry.new
respond_to do |format|
format.html { } @notes = params[:notes]
format.xml { } journal = @issue.init_journal(User.current, @notes)
# User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
attrs = params[:issue].dup
attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed
attrs.delete(:status_id) unless @allowed_statuses.detect {|s| s.id.to_s == attrs[:status_id].to_s}
@issue.attributes = attrs
end end
end
def update if request.post?
update_issue_from_params @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today)
@time_entry.attributes = params[:time_entry]
if @issue.save_issue_with_child_records(params, @time_entry) if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.valid?
render_attachment_warning_if_needed(@issue) attachments = attach_files(@issue, params[:attachments])
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? attachments.each {|a| journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => journal})
respond_to do |format| if @issue.save
format.html { redirect_back_or_default({:action => 'show', :id => @issue}) } # Log spend time
format.xml { head :ok } if User.current.allowed_to?(:log_time, @project)
format.json { head :ok } @time_entry.save
end end
else if !journal.new_record?
render_attachment_warning_if_needed(@issue) # Only send notification if something was actually changed
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? flash[:notice] = l(:notice_successful_update)
@journal = @issue.current_journal end
call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => journal})
respond_to do |format| redirect_back_or_default({:action => 'show', :id => @issue})
format.html { render :action => 'edit' } end
format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
format.json { render :text => object_errors_to_json(@issue), :status => :unprocessable_entity, :layout => false }
end end
end end
rescue ActiveRecord::StaleObjectError
# Optimistic locking exception
flash.now[:error] = l(:notice_locking_conflict)
# Remove the previously added attachments if issue was not updated
attachments.each(&:destroy)
end end
def reply def reply
@@ -225,24 +239,41 @@ class IssuesController < ApplicationController
# Bulk edit a set of issues # Bulk edit a set of issues
def bulk_edit def bulk_edit
@issues.sort!
if request.post? if request.post?
attributes = (params[:issue] || {}).reject {|k,v| v.blank?} tracker = params[:tracker_id].blank? ? nil : @project.trackers.find_by_id(params[:tracker_id])
attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id])
attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values] priority = params[:priority_id].blank? ? nil : IssuePriority.find_by_id(params[:priority_id])
assigned_to = (params[:assigned_to_id].blank? || params[:assigned_to_id] == 'none') ? nil : User.find_by_id(params[:assigned_to_id])
category = (params[:category_id].blank? || params[:category_id] == 'none') ? nil : @project.issue_categories.find_by_id(params[:category_id])
fixed_version = (params[:fixed_version_id].blank? || params[:fixed_version_id] == 'none') ? nil : @project.shared_versions.find_by_id(params[:fixed_version_id])
custom_field_values = params[:custom_field_values] ? params[:custom_field_values].reject {|k,v| v.blank?} : nil
unsaved_issue_ids = [] unsaved_issue_ids = []
@issues.each do |issue| @issues.each do |issue|
issue.reload
journal = issue.init_journal(User.current, params[:notes]) journal = issue.init_journal(User.current, params[:notes])
issue.safe_attributes = attributes issue.tracker = tracker if tracker
issue.priority = priority if priority
issue.assigned_to = assigned_to if assigned_to || params[:assigned_to_id] == 'none'
issue.category = category if category || params[:category_id] == 'none'
issue.fixed_version = fixed_version if fixed_version || params[:fixed_version_id] == 'none'
issue.start_date = params[:start_date] unless params[:start_date].blank?
issue.due_date = params[:due_date] unless params[:due_date].blank?
issue.done_ratio = params[:done_ratio] unless params[:done_ratio].blank?
issue.custom_field_values = custom_field_values if custom_field_values && !custom_field_values.empty?
call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue }) call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
unless issue.save # Don't save any change to the issue if the user is not authorized to apply the requested status
unless (status.nil? || (issue.new_statuses_allowed_to(User.current).include?(status) && issue.status = status)) && issue.save
# Keep unsaved issue ids to display them in flash error # Keep unsaved issue ids to display them in flash error
unsaved_issue_ids << issue.id unsaved_issue_ids << issue.id
end end
end end
set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids) if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless @issues.empty?
else
flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size,
:total => @issues.size,
:ids => '#' + unsaved_issue_ids.join(', #'))
end
redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project}) redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
return return
end end
@@ -251,7 +282,6 @@ class IssuesController < ApplicationController
end end
def move def move
@issues.sort!
@copy = params[:copy_options] && params[:copy_options][:copy] @copy = params[:copy_options] && params[:copy_options][:copy]
@allowed_projects = Issue.allowed_target_projects_on_move @allowed_projects = Issue.allowed_target_projects_on_move
@target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id] @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
@@ -263,7 +293,6 @@ class IssuesController < ApplicationController
unsaved_issue_ids = [] unsaved_issue_ids = []
moved_issues = [] moved_issues = []
@issues.each do |issue| @issues.each do |issue|
issue.reload
changed_attributes = {} changed_attributes = {}
[:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute| [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute|
unless params[valid_attribute].blank? unless params[valid_attribute].blank?
@@ -271,15 +300,19 @@ class IssuesController < ApplicationController
end end
end end
issue.init_journal(User.current) issue.init_journal(User.current)
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy }) if r = issue.move_to(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
moved_issues << r moved_issues << r
else else
unsaved_issue_ids << issue.id unsaved_issue_ids << issue.id
end end
end end
set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids) if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless @issues.empty?
else
flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size,
:total => @issues.size,
:ids => '#' + unsaved_issue_ids.join(', #'))
end
if params[:follow] if params[:follow]
if @issues.size == 1 && moved_issues.size == 1 if @issues.size == 1 && moved_issues.size == 1
redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
@@ -311,18 +344,69 @@ class IssuesController < ApplicationController
TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues])
end end
else else
unless params[:format] == 'xml' || params[:format] == 'json' # display the destroy form
# display the destroy form if it's a user request return
return
end
end end
end end
@issues.each(&:destroy) @issues.each(&:destroy)
respond_to do |format| redirect_to :action => 'index', :project_id => @project
format.html { redirect_to :action => 'index', :project_id => @project } end
format.xml { head :ok }
format.json { head :ok } def gantt
@gantt = Redmine::Helpers::Gantt.new(params)
retrieve_query
@query.group_by = nil
if @query.valid?
events = []
# Issues that have start and due dates
events += @query.issues(:include => [:tracker, :assigned_to, :priority],
:order => "start_date, due_date",
:conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
)
# Issues that don't have a due date but that are assigned to a version with a date
events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
:order => "start_date, effective_date",
:conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
)
# Versions
events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
@gantt.events = events
end end
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
respond_to do |format|
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
end
end
def calendar
if params[:year] and params[:year].to_i > 1900
@year = params[:year].to_i
if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
@month = params[:month].to_i
end
end
@year ||= Date.today.year
@month ||= Date.today.month
@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
retrieve_query
@query.group_by = nil
if @query.valid?
events = []
events += @query.issues(:include => [:tracker, :assigned_to, :priority],
:conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
)
events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
@calendar.events = events
end
render :layout => false if request.xhr?
end end
def context_menu def context_menu
@@ -370,29 +454,9 @@ class IssuesController < ApplicationController
def preview def preview
@issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank? @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
if @issue @attachements = @issue.attachments if @issue
@attachements = @issue.attachments @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil)
@description = params[:issue] && params[:issue][:description] render :partial => 'common/preview'
if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n")
@description = nil
end
@notes = params[:notes]
else
@description = (params[:issue] ? params[:issue][:description] : nil)
end
render :layout => false
end
def auto_complete
@issues = []
q = params[:q].to_s
if q.match(/^\d+$/)
@issues << @project.issues.visible.find_by_id(q.to_i)
end
unless q.blank?
@issues += @project.issues.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10)
end
render :layout => false
end end
private private
@@ -420,69 +484,58 @@ private
end end
def find_project def find_project
project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] @project = Project.find(params[:project_id])
@project = Project.find(project_id)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
# Used by #edit and #update to set some common instance variables def find_optional_project
# from the params @project = Project.find(params[:project_id]) unless params[:project_id].blank?
# TODO: Refactor, not everything in here is needed by #edit allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
def update_issue_from_params allowed ? true : deny_access
@allowed_statuses = @issue.new_statuses_allowed_to(User.current) rescue ActiveRecord::RecordNotFound
@priorities = IssuePriority.all render_404
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@time_entry = TimeEntry.new
@notes = params[:notes]
@issue.init_journal(User.current, @notes)
# User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
attrs = params[:issue].dup
attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed
attrs.delete(:status_id) unless @allowed_statuses.detect {|s| s.id.to_s == attrs[:status_id].to_s}
@issue.safe_attributes = attrs
end
end end
# TODO: Refactor, lots of extra code in here # Retrieve query from session or build a new query
def build_new_issue_from_params def retrieve_query
@issue = Issue.new if !params[:query_id].blank?
@issue.copy_from(params[:copy_from]) if params[:copy_from] cond = "project_id IS NULL"
@issue.project = @project cond << " OR project_id = #{@project.id}" if @project
# Tracker must be set before custom field values @query = Query.find(params[:query_id], :conditions => cond)
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) @query.project = @project
if @issue.tracker.nil? session[:query] = {:id => @query.id, :project_id => @query.project_id}
render_error l(:error_no_tracker_in_project) sort_clear
return false
end
if params[:issue].is_a?(Hash)
@issue.safe_attributes = params[:issue]
@issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
end
@issue.author = User.current
@issue.start_date ||= Date.today
@priorities = IssuePriority.all
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
end
def set_flash_from_bulk_issue_save(issues, unsaved_issue_ids)
if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless issues.empty?
else else
flash[:error] = l(:notice_failed_to_save_issues, if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
:count => unsaved_issue_ids.size, # Give it a name, required to be valid
:total => issues.size, @query = Query.new(:name => "_")
:ids => '#' + unsaved_issue_ids.join(', #')) @query.project = @project
if params[:fields] and params[:fields].is_a? Array
params[:fields].each do |field|
@query.add_filter(field, params[:operators][field], params[:values][field])
end
else
@query.available_filters.keys.each do |field|
@query.add_short_filter(field, params[field]) if params[field]
end
end
@query.group_by = params[:group_by]
@query.column_names = params[:query] && params[:query][:column_names]
session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
else
@query = Query.find_by_id(session[:query][:id]) if session[:query][:id]
@query ||= Query.new(:name => "_", :project => @project, :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
@query.project = @project
end
end end
end end
def check_for_default_issue_status # Rescues an invalid query statement. Just in case...
if IssueStatus.default.nil? def query_statement_invalid(exception)
render_error l(:error_no_default_issue_status) logger.error "Query::StatementInvalid: #{exception.message}" if logger
return false session.delete(:query)
end sort_clear
render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
end end
end end
@@ -1,25 +0,0 @@
# redMine - project management software
# Copyright (C) 2006 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class LdapAuthSourcesController < AuthSourcesController
protected
def auth_source_class
AuthSourceLdap
end
end
+21 -26
View File
@@ -16,9 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MembersController < ApplicationController class MembersController < ApplicationController
model_object Member before_filter :find_member, :except => [:new, :autocomplete_for_member]
before_filter :find_model_object, :except => [:new, :autocomplete_for_member]
before_filter :find_project_from_association, :except => [:new, :autocomplete_for_member]
before_filter :find_project, :only => [:new, :autocomplete_for_member] before_filter :find_project, :only => [:new, :autocomplete_for_member]
before_filter :authorize before_filter :authorize
@@ -36,30 +34,14 @@ class MembersController < ApplicationController
@project.members << members @project.members << members
end end
respond_to do |format| respond_to do |format|
if members.present? && members.all? {|m| m.valid? } format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
format.js {
format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } render(:update) {|page|
page.replace_html "tab-content-members", :partial => 'projects/settings/members'
format.js { page << 'hideOnLoad()'
render(:update) {|page| members.each {|member| page.visual_effect(:highlight, "member-#{member.id}") }
page.replace_html "tab-content-members", :partial => 'projects/settings/members'
page << 'hideOnLoad()'
members.each {|member| page.visual_effect(:highlight, "member-#{member.id}") }
}
} }
else }
format.js {
render(:update) {|page|
errors = members.collect {|m|
m.errors.full_messages
}.flatten.uniq
page.alert(l(:notice_failed_to_save_members, :errors => errors.join(', ')))
}
}
end
end end
end end
@@ -97,4 +79,17 @@ class MembersController < ApplicationController
render :layout => false render :layout => false
end end
private
def find_project
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
def find_member
@member = Member.find(params[:id])
@project = @member.project
rescue ActiveRecord::RecordNotFound
render_404
end
end end
+8 -25
View File
@@ -29,24 +29,10 @@ class MessagesController < ApplicationController
helper :attachments helper :attachments
include AttachmentsHelper include AttachmentsHelper
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
# Show a topic and its replies # Show a topic and its replies
def show def show
page = params[:page] @replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}])
# Find the page of the requested reply @replies.reverse! if User.current.wants_comments_in_reverse_order?
if params[:r] && page.nil?
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
page = 1 + offset / REPLIES_PER_PAGE
end
@reply_count = @topic.children.count
@reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}],
:order => "#{Message.table_name}.created_on ASC",
:limit => @reply_pages.items_per_page,
:offset => @reply_pages.current.offset)
@reply = Message.new(:subject => "RE: #{@message.subject}") @reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => false if request.xhr? render :action => "show", :layout => false if request.xhr?
end end
@@ -62,8 +48,7 @@ class MessagesController < ApplicationController
end end
if request.post? && @message.save if request.post? && @message.save
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
attachments = Attachment.attach_files(@message, params[:attachments]) attach_files(@message, params[:attachments])
render_attachment_warning_if_needed(@message)
redirect_to :action => 'show', :id => @message redirect_to :action => 'show', :id => @message
end end
end end
@@ -76,10 +61,9 @@ class MessagesController < ApplicationController
@topic.children << @reply @topic.children << @reply
if !@reply.new_record? if !@reply.new_record?
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments]) attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply)
end end
redirect_to :action => 'show', :id => @topic, :r => @reply redirect_to :action => 'show', :id => @topic
end end
# Edit a message # Edit a message
@@ -90,11 +74,10 @@ class MessagesController < ApplicationController
@message.sticky = params[:message]['sticky'] @message.sticky = params[:message]['sticky']
end end
if request.post? && @message.update_attributes(params[:message]) if request.post? && @message.update_attributes(params[:message])
attachments = Attachment.attach_files(@message, params[:attachments]) attach_files(@message, params[:attachments])
render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
@message.reload @message.reload
redirect_to :action => 'show', :board_id => @message.board, :id => @message.root, :r => (@message.parent_id && @message.id) redirect_to :action => 'show', :board_id => @message.board, :id => @message.root
end end
end end
@@ -104,7 +87,7 @@ class MessagesController < ApplicationController
@message.destroy @message.destroy
redirect_to @message.parent.nil? ? redirect_to @message.parent.nil? ?
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } : { :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
{ :action => 'show', :id => @message.parent, :r => @message } { :action => 'show', :id => @message.parent }
end end
def quote def quote
+1 -1
View File
@@ -77,7 +77,7 @@ class MyController < ApplicationController
# Manage user's password # Manage user's password
def password def password
@user = User.current @user = User.current
unless @user.change_password_allowed? if @user.auth_source_id
flash[:error] = l(:notice_can_t_change_password) flash[:error] = l(:notice_can_t_change_password)
redirect_to :action => 'account' redirect_to :action => 'account'
return return
+8 -3
View File
@@ -17,9 +17,7 @@
class NewsController < ApplicationController class NewsController < ApplicationController
default_search_scope :news default_search_scope :news
model_object News before_filter :find_news, :except => [:new, :index, :preview]
before_filter :find_model_object, :except => [:new, :index, :preview]
before_filter :find_project_from_association, :except => [:new, :index, :preview]
before_filter :find_project, :only => [:new, :preview] before_filter :find_project, :only => [:new, :preview]
before_filter :authorize, :except => [:index, :preview] before_filter :authorize, :except => [:index, :preview]
before_filter :find_optional_project, :only => :index before_filter :find_optional_project, :only => :index
@@ -90,6 +88,13 @@ class NewsController < ApplicationController
end end
private private
def find_news
@news = News.find(params[:id])
@project = @news.project
rescue ActiveRecord::RecordNotFound
render_404
end
def find_project def find_project
@project = Project.find(params[:project_id]) @project = Project.find(params[:project_id])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
+85 -57
View File
@@ -40,6 +40,7 @@ class ProjectsController < ApplicationController
helper :custom_fields helper :custom_fields
include CustomFieldsHelper include CustomFieldsHelper
helper :issues helper :issues
helper IssuesHelper
helper :queries helper :queries
include QueriesHelper include QueriesHelper
helper :repositories helper :repositories
@@ -52,9 +53,6 @@ class ProjectsController < ApplicationController
format.html { format.html {
@projects = Project.visible.find(:all, :order => 'lft') @projects = Project.visible.find(:all, :order => 'lft')
} }
format.xml {
@projects = Project.visible.find(:all, :order => 'lft')
}
format.atom { format.atom {
projects = Project.visible.find(:all, :order => 'created_on DESC', projects = Project.visible.find(:all, :order => 'created_on DESC',
:limit => Setting.feeds_limit.to_i) :limit => Setting.feeds_limit.to_i)
@@ -83,18 +81,8 @@ class ProjectsController < ApplicationController
m = Member.new(:user => User.current, :roles => [r]) m = Member.new(:user => User.current, :roles => [r])
@project.members << m @project.members << m
end end
respond_to do |format| flash[:notice] = l(:notice_successful_create)
format.html { redirect_to :controller => 'projects', :action => 'settings', :id => @project
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'projects', :action => 'settings', :id => @project
}
format.xml { head :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
else
respond_to do |format|
format.html
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
end
end end
end end
end end
@@ -161,11 +149,6 @@ class ProjectsController < ApplicationController
:conditions => cond).to_f :conditions => cond).to_f
end end
@key = User.current.rss_key @key = User.current.rss_key
respond_to do |format|
format.html
format.xml
end
end end
def settings def settings
@@ -179,33 +162,21 @@ class ProjectsController < ApplicationController
# Edit @project # Edit @project
def edit def edit
if request.get? if request.post?
else
@project.attributes = params[:project] @project.attributes = params[:project]
if validate_parent_id && @project.save if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
respond_to do |format| flash[:notice] = l(:notice_successful_update)
format.html { redirect_to :action => 'settings', :id => @project
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'settings', :id => @project
}
format.xml { head :ok }
end
else else
respond_to do |format| settings
format.html { render :action => 'settings'
settings
render :action => 'settings'
}
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
end
end end
end end
end end
def modules def modules
@project.enabled_module_names = params[:enabled_modules] @project.enabled_module_names = params[:enabled_modules]
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'settings', :id => @project, :tab => 'modules' redirect_to :action => 'settings', :id => @project, :tab => 'modules'
end end
@@ -226,29 +197,81 @@ class ProjectsController < ApplicationController
# Delete @project # Delete @project
def destroy def destroy
@project_to_destroy = @project @project_to_destroy = @project
if request.get? if request.post? and params[:confirm]
# display confirmation view @project_to_destroy.destroy
else redirect_to :controller => 'admin', :action => 'projects'
if params[:format] == 'xml' || params[:confirm]
@project_to_destroy.destroy
respond_to do |format|
format.html { redirect_to :controller => 'admin', :action => 'projects' }
format.xml { head :ok }
end
end
end end
# hide project in layout # hide project in layout
@project = nil @project = nil
end end
# Add a new issue category to @project
def add_issue_category
@category = @project.issue_categories.build(params[:category])
if request.post?
if @category.save
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'settings', :tab => 'categories', :id => @project
end
format.js do
# IE doesn't support the replace_html rjs method for select box options
render(:update) {|page| page.replace "issue_category_id",
content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]')
}
end
end
else
respond_to do |format|
format.html
format.js do
render(:update) {|page| page.alert(@category.errors.full_messages.join('\n')) }
end
end
end
end
end
# Add a new version to @project
def add_version
@version = @project.versions.build
if params[:version]
attributes = params[:version].dup
attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing'])
@version.attributes = attributes
end
if request.post?
if @version.save
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'settings', :tab => 'versions', :id => @project
end
format.js do
# IE doesn't support the replace_html rjs method for select box options
render(:update) {|page| page.replace "issue_fixed_version_id",
content_tag('select', '<option></option>' + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]')
}
end
end
else
respond_to do |format|
format.html
format.js do
render(:update) {|page| page.alert(@version.errors.full_messages.join('\n')) }
end
end
end
end
end
def add_file def add_file
if request.post? if request.post?
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = Attachment.attach_files(container, params[:attachments]) attachments = attach_files(container, params[:attachments])
render_attachment_warning_if_needed(container)
if !attachments.empty? && Setting.notified_events.include?('file_added') if !attachments.empty? && Setting.notified_events.include?('file_added')
Mailer.deliver_attachments_added(attachments[:files]) Mailer.deliver_attachments_added(attachments)
end end
redirect_to :controller => 'projects', :action => 'list_files', :id => @project redirect_to :controller => 'projects', :action => 'list_files', :id => @project
return return
@@ -263,7 +286,6 @@ class ProjectsController < ApplicationController
@project.update_or_create_time_entry_activity(id, activity) @project.update_or_create_time_entry_activity(id, activity)
end end
end end
flash[:notice] = l(:notice_successful_update)
end end
redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
@@ -273,7 +295,6 @@ class ProjectsController < ApplicationController
@project.time_entry_activities.each do |time_entry_activity| @project.time_entry_activities.each do |time_entry_activity|
time_entry_activity.destroy(time_entry_activity.parent) time_entry_activity.destroy(time_entry_activity.parent)
end end
flash[:notice] = l(:notice_successful_update)
redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
end end
@@ -295,9 +316,7 @@ class ProjectsController < ApplicationController
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id] project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id]
@versions = @project.shared_versions || [] @versions = @project.shared_versions.sort
@versions += @project.rolled_up_versions.visible if @with_subprojects
@versions = @versions.uniq.sort
@versions.reject! {|version| version.closed? || version.completed? } unless params[:completed] @versions.reject! {|version| version.closed? || version.completed? } unless params[:completed]
@issues_by_version = {} @issues_by_version = {}
@@ -310,7 +329,7 @@ class ProjectsController < ApplicationController
@issues_by_version[version] = issues @issues_by_version[version] = issues
end end
end end
@versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?} @versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].empty?}
end end
def activity def activity
@@ -356,6 +375,15 @@ class ProjectsController < ApplicationController
end end
private private
# Find project of id params[:id]
# if not found, redirect to project list
# Used as a before_filter
def find_project
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
def find_optional_project def find_optional_project
return true unless params[:id] return true unless params[:id]
@project = Project.find(params[:id]) @project = Project.find(params[:id])
+6 -2
View File
@@ -27,7 +27,9 @@ class QueriesController < ApplicationController
@query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin?
@query.column_names = nil if params[:default_columns] @query.column_names = nil if params[:default_columns]
@query.add_filters(params[:fields], params[:operators], params[:values]) if params[:fields] params[:fields].each do |field|
@query.add_filter(field, params[:operators][field], params[:values][field])
end if params[:fields]
@query.group_by ||= params[:group_by] @query.group_by ||= params[:group_by]
if request.post? && params[:confirm] && @query.save if request.post? && params[:confirm] && @query.save
@@ -41,7 +43,9 @@ class QueriesController < ApplicationController
def edit def edit
if request.post? if request.post?
@query.filters = {} @query.filters = {}
@query.add_filters(params[:fields], params[:operators], params[:values]) if params[:fields] params[:fields].each do |field|
@query.add_filter(field, params[:operators][field], params[:values][field])
end if params[:fields]
@query.attributes = params[:query] @query.attributes = params[:query]
@query.project = nil if params[:query_is_for_all] @query.project = nil if params[:query_is_for_all]
@query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin?
+144 -39
View File
@@ -17,79 +17,184 @@
class ReportsController < ApplicationController class ReportsController < ApplicationController
menu_item :issues menu_item :issues
before_filter :find_project, :authorize, :find_issue_statuses before_filter :find_project, :authorize
def issue_report def issue_report
@trackers = @project.trackers @statuses = IssueStatus.find(:all, :order => 'position')
@versions = @project.shared_versions.sort
@priorities = IssuePriority.all
@categories = @project.issue_categories
@assignees = @project.members.collect { |m| m.user }.sort
@authors = @project.members.collect { |m| m.user }.sort
@subprojects = @project.descendants.visible
@issues_by_tracker = Issue.by_tracker(@project)
@issues_by_version = Issue.by_version(@project)
@issues_by_priority = Issue.by_priority(@project)
@issues_by_category = Issue.by_category(@project)
@issues_by_assigned_to = Issue.by_assigned_to(@project)
@issues_by_author = Issue.by_author(@project)
@issues_by_subproject = Issue.by_subproject(@project) || []
render :template => "reports/issue_report"
end
def issue_report_details
case params[:detail] case params[:detail]
when "tracker" when "tracker"
@field = "tracker_id" @field = "tracker_id"
@rows = @project.trackers @rows = @project.trackers
@data = Issue.by_tracker(@project) @data = issues_by_tracker
@report_title = l(:field_tracker) @report_title = l(:field_tracker)
render :template => "reports/issue_report_details"
when "version" when "version"
@field = "fixed_version_id" @field = "fixed_version_id"
@rows = @project.shared_versions.sort @rows = @project.shared_versions.sort
@data = Issue.by_version(@project) @data = issues_by_version
@report_title = l(:field_version) @report_title = l(:field_version)
render :template => "reports/issue_report_details"
when "priority" when "priority"
@field = "priority_id" @field = "priority_id"
@rows = IssuePriority.all @rows = IssuePriority.all
@data = Issue.by_priority(@project) @data = issues_by_priority
@report_title = l(:field_priority) @report_title = l(:field_priority)
render :template => "reports/issue_report_details"
when "category" when "category"
@field = "category_id" @field = "category_id"
@rows = @project.issue_categories @rows = @project.issue_categories
@data = Issue.by_category(@project) @data = issues_by_category
@report_title = l(:field_category) @report_title = l(:field_category)
render :template => "reports/issue_report_details"
when "assigned_to" when "assigned_to"
@field = "assigned_to_id" @field = "assigned_to_id"
@rows = @project.members.collect { |m| m.user }.sort @rows = @project.members.collect { |m| m.user }.sort
@data = Issue.by_assigned_to(@project) @data = issues_by_assigned_to
@report_title = l(:field_assigned_to) @report_title = l(:field_assigned_to)
render :template => "reports/issue_report_details"
when "author" when "author"
@field = "author_id" @field = "author_id"
@rows = @project.members.collect { |m| m.user }.sort @rows = @project.members.collect { |m| m.user }.sort
@data = Issue.by_author(@project) @data = issues_by_author
@report_title = l(:field_author) @report_title = l(:field_author)
render :template => "reports/issue_report_details"
when "subproject" when "subproject"
@field = "project_id" @field = "project_id"
@rows = @project.descendants.visible @rows = @project.descendants.visible
@data = Issue.by_subproject(@project) || [] @data = issues_by_subproject
@report_title = l(:field_subproject) @report_title = l(:field_subproject)
render :template => "reports/issue_report_details"
else
@trackers = @project.trackers
@versions = @project.shared_versions.sort
@priorities = IssuePriority.all
@categories = @project.issue_categories
@assignees = @project.members.collect { |m| m.user }.sort
@authors = @project.members.collect { |m| m.user }.sort
@subprojects = @project.descendants.visible
issues_by_tracker
issues_by_version
issues_by_priority
issues_by_category
issues_by_assigned_to
issues_by_author
issues_by_subproject
render :template => "reports/issue_report"
end end
end
respond_to do |format|
if @field private
format.html {} # Find project of id params[:id]
else def find_project
format.html { redirect_to :action => 'issue_report', :id => @project } @project = Project.find(params[:id])
end rescue ActiveRecord::RecordNotFound
end render_404
end end
private def issues_by_tracker
@issues_by_tracker ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
t.id as tracker_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{Tracker.table_name} t
where
i.status_id=s.id
and i.tracker_id=t.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, t.id")
end
def find_issue_statuses def issues_by_version
@statuses = IssueStatus.find(:all, :order => 'position') @issues_by_version ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
v.id as fixed_version_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{Version.table_name} v
where
i.status_id=s.id
and i.fixed_version_id=v.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, v.id")
end
def issues_by_priority
@issues_by_priority ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
p.id as priority_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{IssuePriority.table_name} p
where
i.status_id=s.id
and i.priority_id=p.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, p.id")
end
def issues_by_category
@issues_by_category ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
c.id as category_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{IssueCategory.table_name} c
where
i.status_id=s.id
and i.category_id=c.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, c.id")
end
def issues_by_assigned_to
@issues_by_assigned_to ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
a.id as assigned_to_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{User.table_name} a
where
i.status_id=s.id
and i.assigned_to_id=a.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, a.id")
end
def issues_by_author
@issues_by_author ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
a.id as author_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{User.table_name} a
where
i.status_id=s.id
and i.author_id=a.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, a.id")
end
def issues_by_subproject
@issues_by_subproject ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
i.project_id as project_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s
where
i.status_id=s.id
and i.project_id IN (#{@project.descendants.active.collect{|p| p.id}.join(',')})
group by s.id, s.is_closed, i.project_id") if @project.descendants.active.any?
@issues_by_subproject ||= []
end end
end end
+7 -8
View File
@@ -24,7 +24,6 @@ class InvalidRevisionParam < Exception; end
class RepositoriesController < ApplicationController class RepositoriesController < ApplicationController
menu_item :repository menu_item :repository
menu_item :settings, :only => :edit
default_search_scope :changesets default_search_scope :changesets
before_filter :find_repository, :except => :edit before_filter :find_repository, :except => :edit
@@ -44,13 +43,7 @@ class RepositoriesController < ApplicationController
@repository.attributes = params[:repository] @repository.attributes = params[:repository]
@repository.save @repository.save
end end
render(:update) do |page| render(:update) {|page| page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'}
page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'
if @repository && !@project.repository
@project.reload #needed to reload association
page.replace_html "main-menu", render_main_menu(@project)
end
end
end end
def committers def committers
@@ -197,6 +190,12 @@ class RepositoriesController < ApplicationController
end end
private private
def find_project
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
def find_repository def find_repository
@project = Project.find(params[:id]) @project = Project.find(params[:id])
@repository = @project.repository @repository = @project.repository
+8 -3
View File
@@ -21,11 +21,16 @@ class RolesController < ApplicationController
before_filter :require_admin before_filter :require_admin
verify :method => :post, :only => [ :destroy, :move ], verify :method => :post, :only => [ :destroy, :move ],
:redirect_to => { :action => :index } :redirect_to => { :action => :list }
def index def index
list
render :action => 'list' unless request.xhr?
end
def list
@role_pages, @roles = paginate :roles, :per_page => 25, :order => 'builtin, position' @role_pages, @roles = paginate :roles, :per_page => 25, :order => 'builtin, position'
render :action => "index", :layout => false if request.xhr? render :action => "list", :layout => false if request.xhr?
end end
def new def new
@@ -57,7 +62,7 @@ class RolesController < ApplicationController
@role.destroy @role.destroy
redirect_to :action => 'index' redirect_to :action => 'index'
rescue rescue
flash[:error] = l(:error_can_not_remove_role) flash[:error] = 'This role is in use and can not be deleted.'
redirect_to :action => 'index' redirect_to :action => 'index'
end end
+6 -4
View File
@@ -43,12 +43,12 @@ class SearchController < ApplicationController
begin; offset = params[:offset].to_time if params[:offset]; rescue; end begin; offset = params[:offset].to_time if params[:offset]; rescue; end
# quick jump to an issue # quick jump to an issue
if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1.to_i) if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1)
redirect_to :controller => "issues", :action => "show", :id => $1 redirect_to :controller => "issues", :action => "show", :id => $1
return return
end end
@object_types = Redmine::Search.available_search_types.dup @object_types = %w(issues news documents changesets wiki_pages messages projects)
if projects_to_search.is_a? Project if projects_to_search.is_a? Project
# don't search projects # don't search projects
@object_types.delete('projects') @object_types.delete('projects')
@@ -67,14 +67,16 @@ class SearchController < ApplicationController
if !@tokens.empty? if !@tokens.empty?
# no more than 5 tokens to search for # no more than 5 tokens to search for
@tokens.slice! 5..-1 if @tokens.size > 5 @tokens.slice! 5..-1 if @tokens.size > 5
# strings used in sql like statement
like_tokens = @tokens.collect {|w| "%#{w.downcase}%"}
@results = [] @results = []
@results_by_type = Hash.new {|h,k| h[k] = 0} @results_by_type = Hash.new {|h,k| h[k] = 0}
limit = 10 limit = 10
@scope.each do |s| @scope.each do |s|
r, c = s.singularize.camelcase.constantize.search(@tokens, projects_to_search, r, c = s.singularize.camelcase.constantize.search(like_tokens, projects_to_search,
:all_words => @all_words, :all_words => @all_words,
:titles_only => @titles_only, :titles_only => @titles_only,
:limit => (limit+1), :limit => (limit+1),
+51 -60
View File
@@ -19,7 +19,6 @@ class TimelogController < ApplicationController
menu_item :issues menu_item :issues
before_filter :find_project, :authorize, :only => [:edit, :destroy] before_filter :find_project, :authorize, :only => [:edit, :destroy]
before_filter :find_optional_project, :only => [:report, :details] before_filter :find_optional_project, :only => [:report, :details]
before_filter :load_available_criterias, :only => [:report]
verify :method => :post, :only => :destroy, :redirect_to => { :action => :details } verify :method => :post, :only => :destroy, :redirect_to => { :action => :details }
@@ -31,6 +30,51 @@ class TimelogController < ApplicationController
include CustomFieldsHelper include CustomFieldsHelper
def report def report
@available_criterias = { 'project' => {:sql => "#{TimeEntry.table_name}.project_id",
:klass => Project,
:label => :label_project},
'version' => {:sql => "#{Issue.table_name}.fixed_version_id",
:klass => Version,
:label => :label_version},
'category' => {:sql => "#{Issue.table_name}.category_id",
:klass => IssueCategory,
:label => :field_category},
'member' => {:sql => "#{TimeEntry.table_name}.user_id",
:klass => User,
:label => :label_member},
'tracker' => {:sql => "#{Issue.table_name}.tracker_id",
:klass => Tracker,
:label => :label_tracker},
'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
:klass => TimeEntryActivity,
:label => :label_activity},
'issue' => {:sql => "#{TimeEntry.table_name}.issue_id",
:klass => Issue,
:label => :label_issue}
}
# Add list and boolean custom fields as available criterias
custom_fields = (@project.nil? ? IssueCustomField.for_all : @project.all_issue_custom_fields)
custom_fields.select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Issue' AND c.customized_id = #{Issue.table_name}.id)",
:format => cf.field_format,
:label => cf.name}
end if @project
# Add list and boolean time entry custom fields
TimeEntryCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'TimeEntry' AND c.customized_id = #{TimeEntry.table_name}.id)",
:format => cf.field_format,
:label => cf.name}
end
# Add list and boolean time entry activity custom fields
TimeEntryActivityCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Enumeration' AND c.customized_id = #{TimeEntry.table_name}.activity_id)",
:format => cf.field_format,
:label => cf.name}
end
@criterias = params[:criterias] || [] @criterias = params[:criterias] || []
@criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria} @criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria}
@criterias.uniq! @criterias.uniq!
@@ -50,7 +94,7 @@ class TimelogController < ApplicationController
elsif @issue.nil? elsif @issue.nil?
sql_condition = @project.project_condition(Setting.display_subprojects_issues?) sql_condition = @project.project_condition(Setting.display_subprojects_issues?)
else else
sql_condition = "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" sql_condition = "#{TimeEntry.table_name}.issue_id = #{@issue.id}"
end end
sql = "SELECT #{sql_select}, tyear, tmonth, tweek, spent_on, SUM(hours) AS hours" sql = "SELECT #{sql_select}, tyear, tmonth, tweek, spent_on, SUM(hours) AS hours"
@@ -122,7 +166,7 @@ class TimelogController < ApplicationController
elsif @issue.nil? elsif @issue.nil?
cond << @project.project_condition(Setting.display_subprojects_issues?) cond << @project.project_condition(Setting.display_subprojects_issues?)
else else
cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" cond << ["#{TimeEntry.table_name}.issue_id = ?", @issue.id]
end end
retrieve_date_range retrieve_date_range
@@ -132,7 +176,7 @@ class TimelogController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { format.html {
# Paginate results # Paginate results
@entry_count = TimeEntry.count(:include => [:project, :issue], :conditions => cond.conditions) @entry_count = TimeEntry.count(:include => :project, :conditions => cond.conditions)
@entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
@entries = TimeEntry.find(:all, @entries = TimeEntry.find(:all,
:include => [:project, :activity, :user, {:issue => :tracker}], :include => [:project, :activity, :user, {:issue => :tracker}],
@@ -140,7 +184,7 @@ class TimelogController < ApplicationController
:order => sort_clause, :order => sort_clause,
:limit => @entry_pages.items_per_page, :limit => @entry_pages.items_per_page,
:offset => @entry_pages.current.offset) :offset => @entry_pages.current.offset)
@total_hours = TimeEntry.sum(:hours, :include => [:project, :issue], :conditions => cond.conditions).to_f @total_hours = TimeEntry.sum(:hours, :include => :project, :conditions => cond.conditions).to_f
render :layout => !request.xhr? render :layout => !request.xhr?
} }
@@ -181,11 +225,8 @@ class TimelogController < ApplicationController
def destroy def destroy
(render_404; return) unless @time_entry (render_404; return) unless @time_entry
(render_403; return) unless @time_entry.editable_by?(User.current) (render_403; return) unless @time_entry.editable_by?(User.current)
if @time_entry.destroy && @time_entry.destroyed? @time_entry.destroy
flash[:notice] = l(:notice_successful_delete) flash[:notice] = l(:notice_successful_delete)
else
flash[:error] = l(:notice_unable_delete_time_entry)
end
redirect_to :back redirect_to :back
rescue ::ActionController::RedirectBackError rescue ::ActionController::RedirectBackError
redirect_to :action => 'details', :project_id => @time_entry.project redirect_to :action => 'details', :project_id => @time_entry.project
@@ -264,54 +305,4 @@ private
@from ||= (TimeEntry.minimum(:spent_on, :include => :project, :conditions => Project.allowed_to_condition(User.current, :view_time_entries)) || Date.today) - 1 @from ||= (TimeEntry.minimum(:spent_on, :include => :project, :conditions => Project.allowed_to_condition(User.current, :view_time_entries)) || Date.today) - 1
@to ||= (TimeEntry.maximum(:spent_on, :include => :project, :conditions => Project.allowed_to_condition(User.current, :view_time_entries)) || Date.today) @to ||= (TimeEntry.maximum(:spent_on, :include => :project, :conditions => Project.allowed_to_condition(User.current, :view_time_entries)) || Date.today)
end end
def load_available_criterias
@available_criterias = { 'project' => {:sql => "#{TimeEntry.table_name}.project_id",
:klass => Project,
:label => :label_project},
'version' => {:sql => "#{Issue.table_name}.fixed_version_id",
:klass => Version,
:label => :label_version},
'category' => {:sql => "#{Issue.table_name}.category_id",
:klass => IssueCategory,
:label => :field_category},
'member' => {:sql => "#{TimeEntry.table_name}.user_id",
:klass => User,
:label => :label_member},
'tracker' => {:sql => "#{Issue.table_name}.tracker_id",
:klass => Tracker,
:label => :label_tracker},
'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
:klass => TimeEntryActivity,
:label => :label_activity},
'issue' => {:sql => "#{TimeEntry.table_name}.issue_id",
:klass => Issue,
:label => :label_issue}
}
# Add list and boolean custom fields as available criterias
custom_fields = (@project.nil? ? IssueCustomField.for_all : @project.all_issue_custom_fields)
custom_fields.select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Issue' AND c.customized_id = #{Issue.table_name}.id)",
:format => cf.field_format,
:label => cf.name}
end if @project
# Add list and boolean time entry custom fields
TimeEntryCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'TimeEntry' AND c.customized_id = #{TimeEntry.table_name}.id)",
:format => cf.field_format,
:label => cf.name}
end
# Add list and boolean time entry activity custom fields
TimeEntryActivityCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Enumeration' AND c.customized_id = #{TimeEntry.table_name}.activity_id)",
:format => cf.field_format,
:label => cf.name}
end
call_hook(:controller_timelog_available_criterias, { :available_criterias => @available_criterias, :project => @project })
@available_criterias
end
end end
+12 -7
View File
@@ -20,11 +20,16 @@ class TrackersController < ApplicationController
before_filter :require_admin before_filter :require_admin
verify :method => :post, :only => :destroy, :redirect_to => { :action => :index }
def index def index
list
render :action => 'list' unless request.xhr?
end
verify :method => :post, :only => :destroy, :redirect_to => { :action => :list }
def list
@tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position' @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'
render :action => "index", :layout => false if request.xhr? render :action => "list", :layout => false if request.xhr?
end end
def new def new
@@ -35,7 +40,7 @@ class TrackersController < ApplicationController
@tracker.workflows.copy(copy_from) @tracker.workflows.copy(copy_from)
end end
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'index' redirect_to :action => 'list'
return return
end end
@trackers = Tracker.find :all, :order => 'position' @trackers = Tracker.find :all, :order => 'position'
@@ -46,7 +51,7 @@ class TrackersController < ApplicationController
@tracker = Tracker.find(params[:id]) @tracker = Tracker.find(params[:id])
if request.post? and @tracker.update_attributes(params[:tracker]) if request.post? and @tracker.update_attributes(params[:tracker])
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'index' redirect_to :action => 'list'
return return
end end
@projects = Project.find(:all) @projects = Project.find(:all)
@@ -55,10 +60,10 @@ class TrackersController < ApplicationController
def destroy def destroy
@tracker = Tracker.find(params[:id]) @tracker = Tracker.find(params[:id])
unless @tracker.issues.empty? unless @tracker.issues.empty?
flash[:error] = l(:error_can_not_delete_tracker) flash[:error] = "This tracker contains issues and can\'t be deleted."
else else
@tracker.destroy @tracker.destroy
end end
redirect_to :action => 'index' redirect_to :action => 'list'
end end
end end
+6 -7
View File
@@ -50,7 +50,7 @@ class UsersController < ApplicationController
end end
def show def show
@user = User.find(params[:id]) @user = User.active.find(params[:id])
@custom_values = @user.custom_values @custom_values = @user.custom_values
# show only public projects and private projects that the logged in user is also a member of # show only public projects and private projects that the logged in user is also a member of
@@ -61,11 +61,9 @@ class UsersController < ApplicationController
events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10) events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
@events_by_day = events.group_by(&:event_date) @events_by_day = events.group_by(&:event_date)
unless User.current.admin? if @user != User.current && !User.current.admin? && @memberships.empty? && events.empty?
if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?) render_404
render_404 return
return
end
end end
render :layout => 'base' render :layout => 'base'
@@ -120,7 +118,8 @@ class UsersController < ApplicationController
def edit_membership def edit_membership
@user = User.find(params[:id]) @user = User.find(params[:id])
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user) @membership = params[:membership_id] ? Member.find(params[:membership_id]) : Member.new(:principal => @user)
@membership.attributes = params[:membership]
@membership.save if request.post? @membership.save if request.post?
respond_to do |format| respond_to do |format|
format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
+12 -36
View File
@@ -17,48 +17,17 @@
class VersionsController < ApplicationController class VersionsController < ApplicationController
menu_item :roadmap menu_item :roadmap
model_object Version before_filter :find_version, :except => :close_completed
before_filter :find_model_object, :except => [:new, :close_completed] before_filter :find_project, :only => :close_completed
before_filter :find_project_from_association, :except => [:new, :close_completed]
before_filter :find_project, :only => [:new, :close_completed]
before_filter :authorize before_filter :authorize
helper :custom_fields helper :custom_fields
helper :projects helper :projects
def show def show
end @issues = @version.fixed_issues.visible.find(:all,
:include => [:status, :tracker, :priority],
def new :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id")
@version = @project.versions.build
if params[:version]
attributes = params[:version].dup
attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing'])
@version.attributes = attributes
end
if request.post?
if @version.save
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
end
format.js do
# IE doesn't support the replace_html rjs method for select box options
render(:update) {|page| page.replace "issue_fixed_version_id",
content_tag('select', '<option></option>' + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]')
}
end
end
else
respond_to do |format|
format.html
format.js do
render(:update) {|page| page.alert(@version.errors.full_messages.join('\n')) }
end
end
end
end
end end
def edit def edit
@@ -97,6 +66,13 @@ class VersionsController < ApplicationController
end end
private private
def find_version
@version = Version.find(params[:id])
@project = @version.project
rescue ActiveRecord::RecordNotFound
render_404
end
def find_project def find_project
@project = Project.find(params[:project_id]) @project = Project.find(params[:project_id])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
+1 -1
View File
@@ -83,7 +83,7 @@ private
replace_ids = [params[:replace]] replace_ids = [params[:replace]]
end end
else else
replace_ids = ['watcher'] replace_ids = 'watcher'
end end
respond_to do |format| respond_to do |format|
format.html { redirect_to :back } format.html { redirect_to :back }
+13 -24
View File
@@ -33,7 +33,7 @@ class WikiController < ApplicationController
page_title = params[:page] page_title = params[:page]
@page = @wiki.find_or_new_page(page_title) @page = @wiki.find_or_new_page(page_title)
if @page.new_record? if @page.new_record?
if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? if User.current.allowed_to?(:edit_wiki_pages, @project)
edit edit
render :action => 'edit' render :action => 'edit'
else else
@@ -47,17 +47,15 @@ class WikiController < ApplicationController
return return
end end
@content = @page.content_for_version(params[:version]) @content = @page.content_for_version(params[:version])
if User.current.allowed_to?(:export_wiki_pages, @project) if params[:format] == 'html'
if params[:format] == 'html' export = render_to_string :action => 'export', :layout => false
export = render_to_string :action => 'export', :layout => false send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html") return
return elsif params[:format] == 'txt'
elsif params[:format] == 'txt' send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt") return
return
end
end end
@editable = editable? @editable = editable?
render :action => 'show' render :action => 'show'
end end
@@ -76,8 +74,6 @@ class WikiController < ApplicationController
@content.version = @page.content.version @content.version = @page.content.version
else else
if !@page.new_record? && @content.text == params[:content][:text] if !@page.new_record? && @content.text == params[:content][:text]
attachments = Attachment.attach_files(@page, params[:attachments])
render_attachment_warning_if_needed(@page)
# don't save if text wasn't changed # don't save if text wasn't changed
redirect_to :action => 'index', :id => @project, :page => @page.title redirect_to :action => 'index', :id => @project, :page => @page.title
return return
@@ -88,8 +84,6 @@ class WikiController < ApplicationController
@content.author = User.current @content.author = User.current
# if page is new @page.save will also save content, but not if page isn't a new record # if page is new @page.save will also save content, but not if page isn't a new record
if (@page.new_record? ? @page.save : @content.save) if (@page.new_record? ? @page.save : @content.save)
attachments = Attachment.attach_files(@page, params[:attachments])
render_attachment_warning_if_needed(@page)
call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page}) call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
redirect_to :action => 'index', :id => @project, :page => @page.title redirect_to :action => 'index', :id => @project, :page => @page.title
end end
@@ -183,13 +177,9 @@ class WikiController < ApplicationController
@pages_by_parent_id = @pages.group_by(&:parent_id) @pages_by_parent_id = @pages.group_by(&:parent_id)
# export wiki to a single html file # export wiki to a single html file
when 'export' when 'export'
if User.current.allowed_to?(:export_wiki_pages, @project) @pages = @wiki.pages.find :all, :order => 'title'
@pages = @wiki.pages.find :all, :order => 'title' export = render_to_string :action => 'export_multiple', :layout => false
export = render_to_string :action => 'export_multiple', :layout => false send_data(export, :type => 'text/html', :filename => "wiki.html")
send_data(export, :type => 'text/html', :filename => "wiki.html")
else
redirect_to :action => 'index', :id => @project, :page => nil
end
return return
else else
# requested special page doesn't exist, redirect to default page # requested special page doesn't exist, redirect to default page
@@ -213,8 +203,7 @@ class WikiController < ApplicationController
def add_attachment def add_attachment
return render_403 unless editable? return render_403 unless editable?
attachments = Attachment.attach_files(@page, params[:attachments]) attach_files(@page, params[:attachments])
render_attachment_warning_if_needed(@page)
redirect_to :action => 'index', :page => @page.title redirect_to :action => 'index', :page => @page.title
end end
+7
View File
@@ -34,4 +34,11 @@ class WikisController < ApplicationController
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki' redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki'
end end
end end
private
def find_project
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
end end
+5 -13
View File
@@ -19,9 +19,7 @@ class WorkflowsController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin before_filter :require_admin
before_filter :find_roles
before_filter :find_trackers
def index def index
@workflow_counts = Workflow.count_by_tracker_and_role @workflow_counts = Workflow.count_by_tracker_and_role
end end
@@ -42,6 +40,8 @@ class WorkflowsController < ApplicationController
redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker
end end
end end
@roles = Role.find(:all, :order => 'builtin, position')
@trackers = Tracker.find(:all, :order => 'position')
@used_statuses_only = (params[:used_statuses_only] == '0' ? false : true) @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
if @tracker && @used_statuses_only && @tracker.issue_statuses.any? if @tracker && @used_statuses_only && @tracker.issue_statuses.any?
@@ -51,6 +51,8 @@ class WorkflowsController < ApplicationController
end end
def copy def copy
@trackers = Tracker.find(:all, :order => 'position')
@roles = Role.find(:all, :order => 'builtin, position')
if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any' if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any'
@source_tracker = nil @source_tracker = nil
@@ -78,14 +80,4 @@ class WorkflowsController < ApplicationController
end end
end end
end end
private
def find_roles
@roles = Role.find(:all, :order => 'builtin, position')
end
def find_trackers
@trackers = Tracker.find(:all, :order => 'position')
end
end end
+80 -152
View File
@@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'coderay'
require 'coderay/helpers/file_type'
require 'forwardable' require 'forwardable'
require 'cgi' require 'cgi'
@@ -203,12 +205,7 @@ module ApplicationHelper
s = '' s = ''
project_tree(projects) do |project, level| project_tree(projects) do |project, level|
name_prefix = (level > 0 ? ('&nbsp;' * 2 * level + '&#187; ') : '') name_prefix = (level > 0 ? ('&nbsp;' * 2 * level + '&#187; ') : '')
tag_options = {:value => project.id} tag_options = {:value => project.id, :selected => ((project == options[:selected]) ? 'selected' : nil)}
if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
tag_options[:selected] = 'selected'
else
tag_options[:selected] = nil
end
tag_options.merge!(yield(project)) if block_given? tag_options.merge!(yield(project)) if block_given?
s << content_tag('option', name_prefix + h(project), tag_options) s << content_tag('option', name_prefix + h(project), tag_options)
end end
@@ -263,16 +260,6 @@ module ApplicationHelper
def truncate_single_line(string, *args) def truncate_single_line(string, *args)
truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ') truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ')
end end
# Truncates at line break after 250 characters or options[:length]
def truncate_lines(string, options={})
length = options[:length] || 250
if string.to_s =~ /\A(.{#{length}}.*?)$/m
"#{$1}..."
else
string
end
end
def html_hours(text) def html_hours(text)
text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
@@ -292,7 +279,8 @@ module ApplicationHelper
end end
def syntax_highlight(name, content) def syntax_highlight(name, content)
Redmine::SyntaxHighlighting.highlight_by_filename(content, name) type = CodeRay::FileType[name]
type ? CodeRay.scan(content, type).html : h(content)
end end
def to_path_param(path) def to_path_param(path)
@@ -301,7 +289,6 @@ module ApplicationHelper
def pagination_links_full(paginator, count=nil, options={}) def pagination_links_full(paginator, count=nil, options={})
page_param = options.delete(:page_param) || :page page_param = options.delete(:page_param) || :page
per_page_links = options.delete(:per_page_links)
url_param = params.dup url_param = params.dup
# don't reuse query params if filters are present # don't reuse query params if filters are present
url_param.merge!(:fields => nil, :values => nil, :operators => nil) if url_param.delete(:set_filter) url_param.merge!(:fields => nil, :values => nil, :operators => nil) if url_param.delete(:set_filter)
@@ -320,10 +307,10 @@ module ApplicationHelper
end end
unless count.nil? unless count.nil?
html << " (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})" html << [
if per_page_links != false && links = per_page_links(paginator.items_per_page) " (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})",
html << " | #{links}" per_page_links(paginator.items_per_page)
end ].compact.join(' | ')
end end
html html
@@ -409,87 +396,61 @@ module ApplicationHelper
text = args.shift text = args.shift
when 2 when 2
obj = args.shift obj = args.shift
attr = args.shift text = obj.send(args.shift).to_s
text = obj.send(attr).to_s
else else
raise ArgumentError, 'invalid arguments to textilizable' raise ArgumentError, 'invalid arguments to textilizable'
end end
return '' if text.blank? return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
only_path = options.delete(:only_path) == false ? false : true only_path = options.delete(:only_path) == false ? false : true
text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) }
parse_non_pre_blocks(text) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, obj, attr, only_path, options
end
end
end
def parse_non_pre_blocks(text)
s = StringScanner.new(text)
tags = []
parsed = ''
while !s.eos?
s.scan(/(.*?)(<(\/)?(pre|code)(.*?)>|\z)/im)
text, full_tag, closing, tag = s[1], s[2], s[3], s[4]
if tags.empty?
yield text
end
parsed << text
if tag
if closing
if tags.last == tag.downcase
tags.pop
end
else
tags << tag.downcase
end
parsed << full_tag
end
end
# Close any non closing tags
while tag = tags.pop
parsed << "</#{tag}>"
end
parsed
end
def parse_inline_attachments(text, project, obj, attr, only_path, options)
# when using an image link, try to use an attachment, if possible # when using an image link, try to use an attachment, if possible
if options[:attachments] || (obj && obj.respond_to?(:attachments)) attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)
attachments = nil
text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| if attachments
filename, ext, alt, alttext = $1.downcase, $2, $3, $4 attachments = attachments.sort_by(&:created_on).reverse
attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m|
style = $1
filename = $6.downcase
# search for the picture in attachments # search for the picture in attachments
if found = attachments.detect { |att| att.filename.downcase == filename } if found = attachments.detect { |att| att.filename.downcase == filename }
image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
desc = found.description.to_s.gsub('"', '') desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1")
if !desc.blank? && alttext.blank? alt = desc.blank? ? nil : "(#{desc})"
alt = " title=\"#{desc}\" alt=\"#{desc}\"" "!#{style}#{image_url}#{alt}!"
end
"src=\"#{image_url}\"#{alt}"
else else
m m
end end
end end
end end
end
# Wiki links text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text) { |macro, args| exec_macro(macro, obj, args) }
#
# Examples: # different methods for formatting wiki links
# [[mypage]] case options[:wiki_links]
# [[mypage|mytext]] when :local
# wiki links can refer other project wikis, using project name or identifier: # used for local links to html files
# [[project:]] -> wiki starting page format_wiki_link = Proc.new {|project, title, anchor| "#{title}.html" }
# [[project:|mytext]] when :anchor
# [[project:mypage]] # used for single-file wiki export
# [[project:mypage|mytext]] format_wiki_link = Proc.new {|project, title, anchor| "##{title}" }
def parse_wiki_links(text, project, obj, attr, only_path, options) else
text.gsub!(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m| format_wiki_link = Proc.new {|project, title, anchor| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor) }
end
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
# Wiki links
#
# Examples:
# [[mypage]]
# [[mypage|mytext]]
# wiki links can refer other project wikis, using project name or identifier:
# [[project:]] -> wiki starting page
# [[project:|mytext]]
# [[project:mypage]]
# [[project:mypage|mytext]]
text = text.gsub(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m|
link_project = project link_project = project
esc, all, page, title = $1, $2, $3, $5 esc, all, page, title = $1, $2, $3, $5
if esc.nil? if esc.nil?
@@ -507,13 +468,8 @@ module ApplicationHelper
end end
# check if page exists # check if page exists
wiki_page = link_project.wiki.find_page(page) wiki_page = link_project.wiki.find_page(page)
url = case options[:wiki_links] link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor),
when :local; "#{title}.html" :class => ('wiki-page' + (wiki_page ? '' : ' new')))
when :anchor; "##{title}" # used for single-file wiki export
else
url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => link_project, :page => Wiki.titleize(page), :anchor => anchor)
end
link_to((title || page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
else else
# project or wiki doesn't exist # project or wiki doesn't exist
all all
@@ -522,36 +478,34 @@ module ApplicationHelper
all all
end end
end end
end
# Redmine links
# Redmine links #
# # Examples:
# Examples: # Issues:
# Issues: # #52 -> Link to issue #52
# #52 -> Link to issue #52 # Changesets:
# Changesets: # r52 -> Link to revision 52
# r52 -> Link to revision 52 # commit:a85130f -> Link to scmid starting with a85130f
# commit:a85130f -> Link to scmid starting with a85130f # Documents:
# Documents: # document#17 -> Link to document with id 17
# document#17 -> Link to document with id 17 # document:Greetings -> Link to the document with title "Greetings"
# document:Greetings -> Link to the document with title "Greetings" # document:"Some document" -> Link to the document with title "Some document"
# document:"Some document" -> Link to the document with title "Some document" # Versions:
# Versions: # version#3 -> Link to version with id 3
# version#3 -> Link to version with id 3 # version:1.0.0 -> Link to version named "1.0.0"
# version:1.0.0 -> Link to version named "1.0.0" # version:"1.0 beta 2" -> Link to version named "1.0 beta 2"
# version:"1.0 beta 2" -> Link to version named "1.0 beta 2" # Attachments:
# Attachments: # attachment:file.zip -> Link to the attachment of the current object named file.zip
# attachment:file.zip -> Link to the attachment of the current object named file.zip # Source files:
# Source files: # source:some/file -> Link to the file located at /some/file in the project's repository
# source:some/file -> Link to the file located at /some/file in the project's repository # source:some/file@52 -> Link to the file's revision 52
# source:some/file@52 -> Link to the file's revision 52 # source:some/file#L120 -> Link to line 120 of the file
# source:some/file#L120 -> Link to line 120 of the file # source:some/file@52#L120 -> Link to line 120 of the file's revision 52
# source:some/file@52#L120 -> Link to line 120 of the file's revision 52 # export:some/file -> Force the download of the file
# export:some/file -> Force the download of the file # Forum messages:
# Forum messages: # message#1218 -> Link to message with id 1218
# message#1218 -> Link to message with id 1218 text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
def parse_redmine_links(text, project, obj, attr, only_path, options)
text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)}) do |m|
leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8 leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8
link = nil link = nil
if esc.nil? if esc.nil?
@@ -590,11 +544,6 @@ module ApplicationHelper
:anchor => (message.parent ? "message-#{message.id}" : nil)}, :anchor => (message.parent ? "message-#{message.id}" : nil)},
:class => 'message' :class => 'message'
end end
when 'project'
if p = Project.visible.find_by_id(oid)
link = link_to h(p.name), {:only_path => only_path, :controller => 'projects', :action => 'show', :id => p},
:class => 'project'
end
end end
elsif sep == ':' elsif sep == ':'
# removes the double quotes if any # removes the double quotes if any
@@ -628,21 +577,17 @@ module ApplicationHelper
:class => (prefix == 'export' ? 'source download' : 'source') :class => (prefix == 'export' ? 'source download' : 'source')
end end
when 'attachment' when 'attachment'
attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)
if attachments && attachment = attachments.detect {|a| a.filename == name } if attachments && attachment = attachments.detect {|a| a.filename == name }
link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment}, link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment},
:class => 'attachment' :class => 'attachment'
end end
when 'project'
if p = Project.visible.find(:first, :conditions => ["identifier = :s OR LOWER(name) = :s", {:s => name.downcase}])
link = link_to h(p.name), {:only_path => only_path, :controller => 'projects', :action => 'show', :id => p},
:class => 'project'
end
end end
end end
end end
leading + (link || "#{prefix}#{sep}#{identifier}") leading + (link || "#{prefix}#{sep}#{identifier}")
end end
text
end end
# Same as Rails' simple_format helper without using paragraphs # Same as Rails' simple_format helper without using paragraphs
@@ -696,23 +641,6 @@ module ApplicationHelper
), :class => 'progress', :style => "width: #{width};") + ), :class => 'progress', :style => "width: #{width};") +
content_tag('p', legend, :class => 'pourcent') content_tag('p', legend, :class => 'pourcent')
end end
def checked_image(checked=true)
if checked
image_tag 'toggle_check.png'
end
end
def context_menu(url)
unless @context_menu_included
content_for :header_tags do
javascript_include_tag('context_menu') +
stylesheet_link_tag('context_menu')
end
@context_menu_included = true
end
javascript_tag "new ContextMenu('#{ url_for(url) }')"
end
def context_menu_link(name, url, options={}) def context_menu_link(name, url, options={})
options[:class] ||= '' options[:class] ||= ''
+16 -10
View File
@@ -35,9 +35,8 @@ module CustomFieldsHelper
custom_field = custom_value.custom_field custom_field = custom_value.custom_field
field_name = "#{name}[custom_field_values][#{custom_field.id}]" field_name = "#{name}[custom_field_values][#{custom_field.id}]"
field_id = "#{name}_custom_field_values_#{custom_field.id}" field_id = "#{name}_custom_field_values_#{custom_field.id}"
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) case custom_field.field_format
case field_format.edit_as
when "date" when "date"
text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) +
calendar_for(field_id) calendar_for(field_id)
@@ -68,11 +67,10 @@ module CustomFieldsHelper
custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value)
end end
def custom_field_tag_for_bulk_edit(name, custom_field) def custom_field_tag_for_bulk_edit(custom_field)
field_name = "#{name}[custom_field_values][#{custom_field.id}]" field_name = "custom_field_values[#{custom_field.id}]"
field_id = "#{name}_custom_field_values_#{custom_field.id}" field_id = "custom_field_values_#{custom_field.id}"
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) case custom_field.field_format
case field_format.edit_as
when "date" when "date"
text_field_tag(field_name, '', :id => field_id, :size => 10) + text_field_tag(field_name, '', :id => field_id, :size => 10) +
calendar_for(field_id) calendar_for(field_id)
@@ -97,11 +95,19 @@ module CustomFieldsHelper
# Return a string used to display a custom value # Return a string used to display a custom value
def format_value(value, field_format) def format_value(value, field_format)
Redmine::CustomFieldFormat.format_value(value, field_format) # Proxy return "" unless value && !value.empty?
case field_format
when "date"
begin; format_date(value.to_date); rescue; value end
when "bool"
l(value == "1" ? :general_text_Yes : :general_text_No)
else
value
end
end end
# Return an array of custom field formats which can be used in select_tag # Return an array of custom field formats which can be used in select_tag
def custom_field_formats_for_select def custom_field_formats_for_select
Redmine::CustomFieldFormat.as_select CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] }
end end
end end
+25 -88
View File
@@ -18,17 +18,6 @@
module IssuesHelper module IssuesHelper
include ApplicationHelper include ApplicationHelper
def issue_list(issues, &block)
ancestors = []
issues.each do |issue|
while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
ancestors.pop
end
yield issue, ancestors.size
ancestors << issue unless issue.leaf?
end
end
def render_issue_tooltip(issue) def render_issue_tooltip(issue)
@cached_label_start_date ||= l(:field_start_date) @cached_label_start_date ||= l(:field_start_date)
@cached_label_due_date ||= l(:field_due_date) @cached_label_due_date ||= l(:field_due_date)
@@ -41,31 +30,6 @@ module IssuesHelper
"<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" + "<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" +
"<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}" "<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
end end
def render_issue_subject_with_tree(issue)
s = ''
issue.ancestors.each do |ancestor|
s << '<div>' + content_tag('p', link_to_issue(ancestor))
end
s << '<div>' + content_tag('h3', h(issue.subject))
s << '</div>' * (issue.ancestors.size + 1)
s
end
def render_descendants_tree(issue)
s = '<form><table class="list issues">'
issue_list(issue.descendants.sort_by(&:lft)) do |child, level|
s << content_tag('tr',
content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject') +
content_tag('td', h(child.status)) +
content_tag('td', link_to_user(child.assigned_to)) +
content_tag('td', progress_bar(child.done_ratio, :width => '80px')),
:class => "issue issue-#{child.id} hascontextmenu #{level > 0 ? "idnt idnt-#{level}" : nil}")
end
s << '</form></table>'
s
end
def render_custom_fields_rows(issue) def render_custom_fields_rows(issue)
return if issue.custom_field_values.empty? return if issue.custom_field_values.empty?
@@ -103,25 +67,35 @@ module IssuesHelper
def show_detail(detail, no_html=false) def show_detail(detail, no_html=false)
case detail.property case detail.property
when 'attr' when 'attr'
field = detail.prop_key.to_s.gsub(/\_id$/, "") label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
label = l(("field_" + field).to_sym) case detail.prop_key
case when 'due_date', 'start_date'
when ['due_date', 'start_date'].include?(detail.prop_key)
value = format_date(detail.value.to_date) if detail.value value = format_date(detail.value.to_date) if detail.value
old_value = format_date(detail.old_value.to_date) if detail.old_value old_value = format_date(detail.old_value.to_date) if detail.old_value
when 'project_id'
when ['project_id', 'status_id', 'tracker_id', 'assigned_to_id', 'priority_id', 'category_id', 'fixed_version_id'].include?(detail.prop_key) p = Project.find_by_id(detail.value) and value = p.name if detail.value
value = find_name_by_reflection(field, detail.value) p = Project.find_by_id(detail.old_value) and old_value = p.name if detail.old_value
old_value = find_name_by_reflection(field, detail.old_value) when 'status_id'
s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value
when detail.prop_key == 'estimated_hours' s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value
when 'tracker_id'
t = Tracker.find_by_id(detail.value) and value = t.name if detail.value
t = Tracker.find_by_id(detail.old_value) and old_value = t.name if detail.old_value
when 'assigned_to_id'
u = User.find_by_id(detail.value) and value = u.name if detail.value
u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value
when 'priority_id'
e = IssuePriority.find_by_id(detail.value) and value = e.name if detail.value
e = IssuePriority.find_by_id(detail.old_value) and old_value = e.name if detail.old_value
when 'category_id'
c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
when 'fixed_version_id'
v = Version.find_by_id(detail.value) and value = v.name if detail.value
v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
when 'estimated_hours'
value = "%0.02f" % detail.value.to_f unless detail.value.blank? value = "%0.02f" % detail.value.to_f unless detail.value.blank?
old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank? old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank?
when detail.prop_key == 'parent_id'
label = l(:field_parent_issue)
value = "##{detail.value}" unless detail.value.blank?
old_value = "##{detail.old_value}" unless detail.old_value.blank?
end end
when 'cf' when 'cf'
custom_field = CustomField.find_by_id(detail.prop_key) custom_field = CustomField.find_by_id(detail.prop_key)
@@ -166,15 +140,6 @@ module IssuesHelper
l(:text_journal_deleted, :label => label, :old => old_value) l(:text_journal_deleted, :label => label, :old => old_value)
end end
end end
# Find the name of an associated record stored in the field attribute
def find_name_by_reflection(field, id)
association = Issue.reflect_on_association(field.to_sym)
if association
record = association.class_name.constantize.find_by_id(id)
return record.name if record
end
end
def issues_to_csv(issues, project = nil) def issues_to_csv(issues, project = nil)
ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
@@ -195,7 +160,6 @@ module IssuesHelper
l(:field_due_date), l(:field_due_date),
l(:field_done_ratio), l(:field_done_ratio),
l(:field_estimated_hours), l(:field_estimated_hours),
l(:field_parent_issue),
l(:field_created_on), l(:field_created_on),
l(:field_updated_on) l(:field_updated_on)
] ]
@@ -222,7 +186,6 @@ module IssuesHelper
format_date(issue.due_date), format_date(issue.due_date),
issue.done_ratio, issue.done_ratio,
issue.estimated_hours.to_s.gsub('.', decimal_separator), issue.estimated_hours.to_s.gsub('.', decimal_separator),
issue.parent_id,
format_time(issue.created_on), format_time(issue.created_on),
format_time(issue.updated_on) format_time(issue.updated_on)
] ]
@@ -233,30 +196,4 @@ module IssuesHelper
end end
export export
end end
def gantt_zoom_link(gantt, in_or_out)
img_attributes = {:style => 'height:1.4em; width:1.4em; margin-left: 3px;'} # em for accessibility
case in_or_out
when :in
if gantt.zoom < 4
link_to_remote(l(:text_zoom_in) + image_tag('zoom_in.png', img_attributes.merge(:alt => l(:text_zoom_in))),
{:url => gantt.params.merge(:zoom => (gantt.zoom+1)), :update => 'content'},
{:href => url_for(gantt.params.merge(:zoom => (gantt.zoom+1)))})
else
l(:text_zoom_in) +
image_tag('zoom_in_g.png', img_attributes.merge(:alt => l(:text_zoom_in)))
end
when :out
if gantt.zoom > 1
link_to_remote(l(:text_zoom_out) + image_tag('zoom_out.png', img_attributes.merge(:alt => l(:text_zoom_out))),
{:url => gantt.params.merge(:zoom => (gantt.zoom-1)), :update => 'content'},
{:href => url_for(gantt.params.merge(:zoom => (gantt.zoom-1)))})
else
l(:text_zoom_out) +
image_tag('zoom_out_g.png', img_attributes.merge(:alt => l(:text_zoom_out)))
end
end
end
end end
+3 -3
View File
@@ -16,13 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module JournalsHelper module JournalsHelper
def render_notes(issue, journal, options={}) def render_notes(journal, options={})
content = '' content = ''
editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) editable = journal.editable_by?(User.current)
links = [] links = []
if !journal.notes.blank? if !journal.notes.blank?
links << link_to_remote(image_tag('comment.png'), links << link_to_remote(image_tag('comment.png'),
{ :url => {:controller => 'issues', :action => 'reply', :id => issue, :journal_id => journal} }, { :url => {:controller => 'issues', :action => 'reply', :id => journal.journalized, :journal_id => journal} },
:title => l(:button_quote)) if options[:reply_links] :title => l(:button_quote)) if options[:reply_links]
links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes", links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes",
{ :controller => 'journals', :action => 'edit', :id => journal }, { :controller => 'journals', :action => 'edit', :id => journal },
-1
View File
@@ -23,7 +23,6 @@ module MessagesHelper
:action => 'show', :action => 'show',
:board_id => message.board_id, :board_id => message.board_id,
:id => message.root, :id => message.root,
:r => (message.parent_id && message.id),
:anchor => (message.parent_id ? "message-#{message.id}" : nil) :anchor => (message.parent_id ? "message-#{message.id}" : nil)
end end
end end
+1 -5
View File
@@ -46,7 +46,7 @@ module ProjectsHelper
options = '' options = ''
options << "<option value=''></option>" if project.allowed_parents.include?(nil) options << "<option value=''></option>" if project.allowed_parents.include?(nil)
options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected) options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
content_tag('select', options, :name => 'project[parent_id]', :id => 'project_parent_id') content_tag('select', options, :name => 'project[parent_id]')
end end
# Renders a tree of projects as a nested set of unordered lists # Renders a tree of projects as a nested set of unordered lists
@@ -56,10 +56,7 @@ module ProjectsHelper
s = '' s = ''
if projects.any? if projects.any?
ancestors = [] ancestors = []
original_project = @project
projects.each do |project| projects.each do |project|
# set the project environment to please macros.
@project = project
if (ancestors.empty? || project.is_descendant_of?(ancestors.last)) if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n" s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n"
else else
@@ -78,7 +75,6 @@ module ProjectsHelper
ancestors << project ancestors << project
end end
s << ("</li></ul>\n" * ancestors.size) s << ("</li></ul>\n" * ancestors.size)
@project = original_project
end end
s s
end end
-36
View File
@@ -57,44 +57,8 @@ module QueriesHelper
l(:general_text_Yes) l(:general_text_Yes)
when 'FalseClass' when 'FalseClass'
l(:general_text_No) l(:general_text_No)
when 'Issue'
link_to_issue(value, :subject => false)
else else
h(value) h(value)
end end
end end
# Retrieve query from session or build a new query
def retrieve_query
if !params[:query_id].blank?
cond = "project_id IS NULL"
cond << " OR project_id = #{@project.id}" if @project
@query = Query.find(params[:query_id], :conditions => cond)
@query.project = @project
session[:query] = {:id => @query.id, :project_id => @query.project_id}
sort_clear
else
if api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
# Give it a name, required to be valid
@query = Query.new(:name => "_")
@query.project = @project
if params[:fields] and params[:fields].is_a? Array
params[:fields].each do |field|
@query.add_filter(field, params[:operators][field], params[:values][field])
end
else
@query.available_filters.keys.each do |field|
@query.add_short_filter(field, params[field]) if params[field]
end
end
@query.group_by = params[:group_by]
@query.column_names = params[:query] && params[:query][:column_names]
session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
else
@query = Query.find_by_id(session[:query][:id]) if session[:query][:id]
@query ||= Query.new(:name => "_", :project => @project, :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
@query.project = @project
end
end
end
end end
+1 -1
View File
@@ -132,7 +132,7 @@ module RepositoriesHelper
def scm_select_tag(repository) def scm_select_tag(repository)
scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']] scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']]
Redmine::Scm::Base.all.each do |scm| REDMINE_SUPPORTED_SCM.each do |scm|
scm_options << ["Repository::#{scm}".constantize.scm_name, scm] if Setting.enabled_scm.include?(scm) || (repository && repository.class.name.demodulize == scm) scm_options << ["Repository::#{scm}".constantize.scm_name, scm] if Setting.enabled_scm.include?(scm) || (repository && repository.class.name.demodulize == scm)
end end
+1 -10
View File
@@ -81,7 +81,7 @@ module SortHelper
def to_sql def to_sql
sql = @criteria.collect do |k,o| sql = @criteria.collect do |k,o|
if s = @available_criteria[k] if s = @available_criteria[k]
(o ? s.to_a : s.to_a.collect {|c| append_desc(c)}).join(', ') (o ? s.to_a : s.to_a.collect {|c| "#{c} DESC"}).join(', ')
end end
end.compact.join(', ') end.compact.join(', ')
sql.blank? ? nil : sql sql.blank? ? nil : sql
@@ -120,15 +120,6 @@ module SortHelper
@criteria.slice!(3) @criteria.slice!(3)
self self
end end
# Appends DESC to the sort criterion unless it has a fixed order
def append_desc(criterion)
if criterion =~ / (asc|desc)$/i
criterion
else
"#{criterion} DESC"
end
end
end end
def sort_name def sort_name
+1 -1
View File
@@ -57,7 +57,7 @@ module TimelogHelper
if value.to_s.empty? if value.to_s.empty?
data.select {|row| row[criteria].blank? } data.select {|row| row[criteria].blank? }
else else
data.select {|row| row[criteria].to_s == value.to_s} data.select {|row| row[criteria] == value}
end end
end end
+5 -7
View File
@@ -48,8 +48,8 @@ module WatchersHelper
# Returns a comma separated list of users watching the given object # Returns a comma separated list of users watching the given object
def watchers_list(object) def watchers_list(object)
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
lis = object.watcher_users.collect do |user| object.watcher_users.collect do |user|
s = avatar(user, :size => "16").to_s + link_to_user(user, :class => 'user').to_s s = content_tag('span', link_to_user(user), :class => 'user')
if remove_allowed if remove_allowed
url = {:controller => 'watchers', url = {:controller => 'watchers',
:action => 'destroy', :action => 'destroy',
@@ -59,11 +59,9 @@ module WatchersHelper
s += ' ' + link_to_remote(image_tag('delete.png'), s += ' ' + link_to_remote(image_tag('delete.png'),
{:url => url}, {:url => url},
:href => url_for(url), :href => url_for(url),
:style => "vertical-align: middle", :style => "vertical-align: middle")
:class => "delete")
end end
"<li>#{ s }</li>" s
end end.join(",\n")
lis.empty? ? "" : "<ul>#{ lis.join("\n") }</ul>"
end end
end end
+5 -36
View File
@@ -133,33 +133,6 @@ class Attachment < ActiveRecord::Base
def readable? def readable?
File.readable?(diskfile) File.readable?(diskfile)
end end
# Bulk attaches a set of files to an object
#
# Returns a Hash of the results:
# :files => array of the attached files
# :unsaved => array of the files that could not be attached
def self.attach_files(obj, attachments)
attached = []
if attachments && attachments.is_a?(Hash)
attachments.each_value do |attachment|
file = attachment['file']
next unless file && file.size > 0
a = Attachment.create(:container => obj,
:file => file,
:description => attachment['description'].to_s.strip,
:author => User.current)
if a.new_record?
obj.unsaved_attachments ||= []
obj.unsaved_attachments << a
else
attached << a
end
end
end
{:files => attached, :unsaved => obj.unsaved_attachments}
end
private private
def sanitize_filename(value) def sanitize_filename(value)
@@ -174,18 +147,14 @@ private
# Returns an ASCII or hashed filename # Returns an ASCII or hashed filename
def self.disk_filename(filename) def self.disk_filename(filename)
timestamp = DateTime.now.strftime("%y%m%d%H%M%S") df = DateTime.now.strftime("%y%m%d%H%M%S") + "_"
ascii = ''
if filename =~ %r{^[a-zA-Z0-9_\.\-]*$} if filename =~ %r{^[a-zA-Z0-9_\.\-]*$}
ascii = filename df << filename
else else
ascii = Digest::MD5.hexdigest(filename) df << Digest::MD5.hexdigest(filename)
# keep the extension if any # keep the extension if any
ascii << $1 if filename =~ %r{(\.[a-zA-Z0-9]+)$} df << $1 if filename =~ %r{(\.[a-zA-Z0-9]+)$}
end end
while File.exist?(File.join(@@storage_path, "#{timestamp}_#{ascii}")) df
timestamp.succ!
end
"#{timestamp}_#{ascii}"
end end
end end
-9
View File
@@ -32,15 +32,6 @@ class AuthSource < ActiveRecord::Base
"Abstract" "Abstract"
end end
def allow_password_changes?
self.class.allow_password_changes?
end
# Does this auth source backend allow password changes?
def self.allow_password_changes?
false
end
# Try to authenticate a user not yet registered against available sources # Try to authenticate a user not yet registered against available sources
def self.authenticate(login, password) def self.authenticate(login, password)
AuthSource.find(:all, :conditions => ["onthefly_register=?", true]).each do |source| AuthSource.find(:all, :conditions => ["onthefly_register=?", true]).each do |source|
+23 -55
View File
@@ -33,12 +33,30 @@ class AuthSourceLdap < AuthSource
def authenticate(login, password) def authenticate(login, password)
return nil if login.blank? || password.blank? return nil if login.blank? || password.blank?
attrs = get_user_dn(login) attrs = []
# get user's DN
if attrs && attrs[:dn] && authenticate_dn(attrs[:dn], password) ldap_con = initialize_ldap_con(self.account, self.account_password)
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug? login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
return attrs.except(:dn) object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
dn = String.new
ldap_con.search( :base => self.base_dn,
:filter => object_filter & login_filter,
# only ask for the DN if on-the-fly registration is disabled
:attributes=> (onthefly_register? ? ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail] : ['dn'])) do |entry|
dn = entry.dn
attrs = [:firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),
:lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),
:mail => AuthSourceLdap.get_attr(entry, self.attr_mail),
:auth_source_id => self.id ] if onthefly_register?
end end
return nil if dn.empty?
logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?
# authenticate user
ldap_con = initialize_ldap_con(dn, password)
return nil unless ldap_con.bind
# return user's attributes
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
attrs
rescue Net::LDAP::LdapError => text rescue Net::LDAP::LdapError => text
raise "LdapError: " + text raise "LdapError: " + text
end end
@@ -71,56 +89,6 @@ class AuthSourceLdap < AuthSource
options.merge!(:auth => { :method => :simple, :username => ldap_user, :password => ldap_password }) unless ldap_user.blank? && ldap_password.blank? options.merge!(:auth => { :method => :simple, :username => ldap_user, :password => ldap_password }) unless ldap_user.blank? && ldap_password.blank?
Net::LDAP.new options Net::LDAP.new options
end end
def get_user_attributes_from_ldap_entry(entry)
{
:dn => entry.dn,
:firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),
:lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),
:mail => AuthSourceLdap.get_attr(entry, self.attr_mail),
:auth_source_id => self.id
}
end
# Return the attributes needed for the LDAP search. It will only
# include the user attributes if on-the-fly registration is enabled
def search_attributes
if onthefly_register?
['dn', self.attr_firstname, self.attr_lastname, self.attr_mail]
else
['dn']
end
end
# Check if a DN (user record) authenticates with the password
def authenticate_dn(dn, password)
if dn.present? && password.present?
initialize_ldap_con(dn, password).bind
end
end
# Get the user's dn and any attributes for them, given their login
def get_user_dn(login)
ldap_con = initialize_ldap_con(self.account, self.account_password)
login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
attrs = {}
ldap_con.search( :base => self.base_dn,
:filter => object_filter & login_filter,
:attributes=> search_attributes) do |entry|
if onthefly_register?
attrs = get_user_attributes_from_ldap_entry(entry)
else
attrs = {:dn => entry.dn}
end
logger.debug "DN found for #{login}: #{attrs[:dn]}" if logger && logger.debug?
end
attrs
end
def self.get_attr(entry, attr_name) def self.get_attr(entry, attr_name)
if !attr_name.blank? if !attr_name.blank?
-4
View File
@@ -23,8 +23,4 @@ class Change < ActiveRecord::Base
def relative_path def relative_path
changeset.repository.relative_path(path) changeset.repository.relative_path(path)
end end
def before_save
path ||= ""
end
end end
-9
View File
@@ -152,15 +152,6 @@ class Changeset < ActiveRecord::Base
def self.normalize_comments(str) def self.normalize_comments(str)
to_utf8(str.to_s.strip) to_utf8(str.to_s.strip)
end end
# Creates a new Change from it's common parameters
def create_change(change)
Change.create(:changeset => self,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end
private private
+10 -1
View File
@@ -20,11 +20,20 @@ class CustomField < ActiveRecord::Base
acts_as_list :scope => 'type = \'#{self.class}\'' acts_as_list :scope => 'type = \'#{self.class}\''
serialize :possible_values serialize :possible_values
FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },
"text" => { :name => :label_text, :order => 2 },
"int" => { :name => :label_integer, :order => 3 },
"float" => { :name => :label_float, :order => 4 },
"list" => { :name => :label_list, :order => 5 },
"date" => { :name => :label_date, :order => 6 },
"bool" => { :name => :label_boolean, :order => 7 }
}.freeze
validates_presence_of :name, :field_format validates_presence_of :name, :field_format
validates_uniqueness_of :name, :scope => :type validates_uniqueness_of :name, :scope => :type
validates_length_of :name, :maximum => 30 validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i
validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
def initialize(attributes = nil) def initialize(attributes = nil)
super super
+7
View File
@@ -46,4 +46,11 @@ class Document < ActiveRecord::Base
end end
@updated_on @updated_on
end end
# Returns the mail adresses of users that should be notified
def recipients
notified = project.notified_users
notified.reject! {|user| !visible?(user)}
notified.collect(&:mail)
end
end end
+82 -453
View File
@@ -32,7 +32,6 @@ class Issue < ActiveRecord::Base
has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
acts_as_nested_set :scope => 'root_id'
acts_as_attachable :after_remove => :attachment_removed acts_as_attachable :after_remove => :attachment_removed
acts_as_customizable acts_as_customizable
acts_as_watchable acts_as_watchable
@@ -48,11 +47,8 @@ class Issue < ActiveRecord::Base
:author_key => :author_id :author_key => :author_id
DONE_RATIO_OPTIONS = %w(issue_field issue_status) DONE_RATIO_OPTIONS = %w(issue_field issue_status)
attr_reader :current_journal
validates_presence_of :subject, :priority, :project, :tracker, :author, :status validates_presence_of :subject, :priority, :project, :tracker, :author, :status
validates_length_of :subject, :maximum => 255 validates_length_of :subject, :maximum => 255
validates_inclusion_of :done_ratio, :in => 0..100 validates_inclusion_of :done_ratio, :in => 0..100
validates_numericality_of :estimated_hours, :allow_nil => true validates_numericality_of :estimated_hours, :allow_nil => true
@@ -62,16 +58,8 @@ class Issue < ActiveRecord::Base
named_scope :open, :conditions => ["#{IssueStatus.table_name}.is_closed = ?", false], :include => :status named_scope :open, :conditions => ["#{IssueStatus.table_name}.is_closed = ?", false], :include => :status
named_scope :recently_updated, :order => "#{self.table_name}.updated_on DESC" before_save :update_done_ratio_from_issue_status
named_scope :with_limit, lambda { |limit| { :limit => limit} } after_save :create_journal
named_scope :on_active_project, :include => [:status, :project, :tracker],
:conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
before_create :default_assign
before_save :reschedule_following_issues, :close_duplicates, :update_done_ratio_from_issue_status
after_save :update_nested_set_attributes, :update_parent_attributes, :create_journal
after_destroy :destroy_children
after_destroy :update_parent_attributes
# Returns true if usr or current user is allowed to view the issue # Returns true if usr or current user is allowed to view the issue
def visible?(usr=nil) def visible?(usr=nil)
@@ -93,80 +81,60 @@ class Issue < ActiveRecord::Base
def copy_from(arg) def copy_from(arg)
issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg) issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on") self.attributes = issue.attributes.dup.except("id", "created_on", "updated_on")
self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} self.custom_values = issue.custom_values.collect {|v| v.clone}
self.status = issue.status self.status = issue.status
self self
end end
# Moves/copies an issue to a new project and tracker # Moves/copies an issue to a new project and tracker
# Returns the moved/copied issue on success, false on failure # Returns the moved/copied issue on success, false on failure
def move_to_project(*args) def move_to(new_project, new_tracker = nil, options = {})
ret = Issue.transaction do
move_to_project_without_transaction(*args) || raise(ActiveRecord::Rollback)
end || false
end
def move_to_project_without_transaction(new_project, new_tracker = nil, options = {})
options ||= {} options ||= {}
issue = options[:copy] ? self.class.new.copy_from(self) : self issue = options[:copy] ? self.clone : self
ret = Issue.transaction do
if new_project && issue.project_id != new_project.id if new_project && issue.project_id != new_project.id
# delete issue relations # delete issue relations
unless Setting.cross_project_issue_relations? unless Setting.cross_project_issue_relations?
issue.relations_from.clear issue.relations_from.clear
issue.relations_to.clear issue.relations_to.clear
end
# issue is moved to another project
# reassign to the category with same name if any
new_category = issue.category.nil? ? nil : new_project.issue_categories.find_by_name(issue.category.name)
issue.category = new_category
# Keep the fixed_version if it's still valid in the new_project
unless new_project.shared_versions.include?(issue.fixed_version)
issue.fixed_version = nil
end
issue.project = new_project
if issue.parent && issue.parent.project_id != issue.project_id
issue.parent_issue_id = nil
end
end
if new_tracker
issue.tracker = new_tracker
issue.reset_custom_values!
end
if options[:copy]
issue.custom_field_values = self.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
issue.status = if options[:attributes] && options[:attributes][:status_id]
IssueStatus.find_by_id(options[:attributes][:status_id])
else
self.status
end
end
# Allow bulk setting of attributes on the issue
if options[:attributes]
issue.attributes = options[:attributes]
end
if issue.save
unless options[:copy]
# Manually update project_id on related time entries
TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id})
issue.children.each do |child|
unless child.move_to_project_without_transaction(new_project)
# Move failed and transaction was rollback'd
return false
end
end end
# issue is moved to another project
# reassign to the category with same name if any
new_category = issue.category.nil? ? nil : new_project.issue_categories.find_by_name(issue.category.name)
issue.category = new_category
# Keep the fixed_version if it's still valid in the new_project
unless new_project.shared_versions.include?(issue.fixed_version)
issue.fixed_version = nil
end
issue.project = new_project
end
if new_tracker
issue.tracker = new_tracker
end
if options[:copy]
issue.custom_field_values = self.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
issue.status = if options[:attributes] && options[:attributes][:status_id]
IssueStatus.find_by_id(options[:attributes][:status_id])
else
self.status
end
end
# Allow bulk setting of attributes on the issue
if options[:attributes]
issue.attributes = options[:attributes]
end
if issue.save
unless options[:copy]
# Manually update project_id on related time entries
TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id})
end
true
else
raise ActiveRecord::Rollback
end end
else
return false
end end
issue ret ? issue : false
end
def status_id=(sid)
self.status = nil
write_attribute(:status_id, sid)
end end
def priority_id=(pid) def priority_id=(pid)
@@ -176,6 +144,7 @@ class Issue < ActiveRecord::Base
def tracker_id=(tid) def tracker_id=(tid)
self.tracker = nil self.tracker = nil
write_attribute(:tracker_id, tid)
result = write_attribute(:tracker_id, tid) result = write_attribute(:tracker_id, tid)
@custom_field_values = nil @custom_field_values = nil
result result
@@ -197,53 +166,6 @@ class Issue < ActiveRecord::Base
write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h) write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
end end
SAFE_ATTRIBUTES = %w(
tracker_id
status_id
parent_issue_id
category_id
assigned_to_id
priority_id
fixed_version_id
subject
description
start_date
due_date
done_ratio
estimated_hours
custom_field_values
lock_version
) unless const_defined?(:SAFE_ATTRIBUTES)
# Safely sets attributes
# Should be called from controllers instead of #attributes=
# attr_accessible is too rough because we still want things like
# Issue.new(:project => foo) to work
# TODO: move workflow/permission checks from controllers to here
def safe_attributes=(attrs, user=User.current)
return if attrs.nil?
attrs = attrs.reject {|k,v| !SAFE_ATTRIBUTES.include?(k)}
if attrs['status_id']
unless new_statuses_allowed_to(user).collect(&:id).include?(attrs['status_id'].to_i)
attrs.delete('status_id')
end
end
unless leaf?
attrs.reject! {|k,v| %w(priority_id done_ratio start_date due_date estimated_hours).include?(k)}
end
if attrs.has_key?('parent_issue_id')
if !user.allowed_to?(:manage_subtasks, project)
attrs.delete('parent_issue_id')
elsif !attrs['parent_issue_id'].blank?
attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'])
end
end
self.attributes = attrs
end
def done_ratio def done_ratio
if Issue.use_status_for_done_ratio? && status && status.default_done_ratio? if Issue.use_status_for_done_ratio? && status && status.default_done_ratio?
status.default_done_ratio status.default_done_ratio
@@ -287,21 +209,12 @@ class Issue < ActiveRecord::Base
errors.add :tracker_id, :inclusion errors.add :tracker_id, :inclusion
end end
end end
end
# Checks parent issue assignment
if @parent_issue def before_create
if @parent_issue.project_id != project_id # default assignment based on category
errors.add :parent_issue_id, :not_same_project if assigned_to.nil? && category && category.assigned_to
elsif !new_record? self.assigned_to = category.assigned_to
# moving an existing issue
if @parent_issue.root_id != root_id
# we can always move to another tree
elsif move_possible?(@parent_issue)
# move accepted inside tree
else
errors.add :parent_issue_id, :not_a_valid_parent
end
end
end end
end end
@@ -313,6 +226,27 @@ class Issue < ActiveRecord::Base
end end
end end
def after_save
# Reload is needed in order to get the right status
reload
# Update start/due dates of following issues
relations_from.each(&:set_issue_to_dates)
# Close duplicates if the issue was closed
if @issue_before_change && !@issue_before_change.closed? && self.closed?
duplicates.each do |duplicate|
# Reload is need in case the duplicate was updated by a previous duplicate
duplicate.reload
# Don't re-close it if it's already closed
next if duplicate.closed?
# Same user and notes
duplicate.init_journal(@current_journal.user, @current_journal.notes)
duplicate.update_attribute :status, self.status
end
end
end
def init_journal(user, notes = "") def init_journal(user, notes = "")
@current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes) @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
@issue_before_change = self.clone @issue_before_change = self.clone
@@ -340,18 +274,6 @@ class Issue < ActiveRecord::Base
end end
false false
end end
# Return true if the issue is being closed
def closing?
if !new_record? && status_id_changed?
status_was = IssueStatus.find_by_id(status_id_was)
status_new = IssueStatus.find_by_id(status_id)
if status_was && status_new && !status_was.is_closed? && status_new.is_closed?
return true
end
end
false
end
# Returns true if the issue is overdue # Returns true if the issue is overdue
def overdue? def overdue?
@@ -374,10 +296,9 @@ class Issue < ActiveRecord::Base
end end
# Returns an array of status that user is able to apply # Returns an array of status that user is able to apply
def new_statuses_allowed_to(user, include_default=false) def new_statuses_allowed_to(user)
statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker) statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker)
statuses << status unless statuses.empty? statuses << status unless statuses.empty?
statuses << IssueStatus.default if include_default
statuses = statuses.uniq.sort statuses = statuses.uniq.sort
blocked? ? statuses.reject {|s| s.is_closed?} : statuses blocked? ? statuses.reject {|s| s.is_closed?} : statuses
end end
@@ -394,13 +315,13 @@ class Issue < ActiveRecord::Base
notified.collect(&:mail) notified.collect(&:mail)
end end
# Returns the total number of hours spent on this issue and its descendants # Returns the total number of hours spent on this issue.
# #
# Example: # Example:
# spent_hours => 0.0 # spent_hours => 0
# spent_hours => 50.2 # spent_hours => 50
def spent_hours def spent_hours
@spent_hours ||= self_and_descendants.sum("#{TimeEntry.table_name}.hours", :include => :time_entries).to_f || 0.0 @spent_hours ||= time_entries.sum(:hours) || 0
end end
def relations def relations
@@ -437,34 +358,7 @@ class Issue < ActiveRecord::Base
end end
def soonest_start def soonest_start
@soonest_start ||= ( @soonest_start ||= relations_to.collect{|relation| relation.successor_soonest_start}.compact.min
relations_to.collect{|relation| relation.successor_soonest_start} +
ancestors.collect(&:soonest_start)
).compact.max
end
def reschedule_after(date)
return if date.nil?
if leaf?
if start_date.nil? || start_date < date
self.start_date, self.due_date = date, date + duration
save
end
else
leaves.each do |leaf|
leaf.reschedule_after(date)
end
end
end
def <=>(issue)
if issue.nil?
-1
elsif root_id != issue.root_id
(root_id || 0) <=> (issue.root_id || 0)
else
(lft || 0) <=> (issue.lft || 0)
end
end end
def to_s def to_s
@@ -481,42 +375,6 @@ class Issue < ActiveRecord::Base
s s
end end
# Saves an issue, time_entry, attachments, and a journal from the parameters
# Returns false if save fails
def save_issue_with_child_records(params, existing_time_entry=nil)
Issue.transaction do
if params[:time_entry] && params[:time_entry][:hours].present? && User.current.allowed_to?(:log_time, project)
@time_entry = existing_time_entry || TimeEntry.new
@time_entry.project = project
@time_entry.issue = self
@time_entry.user = User.current
@time_entry.spent_on = Date.today
@time_entry.attributes = params[:time_entry]
self.time_entries << @time_entry
end
if valid?
attachments = Attachment.attach_files(self, params[:attachments])
attachments[:files].each {|a| @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
# TODO: Rename hook
Redmine::Hook.call_hook(:controller_issues_edit_before_save, { :params => params, :issue => self, :time_entry => @time_entry, :journal => @current_journal})
begin
if save
# TODO: Rename hook
Redmine::Hook.call_hook(:controller_issues_edit_after_save, { :params => params, :issue => self, :time_entry => @time_entry, :journal => @current_journal})
else
raise ActiveRecord::Rollback
end
rescue ActiveRecord::StaleObjectError
attachments[:files].each(&:destroy)
errors.add_to_base l(:notice_locking_conflict)
raise ActiveRecord::Rollback
end
end
end
end
# Unassigns issues from +version+ if it's no longer shared with issue's project # Unassigns issues from +version+ if it's no longer shared with issue's project
def self.update_versions_from_sharing_change(version) def self.update_versions_from_sharing_change(version)
# Update issues assigned to the version # Update issues assigned to the version
@@ -531,75 +389,6 @@ class Issue < ActiveRecord::Base
Issue.update_versions(["#{Version.table_name}.project_id IN (?) OR #{Issue.table_name}.project_id IN (?)", moved_project_ids, moved_project_ids]) Issue.update_versions(["#{Version.table_name}.project_id IN (?) OR #{Issue.table_name}.project_id IN (?)", moved_project_ids, moved_project_ids])
end end
def parent_issue_id=(arg)
parent_issue_id = arg.blank? ? nil : arg.to_i
if parent_issue_id && @parent_issue = Issue.find_by_id(parent_issue_id)
@parent_issue.id
else
@parent_issue = nil
nil
end
end
def parent_issue_id
if instance_variable_defined? :@parent_issue
@parent_issue.nil? ? nil : @parent_issue.id
else
parent_id
end
end
# Extracted from the ReportsController.
def self.by_tracker(project)
count_and_group_by(:project => project,
:field => 'tracker_id',
:joins => Tracker.table_name)
end
def self.by_version(project)
count_and_group_by(:project => project,
:field => 'fixed_version_id',
:joins => Version.table_name)
end
def self.by_priority(project)
count_and_group_by(:project => project,
:field => 'priority_id',
:joins => IssuePriority.table_name)
end
def self.by_category(project)
count_and_group_by(:project => project,
:field => 'category_id',
:joins => IssueCategory.table_name)
end
def self.by_assigned_to(project)
count_and_group_by(:project => project,
:field => 'assigned_to_id',
:joins => User.table_name)
end
def self.by_author(project)
count_and_group_by(:project => project,
:field => 'author_id',
:joins => User.table_name)
end
def self.by_subproject(project)
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
i.project_id as project_id,
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s
where
i.status_id=s.id
and i.project_id IN (#{project.descendants.active.collect{|p| p.id}.join(',')})
group by s.id, s.is_closed, i.project_id") if project.descendants.active.any?
end
# End ReportsController extraction
# Returns an array of projects that current user can move issues to # Returns an array of projects that current user can move issues to
def self.allowed_target_projects_on_move def self.allowed_target_projects_on_move
projects = [] projects = []
@@ -618,102 +407,6 @@ class Issue < ActiveRecord::Base
private private
def update_nested_set_attributes
if root_id.nil?
# issue was just created
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id)
set_default_left_and_right
Issue.update_all("root_id = #{root_id}, lft = #{lft}, rgt = #{rgt}", ["id = ?", id])
if @parent_issue
move_to_child_of(@parent_issue)
end
reload
elsif parent_issue_id != parent_id
former_parent_id = parent_id
# moving an existing issue
if @parent_issue && @parent_issue.root_id == root_id
# inside the same tree
move_to_child_of(@parent_issue)
else
# to another tree
unless root?
move_to_right_of(root)
reload
end
old_root_id = root_id
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id )
target_maxright = nested_set_scope.maximum(right_column_name) || 0
offset = target_maxright + 1 - lft
Issue.update_all("root_id = #{root_id}, lft = lft + #{offset}, rgt = rgt + #{offset}",
["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt])
self[left_column_name] = lft + offset
self[right_column_name] = rgt + offset
if @parent_issue
move_to_child_of(@parent_issue)
end
end
reload
# delete invalid relations of all descendants
self_and_descendants.each do |issue|
issue.relations.each do |relation|
relation.destroy unless relation.valid?
end
end
# update former parent
recalculate_attributes_for(former_parent_id) if former_parent_id
end
remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue)
end
def update_parent_attributes
recalculate_attributes_for(parent_id) if parent_id
end
def recalculate_attributes_for(issue_id)
if issue_id && p = Issue.find_by_id(issue_id)
# priority = highest priority of children
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :include => :priority)
p.priority = IssuePriority.find_by_position(priority_position)
end
# start/due dates = lowest/highest dates of children
p.start_date = p.children.minimum(:start_date)
p.due_date = p.children.maximum(:due_date)
if p.start_date && p.due_date && p.due_date < p.start_date
p.start_date, p.due_date = p.due_date, p.start_date
end
# done ratio = weighted average ratio of leaves
unless Issue.use_status_for_done_ratio? && p.status && p.status.default_done_ratio?
leaves_count = p.leaves.count
if leaves_count > 0
average = p.leaves.average(:estimated_hours).to_f
if average == 0
average = 1
end
done = p.leaves.sum("COALESCE(estimated_hours, #{average}) * (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :include => :status).to_f
progress = done / (average * leaves_count)
p.done_ratio = progress.round
end
end
# estimate = sum of leaves estimates
p.estimated_hours = p.leaves.sum(:estimated_hours).to_f
p.estimated_hours = nil if p.estimated_hours == 0.0
# ancestors will be recursively updated
p.save(false)
end
end
def destroy_children
unless leaf?
children.each do |child|
child.destroy
end
end
end
# Update issues so their versions are not pointing to a # Update issues so their versions are not pointing to a
# fixed_version that is not shared with the issue's project # fixed_version that is not shared with the issue's project
def self.update_versions(conditions=nil) def self.update_versions(conditions=nil)
@@ -743,45 +436,12 @@ class Issue < ActiveRecord::Base
journal.save journal.save
end end
# Default assignment based on category
def default_assign
if assigned_to.nil? && category && category.assigned_to
self.assigned_to = category.assigned_to
end
end
# Updates start/due dates of following issues
def reschedule_following_issues
if start_date_changed? || due_date_changed?
relations_from.each do |relation|
relation.set_issue_to_dates
end
end
end
# Closes duplicates if the issue is being closed
def close_duplicates
if closing?
duplicates.each do |duplicate|
# Reload is need in case the duplicate was updated by a previous duplicate
duplicate.reload
# Don't re-close it if it's already closed
next if duplicate.closed?
# Same user and notes
if @current_journal
duplicate.init_journal(@current_journal.user, @current_journal.notes)
end
duplicate.update_attribute :status, self.status
end
end
end
# Saves the changes in a Journal # Saves the changes in a Journal
# Called after_save # Called after_save
def create_journal def create_journal
if @current_journal if @current_journal
# attributes changes # attributes changes
(Issue.column_names - %w(id description root_id lft rgt lock_version created_on updated_on)).each {|c| (Issue.column_names - %w(id description lock_version created_on updated_on)).each {|c|
@current_journal.details << JournalDetail.new(:property => 'attr', @current_journal.details << JournalDetail.new(:property => 'attr',
:prop_key => c, :prop_key => c,
:old_value => @issue_before_change.send(c), :old_value => @issue_before_change.send(c),
@@ -797,37 +457,6 @@ class Issue < ActiveRecord::Base
:value => c.value) :value => c.value)
} }
@current_journal.save @current_journal.save
# reset current journal
init_journal @current_journal.user, @current_journal.notes
end end
end end
# Query generator for selecting groups of issue counts for a project
# based on specific criteria
#
# Options
# * project - Project to search in.
# * field - String. Issue field to key off of in the grouping.
# * joins - String. The table name to join against.
def self.count_and_group_by(options)
project = options.delete(:project)
select_field = options.delete(:field)
joins = options.delete(:joins)
where = "i.#{select_field}=j.id"
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
j.id as #{select_field},
count(i.id) as total
from
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{joins} as j
where
i.status_id=s.id
and #{where}
and i.project_id=#{project.id}
group by s.id, s.is_closed, j.id")
end
end end
+10 -26
View File
@@ -21,19 +21,15 @@ class IssueRelation < ActiveRecord::Base
TYPE_RELATES = "relates" TYPE_RELATES = "relates"
TYPE_DUPLICATES = "duplicates" TYPE_DUPLICATES = "duplicates"
TYPE_DUPLICATED = "duplicated"
TYPE_BLOCKS = "blocks" TYPE_BLOCKS = "blocks"
TYPE_BLOCKED = "blocked"
TYPE_PRECEDES = "precedes" TYPE_PRECEDES = "precedes"
TYPE_FOLLOWS = "follows" TYPE_FOLLOWS = "follows"
TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1, :sym => TYPE_RELATES }, TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1 },
TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2, :sym => TYPE_DUPLICATED }, TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2 },
TYPE_DUPLICATED => { :name => :label_duplicated_by, :sym_name => :label_duplicates, :order => 3, :sym => TYPE_DUPLICATES, :reverse => TYPE_DUPLICATES }, TYPE_BLOCKS => { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 3 },
TYPE_BLOCKS => { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 4, :sym => TYPE_BLOCKED }, TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 4 },
TYPE_BLOCKED => { :name => :label_blocked_by, :sym_name => :label_blocks, :order => 5, :sym => TYPE_BLOCKS, :reverse => TYPE_BLOCKS }, TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 5 }
TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 6, :sym => TYPE_FOLLOWS },
TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES }
}.freeze }.freeze
validates_presence_of :issue_from, :issue_to, :relation_type validates_presence_of :issue_from, :issue_to, :relation_type
@@ -48,7 +44,6 @@ class IssueRelation < ActiveRecord::Base
errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id
errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations? errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations?
errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from
errors.add_to_base :cant_link_an_issue_with_a_descendant if issue_from.is_descendant_of?(issue_to) || issue_from.is_ancestor_of?(issue_to)
end end
end end
@@ -56,17 +51,6 @@ class IssueRelation < ActiveRecord::Base
(self.issue_from_id == issue.id) ? issue_to : issue_from (self.issue_from_id == issue.id) ? issue_to : issue_from
end end
# Returns the relation type for +issue+
def relation_type_for(issue)
if TYPES[relation_type]
if self.issue_from_id == issue.id
relation_type
else
TYPES[relation_type][:sym]
end
end
end
def label_for(issue) def label_for(issue)
TYPES[relation_type] ? TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] : :unknow TYPES[relation_type] ? TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] : :unknow
end end
@@ -84,8 +68,9 @@ class IssueRelation < ActiveRecord::Base
def set_issue_to_dates def set_issue_to_dates
soonest_start = self.successor_soonest_start soonest_start = self.successor_soonest_start
if soonest_start if soonest_start && (!issue_to.start_date || issue_to.start_date < soonest_start)
issue_to.reschedule_after(soonest_start) issue_to.start_date, issue_to.due_date = successor_soonest_start, successor_soonest_start + issue_to.duration
issue_to.save
end end
end end
@@ -100,13 +85,12 @@ class IssueRelation < ActiveRecord::Base
private private
# Reverses the relation if needed so that it gets stored in the proper way
def reverse_if_needed def reverse_if_needed
if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse] if (TYPE_FOLLOWS == relation_type)
issue_tmp = issue_to issue_tmp = issue_to
self.issue_to = issue_from self.issue_to = issue_from
self.issue_from = issue_tmp self.issue_from = issue_tmp
self.relation_type = TYPES[relation_type][:reverse] self.relation_type = TYPE_PRECEDES
end end
end end
end end
+4 -24
View File
@@ -120,21 +120,18 @@ class MailHandler < ActionMailer::Base
category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category))) category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category)))
priority = (get_keyword(:priority) && IssuePriority.find_by_name(get_keyword(:priority))) priority = (get_keyword(:priority) && IssuePriority.find_by_name(get_keyword(:priority)))
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
assigned_to = (get_keyword(:assigned_to, :override => true) && find_user_from_keyword(get_keyword(:assigned_to, :override => true)))
due_date = get_keyword(:due_date, :override => true)
start_date = get_keyword(:start_date, :override => true)
# check permission # check permission
unless @@handler_options[:no_permission_check] unless @@handler_options[:no_permission_check]
raise UnauthorizedAction unless user.allowed_to?(:add_issues, project) raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
end end
issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority, :due_date => due_date, :start_date => start_date, :assigned_to => assigned_to) issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority)
# check workflow # check workflow
if status && issue.new_statuses_allowed_to(user).include?(status) if status && issue.new_statuses_allowed_to(user).include?(status)
issue.status = status issue.status = status
end end
issue.subject = email.subject.chomp[0,255] issue.subject = email.subject.chomp
if issue.subject.blank? if issue.subject.blank?
issue.subject = '(no subject)' issue.subject = '(no subject)'
end end
@@ -166,9 +163,6 @@ class MailHandler < ActionMailer::Base
# Adds a note to an existing issue # Adds a note to an existing issue
def receive_issue_reply(issue_id) def receive_issue_reply(issue_id)
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
due_date = get_keyword(:due_date, :override => true)
start_date = get_keyword(:start_date, :override => true)
assigned_to = (get_keyword(:assigned_to, :override => true) && find_user_from_keyword(get_keyword(:assigned_to, :override => true)))
issue = Issue.find_by_id(issue_id) issue = Issue.find_by_id(issue_id)
return unless issue return unless issue
@@ -185,10 +179,6 @@ class MailHandler < ActionMailer::Base
if status && issue.new_statuses_allowed_to(user).include?(status) if status && issue.new_statuses_allowed_to(user).include?(status)
issue.status = status issue.status = status
end end
issue.start_date = start_date if start_date
issue.due_date = due_date if due_date
issue.assigned_to = assigned_to if assigned_to
issue.save! issue.save!
logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
journal journal
@@ -255,7 +245,7 @@ class MailHandler < ActionMailer::Base
@keywords[attr] @keywords[attr]
else else
@keywords[attr] = begin @keywords[attr] = begin
if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr.to_s.humanize}[ \t]*:[ \t]*(.+)\s*$/i, '') if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr}[ \t]*:[ \t]*(.+)\s*$/i, '')
$1.strip $1.strip
elsif !@@handler_options[:issue][attr].blank? elsif !@@handler_options[:issue][attr].blank?
@@handler_options[:issue][attr] @@handler_options[:issue][attr]
@@ -323,14 +313,4 @@ class MailHandler < ActionMailer::Base
end end
body.strip body.strip
end end
def find_user_from_keyword(keyword)
user ||= User.find_by_mail(keyword)
user ||= User.find_by_login(keyword)
if user.nil? && keyword.match(/ /)
firstname, lastname = *(keyword.split) # "First Last Throwaway"
user ||= User.find_by_firstname_and_lastname(firstname, lastname)
end
user
end
end end
+3 -26
View File
@@ -161,7 +161,7 @@ class Mailer < ActionMailer::Base
cc((message.root.watcher_recipients + message.board.watcher_recipients).uniq - @recipients) cc((message.root.watcher_recipients + message.board.watcher_recipients).uniq - @recipients)
subject "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}" subject "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}"
body :message => message, body :message => message,
:message_url => url_for(message.event_url) :message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root)
render_multipart('message_posted', body) render_multipart('message_posted', body)
end end
@@ -284,21 +284,7 @@ class Mailer < ActionMailer::Base
if @references_objects if @references_objects
mail.references = @references_objects.collect {|o| self.class.message_id_for(o)} mail.references = @references_objects.collect {|o| self.class.message_id_for(o)}
end end
super(mail)
# Log errors when raise_delivery_errors is set to false, Rails does not
raise_errors = self.class.raise_delivery_errors
self.class.raise_delivery_errors = true
begin
return super(mail)
rescue Exception => e
if raise_errors
raise e
elsif mylogger
mylogger.error "The following error occured while sending email notification: \"#{e.message}\". Check your configuration in config/email.yml."
end
ensure
self.class.raise_delivery_errors = raise_errors
end
end end
# Sends reminders to issue assignees # Sends reminders to issue assignees
@@ -363,14 +349,9 @@ class Mailer < ActionMailer::Base
recipients.delete(@author.mail) if recipients recipients.delete(@author.mail) if recipients
cc.delete(@author.mail) if cc cc.delete(@author.mail) if cc
end end
notified_users = [recipients, cc].flatten.compact.uniq
# Rails would log recipients only, not cc and bcc
mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
# Blind carbon copy recipients # Blind carbon copy recipients
if Setting.bcc_recipients? if Setting.bcc_recipients?
bcc(notified_users) bcc([recipients, cc].flatten.compact.uniq)
recipients [] recipients []
cc [] cc []
end end
@@ -421,10 +402,6 @@ class Mailer < ActionMailer::Base
@references_objects ||= [] @references_objects ||= []
@references_objects << object @references_objects << object
end end
def mylogger
RAILS_DEFAULT_LOGGER
end
end end
# Patch TMail so that message_id is not overwritten # Patch TMail so that message_id is not overwritten
-7
View File
@@ -71,13 +71,6 @@ class Member < ActiveRecord::Base
IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id] IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
end end
end end
# Find or initilize a Member with an id, attributes, and for a Principal
def self.edit_membership(id, new_attributes, principal=nil)
@membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
@membership.attributes = new_attributes
@membership
end
protected protected
+8 -1
View File
@@ -30,7 +30,7 @@ class Message < ActiveRecord::Base
:description => :content, :description => :content,
:type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'},
:url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id}.merge(o.parent_id.nil? ? {:id => o.id} : :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id}.merge(o.parent_id.nil? ? {:id => o.id} :
{:id => o.parent_id, :r => o.id, :anchor => "message-#{o.id}"})} {:id => o.parent_id, :anchor => "message-#{o.id}"})}
acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]}, acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]},
:author_key => :author_id :author_key => :author_id
@@ -90,6 +90,13 @@ class Message < ActiveRecord::Base
usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project))) usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
end end
# Returns the mail adresses of users that should be notified
def recipients
notified = project.notified_users
notified.reject! {|user| !visible?(user)}
notified.collect(&:mail)
end
private private
def add_author_as_watcher def add_author_as_watcher
+7
View File
@@ -33,6 +33,13 @@ class News < ActiveRecord::Base
!user.nil? && user.allowed_to?(:view_news, project) !user.nil? && user.allowed_to?(:view_news, project)
end end
# Returns the mail adresses of users that should be notified
def recipients
notified = project.notified_users
notified.reject! {|user| !visible?(user)}
notified.collect(&:mail)
end
# returns latest news for projects visible by user # returns latest news for projects visible by user
def self.latest(user = User.current, count = 5) def self.latest(user = User.current, count = 5)
find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
+3 -20
View File
@@ -58,7 +58,7 @@ class Project < ActiveRecord::Base
acts_as_customizable acts_as_customizable
acts_as_searchable :columns => ['name', 'identifier', 'description'], :project_key => 'id', :permission => nil acts_as_searchable :columns => ['name', 'identifier', 'description'], :project_key => 'id', :permission => nil
acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"}, acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"},
:url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}}, :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o.id}},
:author => nil :author => nil
attr_protected :status, :enabled_module_names attr_protected :status, :enabled_module_names
@@ -336,13 +336,6 @@ class Project < ActiveRecord::Base
end end
end end
end end
# Returns a scope of the Versions on subprojects
def rolled_up_versions
@rolled_up_versions ||=
Version.scoped(:include => :project,
:conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status = #{STATUS_ACTIVE}", lft, rgt])
end
# Returns a scope of the Versions used by the project # Returns a scope of the Versions used by the project
def shared_versions def shared_versions
@@ -564,12 +557,9 @@ class Project < ActiveRecord::Base
# value. Used to map the two togeather for issue relations. # value. Used to map the two togeather for issue relations.
issues_map = {} issues_map = {}
# Get issues sorted by root_id, lft so that parent issues project.issues.each do |issue|
# get copied before their children
project.issues.find(:all, :order => 'root_id, lft').each do |issue|
new_issue = Issue.new new_issue = Issue.new
new_issue.copy_from(issue) new_issue.copy_from(issue)
new_issue.project = self
# Reassign fixed_versions by name, since names are unique per # Reassign fixed_versions by name, since names are unique per
# project and the versions for self are not yet saved # project and the versions for self are not yet saved
if issue.fixed_version if issue.fixed_version
@@ -580,13 +570,6 @@ class Project < ActiveRecord::Base
if issue.category if issue.category
new_issue.category = self.issue_categories.select {|c| c.name == issue.category.name}.first new_issue.category = self.issue_categories.select {|c| c.name == issue.category.name}.first
end end
# Parent issue
if issue.parent_id
if copied_parent = issues_map[issue.parent_id]
new_issue.parent_issue_id = copied_parent.id
end
end
self.issues << new_issue self.issues << new_issue
issues_map[issue.id] = new_issue issues_map[issue.id] = new_issue
end end
@@ -656,7 +639,7 @@ class Project < ActiveRecord::Base
def allowed_permissions def allowed_permissions
@allowed_permissions ||= begin @allowed_permissions ||= begin
module_names = enabled_modules.all(:select => :name).collect {|m| m.name} module_names = enabled_modules.collect {|m| m.name}
Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name} Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
end end
end end
+4 -31
View File
@@ -27,11 +27,10 @@ class QueryColumn
self.groupable = name.to_s self.groupable = name.to_s
end end
self.default_order = options[:default_order] self.default_order = options[:default_order]
@caption_key = options[:caption] || "field_#{name}"
end end
def caption def caption
l(@caption_key) l("field_#{name}")
end end
# Returns true if the column is sortable, otherwise false # Returns true if the column is sortable, otherwise false
@@ -121,7 +120,6 @@ class Query < ActiveRecord::Base
@@available_columns = [ @@available_columns = [
QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true), QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true), QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true),
QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue),
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :groupable => true), QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :groupable => true),
QueryColumn.new(:priority, :sortable => "#{IssuePriority.table_name}.position", :default_order => 'desc', :groupable => true), QueryColumn.new(:priority, :sortable => "#{IssuePriority.table_name}.position", :default_order => 'desc', :groupable => true),
QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"), QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"),
@@ -187,11 +185,9 @@ class Query < ActiveRecord::Base
if project if project
user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] } user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] }
else else
project_ids = User.current.projects.collect(&:id) # members of the user's projects
if project_ids.any? # OPTIMIZE: Is selecting from users per project (N+1)
# members of the user's projects user_values += User.current.projects.collect(&:users).flatten.uniq.sort.collect{|s| [s.name, s.id.to_s] }
user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", project_ids]).sort.collect{|s| [s.name, s.id.to_s] }
end
end end
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty? @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty?
@available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values } unless user_values.empty? @available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values } unless user_values.empty?
@@ -243,13 +239,6 @@ class Query < ActiveRecord::Base
parms = expression.scan(/^(o|c|!\*|!|\*)?(.*)$/).first parms = expression.scan(/^(o|c|!\*|!|\*)?(.*)$/).first
add_filter field, (parms[0] || "="), [parms[1] || ""] add_filter field, (parms[0] || "="), [parms[1] || ""]
end end
# Add multiple filters using +add_filter+
def add_filters(fields, operators, values)
fields.each do |field|
add_filter(field, operators[field], values[field])
end
end
def has_filter?(field) def has_filter?(field)
filters and filters[field] filters and filters[field]
@@ -276,27 +265,11 @@ class Query < ActiveRecord::Base
IssueCustomField.find(:all) IssueCustomField.find(:all)
).collect {|cf| QueryCustomFieldColumn.new(cf) } ).collect {|cf| QueryCustomFieldColumn.new(cf) }
end end
def self.available_columns=(v)
self.available_columns = (v)
end
def self.add_available_column(column)
self.available_columns << (column) if column.is_a?(QueryColumn)
end
# Returns an array of columns that can be used to group the results # Returns an array of columns that can be used to group the results
def groupable_columns def groupable_columns
available_columns.select {|c| c.groupable} available_columns.select {|c| c.groupable}
end end
# Returns a Hash of columns and the key for sorting
def sortable_columns
{'id' => "#{Issue.table_name}.id"}.merge(available_columns.inject({}) {|h, column|
h[column.name.to_s] = column.sortable
h
})
end
def columns def columns
if has_default_columns? if has_default_columns?
+5 -1
View File
@@ -85,7 +85,11 @@ class Repository::Darcs < Repository
:comments => revision.message) :comments => revision.message)
revision.paths.each do |change| revision.paths.each do |change|
changeset.create_change(change) Change.create(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end end
next_rev += 1 next_rev += 1
end if revisions end if revisions
+5 -1
View File
@@ -78,7 +78,11 @@ class Repository::Mercurial < Repository
:comments => revision.message) :comments => revision.message)
revision.paths.each do |change| revision.paths.each do |change|
changeset.create_change(change) Change.create(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end end
end end
end unless revisions.nil? end unless revisions.nil?
+5 -1
View File
@@ -63,7 +63,11 @@ class Repository::Subversion < Repository
:comments => revision.message) :comments => revision.message)
revision.paths.each do |change| revision.paths.each do |change|
changeset.create_change(change) Change.create(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end unless changeset.new_record? end unless changeset.new_record?
end end
end unless revisions.nil? end unless revisions.nil?
+4 -20
View File
@@ -120,30 +120,14 @@ class Role < ActiveRecord::Base
find(:all, :conditions => {:builtin => 0}, :order => 'position') find(:all, :conditions => {:builtin => 0}, :order => 'position')
end end
# Return the builtin 'non member' role. If the role doesn't exist, # Return the builtin 'non member' role
# it will be created on the fly.
def self.non_member def self.non_member
non_member_role = find(:first, :conditions => {:builtin => BUILTIN_NON_MEMBER}) find(:first, :conditions => {:builtin => BUILTIN_NON_MEMBER}) || raise('Missing non-member builtin role.')
if non_member_role.nil?
non_member_role = create(:name => 'Non member', :position => 0) do |role|
role.builtin = BUILTIN_NON_MEMBER
end
raise 'Unable to create the non-member role.' if non_member_role.new_record?
end
non_member_role
end end
# Return the builtin 'anonymous' role. If the role doesn't exist, # Return the builtin 'anonymous' role
# it will be created on the fly.
def self.anonymous def self.anonymous
anonymous_role = find(:first, :conditions => {:builtin => BUILTIN_ANONYMOUS}) find(:first, :conditions => {:builtin => BUILTIN_ANONYMOUS}) || raise('Missing anonymous builtin role.')
if anonymous_role.nil?
anonymous_role = create(:name => 'Anonymous', :position => 0) do |role|
role.builtin = BUILTIN_ANONYMOUS
end
raise 'Unable to create the anonymous role.' if anonymous_role.new_record?
end
anonymous_role
end end
+1 -1
View File
@@ -97,7 +97,7 @@ class Setting < ActiveRecord::Base
end end
def value=(v) def value=(v)
v = v.to_yaml if v && @@available_settings[name] && @@available_settings[name]['serialized'] v = v.to_yaml if v && @@available_settings[name]['serialized']
write_attribute(:value, v.to_s) write_attribute(:value, v.to_s)
end end
+7 -29
View File
@@ -53,7 +53,7 @@ class User < Principal
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password, :group_ids attr_protected :login, :admin, :password, :password_confirmation, :hashed_password, :group_ids
validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }
validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false
# Login must contain lettres, numbers, underscores only # Login must contain lettres, numbers, underscores only
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
@@ -71,7 +71,7 @@ class User < Principal
def before_save def before_save
# update hashed_password if password was set # update hashed_password if password was set
self.hashed_password = User.hash_password(self.password) if self.password && self.auth_source_id.blank? self.hashed_password = User.hash_password(self.password) if self.password
end end
def reload(*args) def reload(*args)
@@ -96,7 +96,7 @@ class User < Principal
def self.try_to_login(login, password) def self.try_to_login(login, password)
# Make sure no one can sign in with an empty password # Make sure no one can sign in with an empty password
return nil if password.to_s.empty? return nil if password.to_s.empty?
user = find_by_login(login) user = find(:first, :conditions => ["login=?", login])
if user if user
# user is already in local database # user is already in local database
return nil if !user.active? return nil if !user.active?
@@ -111,12 +111,12 @@ class User < Principal
# user is not yet registered, try to authenticate with available sources # user is not yet registered, try to authenticate with available sources
attrs = AuthSource.authenticate(login, password) attrs = AuthSource.authenticate(login, password)
if attrs if attrs
user = new(attrs) user = new(*attrs)
user.login = login user.login = login
user.language = Setting.default_language user.language = Setting.default_language
if user.save if user.save
user.reload user.reload
logger.info("User '#{user.login}' created from external auth source: #{user.auth_source.type} - #{user.auth_source.name}") if logger && user.auth_source logger.info("User '#{user.login}' created from the LDAP") if logger
end end
end end
end end
@@ -161,17 +161,7 @@ class User < Principal
end end
def check_password?(clear_password) def check_password?(clear_password)
if auth_source_id.present? User.hash_password(clear_password) == self.hashed_password
auth_source.authenticate(self.login, clear_password)
else
User.hash_password(clear_password) == self.hashed_password
end
end
# Does the backend storage allow this user to change their password?
def change_password_allowed?
return true if auth_source_id.blank?
return auth_source.allow_password_changes?
end end
# Generate and set a random password. Useful for automated user creation # Generate and set a random password. Useful for automated user creation
@@ -221,19 +211,7 @@ class User < Principal
@notified_projects_ids = nil @notified_projects_ids = nil
notified_projects_ids notified_projects_ids
end end
# Find a user account by matching the exact login and then a case-insensitive
# version. Exact matches will be given priority.
def self.find_by_login(login)
# force string comparison to be case sensitive on MySQL
type_cast = (ActiveRecord::Base.connection.adapter_name == 'MySQL') ? 'BINARY' : ''
# First look for an exact match
user = first(:conditions => ["#{type_cast} login = ?", login])
# Fail over to case-insensitive if none was found
user ||= first(:conditions => ["#{type_cast} LOWER(login) = ?", login.to_s.downcase])
end
def self.find_by_rss_key(key) def self.find_by_rss_key(key)
token = Token.find_by_value(key) token = Token.find_by_value(key)
token && token.user.active? ? token.user : nil token && token.user.active? ? token.user : nil
+5 -18
View File
@@ -51,9 +51,8 @@ class Version < ActiveRecord::Base
end end
# Returns the total estimated time for this version # Returns the total estimated time for this version
# (sum of leaves estimated_hours)
def estimated_hours def estimated_hours
@estimated_hours ||= fixed_issues.leaves.sum(:estimated_hours).to_f @estimated_hours ||= fixed_issues.sum(:estimated_hours).to_f
end end
# Returns the total reported time for this version # Returns the total reported time for this version
@@ -124,25 +123,13 @@ class Version < ActiveRecord::Base
def to_s; name end def to_s; name end
# Versions are sorted by effective_date and "Project Name - Version name" # Versions are sorted by effective_date and name
# Those with no effective_date are at the end, sorted by "Project Name - Version name" # Those with no effective_date are at the end, sorted by name
def <=>(version) def <=>(version)
if self.effective_date if self.effective_date
if version.effective_date version.effective_date ? (self.effective_date == version.effective_date ? self.name <=> version.name : self.effective_date <=> version.effective_date) : -1
if self.effective_date == version.effective_date
"#{self.project.name} - #{self.name}" <=> "#{version.project.name} - #{version.name}"
else
self.effective_date <=> version.effective_date
end
else
-1
end
else else
if version.effective_date version.effective_date ? 1 : (self.name <=> version.name)
1
else
"#{self.project.name} - #{self.name}" <=> "#{version.project.name} - #{version.name}"
end
end end
end end
-6
View File
@@ -29,12 +29,6 @@ class Wiki < ActiveRecord::Base
!user.nil? && user.allowed_to?(:view_wiki_pages, project) !user.nil? && user.allowed_to?(:view_wiki_pages, project)
end end
# Returns the wiki page that acts as the sidebar content
# or nil if no such page exists
def sidebar
@sidebar ||= find_page('Sidebar', :with_redirect => false)
end
# find the page with the given title # find the page with the given title
# if page doesn't exist, return a new page # if page doesn't exist, return a new page
def find_or_new_page(title) def find_or_new_page(title)
-4
View File
@@ -34,10 +34,6 @@ class WikiContent < ActiveRecord::Base
page.project page.project
end end
def attachments
page.nil? ? [] : page.attachments
end
# Returns the mail adresses of users that should be notified # Returns the mail adresses of users that should be notified
def recipients def recipients
notified = project.notified_users notified = project.notified_users
-9
View File
@@ -41,15 +41,6 @@ class WikiPage < ActiveRecord::Base
validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
validates_associated :content validates_associated :content
# Wiki pages that are protected by default
DEFAULT_PROTECTED_PAGES = %w(sidebar)
def after_initialize
if new_record? && DEFAULT_PROTECTED_PAGES.include?(title.to_s.downcase)
self.protected = true
end
end
def visible?(user=User.current) def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_wiki_pages, project) !user.nil? && user.allowed_to?(:view_wiki_pages, project)
end end
+1 -1
View File
@@ -32,7 +32,7 @@ class Workflow < ActiveRecord::Base
trackers.each do |tracker| trackers.each do |tracker|
t = [] t = []
roles.each do |role| roles.each do |role|
row = counts.detect {|c| c['role_id'].to_s == role.id.to_s && c['tracker_id'].to_s == tracker.id.to_s} row = counts.detect {|c| c['role_id'] == role.id.to_s && c['tracker_id'] == tracker.id.to_s}
t << [role, (row.nil? ? 0 : row['c'].to_i)] t << [role, (row.nil? ? 0 : row['c'].to_i)]
end end
result << [tracker, t] result << [tracker, t]
-1
View File
@@ -3,7 +3,6 @@
<li><%= link_to l(:label_project_plural), {:controller => 'admin', :action => 'projects'}, :class => 'projects' %></li> <li><%= link_to l(:label_project_plural), {:controller => 'admin', :action => 'projects'}, :class => 'projects' %></li>
<li><%= link_to l(:label_user_plural), {:controller => 'users'}, :class => 'users' %></li> <li><%= link_to l(:label_user_plural), {:controller => 'users'}, :class => 'users' %></li>
<li><%= link_to l(:label_group_plural), {:controller => 'groups'}, :class => 'groups' %></li> <li><%= link_to l(:label_group_plural), {:controller => 'groups'}, :class => 'groups' %></li>
<li><%= link_to l(:label_ldap_authentication), :controller => 'ldap_auth_sources', :action => 'index' %></li>
<li><%= link_to l(:label_role_and_permissions), {:controller => 'roles'}, :class => 'roles' %></li> <li><%= link_to l(:label_role_and_permissions), {:controller => 'roles'}, :class => 'roles' %></li>
<li><%= link_to l(:label_tracker_plural), {:controller => 'trackers'}, :class => 'trackers' %></li> <li><%= link_to l(:label_tracker_plural), {:controller => 'trackers'}, :class => 'trackers' %></li>
<li><%= link_to l(:label_issue_status_plural), {:controller => 'issue_statuses'}, :class => 'issue_statuses' %></li> <li><%= link_to l(:label_issue_status_plural), {:controller => 'issue_statuses'}, :class => 'issue_statuses' %></li>
+4 -4
View File
@@ -25,11 +25,11 @@
<th></th> <th></th>
</tr></thead> </tr></thead>
<tbody> <tbody>
<% project_tree(@projects) do |project, level| %> <% for project in @projects %>
<tr class="<%= cycle("odd", "even") %> <%= css_project_classes(project) %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> <tr class="<%= cycle("odd", "even") %> <%= css_project_classes(project) %>">
<td class="name"><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %></td> <td class="name" style="padding-left: <%= project.level %>em;"><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %></td>
<td><%= textilizable project.short_description, :project => project %></td> <td><%= textilizable project.short_description, :project => project %></td>
<td align="center"><%= checked_image project.is_public? %></td> <td align="center"><%= image_tag 'true.png' if project.is_public? %></td>
<td align="center"><%= format_date(project.created_on) %></td> <td align="center"><%= format_date(project.created_on) %></td>
<td class="buttons"> <td class="buttons">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') if project.active? %> <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') if project.active? %>
+2 -2
View File
@@ -1,7 +1,7 @@
<span id="attachments_fields"> <span id="attachments_fields">
<%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil -%> <%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil -%>
<label class="inline"><span id="attachment_description_label_content"><%= l(:label_optional_description) %></span><%= text_field_tag 'attachments[1][description]', '', :size => 60, :id => nil %> <%= text_field_tag 'attachments[1][description]', '', :size => 60, :id => nil %>
</label> <em><%= l(:label_optional_description) %></em>
</span> </span>
<br /> <br />
<small><%= link_to l(:label_add_another_file), '#', :onclick => 'addFileField(); return false;' %> <small><%= link_to l(:label_add_another_file), '#', :onclick => 'addFileField(); return false;' %>
-13
View File
@@ -1,13 +0,0 @@
<%= error_messages_for 'auth_source' %>
<div class="box">
<!--[form:auth_source]-->
<p><label for="auth_source_name"><%=l(:field_name)%> <span class="required">*</span></label>
<%= text_field 'auth_source', 'name' %></p>
<p><label for="auth_source_onthefly_register"><%=l(:field_onthefly)%></label>
<%= check_box 'auth_source', 'onthefly_register' %></p>
</div>
<!--[eoform:auth_source]-->
+1 -1
View File
@@ -42,7 +42,7 @@
<tbody> <tbody>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"> <tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
<td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic } %></td> <td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic }, :class => 'icon' %></td>
<td class="author" align="center"><%= topic.author %></td> <td class="author" align="center"><%= topic.author %></td>
<td class="created_on" align="center"><%= format_time(topic.created_on) %></td> <td class="created_on" align="center"><%= format_time(topic.created_on) %></td>
<td class="replies" align="center"><%= topic.replies_count %></td> <td class="replies" align="center"><%= topic.replies_count %></td>
+10 -3
View File
@@ -1,17 +1,24 @@
<table class="cal"> <table class="cal">
<thead> <thead>
<tr><th scope="col" title="<%= l(:label_week) %>" class="week-number"></th><% 7.times do |i| %><th scope="col"><%= day_name( (calendar.first_wday+i)%7 ) %></th><% end %></tr> <tr><td></td><% 7.times do |i| %><th><%= day_name( (calendar.first_wday+i)%7 ) %></th><% end %></tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<% day = calendar.startdt <% day = calendar.startdt
while day <= calendar.enddt %> while day <= calendar.enddt %>
<%= "<td class='week-number' title='#{ l(:label_week) }'>#{(day+(11-day.cwday)%7).cweek}</td>" if day.cwday == calendar.first_wday %> <%= "<th>#{day.cweek}</th>" if day.cwday == calendar.first_wday %>
<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if Date.today == day %>"> <td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if Date.today == day %>">
<p class="day-num"><%= day.day %></p> <p class="day-num"><%= day.day %></p>
<% calendar.events_on(day).each do |i| %> <% calendar.events_on(day).each do |i| %>
<% if i.is_a? Issue %> <% if i.is_a? Issue %>
<div class="<%= i.css_classes %> <%= 'starting' if day == i.start_date %> <%= 'ending' if day == i.due_date %> tooltip"> <div class="<%= i.css_classes %> tooltip">
<%= if day == i.start_date && day == i.due_date
image_tag('arrow_bw.png')
elsif day == i.start_date
image_tag('arrow_from.png')
elsif day == i.due_date
image_tag('arrow_to.png')
end %>
<%= h("#{i.project} -") unless @project && @project == i.project %> <%= h("#{i.project} -") unless @project && @project == i.project %>
<%= link_to_issue i, :truncate => 30 %> <%= link_to_issue i, :truncate => 30 %>
<span class="tip"><%= render_issue_tooltip i %></span> <span class="tip"><%= render_issue_tooltip i %></span>
+2 -2
View File
@@ -2,7 +2,7 @@
<% diff.each do |table_file| -%> <% diff.each do |table_file| -%>
<div class="autoscroll"> <div class="autoscroll">
<% if diff_type == 'sbs' -%> <% if diff_type == 'sbs' -%>
<table class="filecontent"> <table class="filecontent CodeRay">
<thead> <thead>
<tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr> <tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr>
</thead> </thead>
@@ -29,7 +29,7 @@
</table> </table>
<% else -%> <% else -%>
<table class="filecontent syntaxhl"> <table class="filecontent CodeRay">
<thead> <thead>
<tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr> <tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr>
</thead> </thead>
+1 -1
View File
@@ -1,5 +1,5 @@
<div class="autoscroll"> <div class="autoscroll">
<table class="filecontent syntaxhl"> <table class="filecontent CodeRay">
<tbody> <tbody>
<% line_num = 1 %> <% line_num = 1 %>
<% syntax_highlight(filename, to_utf8(content)).each_line do |line| %> <% syntax_highlight(filename, to_utf8(content)).each_line do |line| %>
-1
View File
@@ -90,7 +90,6 @@ when "IssueCustomField" %>
<% when "ProjectCustomField" %> <% when "ProjectCustomField" %>
<p><%= f.check_box :is_required %></p> <p><%= f.check_box :is_required %></p>
<p><%= f.check_box :searchable %></p>
<% when "TimeEntryCustomField" %> <% when "TimeEntryCustomField" %>
<p><%= f.check_box :is_required %></p> <p><%= f.check_box :is_required %></p>
+3 -3
View File
@@ -14,10 +14,10 @@
<% (@custom_fields_by_type[tab[:name]] || []).sort.each do |custom_field| -%> <% (@custom_fields_by_type[tab[:name]] || []).sort.each do |custom_field| -%>
<tr class="<%= cycle("odd", "even") %>"> <tr class="<%= cycle("odd", "even") %>">
<td><%= link_to custom_field.name, :action => 'edit', :id => custom_field %></td> <td><%= link_to custom_field.name, :action => 'edit', :id => custom_field %></td>
<td align="center"><%= l(Redmine::CustomFieldFormat.label_for(custom_field.field_format)) %></td> <td align="center"><%= l(CustomField::FIELD_FORMATS[custom_field.field_format][:name]) %></td>
<td align="center"><%= checked_image custom_field.is_required? %></td> <td align="center"><%= image_tag 'true.png' if custom_field.is_required? %></td>
<% if tab[:name] == 'IssueCustomField' %> <% if tab[:name] == 'IssueCustomField' %>
<td align="center"><%= checked_image custom_field.is_for_all? %></td> <td align="center"><%= image_tag 'true.png' if custom_field.is_for_all? %></td>
<td align="center"><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> <td align="center"><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
<% end %> <% end %>
<td align="center" style="width:15%;"><%= reorder_links('custom_field', {:action => 'edit', :id => custom_field}) %></td> <td align="center" style="width:15%;"><%= reorder_links('custom_field', {:action => 'edit', :id => custom_field}) %></td>
+3 -6
View File
@@ -1,6 +1,3 @@
<h4><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %></h4> <p><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %><br />
<p><em><%= format_time(document.updated_on) %></em></p> <% unless document.description.blank? %><%=h(truncate(document.description, :length => 250)) %><br /><% end %>
<em><%= format_time(document.updated_on) %></em></p>
<div class="wiki">
<%= textilizable(truncate_lines(document.description)) %>
</div>
+4 -4
View File
@@ -5,19 +5,19 @@
<% enumerations = klass.shared %> <% enumerations = klass.shared %>
<% if enumerations.any? %> <% if enumerations.any? %>
<table class="list"><thead> <table class="list">
<tr> <tr>
<th><%= l(:field_name) %></th> <th><%= l(:field_name) %></th>
<th style="width:15%;"><%= l(:field_is_default) %></th> <th style="width:15%;"><%= l(:field_is_default) %></th>
<th style="width:15%;"><%= l(:field_active) %></th> <th style="width:15%;"><%= l(:field_active) %></th>
<th style="width:15%;"></th> <th style="width:15%;"></th>
<th align="center" style="width:10%;"> </th> <th align="center" style="width:10%;"> </th>
</tr></thead> </tr>
<% enumerations.each do |enumeration| %> <% enumerations.each do |enumeration| %>
<tr class="<%= cycle('odd', 'even') %>"> <tr class="<%= cycle('odd', 'even') %>">
<td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td> <td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td>
<td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td> <td class="center" style="width:15%;"><%= image_tag('true.png') if enumeration.is_default? %></td>
<td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td> <td class="center" style="width:15%;"><%= image_tag('true.png') if enumeration.active? %></td>
<td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td> <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td>
<td class="buttons"> <td class="buttons">
<%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration },
+2 -2
View File
@@ -4,11 +4,11 @@
<div class="splitcontentleft"> <div class="splitcontentleft">
<% if @group.memberships.any? %> <% if @group.memberships.any? %>
<table class="list memberships"> <table class="list memberships">
<thead><tr> <thead>
<th><%= l(:label_project) %></th> <th><%= l(:label_project) %></th>
<th><%= l(:label_role_plural) %></th> <th><%= l(:label_role_plural) %></th>
<th style="width:15%"></th> <th style="width:15%"></th>
</tr></thead> </thead>
<tbody> <tbody>
<% @group.memberships.each do |membership| %> <% @group.memberships.each do |membership| %>
<% next if membership.new_record? %> <% next if membership.new_record? %>
+2 -2
View File
@@ -1,10 +1,10 @@
<div class="splitcontentleft"> <div class="splitcontentleft">
<% if @group.users.any? %> <% if @group.users.any? %>
<table class="list users"> <table class="list users">
<thead><tr> <thead>
<th><%= l(:label_user) %></th> <th><%= l(:label_user) %></th>
<th style="width:15%"></th> <th style="width:15%"></th>
</tr></thead> </thead>
<tbody> <tbody>
<% @group.users.sort.each do |user| %> <% @group.users.sort.each do |user| %>
<tr id="user-<%= user.id %>" class="<%= cycle 'odd', 'even' %>"> <tr id="user-<%= user.id %>" class="<%= cycle 'odd', 'even' %>">
@@ -23,8 +23,8 @@
<% if Issue.use_status_for_done_ratio? %> <% if Issue.use_status_for_done_ratio? %>
<td align="center"><%= h status.default_done_ratio %></td> <td align="center"><%= h status.default_done_ratio %></td>
<% end %> <% end %>
<td align="center"><%= checked_image status.is_default? %></td> <td align="center"><%= image_tag 'true.png' if status.is_default? %></td>
<td align="center"><%= checked_image status.is_closed? %></td> <td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>
<td align="center" style="width:15%;"><%= reorder_links('issue_status', {:action => 'update', :id => status}) %></td> <td align="center" style="width:15%;"><%= reorder_links('issue_status', {:action => 'update', :id => status}) %></td>
<td class="buttons"> <td class="buttons">
<%= link_to(l(:button_delete), { :action => 'destroy', :id => status }, <%= link_to(l(:button_delete), { :action => 'destroy', :id => status },
+9 -9
View File
@@ -7,34 +7,34 @@
<p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p> <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p>
<% end %> <% end %>
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p> <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
<p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p> <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
<% unless @project.issue_categories.empty? %> <% unless @project.issue_categories.empty? %>
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
<%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'),
l(:label_issue_category_new), l(:label_issue_category_new),
'category[name]', 'category[name]',
{:controller => 'issue_categories', :action => 'new', :project_id => @project}, {:controller => 'projects', :action => 'add_issue_category', :id => @project},
:title => l(:label_issue_category_new), :title => l(:label_issue_category_new),
:tabindex => 199) if authorize_for('issue_categories', 'new') %></p> :tabindex => 199) if authorize_for('projects', 'add_issue_category') %></p>
<% end %> <% end %>
<% unless @issue.assignable_versions.empty? %> <% unless @issue.assignable_versions.empty? %>
<p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %> <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %>
<%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'),
l(:label_version_new), l(:label_version_new),
'version[name]', 'version[name]',
{:controller => 'versions', :action => 'new', :project_id => @project}, {:controller => 'projects', :action => 'add_version', :id => @project},
:title => l(:label_version_new), :title => l(:label_version_new),
:tabindex => 200) if authorize_for('versions', 'new') %> :tabindex => 200) if authorize_for('projects', 'add_version') %>
</p> </p>
<% end %> <% end %>
</div> </div>
<div class="splitcontentright"> <div class="splitcontentright">
<p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p> <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
<p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p> <p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
<p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf? %> <%= l(:field_hours) %></p> <p><%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %></p>
<% if @issue.leaf? && Issue.use_field_for_done_ratio? %> <% if Issue.use_field_for_done_ratio? %>
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p> <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
<% end %> <% end %>
</div> </div>
+3 -3
View File
@@ -1,10 +1,10 @@
<% labelled_tabular_form_for :issue, @issue, <% labelled_tabular_form_for :issue, @issue,
:url => {:action => 'update', :id => @issue}, :url => {:action => 'edit', :id => @issue},
:html => {:id => 'issue-form', :html => {:id => 'issue-form',
:class => nil, :class => nil,
:method => :put,
:multipart => true} do |f| %> :multipart => true} do |f| %>
<%= error_messages_for 'issue', 'time_entry' %> <%= error_messages_for 'issue' %>
<%= error_messages_for 'time_entry' %>
<div class="box"> <div class="box">
<% if @edit_allowed || !@allowed_statuses.empty? %> <% if @edit_allowed || !@allowed_statuses.empty? %>
<fieldset class="tabular"><legend><%= l(:label_change_properties) %> <fieldset class="tabular"><legend><%= l(:label_change_properties) %>
+1 -11
View File
@@ -5,16 +5,6 @@
:with => "Form.serialize('issue-form')" %> :with => "Form.serialize('issue-form')" %>
<p><%= f.text_field :subject, :size => 80, :required => true %></p> <p><%= f.text_field :subject, :size => 80, :required => true %></p>
<% unless (@issue.new_record? && @issue.parent_issue_id.nil?) || !User.current.allowed_to?(:manage_subtasks, @project) %>
<p><%= f.text_field :parent_issue_id, :size => 10 %></p>
<div id="parent_issue_candidates" class="autocomplete"></div>
<%= javascript_tag "observeParentIssueField('#{url_for(:controller => :issues,
:action => :auto_complete,
:id => @issue,
:project_id => @project) }')" %>
<% end %>
<p><%= f.text_area :description, <p><%= f.text_area :description,
:cols => 60, :cols => 60,
:rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
@@ -27,7 +17,7 @@
</div> </div>
<% if @issue.new_record? %> <% if @issue.new_record? %>
<p><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p> <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
<% end %> <% end %>
<% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%> <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
+4 -6
View File
@@ -6,14 +6,12 @@
<%= content_tag('a', '', :name => "note-#{journal.indice}")%> <%= content_tag('a', '', :name => "note-#{journal.indice}")%>
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %></h4> <%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %></h4>
<% if journal.details.any? %> <ul>
<ul class="details"> <% for detail in journal.details %>
<% for detail in journal.details %>
<li><%= show_detail(detail) %></li> <li><%= show_detail(detail) %></li>
<% end %>
</ul>
<% end %> <% end %>
<%= render_notes(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %> </ul>
<%= render_notes(journal, :reply_links => reply_links) unless journal.notes.blank? %>
</div> </div>
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
<% end %> <% end %>
+2 -2
View File
@@ -13,7 +13,7 @@
</tr></thead> </tr></thead>
<% previous_group = false %> <% previous_group = false %>
<tbody> <tbody>
<% issue_list(issues) do |issue, level| -%> <% issues.each do |issue| -%>
<% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %> <% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %>
<% reset_cycle %> <% reset_cycle %>
<tr class="group open"> <tr class="group open">
@@ -24,7 +24,7 @@
</tr> </tr>
<% previous_group = group %> <% previous_group = group %>
<% end %> <% end %>
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
<td class="checkbox"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td> <td class="checkbox"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
<td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> <td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
<% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %> <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %>
+1 -1
View File
@@ -12,7 +12,7 @@
<tr> <tr>
<td><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %> <td><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %>
<%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %> <%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %>
<%= link_to_issue(relation.other_issue(@issue), :truncate => 60) %> <%= link_to_issue relation.other_issue(@issue) %>
</td> </td>
<td><%= relation.other_issue(@issue).status.name %></td> <td><%= relation.other_issue(@issue).status.name %></td>
<td><%= format_date(relation.other_issue(@issue).start_date) %></td> <td><%= format_date(relation.other_issue(@issue).start_date) %></td>
+1 -1
View File
@@ -9,7 +9,7 @@
<%= link_to(l(:label_calendar), :controller => 'issues', :action => 'calendar', :project_id => @project) %><br /> <%= link_to(l(:label_calendar), :controller => 'issues', :action => 'calendar', :project_id => @project) %><br />
<% end %> <% end %>
<% if User.current.allowed_to?(:view_gantt, @project, :global => true) %> <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %>
<%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %><br /> <%= link_to(l(:label_gantt), :controller => 'issues', :action => 'gantt', :project_id => @project) %><br />
<% end %> <% end %>
<%= call_hook(:view_issues_sidebar_planning_bottom) %> <%= call_hook(:view_issues_sidebar_planning_bottom) %>
-9
View File
@@ -1,9 +0,0 @@
<ul>
<% if @issues.any? -%>
<% @issues.each do |issue| -%>
<%= content_tag 'li', h("#{issue.tracker} ##{issue.id}: #{issue.subject}"), :id => issue.id %>
<% end -%>
<% else -%>
<%= content_tag("li", l(:label_none), :style => 'display:none') %>
<% end -%>
</ul>
+11 -11
View File
@@ -5,45 +5,45 @@
<% form_tag() do %> <% form_tag() do %>
<%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %> <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %>
<div class="box tabular"> <div class="box tabular">
<fieldset class="attributes"> <fieldset>
<legend><%= l(:label_change_properties) %></legend> <legend><%= l(:label_change_properties) %></legend>
<div class="splitcontentleft"> <div class="splitcontentleft">
<p> <p>
<label><%= l(:field_tracker) %></label> <label><%= l(:field_tracker) %></label>
<%= select_tag('issue[tracker_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@project.trackers, :id, :name)) %> <%= select_tag('tracker_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@project.trackers, :id, :name)) %>
</p> </p>
<% if @available_statuses.any? %> <% if @available_statuses.any? %>
<p> <p>
<label><%= l(:field_status) %></label> <label><%= l(:field_status) %></label>
<%= select_tag('issue[status_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %> <%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %>
</p> </p>
<% end %> <% end %>
<p> <p>
<label><%= l(:field_priority) %></label> <label><%= l(:field_priority) %></label>
<%= select_tag('issue[priority_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %> <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
</p> </p>
<p> <p>
<label><%= l(:field_assigned_to) %></label> <label><%= l(:field_assigned_to) %></label>
<%= select_tag('issue[assigned_to_id]', content_tag('option', l(:label_no_change_option), :value => '') + <%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') + content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@project.assignable_users, :id, :name)) %> options_from_collection_for_select(@project.assignable_users, :id, :name)) %>
</p> </p>
<p> <p>
<label><%= l(:field_category) %></label> <label><%= l(:field_category) %></label>
<%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') + <%= select_tag('category_id', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') + content_tag('option', l(:label_none), :value => 'none') +
options_from_collection_for_select(@project.issue_categories, :id, :name)) %> options_from_collection_for_select(@project.issue_categories, :id, :name)) %>
</p> </p>
<p> <p>
<label><%= l(:field_fixed_version) %></label> <label><%= l(:field_fixed_version) %></label>
<%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') + <%= select_tag('fixed_version_id', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') + content_tag('option', l(:label_none), :value => 'none') +
version_options_for_select(@project.shared_versions.open)) %> version_options_for_select(@project.shared_versions.open)) %>
</p> </p>
<% @custom_fields.each do |custom_field| %> <% @custom_fields.each do |custom_field| %>
<p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('issue', custom_field) %></p> <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit(custom_field) %></p>
<% end %> <% end %>
<%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %> <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>
@@ -52,16 +52,16 @@
<div class="splitcontentright"> <div class="splitcontentright">
<p> <p>
<label><%= l(:field_start_date) %></label> <label><%= l(:field_start_date) %></label>
<%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %> <%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
</p> </p>
<p> <p>
<label><%= l(:field_due_date) %></label> <label><%= l(:field_due_date) %></label>
<%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %> <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
</p> </p>
<% if Issue.use_field_for_done_ratio? %> <% if Issue.use_field_for_done_ratio? %>
<p> <p>
<label><%= l(:field_done_ratio) %></label> <label><%= l(:field_done_ratio) %></label>
<%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %> <%= select_tag 'done_ratio', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>
</p> </p>
<% end %> <% end %>
</div> </div>
@@ -11,18 +11,16 @@
<p style="float:right;"> <p style="float:right;">
<%= link_to_remote ('&#171; ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), <%= link_to_remote ('&#171; ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
{:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }},
{:href => url_for(:action => 'show', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}
%> | %> |
<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' &#187;'), <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' &#187;'),
{:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }},
{:href => url_for(:action => 'show', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}
%> %>
</p> </p>
<p class="buttons"> <p class="buttons">
<%= label_tag('month', l(:label_month)) %>
<%= select_month(@month, :prefix => "month", :discard_type => true) %> <%= select_month(@month, :prefix => "month", :discard_type => true) %>
<%= label_tag('year', l(:label_year)) %>
<%= select_year(@year, :prefix => "year", :discard_type => true) %> <%= select_year(@year, :prefix => "year", :discard_type => true) %>
<%= link_to_remote l(:button_apply), <%= link_to_remote l(:button_apply),
@@ -42,11 +40,9 @@
<% if @query.valid? %> <% if @query.valid? %>
<%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %> <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
<p class="legend cal"> <%= image_tag 'arrow_from.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_day) %><br />
<span class="starting"><%= l(:text_tip_task_begin_day) %></span> <%= image_tag 'arrow_to.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_end_day) %><br />
<span class="ending"><%= l(:text_tip_task_end_day) %></span> <%= image_tag 'arrow_bw.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_end_day) %><br />
<span class="starting ending"><%= l(:text_tip_task_begin_end_day) %></span>
</p>
<% end %> <% end %>
<% content_for :sidebar do %> <% content_for :sidebar do %>
+9 -9
View File
@@ -23,7 +23,7 @@
<a href="#" class="submenu"><%= l(:field_tracker) %></a> <a href="#" class="submenu"><%= l(:field_tracker) %></a>
<ul> <ul>
<% @trackers.each do |t| -%> <% @trackers.each do |t| -%>
<li><%= context_menu_link t.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'tracker_id' => t}, :back_url => @back}, :method => :post, <li><%= context_menu_link t.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'tracker_id' => t, :back_url => @back}, :method => :post,
:selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li> :selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li>
<% end -%> <% end -%>
</ul> </ul>
@@ -33,7 +33,7 @@
<a href="#" class="submenu"><%= l(:field_priority) %></a> <a href="#" class="submenu"><%= l(:field_priority) %></a>
<ul> <ul>
<% @priorities.each do |p| -%> <% @priorities.each do |p| -%>
<li><%= context_menu_link p.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'priority_id' => p}, :back_url => @back}, :method => :post, <li><%= context_menu_link p.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'priority_id' => p, :back_url => @back}, :method => :post,
:selected => (@issue && p == @issue.priority), :disabled => !@can[:edit] %></li> :selected => (@issue && p == @issue.priority), :disabled => !@can[:edit] %></li>
<% end -%> <% end -%>
</ul> </ul>
@@ -43,10 +43,10 @@
<a href="#" class="submenu"><%= l(:field_fixed_version) %></a> <a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
<ul> <ul>
<% @project.shared_versions.open.sort.each do |v| -%> <% @project.shared_versions.open.sort.each do |v| -%>
<li><%= context_menu_link format_version_name(v), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => v}, :back_url => @back}, :method => :post, <li><%= context_menu_link format_version_name(v), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => v, :back_url => @back}, :method => :post,
:selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li> :selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
<% end -%> <% end -%>
<li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => 'none'}, :back_url => @back}, :method => :post, <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => 'none', :back_url => @back}, :method => :post,
:selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li> :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
</ul> </ul>
</li> </li>
@@ -56,10 +56,10 @@
<a href="#" class="submenu"><%= l(:field_assigned_to) %></a> <a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
<ul> <ul>
<% @assignables.each do |u| -%> <% @assignables.each do |u| -%>
<li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => u}, :back_url => @back}, :method => :post, <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'assigned_to_id' => u, :back_url => @back}, :method => :post,
:selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li> :selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>
<% end -%> <% end -%>
<li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => 'none'}, :back_url => @back}, :method => :post, <li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'assigned_to_id' => 'none', :back_url => @back}, :method => :post,
:selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li> :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
</ul> </ul>
</li> </li>
@@ -69,10 +69,10 @@
<a href="#" class="submenu"><%= l(:field_category) %></a> <a href="#" class="submenu"><%= l(:field_category) %></a>
<ul> <ul>
<% @project.issue_categories.each do |u| -%> <% @project.issue_categories.each do |u| -%>
<li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => u}, :back_url => @back}, :method => :post, <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'category_id' => u, :back_url => @back}, :method => :post,
:selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li> :selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li>
<% end -%> <% end -%>
<li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => 'none'}, :back_url => @back}, :method => :post, <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'category_id' => 'none', :back_url => @back}, :method => :post,
:selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li> :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
</ul> </ul>
</li> </li>
@@ -82,7 +82,7 @@
<a href="#" class="submenu"><%= l(:field_done_ratio) %></a> <a href="#" class="submenu"><%= l(:field_done_ratio) %></a>
<ul> <ul>
<% (0..10).map{|x|x*10}.each do |p| -%> <% (0..10).map{|x|x*10}.each do |p| -%>
<li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'done_ratio' => p}, :back_url => @back}, :method => :post, <li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'done_ratio' => p, :back_url => @back}, :method => :post,
:selected => (@issue && p == @issue.done_ratio), :disabled => !@can[:edit] %></li> :selected => (@issue && p == @issue.done_ratio), :disabled => !@can[:edit] %></li>
<% end -%> <% end -%>
</ul> </ul>

Some files were not shown because too many files have changed in this diff Show More