Compare commits

..

276 Commits

Author SHA1 Message Date
chris f8bb0bba56 Display de page contexts in the mobile version as set in structure 2013-10-08 18:10:55 +08:00
Spen 47b8b3e277 announcement init sorting fix 2013-10-07 15:33:50 +08:00
chris ecc3581106 Domain absolute url for tinymce files 2013-09-30 15:25:06 +08:00
Matthew K. Fu JuYuan 6d4d3ccfd4 for some reason can_display has been remove from announcement init. add it back. 2013-09-23 16:29:22 +08:00
Harry Bomrah 141b708392 widget code rewritten for gallery master branch 2013-09-16 11:22:56 +08:00
chris d5dc3ef793 Fix for user and role relationship (from role and sub-role side) 2013-09-13 15:02:31 +08:00
Spen b3366b48a1 announcement add new widget bulletins_and_links 2013-09-13 13:39:39 +08:00
saurabhbhatia 36e7e3d3e8 Fixed Locale settings for location navigation 2013-09-13 12:44:13 +08:00
saurabhbhatia 06c2240d34 Categories working tested and added link to sidebar
Conflicts:
	Gemfile
	config/mongoid.yml
2013-09-13 12:43:42 +08:00
Harry Bomrah c4e8ed96a9 location category 2013-09-13 12:40:18 +08:00
chris 8ad015af7f Remove before filter in user.rb in addition to the previous fix (Fix for user and role relationship) 2013-09-13 11:56:57 +08:00
chris 1857ad428c Fix for user and role relationship
Conflicts:
	lib/tasks/migrate.rake
2013-09-12 15:35:53 +08:00
Matt K. Fu 134b639465 fix announcement language 2013-09-09 17:35:22 +08:00
Matt K. Fu 45136f915d fix news default widget shows un-checked bulletins. 2013-09-09 11:14:31 +08:00
Matt K. Fu 2c3924d92c fix kaminari 2013-09-04 16:38:52 +08:00
Matt K. Fu 41b562d3f7 fix zip by limit version number 2013-09-04 15:20:55 +08:00
Matt K. Fu 4074ac677d fix rake zip 2013-09-04 10:36:16 +08:00
Matthew K. Fu JuYuan e1c57c6843 fixed default widget for tags 2013-09-03 16:17:45 +08:00
Matthew K. Fu JuYuan 915ea066d6 fixing bulletin default widget 2013-09-02 17:24:28 +08:00
Matt K. Fu e7aa7ea1fa added sorting DSL 2013-09-02 16:33:50 +08:00
Matt K. Fu 1ccfd6e48c fix sorting for default widget 2013-08-30 16:52:46 +08:00
Matt K. Fu 23516277f3 fix default widget query 2013-08-30 10:15:18 +08:00
Matt K. Fu 87bc2852b3 fix variable 2013-08-29 18:08:33 +08:00
Matt K. Fu 27b86b078a fix counter for recording request. 2013-08-28 17:56:03 +08:00
Matt K. Fu 8f393e1079 fix template for solar error. gitingore 2013-08-28 10:37:19 +08:00
Matt K. Fu 353039dcd0 fix script 2013-08-27 18:37:09 +08:00
Matt K. Fu d8dd68b4df fixing setting template and site init scripts 2013-08-27 17:28:33 +08:00
Matt K. Fu aa8523c8cf fix counter eval 2013-08-27 16:07:58 +08:00
Matt K. Fu 69ef8fa747 fix dash broad counter 2013-08-27 15:59:17 +08:00
Matt K. Fu 473baa9b95 add backup job 2013-08-27 15:59:17 +08:00
Matt K. Fu 1592aaff89 add option to logrotate for conversional policy. 2013-08-27 15:59:17 +08:00
Matt K. Fu 030d994180 make rake task more easier for service team 2013-08-27 15:59:17 +08:00
Matt K. Fu a88ad35641 add log rotate into site build procedure. 2013-08-27 15:59:17 +08:00
Matthew K. Fu JuYuan a63193dc65 logrotate template 2013-08-27 15:59:16 +08:00
Matt K. Fu 452bddb587 let site builder can enter rescue's worker 2013-08-27 15:59:16 +08:00
Matt K. Fu 371485e420 add handily task for service team 2013-08-27 15:59:16 +08:00
Matt K. Fu 69b3625861 add production pid log folder in case sold error 2013-08-27 15:59:16 +08:00
Matt K. Fu 72d1427854 fix erb for pass argument and paths 2013-08-27 15:59:16 +08:00
Matthew K. Fu JuYuan 079b9145c3 move all *.god to *.erb so the God init won't go wrong 2013-08-27 15:59:16 +08:00
Matt K. Fu 3102a46219 remove useless setting for solar 2013-08-27 15:59:16 +08:00
Matt K. Fu 653a098ab6 fix solr setting 2013-08-27 15:59:16 +08:00
Matt K. Fu 426edea485 add god to watch solr service 2013-08-27 15:59:16 +08:00
Matt K. Fu 2e5b2555c6 from now on the rescue namespace will be decided by site object field: resque_namespace 2013-08-27 15:59:16 +08:00
Matt K. Fu 2593707d8c fix rescue scheduler space error 2013-08-27 15:59:15 +08:00
saurabhbhatia b20955579e Cleaned Up ask module for master 2013-08-27 14:29:59 +08:00
saurabhbhatia 1ebda22f0e Updated with loader
Conflicts:
	vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_acknowledgements/index.html.erb
	vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb
2013-08-27 14:29:53 +08:00
saurabhbhatia c511aeb8de Removed logging statements 2013-08-27 14:29:47 +08:00
saurabhbhatia 26d3a89d30 Updated ask module with custom acknowledgement working 2013-08-27 14:29:39 +08:00
saurabhbhatia 91f80a0952 Deleted ask 2013-08-27 14:29:28 +08:00
saurabhbhatia f333fe9e21 Added custom acknowledgement to ask 2013-08-27 14:29:22 +08:00
saurabhbhatia 33f256bd16 Fix mailing redirect
Conflicts:
	vendor/built_in_modules/ask/init.rb
	vendor/built_in_modules/ask_new/app/controllers/panel/ask/front_end/ask_questions_controller.rb
	vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/thank_you.html.erb
	vendor/built_in_modules/ask_new/config/routes.rb
2013-08-19 13:03:49 +08:00
saurabhbhatia fde9fd7ffe Deleted Unnecessary Old code in ask module and video 2013-08-15 12:12:38 +08:00
saurabhbhatia d977b83d06 Updated captcha, mailing function working 2013-08-15 11:50:28 +08:00
saurabhbhatia a1eae7543e Updated ask module with a new captcha plugin 2013-08-15 11:50:21 +08:00
saurabhbhatia 8d9bf62909 final mongoid fix 2013-07-31 14:22:40 +08:00
saurabhbhatia 2f480c31bf Fixed mongoid 2013-07-31 13:54:29 +08:00
saurabhbhatia 19d33f78bd Updated Video with frontend widget and backend widget working 2013-07-31 13:52:24 +08:00
saurabhbhatia 37c91664d3 Updated with video widget 2013-07-31 13:52:22 +08:00
saurabhbhatia eb853f773d Updated video cleaned up the ui 2013-07-31 13:52:19 +08:00
saurabhbhatia d701d9d6ad Updated videos module with widget initiation 2013-07-31 13:52:10 +08:00
saurabhbhatia 75eeec737c Video and Channel Fetching now working 2013-07-31 13:52:07 +08:00
saurabhbhatia 36c3635bbb add youtube videos module 2013-07-31 13:52:05 +08:00
chris fa1c731ad3 Remove registerable 2013-07-30 18:24:05 +08:00
Harry Bomrah 2c24e788b0 fixed frontend 2013-07-23 18:32:24 +08:00
chris 26a8be2f0f Fix bulletins_controller.rb missing 'end' 2013-07-19 19:52:44 +08:00
chris fa51d16879 Remove space causing error in rake 2013-07-19 19:23:25 +08:00
chris ceff21fd1f Fix migrate.rake 2013-07-19 19:15:45 +08:00
Harry Bomrah 1357124f6f backend theater for ie fixed 2013-07-19 18:40:19 +08:00
Harry Bomrah 8c3fb43bf5 theater view fixed in IE 2013-07-19 18:40:09 +08:00
chris 71e8b3c042 Change get_item
Add category and tags to default widget link to object
2013-07-19 18:39:13 +08:00
Spen b37643147f mail_cron add send_mail_now and mail cron log fix 2013-07-19 17:18:48 +08:00
Spen ec57cbff1c ntue mail cron & log filter fix 2013-07-19 17:18:34 +08:00
Spen 7d6df11873 email send cron & send logs for any apps 2013-07-19 17:01:54 +08:00
Matt K. Fu 8043573370 fix delay impressionist for tags and pages 2013-07-19 17:00:38 +08:00
chris f025c98ffa Fix sorted_tags_for_cloud: it's now using the cloud_view_count 2013-07-19 01:52:36 +08:00
chris 3a91c92bf7 Fix visitor count. Mapping the session and making sure they were unique using rails was way slower than doing it with a mongoid query 2013-07-19 01:20:51 +08:00
Harry Bomrah b1d8a87256 frontend gallery fix 2013-07-18 21:22:23 +08:00
chris c7ac4e2485 Set tinymce-rails version to 3.5.8.3 2013-07-18 20:53:05 +08:00
chris 3467868607 Fix missing tagged_ids in some taggable objects and add a rake task for it 2013-07-18 14:05:21 +08:00
Matt K. Fu ceac2b842c fix impression page counter 2013-07-18 12:04:37 +08:00
chris c763817ebf Fix web link front end index and widget index 2013-07-17 17:54:34 +08:00
chris 3c3bba514a Fix get_item and more link in front end 2013-07-17 11:36:20 +08:00
Spen 837dc3ea7b announcement init default_widget add a style & field 2013-07-17 11:31:38 +08:00
Matt K. Fu ea5d89e0e1 make announcement widget amount start from 1 2013-07-16 18:19:20 +08:00
Matt K. Fu aea15fa622 add class to default widget if row data is hot or top 2013-07-16 17:41:22 +08:00
Matthew K. Fu JuYuan c1316f72a0 remove new design button 2013-07-15 17:10:30 +08:00
Matthew K. Fu JuYuan d996b91b54 preview by default widget 2013-07-15 17:09:48 +08:00
Spen 07b3857465 archive app Category Authorization fix 2013-06-26 17:44:31 +08:00
Spen 8751b15385 archive app add Module Authorization & Category Authorization 2013-06-26 15:35:35 +08:00
Matt K. Fu 6a40a9555a fix query for un-permitted category use 2013-06-26 12:28:14 +08:00
Matt K. Fu 869f3b6815 fix object de-authorize failed. 2013-06-26 12:28:00 +08:00
Harry Bomrah 465d417c35 fixed updated method of events.. was having week error when updating events 2013-06-26 12:27:23 +08:00
Harry Bomrah eaf7577810 small syntax error missed out yesterday fixed. 2013-06-26 12:26:52 +08:00
Harry Bomrah 22358bd862 Small change for creating events when calendar is not selected 2013-06-26 12:26:24 +08:00
Harry Bomrah 300de76c3a Calendar fixed... all views fixed plus event loading fixed and also agenda view fixed. 2013-06-26 12:25:58 +08:00
Matthew K. Fu JuYuan d3f0a10187 fix default setting for partial category selection error,due to API changing. 2013-06-17 15:26:43 +08:00
Matthew K. Fu JuYuan 256c51a970 add sold setting back 2013-06-17 13:45:30 +08:00
chris b674f47528 Remove Syslog 2013-06-14 15:30:22 +08:00
chris c1bd135595 Fix sortable when there's no record 2013-06-14 15:26:12 +08:00
iCross 96fc5ceea3 survey module: ensure the commit 2013-06-14 15:25:58 +08:00
iCross e48a1ffece archive module: add sort to frontend module
Conflicts:

	vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb
	vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.html.erb

Conflicts:
	vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.html.erb

Conflicts:
	vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.html.erb
2013-06-14 15:25:49 +08:00
Matt K. Fu e20df41db5 add user log link at site page 2013-06-14 15:24:04 +08:00
chris e68793afc3 Fix tag delete 2013-06-14 15:23:45 +08:00
iCross 2f7389ae24 ask module change mail view: <p>此為系統自動發信,請勿直接回覆</p> 2013-06-07 13:04:00 +08:00
iCross 110eab0496 ask module: add global smtp setting 2013-06-07 13:04:00 +08:00
iCross ccd760445d ask module: configure resque redis and namespace by config/initializers/resque.rb 2013-06-07 13:04:00 +08:00
iCross c7effcc96c ask module: create.js.erb 2013-06-07 13:04:00 +08:00
iCross f3e1f4057d ask module update css 2013-06-07 13:04:00 +08:00
iCross e353961b21 ask moudule: add ask.css 2013-06-07 13:04:00 +08:00
iCross 75e27ed849 ask module: default status 2013-06-07 13:04:00 +08:00
iCross 8541033ba9 ask module: send mail on development 2013-06-07 13:04:00 +08:00
iCross 467c2e8a3c ask module: fix 2013-06-07 13:04:00 +08:00
iCross b0640f925b ask module: fix some 2013-06-07 13:04:00 +08:00
iCross 841fa10c55 ask module: add rescue ackknowledgement 2013-06-07 13:04:00 +08:00
iCross dcc5fc39a7 ask module: dropdown, icon, big5 encoding, redirect, admin, send mail 2013-06-07 13:03:59 +08:00
iCross 97df100c64 remove department 2013-06-07 13:03:59 +08:00
iCross ce180839f0 finish ask module 2013-06-07 13:03:59 +08:00
chris 0904978292 Remove non resolved conflict 2013-06-07 13:02:47 +08:00
iCross ddd9a9668e Merge branch 'lukas/picked_archive' into development 2013-06-06 23:12:30 +08:00
iCross a468b69013 archive module: fix old data caused error 2013-06-06 23:11:24 +08:00
iCross b6c8a88b73 Merge branch 'lukas/picked_archive' into development 2013-06-06 22:27:08 +08:00
iCross 5b7ac1a22b archive module: add sort feature to achive files 2013-06-06 22:20:27 +08:00
Matt K. Fu d5109c837c Merge branch 'lukas/picked_ques' into development 2013-06-06 19:59:30 +08:00
iCross c63ac751ea archive module: sort for backend/frontend. move get_sorted_and_filtered from orbit_backend_controller.rb to application_controller.rb 2013-06-06 19:20:21 +08:00
iCross 8c1e65994a Merge branch 'clean_development' into lukas/picked_ques 2013-06-06 19:08:59 +08:00
iCross f9a148c901 survey module: move down/up i18n
Conflicts:

	vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_form_survey_question.html.erb
2013-06-06 18:46:52 +08:00
iCross 5ea0c5bd5c survey module: result chart display only other
Conflicts:

	config/environments/production.rb
2013-06-06 18:45:29 +08:00
iCross d2f131d160 survey module: update css
Conflicts:

	app/assets/stylesheets/questionnaire.css
2013-06-06 18:43:28 +08:00
iCross 8d71c377f2 fix datepicker helper hidden field value 2013-06-06 18:42:26 +08:00
iCross ec173c4ce1 fix 2013-06-06 18:42:12 +08:00
iCross ba7d6558ee fix 2013-06-06 18:42:00 +08:00
iCross 88c57e0b0c fix 2013-06-06 18:41:48 +08:00
iCross d4962d20b3 fix 2013-06-06 18:41:36 +08:00
iCross 21bf3a0ccd standalone css and icon 2013-06-06 18:41:27 +08:00
iCross cf0d7cfc64 new export csv table
Conflicts:

	vendor/built_in_modules/survey/app/controllers/panel/survey/back_end/surveys_controller.rb
2013-06-06 18:40:28 +08:00
iCross 15347f25dc fix 2013-06-06 18:38:59 +08:00
iCross 443d1c4fbe csv stats & required start 2013-06-06 18:38:47 +08:00
iCross 7ba0977e16 stuff
Conflicts:

	vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/show.html.erb
2013-06-06 18:38:22 +08:00
iCross 531cee70d2 fix 2013-06-06 18:31:28 +08:00
Lukas b659c7021d bug fix and add feature 2013-06-06 18:31:09 +08:00
Lukas 515185d87c ques: fix submit 2013-06-06 18:30:54 +08:00
Lukas adc15951bb questionnaire stuff
Conflicts:

	vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
	vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
