##// END OF EJS Templates
Merged r1379 to r1385 from trunk....
Jean-Philippe Lang -
r1372:914d1e6645fd
parent child
Show More
This diff has been collapsed as it changes many lines, (623 lines changed) Show them Hide them
@@ -0,0 +1,623
1 _gloc_rule_default: '|n| n==1 ? "" : "_plural" '
2
3 actionview_datehelper_select_day_prefix:
4 actionview_datehelper_select_month_names: มกราคม,กุมภาพันธ์,มีนาคม,เมษายน,พฤษภาคม,มิถุนายน,กรกฎาคม,สิงหาคม,กันยายน,ตุลาคม,พฤศจิกายน,ธันวาคม
5 actionview_datehelper_select_month_names_abbr: ม.ค.,ก.พ.,มี.ค.,เม.ย.,พ.ค.,มิ.ย.,ก.ค.,ส.ค.,ก.ย.,ต.ค.,พ.ย.,ธ.ค.
6 actionview_datehelper_select_month_prefix:
7 actionview_datehelper_select_year_prefix:
8 actionview_datehelper_time_in_words_day: 1 วัน
9 actionview_datehelper_time_in_words_day_plural: %d วัน
10 actionview_datehelper_time_in_words_hour_about: ประมาณ 1 ชั่วโมง
11 actionview_datehelper_time_in_words_hour_about_plural: ประมาณ %d ชั่วโมง
12 actionview_datehelper_time_in_words_hour_about_single: ประมาณ 1 ชั่วโมง
13 actionview_datehelper_time_in_words_minute: 1 นาที
14 actionview_datehelper_time_in_words_minute_half: ครึ่งนาที
15 actionview_datehelper_time_in_words_minute_less_than: ไม่ถึงนาที
16 actionview_datehelper_time_in_words_minute_plural: %d นาที
17 actionview_datehelper_time_in_words_minute_single: 1 นาที
18 actionview_datehelper_time_in_words_second_less_than: ไม่ถึงวินาที
19 actionview_datehelper_time_in_words_second_less_than_plural: ไม่ถึง %d วินาที
20 actionview_instancetag_blank_option: กรุณาเลือก
21
22 activerecord_error_inclusion: ไม่อยู่ในรายการ
23 activerecord_error_exclusion: ถูกสงวนไว้
24 activerecord_error_invalid: ไม่ถูกต้อง
25 activerecord_error_confirmation: พิมพ์ไม่เหมือนเดิม
26 activerecord_error_accepted: ต้องยอมรับ
27 activerecord_error_empty: ต้องเติม
28 activerecord_error_blank: ต้องเติม
29 activerecord_error_too_long: ยาวเกินไป
30 activerecord_error_too_short: สั้นเกินไป
31 activerecord_error_wrong_length: ความยาวไม่ถูกต้อง
32 activerecord_error_taken: ถูกใช้ไปแล้ว
33 activerecord_error_not_a_number: ไม่ใช่ตัวเลข
34 activerecord_error_not_a_date: ไม่ใช่วันที่ ที่ถูกต้อง
35 activerecord_error_greater_than_start_date: ต้องมากกว่าวันเริ่ม
36 activerecord_error_not_same_project: ไม่ได้อยู่ในโครงการเดียวกัน
37 activerecord_error_circular_dependency: ความสัมพันธ์อ้างอิงเป็นวงกลม
38
39 general_fmt_age: %d ปี
40 general_fmt_age_plural: %d ปี
41 general_fmt_date: %%d/%%B/%%Y
42 general_fmt_datetime: %%d/%%B/%%Y %%H:%%M
43 general_fmt_datetime_short: %%d %%b, %%H:%%M
44 general_fmt_time: %%H:%%M
45 general_text_No: 'ไม่'
46 general_text_Yes: 'ใช่'
47 general_text_no: 'ไม่'
48 general_text_yes: 'ใช่'
49 general_lang_name: 'Thai (ไทย)'
50 general_csv_separator: ','
51 general_csv_encoding: Windows-874
52 general_pdf_encoding: cp874
53 general_day_names: จันทร์,อังคาร,พุธ,พฤหัสบดี,ศุกร์,เสาร์,อาทิตย์
54 general_first_day_of_week: '1'
55
56 notice_account_updated: บัญชีได้ถูกปรับปรุงแล้ว.
57 notice_account_invalid_creditentials: ชื้ผู้ใช้หรือรหัสผ่านไม่ถูกต้อง
58 notice_account_password_updated: รหัสได้ถูกปรับปรุงแล้ว.
59 notice_account_wrong_password: รหัสผ่านไม่ถูกต้อง
60 notice_account_register_done: บัญชีถูกสร้างแล้ว. กรุณาเช็คเมล์ แล้วคลิ๊กที่ลิงค์ในอีเมล์เพื่อเปิดใช้บัญชี
61 notice_account_unknown_email: ไม่มีผู้ใช้ที่ใช้อีเมล์นี้.
62 notice_can_t_change_password: บัญชีนี้ใช้การยืนยันตัวตนจากแหล่งภายนอก. ไม่สามารถปลี่ยนรหัสผ่านได้.
63 notice_account_lost_email_sent: เราได้ส่งอีเมล์พร้อมวิธีการสร้างรหัีสผ่านใหม่ให้คุณแล้ว กรุณาเช็คเมล์.
64 notice_account_activated: บัญชีของคุณได้เปิดใช้แล้ว. ตอนนี้คุณสามารถเข้าสู่ระบบได้แล้ว.
65 notice_successful_create: สร้างเสร็จแล้ว.
66 notice_successful_update: ปรับปรุงเสร็จแล้ว.
67 notice_successful_delete: ลบเสร็จแล้ว.
68 notice_successful_connection: ติดต่อสำเร็จแล้ว.
69 notice_file_not_found: หน้าที่คุณต้องการดูไม่มีอยู่จริง หรือถูกลบไปแล้ว.
70 notice_locking_conflict: ข้อมูลถูกปรับปรุงโดยผู้ใช้คนอื่น.
71 notice_not_authorized: คุณไม่มีสิทธิเข้าถึงหน้านี้.
72 notice_email_sent: อีเมล์ได้ถูกส่งถึง %s
73 notice_email_error: เกิดความผิดพลาดขณะกำส่งอีเมล์ (%s)
74 notice_feeds_access_key_reseted: RSS access key ของคุณถูก reset แล้ว.
75 notice_failed_to_save_issues: "%d ปัญหาจาก %d ปัญหาที่ถูกเลือกไม่สามารถจัดเก็บ: %s."
76 notice_no_issue_selected: "ไม่มีปัญหาที่ถูกเลือก! กรุณาเลือกปัญหาที่คุณต้องการแก้ไข."
77 notice_account_pending: "บัญชีของคุณสร้างเสร็จแล้ว ขณะนี้รอการอนุมัติจากผู้บริหารจัดการ."
78 notice_default_data_loaded: ค่าเริ่มต้นโหลดเสร็จแล้ว.
79
80 error_can_t_load_default_data: "ค่าเริ่มต้นโหลดไม่สำเร็จ: %s"
81 error_scm_not_found: "ไม่พบรุ่นที่ต้องการในแหล่งเก็บต้นฉบับ."
82 error_scm_command_failed: "เกิดความผิดพลาดในการเข้าถึงแหล่งเก็บต้นฉบับ: %s"
83 error_scm_annotate: "entry ไม่มีอยู่จริง หรือไม่สามารถเขียนหมายเหตุประกอบ."
84 error_issue_not_found_in_project: 'ไม่พบปัญหานี้ หรือปัญหาไม่ได้อยู่ในโครงการนี้'
85
86 mail_subject_lost_password: รหัสผ่าน %s ของคุณ
87 mail_body_lost_password: 'คลิ๊กที่ลิงค์ต่อไปนี้เพื่อเปลี่ยนรหัสผ่าน:'
88 mail_subject_register: เปิดบัญชี %s ของคุณ
89 mail_body_register: 'คลิ๊กที่ลิงค์ต่อไปนี้เพื่อเปลี่ยนรหัสผ่าน:'
90 mail_body_account_information_external: คุณสามารถใช้บัญชี "%s" เพื่อเข้าสู่ระบบ.
91 mail_body_account_information: ข้อมูลบัญชีของคุณ
92 mail_subject_account_activation_request: กรุณาเปิดบัญชี %s
93 mail_body_account_activation_request: 'ผู้ใช้ใหม่ (%s) ได้ลงทะเบียน. บัญชีของเขากำลังรออนุมัติ:'
94
95 gui_validation_error: 1 ข้อผิดพลาด
96 gui_validation_error_plural: %d ข้อผิดพลาด
97
98 field_name: ชื่อ
99 field_description: รายละเอียด
100 field_summary: สรุปย่อ
101 field_is_required: ต้องใส่
102 field_firstname: ชื่อ
103 field_lastname: นามสกุล
104 field_mail: อีเมล์
105 field_filename: แฟ้ม
106 field_filesize: ขนาด
107 field_downloads: ดาวน์โหลด
108 field_author: ผู้แต่ง
109 field_created_on: สร้าง
110 field_updated_on: ปรับปรุง
111 field_field_format: รูปแบบ
112 field_is_for_all: สำหรับทุกโครงการ
113 field_possible_values: ค่าที่เป็นไปได้
114 field_regexp: Regular expression
115 field_min_length: สั้นสุด
116 field_max_length: ยาวสุด
117 field_value: ค่า
118 field_category: ประเภท
119 field_title: ชื่อเรื่อง
120 field_project: โครงการ
121 field_issue: ปัญหา
122 field_status: สถานะ
123 field_notes: บันทึก
124 field_is_closed: ปัญหาจบ
125 field_is_default: ค่าเริ่มต้น
126 field_tracker: การติดตาม
127 field_subject: เรื่อง
128 field_due_date: วันครบกำหนด
129 field_assigned_to: มอบหมายให้
130 field_priority: ความสำคัญ
131 field_fixed_version: รุ่น
132 field_user: ผู้ใช้
133 field_role: บทบาท
134 field_homepage: หน้าแรก
135 field_is_public: สาธารณะ
136 field_parent: โครงการย่อยของ
137 field_is_in_chlog: ปัญหาแสดงใน รายกาเปลี่ยนแปลง
138 field_is_in_roadmap: ปัญหาแสดงใน แผนงาน
139 field_login: ชื่อที่ใช้เข้าระบบ
140 field_mail_notification: การแจ้งเตือนทางอีเมล์
141 field_admin: ผู้บริหารจัดการ
142 field_last_login_on: เข้าระบบครั้งสุดท้าย
143 field_language: ภาษา
144 field_effective_date: วันที่
145 field_password: รหัสผ่าน
146 field_new_password: รหัสผ่านใหม่
147 field_password_confirmation: ยืนยันรหัสผ่าน
148 field_version: รุ่น
149 field_type: ชนิด
150 field_host: โฮสต์
151 field_port: พอร์ต
152 field_account: บัญชี
153 field_base_dn: Base DN
154 field_attr_login: เข้าระบบ attribute
155 field_attr_firstname: ชื่อ attribute
156 field_attr_lastname: นามสกุล attribute
157 field_attr_mail: อีเมล์ attribute
158 field_onthefly: สร้างผู้ใช้ทันที
159 field_start_date: เริ่ม
160 field_done_ratio: %% สำเร็จ
161 field_auth_source: วิธีการยืนยันตัวตน
162 field_hide_mail: ซ่อนอีเมล์ของฉัน
163 field_comments: ความเห็น
164 field_url: URL
165 field_start_page: หน้าเริ่มต้น
166 field_subproject: โครงการย่อย
167 field_hours: ชั่วโมง
168 field_activity: กิจกรรม
169 field_spent_on: วันที่
170 field_identifier: ชื่อเฉพาะ
171 field_is_filter: ใช้เป็นตัวกรอง
172 field_issue_to_id: ปัญหาที่เกี่ยวข้อง
173 field_delay: เลื่อน
174 field_assignable: ปัญหาสามารถมอบหมายให้คนที่ทำบทบาทนี้
175 field_redirect_existing_links: ย้ายจุดเชื่อมโยงนี้
176 field_estimated_hours: เวลาที่ใช้โดยประมาณ
177 field_column_names: สดมภ์
178 field_time_zone: ย่านเวลา
179 field_searchable: ค้นหาได้
180 field_default_value: ค่าเริ่มต้น
181 field_comments_sorting: แสดงความเห็น
182
183 setting_app_title: ชื่อโปรแกรม
184 setting_app_subtitle: ชื่อโปรแกรมรอง
185 setting_welcome_text: ข้อความต้อนรับ
186 setting_default_language: ภาษาเริ่มต้น
187 setting_login_required: ต้องป้อนผู้ใช้-รหัสผ่าน
188 setting_self_registration: ลงทะเบียนด้วยตนเอง
189 setting_attachment_max_size: ขนาดแฟ้มแนบสูงสุด
190 setting_issues_export_limit: การส่งออกปัญหาสูงสุด
191 setting_mail_from: อีเมล์ที่ใช้ส่ง
192 setting_bcc_recipients: ไม่ระบุชื่อผู้รับ (bcc)
193 setting_host_name: ชื่อโฮสต์
194 setting_text_formatting: การจัดรูปแบบข้อความ
195 setting_wiki_compression: บีบอัดประวัติ Wiki
196 setting_feeds_limit: จำนวน Feed
197 setting_default_projects_public: โครงการใหม่มีค่าเริ่มต้นเป็น สาธารณะ
198 setting_autofetch_changesets: ดึง commits อัตโนมัติ
199 setting_sys_api_enabled: เปิดใช้ WS สำหรับการจัดการที่เก็บต้นฉบับ
200 setting_commit_ref_keywords: คำสำคัญ Referencing
201 setting_commit_fix_keywords: คำสำคัญ Fixing
202 setting_autologin: เข้าระบบอัตโนมัติ
203 setting_date_format: รูปแบบวันที่
204 setting_time_format: รูปแบบเวลา
205 setting_cross_project_issue_relations: อนุญาตให้ระบุปัญหาข้ามโครงการ
206 setting_issue_list_default_columns: สดมภ์เริ่มต้นแสดงในรายการปัญหา
207 setting_repositories_encodings: การเข้ารหัสที่เก็บต้นฉบับ
208 setting_emails_footer: คำลงท้ายอีเมล์
209 setting_protocol: Protocol
210 setting_per_page_options: ตัวเลือกจำนวนต่อหน้า
211 setting_user_format: รูปแบบการแสดงชื่อผู้ใช้
212 setting_activity_days_default: จำนวนวันที่แสดงในกิจกรรมของโครงการ
213 setting_display_subprojects_issues: แสดงปัญหาของโครงการย่อยในโครงการหลัก
214
215 project_module_issue_tracking: การติดตามปัญหา
216 project_module_time_tracking: การใช้เวลา
217 project_module_news: ข่าว
218 project_module_documents: เอกสาร
219 project_module_files: แฟ้ม
220 project_module_wiki: Wiki
221 project_module_repository: ที่เก็บต้นฉบับ
222 project_module_boards: กระดานข้อความ
223
224 label_user: ผู้ใช้
225 label_user_plural: ผู้ใช้
226 label_user_new: ผู้ใช้ใหม่
227 label_project: โครงการ
228 label_project_new: โครงการใหม่
229 label_project_plural: โครงการ
230 label_project_all: โครงการทั้งหมด
231 label_project_latest: โครงการล่าสุด
232 label_issue: ปัญหา
233 label_issue_new: ปัญหาใหม่
234 label_issue_plural: ปัญหา
235 label_issue_view_all: ดูปัญหาทั้งหมด
236 label_issues_by: ปัญหาโดย %s
237 label_issue_added: ปัญหาถูกเพิ่ม
238 label_issue_updated: ปัญหาถูกปรับปรุง
239 label_document: เอกสาร
240 label_document_new: เอกสารใหม่
241 label_document_plural: เอกสาร
242 label_document_added: เอกสารถูกเพิ่ม
243 label_role: บทบาท
244 label_role_plural: บทบาท
245 label_role_new: บทบาทใหม่
246 label_role_and_permissions: บทบาทและสิทธิ
247 label_member: สมาชิก
248 label_member_new: สมาชิกใหม่
249 label_member_plural: สมาชิก
250 label_tracker: การติดตาม
251 label_tracker_plural: การติดตาม
252 label_tracker_new: การติดตามใหม่
253 label_workflow: ลำดับงาน
254 label_issue_status: สถานะของปัญหา
255 label_issue_status_plural: สถานะของปัญหา
256 label_issue_status_new: สถานะใหม
257 label_issue_category: ประเภทของปัญหา
258 label_issue_category_plural: ประเภทของปัญหา
259 label_issue_category_new: ประเภทใหม่
260 label_custom_field: เขตข้อมูลแบบระบุเอง
261 label_custom_field_plural: เขตข้อมูลแบบระบุเอง
262 label_custom_field_new: สร้างเขตข้อมูลแบบระบุเอง
263 label_enumerations: รายการ
264 label_enumeration_new: สร้างใหม่
265 label_information: ข้อมูล
266 label_information_plural: ข้อมูล
267 label_please_login: กรุณาเข้าระบบก่อน
268 label_register: ลงทะเบียน
269 label_password_lost: ลืมรหัสผ่าน
270 label_home: หน้าแรก
271 label_my_page: หน้าของฉัน
272 label_my_account: บัญชีของฉัน
273 label_my_projects: โครงการของฉัน
274 label_administration: บริหารจัดการ
275 label_login: เข้าระบบ
276 label_logout: ออกระบบ
277 label_help: ช่วยเหลือ
278 label_reported_issues: ปัญหาที่แจ้งไว้
279 label_assigned_to_me_issues: ปัญหาที่มอบหมายให้ฉัน
280 label_last_login: ติดต่อครั้งสุดท้าย
281 label_last_updates: ปรับปรุงครั้งสุดท้าย
282 label_last_updates_plural: %d ปรับปรุงครั้งสุดท้าย
283 label_registered_on: ลงทะเบียนเมื่อ
284 label_activity: กิจกรรม
285 label_activity_plural: กิจกรรม
286 label_activity_latest: กิจกรรมล่าสุด
287 label_overall_activity: กิจกรรมโดยรวม
288 label_new: ใหม่
289 label_logged_as: เข้าระบบในชื่อ
290 label_environment: สภาพแวดล้อม
291 label_authentication: การยืนยันตัวตน
292 label_auth_source: วิธีการการยืนยันตัวตน
293 label_auth_source_new: สร้างวิธีการยืนยันตัวตนใหม่
294 label_auth_source_plural: วิธีการ Authentication
295 label_subproject_plural: โครงการย่อย
296 label_min_max_length: สั้น-ยาว สุดที่
297 label_list: รายการ
298 label_date: วันที่
299 label_integer: จำนวนเต็ม
300 label_float: จำนวนจริง
301 label_boolean: ถูกผิด
302 label_string: ข้อความ
303 label_text: ข้อความขนาดยาว
304 label_attribute: คุณลักษณะ
305 label_attribute_plural: คุณลักษณะ
306 label_download: %d ดาวน์โหลด
307 label_download_plural: %d ดาวน์โหลด
308 label_no_data: จำนวนข้อมูลที่แสดง
309 label_change_status: เปลี่ยนสถานะ
310 label_history: ประวัติ
311 label_attachment: แฟ้ม
312 label_attachment_new: แฟ้มใหม่
313 label_attachment_delete: ลบแฟ้ม
314 label_attachment_plural: แฟ้ม
315 label_file_added: แฟ้มถูกเพิ่ม
316 label_report: รายงาน
317 label_report_plural: รายงาน
318 label_news: ข่าว
319 label_news_new: เพิ่มข่าว
320 label_news_plural: ข่าว
321 label_news_latest: ข่าวล่าสุด
322 label_news_view_all: ดูข่าวทั้งหมด
323 label_news_added: ข่าวถูกเพิ่ม
324 label_change_log: บันทึกการเปลี่ยนแปลง
325 label_settings: ปรับแต่ง
326 label_overview: ภาพรวม
327 label_version: รุ่น
328 label_version_new: รุ่นใหม่
329 label_version_plural: รุ่น
330 label_confirmation: ยืนยัน
331 label_export_to: 'รูปแบบอื่นๆ :'
332 label_read: อ่าน...
333 label_public_projects: โครงการสาธารณะ
334 label_open_issues: เปิด
335 label_open_issues_plural: เปิด
336 label_closed_issues: ปิด
337 label_closed_issues_plural: ปิด
338 label_total: จำนวนรวม
339 label_permissions: สิทธิ
340 label_current_status: สถานะปัจจุบัน
341 label_new_statuses_allowed: อนุญาตให้มีสถานะใหม่
342 label_all: ทั้งหมด
343 label_none: ไม่มี
344 label_nobody: ไม่มีใคร
345 label_next: ต่อไป
346 label_previous: ก่อนหน้า
347 label_used_by: ถูกใช้โดย
348 label_details: รายละเอียด
349 label_add_note: เพิ่มบันทึก
350 label_per_page: ต่อหน้า
351 label_calendar: ปฏิทิน
352 label_months_from: เดือนจาก
353 label_gantt: Gantt
354 label_internal: ภายใน
355 label_last_changes: last %d เปลี่ยนแปลง
356 label_change_view_all: ดูการเปลี่ยนแปลงทั้งหมด
357 label_personalize_page: ปรับแต่งหน้านี้
358 label_comment: ความเห็น
359 label_comment_plural: ความเห็น
360 label_comment_add: เพิ่มความเห็น
361 label_comment_added: ความเห็นถูกเพิ่ม
362 label_comment_delete: ลบความเห็น
363 label_query: แบบสอบถามแบบกำหนดเอง
364 label_query_plural: แบบสอบถามแบบกำหนดเอง
365 label_query_new: แบบสอบถามใหม่
366 label_filter_add: เพิ่มตัวกรอง
367 label_filter_plural: ตัวกรอง
368 label_equals: คือ
369 label_not_equals: ไม่ใช่
370 label_in_less_than: น้อยกว่า
371 label_in_more_than: มากกว่า
372 label_in: ในช่วง
373 label_today: วันนี้
374 label_all_time: ตลอดเวลา
375 label_yesterday: เมื่อวาน
376 label_this_week: อาทิตย์นี้
377 label_last_week: อาทิตย์ที่แล้ว
378 label_last_n_days: %d วันย้อนหลัง
379 label_this_month: เดือนนี้
380 label_last_month: เดือนที่แล้ว
381 label_this_year: ปีนี้
382 label_date_range: ช่วงวันที่
383 label_less_than_ago: น้อยกว่าหนึ่งวัน
384 label_more_than_ago: มากกว่าหนึ่งวัน
385 label_ago: วันผ่านมาแล้ว
386 label_contains: มี...
387 label_not_contains: ไม่มี...
388 label_day_plural: วัน
389 label_repository: ที่เก็บต้นฉบับ
390 label_repository_plural: ที่เก็บต้นฉบับ
391 label_browse: เปิดหา
392 label_modification: %d เปลี่ยนแปลง
393 label_modification_plural: %d เปลี่ยนแปลง
394 label_revision: การแก้ไข
395 label_revision_plural: การแก้ไข
396 label_associated_revisions: การแก้ไขที่เกี่ยวข้อง
397 label_added: ถูกเพิ่ม
398 label_modified: ถูกแก้ไข
399 label_deleted: ถูกลบ
400 label_latest_revision: รุ่นการแก้ไขล่าสุด
401 label_latest_revision_plural: รุ่นการแก้ไขล่าสุด
402 label_view_revisions: ดูการแก้ไข
403 label_max_size: ขนาดใหญ่สุด
404 label_on: 'ใน'
405 label_sort_highest: ย้ายไปบนสุด
406 label_sort_higher: ย้ายขึ้น
407 label_sort_lower: ย้ายลง
408 label_sort_lowest: ย้ายไปล่างสุด
409 label_roadmap: แผนงาน
410 label_roadmap_due_in: ถึงกำหนดใน
411 label_roadmap_overdue: %s ช้ากว่ากำหนด
412 label_roadmap_no_issues: ไม่มีปัญหาสำหรับรุ่นนี้
413 label_search: ค้นหา
414 label_result_plural: ผลการค้นหา
415 label_all_words: ทุกคำ
416 label_wiki: Wiki
417 label_wiki_edit: แก้ไข Wiki
418 label_wiki_edit_plural: แก้ไข Wiki
419 label_wiki_page: หน้า Wiki
420 label_wiki_page_plural: หน้า Wiki
421 label_index_by_title: เรียงตามชื่อเรื่อง
422 label_index_by_date: เรียงตามวัน
423 label_current_version: รุ่นปัจจุบัน
424 label_preview: ตัวอย่างก่อนจัดเก็บ
425 label_feed_plural: Feeds
426 label_changes_details: รายละเอียดการเปลี่ยนแปลงทั้งหมด
427 label_issue_tracking: ติดตามปัญหา
428 label_spent_time: เวลาที่ใช้
429 label_f_hour: %.2f ชั่วโมง
430 label_f_hour_plural: %.2f ชั่วโมง
431 label_time_tracking: ติดตามการใช้เวลา
432 label_change_plural: เปลี่ยนแปลง
433 label_statistics: สถิติ
434 label_commits_per_month: Commits ต่อเดือน
435 label_commits_per_author: Commits ต่อผู้แต่ง
436 label_view_diff: ดูความแตกต่าง
437 label_diff_inline: inline
438 label_diff_side_by_side: side by side
439 label_options: ตัวเลือก
440 label_copy_workflow_from: คัดลอกลำดับงานจาก
441 label_permissions_report: รายงานสิทธิ
442 label_watched_issues: เฝ้าดูปัญหา
443 label_related_issues: ปัญหาที่เกี่ยวข้อง
444 label_applied_status: จัดเก็บสถานะ
445 label_loading: กำลังโหลด...
446 label_relation_new: ความสัมพันธ์ใหม่
447 label_relation_delete: ลบความสัมพันธ์
448 label_relates_to: สัมพันธ์กับ
449 label_duplicates: ซ้ำ
450 label_blocks: กีดกัน
451 label_blocked_by: กีดกันโดย
452 label_precedes: นำหน้า
453 label_follows: ตามหลัง
454 label_end_to_start: จบ-เริ่ม
455 label_end_to_end: จบ-จบ
456 label_start_to_start: เริ่ม-เริ่ม
457 label_start_to_end: เริ่ม-จบ
458 label_stay_logged_in: อยู่ในระบบต่อ
459 label_disabled: ไม่ใช้งาน
460 label_show_completed_versions: แสดงรุ่นที่สมบูรณ์
461 label_me: ฉัน
462 label_board: สภากาแฟ
463 label_board_new: สร้างสภากาแฟ
464 label_board_plural: สภากาแฟ
465 label_topic_plural: หัวข้อ
466 label_message_plural: ข้อความ
467 label_message_last: ข้อความล่าสุด
468 label_message_new: เขียนข้อความใหม่
469 label_message_posted: ข้อความถูกเพิ่มแล้ว
470 label_reply_plural: ตอบกลับ
471 label_send_information: ส่งรายละเอียดของบัญชีให้ผู้ใช้
472 label_year: ปี
473 label_month: เดือน
474 label_week: สัปดาห์
475 label_date_from: จาก
476 label_date_to: ถึง
477 label_language_based: ขึ้นอยู่กับภาษาของผู้ใช้
478 label_sort_by: เรียงโดย %s
479 label_send_test_email: ส่งจดหมายทดสอบ
480 label_feeds_access_key_created_on: RSS access key สร้างเมื่อ %s ที่ผ่านมา
481 label_module_plural: ส่วนประกอบ
482 label_added_time_by: เพิ่มโดย %s %s ที่ผ่านมา
483 label_updated_time: ปรับปรุง %s ที่ผ่านมา
484 label_jump_to_a_project: ไปที่โครงการ...
485 label_file_plural: แฟ้ม
486 label_changeset_plural: กลุ่มการเปลี่ยนแปลง
487 label_default_columns: สดมภ์เริ่มต้น
488 label_no_change_option: (ไม่เปลี่ยนแปลง)
489 label_bulk_edit_selected_issues: แก้ไขปัญหาที่เลือกทั้งหมด
490 label_theme: ชุดรูปแบบ
491 label_default: ค่าเริ่มต้น
492 label_search_titles_only: ค้นหาจากชื่อเรื่องเท่านั้น
493 label_user_mail_option_all: "ทุกๆ เหตุการณ์ในโครงการของฉัน"
494 label_user_mail_option_selected: "ทุกๆ เหตุการณ์ในโครงการที่เลือก..."
495 label_user_mail_option_none: "เฉพาะสิ่งที่ฉันเลือกหรือมีส่วนเกี่ยวข้อง"
496 label_user_mail_no_self_notified: "ฉันไม่ต้องการได้รับการแจ้งเตือนในสิ่งที่ฉันทำเอง"
497 label_registration_activation_by_email: เปิดบัญชีผ่านอีเมล์
498 label_registration_manual_activation: อนุมัติโดยผู้บริหารจัดการ
499 label_registration_automatic_activation: เปิดบัญชีอัตโนมัติ
500 label_display_per_page: 'ต่อหน้า: %s'
501 label_age: อายุ
502 label_change_properties: เปลี่ยนคุณสมบัติ
503 label_general: ทั่วๆ ไป
504 label_more: อื่น ๆ
505 label_scm: ตัวจัดการต้นฉบับ
506 label_plugins: ส่วนเสริม
507 label_ldap_authentication: การยืนยันตัวตนโดยใช้ LDAP
508 label_downloads_abbr: D/L
509 label_optional_description: รายละเอียดเพิ่มเติม
510 label_add_another_file: เพิ่มแฟ้มอื่นๆ
511 label_preferences: ค่าที่ชอบใจ
512 label_chronological_order: เรียงจากเก่าไปใหม่
513 label_reverse_chronological_order: เรียงจากใหม่ไปเก่า
514 label_planning: การวางแผน
515
516 button_login: เข้าระบบ
517 button_submit: จัดส่งข้อมูล
518 button_save: จัดเก็บ
519 button_check_all: เลือกทั้งหมด
520 button_uncheck_all: ไม่เลือกทั้งหมด
521 button_delete: ลบ
522 button_create: สร้าง
523 button_test: ทดสอบ
524 button_edit: แก้ไข
525 button_add: เพิ่ม
526 button_change: เปลี่ยนแปลง
527 button_apply: ประยุกต์ใช้
528 button_clear: ล้างข้อความ
529 button_lock: ล็อค
530 button_unlock: ยกเลิกการล็อค
531 button_download: ดาวน์โหลด
532 button_list: รายการ
533 button_view: มุมมอง
534 button_move: ย้าย
535 button_back: กลับ
536 button_cancel: ยกเลิก
537 button_activate: เปิดใช้
538 button_sort: จัดเรียง
539 button_log_time: บันทึกเวลา
540 button_rollback: ถอยกลับมาที่รุ่นนี้
541 button_watch: เฝ้าดู
542 button_unwatch: เลิกเฝ้าดู
543 button_reply: ตอบกลับ
544 button_archive: เก็บเข้าโกดัง
545 button_unarchive: เอาออกจากโกดัง
546 button_reset: เริ่มใหมท
547 button_rename: เปลี่ยนชื่อ
548 button_change_password: เปลี่ยนรหัสผ่าน
549 button_copy: คัดลอก
550 button_annotate: หมายเหตุประกอบ
551 button_update: ปรับปรุง
552 button_configure: ปรับแต่ง
553
554 status_active: เปิดใช้งานแล้ว
555 status_registered: รอการอนุมัติ
556 status_locked: ล็อค
557
558 text_select_mail_notifications: เลือกการกระทำที่ต้องการให้ส่งอีเมล์แจ้ง.
559 text_regexp_info: ตัวอย่าง ^[A-Z0-9]+$
560 text_min_max_length_info: 0 หมายถึงไม่จำกัด
561 text_project_destroy_confirmation: คุณแน่ใจไหมว่าต้องการลบโครงการและข้อมูลที่เกี่ยวข้่อง ?
562 text_subprojects_destroy_warning: 'โครงการย่อย: %s จะถูกลบด้วย.'
563 text_workflow_edit: เลือกบทบาทและการติดตาม เพื่อแก้ไขลำดับงาน
564 text_are_you_sure: คุณแน่ใจไหม ?
565 text_journal_changed: เปลี่ยนแปลงจาก %s เป็น %s
566 text_journal_set_to: ตั้งค่าเป็น %s
567 text_journal_deleted: ถูกลบ
568 text_tip_task_begin_day: งานที่เริ่มวันนี้
569 text_tip_task_end_day: งานที่จบวันนี้
570 text_tip_task_begin_end_day: งานที่เริ่มและจบวันนี้
571 text_project_identifier_info: 'ภาษาอังกฤษตัวเล็ก(a-z), ตัวเลข(0-9) และขีด (-) เท่านั้น.<br />เมื่อจัดเก็บแล้ว, ชื่อเฉพาะไม่สามารถเปลี่ยนแปลงได้'
572 text_caracters_maximum: สูงสุด %d ตัวอักษร.
573 text_caracters_minimum: ต้องยาวอย่างน้อย %d ตัวอักษร.
574 text_length_between: ความยาวระหว่าง %d ถึง %d ตัวอักษร.
575 text_tracker_no_workflow: ไม่ได้บัญญัติลำดับงานสำหรับการติดตามนี้
576 text_unallowed_characters: ตัวอักษรต้องห้าม
577 text_comma_separated: ใส่ได้หลายค่า โดยคั่นด้วยลูกน้ำ( ,).
578 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
579 text_issue_added: ปัญหา %s ถูกแจ้งโดย %s.
580 text_issue_updated: ปัญหา %s ถูกปรับปรุงโดย %s.
581 text_wiki_destroy_confirmation: คุณแน่ใจหรือว่าต้องการลบ wiki นี้พร้อมทั้งเนี้อหา?
582 text_issue_category_destroy_question: บางปัญหา (%d) อยู่ในประเภทนี้. คุณต้องการทำอย่างไร ?
583 text_issue_category_destroy_assignments: ลบประเภทนี้
584 text_issue_category_reassign_to: ระบุปัญหาในประเภทนี้
585 text_user_mail_option: "ในโครงการที่ไม่ได้เลือก, คุณจะได้รับการแจ้งเกี่ยวกับสิ่งที่คุณเฝ้าดูหรือมีส่วนเกี่ยวข้อง (เช่นปัญหาที่คุณแจ้งไว้หรือได้รับมอบหมาย)."
586 text_no_configuration_data: "บทบาท, การติดตาม, สถานะปัญหา และลำดับงานยังไม่ได้ถูกตั้งค่า.\nขอแนะนำให้โหลดค่าเริ่มต้น. คุณสามารถแก้ไขค่าได้หลังจากโหลดแล้ว."
587 text_load_default_configuration: โหลดค่าเริ่มต้น
588 text_status_changed_by_changeset: ประยุกต์ใช้ในกลุ่มการเปลี่ยนแปลง %s.
589 text_issues_destroy_confirmation: 'คุณแน่ใจไหมว่าต้องการลบปัญหา(ทั้งหลาย)ที่เลือกไว้?'
590 text_select_project_modules: 'เลือกส่วนประกอบที่ต้องการใช้งานสำหรับโครงการนี้:'
591 text_default_administrator_account_changed: ค่าเริ่มต้นของบัญชีผู้บริหารจัดการถูกเปลี่ยนแปลง
592 text_file_repository_writable: ที่เก็บต้นฉบับสามารถเขียนได้
593 text_rmagick_available: RMagick มีให้ใช้ (เป็นตัวเลือก)
594 text_destroy_time_entries_question: %.02f ชั่วโมงที่ถูกแจ้งในปัญหานี้จะโดนลบ. คุณต้องการทำอย่างไร?
595 text_destroy_time_entries: ลบเวลาที่รายงานไว้
596 text_assign_time_entries_to_project: ระบุเวลาที่ใช้ในโครงการนี้
597 text_reassign_time_entries: 'ระบุเวลาที่ใช้ในโครงการนี่อีกครั้ง:'
598
599 default_role_manager: ผู้จัดการ
600 default_role_developper: ผู้พัฒนา
601 default_role_reporter: ผู้รายงาน
602 default_tracker_bug: บั๊ก
603 default_tracker_feature: ลักษณะเด่น
604 default_tracker_support: สนับสนุน
605 default_issue_status_new: เกิดขึ้น
606 default_issue_status_assigned: รับมอบหมาย
607 default_issue_status_resolved: ดำเนินการ
608 default_issue_status_feedback: รอคำตอบ
609 default_issue_status_closed: จบ
610 default_issue_status_rejected: ยกเลิก
611 default_doc_category_user: เอกสารของผู้ใช้
612 default_doc_category_tech: เอกสารทางเทคนิค
613 default_priority_low: ต่ำ
614 default_priority_normal: ปกติ
615 default_priority_high: สูง
616 default_priority_urgent: เร่งด่วน
617 default_priority_immediate: ด่วนมาก
618 default_activity_design: ออกแบบ
619 default_activity_development: พัฒนา
620
621 enumeration_issue_priorities: ความสำคัญของปัญหา
622 enumeration_doc_categories: ประเภทเอกสาร
623 enumeration_activities: กิจกรรม (ใช้ในการติดตามเวลา)
@@ -0,0 +1,127
1 // ** I18N
2
3 // Calendar EN language
4 // Author: Gampol Thitinilnithi, <gampolt@gmail.com>
5 // Encoding: UTF-8
6 // Distributed under the same terms as the calendar itself.
7
8 // For translators: please use UTF-8 if possible. We strongly believe that
9 // Unicode is the answer to a real internationalized world. Also please
10 // include your contact information in the header, as can be seen above.
11
12 // full day names
13 Calendar._DN = new Array
14 ("อาทิตย์",
15 "จันทร์",
16 "อังคาร",
17 "พุธ",
18 "พฤหัสบดี",
19 "ศุกร์",
20 "เสาร์",
21 "อาทิตย์");
22
23 // Please note that the following array of short day names (and the same goes
24 // for short month names, _SMN) isn't absolutely necessary. We give it here
25 // for exemplification on how one can customize the short day names, but if
26 // they are simply the first N letters of the full name you can simply say:
27 //
28 // Calendar._SDN_len = N; // short day name length
29 // Calendar._SMN_len = N; // short month name length
30 //
31 // If N = 3 then this is not needed either since we assume a value of 3 if not
32 // present, to be compatible with translation files that were written before
33 // this feature.
34
35 // short day names
36 Calendar._SDN = new Array
37 ("อา.",
38 "จ.",
39 "อ.",
40 "พ.",
41 "พฤ.",
42 "ศ.",
43 "ส.",
44 "อา.");
45
46 // First day of the week. "0" means display Sunday first, "1" means display
47 // Monday first, etc.
48 Calendar._FD = 1;
49
50 // full month names
51 Calendar._MN = new Array
52 ("มกราคม",
53 "กุมภาพันธ์",
54 "มีนาคม",
55 "เมษายน",
56 "พฤษภาคม",
57 "มิถุนายน",
58 "กรกฎาคม",
59 "สิงหาคม",
60 "กันยายน",
61 "ตุลาคม",
62 "พฤศจิกายน",
63 "ธันวาคม");
64
65 // short month names
66 Calendar._SMN = new Array
67 ("ม.ค.",
68 "ก.พ.",
69 "มี.ค.",
70 "เม.ย.",
71 "พ.ค.",
72 "มิ.ย.",
73 "ก.ค.",
74 "ส.ค.",
75 "ก.ย.",
76 "ต.ค.",
77 "พ.ย.",
78 "ธ.ค.");
79
80 // tooltips
81 Calendar._TT = {};
82 Calendar._TT["INFO"] = "เกี่ยวกับปฏิทิน";
83
84 Calendar._TT["ABOUT"] =
85 "DHTML Date/Time Selector\n" +
86 "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
87 "For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
88 "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
89 "\n\n" +
90 "Date selection:\n" +
91 "- Use the \xab, \xbb buttons to select year\n" +
92 "- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
93 "- Hold mouse button on any of the above buttons for faster selection.";
94 Calendar._TT["ABOUT_TIME"] = "\n\n" +
95 "Time selection:\n" +
96 "- Click on any of the time parts to increase it\n" +
97 "- or Shift-click to decrease it\n" +
98 "- or click and drag for faster selection.";
99
100 Calendar._TT["PREV_YEAR"] = "ปีที่แล้ว (ถ้ากดค้างจะมีเมนู)";
101 Calendar._TT["PREV_MONTH"] = "เดือนที่แล้ว (ถ้ากดค้างจะมีเมนู)";
102 Calendar._TT["GO_TODAY"] = "ไปที่วันนี้";
103 Calendar._TT["NEXT_MONTH"] = "เดือนหน้า (ถ้ากดค้างจะมีเมนู)";
104 Calendar._TT["NEXT_YEAR"] = "ปีหน้า (ถ้ากดค้างจะมีเมนู)";
105 Calendar._TT["SEL_DATE"] = "เลือกวัน";
106 Calendar._TT["DRAG_TO_MOVE"] = "กดแล้วลากเพื่อย้าย";
107 Calendar._TT["PART_TODAY"] = " (วันนี้)";
108
109 // the following is to inform that "%s" is to be the first day of week
110 // %s will be replaced with the day name.
111 Calendar._TT["DAY_FIRST"] = "แสดง %s เป็นวันแรก";
112
113 // This may be locale-dependent. It specifies the week-end days, as an array
114 // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
115 // means Monday, etc.
116 Calendar._TT["WEEKEND"] = "0,6";
117
118 Calendar._TT["CLOSE"] = "ปิด";
119 Calendar._TT["TODAY"] = "วันนี้";
120 Calendar._TT["TIME_PART"] = "(Shift-)กดหรือกดแล้วลากเพื่อเปลี่ยนค่า";
121
122 // date formats
123 Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
124 Calendar._TT["TT_DATE_FORMAT"] = "%a %e %b";
125
126 Calendar._TT["WK"] = "wk";
127 Calendar._TT["TIME"] = "เวลา:";
@@ -0,0 +1,14
1 jsToolBar.strings = {};
2 jsToolBar.strings['Strong'] = 'หนา';
3 jsToolBar.strings['Italic'] = 'เอียง';
4 jsToolBar.strings['Underline'] = 'ขีดเส้นใต้';
5 jsToolBar.strings['Deleted'] = 'ขีดฆ่า';
6 jsToolBar.strings['Code'] = 'โค๊ดโปรแกรม';
7 jsToolBar.strings['Heading 1'] = 'หัวข้อ 1';
8 jsToolBar.strings['Heading 2'] = 'หัวข้อ 2';
9 jsToolBar.strings['Heading 3'] = 'หัวข้อ 3';
10 jsToolBar.strings['Unordered list'] = 'รายการ';
11 jsToolBar.strings['Ordered list'] = 'ลำดับเลข';
12 jsToolBar.strings['Preformatted text'] = 'รูปแบบข้อความคงที่';
13 jsToolBar.strings['Wiki link'] = 'เชื่อมโยงไปหน้า Wiki อื่น';
14 jsToolBar.strings['Image'] = 'รูปภาพ';
@@ -1,368 +1,372
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class QueryColumn
19 19 attr_accessor :name, :sortable, :default_order
20 20 include GLoc
21 21
22 22 def initialize(name, options={})
23 23 self.name = name
24 24 self.sortable = options[:sortable]
25 25 self.default_order = options[:default_order]
26 26 end
27 27
28 28 def caption
29 29 set_language_if_valid(User.current.language)
30 30 l("field_#{name}")
31 31 end
32 32 end
33 33
34 34 class QueryCustomFieldColumn < QueryColumn
35 35
36 36 def initialize(custom_field)
37 37 self.name = "cf_#{custom_field.id}".to_sym
38 38 self.sortable = false
39 39 @cf = custom_field
40 40 end
41 41
42 42 def caption
43 43 @cf.name
44 44 end
45 45
46 46 def custom_field
47 47 @cf
48 48 end
49 49 end
50 50
51 51 class Query < ActiveRecord::Base
52 52 belongs_to :project
53 53 belongs_to :user
54 54 serialize :filters
55 55 serialize :column_names
56 56
57 57 attr_protected :project_id, :user_id
58 58
59 59 validates_presence_of :name, :on => :save
60 60 validates_length_of :name, :maximum => 255
61 61
62 62 @@operators = { "=" => :label_equals,
63 63 "!" => :label_not_equals,
64 64 "o" => :label_open_issues,
65 65 "c" => :label_closed_issues,
66 66 "!*" => :label_none,
67 67 "*" => :label_all,
68 68 ">=" => '>=',
69 69 "<=" => '<=',
70 70 "<t+" => :label_in_less_than,
71 71 ">t+" => :label_in_more_than,
72 72 "t+" => :label_in,
73 73 "t" => :label_today,
74 74 "w" => :label_this_week,
75 75 ">t-" => :label_less_than_ago,
76 76 "<t-" => :label_more_than_ago,
77 77 "t-" => :label_ago,
78 78 "~" => :label_contains,
79 79 "!~" => :label_not_contains }
80 80
81 81 cattr_reader :operators
82 82
83 83 @@operators_by_filter_type = { :list => [ "=", "!" ],
84 84 :list_status => [ "o", "=", "!", "c", "*" ],
85 85 :list_optional => [ "=", "!", "!*", "*" ],
86 86 :list_subprojects => [ "*", "!*", "=" ],
87 87 :date => [ "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
88 88 :date_past => [ ">t-", "<t-", "t-", "t", "w" ],
89 89 :string => [ "=", "~", "!", "!~" ],
90 90 :text => [ "~", "!~" ],
91 91 :integer => [ "=", ">=", "<=" ] }
92 92
93 93 cattr_reader :operators_by_filter_type
94 94
95 95 @@available_columns = [
96 96 QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
97 97 QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
98 98 QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'),
99 99 QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"),
100 100 QueryColumn.new(:author),
101 101 QueryColumn.new(:assigned_to, :sortable => "#{User.table_name}.lastname"),
102 102 QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on", :default_order => 'desc'),
103 103 QueryColumn.new(:category, :sortable => "#{IssueCategory.table_name}.name"),
104 104 QueryColumn.new(:fixed_version, :sortable => "#{Version.table_name}.effective_date", :default_order => 'desc'),
105 105 QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"),
106 106 QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
107 107 QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
108 108 QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio"),
109 109 QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
110 110 ]
111 111 cattr_reader :available_columns
112 112
113 113 def initialize(attributes = nil)
114 114 super attributes
115 115 self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
116 116 set_language_if_valid(User.current.language)
117 117 end
118 118
119 119 def after_initialize
120 120 # Store the fact that project is nil (used in #editable_by?)
121 121 @is_for_all = project.nil?
122 122 end
123 123
124 124 def validate
125 125 filters.each_key do |field|
126 126 errors.add label_for(field), :activerecord_error_blank unless
127 127 # filter requires one or more values
128 (values_for(field) and !values_for(field).first.empty?) or
128 (values_for(field) and !values_for(field).first.blank?) or
129 129 # filter doesn't require any value
130 130 ["o", "c", "!*", "*", "t", "w"].include? operator_for(field)
131 131 end if filters
132 132 end
133 133
134 134 def editable_by?(user)
135 135 return false unless user
136 136 # Admin can edit them all and regular users can edit their private queries
137 137 return true if user.admin? || (!is_public && self.user_id == user.id)
138 138 # Members can not edit public queries that are for all project (only admin is allowed to)
139 139 is_public && !@is_for_all && user.allowed_to?(:manage_public_queries, project)
140 140 end
141 141
142 142 def available_filters
143 143 return @available_filters if @available_filters
144 144
145 145 trackers = project.nil? ? Tracker.find(:all, :order => 'position') : project.rolled_up_trackers
146 146
147 147 @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
148 148 "tracker_id" => { :type => :list, :order => 2, :values => trackers.collect{|s| [s.name, s.id.to_s] } },
149 149 "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI'], :order => 'position').collect{|s| [s.name, s.id.to_s] } },
150 150 "subject" => { :type => :text, :order => 8 },
151 151 "created_on" => { :type => :date_past, :order => 9 },
152 152 "updated_on" => { :type => :date_past, :order => 10 },
153 153 "start_date" => { :type => :date, :order => 11 },
154 154 "due_date" => { :type => :date, :order => 12 },
155 155 "done_ratio" => { :type => :integer, :order => 13 }}
156 156
157 157 user_values = []
158 158 user_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
159 159 if project
160 160 user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] }
161 161 else
162 162 # members of the user's projects
163 163 user_values += User.current.projects.collect(&:users).flatten.uniq.sort.collect{|s| [s.name, s.id.to_s] }
164 164 end
165 165 @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty?
166 166 @available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values } unless user_values.empty?
167 167
168 168 if project
169 169 # project specific filters
170 170 @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
171 171 @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
172 172 unless @project.active_children.empty?
173 173 @available_filters["subproject_id"] = { :type => :list_subprojects, :order => 13, :values => @project.active_children.collect{|s| [s.name, s.id.to_s] } }
174 174 end
175 175 @project.all_custom_fields.select(&:is_filter?).each do |field|
176 176 case field.field_format
177 177 when "text"
178 178 options = { :type => :text, :order => 20 }
179 179 when "list"
180 180 options = { :type => :list_optional, :values => field.possible_values, :order => 20}
181 181 when "date"
182 182 options = { :type => :date, :order => 20 }
183 183 when "bool"
184 184 options = { :type => :list, :values => [[l(:general_text_yes), "1"], [l(:general_text_no), "0"]], :order => 20 }
185 185 else
186 186 options = { :type => :string, :order => 20 }
187 187 end
188 188 @available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
189 189 end
190 190 # remove category filter if no category defined
191 191 @available_filters.delete "category_id" if @available_filters["category_id"][:values].empty?
192 192 end
193 193 @available_filters
194 194 end
195 195
196 196 def add_filter(field, operator, values)
197 197 # values must be an array
198 198 return unless values and values.is_a? Array # and !values.first.empty?
199 199 # check if field is defined as an available filter
200 200 if available_filters.has_key? field
201 201 filter_options = available_filters[field]
202 202 # check if operator is allowed for that filter
203 203 #if @@operators_by_filter_type[filter_options[:type]].include? operator
204 204 # allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]})
205 205 # filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator
206 206 #end
207 207 filters[field] = {:operator => operator, :values => values }
208 208 end
209 209 end
210 210
211 211 def add_short_filter(field, expression)
212 212 return unless expression
213 213 parms = expression.scan(/^(o|c|\!|\*)?(.*)$/).first
214 214 add_filter field, (parms[0] || "="), [parms[1] || ""]
215 215 end
216 216
217 217 def has_filter?(field)
218 218 filters and filters[field]
219 219 end
220 220
221 221 def operator_for(field)
222 222 has_filter?(field) ? filters[field][:operator] : nil
223 223 end
224 224
225 225 def values_for(field)
226 226 has_filter?(field) ? filters[field][:values] : nil
227 227 end
228 228
229 229 def label_for(field)
230 230 label = @available_filters[field][:name] if @available_filters.has_key?(field)
231 231 label ||= field.gsub(/\_id$/, "")
232 232 end
233 233
234 234 def available_columns
235 235 return @available_columns if @available_columns
236 236 @available_columns = Query.available_columns
237 237 @available_columns += (project ?
238 238 project.all_custom_fields :
239 239 IssueCustomField.find(:all, :conditions => {:is_for_all => true})
240 240 ).collect {|cf| QueryCustomFieldColumn.new(cf) }
241 241 end
242 242
243 243 def columns
244 244 if has_default_columns?
245 245 available_columns.select {|c| Setting.issue_list_default_columns.include?(c.name.to_s) }
246 246 else
247 247 # preserve the column_names order
248 248 column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact
249 249 end
250 250 end
251 251
252 252 def column_names=(names)
253 253 names = names.select {|n| n.is_a?(Symbol) || !n.blank? } if names
254 254 names = names.collect {|n| n.is_a?(Symbol) ? n : n.to_sym } if names
255 255 write_attribute(:column_names, names)
256 256 end
257 257
258 258 def has_column?(column)
259 259 column_names && column_names.include?(column.name)
260 260 end
261 261
262 262 def has_default_columns?
263 263 column_names.nil? || column_names.empty?
264 264 end
265 265
266 266 def statement
267 267 # project/subprojects clause
268 268 clause = ''
269 269 if project && !@project.active_children.empty?
270 270 ids = [project.id]
271 271 if has_filter?("subproject_id")
272 272 case operator_for("subproject_id")
273 273 when '='
274 274 # include the selected subprojects
275 275 ids += values_for("subproject_id").each(&:to_i)
276 276 when '!*'
277 277 # main project only
278 278 else
279 279 # all subprojects
280 280 ids += project.active_children.collect{|p| p.id}
281 281 end
282 282 elsif Setting.display_subprojects_issues?
283 283 ids += project.active_children.collect{|p| p.id}
284 284 end
285 285 clause << "#{Issue.table_name}.project_id IN (%s)" % ids.join(',')
286 286 elsif project
287 287 clause << "#{Issue.table_name}.project_id = %d" % project.id
288 288 else
289 289 clause << Project.visible_by(User.current)
290 290 end
291 291
292 292 # filters clauses
293 293 filters_clauses = []
294 294 filters.each_key do |field|
295 295 next if field == "subproject_id"
296 296 v = values_for(field).clone
297 297 next unless v and !v.empty?
298 298
299 299 sql = ''
300 is_custom_filter = false
300 301 if field =~ /^cf_(\d+)$/
301 302 # custom field
302 303 db_table = CustomValue.table_name
303 304 db_field = 'value'
305 is_custom_filter = true
304 306 sql << "#{Issue.table_name}.id IN (SELECT #{Issue.table_name}.id FROM #{Issue.table_name} LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='Issue' AND #{db_table}.customized_id=#{Issue.table_name}.id AND #{db_table}.custom_field_id=#{$1} WHERE "
305 307 else
306 308 # regular field
307 309 db_table = Issue.table_name
308 310 db_field = field
309 311 sql << '('
310 312 end
311 313
312 314 # "me" value subsitution
313 315 if %w(assigned_to_id author_id).include?(field)
314 316 v.push(User.current.logged? ? User.current.id.to_s : "0") if v.delete("me")
315 317 end
316 318
317 319 case operator_for field
318 320 when "="
319 321 sql = sql + "#{db_table}.#{db_field} IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
320 322 when "!"
321 323 sql = sql + "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
322 324 when "!*"
323 sql = sql + "#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} = ''"
325 sql = sql + "#{db_table}.#{db_field} IS NULL"
326 sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter
324 327 when "*"
325 sql = sql + "#{db_table}.#{db_field} IS NOT NULL AND #{db_table}.#{db_field} <> ''"
328 sql = sql + "#{db_table}.#{db_field} IS NOT NULL"
329 sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
326 330 when ">="
327 331 sql = sql + "#{db_table}.#{db_field} >= #{v.first.to_i}"
328 332 when "<="
329 333 sql = sql + "#{db_table}.#{db_field} <= #{v.first.to_i}"
330 334 when "o"
331 335 sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
332 336 when "c"
333 337 sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}" if field == "status_id"
334 338 when ">t-"
335 339 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today - v.first.to_i).to_time), connection.quoted_date((Date.today + 1).to_time)]
336 340 when "<t-"
337 341 sql = sql + "#{db_table}.#{db_field} <= '%s'" % connection.quoted_date((Date.today - v.first.to_i).to_time)
338 342 when "t-"
339 343 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today - v.first.to_i).to_time), connection.quoted_date((Date.today - v.first.to_i + 1).to_time)]
340 344 when ">t+"
341 345 sql = sql + "#{db_table}.#{db_field} >= '%s'" % connection.quoted_date((Date.today + v.first.to_i).to_time)
342 346 when "<t+"
343 347 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
344 348 when "t+"
345 349 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today + v.first.to_i).to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
346 350 when "t"
347 351 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)]
348 352 when "w"
349 353 from = l(:general_first_day_of_week) == '7' ?
350 354 # week starts on sunday
351 355 ((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :
352 356 # week starts on monday (Rails default)
353 357 Time.now.at_beginning_of_week
354 358 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]
355 359 when "~"
356 360 sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'"
357 361 when "!~"
358 362 sql = sql + "#{db_table}.#{db_field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
359 363 end
360 364 sql << ')'
361 365 filters_clauses << sql
362 366 end if filters and valid?
363 367
364 368 clause << ' AND ' unless clause.empty?
365 369 clause << filters_clauses.join(' AND ') unless filters_clauses.empty?
366 370 clause
367 371 end
368 372 end
@@ -1,133 +1,133
1 1 require 'redmine/access_control'
2 2 require 'redmine/menu_manager'
3 3 require 'redmine/mime_type'
4 4 require 'redmine/core_ext'
5 5 require 'redmine/themes'
6 6 require 'redmine/plugin'
7 7
8 8 begin
9 9 require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick)
10 10 rescue LoadError
11 11 # RMagick is not available
12 12 end
13 13
14 14 REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs Bazaar Git )
15 15
16 16 # Permissions
17 17 Redmine::AccessControl.map do |map|
18 18 map.permission :view_project, {:projects => [:show, :activity]}, :public => true
19 19 map.permission :search_project, {:search => :index}, :public => true
20 20 map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member
21 21 map.permission :select_project_modules, {:projects => :modules}, :require => :member
22 22 map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy]}, :require => :member
23 23 map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :destroy]}, :require => :member
24 24
25 25 map.project_module :issue_tracking do |map|
26 26 # Issue categories
27 27 map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member
28 28 # Issues
29 29 map.permission :view_issues, {:projects => [:changelog, :roadmap],
30 30 :issues => [:index, :changes, :show, :context_menu],
31 31 :versions => [:show, :status_by],
32 32 :queries => :index,
33 33 :reports => :issue_report}, :public => true
34 34 map.permission :add_issues, {:issues => :new}
35 35 map.permission :edit_issues, {:issues => [:edit, :bulk_edit, :destroy_attachment]}
36 36 map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
37 37 map.permission :add_issue_notes, {:issues => :edit}
38 38 map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
39 39 map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
40 40 map.permission :move_issues, {:issues => :move}, :require => :loggedin
41 41 map.permission :delete_issues, {:issues => :destroy}, :require => :member
42 42 # Queries
43 43 map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
44 44 map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin
45 45 # Gantt & calendar
46 46 map.permission :view_gantt, :projects => :gantt
47 47 map.permission :view_calendar, :projects => :calendar
48 48 end
49 49
50 50 map.project_module :time_tracking do |map|
51 51 map.permission :log_time, {:timelog => :edit}, :require => :loggedin
52 52 map.permission :view_time_entries, :timelog => [:details, :report]
53 53 map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member
54 54 map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin
55 55 end
56 56
57 57 map.project_module :news do |map|
58 58 map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member
59 59 map.permission :view_news, {:news => [:index, :show]}, :public => true
60 60 map.permission :comment_news, {:news => :add_comment}
61 61 end
62 62
63 63 map.project_module :documents do |map|
64 64 map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin
65 65 map.permission :view_documents, :documents => [:index, :show, :download]
66 66 end
67 67
68 68 map.project_module :files do |map|
69 69 map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin
70 70 map.permission :view_files, :projects => :list_files, :versions => :download
71 71 end
72 72
73 73 map.project_module :wiki do |map|
74 74 map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member
75 75 map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
76 76 map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
77 77 map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :annotate, :special]
78 78 map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment]
79 79 end
80 80
81 81 map.project_module :repository do |map|
82 82 map.permission :manage_repository, {:repositories => [:edit, :destroy]}, :require => :member
83 83 map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph]
84 84 map.permission :view_changesets, :repositories => [:show, :revisions, :revision]
85 85 end
86 86
87 87 map.project_module :boards do |map|
88 88 map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member
89 89 map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true
90 90 map.permission :add_messages, {:messages => [:new, :reply]}
91 91 map.permission :edit_messages, {:messages => :edit}, :require => :member
92 92 map.permission :delete_messages, {:messages => :destroy}, :require => :member
93 93 end
94 94 end
95 95
96 96 Redmine::MenuManager.map :top_menu do |menu|
97 menu.push :home, :home_url, :html => { :class => 'home' }
97 menu.push :home, :home_path, :html => { :class => 'home' }
98 98 menu.push :my_page, { :controller => 'my', :action => 'page' }, :html => { :class => 'mypage' }, :if => Proc.new { User.current.logged? }
99 99 menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural, :html => { :class => 'projects' }
100 100 menu.push :administration, { :controller => 'admin', :action => 'index' }, :html => { :class => 'admin' }, :if => Proc.new { User.current.admin? }
101 101 menu.push :help, Redmine::Info.help_url, :html => { :class => 'help' }
102 102 end
103 103
104 104 Redmine::MenuManager.map :account_menu do |menu|
105 menu.push :login, :signin_url, :html => { :class => 'login' }, :if => Proc.new { !User.current.logged? }
105 menu.push :login, :signin_path, :html => { :class => 'login' }, :if => Proc.new { !User.current.logged? }
106 106 menu.push :register, { :controller => 'account', :action => 'register' }, :html => { :class => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
107 107 menu.push :my_account, { :controller => 'my', :action => 'account' }, :html => { :class => 'myaccount' }, :if => Proc.new { User.current.logged? }
108 menu.push :logout, :signout_url, :html => { :class => 'logout' }, :if => Proc.new { User.current.logged? }
108 menu.push :logout, :signout_path, :html => { :class => 'logout' }, :if => Proc.new { User.current.logged? }
109 109 end
110 110
111 111 Redmine::MenuManager.map :application_menu do |menu|
112 112 # Empty
113 113 end
114 114
115 115 Redmine::MenuManager.map :project_menu do |menu|
116 116 menu.push :overview, { :controller => 'projects', :action => 'show' }
117 117 menu.push :activity, { :controller => 'projects', :action => 'activity' }
118 118 menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' },
119 119 :if => Proc.new { |p| p.versions.any? }
120 120 menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
121 121 menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new,
122 122 :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
123 123 menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
124 124 menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural
125 125 menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil },
126 126 :if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
127 127 menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
128 128 :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
129 129 menu.push :files, { :controller => 'projects', :action => 'list_files' }, :caption => :label_attachment_plural
130 130 menu.push :repository, { :controller => 'repositories', :action => 'show' },
131 131 :if => Proc.new { |p| p.repository && !p.repository.new_record? }
132 132 menu.push :settings, { :controller => 'projects', :action => 'settings' }
133 133 end
@@ -1,40 +1,40
1 1 # redMine - project management software
2 2 # Copyright (C) 2008 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module Redmine #:nodoc:
19 19 module CoreExtensions #:nodoc:
20 20 module String #:nodoc:
21 21 # Custom string conversions
22 22 module Conversions
23 23 # Parses hours format and returns a float
24 24 def to_hours
25 25 s = self.dup
26 26 s.strip!
27 27 unless s =~ %r{^[\d\.,]+$}
28 28 # 2:30 => 2.5
29 29 s.gsub!(%r{^(\d+):(\d+)$}) { $1.to_i + $2.to_i / 60.0 }
30 30 # 2h30, 2h, 30m => 2.5, 2, 0.5
31 31 s.gsub!(%r{^((\d+)\s*(h|hours?))?\s*((\d+)\s*(m|min)?)?$}) { |m| ($1 || $4) ? ($2.to_i + $5.to_i / 60.0) : m[0] }
32 32 end
33 33 # 2,5 => 2.5
34 34 s.gsub!(',', '.')
35 s.to_f
35 begin; Kernel.Float(s); rescue; nil; end
36 36 end
37 37 end
38 38 end
39 39 end
40 40 end
@@ -1,63 +1,64
1 1 ---
2 2 custom_fields_001:
3 3 name: Database
4 4 min_length: 0
5 5 regexp: ""
6 6 is_for_all: true
7 is_filter: true
7 8 type: IssueCustomField
8 9 max_length: 0
9 10 possible_values: MySQL|PostgreSQL|Oracle
10 11 id: 1
11 12 is_required: false
12 13 field_format: list
13 14 default_value: ""
14 15 custom_fields_002:
15 16 name: Searchable field
16 17 min_length: 1
17 18 regexp: ""
18 19 is_for_all: true
19 20 type: IssueCustomField
20 21 max_length: 100
21 22 possible_values: ""
22 23 id: 2
23 24 is_required: false
24 25 field_format: string
25 26 searchable: true
26 27 default_value: "Default string"
27 28 custom_fields_003:
28 29 name: Development status
29 30 min_length: 0
30 31 regexp: ""
31 32 is_for_all: false
32 33 type: ProjectCustomField
33 34 max_length: 0
34 35 possible_values: Stable|Beta|Alpha|Planning
35 36 id: 3
36 37 is_required: true
37 38 field_format: list
38 39 default_value: ""
39 40 custom_fields_004:
40 41 name: Phone number
41 42 min_length: 0
42 43 regexp: ""
43 44 is_for_all: false
44 45 type: UserCustomField
45 46 max_length: 0
46 47 possible_values: ""
47 48 id: 4
48 49 is_required: false
49 50 field_format: string
50 51 default_value: ""
51 52 custom_fields_005:
52 53 name: Money
53 54 min_length: 0
54 55 regexp: ""
55 56 is_for_all: false
56 57 type: UserCustomField
57 58 max_length: 0
58 59 possible_values: ""
59 60 id: 5
60 61 is_required: false
61 62 field_format: float
62 63 default_value: ""
63 64 No newline at end of file
@@ -1,507 +1,514
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.dirname(__FILE__) + '/../test_helper'
19 19 require 'issues_controller'
20 20
21 21 # Re-raise errors caught by the controller.
22 22 class IssuesController; def rescue_action(e) raise e end; end
23 23
24 24 class IssuesControllerTest < Test::Unit::TestCase
25 25 fixtures :projects,
26 26 :users,
27 27 :roles,
28 28 :members,
29 29 :issues,
30 30 :issue_statuses,
31 31 :trackers,
32 32 :projects_trackers,
33 33 :issue_categories,
34 34 :enabled_modules,
35 35 :enumerations,
36 36 :attachments,
37 37 :workflows,
38 38 :custom_fields,
39 39 :custom_values,
40 40 :custom_fields_trackers,
41 41 :time_entries
42 42
43 43 def setup
44 44 @controller = IssuesController.new
45 45 @request = ActionController::TestRequest.new
46 46 @response = ActionController::TestResponse.new
47 47 User.current = nil
48 48 end
49 49
50 50 def test_index
51 51 get :index
52 52 assert_response :success
53 53 assert_template 'index.rhtml'
54 54 assert_not_nil assigns(:issues)
55 55 assert_nil assigns(:project)
56 56 end
57 57
58 58 def test_index_with_project
59 59 get :index, :project_id => 1
60 60 assert_response :success
61 61 assert_template 'index.rhtml'
62 62 assert_not_nil assigns(:issues)
63 63 end
64 64
65 65 def test_index_with_project_and_filter
66 66 get :index, :project_id => 1, :set_filter => 1
67 67 assert_response :success
68 68 assert_template 'index.rhtml'
69 69 assert_not_nil assigns(:issues)
70 70 end
71 71
72 72 def test_index_csv_with_project
73 73 get :index, :format => 'csv'
74 74 assert_response :success
75 75 assert_not_nil assigns(:issues)
76 76 assert_equal 'text/csv', @response.content_type
77 77
78 78 get :index, :project_id => 1, :format => 'csv'
79 79 assert_response :success
80 80 assert_not_nil assigns(:issues)
81 81 assert_equal 'text/csv', @response.content_type
82 82 end
83 83
84 84 def test_index_pdf
85 85 get :index, :format => 'pdf'
86 86 assert_response :success
87 87 assert_not_nil assigns(:issues)
88 88 assert_equal 'application/pdf', @response.content_type
89 89
90 90 get :index, :project_id => 1, :format => 'pdf'
91 91 assert_response :success
92 92 assert_not_nil assigns(:issues)
93 93 assert_equal 'application/pdf', @response.content_type
94 94 end
95 95
96 96 def test_changes
97 97 get :changes, :project_id => 1
98 98 assert_response :success
99 99 assert_not_nil assigns(:journals)
100 100 assert_equal 'application/atom+xml', @response.content_type
101 101 end
102 102
103 103 def test_show_by_anonymous
104 104 get :show, :id => 1
105 105 assert_response :success
106 106 assert_template 'show.rhtml'
107 107 assert_not_nil assigns(:issue)
108 108 assert_equal Issue.find(1), assigns(:issue)
109 109
110 110 # anonymous role is allowed to add a note
111 111 assert_tag :tag => 'form',
112 112 :descendant => { :tag => 'fieldset',
113 113 :child => { :tag => 'legend',
114 114 :content => /Notes/ } }
115 115 end
116 116
117 117 def test_show_by_manager
118 118 @request.session[:user_id] = 2
119 119 get :show, :id => 1
120 120 assert_response :success
121 121
122 122 assert_tag :tag => 'form',
123 123 :descendant => { :tag => 'fieldset',
124 124 :child => { :tag => 'legend',
125 125 :content => /Change properties/ } },
126 126 :descendant => { :tag => 'fieldset',
127 127 :child => { :tag => 'legend',
128 128 :content => /Log time/ } },
129 129 :descendant => { :tag => 'fieldset',
130 130 :child => { :tag => 'legend',
131 131 :content => /Notes/ } }
132 132 end
133 133
134 134 def test_get_new
135 135 @request.session[:user_id] = 2
136 136 get :new, :project_id => 1, :tracker_id => 1
137 137 assert_response :success
138 138 assert_template 'new'
139 139
140 140 assert_tag :tag => 'input', :attributes => { :name => 'custom_fields[2]',
141 141 :value => 'Default string' }
142 142 end
143 143
144 144 def test_get_new_without_tracker_id
145 145 @request.session[:user_id] = 2
146 146 get :new, :project_id => 1
147 147 assert_response :success
148 148 assert_template 'new'
149 149
150 150 issue = assigns(:issue)
151 151 assert_not_nil issue
152 152 assert_equal Project.find(1).trackers.first, issue.tracker
153 153 end
154 154
155 155 def test_update_new_form
156 156 @request.session[:user_id] = 2
157 157 xhr :post, :new, :project_id => 1,
158 158 :issue => {:tracker_id => 2,
159 159 :subject => 'This is the test_new issue',
160 160 :description => 'This is the description',
161 161 :priority_id => 5}
162 162 assert_response :success
163 163 assert_template 'new'
164 164 end
165 165
166 166 def test_post_new
167 167 @request.session[:user_id] = 2
168 168 post :new, :project_id => 1,
169 169 :issue => {:tracker_id => 1,
170 170 :subject => 'This is the test_new issue',
171 171 :description => 'This is the description',
172 :priority_id => 5},
172 :priority_id => 5,
173 :estimated_hours => ''},
173 174 :custom_fields => {'2' => 'Value for field 2'}
174 175 assert_redirected_to 'issues/show'
175 176
176 177 issue = Issue.find_by_subject('This is the test_new issue')
177 178 assert_not_nil issue
178 179 assert_equal 2, issue.author_id
180 assert_nil issue.estimated_hours
179 181 v = issue.custom_values.find_by_custom_field_id(2)
180 182 assert_not_nil v
181 183 assert_equal 'Value for field 2', v.value
182 184 end
183 185
184 186 def test_post_new_without_custom_fields_param
185 187 @request.session[:user_id] = 2
186 188 post :new, :project_id => 1,
187 189 :issue => {:tracker_id => 1,
188 190 :subject => 'This is the test_new issue',
189 191 :description => 'This is the description',
190 192 :priority_id => 5}
191 193 assert_redirected_to 'issues/show'
192 194 end
193 195
194 196 def test_copy_issue
195 197 @request.session[:user_id] = 2
196 198 get :new, :project_id => 1, :copy_from => 1
197 199 assert_template 'new'
198 200 assert_not_nil assigns(:issue)
199 201 orig = Issue.find(1)
200 202 assert_equal orig.subject, assigns(:issue).subject
201 203 end
202 204
203 205 def test_get_edit
204 206 @request.session[:user_id] = 2
205 207 get :edit, :id => 1
206 208 assert_response :success
207 209 assert_template 'edit'
208 210 assert_not_nil assigns(:issue)
209 211 assert_equal Issue.find(1), assigns(:issue)
210 212 end
211 213
212 214 def test_get_edit_with_params
213 215 @request.session[:user_id] = 2
214 216 get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 }
215 217 assert_response :success
216 218 assert_template 'edit'
217 219
218 220 issue = assigns(:issue)
219 221 assert_not_nil issue
220 222
221 223 assert_equal 5, issue.status_id
222 224 assert_tag :select, :attributes => { :name => 'issue[status_id]' },
223 225 :child => { :tag => 'option',
224 226 :content => 'Closed',
225 227 :attributes => { :selected => 'selected' } }
226 228
227 229 assert_equal 7, issue.priority_id
228 230 assert_tag :select, :attributes => { :name => 'issue[priority_id]' },
229 231 :child => { :tag => 'option',
230 232 :content => 'Urgent',
231 233 :attributes => { :selected => 'selected' } }
232 234 end
233 235
234 236 def test_post_edit
235 237 @request.session[:user_id] = 2
236 238 ActionMailer::Base.deliveries.clear
237 239
238 240 issue = Issue.find(1)
239 241 old_subject = issue.subject
240 242 new_subject = 'Subject modified by IssuesControllerTest#test_post_edit'
241 243
242 244 post :edit, :id => 1, :issue => {:subject => new_subject}
243 245 assert_redirected_to 'issues/show/1'
244 246 issue.reload
245 247 assert_equal new_subject, issue.subject
246 248
247 249 mail = ActionMailer::Base.deliveries.last
248 250 assert_kind_of TMail::Mail, mail
249 251 assert mail.subject.starts_with?("[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}]")
250 252 assert mail.body.include?("Subject changed from #{old_subject} to #{new_subject}")
251 253 end
252 254
253 255 def test_post_edit_with_status_and_assignee_change
254 256 issue = Issue.find(1)
255 257 assert_equal 1, issue.status_id
256 258 @request.session[:user_id] = 2
259 assert_difference('TimeEntry.count', 0) do
257 260 post :edit,
258 261 :id => 1,
259 262 :issue => { :status_id => 2, :assigned_to_id => 3 },
260 :notes => 'Assigned to dlopper'
263 :notes => 'Assigned to dlopper',
264 :time_entry => { :hours => '', :comments => '', :activity_id => Enumeration.get_values('ACTI').first }
265 end
261 266 assert_redirected_to 'issues/show/1'
262 267 issue.reload
263 268 assert_equal 2, issue.status_id
264 269 j = issue.journals.find(:first, :order => 'id DESC')
265 270 assert_equal 'Assigned to dlopper', j.notes
266 271 assert_equal 2, j.details.size
267 272
268 273 mail = ActionMailer::Base.deliveries.last
269 274 assert mail.body.include?("Status changed from New to Assigned")
270 275 end
271 276
272 277 def test_post_edit_with_note_only
273 278 notes = 'Note added by IssuesControllerTest#test_update_with_note_only'
274 279 # anonymous user
275 280 post :edit,
276 281 :id => 1,
277 282 :notes => notes
278 283 assert_redirected_to 'issues/show/1'
279 284 j = Issue.find(1).journals.find(:first, :order => 'id DESC')
280 285 assert_equal notes, j.notes
281 286 assert_equal 0, j.details.size
282 287 assert_equal User.anonymous, j.user
283 288
284 289 mail = ActionMailer::Base.deliveries.last
285 290 assert mail.body.include?(notes)
286 291 end
287 292
288 293 def test_post_edit_with_note_and_spent_time
289 294 @request.session[:user_id] = 2
290 295 spent_hours_before = Issue.find(1).spent_hours
296 assert_difference('TimeEntry.count') do
291 297 post :edit,
292 298 :id => 1,
293 299 :notes => '2.5 hours added',
294 300 :time_entry => { :hours => '2.5', :comments => '', :activity_id => Enumeration.get_values('ACTI').first }
301 end
295 302 assert_redirected_to 'issues/show/1'
296 303
297 304 issue = Issue.find(1)
298 305
299 306 j = issue.journals.find(:first, :order => 'id DESC')
300 307 assert_equal '2.5 hours added', j.notes
301 308 assert_equal 0, j.details.size
302 309
303 310 t = issue.time_entries.find(:first, :order => 'id DESC')
304 311 assert_not_nil t
305 312 assert_equal 2.5, t.hours
306 313 assert_equal spent_hours_before + 2.5, issue.spent_hours
307 314 end
308 315
309 316 def test_post_edit_with_attachment_only
310 317 # anonymous user
311 318 post :edit,
312 319 :id => 1,
313 320 :notes => '',
314 321 :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
315 322 assert_redirected_to 'issues/show/1'
316 323 j = Issue.find(1).journals.find(:first, :order => 'id DESC')
317 324 assert j.notes.blank?
318 325 assert_equal 1, j.details.size
319 326 assert_equal 'testfile.txt', j.details.first.value
320 327 assert_equal User.anonymous, j.user
321 328
322 329 mail = ActionMailer::Base.deliveries.last
323 330 assert mail.body.include?('testfile.txt')
324 331 end
325 332
326 333 def test_post_edit_with_no_change
327 334 issue = Issue.find(1)
328 335 issue.journals.clear
329 336 ActionMailer::Base.deliveries.clear
330 337
331 338 post :edit,
332 339 :id => 1,
333 340 :notes => ''
334 341 assert_redirected_to 'issues/show/1'
335 342
336 343 issue.reload
337 344 assert issue.journals.empty?
338 345 # No email should be sent
339 346 assert ActionMailer::Base.deliveries.empty?
340 347 end
341 348
342 349 def test_bulk_edit
343 350 @request.session[:user_id] = 2
344 351 # update issues priority
345 352 post :bulk_edit, :ids => [1, 2], :priority_id => 7, :notes => 'Bulk editing', :assigned_to_id => ''
346 353 assert_response 302
347 354 # check that the issues were updated
348 355 assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
349 356 assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes
350 357 end
351 358
352 359 def test_bulk_unassign
353 360 assert_not_nil Issue.find(2).assigned_to
354 361 @request.session[:user_id] = 2
355 362 # unassign issues
356 363 post :bulk_edit, :ids => [1, 2], :notes => 'Bulk unassigning', :assigned_to_id => 'none'
357 364 assert_response 302
358 365 # check that the issues were updated
359 366 assert_nil Issue.find(2).assigned_to
360 367 end
361 368
362 369 def test_move_one_issue_to_another_project
363 370 @request.session[:user_id] = 1
364 371 post :move, :id => 1, :new_project_id => 2
365 372 assert_redirected_to 'projects/ecookbook/issues'
366 373 assert_equal 2, Issue.find(1).project_id
367 374 end
368 375
369 376 def test_bulk_move_to_another_project
370 377 @request.session[:user_id] = 1
371 378 post :move, :ids => [1, 2], :new_project_id => 2
372 379 assert_redirected_to 'projects/ecookbook/issues'
373 380 # Issues moved to project 2
374 381 assert_equal 2, Issue.find(1).project_id
375 382 assert_equal 2, Issue.find(2).project_id
376 383 # No tracker change
377 384 assert_equal 1, Issue.find(1).tracker_id
378 385 assert_equal 2, Issue.find(2).tracker_id
379 386 end
380 387
381 388 def test_bulk_move_to_another_tracker
382 389 @request.session[:user_id] = 1
383 390 post :move, :ids => [1, 2], :new_tracker_id => 2
384 391 assert_redirected_to 'projects/ecookbook/issues'
385 392 assert_equal 2, Issue.find(1).tracker_id
386 393 assert_equal 2, Issue.find(2).tracker_id
387 394 end
388 395
389 396 def test_context_menu_one_issue
390 397 @request.session[:user_id] = 2
391 398 get :context_menu, :ids => [1]
392 399 assert_response :success
393 400 assert_template 'context_menu'
394 401 assert_tag :tag => 'a', :content => 'Edit',
395 402 :attributes => { :href => '/issues/edit/1',
396 403 :class => 'icon-edit' }
397 404 assert_tag :tag => 'a', :content => 'Closed',
398 405 :attributes => { :href => '/issues/edit/1?issue%5Bstatus_id%5D=5',
399 406 :class => '' }
400 407 assert_tag :tag => 'a', :content => 'Immediate',
401 408 :attributes => { :href => '/issues/edit/1?issue%5Bpriority_id%5D=8',
402 409 :class => '' }
403 410 assert_tag :tag => 'a', :content => 'Dave Lopper',
404 411 :attributes => { :href => '/issues/edit/1?issue%5Bassigned_to_id%5D=3',
405 412 :class => '' }
406 413 assert_tag :tag => 'a', :content => 'Copy',
407 414 :attributes => { :href => '/projects/ecookbook/issues/new?copy_from=1',
408 415 :class => 'icon-copy' }
409 416 assert_tag :tag => 'a', :content => 'Move',
410 417 :attributes => { :href => '/issues/move?ids%5B%5D=1',
411 418 :class => 'icon-move' }
412 419 assert_tag :tag => 'a', :content => 'Delete',
413 420 :attributes => { :href => '/issues/destroy?ids%5B%5D=1',
414 421 :class => 'icon-del' }
415 422 end
416 423
417 424 def test_context_menu_one_issue_by_anonymous
418 425 get :context_menu, :ids => [1]
419 426 assert_response :success
420 427 assert_template 'context_menu'
421 428 assert_tag :tag => 'a', :content => 'Delete',
422 429 :attributes => { :href => '#',
423 430 :class => 'icon-del disabled' }
424 431 end
425 432
426 433 def test_context_menu_multiple_issues_of_same_project
427 434 @request.session[:user_id] = 2
428 435 get :context_menu, :ids => [1, 2]
429 436 assert_response :success
430 437 assert_template 'context_menu'
431 438 assert_tag :tag => 'a', :content => 'Edit',
432 439 :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;ids%5B%5D=2',
433 440 :class => 'icon-edit' }
434 441 assert_tag :tag => 'a', :content => 'Move',
435 442 :attributes => { :href => '/issues/move?ids%5B%5D=1&amp;ids%5B%5D=2',
436 443 :class => 'icon-move' }
437 444 assert_tag :tag => 'a', :content => 'Delete',
438 445 :attributes => { :href => '/issues/destroy?ids%5B%5D=1&amp;ids%5B%5D=2',
439 446 :class => 'icon-del' }
440 447 end
441 448
442 449 def test_context_menu_multiple_issues_of_different_project
443 450 @request.session[:user_id] = 2
444 451 get :context_menu, :ids => [1, 2, 4]
445 452 assert_response :success
446 453 assert_template 'context_menu'
447 454 assert_tag :tag => 'a', :content => 'Delete',
448 455 :attributes => { :href => '#',
449 456 :class => 'icon-del disabled' }
450 457 end
451 458
452 459 def test_destroy_issue_with_no_time_entries
453 460 assert_nil TimeEntry.find_by_issue_id(2)
454 461 @request.session[:user_id] = 2
455 462 post :destroy, :id => 2
456 463 assert_redirected_to 'projects/ecookbook/issues'
457 464 assert_nil Issue.find_by_id(2)
458 465 end
459 466
460 467 def test_destroy_issues_with_time_entries
461 468 @request.session[:user_id] = 2
462 469 post :destroy, :ids => [1, 3]
463 470 assert_response :success
464 471 assert_template 'destroy'
465 472 assert_not_nil assigns(:hours)
466 473 assert Issue.find_by_id(1) && Issue.find_by_id(3)
467 474 end
468 475
469 476 def test_destroy_issues_and_destroy_time_entries
470 477 @request.session[:user_id] = 2
471 478 post :destroy, :ids => [1, 3], :todo => 'destroy'
472 479 assert_redirected_to 'projects/ecookbook/issues'
473 480 assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
474 481 assert_nil TimeEntry.find_by_id([1, 2])
475 482 end
476 483
477 484 def test_destroy_issues_and_assign_time_entries_to_project
478 485 @request.session[:user_id] = 2
479 486 post :destroy, :ids => [1, 3], :todo => 'nullify'
480 487 assert_redirected_to 'projects/ecookbook/issues'
481 488 assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
482 489 assert_nil TimeEntry.find(1).issue_id
483 490 assert_nil TimeEntry.find(2).issue_id
484 491 end
485 492
486 493 def test_destroy_issues_and_reassign_time_entries_to_another_issue
487 494 @request.session[:user_id] = 2
488 495 post :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2
489 496 assert_redirected_to 'projects/ecookbook/issues'
490 497 assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
491 498 assert_equal 2, TimeEntry.find(1).issue_id
492 499 assert_equal 2, TimeEntry.find(2).issue_id
493 500 end
494 501
495 502 def test_destroy_attachment
496 503 issue = Issue.find(3)
497 504 a = issue.attachments.size
498 505 @request.session[:user_id] = 2
499 506 post :destroy_attachment, :id => 3, :attachment_id => 1
500 507 assert_redirected_to 'issues/show/3'
501 508 assert_nil Attachment.find_by_id(1)
502 509 issue.reload
503 510 assert_equal((a-1), issue.attachments.size)
504 511 j = issue.journals.find(:first, :order => 'created_on DESC')
505 512 assert_equal 'attachment', j.details.first.property
506 513 end
507 514 end
@@ -1,74 +1,148
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2008 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.dirname(__FILE__) + '/../test_helper'
19 19
20 20 class QueryTest < Test::Unit::TestCase
21 21 fixtures :projects, :users, :members, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
22 22
23 23 def test_query_with_multiple_custom_fields
24 24 query = Query.find(1)
25 25 assert query.valid?
26 26 assert query.statement.include?("#{CustomValue.table_name}.value IN ('MySQL')")
27 27 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
28 28 assert_equal 1, issues.length
29 29 assert_equal Issue.find(3), issues.first
30 30 end
31 31
32 def test_operator_none
33 query = Query.new(:project => Project.find(1), :name => '_')
34 query.add_filter('fixed_version_id', '!*', [''])
35 query.add_filter('cf_1', '!*', [''])
36 assert query.statement.include?("#{Issue.table_name}.fixed_version_id IS NULL")
37 assert query.statement.include?("#{CustomValue.table_name}.value IS NULL OR #{CustomValue.table_name}.value = ''")
38 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
39 end
40
41 def test_operator_all
42 query = Query.new(:project => Project.find(1), :name => '_')
43 query.add_filter('fixed_version_id', '*', [''])
44 query.add_filter('cf_1', '*', [''])
45 assert query.statement.include?("#{Issue.table_name}.fixed_version_id IS NOT NULL")
46 assert query.statement.include?("#{CustomValue.table_name}.value IS NOT NULL AND #{CustomValue.table_name}.value <> ''")
47 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
48 end
49
50 def test_operator_greater_than
51 query = Query.new(:project => Project.find(1), :name => '_')
52 query.add_filter('done_ratio', '>=', ['40'])
53 assert query.statement.include?("#{Issue.table_name}.done_ratio >= 40")
54 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
55 end
56
57 def test_operator_in_more_than
58 query = Query.new(:project => Project.find(1), :name => '_')
59 query.add_filter('due_date', '>t+', ['15'])
60 assert query.statement.include?("#{Issue.table_name}.due_date >=")
61 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
62 end
63
64 def test_operator_in_less_than
65 query = Query.new(:project => Project.find(1), :name => '_')
66 query.add_filter('due_date', '<t+', ['15'])
67 assert query.statement.include?("#{Issue.table_name}.due_date BETWEEN")
68 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
69 end
70
71 def test_operator_today
72 query = Query.new(:project => Project.find(1), :name => '_')
73 query.add_filter('due_date', 't', [''])
74 assert query.statement.include?("#{Issue.table_name}.due_date BETWEEN")
75 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
76 end
77
78 def test_operator_this_week_on_date
79 query = Query.new(:project => Project.find(1), :name => '_')
80 query.add_filter('due_date', 'w', [''])
81 assert query.statement.include?("#{Issue.table_name}.due_date BETWEEN")
82 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
83 end
84
85 def test_operator_this_week_on_datetime
86 query = Query.new(:project => Project.find(1), :name => '_')
87 query.add_filter('created_on', 'w', [''])
88 assert query.statement.include?("#{Issue.table_name}.created_on BETWEEN")
89 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
90 end
91
92 def test_operator_contains
93 query = Query.new(:project => Project.find(1), :name => '_')
94 query.add_filter('subject', '~', ['string'])
95 assert query.statement.include?("#{Issue.table_name}.subject LIKE '%string%'")
96 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
97 end
98
99 def test_operator_does_not_contains
100 query = Query.new(:project => Project.find(1), :name => '_')
101 query.add_filter('subject', '!~', ['string'])
102 assert query.statement.include?("#{Issue.table_name}.subject NOT LIKE '%string%'")
103 issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement
104 end
105
32 106 def test_default_columns
33 107 q = Query.new
34 108 assert !q.columns.empty?
35 109 end
36 110
37 111 def test_set_column_names
38 112 q = Query.new
39 113 q.column_names = ['tracker', :subject, '', 'unknonw_column']
40 114 assert_equal [:tracker, :subject], q.columns.collect {|c| c.name}
41 115 c = q.columns.first
42 116 assert q.has_column?(c)
43 117 end
44 118
45 119 def test_editable_by
46 120 admin = User.find(1)
47 121 manager = User.find(2)
48 122 developer = User.find(3)
49 123
50 124 # Public query on project 1
51 125 q = Query.find(1)
52 126 assert q.editable_by?(admin)
53 127 assert q.editable_by?(manager)
54 128 assert !q.editable_by?(developer)
55 129
56 130 # Private query on project 1
57 131 q = Query.find(2)
58 132 assert q.editable_by?(admin)
59 133 assert !q.editable_by?(manager)
60 134 assert q.editable_by?(developer)
61 135
62 136 # Private query for all projects
63 137 q = Query.find(3)
64 138 assert q.editable_by?(admin)
65 139 assert !q.editable_by?(manager)
66 140 assert q.editable_by?(developer)
67 141
68 142 # Public query for all projects
69 143 q = Query.find(4)
70 144 assert q.editable_by?(admin)
71 145 assert !q.editable_by?(manager)
72 146 assert !q.editable_by?(developer)
73 147 end
74 148 end
General Comments 0
You need to be logged in to leave comments. Login now