From 119d8ff13a1711d24eb9daef2266a32282978479 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 3 May 2012 18:27:39 +0800 Subject: [PATCH] add field called unit_list_for_anc and data from nccu(0224). Now can run "rake nccu_data:setup_ut_list" to setup NCCU data. --- .../back_end/bulletins_controller.rb | 1 + .../announcement/app/models/bulletin.rb | 1 + .../app/models/unit_list_for_anc.rb | 12 ++ .../back_end/bulletins/_form.html.erb | 3 + .../front_end/bulletins/show.html.erb | 2 +- .../data_for_ut_list_for_posting_anc.rake | 15 ++ .../lib/ut_list_from_nccu_2012feb.csv | 186 ++++++++++++++++++ 7 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb create mode 100644 vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake create mode 100644 vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index a1f5227e..5f210f3c 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -319,6 +319,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def get_categorys(id = nil) @bulletin_categorys = [] + @unit_list_for_anc = UnitListForAnc.all if(is_manager? || is_admin?) @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) elsif is_sub_manager? diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 44882df3..008090f4 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -33,6 +33,7 @@ class Bulletin mount_uploader :image, ImageUploader belongs_to :bulletin_category + belongs_to :unit_list_for_anc # embeds_many :bulletin_links, :cascade_callbacks => true # embeds_many :bulletin_files, :cascade_callbacks => true diff --git a/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb new file mode 100644 index 00000000..5261f6a2 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb @@ -0,0 +1,12 @@ +class UnitListForAnc + include Mongoid::Document + include Mongoid::Timestamps + + field :order + field :ut_code + field :up_ut_code + + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true + + +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 33aacf34..23557206 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -117,6 +117,9 @@
+ + <%= f.label :unit_list_for_anc%> + <%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %> <%= f.label :category %> <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb index 2f37df9c..5c0857cd 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -4,7 +4,7 @@
diff --git a/vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake b/vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake new file mode 100644 index 00000000..e5bd0be2 --- /dev/null +++ b/vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake @@ -0,0 +1,15 @@ +# encoding: utf-8 + +namespace :nccu_data do + desc "load nccu data from csv" + task :setup_ut_list => :environment do + require 'csv' + + CSV.foreach("vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv") do |row| + new_unit = UnitListForAnc.new(:order => row[0], :ut_code => row[1], :up_ut_code => row[2], :created_at => Time.now,:updated_at => Time.now) + new_unit.build_title :en => row[4], :zh_tw => row[3] + new_unit.save + end + + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv b/vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv new file mode 100644 index 00000000..548ad528 --- /dev/null +++ b/vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv @@ -0,0 +1,186 @@ +order,ut_code,up_tu_code,ut_zh_tw,ut_en +0100,H00,H00,校長室,Office of the President +0110,H01,H01,副校長室一,Office of the Vice President +0110,H03,H03,副校長室二,Office of the Vice President +0200,100,100,文學院,College of Liberal Arts +0210,101,100,中文系,Dept. of Chinese Literature +0220,103,100,歷史系,Dept. of History +0230,104,100,哲學系,Dept. of Philosophy +0240,155,100,圖檔所,"Graduate Institute of Library, Informati" +0250,156,100,宗教所,Graduate Institute of Religious Studies +0260,158,100,台史所,Graduate Institute of Taiwan History +0270,159,100,台文所,Graduate Institute of Taiwan Literatu +0280,161,100,華文碩,Master's Program in Teaching Chinese as +0290,160,100,華文博,Doctor's Program in Teaching Chinese as +0294,913,100,圖資專班,E-learning Master Program of Library and +0300,700,700,理學院,College of Science +0310,701,700,應數系,Dept. of Mathematical Sciences +0320,702,700,心理系,Dept. of Psychology +0330,703,700,資科系,Dept. of Computer Science +0340,754,700,神科所,The Graduate Institute of Neuroscience +0350,755,700,應物所,Graduate Institute of Applied Physics +0600,200,200,社科院,College of Social Sciences +0605,202,200,政治系,Dept. of Political Science +0610,204,200,社會系,Dept. of Sociology +0615,205,200,財政系,Dept. of Public Finance +0620,206,200,公行系,Dept. of Public Administration +0625,207,200,地政系,Dept. of Land Economics +0630,208,200,經濟系,Dept. of Economics +0635,209,200,民族系,Dept. of Ethnology +0640,261,200,國發所,GIDS +0645,262,200,勞工所,Graduate Institute of Labor Research +0650,264,200,社工所,Graduate Institute of Social Work +0652,265,200,亞太博,International Doctor Program in Asia-Pac +0700,600,600,法學院,College of Law +0710,601,600,法律系,Dept. of Law +0720,652,600,法科所,The Institute of Law and Inter-disciplin +0800,300,300,商學院,College of Commerce +0801,301,300,國貿系,Dept. of International Business +0803,302,300,金融系,Dept. of Money and Banking +0805,303,300,會計系,Dept. of Accounting +0807,304,300,統計系,Dept. of Statistics +0809,305,300,企管系,Dept. of Business Administration +0811,306,300,資管系,Dept. of Management Information System +0813,307,300,財管系,Dept. of Finance +0815,308,300,風管系,Dept. of Risk Management and Insurance +0817,359,300,科管所,Graduate Institute of Technology and Inn +0819,361,300,智財所,Graduate Institute of Intellectual Prope +0821,362,300,管理碩士學程,Advanced Master of Business Administrati +0823,380,300,商管碩,Advanced Master of Business Administrati +1100,500,500,外語學院,College of Foreign Languages +1110,501,500,英文系,Dept. of English +1120,502,500,阿文系,Dept. of Arabic Language and Literature +1130,504,500,斯拉夫文系,Dept. of Slavic Languages and Literature +1140,506,500,日文系,Dept. of Japanese +1150,507,500,韓文系,Dept. of Korean Language and Cultur +1160,508,500,土文系,Dept. of Turkish Language and Cultu +1170,555,500,語言所,Graduate Institute of Linguistics +1180,509,500,歐洲語文學程,Undergraduate Program in European Langua +1190,5T1,500,外文中心,Foreign Languages Center +1200,400,400,傳播學院,College of Communication +1210,401,400,新聞系,Dept. of Journalism +1220,402,400,廣告系,Dept. of Advertising +1230,403,400,廣電系,Dept. of Radio and Television +1240,461,400,國傳英語碩士學位學程,International Master's Program in Intern +1250,404,400,傳播學程,College of Communication Undergraduate D +1260,462,400,數位內容學程,DCT +1270,781,700,數位內容與科技學士學位學程,數位內容與科技學士學位學程 +1280,4A1,400,實習廣播電台,NCCU Community Radio Station +1300,800,800,國際事務學院,College of International Affairs +1310,203,800,外交系,Dept. of Diplomacy +1320,260,800,東亞所,Graduate Institute of East Asian Studies +1330,263,800,俄研所,Graduate Institute of Russian Studies +1340,861,800,日碩研,Master Program in Japan Studies +1346,862,800,國際研究英語碩士學位學程(籌備處),International Master's Program in Intern +1600,900,900,教育學院,College of Education +1610,102,900,教育系,Dept. of Education +1620,157,900,幼教所,Graduate Institute of Early Childhood Ed +1630,171,900,教政所,Graduate Institute of Educational Admini +1640,1T3,900,師培中心,Institute of Teacher Education +1652,172,900,輔諮碩學程,MPCG +1660,1T1,900,教研中心,The Teacher In-Service Education Center +1700,L00,L00,國關中心,The Institute of International Relations +1710,L01,L00,國關第一所,First Division +1720,L02,L00,國關第二所,Second Division +1730,L03,L00,國關第三所,Third Division +1740,L04,L00,國關第四所,Fourth Division +1750,L05,L00,國關合交組,The Institute of International Relations +1760,L06,L00,國關編譯組,The Institute of International Relations +1770,L07,L00,國關圖資組,The Institute of International Relations +1780,L08,L00,國關秘書組,The Institute of International Relations +1800,S00,S00,選研中心,Election Study Center +1900,Z01,Z01,第三部門研究中心,Center for the Third Sector +1910,Z02,Z02,創新創造力研究中心,CCIS +1920,Z03,Z03,中國大陸研究中心,Center for China Studies +1930,Z04,Z04,台灣研究中心,TSC +1940,Z08,Z08,心腦學中心,"Reseach Center for Mind, Brain and Learn" +1950,Z10,Z10,原民中心,Center for Aboriginal Studies +1960,Z09,Z09,人文中心,Humanities Center +2000,T00,T00,教務處,Office of Academic Affairs +2010,T01,T00,教務處註冊組,Registration Section +2020,T02,T00,教務處課務組,Instruction Resources Section +2030,T03,T00,教務處綜合業務組,Admission Section +2040,T04,T00,教務處通識教育中心,Center of General Education +2100,M00,M00,學務處,Office of Student Affairs +2110,M01,M00,學務處生僑組,Life Guidance and Overseas Chinese Stude +2120,M02,M00,學務處課外組,Student Activities Section +2130,M03,M00,學務處住宿組,Student Housing Service Section +2150,M11,M00,學務處藝文中心,Art and Culture Center +2155,M14,M00,學務處身心健康中心,Physical and Mental Health Center +2160,M13,M00,學務處職涯中心,Center of Career Development +2170,D00,M00,學務處軍訓室,Military Education Office +2200,G00,G00,總務處,Office of General Affairs +2210,G01,G00,總務處文書組,Document and postal section +2220,G02,G00,總務處事務組,General Management Section +2230,G05,G00,總務處出納組,Cashier Section +2240,G04,G00,總務處營繕組,Construction and Maintenance Section +2250,G03,G00,總務處財產組,Property Management SEction +2260,G06,G00,總務處環保組,Environmental Protection Section +2270,G08,G00,總務處規劃組,Campus Planning & Devel opment Section +2280,G07,G00,總務處駐警隊,Campus Security National Chengchi Unive +2300,R00,R00,研發處,Office of Research and Development +2310,R01,R00,研發處企畫組,Planning Section +2320,R02,R00,研發處學術推展組,Academic Development Section +2330,R03,R00,研發處學評組,Academic Evaluation Section +2400,Z05,Z05,國合處,Office of International Cooperation +2410,Z06,Z05,國合處合作交流組,CES +2420,Z07,Z05,國合處教育組,IES +2430,Z14,Z05,國合處發展策劃組,DPS +2500,Q00,Q00,秘書處,Secretariat +2510,Q01,Q00,秘書處第一組,First Section +2520,Q02,Q00,秘書處第二組,Second Section +2530,Q03,Q00,秘書處第三組,Third Section +2600,K00,K00,圖書館,Libraries +2610,K06,K00,圖書館資訊組,System Information Section +2620,K07,K00,圖書館採編組,Acquisition & Cataloging Section +2630,K08,K00,圖書館典閱組,Circulation Section +2640,K09,K00,圖書館推廣服務組,Reference Services Section +2650,K10,K00,圖書館數位典藏組,Digital Preservation Section +2660,K11,K00,圖書館行政組,Administration Section +2670,K12,K00,圖書館圖書分館,Branch Libraries +2700,B00,B00,體育室,Physical Education Office +2710,B01,B00,體育教學組,Physical Education Office +2720,B02,B00,體育活動組,Sport activities section +2800,P00,P00,人事室,Personnel Office +2810,P01,P00,人一組,First Section +2820,P02,P00,人二組,Second Section +2830,P03,P00,人三組,Third Section +2840,P04,P00,人四組,Fourth Section +2900,A00,A00,會計室,Accounting Office +2910,A01,A00,會計室第一組,Budgeting Section +2920,A02,A00,會計室第二組,Accounting Section +2930,A03,A00,會計室第三組,Auditing Section +3000,I00,I00,公企中心,Public and Business Administration Educa +3010,I01,I00,公企諮詢組,Research and Consultation Section +3020,I02,I00,公企職訓組,Training Section +3030,I03,I00,公企語訓組,Language Training Section +3040,I04,I00,公企總務組,General Affairs Section +3050,I05,I00,公企中心圖資組,Library Resource Section +3100,O00,O00,公教中心,Civil Service Education Center +3110,O01,O00,公教教務組,Civil Service Education Center +3120,O02,O00,公教輔導組,Civil Service Education Center +3130,O03,O00,公教行政組,Civil Service Education Center +3200,J00,J00,社資中心,Social Sciences Information Center +3210,J03,J00,社資資料組,Reference Services Section +3220,J04,J00,社資研發組,Section of Research & Development +3300,C00,C00,電算中心,Computer Center +3310,C01,C00,電算教研組,Teaching and Research Section +3320,C02,C00,電算系統組,Application System Section +3330,C03,C00,電算行政組,Administration and Counseling Section +3340,C04,C00,電算網路組,Networking and Development Section +3400,T05,T05,教學發展中心,Center for Teaching and Learning Develop +3410,T06,T05,教發教學組,Teaching and Learning Division +3420,T07,T05,教發數位組,E-Learning Division +3430,T08,T05,教發規劃組,Planning and Research Division +3500,162,162,華語文中心,Chinese Language Center +3600,Z11,Z11,育成中心,Innovation Incubation Center +3700,V00,V00,附設實小,The Experimental Elementary School +3700,V01,V00,附設實小教務處,Office of Academic Affairs +3700,V02,V00,附設實小學務處,Office of Student Affairs +3700,V03,V00,附設實小輔導室,The Experimental Elementary School +3700,V04,V00,附設實小總務處,Office of General Affairs +3700,V06,V00,附設實小研究處,The Experimental Elementary School +3710,V05,V00,附設實小幼稚園,The Experimental Elementary School +3800,W00,W00,附中,The Affiliated High School +3900,Z13,Z13,政大書院辦公室,Chengchi College Project Office +4000,Z12,Z12,頂大辦公室,Office of NCCU Top University Program \ No newline at end of file