2013-06-06 18:29:58 +08:00
Lukas 32c259ac9e survey: remain stuff 2013-06-06 18:27:05 +08:00
Lukas 51640423a7 survey module initial 2013-06-06 18:26:41 +08:00
Matt K. Fu dd206437d8 apply tags and cates for fronted. from now app developer can use param category_id and tag_id freely. 2013-06-06 17:39:36 +08:00
Matt K. Fu 7729161123 fix for passing args. code in complete,fronted controller need to take care params,too. backend parser need to catch up. 2013-06-06 17:38:17 +08:00
Matthew K. Fu JuYuan f2706ff2c1 make default widget work with params[tag_id] params[category_id] 2013-06-06 17:36:30 +08:00
Matthew K. Fu JuYuan 5c94200b77 fix argument passing problem for more link and tag cloud, incomplete code. 2013-06-06 17:21:27 +08:00
Matt K. Fu 6b8b749b0f fix chris tag cloud 2013-06-06 17:18:42 +08:00
chris 253cca06cc New widget for tag cloud 2013-06-06 17:17:45 +08:00
Matt K. Fu 30824d1620 add search to archive 2013-06-05 18:03:09 +08:00
Matt K. Fu 704db56925 fix bulletin data having 8 hours difference. 2013-06-05 18:01:57 +08:00
Matt K. Fu 06fd305bf9 default widget show search 2013-06-05 13:00:21 +08:00
Matt K. Fu c0f1614cb9 fix uploading error due to user action decoder can not handle uploading file 2013-05-30 10:17:28 +08:00
Matt K. Fu 3e0b7d81ae clean 403 404 500 2013-05-27 16:46:49 +08:00
Matt K. Fu 2806dd35a9 spen's fix for user 2013-05-23 14:03:18 +08:00
Matt K. Fu 54a35b30be fix design index bug when start start from blank DB.
add delay impressionist.
add several i18n vars
2013-05-23 12:07:43 +08:00
Matt K. Fu 37aa950028 user action 2013-05-23 11:55:57 +08:00
Matt K. Fu 3d0a1cef56 1.fix for syntax error.
2.Making production console works.
3.Making blank site member no errors.
2013-05-22 16:25:12 +08:00
Spen 4a5256bf4f ntu dropdown fix member staff css 2013-05-14 14:19:56 +08:00
Spen 5b368235e8 ntu dropdown fix list sort 2013-05-14 14:19:55 +08:00
Spen b8da40b4ae ntu_dropdown_fix 2013-05-14 14:19:55 +08:00
Matt K. Fu 287e77836d fix css compiling error 2013-05-14 14:19:20 +08:00
Matt K. Fu 3e6c2b1ec2 fix member error with blank database 2013-05-14 11:48:13 +08:00
Matt K. Fu f2247aab32 ray's css fix 2013-05-14 11:27:15 +08:00
Matt K. Fu ef2c732d2e make blank site working better 2013-05-14 11:26:35 +08:00
Matt K. Fu 1096db79b6 blank site now can be start from rake site:build 2013-05-14 10:32:53 +08:00
Matt K. Fu 88d55989de change logger 2013-05-14 10:29:11 +08:00
chris c2331695cd Set order of page context to match the order of structure
Add some params to keep the sorting
2013-05-07 11:15:30 +08:00
chris 127ab3845c Changes for queries 2013-05-03 12:12:19 +08:00
chris aefd62da2a Add tagged_ids to taggable 2013-05-03 12:12:19 +08:00
chris 167a71272a queries need to be rethink 2013-05-03 12:12:19 +08:00
Matt K. Fu caf0426bd4 bulletin search 2013-05-01 12:16:28 +08:00
Matt K. Fu 7d077a92a5 system preference 2013-04-29 15:23:15 +08:00
Matt K. Fu 64101109dd disable all sorted_tags 2013-04-26 18:07:59 +08:00
Matt K. Fu 3e567223e3 fix for Spen's translation and Chris's tag error 2013-04-26 15:37:27 +08:00
Spen 79ef86f2c9 member translation fix 2013-04-26 11:26:11 +08:00
Matthew K. Fu JuYuan d047a3d62a chris tags update 2013-04-26 11:26:10 +08:00
Matt K. Fu 2945e14385 use rack gridfs 2013-04-25 20:37:13 +08:00
Matt K. Fu c68c563fb0 fix qa problem 2013-04-25 20:37:13 +08:00
Spen 697944a029 user id set & user fields set & role set & member frontend list & user translation & create new member bug fix 2013-04-25 19:59:59 +08:00
Matt K. Fu 12e39b4d77 fix rescue job won't start 2013-04-25 15:46:16 +08:00
Matt K. Fu a0478f2a8f fix page name repeated error when page creating 2013-04-25 12:19:25 +08:00
Matt K. Fu b198b1a17b system preference 2013-04-24 19:21:11 +08:00
Matt K. Fu 62fa589e8a add msg when user session expired at page admin 2013-04-24 11:58:48 +08:00
Matt K. Fu 5ff7dfbac6 fronted open switch and backend openness 2013-04-23 18:48:18 +08:00
Harry Bomrah 11067ef34f english mandatory removed from albums 2013-04-23 11:09:43 +08:00
Spen 536f0d30af apps_translate_fix 2013-04-23 11:09:20 +08:00
Matt K. Fu 41168f4c99 fix for fronted routing failed 2013-04-23 10:01:02 +08:00
Matt K. Fu 7e9fce0c2d clean Harry's code 2013-04-17 14:31:10 +08:00
Matt K. Fu 2416030adc remove useless rake task 2013-04-17 14:31:09 +08:00
Harry Bomrah 38d5a193e0 tiny scrollbar trigger fixed and devin branch merged 2013-04-17 14:31:09 +08:00
Matt K. Fu fcfdd562a6 reverse harrys db setting 2013-04-17 14:29:56 +08:00
devin chen 989e5aa974 minor update 2013-04-17 14:29:56 +08:00
Matt K. Fu 4cbf2fd8b9 complete harrys code 2013-04-17 14:29:56 +08:00
Spen c94a86c3a4 web_resource rake web_link_url:web_link_url_i18n 2013-04-17 14:29:04 +08:00
devin chen aedab01ae6 minor update 2013-04-17 14:29:04 +08:00
devin chen e3782c9cf7 minor update 2013-04-17 14:29:04 +08:00
Harry Bomrah e2802d94d0 rake task added 2013-04-17 14:28:13 +08:00
devin chen 055d758769 Page Loading Effect
tinyscrollbar has problem
2013-04-17 14:27:18 +08:00
Spen 0734f73291 faq show fix 2013-04-17 14:25:05 +08:00
Matt K. Fu a4ebe31ada fix for widget edit js missing 2013-04-17 14:19:32 +08:00
Matt K. Fu 3098496083 widget link followed by setting 2013-04-17 14:19:32 +08:00
Matt K. Fu 28f0df5da8 fix default widget link failed 2013-04-17 14:19:32 +08:00
Matt K. Fu 3de4591413 fix frontend ajax respond 404 due to javascript overwritten after assets precompile 2013-04-17 14:19:32 +08:00
devin chen d177fe0369 minor update 2013-04-17 14:19:32 +08:00
Harry Bomrah d288972035 stupid commit 2013-04-17 14:19:32 +08:00
Harry Bomrah c6868bf2e0 small fix in select2.js 2013-04-17 14:18:49 +08:00
devin chen 95e308e046 minor update 2013-04-17 14:18:49 +08:00
Matt K. Fu 425a320c02 fix widget and fronted setting interface. checked with Spen 2013-04-17 14:16:24 +08:00
devin chen dc5f24ab22 starting new branch ( add rules in .gitignore for SASS cache folder ) 2013-04-17 14:16:24 +08:00
Harry Bomrah bc0477a5ed widget and gridster fixes 2013-04-17 14:16:24 +08:00
Matt K. Fu 0781779ac0 solved conflicts 2013-04-17 14:14:24 +08:00
devin e7bffe4c0f devin's new branch 2013-04-17 14:14:24 +08:00
chris dd10b3147c Fix js bug and asset url after merge 2013-04-17 14:14:24 +08:00
devin cae43e8acd recover .gitignore file
Conflicts:
	.gitignore
2013-04-17 14:14:23 +08:00
Harry Bomrah 793d739726 features and widgets added
Conflicts:
	app/assets/javascripts/orbitdesktop.js
2013-04-17 14:14:23 +08:00
devin c8aa50ee87 Lots of Update
1. CSS to SCSS
2. Journal Paper update

Conflicts:
	Gemfile.lock
	app/assets/javascripts/orbitdesktop.js
	app/assets/stylesheets/desktop/desktop-main.css
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/index.html.erb
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/index.html.erb
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/journal_type.html.erb
2013-04-17 14:14:23 +08:00
Matt K. Fu 0f6f5aafce fix for both part and page part settings
Conflicts:
	app/helpers/admin/page_parts_helper.rb
	app/views/admin/pages/reload_front_end_setting.js.erb
	app/views/admin/pages/reload_frontend_pages.js.erb
2013-04-17 14:12:52 +08:00
Fu Matthew f6b600df59 deliver API 2013-04-17 14:09:01 +08:00
chris 6af375efa4 Fix bug in setup_app_frontend_and_style 2013-04-17 14:09:00 +08:00
Fu Matthew 1709773b0a style for front end 2013-04-17 14:08:01 +08:00
Rueshyna 95805cfdee correct model method 2013-04-17 14:07:24 +08:00
Harry Bomrah 84afbfa86c section page fixed.. 2013-04-17 14:01:48 +08:00
Rueshyna 44fede2b71 fixed co author relation save button 2013-04-17 14:01:48 +08:00
Harry Bomrah 764f83d58c app manager changed plus some changes 2013-04-17 14:01:14 +08:00
Harry Bomrah 8dee211ab4 section page fixed.. 2013-04-17 14:01:14 +08:00
Rueshyna 27ad25ccca add pagination for every controller and view in personal plugin 2013-04-17 14:00:37 +08:00
Harry Bomrah f9e7cefc94 compatibility page added and tinyscrollbar drag event fixed.. 2013-04-17 13:59:16 +08:00
Rueshyna df220397b2 make index of list can be hightline list when click cancel button 2013-04-17 12:22:04 +08:00
Rueshyna b5fd6c7a1a fixed author sample data generation and model method 2013-04-17 12:21:21 +08:00
Rueshyna 65e306a854 have done conference author filter, journal haven't been done, yet 2013-04-17 12:13:06 +08:00
Harry Bomrah 41643d1f61 tinyscrollbar pagination fixed 2013-04-17 12:11:33 +08:00
Rueshyna aad4119892 fixed bug 2013-04-17 12:07:11 +08:00
Harry Bomrah 54af5e8bd4 insert and remove columns 2013-04-17 12:06:33 +08:00
Harry Bomrah 6db9e70132 Major tinyscrollbar update 2013-04-17 12:04:22 +08:00
Harry Bomrah dabceec3ea all none for conf done 2013-04-17 11:23:03 +08:00
Harry Bomrah 52789fa032 all none fixed 2013-04-17 11:23:02 +08:00
Rueshyna dc68f40cb4 correct model method 2013-04-17 11:13:32 +08:00
Rueshyna 228dd1b767 fixed co author relation save button 2013-04-17 11:13:32 +08:00
Harry Bomrah dae3f069ff app manager changed plus some changes 2013-04-17 11:09:56 +08:00
Rueshyna 5f2c669568 fixed checkout and start in personal plugin 2013-04-17 11:08:58 +08:00
Rueshyna 1b12412596 correct factoried girl for journal 2013-04-17 11:08:58 +08:00
Harry Bomrah b1d7d5345e section page fixed.. 2013-04-17 11:08:58 +08:00
Fu Matthew 6efef253a6 add conditions for making multi cates and tags more stable 2013-04-17 11:08:57 +08:00
devin 0d5ab20efa add browser compatibility page 2013-04-17 11:07:45 +08:00
Fu Matthew 9815950083 now default options can be chosen by developer at init 2013-04-17 11:07:45 +08:00
Rueshyna 50449b55e8 one abstract one column for personal plugin 2013-04-17 11:07:20 +08:00
Rueshyna 00db66b8c4 add pagination for every controller and view in personal plugin 2013-04-17 11:07:20 +08:00
Harry Bomrah b8ee2fd559 compatibility page added and tinyscrollbar drag event fixed.. 2013-04-17 11:07:20 +08:00
Harry Bomrah 401c75c0de Major tinyscrollbar update 2013-04-17 11:06:28 +08:00
Rueshyna 1ebae504dc modify translation for journal_co_author_relation button 2013-04-17 11:05:57 +08:00
Harry Bomrah 323fadc210 tinyscrollbar pagination fixed 2013-04-17 11:05:57 +08:00
Fu Matthew 69a49a69aa style for front end 2013-04-17 11:05:57 +08:00
Rueshyna 5178ce3bde modify nil of email string and sort 2013-04-17 11:04:52 +08:00
Rueshyna 95128a3465 remove redundant space of co_author sample data 2013-04-17 11:04:52 +08:00
Rueshyna 8783b8e5fe make index of list can be hightline list when click cancel button 2013-04-17 11:04:52 +08:00
Rueshyna a3de4cc2d4 fixed author sample data generation and model method 2013-04-17 11:04:52 +08:00
Rueshyna bdaef3af0f add author filter for journal and fix some bug 2013-04-17 11:04:52 +08:00
Rueshyna 625f2e9ad6 have done conference author filter, journal haven't been done, yet 2013-04-17 11:04:52 +08:00
Harry Bomrah db60a3bcfa insert and remove columns 2013-04-17 11:04:37 +08:00
Harry Bomrah a7667d586a Major tinyscrollbar update 2013-04-17 11:04:36 +08:00
Rueshyna e9ddb85734 add pagination for personal plugin 2013-04-17 10:56:49 +08:00
Harry Bomrah d840b82fa9 insert and remove columns 2013-04-17 10:56:15 +08:00
devin 84dfb44e78 tinyscrollbar css minor update 2013-04-17 10:56:15 +08:00
Fu Matthew 4a08a1992b 1.make module app forbid unearthed access except from admin
2.override sidebar link when it's object_auth or app_auth.
2013-04-17 10:56:15 +08:00
Rueshyna 15be80a35f fixed bug 2013-04-17 10:56:14 +08:00
Harry Bomrah 1d06bcaae7 Major tinyscrollbar update 2013-04-17 10:54:38 +08:00
Fu Matthew 8e98cb3ec9 put add admin pages using orbit back end controller 2013-04-17 10:54:38 +08:00
Harry Bomrah 6cd97adf21 all none for conf done 2013-04-17 10:54:38 +08:00
Harry Bomrah 0189d1c2c0 all none fixed 2013-04-17 10:54:38 +08:00
chris 3e96cfe514 Changes for FAQ to work with not latest but stable code 2013-03-28 15:05:52 +08:00
Spen 468555a037 faq app 2013-03-28 14:09:29 +08:00
chris da8a5123c2 Change in announcement init for query
Change in default widget query
2013-03-27 16:31:42 +08:00
chris 4ebc8cbb77 Delete NTU's i18n 2013-03-27 16:30:35 +08:00
chris ec1605358b Fix sorting for archive 2013-03-27 06:30:22 +08:00
826 changed files with 14673 additions and 3326 deletions

9
.gitignore vendored
View File

@ -11,13 +11,16 @@ public/assets
public/index.html
public/panel/**/*
public/uploads/**/*
solr
solr/data
tmp/**/*
uploads/**/*
config/*.god
log/*.gz
tmp/restart.txt
*.swp
*.pid
*.lck
.sass-cache/*
*.supported
*.supported
mongoid.yml

17
Gemfile
View File

@ -14,7 +14,11 @@ gem 'execjs'
gem 'jquery-rails', '2.1.4'
gem 'jquery-ui-rails'
gem "select2-rails", '3.3.1'
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'kaminari'
gem "acts_as_unvlogable"
gem 'youtube_it'
gem 'gotcha'
# gem "memcached", "~> 1.4.3"
# gem "memcache-client"
@ -26,6 +30,7 @@ gem "mongo_session_store-rails3", '3.0.6'
gem 'nokogiri'
gem 'fb_graph'
gem 'rack-gridfs'
gem 'radius'
gem 'rake'
# gem 'remotipart'
@ -34,7 +39,7 @@ gem 'resque-scheduler' # job scheduling
gem 'resque-restriction'
#gem 'rb-readline'
# gem 'ruby-debug19'
gem 'rubyzip'
gem 'rubyzip','0.9.9'
gem 'sunspot_mongo'
gem 'sunspot_solr'
@ -45,14 +50,14 @@ gem 'sinatra'
gem 'sprockets'
gem 'social-share-button'
gem 'tinymce-rails'
gem 'tinymce-rails', '3.5.8.3'
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
gem 'rb-readline' if RUBY_PLATFORM.downcase.include?("linux")
gem 'rb-readline','~> 0.4.2' if RUBY_PLATFORM.downcase.include?("linux")
gem "impressionist", :git => 'git://github.com/charlotte-ruby/impressionist.git'
gem "impressionist",'1.2.0'
#gem 'contacts'
#gem 'event-calendar', :require => 'event_calendar'#, :git => 'git://github.com/elevation/event_calendar.git'
@ -62,6 +67,8 @@ gem 'chinese_pinyin', '0.4.1'
gem 'rmmseg-cpp-huacnlee', '0.2.9'
gem 'redis-namespace'
gem 'redis-search'
gem 'syslog-logger'
gem "recaptcha", :require => "recaptcha/rails"
# Gems used only for assets and not required
# in production environments by default.

View File

@ -1,402 +0,0 @@
GIT
remote: git://github.com/amatsuda/kaminari.git
revision: 2e09b5374fec33b57c6387ca7bac89ecaa60c9eb
specs:
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
GIT
remote: git://github.com/charlotte-ruby/impressionist.git
revision: 0894f6a550a33f83f4937d655e9f0774521781e4
specs:
impressionist (1.2.0)
httpclient (~> 2.2)
nokogiri (~> 1.5)
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
attr_required (0.0.5)
bcrypt-ruby (3.0.0)
binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1)
bourne (1.1.2)
mocha (= 0.10.5)
brakeman (1.9.2)
erubis (~> 2.6)
fastercsv (~> 1.5)
haml (~> 3.0)
highline (~> 1.6)
multi_json (~> 1.2)
ruby2ruby (~> 2.0)
ruby_parser (~> 3.1.1)
sass (~> 3.0)
terminal-table (~> 1.4)
bson (1.8.2)
bson_ext (1.8.2)
bson (~> 1.8.2)
builder (3.0.4)
capybara (2.0.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
carrierwave (0.6.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
carrierwave-mongoid (0.2.2)
carrierwave (~> 0.6.1)
mongoid (~> 2.1)
childprocess (0.3.8)
ffi (~> 1.0, >= 1.0.11)
chinese_pinyin (0.4.1)
chronic (0.9.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.4.0)
columnize (0.3.6)
database_cleaner (0.9.1)
debug_inspector (0.0.2)
debugger (1.2.4)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
debugger-ruby_core_source (~> 1.1.7)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.1.8)
delorean (2.1.0)
chronic
devise (1.5.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
diff-lcs (1.1.3)
encrypted_strings (0.3.3)
erubis (2.7.0)
exception_notification (3.0.1)
actionmailer (>= 3.0.4)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
fastercsv (1.5.5)
fattr (2.2.1)
fb_graph (2.6.4)
httpclient (>= 2.2.0.2)
multi_json (>= 1.3)
rack-oauth2 (>= 0.14.4)
tzinfo
ffi (1.4.0)
haml (3.1.8)
highline (1.6.15)
hike (1.2.1)
httpclient (2.3.2)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.0.1)
jquery-rails
railties (>= 3.1.0)
json (1.7.7)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
method_source (0.8.1)
mime-types (1.21)
mini_magick (3.5.0)
subexec (~> 0.2.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
mongo (1.8.2)
bson (~> 1.8.2)
mongo_session_store-rails3 (3.0.6)
actionpack (>= 3.0)
mongo
mongoid (2.6.0)
activemodel (~> 3.1)
mongo (~> 1.7)
tzinfo (~> 0.3.22)
mongoid-encryptor (0.0.5)
activesupport (~> 3.0)
encrypted_strings (~> 0.3.3)
mongoid (~> 2)
mongoid-tree (0.7.0)
mongoid (~> 2.0)
multi_json (1.6.1)
net-ldap (0.3.1)
nokogiri (1.5.6)
options (2.3.0)
fattr
orm_adapter (0.0.7)
polyglot (0.3.3)
pr_geohash (1.0.0)
progress_bar (0.4.0)
highline (~> 1.6.1)
options (~> 2.3.0)
pry (0.9.12)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pry-debugger (0.2.1)
debugger (~> 1.2.0)
pry (~> 0.9.10)
pry-remote (0.1.6)
pry (~> 0.9)
slop (~> 3.0)
pry-stack_explorer (0.4.9)
binding_of_caller (>= 0.7)
pry (~> 0.9.11)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-oauth2 (1.0.0)
activesupport (>= 2.3)
attr_required (>= 0.0.5)
httpclient (>= 2.2.0.2)
i18n
multi_json (>= 1.3.6)
rack (>= 1.1)
rack-protection (1.3.2)
rack
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
radius (0.7.3)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
bundler (~> 1.0)
railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12.1)
json (~> 1.4)
redis (3.0.2)
redis-namespace (1.2.1)
redis (~> 3.0.0)
redis-search (0.9.0)
chinese_pinyin (>= 0.3.0)
redis (>= 2.1.1)
redis-namespace (>= 1.0.2)
resque (1.23.0)
multi_json (~> 1.0)
redis-namespace (~> 1.0)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-restriction (0.3.0)
resque (>= 1.7.0)
resque-scheduler (2.0.0)
redis (>= 2.0.1)
resque (>= 1.20.0)
rufus-scheduler
rmmseg-cpp-huacnlee (0.2.9)
rsolr (1.0.8)
builder (>= 2.1.2)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
rspec-rails (2.12.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
ruby2ruby (2.0.3)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
ruby_parser (3.1.1)
sexp_processor (~> 4.1)
rubyzip (0.9.9)
rufus-scheduler (2.0.17)
tzinfo (>= 0.3.23)
sass (3.2.5)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
select2-rails (3.3.1)
sass-rails (>= 3.2)
thor (~> 0.14)
selenium-webdriver (2.30.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
sexp_processor (4.1.5)
shoulda-matchers (1.4.2)
activesupport (>= 3.0.0)
bourne (~> 1.1.2)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
sinatra (1.3.4)
rack (~> 1.4)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
slop (3.4.3)
social-share-button (0.1.1)
spork (0.9.2)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
subexec (0.2.2)
sunspot (1.3.3)
pr_geohash (~> 1.0)
rsolr (~> 1.0.7)
sunspot-rails-tester (0.0.4)
sunspot_rails (~> 1.2)
sunspot_mongo (1.0.1)
sunspot_rails
sunspot_rails (1.3.3)
nokogiri
sunspot (= 1.3.3)
sunspot_solr (1.3.3)
terminal-table (1.4.5)
thor (0.17.0)
tilt (1.3.3)
tinymce-rails (3.5.8)
railties (>= 3.1.1)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.2.1)
rack (>= 1.0)
watchr (0.7)
websocket (1.0.7)
xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
brakeman
bson_ext
capybara
carrierwave
carrierwave-mongoid
chinese_pinyin (= 0.4.1)
coffee-rails
database_cleaner
debugger
delorean
devise (= 1.5.3)
exception_notification
execjs
factory_girl_rails
faker
fb_graph
impressionist!
jquery-rails (= 2.1.4)
jquery-ui-rails
kaminari!
mime-types
mini_magick
mongo_session_store-rails3 (= 3.0.6)
mongoid (> 2.1, < 3.0.0)
mongoid-encryptor
mongoid-tree
net-ldap (~> 0.3.1)
nokogiri
progress_bar
pry
pry-debugger
pry-remote
pry-stack_explorer
radius
rails (~> 3.2.9)
rake
redis (>= 2.1.1)
redis-namespace
redis-search
resque
resque-restriction
resque-scheduler
rmmseg-cpp-huacnlee (= 0.2.9)
rspec (~> 2.0)
rspec-rails (~> 2.0)
rubyzip
sass-rails
select2-rails (= 3.3.1)
shoulda-matchers
simplecov
sinatra
social-share-button
spork
sprockets
sunspot-rails-tester
sunspot_mongo
sunspot_solr
tinymce-rails
uglifier
watchr

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

BIN
app/assets/images/write.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

View File

@ -1,6 +1,6 @@
orbitDesktop.prototype.themefolder = "desktop_themes";
orbitDesktopAPI.prototype.notifyImgPath = "/assets/";
alert("<%= @desktop.inspect %>")
// alert("<%= @desktop.inspect %>")
var od = new orbitDesktop("#ajax_container");

View File

@ -55,7 +55,7 @@ $(document).ready(function(){
}
return false;
});
getEvent(selet);
function resetText() {
$events.find('li').find($mon).html('');
$events.find('li').find($day).html('');
@ -63,60 +63,4 @@ $(document).ready(function(){
$events.find('li').find($link_text).attr('href', '');
$events.find('li').find($time).html('');
}
function getEvent(selet){
$.ajax({
type: "GET",
url: "/static/nccu_calendar.xml",
dataType: "xml",
timeout: 1000,
error: function(xml){
$events.find('.links_next').addClass('disabled')
$events.find('.error_mag').show();
$events.find('ul').hide();
$events.find('.error_mag').html("讀取錯誤");
},
success: function(xml) {
xmlLength = $(xml).find('entry').length;
$(xml).find('entry').slice(selet, selet+objLength).each(function(i){
title_text = $(this).find('title').text()
link_text = $(this).find('link').attr('href')
summary_text = $(this).find('summary').text()
indexA = summary_text.indexOf("-");
indexB = summary_text.indexOf(" ");
indexC = summary_text.indexOf("/");
//清除前後空白字元
summary_text = jQuery.trim(summary_text);
//篩選標題
title_text = title_text.slice(0, 16)
if (summary_text.length == 31) {
startDate_text = summary_text.slice(0, indexA);
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
startDay_text = startDate_text.slice(7);
endDate_text = summary_text.slice((indexA+1), indexB);
time_text = summary_text.slice((indexB+1));
} else {
startDate_text = summary_text.slice(0, indexB);
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
startDay_text = startDate_text.slice(7);
endDate_text = '';
time_text = summary_text.slice((indexB+1));
}
if(startMon_text.slice(0, 1) == '0'){
startMon_text = month[startMon_text.slice(1)-1];
} else {
startMon_text = month[startMon_text-1];
}
$events.find('li').eq(i).find($mon).html(startMon_text);
$events.find('li').eq(i).find($day).html(startDay_text);
$events.find('li').eq(i).find($link_text).html(title_text+"…");
$events.find('li').eq(i).find($link_text).attr('href', link_text);
$events.find('li').eq(i).find($time).html('時間:'+time_text);
//console.log();
/*$('<li></li>')
.html('<div class="event_date"><span class="mon">'+startMon_text+'</span><span class="day">'+startDay_text+'</div>')
.appendTo('.events ul');*/
});//close each(
}
}); //close $.ajax(
}
});

