# HG changeset patch # User Zoe Hong # Date 1425402800 -3600 # Node ID e6e9bdc4f256ca9f31bfb4f11c80b1cf26cc2b86 # Parent 4a29bccb6c59bf1e2d806b02059aea2f007ca7b3 update the saving response from LGService between different file version diff -r 4a29bccb6c59 -r e6e9bdc4f256 develop/controllers/extractapp.php --- a/develop/controllers/extractapp.php Tue Mar 03 11:47:41 2015 +0100 +++ b/develop/controllers/extractapp.php Tue Mar 03 18:13:20 2015 +0100 @@ -26,9 +26,7 @@ $viewmodel->messages .= "SaveFullTextToLGService! "."
"; $viewmodel->GetInfoFromPreviousPage($this->postdata); $response = $viewmodel->SaveFullTextToLGService($this->postdata); - $viewmodel->UpdateInfoByResponseFromLGService($response); // update file_id, branch_id, user_id - $this->ReturnView($viewmodel->StartTagging(), true); break; @@ -38,6 +36,10 @@ case 'SmartRegexSave': $viewmodel->SmartRegexSave($this->postdata); break; + case 'Reload': + $viewmodel->messages .= "Reload
"; + + break; case 'ContinueTagging': $viewmodel->messages .= "(Countinue tagging) "."
"; @@ -48,6 +50,7 @@ $this->ReturnView($viewmodel->StartTagging(), true); break; + default: // first time visit extraction interface from LGService $viewmodel->messages .= "Welcome to Extraction Interface. "."
"; diff -r 4a29bccb6c59 -r e6e9bdc4f256 develop/data/parsing_files/126434.txt --- a/develop/data/parsing_files/126434.txt Tue Mar 03 11:47:41 2015 +0100 +++ b/develop/data/parsing_files/126434.txt Tue Mar 03 18:13:20 2015 +0100 @@ -1,4 +1,4 @@ -【737】常州府志卷之十 物産 禮曰天時有生也地利有宜也天不生地不養君子 不以為禮則物宜所亟辨哉常郡屬古揚州而禹貢 所載貢物吾郡無一焉蓋吾郡之所生者日用飮食 之外無他奇似無足紀然書稱不貴異物賤用物民 乃足豈吾郡之謂乎兹於他郡所同有者紀於前吾 郡所獨有者紀於後即同為他郡所有而吾郡尤佳 者亦特表而出之作物産志 +【737】〈常州府志〉卷之十 物産 禮曰天時有生也地利有宜也天不生地不養君子 不以為禮則物宜所亟辨哉常郡屬古揚州而禹貢 所載貢物吾郡無一焉蓋吾郡之所生者日用飮食 之外無他奇似無足紀然書稱不貴異物賤用物民 乃足豈吾郡之謂乎兹於他郡所同有者紀於前吾 郡所獨有者紀於後即同為他郡所有而吾郡尤佳 者亦特表而出之作物産志 〈榖之屬〉〈榖之屬〉 〈榖之屬〉〈榖之屬〉白稻 @@ -8,7 +8,7 @@ 〈榖之屬〉晚稻 〈榖之屬〉糯稻與他郡無異 〈榖之屬〉【738】 惟 -〈榖之屬〉香珠稻 +〈榖之屬〉香珠稻 〈榖之屬〉紅蓮稻則産於武進者佳而秈米則歲以 二十石為 上供焉如 〈榖之屬〉大麥 〈榖之屬〉小麥 @@ -24,198 +24,134 @@ 〈榖之屬〉僧衣豆 〈榖之屬〉豇豆 〈榖之屬〉豌豆 -〈榖之屬〉稨豆 -〈榖之屬〉芝麻 -〈榖之屬〉飯豆俱與他郡無異惟 -〈榖之屬〉白果豆則産於武進者 -〈榖之屬〉佳蠶豆 則産於無錫者佳 -〈蔬之屬〉〈蔬之屬〉 -〈蔬之屬〉如 -〈蔬之屬〉芹菜 -〈蔬之屬〉蔓菁 -〈蔬之屬〉韭薺 -〈蔬之屬〉塌科 -〈蔬之屬〉烏菘菜 -〈蔬之屬〉薹馬蘭 -〈蔬之屬〉茼蒿 -〈蔬之屬〉菠菜芫荽葱小蒜扁瓠茭白芥莧萵苣馬齒 -〈蔬之屬〉莧黄瓜 -〈蔬之屬〉茄子 -〈蔬之屬〉絲瓜 -〈蔬之屬〉南瓜 -〈蔬之屬〉牛角瓜 -〈蔬之屬〉香瓜 -〈蔬之屬〉冬瓜 -〈蔬之屬〉番瓜 -〈蔬之屬〉火菜 -〈蔬之屬〉白菜 -〈蔬之屬〉葫蘆 -〈蔬之屬〉刀豆 -〈蔬之屬〉莢茨 -〈蔬之屬〉 -〈蔬之屬〉荸薺 -〈蔬之屬〉香芋俱與他郡無異惟 -〈蔬之屬〉燕笋産於 【739】 江陰者隹 -〈蔬之屬〉毛笋產於宜興者隹 -〈蔬之屬〉萊菔蘿蔔 産於武進 之觀基者隹 -〈蔬之屬〉芋頭產於武進之馬山者隹蕈産於無 錫之惠山 -〈蔬之屬〉者隹竹茹産於宜興之南山者 -〈蔬之屬〉西瓜産 於武進之奔牛無錫之五牧江陰之青暘者隹 -〈蔬之屬〉大蒜 産於武進之横林者隹 -〈果之屬〉 -〈果之屬〉如 -〈果之屬〉棗栗 -〈果之屬〉 -〈果之屬〉 -〈果之屬〉 -〈果之屬〉枇杷 -〈果之屬〉 -〈果之屬〉 -〈果之屬〉梧桐 -〈果之屬〉石榴花紅嘉慶 子 -〈果之屬〉核桃 -〈果之屬〉葡萄 -〈果之屬〉銀杏 -〈果之屬〉蓮蓬 -〈果之屬〉實俱與他郡無異惟 -〈果之屬〉則 産於武進之孟河靖江之諸沙者隹 -〈果之屬〉櫻桃產於江陰 之青暘者隹 -〈果之屬〉楊梅産於武進之馬山者隹 -〈果之屬〉産於武進之蘆墅者隹 -【740】 -〈藥之屬〉〈藥之屬〉如 -〈藥之屬〉百合 -〈藥之屬〉〈藥之屬〉山藥 -〈藥之屬〉麥門冬 -〈藥之屬〉桔梗 -〈藥之屬〉枸杞 -〈藥之屬〉菖蒲 -〈藥之屬〉金銀花 -〈藥之屬〉櫻子 -〈藥之屬〉山查 -〈藥之屬〉决明 -〈藥之屬〉蒲公英皂角沙參稀薟蒼耳子大薊 小薊牽牛薄荷蛇牀子茴 -〈藥之屬〉香瞿 -〈藥之屬〉麥藿 -〈藥之屬〉香夏 -〈藥之屬〉枯草瓜簍 仁益母草山茨菰土茯苓五加皮水蓼浮萍羊蹄根 天花粉甘菊艾俱與他郡無異惟 -〈藥之屬〉紫蘇產於武進之 毘陵驛者隹 -〈藥之屬〉何首烏産於宜興之銅官者佳而武進 之馬山又有一種亦名何首烏或曰何首胡身如蘿 蔔而略細味甚甘美山人種之售於他邑多所獲利 -〈木之屬〉〈木之屬〉 -〈木之屬〉如 -〈木之屬〉 -〈木之屬〉 -〈木之屬〉榆槐椐石楠 -〈木之屬〉冬青 -〈木之屬〉棕櫚黄楊檉梓桐 杉椿桑柘樗樟楓楊柳楮樸槿楝烏柏烏穠糓檀櫟 -〈木之屬〉【741】 俱與他郡無異惟 -〈木之屬〉則産於宜興者佳其品類不一 而總名之日岕茶大約以高山者為上平原者為下 每當初夏商賈駢集官給茶引方敢出境 -〈竹之屬〉〈竹之屬〉 -〈竹之屬〉如 -〈竹之屬〉慈孝 -〈竹之屬〉紫竹 -〈竹之屬〉淡竹 -〈竹之屬〉金竹 -〈竹之屬〉剛竹 -〈竹之屬〉天竹 -〈竹之屬〉苦竹 -〈竹之屬〉木竹 -〈竹之屬〉鳯尾竹 -〈竹之屬〉烏筋竹 -〈竹之屬〉水竹 -〈竹之屬〉護基竹俱與他郡無異 -〈竹之屬〉惟 -〈竹之屬〉〈江陰〉燕竹 -〈竹之屬〉〈江陰〉班竹産於 -〈竹之屬〉〈江陰〉〈江陰〉者佳 -〈竹之屬〉毛竹産於宜興者佳 -〈竹之屬〉〈竹之屬〉其 -〈竹之屬〉班竹 -〈竹之屬〉毛竹 俱可為器物 -〈花之屬〉〈花之屬〉 -〈花之屬〉其已見果屬者不更載如 -〈花之屬〉芍藥 -〈花之屬〉山鵑萱夜合金 雀 -〈花之屬〉薔薇木香月季鐵線蓮 -〈花之屬〉罌粟虞美人佛見笑荼䕷 -諸葛菜金絲桃蝴蝶蜀葵錦葵剪春羅剪秋紗翠梅 -【742】 烏羢凌霄沃丹沃黄沃素玉簮長春玫瑰滴滴金千 日紫秋葵鳯仙雞冠荷包牡丹埭棠海棠俱與他郡 無異惟 -〈花之屬〉牡丹則産於江陰之虎涇口者隹多以芍藥 相接故花色甚不一 -〈花之屬〉石巖亦産於江陰之虎涇口沙山者佳 -〈花之屬〉菊花亦産於江陰者佳 -〈花之屬〉蘭蕙産於宜興諸山者佳 -〈花之屬〉杜鵑亦産於宜興者佳而惟南嶽一株為最古 -〈花之屬〉棉花雖各邑俱産而江靖尤多遠近交相貿易 +〈榖之屬〉稨豆芝麻飯 豆俱與他郡無異惟 +〈榖之屬〉白果豆則産於武進者 +〈榖之屬〉佳蠶豆 則産於無錫者佳 +〈蔬之屬〉 +如 +芹菜蔓菁韭薺塌科 +烏菘菜薹馬蘭茼蒿菠 菜芫荽葱小蒜扁瓠茭白芥莧萵苣馬齒 +莧黄瓜茄 +子絲瓜 +南瓜 +牛角瓜 +香瓜 +冬瓜 +番瓜 +火菜 +白菜葫蘆 +刀豆莢茨菇荸薺香芋俱與他郡無異惟燕笋産於 +【739】 江陰者隹毛笋產於宜興者隹萊菔 +即蘿 + 産於武進 之觀基者隹芋頭產於武進之馬山者隹蕈産於無 錫之惠山 +者隹竹茹産於宜興之南山者 +隹西瓜産 於武進之奔牛無錫之五牧江陰之青暘者隹大蒜 産於武進之横林者隹 +〈果之屬〉 +如棗栗梅杏李枇杷梨杮梧桐石榴花紅嘉慶 子核桃葡萄銀杏蓮蓬芡實俱與他郡無異惟桃則 産於武進之孟河靖江之諸沙者隹櫻桃產於江陰 之青暘者隹楊梅産於武進之馬山者隹菱産於武 進之蘆墅者隹 +【740】藥之屬如百合 +山藥麥門冬桔梗枸杞菖蒲金銀花金櫻子山查决明蒲公英皂角沙參稀薟蒼耳子大薊 小薊牽牛薄荷蛇牀子茴 +香瞿麥藿香夏 +枯草瓜簍 仁益母草山茨菰土茯苓五加皮水蓼浮萍羊蹄根 天花粉甘菊艾俱與他郡無異惟紫蘇產於武進之 毘陵驛者隹何首烏産於宜興之銅官者佳而武進 之馬山又有一種亦名何首烏或曰何首胡身如蘿 蔔而略細味甚甘美山人種之售於他邑多所獲利 +〈木之屬〉 +如松栢檜榆槐椐石楠冬青棕櫚黄楊檉梓桐 杉椿桑柘樗樟楓楊柳楮樸槿楝烏柏烏穠糓檀櫟 +【741】 俱與他郡無異惟茶則産於宜興者佳其品類不一 而總名之日岕茶大約以高山者為上平原者為下 每當初夏商賈駢集官給茶引方敢出境 +〈竹之屬〉 +如慈 +孝紫竹 +淡竹 +金竹 +剛竹 +天竹 +苦竹 +木竹鳯 +尾竹 +烏筋竹 +水竹 +護基竹俱與他郡無異 +惟燕竹班 竹産於江陰者 +佳毛竹産於宜興者佳 +其班竹 +毛竹 俱可為器物 +〈花之屬〉 +其已見果屬者不更載如芍藥山鵑萱夜合金 雀薔薇木香月季鐵線蓮罌粟虞美人佛見笑荼䕷 +諸葛菜金絲桃蝴蝶蜀葵錦葵剪春羅剪秋紗翠梅 +【742】 烏羢凌霄沃丹沃黄沃素玉簮長春玫瑰滴滴金千 日紫秋葵鳯仙雞冠荷包牡丹埭棠海棠俱與他郡 無異惟牡丹則産於江陰之虎涇口者隹多以芍藥 相接故花色甚不一石巖亦産於江陰之虎涇口沙 山者佳菊花亦産於江陰者佳蘭蕙産於宜興諸山 者佳杜鵑亦産於宜興者佳而惟南嶽一株為最古 棉花雖各邑俱産而江靖尤多遠近交相貿易 〈草之屬〉 -如千年蒀龍虎草游龍虎耳鳯尾吉祥翠雲繡 墩書帶芭蕉酸漿魚腥紅蓼辣蓼淡竹葉青苔薜荔 莎蓬蒿灰蓼俱與他郡無異惟 -黄麻席草則産於【743】無錫者佳黄麻漬水取皮織以為布蓆草織以為蓆藍 則産於江靖者多而且佳以之為靛利用甚溥 -〈禽之屬〉〈禽之屬〉 -〈禽之屬〉如 -〈禽之屬〉 -〈禽之屬〉 -〈禽之屬〉 -〈禽之屬〉鴿 -〈禽之屬〉雉竹 -〈禽之屬〉雞鵲 -〈禽之屬〉烏鴉鶯燕戴勝雀鳩鵓 鴣鸜鵒鵜鶘練雀百舌畫眉脊令啄木鷹鷺鷥鷗鴛 鴦黄頭偷倉鸕鷀俱與他郡無異惟 -〈禽之屬〉 俗名 野鴨 -〈禽之屬〉 俗名 水葫蘆産於武進之太湖滆湖者佳 -〈禽之屬〉産於武進之横 林無錫之五牧者佳以上數禽取其肥而可食 +如千年蒀龍虎草游龍虎耳鳯尾吉祥翠雲繡 墩書帶芭蕉 +酸漿魚腥紅蓼辣 +蓼淡竹葉青苔薜荔 莎蓬蒿灰蓼俱與他郡無異惟黄麻席草則産於無 +【743】 錫者佳黄麻漬水取皮織以為布蓆草織以為蓆藍 則産於江靖者多而且佳以之為靛利用甚溥 +〈禽之屬〉 +如雞鵝鴨 +鴿雉竹雞鵲烏鴉鶯燕戴勝雀鳩鵓 鴣鸜鵒鵜鶘練雀百舌畫眉脊令啄木鷹鷺鷥鷗鴛 鴦黄頭偷倉鸕鷀俱與他郡無異惟鶩 +俗名 +野鴨 + +俗名 +水葫 + 産於武進之太湖滆湖者佳黄雀産於武進之横 林無錫之五牧者佳以上數禽取其肥而可食 〈獸之屬〉 -如 - - -虎豹 -豕兔 -犬貓 -竹䶉 -獺獾俱與他郡無 異惟鹿獐鹿柿狐山牛野猪産於宜興諸山者佳而 可食 -【744】 -〈鱗之屬〉如鯉青魚鰱鯽鯶鯿鱸鮆鮎土鮒蝦虎黄䫙白 絲黑魚鰻鱔俱與他郡無異惟子魚河魨刀鱭鱠殘 塌沙蛼 俗名 昌蛾 鑊㔶鱘鮰蝗諸種産於武邑之孟河 虞塘及江靖兩邑者佳白魚至時雨後産於無錫溪 河及太湖者佳 -〈無錫〉〈太湖〉銀魚 -〈無錫〉〈太湖〉澤魚産於 -〈無錫〉〈太湖〉〈太湖〉及 -〈無錫〉〈無錫〉之鵝肫 蕩者佳 +如牛羊虎豹豕兔 +犬貓竹䶉獺獾俱與他郡無 異惟鹿獐鹿柿狐山牛野猪産於宜興諸山者佳而 +可食 +【744】鱗之屬如 +鯉青魚鰱鯽鯶鯿鱸鮆鮎土鮒蝦虎黄䫙白 +絲黑魚鰻鱔俱與他郡無異 +惟子魚河魨刀鱭鱠殘 塌沙蛼 +俗名 +昌蛾 鑊㔶鱘鮰蝗諸種産於武邑之孟河 虞塘及江靖兩邑者 +佳白魚至時雨後産於無錫溪 河及太湖者 +佳銀魚 +澤魚産於太湖及無錫之鵝肫 +蕩者佳 〈介之屬〉 -如鼋龜蝦蟛蜞鼈蚌蜆螺田螺俱與他郡無異 惟 -則産於武進之芙蓉湖 -名玉瓜者佳江陰之江 蟹尤巨 -〈蟲之屬〉〈蟲之屬〉 -〈蟲之屬〉如蠶蜂蛙蝦蟇蝌蚪蜥蜴蜘蛛䗪 俗名 地鱉 螟蛉 -〈蟲之屬〉【745】 菜花蟲螢蟬螻蟈螳螂蠅虎蠅螬蠐蚱蜢飛蛾蝸牛 壁虎黄蜂鐵嘴蜂蛇蜈蚣虱蚤蚊俱與他郡無異惟 -〈蟲之屬〉石曠一名石麟産於宜興山中食者以為佳 -〈布帛之屬〉〈布帛之屬〉 -〈布帛之屬〉如 -〈布帛之屬〉綾絹 -〈布帛之屬〉布苧之類與他郡無異惟 -〈布帛之屬〉武邑 之名東門闊者闊而甚細異於他織無錫之名蕩口 縑者細擘黄草合絲縷績之織成縑布靖江之麻布 麤細各種細者縝密可愛即麤者亦疏爽經久不敝 -〈工作之屬〉〈工作之屬〉 -〈工作之屬〉如 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉 -〈工作之屬〉諸作俱與他郡無 異惟 -〈工作之屬〉無錫最擅名所云惠山三白 謂米白麴 白泉水白 臘月釀成以味清冽者為上奔走天下每歲數十萬 -【746】 斛不止窑作則宜興之缸甕罌缽壺諸器稱蜀山 窑者佳又有灰户伐石而焚炭户斵薪而火一郡資 之無錫則磚瓦窑磚瓦盛行於數百里內外又若石 作則宜興之石板可以蓋地無錫之陽山石可以為 磨為臼江陰之石堰石可以砌牆築岸皆工人终歲 勤劬以為業也 -〈器用之屬〉〈器用之屬〉 -〈器用之屬〉如 -〈器用之屬〉筆箋 -〈器用之屬〉扇箸 -〈器用之屬〉梳枕 -〈器用之屬〉以及 -〈器用之屬〉竹木器皿之類俱與 他郡無異惟燈則武邑有料絲燈初鈕姓獨擅其長 今則工是伎者甚衆厥製方圓不一又或為圍屏或 為對額夜燃膏燭瑩瑩洞徹山水人物花卉翎毛畢 -〈器用之屬〉【747】 具爭奇競巧歲歲不同惟 -〈器用之屬〉宜興有茶壺澄泥為 之始於供春而時大彬陳仲美陳用卿徐友泉輩踵 事增華并製為花罇菊合香盤十錦杯等物精美絕 倫四方皆爭購之他如 -〈器用之屬〉〈江陰〉蒲扇 -〈器用之屬〉〈江陰〉蒲蓆則 -〈器用之屬〉〈江陰〉〈江陰〉者佳 -〈器用之屬〉苧帨武進之驛前無錫之蕩口與靖江三者各佳 -〈器用之屬〉蒲鞋宜興之陳橋者佳 -【748】常州府志卷之十一 封系 考古封建所以親親尙賢也三代建國盛於西北而 東南則自泰伯季札始封至漢初猶循遺制從兹以 後有借一邑以為名實未嘗秉國之鈞食土之毛也 欲譜其流必溯其源自商周以迄後世其族之䌓簡 年之多寡莫不彰彰可考若夫齊以四代興梁以五 傳熾二代同姓各紀其始祖而餘略之蓋詳於史矣 作封系志 商 +如鼋龜蝦蟛蜞鼈蚌蜆螺田螺俱與他郡無異 惟蟹則産於武進之芙蓉湖 +名玉瓜者佳江陰之江 +蟹尤巨 +〈蟲之屬〉 +如蠶蜂蛙蝦蟇蝌蚪蜥蜴蜘蛛䗪 +俗名 +地鱉 +螟蛉 +【745】 菜花蟲螢蟬螻蟈螳螂蠅虎蠅螬蠐蚱蜢飛蛾蝸牛 壁虎黄蜂鐵嘴蜂蛇蜈蚣虱蚤蚊俱與他郡無異惟 石曠一名石麟産於宜興山中食者以為佳 +〈布帛之屬〉 +如綾絹布苧之類與他郡無異惟布則武邑 之名東門闊者闊而甚細異於他織無錫之名蕩口 縑者細擘黄草合絲縷績之織成縑布靖江之麻布 麤細各種細者縝密可愛即麤者亦疏爽經久不敝 +〈工作之屬〉 +如銀錫銅鐵木瓦石漆染諸作俱與他郡無 異惟酒作則無錫最擅名所云惠山三白 謂米白麴 白泉水白 臘月釀成以味清冽者為上奔走天下每歲數十萬 +【746】 斛不止窑作則宜興之缸甕罌缽壺諸器稱蜀山 窑者佳又有灰户伐石而焚炭户斵薪而火一郡資 之無錫則磚瓦窑磚瓦盛行於數百里內外又若石 作則宜興之石板可以蓋地無錫之陽山石可以為 磨為臼江陰之石堰石可以砌牆築岸皆工人终歲 勤劬以為業也 +〈器用之屬〉 +如筆箋扇箸梳枕 +以及竹木器皿之類俱與 他郡無異惟燈則武邑有料絲燈初鈕姓獨擅其長 今則工是伎者甚衆厥製方圓不一又或為圍屏或 為對額夜燃膏燭瑩瑩洞徹山水人物花卉翎毛畢 +【747】 具爭奇競巧歲歲不同惟壺則宜興有茶壺澄泥為 之始於供春而時大彬陳仲美陳用卿徐友泉輩踵 事增華并製為花罇菊合香盤十錦杯等物精美絕 倫四方皆爭購之他如蒲扇蒲蓆則江陰者佳苧帨 則武進之驛前無錫之蕩口與靖江三者各佳蒲鞋 則宜興之陳橋者佳 +【748】常州府志卷之十一 +封系 考古封建所以親親尙賢也三代建國盛於西北而 東南則自泰伯季札始封至漢初猶循遺制從兹以 後有借一邑以為名實未嘗秉國之鈞食土之毛也 欲譜其流必溯其源自商周以迄後世其族之䌓簡 年之多寡莫不彰彰可考若夫齊以四代興梁以五 傳熾二代同姓各紀其始祖而餘略之蓋詳於史矣 作封系志 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4a29bccb6c59 -r e6e9bdc4f256 develop/models/extractapp.php --- a/develop/models/extractapp.php Tue Mar 03 11:47:41 2015 +0100 +++ b/develop/models/extractapp.php Tue Mar 03 18:13:20 2015 +0100 @@ -8,7 +8,7 @@ return array("Index Value 1", "Value 2", "Value 3"); } - protected $section_id = 0, $data_path, $file_id = 0, $branch_id = 0, $user_id = 0, $lg_text = "", $topic = 0; + protected $section_id = 0, $data_path, $file_id = 0, $current_fileId=0, $branch_id = 0, $user_id = 0, $lg_text = "", $topic = 0; public $messages = ""; private function Initialize($_urlvalues) { @@ -17,24 +17,28 @@ } public function GetTextFromFileId($_postdata) { - $file_id = $_postdata['fileId']; + + if ($this->current_fileId != 0) { + $this->file_id = $this->current_fileId; + } else { + $this->file_id = $_postdata['fileId']; + } + $branch_id = $_postdata['branchId']; $section_id = $_postdata['sectionId']; $this->branch_id = $branch_id; - $this->file_id = $file_id; $this->user_id = $_postdata['userId']; $this->section_id = $section_id; - // TODO: get info from LGService $this->section_name = $_postdata['sectionName']; $this->book_id = $_postdata['bookId']; $this->book_name = $_postdata['bookName']; // get from URL with file_id - $lg_text_url = $this->get_text_from_fileId_url.$file_id; + $lg_text_url = $this->get_text_from_fileId_url.$this->file_id; $lg_text = file_get_contents($lg_text_url); $stringInput = $lg_text; @@ -112,13 +116,11 @@ if ($_postdata['bookId']) { $this->book_id = $_postdata['bookId']; } + if ($_postdata['currentFileId']) { + $this->current_fileId = $_postdata['currentFileId']; + } - $this->messages .= "Info: "; - $this->messages .= "file_id=".$this->file_id.", section_id=".$this->section_id; - $this->messages .= ", user_id=".$this->user_id.", branch_id=".$this->branch_id.", topic_id=".$this->topic; - $this->messages .= ", book_id=".$this->book_id.", book_name=".$this->book_name.", section_name=".$this->section_name."
"; - - + } public function InitData($_postdata) { @@ -192,10 +194,19 @@ $data['topic_tag'] = $this->GetTopicTag($this->GetTopic()); $data['topic_name'] = $this->GetTopicName($this->GetTopic()); + $data['info'] = array('file_id'=>$this->file_id, 'user_id'=>$this->user_id, 'branch_id'=>$this->branch_id, 'section_id'=>$this->section_id, 'book_id'=>$this->book_id, 'book_name'=>$this->book_name, 'section_name'=>$this->section_name, 'current_fileId'=>$this->current_fileId); + //'current_fileId'=>$this->file_id); + //'current_fileId'=>'123'); + + $this->messages .= "Info: "; + $this->messages .= "file_id=".$this->file_id.", section_id=".$this->section_id; + $this->messages .= ", user_id=".$this->user_id.", branch_id=".$this->branch_id.", topic_id=".$this->topic; + $this->messages .= ", book_id=".$this->book_id.", book_name=".$this->book_name.", section_name=".$this->section_name; + $this->messages .= ", current_fileId=".$this->current_fileId."
"; $data['messages'] = $this->messages; @@ -228,26 +239,44 @@ } public function UpdateInfoByResponseFromLGService($response) { + + + $status = $response["status"]; + if ($response["status"] == "error") { + $response_currentFile = $response["currentFile"]; + + $this->current_fileId = (string)$response_currentFile['id']; + $this->messages .= "saving does not success! ".(string)$response["message"]; + + } else { + + $response_file = $response["file"]; + $response_branch = $response["branch"]; + + $this->messages .= "saving success."; + $this->file_id = (string)$response_file["id"]; + $this->branch_id = (string)$response_branch["id"]; + + } + + + /* $response_file = $response["file"]; $response_branch = $response["branch"]; - $this->file_id = (string)$response_file["id"]; - $this->branch_id = (string)$response_branch["id"]; - - - $status = (string)$response["status"]; if ($status == "ok") { $this->messages .= "saving success."; + $this->file_id = (string)$response_file["id"]; + $this->branch_id = (string)$response_branch["id"]; } else if ($status == "error") { // saving not success $this->messages .= "saving does not success! ".(string)$response["message"]; - $this->current_fileId = (string)$response['currentFileId']; - // ask to "force save" or "reload" - + $this->current_fileId = $response["currentFileId"]; } + */ } @@ -282,7 +311,7 @@ if ($_postdata['branchId'] != 0) { - // exiting branch case + // -- exiting branch case $postfields = array( "text" => $require, "branchId" => $_postdata['branchId'], @@ -292,7 +321,7 @@ $save_url = $this->save_to_LGService_url; } else { - // new branch case + // -- new branch case echo "saveNew!"; if ($_postdata['userId']) { $user_id = $_postdata['userId']; @@ -323,10 +352,11 @@ // execute the request - $output = curl_exec($ch); + //$output = curl_exec($ch); + // output the profile information - includes the header - //echo($output) . PHP_EOL; + echo($output) . PHP_EOL; // close curl resource to free up system resources curl_close($ch); diff -r 4a29bccb6c59 -r e6e9bdc4f256 develop/views/Extractapp/taggingtext.php --- a/develop/views/Extractapp/taggingtext.php Tue Mar 03 11:47:41 2015 +0100 +++ b/develop/views/Extractapp/taggingtext.php Tue Mar 03 18:13:20 2015 +0100 @@ -73,6 +73,60 @@ // ==== +handleFileVersionConflict(); +// Popup to proceeding the saving situations +function handleFileVersionConflict() { + var info = JSON.parse(''); + console.log(info['current_fileId']); + + if (info['current_fileId'] != 0){ + // -- there might be conflicts between different version + var retVal = confirm('There were something happened/someone editing in the between of time.\nDo you want to force saving? (There might be conflicts between two versions.)'); + if( retVal == true ){ + // TODO: force saving with currentFileId + alert("You do the force saving!"); + //saveTextToLGService(); + + }else{ + var loadLastest = confirm("Do you want to reload for the lastest version? (Your current editing will lost.)"); + if (loadLastest == true) { + // TODO: reload page with the currentFileId + alert("You will reload the latest version."); + + var form = document.createElement("form"); + form.setAttribute("method", "post"); + form.setAttribute("action", "./TaggingText"); // hand to controller + form.setAttribute("target", "_blank"); + + var topic_id = JSON.parse(''); + + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "topic"); + hiddenField.setAttribute("value", topic_id); + form.appendChild(hiddenField); + + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "func"); + hiddenField.setAttribute("value", "Reload"); // reload + form.appendChild(hiddenField); + + + + _postForContineTagging(form); + + // use the current_fileId to reload the latest version of text + console.log('reloaded'); + + + } else { + alert("Just a reminder, there is a new version for this branch."); + } + } + } + return; + +} + '); - // Popup to proceeding the saving situations + + /* - if (info['current_fileId']) { - var retVal = confirm('There were something happened/someone editing in the between of time. - Please choose what you want to proceed the saving. - Click "OK" to force saving the current file.'); - if( retVal == true ){ - // TODO: force saving - alert("You do the force saving!"); - return true; - }else{ - // TODO: reload with the new file id (current_FileId) - - - alert("You will reload for the latest version!"); - return false; - } - - }; - - */ - // Popup choosing topic if first time to this section. without branchId if (info['file_id'] == 0) { // or info['branchId'] == 0, means new file @@ -151,7 +185,8 @@ var popup = document.getElementById('popup-window'); // alert('choose topic!'); - }; + } + */ }); $(document).on("click", "name", function (e) { @@ -359,7 +394,7 @@ form.appendChild(hiddenField); _postForContineTagging(form); - + /* var section_id = JSON.parse(''); @@ -422,8 +457,6 @@ form.appendChild(hiddenField); _postForContineTagging(form); - - /* var section_id = JSON.parse(''); console.log("section_id: "+section_id+", topic_id: "+topic_id); @@ -567,6 +600,7 @@ } }; + var form = document.createElement("form"); form.setAttribute("method", "post"); @@ -592,6 +626,7 @@ _postForContineTagging(form); /* + if (info) { var hiddenField = document.createElement("input"); hiddenField.setAttribute("name", "fileId"); @@ -685,8 +720,9 @@ form.appendChild(hiddenField); _postForContineTagging(form); + + }; - }; //Create and append the options for (var i = 0; i < t.length; i++) { @@ -723,39 +759,58 @@ if (info) { // TODO: different field info array based on fileId(branchId) existing or not - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "fileId"); - hiddenField.setAttribute("value", info['file_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "branchId"); - hiddenField.setAttribute("value", info['branch_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "userId"); - hiddenField.setAttribute("value", info['user_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "sectionId"); - hiddenField.setAttribute("value", info['section_id']); - form.appendChild(hiddenField); + if (info['file_id']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "fileId"); + hiddenField.setAttribute("value", info['file_id']); + form.appendChild(hiddenField); + }; + if (info['branch_id']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "branchId"); + hiddenField.setAttribute("value", info['branch_id']); + form.appendChild(hiddenField); + }; + if (info['user_id']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "userId"); + hiddenField.setAttribute("value", info['user_id']); + form.appendChild(hiddenField); + }; + if (info['section_id']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "sectionId"); + hiddenField.setAttribute("value", info['section_id']); + form.appendChild(hiddenField); + }; + if (info['book_id']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "bookId"); + hiddenField.setAttribute("value", info['book_id']); + form.appendChild(hiddenField); + }; + if (info['section_name']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "sectionName"); + hiddenField.setAttribute("value", info['section_name']); + form.appendChild(hiddenField); + }; + if (info['book_name']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "bookName"); + hiddenField.setAttribute("value", info['book_name']); + form.appendChild(hiddenField); + }; + /* + if (info['current_fileId']) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("name", "currentFileId"); + hiddenField.setAttribute("value", info['current_fileId']); + form.appendChild(hiddenField); + }; + */ - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "bookId"); - hiddenField.setAttribute("value", info['book_id']); - form.appendChild(hiddenField); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "sectionName"); - hiddenField.setAttribute("value", info['section_name']); - form.appendChild(hiddenField); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "bookName"); - hiddenField.setAttribute("value", info['book_name']); - form.appendChild(hiddenField); } - if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { document.body.appendChild(form); form.submit(); @@ -778,7 +833,13 @@ form.appendChild(hiddenField); _postForContineTagging(form); - + + if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { + document.body.appendChild(form); + form.submit(); + } else { + form.submit(); // works under IE and Chrome, but not FF + } }