View File

@ -0,0 +1,34 @@
function append_id(){
if ($("#object_id").length == 1) {
return "&id="+$("#object_id").val();
}
else{
return '';
};
}
$("#page_design").live('change', function() {
$.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id());
});
$("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id());
});
$("#widget_list select,#frontend_list select").live('change', function() {
$.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() );
});
$("#tag_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id() );
});
$("select.widget_field_select").live('change', function() {
$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() );
});
$('.part_kind').live('click', function() {
$('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show();
});

View File

@ -2,11 +2,11 @@ function update_cates_and_tags()
{
$('.select_option,.select_all').removeAttr('disabled');
$(".select_all:checked").each(function( obj ) {
$(this).parent().siblings('label').find('.select_option').attr('disabled',true);
// $(this).parent().siblings('label').find('.select_option').attr('disabled',"disabled");
$(this).parent().siblings('label').find('.select_option').removeAttr('checked');
});
$(".select_option:checked").each(function( obj ) {
$(this).parent().siblings('label').find('.select_all').attr('disabled',true);
// $(this).parent().siblings('label').find('.select_all').attr('disabled',"disabled");
$(this).parent().siblings('label').find('.select_all').removeAttr('checked');
});
}

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +1,3 @@
function get_part_id(){
return $(".edit_page_part,.edit_page").attr("action").split('/').pop();
}
$("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle();
});
$("#page_design").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
});
// $("#page_module_app_id").live('change', function() {
// var app_id = $(this).val();
// if(app_id!=''){
// $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_after_module_changed',function(data, textStatus){
// if(textStatus == 'success'){
// $(this).after(data);
// }
// });
// }
// else{
// $("#app_page_url").children().remove();
// }
// });
$("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?module_app_id='+$(this).val()); //?part_id=' + get_part_id());
});
$("#widget_list select,#frontend_list select").live('change', function() {
$.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() );//+ '&part_id=' + get_part_id());
});
$("#tag_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?type=' + $(this).val());
});
$("select.widget_field_select").live('change', function() {
$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val());
});
$('.part_kind').live('click', function() {
$('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show();
});
$(document).ready(function(){
bindTreeDragHandle();
});
@ -68,4 +21,8 @@ var bindTreeDragHandle = function(){
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
}
});
}
}
$("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle();
});

View File

@ -0,0 +1,56 @@
<%#= encoding: utf-8 %>
$(document).ready(function(){
$(document).on('click', '.survey_question_item a.remove_existing_record_question', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).next('.should_destroy').val(1);
$(".survey_question_item#" + $(this).prev().attr('value')).hide();
}
});
$(document).on('click', '.survey_question_option_item a.remove_existing_record_option', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).next('.should_destroy').val(1);
$(".survey_question_option_item#" + $(this).prev().attr('value')).hide();
}
});
$(document).on('click', '.survey_question_radiogroup_item a.remove_existing_record_radiogroup', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).next('.should_destroy').val(1);
$(".survey_question_radiogroup_item#" + $(this).prev().attr('value')).hide();
}
});
$('.survey_question_item .type-selector').live('change', function(){
$item = $(this).parents('.survey_question_item');
$item.find('.type-specify').hide();
$item.find('.type-specify.type-' + $(this).val()).show();
$item.find('.type-specify.hide-type-' + $(this).val()).hide();
});
$('.survey_question_item .type-selector').trigger('change');
$('.survey_question_item .add_survey_question_option a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_survey_question_options", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$_new = $($(this).next().html().replace(old_id, new_id));
$(this).parents('.survey_question_options_wrapper').find('tbody').append($_new);
$_new.find('a.delete_option').on('click', function(){
$(this).parents('.survey_question_option_item').remove();
});
});
$('.survey_question_item .add_survey_question_radiogroup a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_survey_question_radiogroups", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$_new = $($(this).next().html().replace(old_id, new_id));
$(this).parents('.survey_question_radiogroups_wrapper').find('tbody').append($_new);
$_new.find('a.delete_radiogroup').on('click', function(){
$(this).parents('.survey_question_radiogroup_item').remove();
});
});
});

View File

@ -15,6 +15,11 @@ function load_tinymce() {
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Domain Absolute URLs
relative_urls : false,
remove_script_host : false,
document_base_url: window.location.protocol + '//' + window.location.host,
// Skin options
skin : "o2k7",
skin_variant : "silver",

View File

@ -5,3 +5,4 @@
*= require_self
*= require social-share-button
*/

View File

@ -0,0 +1,40 @@
#acknowledgement {
display: none;
padding: 20px;
margin: -20px 0 30px 0;
background-color: #fff;
font-weight: bold;
font-size: 15px;
border: solid 2px #f0f0f0;
}
#aclnowledgement:after {
content: '';
display: table;
width: table;
clear: both;
}
.ask-question {
}
/* AQ form */
#new-ask-question {
background-color: #f8f8f8;
padding: 20px 0;
}
#new-ask-question .form-horizontal .control-label {
width: 100px;
}
#new-ask-question .form-horizontal .controls {
margin-left: 120px;
}
#new-ask-question .form-horizontal .controls textarea {
width: 80%;
resize: vertical;
}
#new-ask-question .form-horizontal .form-actions {
padding-left: 120px;
background-color: transparent;
border: none;
}

View File

@ -3,12 +3,10 @@ $gray: #ddd;
@mixin font-main($font-size) {
font-family: "Source Sans Pro", sans-serif;
font-size: #{$font-size}px;
font-weight: 300;
}
@mixin font-sub($font-size) {
font-family: "Source Sans Pro", Arial, sans-serif;
font-size: #{$font-size}px;
font-weight: 300;
}
@mixin transition-type($property, $sec) {
-webkit-transition: #{$property} #{$sec}s ease;

View File

@ -93,9 +93,20 @@
left: 0;
top: 60px;
font-size: 15px;
width: 120px; }
width: 120px;
border: solid 2px #dddddd;
-webkit-box-sizing: border-box;
/* webkit */
-khtml-box-sizing: border-box;
/* konqueror */
-moz-box-sizing: border-box;
/* firefox */
-ms-box-sizing: border-box;
/* ie */
box-sizing: border-box;
/* css3 */ }
.sdm_o li {
border-top: solid 1px #f2f2f2; }
border-top: solid 1px #f7f7f7; }
.sdm_o li:first-child {
border: none; }
.sdm_o a {
@ -151,7 +162,7 @@
font-size: 15px; }
.s_form label {
font-size: 13px;
font-weight: normal;
font-weight: bold;
display: inline-block;
vertical-align: middle;
width: 100px;
@ -249,8 +260,7 @@
display: inline-block;
vertical-align: top; }
.toolbar .sdm_o {
top: 36px;
background-color: #f0f0f0; }
top: 36px; }
.toolbar button {
border: none;
outline: none;

View File

@ -59,9 +59,11 @@
top: 60px;
font-size: 15px;
width: 120px;
border: solid 2px $gray;
@include box-sizing;
li {
border-top: solid 1px #f2f2f2;
border-top: solid 1px lighten( $gray, 10% );
}
li:first-child {
border: none;
@ -90,7 +92,7 @@
line-height: 36px;
li {
border-top: solid 1px #ddd;
border-top: solid 1px $gray;
}
li:first-child {
border: none;
@ -133,7 +135,7 @@
// basic style
label {
font-size: 13px;
font-weight: normal;
font-weight: bold;
display: inline-block;
vertical-align: middle;
width: 100px;
@ -239,7 +241,6 @@
}
.sdm_o {
top: 36px;
background-color: #f0f0f0;
}
button {
border: none;

View File

@ -54,7 +54,6 @@ table {
body {
font-family: "Source Sans Pro", sans-serif;
font-size: 12px;
font-weight: 300;
background-color: #000; }
a, a:hover {
@ -74,8 +73,7 @@ a:focus {
clear: both; }
.o-loading {
font-size: 13px;
font-weight: normal; }
font-size: 13px; }
.fullsize .o-loading {
padding: 12px; }
.o-loading i {
@ -297,7 +295,7 @@ a:focus {
.fn_des.admtxt {
line-height: 60px;
padding: 0 6px;
padding: 0 12px;
font-size: 15px;
position: absolute;
z-index: 9;
@ -336,8 +334,7 @@ a:focus {
.section_label li {
font-size: 15px; }
.section_label li:first-child {
font-size: 18px;
font-weight: normal; }
font-size: 18px; }
/* panel */
#panel_l {
@ -372,8 +369,7 @@ a:focus {
#orbitnote .note_holder .note_message {
color: #333;
margin: 10px 0 0 48px;
font-size: 15px;
font-weight: normal; }
font-size: 15px; }
/* Desktop Dialogue */
#orbitdiag {
@ -404,7 +400,6 @@ a:focus {
margin: 0 6px;
text-align: center;
font-size: 15px;
font-weight: normal;
line-height: 36px; }
#orbitdiag .diag_holder .diag_holder_inner .diag_btn:hover {
outline: solid 2px white; }
@ -421,12 +416,12 @@ a:focus {
position: absolute;
left: 0;
bottom: 0;
z-index: 3; }
z-index: 3;
white-space: nowrap; }
[data-sizex="1"] .appname, .w1.h1 .appname {
text-align: center; }
[data-sizey="2"] .appname {
font-size: 21px;
font-weight: normal; }
font-size: 21px; }
.hh2 .appname {
position: relative;
width: auto;
@ -469,8 +464,6 @@ a:focus {
margin: 0 12px 0 0;
position: relative;
z-index: 9; }
.dtitle .sdm_o {
width: auto; }
.tile {
display: block;
@ -480,8 +473,12 @@ a:focus {
left: 0;
top: 0; }
.gridster ul {
margin: -6px 0 0 -6px; }
.widget.gs_w {
cursor: move; }
cursor: move;
overflow: hidden; }
/* header drop menu */
.sdm_mdr .sdm_o {
@ -533,7 +530,6 @@ a:focus {
.s_title {
font-size: 21px;
font-weight: normal;
line-height: 60px;
text-align: left; }
.s_title.size_large {
@ -559,7 +555,6 @@ a:focus {
display: block;
float: right;
font-size: 15px;
font-weight: normal;
line-height: 36px;
text-align: center;
border: 0; }
@ -615,8 +610,7 @@ a:focus {
.list_t_title {
margin-bottom: 6px;
color: #333;
font-size: 15px;
font-weight: normal; }
font-size: 15px; }
.list_t_des {
line-height: 1.5em;

View File

@ -70,7 +70,7 @@ a:focus { outline: none; }
}
.o-loading {
font-size: 13px;
font-weight: normal;
// font-weight: normal;
.fullsize & {
padding: 12px;
@ -231,7 +231,7 @@ a:focus { outline: none; }
}
.fn_des.admtxt {
line-height: 60px;
padding: 0 6px;
padding: 0 12px;
font-size: 15px;
position: absolute;
z-index: 9;
@ -277,10 +277,9 @@ a:focus { outline: none; }
}
li:first-child {
font-size: 18px;
font-weight: normal;
// font-weight: normal;
}
}
/* panel */
#panel_l {
background-color: #f0f0f0;
@ -321,7 +320,7 @@ a:focus { outline: none; }
color: #333;
margin: 10px 0 0 48px;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
}
}
}
@ -361,7 +360,7 @@ a:focus { outline: none; }
margin: 0 6px;
text-align: center;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
line-height: 36px;
&:hover {
@ -386,6 +385,7 @@ a:focus { outline: none; }
left: 0;
bottom: 0;
z-index: 3;
white-space: nowrap;
[data-sizex="1"] &,
.w1.h1 & {
@ -393,7 +393,7 @@ a:focus { outline: none; }
}
[data-sizey="2"] & {
font-size: 21px;
font-weight: normal;
// font-weight: normal;
}
.hh2 & {
position: relative;
@ -421,8 +421,6 @@ a:focus { outline: none; }
margin-right: 6px;
}
}
.appholder {
position: relative;
z-index: 2;
@ -446,10 +444,6 @@ a:focus { outline: none; }
margin: 0 12px 0 0;
position: relative;
z-index: 9;
.sdm_o {
width: auto;
}
}
.tile {
display: block;
@ -459,9 +453,18 @@ a:focus { outline: none; }
left: 0;
top: 0;
}
.gridster ul {
margin: -6px 0 0 -6px;
}
.widget.gs_w {
cursor: move;
overflow: hidden;
}
// .app.gs_w:active {
// -webkit-transform: scale(0.9);
// -moz-transform: scale(0.9);
// transform: scale(0.9);
// }
/* header drop menu */
.sdm_mdr .sdm_o { top: 36px; }
@ -520,7 +523,7 @@ a:focus { outline: none; }
.s_title {
font-size: 21px;
font-weight: normal;
// font-weight: normal;
line-height: 60px;
text-align: left;
@ -549,7 +552,7 @@ a:focus { outline: none; }
display: block;
float: right;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
line-height: 36px;
text-align: center;
border: 0;
@ -598,7 +601,7 @@ a:focus { outline: none; }
margin-bottom: 6px;
color: #333;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
}
.list_t_des {
line-height: 1.5em;

View File

@ -86,15 +86,12 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
position: absolute;
z-index: 9999;
top: 100%;
background-color: #dddddd;
background-color: #fff;
color: #000;
border: 1px solid #dddddd;
border-top: 0; }
border: 2px solid #dddddd; }
.select2-drop.select2-drop-above {
margin-top: 1px;
border-top: 1px solid #dddddd;
border-bottom: 0; }
margin-top: 1px; }
.select2-container .select2-choice div {
display: block;
@ -152,7 +149,7 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
margin-top: 4px; }
.select2-search input.select2-active {
background: white image-url("select2-spinner.gif") no-repeat 100%; }
background: white url("select2/spinner.gif") no-repeat 100%; }
.select2-container-active .select2-choice,
.select2-container-active .select2-choices {
@ -171,8 +168,6 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
/* results */
.select2-results {
max-height: 200px;
padding: 0 0 0 4px;
margin: 4px 4px 4px 0;
font-size: 13px;
position: relative;
overflow-x: hidden;
@ -206,13 +201,16 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
.select2-results li {
list-style: none;
display: list-item;
background-image: none; }
background-image: none;
border-top: solid 1px #f7f7f7; }
.select2-results li :first-child {
border-top: 0; }
.select2-results li.select2-result-with-children > .select2-result-label {
font-weight: bold; }
.select2-results .select2-result-label {
padding: 4px 6px;
padding: 6px;
margin: 0;
cursor: pointer;
-webkit-touch-callout: none;
@ -263,7 +261,7 @@ disabled look for disabled choices in the results dropdown
display: none; }
.select2-more-results.select2-active {
background: #f4f4f4 image-url("select2-spinner.gif") no-repeat 100%; }
background: #f4f4f4 url("select2/spinner.gif") no-repeat 100%; }
.select2-more-results {
background: #f4f4f4;
@ -325,7 +323,7 @@ disabled look for disabled choices in the results dropdown
background: transparent !important; }
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
background: white image-url("select2-spinner.gif") no-repeat 100% !important; }
background: white url("select2/spinner.gif") no-repeat 100% !important; }
.select2-default {
color: #999999 !important; }
@ -406,4 +404,4 @@ disabled look for disabled choices in the results dropdown
background-size: 60px 40px !important; }
.select2-search input {
background-position: 100% -21px !important; } }
background-position: 100% -21px !important; } }

View File

@ -86,16 +86,16 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
position: absolute;
z-index: 9999;
top: 100%;
background-color: $gray;
background-color: #fff;
color: #000;
border: 1px solid $gray;
border-top: 0;
border: 2px solid $gray;
// border-top: 0;
}
.select2-drop.select2-drop-above {
margin-top: 1px;
border-top: 1px solid $gray;
border-bottom: 0;
// border-top: 1px solid $gray;
// border-bottom: 0;
}
.select2-container .select2-choice div {
@ -180,8 +180,8 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
/* results */
.select2-results {
max-height: 200px;
padding: 0 0 0 4px;
margin: 4px 4px 4px 0;
// padding: 0 0 0 4px;
// margin: 4px 4px 4px 0;
font-size: 13px;
position: relative;
overflow-x: hidden;
@ -205,6 +205,11 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
list-style: none;
display: list-item;
background-image: none;
border-top: solid 1px lighten($gray, 10%);
:first-child {
border-top: 0;
}
}
.select2-results li.select2-result-with-children > .select2-result-label {
@ -212,7 +217,7 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
}
.select2-results .select2-result-label {
padding: 4px 6px;
padding: 6px;
margin: 0;
cursor: pointer;

View File

@ -12,6 +12,9 @@
.main-list {
margin-bottom: 0;
}
#filter .main-list, #filter + .main-list {
table-layout: fixed;
}
.main-wrap>.main-list thead th {
background-color: transparent;
border-right: medium none;
@ -36,7 +39,7 @@
}
.main-list tbody .quick-edit .nav {
position: absolute;
width: 350px;
width: 440px;
left: -8px;
}
.main-list tbody .quick-edit .nav .dropdown-menu {

View File

@ -0,0 +1,150 @@
.o-question {
font-size: 15px;
}
.o-question input[type=checkbox], .o-question input[type=radio] {
margin: 0;
}
.o-question textarea {
resize: vertical;
}
.o-question-topic {
font-size: 2em;
line-height: normal;
margin: 0;
padding: 0.5em 0;
}
.o-question-description {
font-size: 0.9em;
line-height: 1.5em;
}
.o-question-list {
clear: both;
margin: 40px 0;
padding: 0;
font-weight: bold;
}
.o-question-list > li {
margin: 0 0 0 40px;
padding: 16px 0;
border-top: solid 1px #eee;
position: relative;
}
.o-question-list > li .required-star {
position: absolute;
left: -42px;
padding-top: 4px;
}
.o-question-list > li:first-child {
border: 0;
}
.o-question-title {
font-weight: bold;
font-size: 1.2em;
line-height: 1.5em;
margin-bottom: 16px;
}
.o-question-title + .o-question-description {
font-weight: normal;
background-color: #f6f6f6;
padding: 16px;
position: relative;
margin-top: 20px;
width: 90%;
}
.o-question-title + .o-question-description:before {
display: block;
content: "";
border-left: 12px solid transparent;
border-right: 12px solid transparent;
border-bottom: 12px solid #f6f6f6;
position: absolute;
top: -12px;
left: 16px;
}
.o-question-title + input[type=text],
.o-question-title + textarea,
.o-question-title + select,
.o-question-description + input[type=text],
.o-question-description + textarea,
.o-question-description + select {
display: block;
}
.o-question-title + input[type=text], .o-question-title + textarea {
border: solid 1px #ccc;
padding: 6px;
margin: 20px 0;
line-height: 24px;
}
.o-question-title + input[type=text] {
width: 40%;
}
.o-question-title + textarea {
width: 70%;
}
.o-question-group {
margin: 20px 0;
padding: 0;
}
.o-question-option {
font-weight: normal;
}
.o-question-group.view-list {
list-style: none;
}
.o-question-group.view-list .o-question-option {}
.o-question-group.view-list > li {
margin-top: 8px;
}
.o-question-group.view-list > li:first-child {
margin: 0;
}
.o-question-group.view-list > li > * {
display: inline-block;
margin: 0;
padding: 0;
vertical-align: middle;
}
.o-question-group.view-list > li input + .o-question-option {
margin: 0 0 0 12px;
}
.o-question-group.view-dropdown {
height: 24px;
line-height: 24px;
}
.o-question-group.view-grid {
border-collapse: collapse;
max-width: 90%;
min-width: 50%;
width: auto;
}
.o-question-group.view-grid th, .o-question-group.view-grid td {
padding: 6px;
}
.o-question-group.view-grid thead th {
text-align: center;
}
.o-question-group.view-grid tbody th {}
.o-question-group.view-grid tbody .odd .o-question-title, .o-question-group.view-grid tbody .odd td {
background-color: #f6f6f6;
}
.o-question-group.view-grid .o-question-title {
font-size: 1em;
}
.o-question-group.view-grid tbody .odd .o-question-title {
background-color: transparent;
}
.o-question-group.view-grid tbody .odd td {}
.o-question-group.view-grid tbody tr:hover td {
background-color: #aaa;
}
.o-question-group.view-grid tbody td {
vertical-align: middle;
text-align: center;
}
.o-question-group.view-grid tbody td input {
vertical-align: baseline;
}
.o-question-action {
padding: 20px;
background-color: #f6f6f6;
}

View File

@ -0,0 +1,52 @@
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
body {
margin: 0;
padding: 50px 0;
background-color: #eee;
font-family: 'Open Sans', sans-serif;
}
.wrapper {
background: #FFFFFF none;
box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
margin: 0 auto;
overflow: hidden;
width: 980px;
}
.wrapper > h1 {
margin: 0;
padding: 20px;
font-family: 'Open Sans', sans-serif;
font-weight: bold;
}
section {
border-top: dashed 3px #eee;
padding: 40px;
overflow: hidden;
}
section:first-child {
border: 0;
padding-top: 0;
}
section > h2 {
font-size: 13px;
font-weight: bold;
border: solid 1px #ddd;
background-color: #2676C0;
color: #fff;
display: inline-block;
padding: 0 16px;
box-shadow: 0 1px 1px #fff, 0 2px 6px rgba(0,0,0,0.1);
}
.side {
float: right;
width: 189px;
padding-left: 20px;
border-left: solid 1px #eee;
}
.main {
float: left;
width: 710px;
padding-right: 20px;
}

View File

@ -11,7 +11,7 @@ class Admin::AssetsController < OrbitBackendController
def new
@asset = Asset.new
@asset_categories = AssetCategory.all
@tags = AssetTag.all
@tags = get_tags
respond_to do |format|
format.html {}
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
@ -21,7 +21,7 @@ class Admin::AssetsController < OrbitBackendController
def edit
@asset = Asset.find(params[:id])
@asset_categories = AssetCategory.all
@tags = AssetTag.all
@tags = get_tags
respond_to do |format|
format.html {}
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
@ -46,7 +46,7 @@ class Admin::AssetsController < OrbitBackendController
else
flash[:error] = t('create.fail')
@asset_categories = AssetCategory.all
@tags = AssetTag.all
@tags = get_tags
respond_to do |format|
format.js {
if params[:uploader]
@ -69,7 +69,7 @@ class Admin::AssetsController < OrbitBackendController
else
flash[:error] = t('update.fail')
@asset_categories = AssetCategory.all
@tags = AssetTag.all
@tags = get_tags
respond_to do |format|
format.html { render :action => :edit }
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} }
@ -96,7 +96,7 @@ class Admin::AssetsController < OrbitBackendController
def file_upload
@asset = Asset.new
@asset_categories = AssetCategory.all
@tags = AssetTag.all
@tags = get_tags
render :layout => false
end

View File

@ -5,8 +5,9 @@ class Admin::DashboardsController < OrbitBackendController
# before_filter :is_admin?
def index
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
check_backend_openness
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
@most_visited = get_most_visited('bulletin', 'page_context')
end

View File

@ -0,0 +1,38 @@
class Admin::MailCronLogsController < OrbitBackendController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
def index
# @mail_cron_logs = MailCronLog.all.desc(:created_at).page(params[:page_main] ).per('20')
@mail_cron_logs = (params[:sort]) ? get_sorted_and_filtered("mail_cron_log") : get_viewable("mail_cron_log")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @mail_crons }
format.js
end
end
def destroy
@mail_cron_log = MailCronLog.find(params[:id])
@mail_cron_log.destroy
respond_to do |format|
format.html { redirect_to(admin_mail_cron_logs_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
mail_cron_logs = MailCronLog.any_in(:_id => params[:ids]).destroy_all
end
redirect_to admin_mail_cron_logs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
end

View File

@ -0,0 +1,126 @@
class Admin::MailCronsController < OrbitBackendController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
def index
# @mail_crons = MailCron.all.asc(:mail_sentdate).page(params[:page_main] ).per('20')
@mail_crons = (params[:sort]) ? get_sorted_and_filtered("mail_cron") : get_viewable("mail_cron")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @mail_crons }
format.js
end
end
def show
end
def new
@mail_cron = MailCron.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mail_cron }
end
end
def create
@mail_cron = MailCron.new(params[:mail_cron])
@mail_cron.create_user_id = current_user.id
@mail_cron.update_user_id = current_user.id
respond_to do |format|
if @mail_cron.save
format.html { redirect_to(admin_mail_crons_url) }
format.xml { render :xml => @mail_cron, :status => :created, :location => @mail_cron }
else
format.html { render :action => "new" }
format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity }
end
end
end
def edit
@mail_cron = MailCron.find(params[:id])
end
def update
@datas = MailCron.where(:mail_sentdate.lte => Time.now, :mail_sent => false)
@datas.each do |mail_data|
@mail_j = 0
@read_mails = Array.new
@mails = mail_data.mail_to.split(",")
@mails.each do |send_mail|
@read_mails << send_mail
@mail_j += 1
if 0 == @mail_j % 30
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
@read_mails = Array.new
sleep 10
end
end
if !@read_mails.join(',').blank?
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
@read_mails = Array.new
sleep 10
end
end
@mail_cron = MailCron.find(params[:id])
@mail_cron.update_user_id = current_user.id
respond_to do |format|
if @mail_cron.update_attributes(params[:mail_cron])
format.html { redirect_to(admin_mail_crons_url) }
format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity }
end
end
end
def destroy
@mail_cron = MailCron.find(params[:id])
@mail_cron.destroy
respond_to do |format|
format.html { redirect_to(admin_mail_crons_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
mail_crons = MailCron.any_in(:_id => params[:ids]).destroy_all
end
redirect_to admin_mail_crons_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
end

View File

@ -1,7 +1,6 @@
class Admin::PagePartsController < OrbitBackendController
include Admin::FrontendWidgetInterface
layout "site_editor"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_current_item
@ -18,59 +17,80 @@ class Admin::PagePartsController < OrbitBackendController
end
end
def new
end
def edit
@part = PagePart.find(params[:id])
@module_apps = ModuleApp.where(:key.in=>OrbitApp::Module::WidgetUtility.all.keys).order_by(:title, :asc)
@module_app = @part.module_app ? @part.module_app : nil
@user_choose = @part.widget_path
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all rescue nil
if @module_app
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? or @module_app.nil?
end
unless @module_app.nil?
@categories = @module_app.get_categories
@tags = @module_app.get_tags
if @r_tag.eql?('tag_cloud')
@tag_objects = ModuleApp.where(has_tag: true)
else
@tag_objects = @r_tag.classify.constantize.all rescue nil
end
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
if @module_app && @module_app.widgets.any?{|b| b.class == Array}
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
end
@module_apps = ModuleApp.for_widget_select
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
# @frontend_styles = nil
@selected={
:module_app=> @part.module_app ? @part.module_app : nil,
:app_frontend_url=> @part.widget_path || "default_widget", #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil,
:widget_path=> nil
}
@selected[:widget_path] = @part.widget_path ? @part.widget_path : (@selected[:module_app].widgets.keys[0] rescue nil)
get_categories_and_tags
get_frontend_data_count
@app_frontend_urls = get_app_frontend_urls
end
def create
def reload_widgets
@part = PagePart.find params[:id]
@selected={
:module_app=> ModuleApp.find(params["module_app_id"])
}
get_categories_and_tags
get_frontend_data_count
@selected[:app_frontend_url] = @selected[:module_app].has_default_widget? ? 'default_widget' : @selected[:module_app].widget_options.first.name
end
def reload_widget_styles
@part = PagePart.find(params[:id])
@selected={
:module_app=> ModuleApp.find(params["module_app_id"]),
:app_frontend_url=> params["frontend"], #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil,
:widget_path=> nil
}
get_categories_and_tags
get_frontend_data_count
end
def reload_widget_field
@index = params[:field_seri].to_i
@part = PagePart.find(params[:id])
@selected = {
:module_app=> ModuleApp.find(params["module_app_id"]),
:default_widget_field=>params[:widget_field_value]
}
end
def update
@part = PagePart.find(params[:id])
# params[:page_part][:widget_field_type] = nil
# params[:page_part][:widget_field_is_link] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
end
if params[:page_part][:tag].nil? || params[:page_part][:tag].include?("nil")
params[:page_part][:tag] = []
end
if params[:page_part][:category].nil? || params[:page_part][:category].include?("nil")
params[:page_part][:category] = []
end
clean_tags_and_category_params
# params[:page_part][:widget_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page_part][:widget_field].blank?
if @part.update_attributes(params[:page_part])
@ -101,51 +121,25 @@ class Admin::PagePartsController < OrbitBackendController
redirect_to admin_items_url( :parent_id => @item.parent_id )
end
def reload_widget_field
@index = params[:field_seri].to_i
@part = PagePart.find params[:id]
@choosen_field = params[:widget_field_value]
@module_app = @part.module_app
@module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?
end
def reload_widgets
@part = PagePart.find params[:id]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@categories =@module_app ? @module_app.get_categories : []
@tags =@module_app ? @module_app.get_tags : []
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
@part.widget_path = @module_app.widgets.first if( @module_app)
respond_to do |format|
format.js {}
end
end
def reload_widget_styles
@module_app = ModuleApp.find(params[:module_app_id])
@part = PagePart.find params[:id]
@user_choose =@widget_path= params[:frontend]
@widget_style = @module_app.widgets[@widget_path]
respond_to do |format|
format.js {}
end
end
def reload_r_tag_options
@part = PagePart.find params[:id]
@r_tag = params[:type]
@tag_objects = @r_tag.classify.constantize.all rescue nil
if params[:type].eql?('tag_cloud')
@tag_objects = ModuleApp.where(has_tag: true)
else
@tag_objects = @r_tag.classify.constantize.all rescue nil
end
respond_to do |format|
format.js {}
end
end
protected
def get_app_frontend_urls
@selected[:module_app] ? @selected[:module_app].widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} : []
# has_old_value = @selected[:module_app].app_pages[@selected[:app_frontend_url]]
# @frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil)
end
def set_children_sub_menu(part)
part.page.children.each do |child|

View File

@ -1,5 +1,6 @@
class Admin::PagesController < Admin::ItemsController
helper Admin::PagePartsHelper
include Admin::FrontendWidgetInterface
def show
@item = Page.find(params[:id])
respond_to do |format|
@ -13,40 +14,123 @@ helper Admin::PagePartsHelper
def new
@item = Page.new
@item.parent = Item.find(params[:parent_id]) rescue nil
@apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys)
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
# @apps = ModuleApp.for_frontend_select
@designs = Design.all.entries
@design = Design.first
@themes = Design.first.themes
@module_apps = ModuleApp.for_frontend_select
@app_frontend_urls = nil
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
@frontend_styles = nil
@selected={
:design => @designs.first,
:theme=> @themes.first,
:module_app=>nil,#@module_apps.first
:app_frontend_url=> nil, #@module_apps.first
:category=>nil,
:tag=>nil,
:page_frontend_data_count=>nil,
:frontend_style => nil
}
end
def edit
@item = Page.find(params[:id])
@user_choose = @item.app_frontend_url
@apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys)
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
@themes = @item.design ? @item.design.themes : @designs.first.themes
@module_apps = ModuleApp.for_frontend_select
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
@frontend_styles = nil
if @item.module_app
@app_frontend_urls = []
setup_app_frontend_and_style
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?
@selected={
:design => @item.design || @designs.first,
:theme=> @item.theme,
:module_app=>@item.module_app,#@module_apps.first
:app_frontend_url=> @item.app_frontend_url, #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil
}
@app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil
get_categories_and_tags
get_frontend_data_count
end
@module_app = @item.module_app
@frontend_path = @item.app_frontend_url
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end
get_categories_and_tags
else
@module_app = @module_apps[0]
def reload_themes
design = Design.find(params[:design_id])
@themes = design.themes
respond_to do |format|
format.js {}
end
end
def reload_frontend_pages
@item = Page.find(params[:id]) rescue Page.new
@selected={
:design => nil,
:theme=> nil,
:module_app=>(ModuleApp.find(params[:module_app_id]) rescue nil),
:app_frontend_url=> @item.app_frontend_url || 'default_widget', #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil
}
@app_frontend_urls = @selected[:module_app] ? select_array_for_app_frontend_urls(@selected[:module_app].app_pages) : nil
get_categories_and_tags
get_frontend_data_count
get_frontend_styles
respond_to do |format|
format.js {}
end
end
def reload_front_end_setting
@item = Page.find(params[:id]) rescue Page.new
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
@selected={
# :design => @item.design || @designs.first,
# :theme=> @item.theme,
:module_app=>ModuleApp.find(params[:module_app_id]),
:app_frontend_url=> params[:frontend] ,
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil
}
@app_frontend_urls = @selected[:module_app].nil? ? nil : @selected[:module_app].app_pages.each{|name,data| [I18n.t(data["i18n"]),name]}
@frontend_styles = @selected[:module_app].app_pages[params["frontend"]]["style"] rescue nil
end
def reload_widget_field
@index = params[:field_seri].to_i
@item = Page.find(params[:id]) rescue Page.new
@selected = {
:module_app=> (ModuleApp.find(params[:module_app_id]) || @item.module_app ),
:default_widget_field=>params[:widget_field_value]
}
# @choosen_field = params[:widget_field_value]
# @module_app = @item.module_app
# @module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?
end
def create
clean_tags_and_category_params
@item = Page.new(params[:page])
if @item.module_app && @item.module_app.key == 'page_content'
@ -63,36 +147,34 @@ helper Admin::PagePartsHelper
end
else
flash.now[:error] = t('create.error.page')
@apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys)
@designs = Design.all.entries
@design = Design.first
@design = Design.find(params[:page][:design]) || Design.first
@themes = @design.themes
@module_apps = ModuleApp.for_frontend_select
@selected={
:design => params[:page][:design],
:theme=> (Theme.find(params[:page][:theme_id]) rescue nil),
:module_app=> (ModuleApp.find(params[:page][:module_app_id]) rescue nil) ,#@module_apps.first
:app_frontend_url=> params[:page][:app_frontend_url], #@module_apps.first
:category=>params[:page][:category],
:tag=>params[:page][:tag],
:page_frontend_data_count=>params[:page][:page_frontend_data_count],
:frontend_style => params[:page][:frontend_style]
}
@app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil
get_categories_and_tags
get_frontend_data_count
render :action => "new"
end
end
def update
clean_tags_and_category_params
@item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
# params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type], params[:page][:frontend_field_is_link] ) if params[:page][:frontend_field]
# params[:page][:frontend_field_type] = nil
# params[:page][:frontend_field_is_link] = nil
if params[:page][:tag].nil? || params[:page][:tag].include?("nil")
params[:page][:tag] = []
end
if params[:page][:category].nil? || params[:page][:category].include?("nil")
params[:page][:category] = []
end
# params[:page][:frontend_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page][:frontend_field].blank?
if @item.update_attributes(params[:page])
flash[:notice] = t('update.success.page')
respond_to do |format|
@ -126,65 +208,10 @@ helper Admin::PagePartsHelper
end
end
def reload_front_end_setting
@item = Page.find params[:id] rescue nil
@module_app = ModuleApp.find params[:module_app_id]
@user_choose = params[:frontend] #choosen frontend
protected
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.each{|name,data| [I18n.t(data["i18n"]),name]}
@frontend_styles = @module_app.app_pages[params["frontend"]]["style"] rescue nil
# =======
# @chosen_frontend = @user_choose = params[:frontend]
# >>>>>>> Stashed changes
end
def get_categories_and_tags
unless @module_app.nil?
@categories = @module_app.get_categories
@tags = @module_app.get_tags
end
def get_frontend_styles
has_old_value = @selected[:module_app].app_pages[@selected[:app_frontend_url]]
@frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil)
end
def setup_app_frontend_and_style
if @module_app.nil?
@item.module_app.app_pages.each{|name,data| @app_frontend_urls << [I18n.t(data["i18n"]),name]}
@frontend_styles = @item.module_app.app_pages[@item.frontend_style]["style"] if @frontend_styles.nil? && @item && @item.module_app.app_pages[@item.frontend_style]
@frontend_styles = @item.module_app.app_pages.first[1]["style"] if @frontend_styles.nil? && @item
else
@module_app.app_pages.each{|name,data| @app_frontend_urls << [I18n.t(data["i18n"]),name]}
@frontend_styles = @module_app.app_pages[params["frontend"]]["style"] rescue nil
@frontend_styles = @module_app.app_pages.first[1]["style"] if @frontend_styles.nil?
end
end
def reload_frontend_pages
@item = Page.find params[:id] rescue nil
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = []
setup_app_frontend_and_style
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?)
get_categories_and_tags
respond_to do |format|
format.js {}
end
end
def reload_themes
@design = Design.find(params[:id])
@themes = @design.themes
respond_to do |format|
format.js {}
end
end
def reload_widget_field
@index = params[:field_seri].to_i
@item = params.has_key?(:id) ? Page.find(params[:id] ) : Page.new
@choosen_field = params[:widget_field_value]
@module_app = @page.module_app
@module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?
end
end

View File

@ -0,0 +1,9 @@
class Admin::RoleCategorysController < Admin::RoleFiltersController
def initialize
super
@app_type = 'role_category'
@app_type_name = 'category'
end
end

View File

@ -0,0 +1,144 @@
class Admin::RoleFiltersController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
# before_filter :set_attribute, :only => [:index, :show, :new, :edit]
helper Admin::AttributeValuesViewHelper
def index
get_types
@role = Role.find(params[:role_id])
@role_filters = @types.where(:role_id=>params[:role_id])
@role_filter = @types.new(:display => 'List')
# @url = admin_role_filter_role_filters_path
if @app_type == 'role_statuses'
@url = eval("admin_#{@app_type}_path")
else
@url = eval("admin_#{@app_type}s_path")
end
respond_to do |format|
format.html # index.html.erb
format.js
end
end
def show
get_types
@role_filter = @types.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
end
end
def new
get_types
@role_filter = @types.new(:display => 'List')
@verb = :post
respond_to do |format|
format.html # new.html.erb
format.js
end
end
def edit
get_types
@role_filter = @types.find(params[:id])
@url = polymorphic_path([:admin, @role_filter])
@verb = :put
respond_to do |format|
format.html
format.js
end
end
def create
get_types
@role_filter = @types.new(params[:role_filter])
respond_to do |format|
if @role_filter.save
format.html { redirect_to(admin_role_filter_url(params[:role_filter][:role_id])) }
format.js
end
end
end
def update
get_types
@role_filter = @types.find(params[:id])
# debugger
# @url = admin_role_filter_role_filter_path(@role_filter)
# @url = eval("admin_role_filter_#{@app_type}_path(#{@role_filter})")
@url = polymorphic_path([:admin, @role_filter])
respond_to do |format|
if @role_filter.update_attributes(params[:role_filter])
format.html { redirect_to(admin_role_filter_role_filters_url(params[:role_id]), :notice => t('role_filter.update_role_filter_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
def destroy
get_types
@role_filter = @types.find(params[:id])
@role_filter.disable = @role_filter.disable ? false : true
if @role_filter.save!
respond_to do |format|
format.html { redirect_to(admin_role_filter_role_filters_url) }
# format.xml { head :ok }
format.js
end
else
flash[:error] = t("role_filter.update_failed")
format.html { render :action => "index" }
end
end
protected
def get_types
@types = @app_type.classify.constantize
end
end

View File

@ -0,0 +1,9 @@
class Admin::RoleStatusesController < Admin::RoleFiltersController
def initialize
super
@app_type = 'role_statuses'
@app_type_name = 'status'
end
end

View File

@ -17,35 +17,34 @@ class Admin::RolesController < OrbitBackendController
def role_field
@field_name = 'role'
@field_name = 'role'
@attribute = Role.find(params[:role_id])
@attribute = Role.find(params[:role_id])
end
def sub_role
@attribute = Role.find(params[:role_id])
@attribute_fields_upper_object = @attribute.sub_roles
@attribute = Role.find(params[:role_id])
@attribute_fields_upper_object = @attribute.sub_roles
end
def add_sub_role
@attribute = Role.find(params[:role_id])
# @sub_attribute = Role.find(params[:role_id])
@attribute = Role.find(params[:role_id])
# @sub_attribute = Role.find(params[:role_id])
@sub_attribute = SubRole.new
@sub_attribute = SubRole.new
@sub_attribute.role_id = params[:role_id]
end
def edit_sub_role
@sub_attribute = SubRole.find(params[:role_id])
@sub_attribute = SubRole.find(params[:role_id])
@attribute = Role.find(@sub_attribute.role_id)
@attribute = Role.find(@sub_attribute.role_id)
@sub_attribute.role_id = @sub_attribute.role_id
@ -55,53 +54,52 @@ class Admin::RolesController < OrbitBackendController
@field_name = 'sub_role'
@sub_attribute = SubRole.find(params[:role_id])
@sub_attribute = SubRole.find(params[:role_id])
@attribute = Role.find(@sub_attribute.role_id)
@attribute = Role.find(@sub_attribute.role_id)
end
def add_attribute_field
if params[:sub_role]
if params[:sub_role]
@field_name = 'sub_role'
@field_name = 'sub_role'
attribute = SubRole.find(params[:sub_role][:id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
attribute = SubRole.find(params[:sub_role][:id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
@attribute_field[:af_count] = @attribute_field_counter
@attribute_field[:af_count] = @attribute_field_counter
@attribute = SubRole.find(params[:sub_role][:id])
@attribute = SubRole.find(params[:sub_role][:id])
else
else
@field_name = 'role'
@field_name = 'role'
attribute = Role.find(params[:role_id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
attribute = Role.find(params[:role_id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
@attribute_field[:af_count] = @attribute_field_counter
@attribute_field[:af_count] = @attribute_field_counter
@attribute = Role.find(params[:role_id])
@attribute = Role.find(params[:role_id])
end
end
respond_to do |format|
respond_to do |format|
format.js { render 'add_attribute_field' }
end
end
end
def new
@attribute = Role.new
if !params[:parent_id]
if !params[:parent_id]
render :template => 'admin/attributes/new'
end
@ -165,17 +163,17 @@ class Admin::RolesController < OrbitBackendController
def destroy
if params[:sub_role]
if params[:sub_role]
@sub_role = SubRole.find(params[:sub_role][:id])
@sub_role = SubRole.find(params[:sub_role][:id])
respond_to do |format|
if @sub_role.destroy
format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) }
format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) }
end
end
else
else
@attribute = Role.find(params[:id])
@attribute.destroy

View File

@ -14,8 +14,16 @@ class Admin::SitesController < OrbitBackendController
# @site = Site.new
# end
def show_system_preference
@git_commit_list_file = File.new(OrbitSystemPreference::GitCommitListPath, "r") rescue nil
@db_backup_list_file = File.new(OrbitSystemPreference::ArchiveDbListPath, "r") rescue nil
@resque_logs_file = File.new(OrbitSystemPreference::ResqueLogFile, "r") rescue nil
@site = Site.first
end
def update
@site.update_attributes(params[:site])
site_restart
redirect_to :back
end

View File

@ -2,16 +2,10 @@ class Admin::TagsController < OrbitBackendController
before_filter :force_order_for_visitor,:only=>[:index]
before_filter :force_order_for_user,:except => [:index]
before_filter :for_app_sub_manager,:except => [:index]
# layout 'new_admin'
# before_filter :authenticate_user!
# before_filter :is_admin?
# before_filter :set_module_app
def index
get_tags
@module_app_id = @module_app.id rescue nil
@tags = get_tags
end
def new
@ -23,12 +17,7 @@ class Admin::TagsController < OrbitBackendController
end
def create
if params[:tag][:module_app_id].blank?
@tag = Tag.create(params[:tag])
else
module_app = ModuleApp.find(params[:tag][:module_app_id])
@tag = eval("#{module_app.key.camelize}Tag").create(params[:tag])
end
@tag = @module_app ? @module_app.tags.create(params[:tag]) : Tag.create(params[:tag])
end
def update
@ -47,15 +36,12 @@ class Admin::TagsController < OrbitBackendController
protected
def get_tags
@tags = (@module_app ? @module_app.tags : Tag.all)
@tags = @module_app.blank? ? Tag.all : @module_app.tags
end
def setup_vars
@app_key = request.env['HTTP_REFERER'].split('/')[4]
if @app_key
@app_key.gsub!(/[?].*/, '')
@module_app = ModuleApp.first(conditions: {:key => @app_key})
end
@module_app = ModuleApp.find(params[:module_app_id]) if params[:module_app_id]
@module_app_id = @module_app.id rescue nil
end
end

View File

@ -0,0 +1,8 @@
class Admin::UserActionsController < OrbitBackendController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
def index
@user_actions = UserAction.all
end
end

View File

@ -1,4 +1,6 @@
class Admin::UsersNewInterfaceController < OrbitBackendController
helper MemberHelper
layout "new_admin"
# before_filter :authenticate_user!
@ -23,13 +25,13 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
render case params[:at]
when 'summary'
@users=User.not_guest_user.page(page_num).per(12).includes('avatar')
@users=User.not_guest_user.page(page_num).per(12).asc("_id").includes('avatar')
"index_summary"
when 'thumbnail'
@users=User.not_guest_user.page(page_num).per(36).includes('avatar')
@users=User.not_guest_user.page(page_num).per(36).asc("_id").includes('avatar')
"index_thumbnail"
else
@users=User.not_guest_user.page(page_num).per(10).includes('avatar')
@users=User.not_guest_user.page(page_num).per(10).asc("_id").includes('avatar')
"index"
end
end
@ -43,7 +45,7 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
@student_data = []
@staff_data = []
attribute_values = @user.attribute_values
attribute_values = @user.attribute_values.asc("_id")
attribute_values.each{|att_val|
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale.to_s)}) if att_val.attribute_field.attribute.key=="profile" rescue false
}
@ -80,21 +82,29 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
end
def create
puts params.to_yaml
# puts params.to_yaml
# attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
# attribute_values = params[:user].delete(attribute_values_key)
@user = User.new(params["user"])
@checkuser = User.where(:user_id => params[:user][:user_id]).first
if !@checkuser.blank?
flash.now[:error] = t("users.user_id_error")
end
# attribute_values.to_hash.each{|key,value|
# @user.attribute_values.build(value)
# }
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
# binding.pry
if @user.save
if !flash.now[:error] && @user.save
flash[:notice] = t('create.success.user')
redirect_to :action => :index
else
@user.attribute_values = nil
@form_index = 0
render :action => :new
render :action => :new , :notice => flash.now[:error]
end
end
@ -110,16 +120,46 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
@form_index = 0
get_info_and_roles
end
def edit_passwd
# @disable_all_field = false
@user = User.find(params[:users_new_interface_id])
end
def update
@user = User.find(params[:id])
if params[:edit_type] == 'edit_passwd'
@checkuser = User.where(:user_id => params[:user][:user_id]).first
if !@checkuser.blank? && @checkuser.id != @user.id
flash.now[:error] = t("users.user_id_error")
elsif @user.admin && current_user.id == @user.id
flash.now[:error] = t("users.admin_change_password")
end
if !flash.now[:error] && @user.update_attributes(params[:user])
redirect_to :action => :show
else
render :action => :edit_passwd, :notice => flash.now[:error]
end
else
@user.update_attributes(params[:user])
attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
attribute_values = params[:user].delete(attribute_values_key)
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
@user.save
redirect_to :action => :show
end
@user.update_attributes(params[:user])
attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
attribute_values = params[:user].delete(attribute_values_key)
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
@user.save
redirect_to :action => :show
# # Update changes to the avatar
# @user.remove_avatar! if params[:file]
# @user.avatar = params[:file] if params[:file]

View File

@ -3,8 +3,8 @@ class ApplicationController < ActionController::Base
include ParserFrontEnd, ParserBackEnd, ApplicationHelper
include OrbitApp::ErrorHandlers::PageErrorHandler
include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler
include OrbitApp::ErrorHandlers::ModuleAppErrorHandler
include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler
include OrbitApp::ErrorHandlers::ModuleAppErrorHandler
rescue_from ObjectAuthError, :with => :render_object_auth_error
rescue_from ModuleAppError, :with => :render_module_app_error
@ -17,19 +17,28 @@ class ApplicationController < ActionController::Base
helper_attr :site_valid_locales
def check_backend_openness
if !Me.backend_openness_on
redirect_to '/users/sign_in' if not (authenticate_user! and is_member? )
end
end
def site_restart
Resque.enqueue(RestartServer)
end
def set_current_user
User.current = current_or_guest_user
UserActionRecoder.perform(current_or_guest_user,params.to_s)
end
def front_end_available(module_app_title='')
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
unless app_controller.enable_frontend?
unless app_controller.enable_frontend?
render :nothing => true
end
end
def get_all_app_engines
ary = ["vender/plugins/new_blog"]
app_engines = ary.collect{|t|
@ -42,23 +51,23 @@ class ApplicationController < ActionController::Base
def flaten_controller
ary=[]
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
require_dependency(name) if /_controller\.rb$/ =~ name
ary << name
}
ary
end
# Find the parent for the given item
def find_parent_item
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
end
def auth_failed_in_backend
#redirect_to admin_dashboards_url
#redirect_to admin_dashboards_url
redirect_to root_path
end
def for_admin_only
if is_admin?
true
@ -67,7 +76,7 @@ class ApplicationController < ActionController::Base
auth_failed_in_backend
end
end
def for_app_manager
if is_manager?
true
@ -76,7 +85,7 @@ class ApplicationController < ActionController::Base
auth_failed_in_backend
end
end
def for_app_sub_manager
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
true
@ -99,12 +108,12 @@ class ApplicationController < ActionController::Base
flash[:error] = t("access.denied.object")
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
end
# Render the page
def render_page
def render_page(args={})
if @item
respond_to do |format|
format.html { render :text => parse_page_content(@item), :layout => 'page_layout' }
format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' }
format.rss { render_main_rss }
format.mobile { redirect_to mobile_path(:app => params[:app]) }
end
@ -123,9 +132,9 @@ class ApplicationController < ActionController::Base
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
render 'shared/render_share', :layout => false
end
protected
# Set I18n.locale
def set_locale
# update session if passed
@ -139,24 +148,24 @@ class ApplicationController < ActionController::Base
else
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
condition = @site_in_use_locales.include?(browser_locale)
end
end
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
I18n.locale = session[:locale].to_sym
end
# Set the site variables
def set_site
# set site if exist or create site
@site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []})
@site = Site.first || Site.create({:valid_locales => VALID_LOCALES, :in_use_locales => VALID_LOCALES})
session[:site] = @site.id
@site_in_use_locales = site_locales_default_head(@site.in_use_locales)
@site_valid_locales = site_locales_default_head(@site.valid_locales)
end
def set_current_item
session[:current_page] = params[:id] || @item.id rescue nil
end
def decrypt_data(encrypted_data, encrypted_key, encrypted_iv)
site = Site.find(session[:site])
if encrypted_data
@ -172,7 +181,7 @@ class ApplicationController < ActionController::Base
''
end
end
def get_homepage
Page.root
end
@ -220,6 +229,174 @@ class ApplicationController < ActionController::Base
redirect_to ret
end
def get_sorted_and_filtered(object_class, query = nil, objects = nil)
objects ||= get_objects(object_class, query)
object_class = object_class.classify.constantize
if !params[:sort].blank?
options = params[:sort_options]
options = [options] if !options.class.eql?(Array)
options.each do |option|
if object_class.fields.include?(option)
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
else
(objects = objects.order_by(option, params[:direction])) rescue nil
end
elsif object_class.relations.include?(option)
case object_class.relations[option].macro
when :references_one
a = Array.new
objects.each { |object| a << [get_string_value_from_object(object), object] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
objects = sorted.collect {|x| x[1] }
when :references_many, :references_and_referenced_in_many
objects = get_objects_from_self(object_class, objects, option)
when :referenced_in
objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id")
end
elsif option.eql?('tags')
tag_array = @module_app.tags.inject([]){ |result, value|
result << [value.name, value]
}
params[:direction].eql?('asc') ? tag_array.sort : tag_array.sort.reverse!
sorted_objects = Array.new
tag_array.each do |x|
taggings = x[1].taggings
taggings.each {|tagging| sorted_objects << tagging.taggable }
end
# debugger
sorted_objects.flatten!
sorted_objects.uniq!
objects = get_with_nil(objects, option, sorted_objects)
end
end
end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
objects.each do |object|
value.each do |v|
a << object if object[v]
end
end
objects = a.uniq
when 'categories'
a = Array.new
objects.each do |object|
a << object if (value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) rescue nil)
end
objects = a.uniq
when 'tags'
a = Array.new
objects.each do |object|
object.tags.each do |tag|
a << object if value.include?(tag.id.to_s)
end
end
objects = a.uniq
end if value.size > 0
end
end
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
end
def get_viewable(object_class, query=nil)
objects = get_objects(object_class,query).order_by(:created_at, :desc)
Kaminari.paginate_array(objects).page(params[:page]).per(10)
end
def get_objects(object_class, query=nil)
object_class = object_class.classify.constantize
# debugger
# a=1
if query
if object_class.include?(Mongoid::Sortable)
objects = object_class.default_sort(params[:sort]).where(query)
else
objects = object_class.where(query)
end
else
if object_class.include?(Mongoid::Sortable)
objects = object_class.default_sort(params[:sort]).all
else
objects = object_class.all
end
end
objects
end
def get_objects_from_referenced_objects(object_class, objects, option)
referer_ids = objects.distinct(option)
referenced_objects = object_class.find(referer_ids) rescue nil
if referenced_objects
a = Array.new
referenced_objects.to_a.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_objects_from_self(object_class, objects, option)
referenced_class = object_class.relations[option].class_name.constantize
referenced_objects = referenced_class.all rescue nil
if referenced_objects
reverse_relation = nil
referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) }
a = Array.new
referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] }
a.compact!
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = Array.new
sorted.each {|x| sorted_objects << x[1].send(reverse_relation) }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_string_value_from_object(object)
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
s = object.name unless s rescue nil
s = object.title unless s rescue nil
s.downcase rescue ''
end
def get_with_nil(objects, option, sorted_objects)
tmp = Array.new
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_tmp = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
a.flatten
end
def filter_authorized_objects(objects)
if(!is_admin? || !is_manager?)
objects.delete_if{ |object|
if object.is_pending == true
if check_permission(:manager)
object.create_user_id != current_user.id
else
!object.send("#{object.class.to_s.underscore}_category").authed_users('fact_check').include?(current_user) rescue false
end
else
false
end
}
end
objects
end
private

View File

@ -11,53 +11,68 @@ class DefaultWidgetController< OrbitWidgetController
end
def query_for_default_widget
ori_class_name = @default_widget["query"].split('.')[0]
result = nil
result_objects = nil
@ori_class_name = @default_widget["query"].split('.')[0]
@result = eval(@default_widget["query"])
if !params["tag_id"].blank?
@tags = Tag.find(params["tag_id"]) rescue nil
result_ids = nil
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).entries.collect{|t| t.id}}
if params["category_id"].blank? #has tag no cate
#nothing
@result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
else #has tag and cate
# result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).where(:#{get_category_field_name(ori_class_name)}.in=>params["category_id"]).available_for_lang(I18n.locale).can_display.collect{|t| t.id}}.flatten
result_ids << eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id']).entries.collect{|t| t.id}")
result_ids.flatten!
@result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
@result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
end
result = eval("#{ori_class_name}.where(:id=>result_ids)")
elsif params["category_id"].blank? #no tag no cate
result = eval(@default_widget["query"])
else #no tag has cate
result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])")
@result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
end
date_now = Time.now
result.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :postdate)
eval("@result.#{@default_widget[:sorting_query]}")
end
def search_result
@search = query_for_default_widget.solr_search do
fulltext params[:search_query]
end
search_result = @search.results.collect{|result| result.id}
@items = eval(@ori_class_name).all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result)
end
def default_widget
if !params[:id].blank?
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[:title][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
@search = params["search_query"].blank? ? false : true
if !params[:id].blank? and !params["clicked_field_name"].blank?
clicked_field_name = params["clicked_field_name"].to_sym
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
elsif !params[:id].blank? and params["preview"]
clicked_field_name = :title
@preview_pages = @page_part.module_app.widget_fields_link_method.find_all{|t| t[1].has_key?(:preview)}.collect{|t| t[0]}
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {preview: true,inner: #{params[:inner] || true},clicked_field_name: '#{@preview_pages.first.to_s}'})")
else
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image]
case @page_part
when Page
@fields = @page_part.frontend_field
@frontend_field_names = @page_part.frontend_field_name
@frontend_classes = @page_part.frontend_class
@frontend_sat_to_links = @page_part.frontend_sat_to_link
@data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
@paginate = true
@page_id = @page_part.id
when PagePart
@frontend_field_names = @page_part.widget_field_name
@frontend_classes = @page_part.widget_class
@frontend_sat_to_links = @page_part.widget_sat_to_link
@fields = @page_part.widget_field
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
end
if @paginate
@data = query_for_default_widget.includes(@widget_image_field).page(params[:page_main]).per(@data_limit)
if @paginate || @search
if @search
@data = search_result.page(params[:page_main]).per(@data_limit) rescue []
else #regular listing
@data = query_for_default_widget.includes(@widget_image_field).page(params[:page_main]).per(@data_limit)
end
# @data = query_for_default_widget.limit(@data_limit).includes(@widget_image_field)
else
@data = query_for_default_widget.includes(@widget_image_field).limit(@data_limit)
@ -77,10 +92,10 @@ class DefaultWidgetController< OrbitWidgetController
end
end
def get_category_field_name(ori_class_name)
ori_class_name = ori_class_name.constantize
ori_class_name.fields.each_key do |key|
return key if key.include?('category_id')
def get_category_field_name
@ori_class_name = @ori_class_name.constantize unless @ori_class_name.is_a? Class
@ori_class_name.fields.each_key do |key|
return key.to_s if key.include?('category_id')
end
nil
end

View File

@ -38,6 +38,11 @@ class FrontController < ApplicationController
@ad_images = AdImage.all
end
def show_tag_cloud
module_app = ModuleApp.find(params[:id]) rescue nil
@tags = module_app.sorted_tags_for_cloud
end
private
def menu_level(page, current_page, current, menu)

View File

@ -43,7 +43,7 @@ class MobileController < ApplicationController
def page
@page_title = t('mobile.page')
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15)
@page_contexts = get_sorted_page_from_structure
end
def page_content
@ -57,4 +57,12 @@ class MobileController < ApplicationController
@no_footer = true if request.path =~ /app/
end
def get_sorted_page_from_structure
page_contexts = Item.structure_ordered_items.inject([]){ |pages, page|
pages << page.page_contexts.where(archived: false).limit(1)[0] if page.is_a?(Page) && !page.page_contexts.blank?
pages
}
Kaminari.paginate_array(page_contexts).page(params[:page]).per(15)
end
end

View File

@ -1,11 +1,12 @@
class OrbitBackendController < ApplicationController
include OrbitCoreLib::AppBackendUtility
include OrbitCoreLib::PermissionUtility
include OrbitTag::Tagging
include AdminHelper
include ApplicationHelper
layout 'new_admin'
def setup_vars
@app_title ||= controller_path.split('/')[1].singularize
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
@ -15,6 +16,7 @@ class OrbitBackendController < ApplicationController
private
def force_order_for_visitor
check_backend_openness
setup_vars
set_current_user
end
@ -22,163 +24,15 @@ class OrbitBackendController < ApplicationController
def force_order_for_user
setup_vars
set_current_user
set_current_user
authenticate_user!
check_user_can_use
end
def check_user_can_use
def check_user_can_use
unless check_permission
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
redirect_to root_url
end
end
def get_sorted_and_filtered(object_class, query=nil)
objects = get_objects(object_class, query)
object_class = object_class.classify.constantize
if !params[:sort].blank?
options = params[:sort_options]
options = [options] if !options.class.eql?(Array)
options.each do |option|
if object_class.fields.include?(option)
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
else
(objects = objects.order_by(option, params[:direction])) rescue nil
end
elsif object_class.relations.include?(option)
case object_class.relations[option].macro
when :references_one
a = Array.new
objects.each { |object| a << [get_string_value_from_object(object), object] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
objects = sorted.collect {|x| x[1] }
when :references_many, :references_and_referenced_in_many
objects = get_objects_from_self(object_class, objects, option)
when :referenced_in
objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id")
end
end
end
end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
objects.each do |object|
value.each do |v|
a << object if object[v]
end
end
objects = a.uniq
when 'categories'
a = Array.new
objects.each do |object|
a << object if (value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) rescue nil)
end
objects = a.uniq
when 'tags'
a = Array.new
objects.each do |object|
object.tags.each do |tag|
a << object if value.include?(tag.id.to_s)
end
end
objects = a.uniq
end if value.size > 0
end
end
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
end
def get_string_value_from_object(object)
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
s = object.name unless s rescue nil
s = object.title unless s rescue nil
s.downcase rescue ''
end
def get_objects_from_referenced_objects(object_class, objects, option)
referer_ids = objects.distinct(option)
referenced_objects = object_class.find(referer_ids) rescue nil
if referenced_objects
a = Array.new
referenced_objects.to_a.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_objects_from_self(object_class, objects, option)
referenced_class = object_class.relations[option].class_name.constantize
referenced_objects = referenced_class.all rescue nil
if referenced_objects
reverse_relation = nil
referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) }
a = Array.new
referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] }
a.compact!
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = Array.new
sorted.each {|x| sorted_objects << x[1].send(reverse_relation) }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_with_nil(objects, option, sorted_objects)
tmp = Array.new
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_tmp = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
a.flatten
end
def get_viewable(object_class, query=nil)
objects = get_objects(object_class,query).order_by(:created_at, :desc)
Kaminari.paginate_array(objects).page(params[:page]).per(10)
end
def get_objects(object_class, query=nil)
object_class = object_class.classify.constantize
# debugger
# a=1
if query
objects = object_class.where(query)
else
objects = object_class.all
end
objects
end
def filter_authorized_objects(objects)
if(!is_admin? || !is_manager?)
objects.delete_if{ |object|
if object.is_pending == true
if check_permission(:manager)
object.create_user_id != current_user.id
else
!object.send("#{object.class.to_s.underscore}_category").authed_users('fact_check').include?(current_user) rescue false
end
else
false
end
}
end
objects
end
end
end

View File

@ -7,4 +7,10 @@ class OrbitFrontendComponentController< ApplicationController
@app_title = request.fullpath.split('/')[2]
end
def delay_impressionist(item)
user_id = current_user.nil? ? nil : current_user.id
Resque.enqueue(DelayedImpressionist,:request=>DelayImpressionistRequest.new(request),:obj=>item,:class=>item.class.to_s,:controller_name=>controller_name,:action_name=>action_name,:user=>user_id)
end
end

View File

@ -1,4 +1,9 @@
class OrbitWidgetController< OrbitFrontendComponentController
include FrontEndArrayParamsHelper
before_filter {get_tags_and_cates(params)}
def get_tags_and_cates(params)
params = tags_and_cates(params)
end
end

View File

@ -1,27 +1,39 @@
class PagesController < ApplicationController
include ApplicationHelper
before_filter :get_item, :only => [:index_from_link, :show_from_link]
before_filter :check_frontend_open, :only => [:index,:show]
# caches_page :index
def check_frontend_open
if Me.frontend_closed and current_user.nil? #Need to be change
redirect_to '/admin/dashboards'
end
end
def index
@item = Page.find_by_name('home')
if @item
impressionist(@item)
delayed_impressionist(@item)
render_page
else
render :text => t(:need_home)
redirect_to '/admin/dashboards',:notice=>t(:need_home)
# render :text => t(:need_home)
end
end
def show
def show
#begin
@item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
impressionist(@item)
delayed_impressionist(@item)
case @item.class.to_s
when 'Page'
render_page unless save_from_no_lang_for_page
if params[:clicked_field_name]
render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page
else
render_page(params) unless save_from_no_lang_for_page
end
when 'Link'
redirect_to(@item[:url]) unless save_from_no_lang_for_page
end
@ -32,13 +44,13 @@ class PagesController < ApplicationController
# render :file => "#{Rails.root}/public/404.html", :status => :not_found
#end
end
def index_from_link
url = "/#{@item.path}"
options = ''
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id', params[:category_id])}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id', params[:tag_id])}" unless params[:tag_id].blank?
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
uri = URI::escape(url + options)
@ -50,10 +62,11 @@ class PagesController < ApplicationController
url = "/#{@item.path}"
options = ''
options << "#{options.blank? ? '?' : '&'}id=#{params[:id]}" unless params[:id].blank?
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id', params[:category_id])}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id', params[:tag_id])}" unless params[:tag_id].blank?
options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank?
options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank?
options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank?
redirect_to(url + options) unless save_from_no_lang_for_page
end
@ -69,23 +82,43 @@ class PagesController < ApplicationController
elsif params[:same_page_id]
@item = Item.find(params[:same_page_id])
else
category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
category_ids = Array(params[:category_id]) unless params[:category_id].nil?
tag_ids = Array(params[:tag_id]) unless params[:tag_id].nil?
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
default_query = { is_published: true, module_app_id: module_app.id, :app_frontend_url.in => [params[:app_action], 'default_widget'] }
specific_categories = { :category => category_ids }
in_categories = { :category.in => category_ids }
nil_categories = { :category.in => [nil, []] }
specific_tags = { :tag => tag_ids }
in_tags = { :tag.in => tag_ids }
nil_tags = { :tag.in => [nil, []] }
if !category_ids.blank? && !tag_ids.blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => tag_ids})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => [nil, []]}) unless @item
@item = Item.where(default_query.merge(specific_categories).merge(specific_tags)).first
@item = Item.where(default_query.merge(specific_categories).merge(in_tags)).first unless @item
@item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first unless @item
@item = Item.where(default_query.merge(specific_tags).merge(in_categories)).first unless @item
@item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first unless @item
@item = Item.where(default_query.merge(in_categories).merge(in_tags)).first unless @item
@item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
@item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
elsif !category_ids.blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :category.in => category_ids).any_in(tag: [nil, []]).first
@item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first
@item = Item.where(default_query.merge(specific_categories)).first unless @item
@item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
@item = Item.where(default_query.merge(in_categories)).first unless @item
elsif !tag_ids.blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
@item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first
@item = Item.where(default_query.merge(specific_tags)).first unless @item
@item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
@item = Item.where(default_query.merge(in_tags)).first unless @item
end
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
@item = Item.where(default_query.merge(nil_categories).merge(nil_tags)).first unless @item
@item = Item.where(default_query).first unless @item
end
raise PageError,'Missing Frontend Page' if @item.nil?
raise PageError, 'Missing Frontend Page' if @item.nil?
end
def save_from_no_lang_for_page

View File

@ -0,0 +1,58 @@
module Admin::FrontendWidgetInterface
protected
def get_categories_and_tags
unless @selected[:module_app].nil?
@categories = @selected[:module_app].get_categories
@tags = @selected[:module_app].tags
end
end
def get_frontend_data_count
local_item = set_local_item
@page_frontend_data_counts = @selected[:module_app].get_registration.get_data_count rescue []
@selected[:page_frontend_data_count] = case local_item
when PagePart
local_item.widget_data_count
when Page
local_item.frontend_data_count
end
end
def clean_tags_and_category_params
field_name = set_field_name
if self.class==Admin::PagePartsController and params[field_name][:module_app].blank?
params[field_name][:module_app] = nil
end
if params[field_name][:tag].nil? || params[field_name][:tag].include?("nil")
params[field_name][:tag] = []
end
if params[field_name][:category].nil? || params[field_name][:category].include?("nil")
params[field_name][:category] = []
end
end #of clean_tags_and_category_params
def set_local_item
local_item = @part
local_item = @item if local_item.nil? && @item
local_item
end
def set_field_name
case self.class.to_s
when "Admin::PagesController"
return "page"
when "Admin::PagePartsController"
return "page_part"
end # of case
end
def select_array_for_app_frontend_urls(hash)
ary = hash.collect{|name,data| [I18n.t(data["i18n"]),name]}
ary << [I18n.t('default_widget.name'),'default_widget'] if @selected[:module_app] and @selected[:module_app].has_default_widget?
ary
end
end

View File

@ -1,7 +1,8 @@
module Admin::PagePartsHelper
include Admin::FrontendWidgetInterface
def support_link
url_method = @module_app.get_default_widget[:url_method]
url_method = @selected[:module_app].get_default_widget[:url_method]
unless url_method.nil?
res = "Link:"
res << select_tag( "page_part[widget_field_is_link][]", options_for_select([["NotLink",false],["Link1",url_method]]))
@ -9,10 +10,8 @@ module Admin::PagePartsHelper
end
end
def get_widget_field_rel(local_item=nil)
local_item = @part if local_item.nil? && @part
local_item = @item if local_item.nil? && @item
case local_item
def get_widget_field_rel
case set_local_item
when Page
reload_after_list_changed_admin_pages_path
when PagePart
@ -34,8 +33,7 @@ module Admin::PagePartsHelper
unless field_is_checked.nil? and assign_field_name_value.nil?
origin_field = nil
origin_field = @module_app.widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first
origin_field = @selected[:module_app].widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first
if origin_field and origin_field[2]==:link #choosen_field_is_link
@ -51,11 +49,10 @@ module Admin::PagePartsHelper
end
def widget_field_options(i,local_item=nil)
local_item = @part if local_item.nil? && @part
local_item = @item if local_item.nil? && @item
local_item = set_local_item
options = @module_app.widget_fields.collect do |widget_field|
label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}")
options = @selected[:module_app].widget_fields.collect do |widget_field|
label = I18n.t("#{@selected[:module_app].key}.default_widget.#{widget_field[0]}")
[label, widget_field[0]]
end
case local_item
@ -66,11 +63,9 @@ module Admin::PagePartsHelper
end
end
def widget_fiield_class_options(i,local_item=nil)
def widget_field_class_options(i,local_item=nil)
options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
local_item = @part if local_item.nil? && @part
local_item = @item if local_item.nil? && @item
local_item = set_local_item
case local_item
when Page
options_for_select(options, (local_item.frontend_class[i] if (local_item) ))
@ -115,12 +110,8 @@ module Admin::PagePartsHelper
end
def nil_checkbox_button(part,tag_or_cate)
field_name = case part
when PagePart
'page_part'
when Page
'page'
end
field_name = set_field_name
content_tag :label,:class=>"radio inline" do
op = check_box_tag("#{field_name}[#{tag_or_cate}][]", 'nil' , eval("#{tag_or_cate}_checked_value(part,'')"),:class=>'select_all')
op << I18n.t("default_widget.no_value")
@ -128,12 +119,8 @@ module Admin::PagePartsHelper
end
def nil_radio_button(part,tag_or_cate)
field_name = case part
when PagePart
'page_part'
when Page
'page'
end
field_name = set_field_name
content_tag :label,:class=>"radio inline" do
op = radio_button(field_name, tag_or_cate, '' , :checked => eval("#{tag_or_cate}_checked_value(part,'')"))
op << I18n.t("default_widget.no_value")
@ -141,7 +128,7 @@ module Admin::PagePartsHelper
end
def show_default_widget_setting_panel
@module_app && @module_app.has_default_widget? && (!@user_choose.nil? && @user_choose== 'default_widget') #&& @part.widget_path == 'default_widget'
@selected[:module_app] && @selected[:module_app].has_default_widget? && (@selected[:app_frontend_url]== 'default_widget')
end
def show_custom_widget_setting_panel

View File

@ -1,9 +1,21 @@
module ApplicationHelper
include OrbitApp::Module::VisitorCounter
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
def current_path(param_hash)
request.referer.include?('?') ? [request.referer,param_hash.to_param].join('&') : [request.referer,param_hash.to_param].join('?')
end
def delayed_impressionist(item)
user_id = current_user.nil? ? nil : current_user.id
Resque.enqueue(DelayedImpressionist,:request=>DelayImpressionistRequest.new(request),:obj=>item,:class=>item.class.to_s,:controller_name=>controller_name,:action_name=>action_name,:user=>user_id)
end
def check_user_role_enable(attribute_fields)
@user.attribute_values.collect{|t| attribute_fields.include?(t.attribute_field) }.include?(true) rescue false
end
def show_attribute_value(value)
if value.kind_of? Hash
result = []
@ -18,7 +30,7 @@ module ApplicationHelper
u = nil
User.without_callback(:create, :before, :initialize_desktop) do
u = User.create(:name => "guest", :email => "guest_#{Time.now.to_i}#{rand(99)}@example.com")
end
end
u.admin = false
u.save(:validate => false)
u
@ -46,24 +58,24 @@ module ApplicationHelper
def flash_messages
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
formatted_messages = messages.map do |type|
formatted_messages = messages.map do |type|
content_tag :div, :class => type.to_s do
message_for_item(flash[type], flash["#{type}_item".to_sym])
end
end
raw(formatted_messages.join)
end
def link_back(custom_class=nil)
case custom_class
when nil
link_to t('back'), get_go_back, :class => 'nav'
link_to t('back'), get_go_back, :class => 'nav'
else
link_to t('back'), get_go_back, :class => custom_class
link_to t('back'), get_go_back, :class => custom_class
end
end
# Clean the link back
def get_go_back
begin
@ -104,28 +116,28 @@ module ApplicationHelper
message % item
end
end
def add_attribute(partial, f, attribute)
new_object = f.object.send(attribute).build
fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
render :partial => partial, :object => new_object, :locals => {:f => f}
end
end
def active_for_ob_auths_object(object_class,field = :object_auth_id)
unless active_for_action("object_auths_new_interface","setting").nil?
ob_auth = ObjectAuth.find params[field]
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
end
end
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
unless active_for_action("module_apps_new_interface","setting").nil?
oa_auth = ObjectAuth.find params[field]
oa_auth.title == ob_auth_title ? 'active' : nil
end
end
def active_for_app_auth(app_title ='', opt={:controller_name => 'module_apps_new_interface',:action_name=>'setting',:field => :module_app_id})
unless active_for_action(opt[:controller_name],opt[:action_name]).nil?
app = ModuleApp.find params[opt[:field]]
@ -134,7 +146,7 @@ module ApplicationHelper
nil
end
end
def active_for_controllers(*controller_names)
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
end
@ -142,11 +154,11 @@ module ApplicationHelper
def visible_for_controllers(*controller_names)
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
end
def active_for_action(controller_name, action_name)
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end
def page_metas(page)
tmp_meta = {}
metas = ''
@ -175,11 +187,11 @@ module ApplicationHelper
res << page_title
end
res << "</title>\n"
end
end
def page_stylesheets(page, edit=nil)
stylesheets = ''
unless edit
unless edit
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/icons.css' rel='stylesheet' type='text/css' />\n"
@ -188,9 +200,9 @@ module ApplicationHelper
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/font-awesome.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/orbit-bar.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
@ -224,32 +236,34 @@ module ApplicationHelper
end
def at_least_module_manager
is_manager? || is_admin?
is_manager? || is_admin?
end
def dislpay_view_count(object)
"#{t(:view_count)}: #{object.view_count}"
end
def display_visitors(options={})
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
end
# def display_visitors(options={})
# # Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
# impressions = Impression.where(options).and(:referrer.ne => nil)
# impressions.map{|i| i[:session_hash]}.uniq.count
# end
def display_visitors_today
display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
end
# def display_visitors_today
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
# end
def display_visitors_this_week
display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
end
# def display_visitors_this_week
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
# end
def display_visitors_this_month
display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
end
# def display_visitors_this_month
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
# end
def display_visitors_this_year
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
end
# def display_visitors_this_year
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
# end
def display_date_time(object)
object.strftime("%Y-%m-%d %H:%M")
@ -292,4 +306,16 @@ module ApplicationHelper
"http://#{request.host}:2#{site_number}00"
end
def sortable(column, title = nil, options = {})
options[:remote] ||= true
title ||= column.titleize
css_class = column.to_s == params[:sort] ? "current #{params[:direction]}" : 'asc'
direction = column.to_s == params[:sort] && params[:direction] == 'asc' ? 'desc' : 'asc'
link_to title, params.merge({direction: direction, sort: column, sort_options: column}), {:class => "#{css_class} sortable", :remote => options[:remote]}
end
def convert_array_param(key, array)
Array(array).collect{|t| "#{key}[]=#{t}"}.join("&")
end
end

View File

@ -3,10 +3,19 @@ module DefaultWidgetHelper
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
end
def get_top_hot_class(row_data)
class_attr = []
class_attr << 'data_is_hot' if( row_data.is_hot? rescue false )
class_attr << 'data_is_top' if( row_data.is_top? rescue false)
return class_attr.join(" ")
end
def link_to_field(row_data,field, switch, options=nil)
method_ary = @page_part.module_app.widget_fields_link_method
field = field.to_sym
if(method_ary.has_key?(field) and (switch == true))
options = options || {}
options[:clicked_field_name] = field
if(method_ary.has_key?(field) and (switch.to_s == "true"))
url = case method_ary[field][:args]
when nil # no args
get_data_link(method_ary[field][:method], options)
@ -75,4 +84,13 @@ module DefaultWidgetHelper
content_tag(:span,get_display(row_data,field_setting),:class=>field_setting[:class])
end
end
def get_row_category(row_data)
row_data.send("#{row_data.class.to_s.underscore}_category_id") rescue nil
end
def get_row_tags(row_data)
row_data.tagged_ids rescue nil
end
end

View File

@ -0,0 +1,5 @@
module MemberHelper
def nl2br(val)
val.gsub(/\r\n/, '<br />').html_safe
end
end

View File

@ -8,7 +8,7 @@ module OrbitFormHelper
options[:icon_date] ||= 'icons-calendar'
options[:icon_clear] ||= 'icons-cross-3'
options[:input_class] ||= 'input-large'
options[:value] ||= options[:object][method] if options[:object] && options[:object][method]
options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method]
case options[:picker_type]
when 'date'
content_tag :div, :id => options[:id], :class => options[:class] do
@ -22,7 +22,7 @@ module OrbitFormHelper
options[:label] ||= I18n.t('datetime_picker.separated.label')
content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do
concat label_tag options[:label] unless options[:no_label]
concat hidden_field(object_name, method)
concat hidden_field(object_name, method, :value => options[:value])
concat separated_picker(object_name, method, options)
end
else

View File

@ -2,12 +2,24 @@ class BackupServer
@queue = :high
def self.perform()
#CronMail.time_check("Going to backup Orbit").deliver
dbhost = Mongoid.config.database.connection.primary.join ':'
dbname = Mongoid.config.database.name
archive_db_list_path = OrbitSystemPreference::ArchiveDbListPath
dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M")
%x[mongodump -h #{dbhost} -d #{dbname} -o #{dbdirectory} ]
# %x[touch #{Rails.root}/tmp/restart]
Dir.foreach('tmp') do |item|
date_str = item.to_s.gsub("#{dbname}-",'')
next if not date_str.match(/\d{4}-\d{2}-\d{2}-\d{2}-\d{2}/)
if Date.parse(date_str).to_time < Site.first.backup_keep_for_days.days.ago
OrbitLogger.info "Deleting #{date_str}"
%x[rm -rf tmp/#{item}]
end
end
%x[rm -f #{archive_db_list_path}]
%x[cd tmp ; ls -l |grep #{dbname} | awk '{print $8}'|xargs du -h --block-size=1M --max-depth=0 |sort -h >> #{archive_db_list_path}]
OrbitLogger.info "DB backup done Path:#{dbdirectory}"
end
end

View File

@ -0,0 +1,21 @@
class DashboardCounter < Resque::Plugins::RestrictionJob
extend OrbitApp::Module::VisitorCounterEval
@queue = :high
def self.perform(*args)
site = Site.first
obj = new(*args)
site.visitor_counters[:total] = display_visitors
site.visitor_counters[:today] = display_visitors_today
site.visitor_counters[:this_week] = display_visitors_this_week
site.visitor_counters[:this_month] = display_visitors_this_month
site.visitor_counters[:this_year] = display_visitors_this_year
site.save
OrbitLogger.info "DashboardCounter done #{site.visitor_counters.to_s}"
#Notice this is mainly used at user dashbroad. however the code there is currentlly using realtime evaluation.
#and the site model will need a field call dashboard_counter to complete this job.
end
end

View File

@ -0,0 +1,51 @@
class DelayedImpressionist
def self.before_filter(*args)
return
end
include ImpressionistController::InstanceMethods
@queue = :low
def initialize(request,controller_name,action_name,user,obj)
@controller_name = controller_name
@action_name = action_name
@user = User.find user unless user.nil?
@request = request
end
def self.perform(*args)
arg = args[0]
@request= DelayImpressionistRequest.new
@request.restore(arg["request"])
obj = eval("#{arg["class"]}.find '#{arg['obj']['_id']}'")
# imp = new(@request,arg["controller_name"],arg["action_name"],arg["user"],obj)
new_impression = obj.impressions.build(:user_id=>arg["user"],:controller_name=>arg["controller_name"],:action_name=>arg["action_name"],:ip_address=>@request.remote_ip,:referrer=>@request.referer)
@try = 1
loop do
result = new_impression.save rescue false
break if (result || @try >= 10)
@try = @try + 1
puts "trying:#{@try}"
end
new_impression.save
obj.update_attribute(:view_count,obj.impression_count)
end
private
def user
@user
end
def action_name
@action_name
end
def controller_name
@controller_name
end
def request
@request
end
end

42
app/jobs/email_cron.rb Normal file
View File

@ -0,0 +1,42 @@
class EmailCron
@queue = :mail
def self.perform
@datas = MailCron.where(:mail_sentdate.lte => Time.now)
@datas.each do |mail_data|
@mail_j = 0
@read_mails = Array.new
@mails = mail_data.mail_to.split(",")
@mails.each do |send_mail|
@read_mails << send_mail
@mail_j += 1
if 0 == @mail_j % 30
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
@read_mails = Array.new
sleep 10
end
end
if !@read_mails.join(',').blank?
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
@read_mails = Array.new
sleep 10
end
end
end
end

View File

@ -0,0 +1,46 @@
class GenerateSystemSummary
@queue = :high
def self.perform()
@site = Site.first
get_disk_free
get_git_log_list
get_package_info
@site.save
end
def self.get_package_info
@info = {}
get_nginx_version
get_MongoDB_version
get_Linux_version
@site.system_package_info = @info
end
def self.get_git_log_list
git_commit_list_path = OrbitSystemPreference::GitCommitListPath
%x[rm #{git_commit_list_path}]
%x[cd #{Rails.root};#{OrbitSystemPreference::GitLogCommend} >>#{git_commit_list_path} ]
end
def self.get_disk_free
@site.disk_space= %x[#{OrbitSystemPreference::DiskFree}]
end
def self.get_nginx_version
@info[:nginx] = %x[#{OrbitSystemPreference::SystemPackage::NginxVersion} ]
end
def self.get_MongoDB_version
@info[:mongodb] = %x[#{OrbitSystemPreference::SystemPackage::MongodbVersion} ]
end
def self.get_Linux_version
@info[:linux] = %x[#{OrbitSystemPreference::SystemPackage::SystemVersion} ]
end
def self.check_system_has_enough_space( limit =OrbitSystemPreference::DefaultDiskSpaceLimit )
binding.pry
end
end

View File

@ -1,21 +0,0 @@
class NccuCalendar
require 'open-uri'
require 'tempfile'
@queue = :high
def self.perform()
# temp_file = Tempfile.new('new_cal')
# open('http://events.nccu.edu.tw/Month').read{|data|
# temp_file << data
# }
open(File.join(Rails.root, 'public/static', 'nccu_calendar.xml'), 'wb') do |fo|
fo.print open('http://events.nccu.edu.tw/Month').read
end
# FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]NccuCalendar Synced #{File.join(Rails.root, 'public/static', 'nccu_calendar.xml')}"
end
end

View File

@ -0,0 +1,8 @@
class RestartServer
@queue = :high
def self.perform()
temp_directory = "#{Rails.root}/tmp/"
%x[touch #{temp_directory}restart.txt ]
end
end

View File

@ -0,0 +1,10 @@
class SendAskNoticeMail
@queue = :mail
def self.perform(ask_admin_id, ask_question_id)
ask_admin = AskAdmin.find(ask_admin_id)
ask_question = AskQuestion.find(ask_question_id)
AskMailer.notice(ask_admin, ask_question).deliver
end
end

View File

@ -0,0 +1,9 @@
class SendAskReplyMail
@queue = :mail
def self.perform(ask_question_id)
ask_question = AskQuestion.find(ask_question_id)
AskMailer.reply(ask_question).deliver
end
end

View File

@ -1,25 +0,0 @@
class SyncDb
@queue = :high
def self.perform()
puts "[ #{DateTime.now.strftime("%Y %D %H:%M") }]\t SyncDb Starting"
self.start_sync
self.set_admin
end
def self.start_sync
task = 'mid_site:sync'
args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
User.all.each{|ur| ur.create_dept_cache}
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tSyncDb Synced"
end
def self.set_admin
task = 'mid_site:install_admin'
args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tAdmin done"
end
end

View File

@ -3,7 +3,8 @@ class UpdateTagCloud
def self.perform()
Tag.all.each do |tag|
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
tag.update_attribute(:cloud_view_count, tag.get_impressionist)
end
OrbitLogger.info "UpdateTagCloud Done"
end
end

View File

@ -0,0 +1,8 @@
class UserActionRecoder
@queue = :low
def self.perform(user,params)
UserAction.create!(:user=>user,:params=>params,:page=>"#{params['controller']}##{params['action']}")
true
end
end

View File

@ -0,0 +1,81 @@
class MailCronMailer < ActionMailer::Base
default :from => "orbit_test@rulingcom.com"
def get_settings
@site = Site.first
@smtp_settings = {
:address => @site['site_settings']['address'],
:port => @site['site_settings']['port'],
:domain => @site['site_settings']['domain'],
:authentication => @site['site_settings']['authentication'],
# :user_name => @site['site_settings']['user_name'],
# :password => @site['site_settings']['password'],
:tls => (@site['site_settings']['tls'] == '0' ? false : true ) ,
:enable_starttls_auto => (@site['site_settings']['enable_starttls_auto'] == '0' ? false : true )
}
if !@site['site_settings']['user_name'].blank?
@smtp_settings[:user_name] = @site['site_settings']['user_name']
end
if !@site['site_settings']['password'].blank?
@smtp_settings[:password] = @site['site_settings']['password']
end
ActionMailer::Base.smtp_settings = @smtp_settings
end
def cron_mail( data_id, group_mail )
get_settings
@data = MailCron.find(data_id)
if @data
@user = User.find(@data.create_user_id)
if !@data.mail_cron_files.blank?
@data.mail_cron_files.each_with_index do |mail_cron_file, i|
file_type = File.extname(mail_cron_file.file.to_s)
file_content = Mongo::GridFileSystem.new(Mongoid.database).open(mail_cron_file.file.url.gsub("/gridfs/", "").force_encoding("UTF-8"), 'r')
attachments["#{mail_cron_file.title}#{file_type}"] = file_content.read
end
end
if !@data.mail_content["text"].blank?
mail( :from => @data.mail_from, :reply_to => @data.mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format|
format.html { render :text => @data.mail_content["text"] }
end
elsif !@data.mail_content["template"].blank?
mail( :from => @data.mail_from, :reply_to => @data.mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format|
format.html { render :template => @data.mail_content["template"], :collection => @data.mail_content }
end
end
@mail_cron_log = {
:mail_subject => @data.mail_subject,
:mail_to => group_mail,
:mail_user => @user.name,
:mailer_count => group_mail.split(",").size,
:mail_from_app => @data.mail_from_app
}
@mail_cron_log = MailCronLog.new(@mail_cron_log)
@mail_cron_log.save
@data.destroy
end
end
end

View File

@ -2,6 +2,8 @@ class Asset
include Mongoid::Document
include Mongoid::Timestamps
include OrbitTag::Taggable
taggable
mount_uploader :data, FileAssetUploader
@ -16,18 +18,14 @@ class Asset
belongs_to :asset_category
belongs_to :assetable, polymorphic: true
has_and_belongs_to_many :tags, :class_name => "AssetTag"
# has_and_belongs_to_many :tags, :class_name => "AssetTag"
before_save :clean_tags
def sorted_tags
tags.order_by(I18n.locale, :asc)
end
protected
def clean_tags
self.tag_ids.delete('')
self.tagged_ids.delete('')
end
end

View File

@ -17,7 +17,7 @@ class Item
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
# validates :name, :exclusion => { :in => LIST[:forbidden_item_names] }
validates_uniqueness_of :name, :scope => :parent_id
validates_uniqueness_of :name #, :scope => :parent_id
validates_presence_of :name
validates_associated :parent, :children
@ -26,7 +26,7 @@ class Item
after_save :rebuild_children_path, :if => "path_changed?"
def enabled_for_lang(lang)
enabled_for.include?(lang)
enabled_for.include?(lang) rescue false
end
def self.find_by_name(item_name)
@ -64,6 +64,10 @@ class Item
true
end
end
def self.structure_ordered_items
self.get_children(Item.root, [])
end
protected
@ -87,5 +91,13 @@ class Item
def validates_presence_of_parent_id?
true
end
def self.get_children(item, tree)
tree << item
item.children.each do |child|
self.get_children(child, tree)
end
tree
end
end

70
app/models/mail_cron.rb Normal file
View File

@ -0,0 +1,70 @@
class MailCron
include Mongoid::Document
include Mongoid::Timestamps
field :mail_from_app
field :mail_from
field :mail_to
field :mail_reply_to
field :mail_subject
field :mail_content, :type => Hash
field :mail_sentdate , :type => DateTime
field :create_user_id
field :update_user_id
has_many :mail_cron_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :mail_cron_files, :allow_destroy => true
after_save :save_mail_cron_files
def save_mail_cron_files
self.mail_cron_files.each do |t|
if t.should_destroy
t.destroy
end
end
end
def self.send_mail_now(mail_cron_id)
mail_data = MailCron.find(mail_cron_id)
if !mail_data.blank?
@mail_j = 0
@read_mails = Array.new
@mails = mail_data.mail_to.split(",")
@mails.each do |send_mail|
@read_mails << send_mail
@mail_j += 1
if 0 == @mail_j % 30
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
@read_mails = Array.new
sleep 10
end
end
if !@read_mails.join(',').blank?
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
@read_mails = Array.new
sleep 10
end
end
end
end

View File

@ -0,0 +1,13 @@
class MailCronFile
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
field :should_destroy, :type => Boolean
field :title
belongs_to :mail_cron
end

View File

@ -0,0 +1,14 @@
class MailCronLog
include Mongoid::Document
include Mongoid::Timestamps
field :mail_subject
field :mail_to
field :mail_user
field :mailer_count
field :mail_from_app
end

View File

@ -8,6 +8,8 @@ class ModuleApp
field :title
field :sidebar_order,type: Integer,default: 0
has_many :tags, as: :module_tag, dependent: :destroy
def refetch_setting!(reg)
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
# self[field.to_sym] = reg.send field
@ -17,13 +19,20 @@ class ModuleApp
self[:get_widget_style] = reg.get_widgets
self[:using_default_widget] = !reg.get_default_widget.blank?
self[:widgets] = reg.get_widgets
self[:has_tag] = reg.get_has_tags
end
# def app_pages
# get_registration.get_app_pages
# end
# scope :for_frontend_select,
scope :standard_sorting ,order_by(:title, :asc)
def self.for_widget_select
where(:key.in=>OrbitApp::Module::WidgetUtility.all.keys).order_by(:title, :asc)
end
def self.for_frontend_select
where(:key.in => OrbitApp::Module::FrontendUtility.all.keys).excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
end
def enable_frontend?
self[:enable_frontend]
@ -112,10 +121,6 @@ class ModuleApp
has_one :app_auth,dependent: :delete
def get_tags
get_registration.get_tags
end
def get_categories
get_registration.get_categories
end
@ -127,5 +132,31 @@ class ModuleApp
def get_registration
OrbitApp::Module::Registration.find_by_key(key)
end
def self.find_by_key(key)
self.where(key: key)[0] rescue nil
end
def sorted_tags_for_cloud
temp_tags = {}
self.tags.each{ |tag|
temp_tags.merge!({tag => tag.cloud_view_count})
}
if !temp_tags.blank?
sorted_tags = temp_tags.sort{|a,b| a[1]<=>b[1]}.reverse
sorted_tags[0][1] = :hot1
offset = (sorted_tags.size - 1) / 3
i = 1
class_i = 2
sorted_tags[1..-1].collect!{ |x|
x[1] = "hot#{class_i}"
i == offset ? i = 1 : i += 1 if class_i < 4
class_i += 1 if i == offset && class_i < 4
}
sorted_tags
else
[]
end
end
end

View File

@ -0,0 +1,34 @@
module Mongoid
module Sortable
extend ActiveSupport::Concern
included do
field :sort_number, type: Integer
after_initialize :set_sort_number
end
module ClassMethods
def default_sort(sorted = true)
if !sorted
asc(:sort_number)
else
asc
end
end
end
private
def set_sort_number
if self.new? && self.sort_number.nil?
last_record = self.class.desc(:sort_number).first
if last_record && last_record.sort_number
self.sort_number = (last_record.sort_number + 10) / 10 * 10
else
self.sort_number = 10
end
end
end
end
end

View File

@ -3,11 +3,11 @@ class Page < Item
include Impressionist::Impressionable
include ParserFrontEnd
is_impressionable :counter_cache => { :column_name => :view_count }
is_impressionable #:counter_cache => { :column_name => :view_count }
field :content, localize: true
field :app_frontend_url
field :theme_id, :type => BSON::ObjectId, :default => nil
# field :theme_id, :type => BSON::ObjectId, :default => nil
field :category,type: Array, :default => []
field :tag, type: Array,:default => []
field :view_count, :type => Integer, :default => 0
@ -21,7 +21,8 @@ class Page < Item
field :frontend_sat_to_link , :type => Array,:default => []
field :frontend_data_count
belongs_to :theme
belongs_to :design
belongs_to :module_app
has_many :page_parts, :dependent => :destroy

View File

@ -51,8 +51,9 @@ class PrototypeAuth
end
def remove_operation(item,obj)
if (self.send item).include? obj
(self.send item).delete obj
item = (item.to_s.singularize == item.to_s) ? "#{item.to_s}_id" : "#{item.to_s.singularize}_ids"
if (self.send item).include? obj.id
(self.send item).delete obj.id
self.save!
else
false #should put error message for user not existed in list

View File

@ -11,20 +11,29 @@ class Site
field :roaming_id
field :private_key, :type => Binary
field :public_key, :type => Binary
field :frontend_closed, :type => Boolean, :default => false
field :backend_openness_on, :type => Boolean, :default => false
field :title_always_on, :type => Boolean, :default => false
field :dashbroad_allow_visitor, :type => Boolean, :default => false
field :mail_settings, :type => Hash
field :visitor_counters,:type=> Hash,:default=>{:total=>0,:today=>0,:this_week=>0,:this_month=>0,:this_year=>0}
field :disk_space, :type => String
field :system_package_info, :type => Hash,:default=>{}
field :school
field :department
mount_uploader :default_image, ImageUploader
field :search,:type => Hash
field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit']
field :title, localize: true
field :footer, localize: true
field :sub_menu, localize: true
field :backup_keep_for_days,:type=>Integer,:default=> APP_CONFIG['backup_keep_for_days']
field :mobile_on, :type => Boolean, :default => false

View File

@ -1,4 +1,3 @@
class SubRoleTag < ProtoTag
has_and_belongs_to_many :sub_roles
end

View File

@ -8,35 +8,14 @@ class Tag
include Mongoid::Timestamps
include Impressionist::Impressionable
is_impressionable :counter_cache => { :column_name => :view_count }
is_impressionable #:counter_cache => { :column_name => :view_count }
field :key
field :name, localize: true
field :view_count, :type => Integer, :default => 0
field :cloud_view_count, :type => Integer, :default => 0
#field :cloud_amper,:type: Integer,:default=> 0
def self.sorted_for_cloud
tags = {}
self.all.each{ |tag|
tags.merge!({tag => self.get_impressionist(tag)})
}
if !tags.blank?
sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
sorted_tags[0][1] = :hot1
offset = (sorted_tags.size - 1) / 3
i = 1
class_i = 2
sorted_tags[1..-1].collect!{ |x|
x[1] = "hot#{class_i}"
i == offset ? i = 1 : i += 1 if class_i < 4
class_i += 1 if i == offset && class_i < 4
}
sorted_tags
else
[]
end
end
belongs_to :module_tag, polymorphic: true
has_many :taggings, dependent: :destroy
protected

17
app/models/tagging.rb Normal file
View File

@ -0,0 +1,17 @@
class Tagging
include Mongoid::Document
include Mongoid::Timestamps
field :to_destroy, default: false
belongs_to :tag
belongs_to :taggable, polymorphic: true
before_destroy :update_taggable_tag_ids
private
def update_taggable_tag_ids
self.taggable.remove_id(self.tag.id)
end
end

View File

@ -11,9 +11,14 @@ class Role < Attribute
has_many :sub_roles, :autosave => true, :dependent => :destroy
has_many :users
has_many :statuses, :autosave => true, :dependent => :destroy
# has_many :statuses, :autosave => true, :dependent => :destroy
# has_many :attribute_fields, :autosave => true, :dependent => :destroy
has_many :role_statuses, :autosave => true, :dependent => :destroy
has_many :role_categorys, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :sub_roles, :allow_destroy => true
accepts_nested_attributes_for :role_statuses, :allow_destroy => true
accepts_nested_attributes_for :role_categorys, :allow_destroy => true
def is_built_in?
self.built_in

View File

@ -0,0 +1,14 @@
class RoleCategory < RoleFilter
has_and_belongs_to_many :users
belongs_to :role
def self.get_role_data(role_key)
@role = Role.where(:key =>role_key).first
return @role.id
end
end

View File

@ -0,0 +1,26 @@
class RoleFilter
include Mongoid::Document
include Mongoid::Timestamps
# include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
field :key
field :title, localize: true
# belongs_to :role
def pp_object
title
end
def self.from_id(id)
RoleFilter.find(id) rescue nil
end
def self.is_localized?(field_name)
self.fields[field_name.to_s].localized?
end
end

View File

@ -0,0 +1,16 @@
class RoleStatus < RoleFilter
has_and_belongs_to_many :users
belongs_to :role
scope :can_display,where(disable: false)
def self.get_role_data(role_key)
@role = Role.where(:key =>role_key).first
return @role.id
end
end

View File

@ -3,13 +3,19 @@ class User
include Mongoid::Document
include Mongoid::Timestamps
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable #, :timeoutable
mount_uploader :avatar, AvatarUploader
field :admin, :type => Boolean, :default => true
field :active_role
field :user_id
field :sid
field :first_name, localize: true
field :last_name, localize: true
field :email
field :sex, :default => 'unknown'
field :office_tel
field :cache_dept,type: Hash
field :status_record,type: Hash
@ -25,17 +31,23 @@ class User
# has_many :papers, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :sub_role_tags
has_and_belongs_to_many :statuses
has_many :user_actions, :dependent => :destroy
# has_and_belongs_to_many :statuses
has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
has_and_belongs_to_many :role_statuses
has_and_belongs_to_many :role_categorys
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
before_create :initialize_desktop
before_save :rebuild_status_record
before_save :save_roles
scope :remote_account, where(:nccu_id.ne => nil)
scope :not_guest_user, all_of(:name.ne => "guest")
validates :user_id,
:presence => { :message => I18n.t("users.user_id_not_null") } ,
:length => {:minimum => 3, :maximum => 50, :message => I18n.t("users.user_id_length") }
# validates_uniqueness_of :email,:message=> I18n.t("devise.registrations.email_not_unique")
# def new_attribute_values=(vars)
@ -76,9 +88,9 @@ class User
var[:id].each do |id,val|
# binding.pry if id == '5052c5b22b5c49ab02000004'
if (val=="true")
self.roles = self.roles.reject{|t| t.id.to_s==id}
self.role_ids.reject!{|t| t.to_s == id}
elsif(val=="false")
self.roles << Role.find(id)
self.role_ids += Array(id)
end
end
end
@ -93,14 +105,32 @@ class User
# binding.pry if id == '5052c5b22b5c49ab02000004'
if ( self.roles.include?(@roid) == false or val=="true")
self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id}
self.sub_role_ids.reject!{|t| t.to_s == id}
elsif(val=="false")
self.sub_roles << SubRole.find(id)
self.sub_role_ids += Array(id)
end
end
end
def role_status=(var)
self.role_statuses = []
var[:id].each do |id,val|
if (val=="true")
self.role_statuses << RoleStatus.find(id)
end
end
end
def role_category=(var)
self.role_categorys = []
var[:id].each do |id,val|
if (val=="true")
self.role_categorys << RoleCategory.find(id)
end
end
end
def set_sub_role(sub_role_id,status_id)
@ -144,6 +174,24 @@ class User
}.uniq!
end
def self.get_member_list_attribute_field_name(role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first
return ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first.title
end
def self.get_member_list_attribute_value(user_id,role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first
end
def self.get_role_member_data_by_sort(role_status_id)
a = Array.new
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,"staff","job_title")['val'].to_i, t ] }
member_data = a.sort
member_data_tmp = member_data.collect {|v| v[1] }
end
def create_dept_cache
dept_hash = {}
@ -170,12 +218,30 @@ class User
(query1 + query2).uniq
end
# def name
# info = Class::Info.first(:conditions => {:key => 'profile'})
# if info
# first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
# last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
# full_name = "#{last_name} #{first_name}"
# if full_name.strip.empty?
# full_name = email
# end
# return full_name
# else
# return nil
# end
# end
def name
info = Class::Info.first(:conditions => {:key => 'profile'})
if info
first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
full_name = "#{last_name} #{first_name}"
# first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
# last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
# full_name = (I18n.locale != 'zh_tw') ? "#{self.last_name} #{self.first_name}" : "#{self.first_name} #{self.last_name}"
full_name = (I18n.locale.to_s == 'zh_tw') ? "#{self.last_name} #{self.first_name}" : "#{self.first_name} #{self.last_name}"
if full_name.strip.empty?
full_name = email
@ -206,11 +272,6 @@ class User
end
protected
def save_roles
# self.roles = self.sub_roles.collect{|t| t.role}.uniq
self.roles = self.roles.uniq
end
def rebuild_status_record
self.status_record = {}

View File

@ -0,0 +1,10 @@
class UserAction
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :user
field :params,:type => Hash
field :page
end

View File

@ -17,7 +17,7 @@
<div class="label-group">
<div class="label-td">
<% asset.sorted_tags.each do |tag| %>
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<span class="label label-tags"><%= tag.name %></span>
<% end %>
</div>
</div>

View File

@ -25,7 +25,7 @@
<% @tags.each do |tag| %>
<%= content_tag :label, :class => "checkbox inline" do -%>
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
<%= tag[I18n.locale] %>
<%= tag.name %>
<%= hidden_field_tag 'asset[tag_ids][]', '' %>
<% end %>
<% end %>

View File

@ -1,5 +1,5 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>

View File

@ -1,5 +1,5 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
@ -37,6 +37,8 @@
<% if @attribute_type == 'role' %>
<li><%= link_to t(:role_field), eval("admin_#{@attribute_type}_role_field_path(attribute)") %></li>
<li><%= link_to t(:sub_role), eval("admin_#{@attribute_type}_sub_role_path(attribute)") %></li>
<li><%= link_to t(:status), eval("admin_role_statuses_path(:role_id=>attribute)") %></li>
<li><%= link_to t(:category), eval("admin_role_categorys_path(:role_id=>attribute)") %></li>
<% end %>
<li><%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' %></li>
<li><%= link_to t(:disable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' %></li>

View File

@ -40,7 +40,7 @@
</div>
</div>
<!-- <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:member) %></a></h3>
<h3><i class="icons-"></i><a href=""><%= t(:member_) %></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_member) %></span>2,217</p>
<table class="table table-striped">

View File

@ -8,5 +8,5 @@
</table>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_admin_design_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:upload), upload_package_admin_designs_path, :class => 'btn btn-primary pull-right' %>
</div>

View File

@ -1,7 +1,8 @@
<% content_for :side_bar do %>
<%= render 'admin/sites/side_bar' %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :side_bar_content => 'admin/sites/side_bar'} %>
<% end %>
<div class="main2">
<%= form_tag '',:multipart => true,:action=>"post" do |f| %>

View File

@ -2,5 +2,14 @@
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
</ol>
<script type="text/javascript">
$.ajaxSetup({
error: function(xhr, status, err) {
if (xhr.status == 401){
alert("<%= I18n.t('access.denied.ajax_401_error') %>");
window.location.href = '/';
}
}
});
bindTreeDragHandle();
</script>

View File

@ -0,0 +1,3 @@
<div class="filter-clear">
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
</div>

View File

@ -0,0 +1,11 @@
<div id="filter" class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -0,0 +1,29 @@
<tr id="<%= dom_id mail_cron_log %>" class="with_action">
<td class="span1">
<% if is_manager? %>
<%= check_box_tag 'to_delete[]', mail_cron_log.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1-2">
<%= mail_cron_log.mail_subject %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager %>
<li><%= link_to t(:delete_), admin_mail_cron_log_path(mail_cron_log), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td class="span2">
<%= mail_cron_log.mail_to.gsub(/,/, "<br />").html_safe %>
</td>
<td class="span2">
<%= mail_cron_log.mail_user %>
</td>
<td class="span2">
<%= mail_cron_log.mail_from_app %>
</td>
<td class="span2">
<%= display_date_time(mail_cron_log.created_at) %>
</td>
</tr>

View File

@ -0,0 +1,6 @@
<%= render_sort_bar(true, delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['subject', 'mail_subject','span2', :subject] ,
['mail_to', 'mail_to','span2', :mail_to] ,
['mail_user', 'mail_user','span2', :mail_user] ,
['mail_from_app', 'mail_from_app','span2', :mail_from_app] ,
['sentdate', 'created_at','span2', :sentdate] ).html_safe %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @mail_cron_log %>").remove();

View File

@ -0,0 +1,28 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
<% end %>
<%= render 'filter' %>
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span2"></th>
<th class="span2"></th>
<th class="span2"></th>
<th class="span2"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_mail_cron_logs" class="sort-holder">
<%= render :partial => "mail_cron_log",:collection=> @mail_cron_logs%>
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div id="web_link_pagination" class="paginationFixed">
<%= paginate @mail_cron_logs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

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