From 43d969a72b281473593f99bf10eecef66aa89aa4 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 6 Nov 2012 17:51:42 +0800 Subject: [PATCH 01/15] Fix attribute_field_helper and comment admin in I18n --- app/helpers/admin_helper.rb | 4 +- app/helpers/attribute_fields_helper.rb | 2 +- config/locales/en.yml | 340 ++++++++-------- config/locales/zh_tw.yml | 544 ++++++++++++------------- 4 files changed, 445 insertions(+), 445 deletions(-) diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 31177d706..120e1245e 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -7,12 +7,12 @@ module AdminHelper # Check if the current_user is manager in current module app def is_manager? - @module_app.is_manager?(current_or_guest_user) || is_admin? + (@module_app.is_manager?(current_or_guest_user) rescue nil) || is_admin? end # Check if the current_user is sub manager in current module app def is_sub_manager? - @module_app.is_sub_manager?(current_or_guest_user)|| is_admin? + (@module_app.is_sub_manager?(current_or_guest_user) rescue nil) || is_admin? end def is_admin? diff --git a/app/helpers/attribute_fields_helper.rb b/app/helpers/attribute_fields_helper.rb index 9050b9e6c..c35c7370f 100644 --- a/app/helpers/attribute_fields_helper.rb +++ b/app/helpers/attribute_fields_helper.rb @@ -163,7 +163,7 @@ protected result << "" result << "" result << "" diff --git a/config/locales/en.yml b/config/locales/en.yml index 041e03d73..60dfacbd1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -368,176 +368,176 @@ en: errors: at_least_one: must at least have one value - admin: - access: - denied: - app: - not_sub_manager: Access Denied for you are not SubManager for this app - not_manager: Access Denied for you are not SubManager for this app - not_authed_user: Access Denied for you are not User for this app - not_admin: Access Denied for you are not Admin - object: "Access Denied for you don't have permission for this object" - action: Action - ad_banner: AD Banner - orbit_gallery: Gallery - calendar: Calendar - ad: - sec_place_holder: Enter 3 if 3 sec - ab_fx: FX - all_banners: AdBanner list - banner_best_size: Banner Best Size - best_size: Best size - new_banner: New banner - new_image: New image - showing: Showing - not_showing: NotShowing - picture_list: Picture List - title: Title - transition_sec: Transition time - trans_unit_sec: sec - update_banner: Update Banner - widget_info_for_ad_image_size: "Best size with: %{best_size}" - add: Add - add_item: Add item - add_language: Add language - add_drop_down_item: +Add Menu Item - admin: Admin - action: Action - all_articles: List - always_display_title: Always displayed in the title bar - announcement: Announcement - asset: Asset - assets: - file: File - album: Album - video: Video - book: Book - attributes: Attributes - author: Author - calendar: Calendar - gprs: GPS - cant_delete_self: You can not delete yourself. - cant_revoke_self_admin: You can not revoke your admin role yourself. - category: Category - choose_file: Choose a file... - class: Class - content: Content - create_error_link: Error when creating link. - create_error_page: Error when creating page. - create_success_home: Homepage was successfully created. - create_success_layout: Layout was successfully created. - create_success_link: Link was successfully created. - create_success_page: Page was successfully created. - create_success_snippet: Snippet was successfully created. - create_success_user: User was successfully created. - data: Data - dashboard: Dashboard - delete_language: Delete language - description: Description - design: Template - disable_language: Disable language - editing_home: Editing homepage - editing_layout: Editing layout - editing_link: Editing link - editing_page: Editing page - editing_snippet: Editing snippet - editing_info: Editing user information - editing_role: Editing user role - email: Email - enable_language: Enable language - enabled_for: Enabled for - file_name: Filename - file_size: File size - file_upload: File upload - format: Format - home: Home - id: ID - info: Information - intro: Introduction - is_published: Is published - item: Item - key: Key - keywords: Keywords - language: Language - layout: Layout - layout_name: Layout name - links: Links - link: Links - list_assets: Assets list - list_designs: Designs list - list_items: Items list - list_puchases: Purchases list - list_snippets: Snippets list - list_users: Users list - list_infos: User information list - list_roles: User roles list - mail_address: Address - mail_port: Port - mail_domain: Domain - mail_authentication: Authentication - mail_user_name: User Name - mail_password: Password - mail_tls: TLS - mail_enable_starttls_auto: Enable Start TLS Auto - member: Member - menu_enabled_for: Menu enabled for - module: - authorization: Module Authorization - move_down: Move down - move_up: Move up - multilingual: Multilingual - my_avatar: My Avatar - no_home_page: You don't have a homepage - no_layout: You don't have a layout - name: Name - nccu: NCCU Custom - nccu_c: - nccu_ldap_uid: NCCU LDAP Account - new_asset: New asset - new_component: New component - new_design: New design - new_home: New homepage - new_layout: New layout - new_link: New link - new_page: New page - new_snippet: New snippet - new_user: New user - new_info: New user information - new_role: New user role - news: News - non_multilingual: Non multilingual - object_auth: - list_title_of_users: %{auth_title} Auth List - update_done: Update done,reulst showing in list - update_failed: Update failed - options: Options - orig_upload_file: Original filename - page: Page - page_context: - edit: Edit - ob_auth: - edit: Category authorization - page_part_kinds: - text: Text Area - public_r_tag: System Widget - module_widget: Plug-in Module Widget - position: Position - published?: Published? - purchase: Purchase - registered: Registered - role: Role - roles: Roles - setup_member: Member setup - setup_translations: Translations setup - setup_designs: Designs setup - site: Site - site_description: Site description - site_footer: Site footer - site_settings: Site Setting - site_sub_menu: Site sub-menu - site_title: Site title - super_pages: Super pages - structure: Structure + # admin: + # access: + # denied: + # app: + # not_sub_manager: Access Denied for you are not SubManager for this app + # not_manager: Access Denied for you are not SubManager for this app + # not_authed_user: Access Denied for you are not User for this app + # not_admin: Access Denied for you are not Admin + # object: "Access Denied for you don't have permission for this object" + # action: Action + # ad_banner: AD Banner + # orbit_gallery: Gallery + # calendar: Calendar + # ad: + # sec_place_holder: Enter 3 if 3 sec + # ab_fx: FX + # all_banners: AdBanner list + # banner_best_size: Banner Best Size + # best_size: Best size + # new_banner: New banner + # new_image: New image + # showing: Showing + # not_showing: NotShowing + # picture_list: Picture List + # title: Title + # transition_sec: Transition time + # trans_unit_sec: sec + # update_banner: Update Banner + # widget_info_for_ad_image_size: "Best size with: %{best_size}" + # add: Add + # add_item: Add item + # add_language: Add language + # add_drop_down_item: +Add Menu Item + # admin: Admin + # action: Action + # all_articles: List + # always_display_title: Always displayed in the title bar + # announcement: Announcement + # asset: Asset + # assets: + # file: File + # album: Album + # video: Video + # book: Book + # attributes: Attributes + # author: Author + # calendar: Calendar + # gprs: GPS + # cant_delete_self: You can not delete yourself. + # cant_revoke_self_admin: You can not revoke your admin role yourself. + # category: Category + # choose_file: Choose a file... + # class: Class + # content: Content + # create_error_link: Error when creating link. + # create_error_page: Error when creating page. + # create_success_home: Homepage was successfully created. + # create_success_layout: Layout was successfully created. + # create_success_link: Link was successfully created. + # create_success_page: Page was successfully created. + # create_success_snippet: Snippet was successfully created. + # create_success_user: User was successfully created. + # data: Data + # dashboard: Dashboard + # delete_language: Delete language + # description: Description + # design: Template + # disable_language: Disable language + # editing_home: Editing homepage + # editing_layout: Editing layout + # editing_link: Editing link + # editing_page: Editing page + # editing_snippet: Editing snippet + # editing_info: Editing user information + # editing_role: Editing user role + # email: Email + # enable_language: Enable language + # enabled_for: Enabled for + # file_name: Filename + # file_size: File size + # file_upload: File upload + # format: Format + # home: Home + # id: ID + # info: Information + # intro: Introduction + # is_published: Is published + # item: Item + # key: Key + # keywords: Keywords + # language: Language + # layout: Layout + # layout_name: Layout name + # links: Links + # link: Links + # list_assets: Assets list + # list_designs: Designs list + # list_items: Items list + # list_puchases: Purchases list + # list_snippets: Snippets list + # list_users: Users list + # list_infos: User information list + # list_roles: User roles list + # mail_address: Address + # mail_port: Port + # mail_domain: Domain + # mail_authentication: Authentication + # mail_user_name: User Name + # mail_password: Password + # mail_tls: TLS + # mail_enable_starttls_auto: Enable Start TLS Auto + # member: Member + # menu_enabled_for: Menu enabled for + # module: + # authorization: Module Authorization + # move_down: Move down + # move_up: Move up + # multilingual: Multilingual + # my_avatar: My Avatar + # no_home_page: You don't have a homepage + # no_layout: You don't have a layout + # name: Name + # nccu: NCCU Custom + # nccu_c: + # nccu_ldap_uid: NCCU LDAP Account + # new_asset: New asset + # new_component: New component + # new_design: New design + # new_home: New homepage + # new_layout: New layout + # new_link: New link + # new_page: New page + # new_snippet: New snippet + # new_user: New user + # new_info: New user information + # new_role: New user role + # news: News + # non_multilingual: Non multilingual + # object_auth: + # list_title_of_users: %{auth_title} Auth List + # update_done: Update done,reulst showing in list + # update_failed: Update failed + # options: Options + # orig_upload_file: Original filename + # page: Page + # page_context: + # edit: Edit + # ob_auth: + # edit: Category authorization + # page_part_kinds: + # text: Text Area + # public_r_tag: System Widget + # module_widget: Plug-in Module Widget + # position: Position + # published?: Published? + # purchase: Purchase + # registered: Registered + # role: Role + # roles: Roles + # setup_member: Member setup + # setup_translations: Translations setup + # setup_designs: Designs setup + # site: Site + # site_description: Site description + # site_footer: Site footer + # site_settings: Site Setting + # site_sub_menu: Site sub-menu + # site_title: Site title + # super_pages: Super pages + # structure: Structure # : >>>>>>> various_bugs tags: Tags url: URL diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index efa69994f..86c4f0eaf 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -350,278 +350,278 @@ zh_tw: # : ======= errors: at_least_one: 必須至少有一個值 - admin: - infos: - add_attribute_field: 新增 - save: 儲存 - initial: 起始值 - markup: 輸入模式 - item_name: 資料表名稱 - name: 名稱 - options: 選項 - multilingual: 多語言輸入 - add_more: 使用者可自行延伸欄位 - add: 新增 - placeholder: 輸入協助 - type: 類型 - placeholder: 提示內容 - list: 自定選單 - is_range: 是 - not_range: 否 - date: - claendar: 紀年法 - range: 本欄為時間區段 - format: 格式 - tw_claendar: 民國 - west_claendar: 西元 - access: - denied: - app: - not_sub_manager: 拒絕存取因你不是此應用程式次管理員 - not_manager: 拒絕存取因你不是此應用程式管理員 - not_authed_user: 拒絕存取因你不是此應用程式授權使用者 - not_admin: 拒絕存取因你不是此應用程式次管理員 - object: 拒絕存取因你不是網站管理者 - action: 操作 - ad_banner: 廣告輪播 - orbit_gallery: 活動花絮 - ad: - sec_place_holder: 3秒請輸入3 - ab_fx: 轉場特效 - all_banners: 輪播清單 - banner_best_size: Banner 尺寸 - best_size: 最佳尺寸 - cate_auth: 分類授權 - delete_banner: 刪除整組輪播 - new_banner: 新增輪播 - new_image: 新增橫幅 - showing: 顯示中 - not_showing: 沒有顯示 - picture_list: 圖片列表 - title: 標題 - transition_sec: 轉場單位時間 - trans_unit_sec: 秒 - update_banner: 更新輪播 - widget_info_for_ad_image_size: "此區塊圖片尺寸請使用 %{best_size}" - add: 新增 - add_item: 新增項目 - add_language: 新增語言 - add_drop_down_item: +增加Orbit選單 - admin: 網站管理者 - all_articles: 列表 - always_display_title: 永遠顯示於標題列 - announcement: 公告管理 - asset: 資產 - assets: - file: 檔案 - album: 相簿 - video: 影片 - book: 書籍 - attributes: 屬性 - author: 作者 - calendar: 行事曆 - cant_delete_self: 您不可以刪除自己。 - cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 - category: 類別 - choose_file: 請選擇一個文件... - class: 階級 - content: 內容 - contenteditable: - update_done: 更新完成 - update_failed: 更新失敗 - create_error_link: 新增連接時出錯。 - create_error_page: 新增頁面時出錯。 - create_success_home: 首頁已成功新增。 - create_success_layout: 樣板已成功新增。 - create_success_link: 連結已成功新增。 - create_success_page: 頁面已成功新增。 - create_success_home: 首頁已成功新增。 - create_success_layout: 佈局已成功新增。 - create_success_link: 連結已成功新增。 - create_success_page: 頁面已成功新增。 - create_success_snippet: 片段已成功新增。 - create_success_user: 用戶已成功新增。。 - dashboard: 儀表板 - data: 選擇檔案 - delete_language: 刪除語言 - description: 描述 - design: 版型管理 - disable_language: 禁用語言 - edit: 編輯 - editing_home: 編輯首頁 - editing_layout: 編輯樣板 - editing_link: 編輯連結 - editing_page: 編輯頁面 - editing_snippet: 編輯片段 - editing_info: 編輯用戶資料 - editing_role: 編輯用戶身份 - email: Email - enable_language: 啟用語言 - enabled_for: 啟用 - file_name: 檔名 - file_size: 檔案大小 - file_upload: 文件上載 - format: 格式 - home: 首頁 - id: ID - info: 資料 - intro: 簡介 - is_published: 被出版 - item: 網站架構 - key: 關鍵 - keywords: 關鍵字 - language: 語言 - layout: 佈局 - layout_name: 佈局名字 - link: 連結管理 - links: 網路資源 - list_assets: 資產列表 - list_designs: 設計列表 - list_items: 項目列表 - list_puchases: 購買清單 - list_snippets: 斷片列表 - list_users: 使用列表 - list_infos: 用戶資料列表 - list_roles: 用戶身份列表 - mail_address: 郵件地址 - mail_port: 傳輸埠 - mail_domain: 網域名稱 - mail_authentication: 認證 - mail_user_name: 帳號 - mail_password: 密碼 - mail_tls: TLS - mail_enable_starttls_auto: Enable Start TLS Auto - member: 會員 - menu_enabled_for: 選單啟用 - module: - authorization: 模組授權 - move_down: 往下移 - move_up: 往上移 - multilingual: 多種語言 - my_avatar: 我的頭像 - no_home_page: 您沒有首頁 - no_layout: 您沒有佈局 - name: 名稱 - new_admin: - side_bar: - all_user: 所有使用者 - add_user: 新增使用者 - user_roles: 角色 - user_info: 使用者資訊 - user: 會員 - users: - all_plugin_summary: 全部 - profile: 基本資料 - roles: - staff: 職員資料 - student: 學生資料 - teacher: 教師資料 - action: - add: 新增 - edit: 編輯 - delete: 刪除 - quick_edit: 快速編輯 - next: 下一頁 - prev: 上一頁 - attributes: - roles: 角色 - name: 名稱 - publications: 出版數 - courses: 開課數 - followers: 被關注數 - show_mode: - index: 清單 - summary: 摘要 - thumbnail: 縮圖 - table_header: - status: 狀態 - category: 分類 - tags: 標籤 - clear_filter: 重置 - new_asset: 新增資產 - new_component: 新增元件 - new_design: 新設計 - new_home: 新增首頁 - new_layout: 新增樣板 - new_link: 新增連結 - new_page: 新增頁面 - new_snippet: 新增片段 - new_user: 新增使用 - new_info: 新增用戶資料 - new_role: 新增用戶身份 - news: 新聞 - non_multilingual: - object_auth: - list_title_of_users: 授權清單-%{auth_title} - update_done: 更新完成,結果顯示於清單 - update_failed: 更新失敗 - options: 選項 - orig_upload_file: 原上傳檔名 - page: 頁面管理 - page_context: - edit: 編輯 - ob_auth: - edit: 分類授權 - page_part_kinds: - text: 文字區塊 - public_r_tag: 系統模塊 - module_widget: 外掛模塊 - position: 位置 - published?: 發布? - purchase: 購買 - role: 身份 - roles: 身份 - site_description: 網站描述 - site_footer: 網站頁尾 - site_settings: 基本設定 - site_sub_menu: 網站次選單 - site_title: 網站標題 - setup_member: 成員設置 - setup_translations: 語系設定 - setup_designs: 版型設定 - site: 網站 - site_setting: 網站設定 - super_pages: 可編頁面 - structure: 網站結構 - tags: 標籤 - title: 標題 - translation: 翻譯 - type: 類型 - up_to_date: 最新版本 - update_error_link: 更新鏈接時出現錯誤。 - update_error_page: 更新頁面時出現錯誤。 - update_success_content: 內容已成功更新。 - update_success_home: 首頁已成功更新。 - update_success_layout: 樣板已成功更新。 - update_success_link: 連結已成功更新。 - update_success_page: 頁面已成功更新。 - update_success_snippet: 片段已成功更新。 - update_success_user: 用戶已成功更新 - upload_design: 上傳設計 - url: URL - user: 用戶 - user_new_interface: - sys_basic_form: 系統基本資料表 - password: 密碼 - password_confirmation: 確認密碼 - email: 使用者帳號信箱 - user_role: - auth: - all_member: 所有會員 - manager: 管理員 - sub_manager: 次管理員 - by_role: 根據身份 - by_sub_role: 根據次身份 - block_list: 封鎖名單 - add_manager: 增加到管理員 - add_sub_manager: 增加到次管理員 - add_to_block_list: 封鎖名單 - add_to_privilege_list: 特許名單 - auth_by: -由%{user_display_name}授權 - user: 使用會員 - info: 用戶資料 - panel: 用戶面板 - role: 用戶身份 + # admin: + # infos: + # add_attribute_field: 新增 + # save: 儲存 + # initial: 起始值 + # markup: 輸入模式 + # item_name: 資料表名稱 + # name: 名稱 + # options: 選項 + # multilingual: 多語言輸入 + # add_more: 使用者可自行延伸欄位 + # add: 新增 + # placeholder: 輸入協助 + # type: 類型 + # placeholder: 提示內容 + # list: 自定選單 + # is_range: 是 + # not_range: 否 + # date: + # claendar: 紀年法 + # range: 本欄為時間區段 + # format: 格式 + # tw_claendar: 民國 + # west_claendar: 西元 + # access: + # denied: + # app: + # not_sub_manager: 拒絕存取因你不是此應用程式次管理員 + # not_manager: 拒絕存取因你不是此應用程式管理員 + # not_authed_user: 拒絕存取因你不是此應用程式授權使用者 + # not_admin: 拒絕存取因你不是此應用程式次管理員 + # object: 拒絕存取因你不是網站管理者 + # action: 操作 + # ad_banner: 廣告輪播 + # orbit_gallery: 活動花絮 + # ad: + # sec_place_holder: 3秒請輸入3 + # ab_fx: 轉場特效 + # all_banners: 輪播清單 + # banner_best_size: Banner 尺寸 + # best_size: 最佳尺寸 + # cate_auth: 分類授權 + # delete_banner: 刪除整組輪播 + # new_banner: 新增輪播 + # new_image: 新增橫幅 + # showing: 顯示中 + # not_showing: 沒有顯示 + # picture_list: 圖片列表 + # title: 標題 + # transition_sec: 轉場單位時間 + # trans_unit_sec: 秒 + # update_banner: 更新輪播 + # widget_info_for_ad_image_size: "此區塊圖片尺寸請使用 %{best_size}" + # add: 新增 + # add_item: 新增項目 + # add_language: 新增語言 + # add_drop_down_item: +增加Orbit選單 + # admin: 網站管理者 + # all_articles: 列表 + # always_display_title: 永遠顯示於標題列 + # announcement: 公告管理 + # asset: 資產 + # assets: + # file: 檔案 + # album: 相簿 + # video: 影片 + # book: 書籍 + # attributes: 屬性 + # author: 作者 + # calendar: 行事曆 + # cant_delete_self: 您不可以刪除自己。 + # cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 + # category: 類別 + # choose_file: 請選擇一個文件... + # class: 階級 + # content: 內容 + # contenteditable: + # update_done: 更新完成 + # update_failed: 更新失敗 + # create_error_link: 新增連接時出錯。 + # create_error_page: 新增頁面時出錯。 + # create_success_home: 首頁已成功新增。 + # create_success_layout: 樣板已成功新增。 + # create_success_link: 連結已成功新增。 + # create_success_page: 頁面已成功新增。 + # create_success_home: 首頁已成功新增。 + # create_success_layout: 佈局已成功新增。 + # create_success_link: 連結已成功新增。 + # create_success_page: 頁面已成功新增。 + # create_success_snippet: 片段已成功新增。 + # create_success_user: 用戶已成功新增。。 + # dashboard: 儀表板 + # data: 選擇檔案 + # delete_language: 刪除語言 + # description: 描述 + # design: 版型管理 + # disable_language: 禁用語言 + # edit: 編輯 + # editing_home: 編輯首頁 + # editing_layout: 編輯樣板 + # editing_link: 編輯連結 + # editing_page: 編輯頁面 + # editing_snippet: 編輯片段 + # editing_info: 編輯用戶資料 + # editing_role: 編輯用戶身份 + # email: Email + # enable_language: 啟用語言 + # enabled_for: 啟用 + # file_name: 檔名 + # file_size: 檔案大小 + # file_upload: 文件上載 + # format: 格式 + # home: 首頁 + # id: ID + # info: 資料 + # intro: 簡介 + # is_published: 被出版 + # item: 網站架構 + # key: 關鍵 + # keywords: 關鍵字 + # language: 語言 + # layout: 佈局 + # layout_name: 佈局名字 + # link: 連結管理 + # links: 網路資源 + # list_assets: 資產列表 + # list_designs: 設計列表 + # list_items: 項目列表 + # list_puchases: 購買清單 + # list_snippets: 斷片列表 + # list_users: 使用列表 + # list_infos: 用戶資料列表 + # list_roles: 用戶身份列表 + # mail_address: 郵件地址 + # mail_port: 傳輸埠 + # mail_domain: 網域名稱 + # mail_authentication: 認證 + # mail_user_name: 帳號 + # mail_password: 密碼 + # mail_tls: TLS + # mail_enable_starttls_auto: Enable Start TLS Auto + # member: 會員 + # menu_enabled_for: 選單啟用 + # module: + # authorization: 模組授權 + # move_down: 往下移 + # move_up: 往上移 + # multilingual: 多種語言 + # my_avatar: 我的頭像 + # no_home_page: 您沒有首頁 + # no_layout: 您沒有佈局 + # name: 名稱 + # new_admin: + # side_bar: + # all_user: 所有使用者 + # add_user: 新增使用者 + # user_roles: 角色 + # user_info: 使用者資訊 + # user: 會員 + # users: + # all_plugin_summary: 全部 + # profile: 基本資料 + # roles: + # staff: 職員資料 + # student: 學生資料 + # teacher: 教師資料 + # action: + # add: 新增 + # edit: 編輯 + # delete: 刪除 + # quick_edit: 快速編輯 + # next: 下一頁 + # prev: 上一頁 + # attributes: + # roles: 角色 + # name: 名稱 + # publications: 出版數 + # courses: 開課數 + # followers: 被關注數 + # show_mode: + # index: 清單 + # summary: 摘要 + # thumbnail: 縮圖 + # table_header: + # status: 狀態 + # category: 分類 + # tags: 標籤 + # clear_filter: 重置 + # new_asset: 新增資產 + # new_component: 新增元件 + # new_design: 新設計 + # new_home: 新增首頁 + # new_layout: 新增樣板 + # new_link: 新增連結 + # new_page: 新增頁面 + # new_snippet: 新增片段 + # new_user: 新增使用 + # new_info: 新增用戶資料 + # new_role: 新增用戶身份 + # news: 新聞 + # non_multilingual: + # object_auth: + # list_title_of_users: 授權清單-%{auth_title} + # update_done: 更新完成,結果顯示於清單 + # update_failed: 更新失敗 + # options: 選項 + # orig_upload_file: 原上傳檔名 + # page: 頁面管理 + # page_context: + # edit: 編輯 + # ob_auth: + # edit: 分類授權 + # page_part_kinds: + # text: 文字區塊 + # public_r_tag: 系統模塊 + # module_widget: 外掛模塊 + # position: 位置 + # published?: 發布? + # purchase: 購買 + # role: 身份 + # roles: 身份 + # site_description: 網站描述 + # site_footer: 網站頁尾 + # site_settings: 基本設定 + # site_sub_menu: 網站次選單 + # site_title: 網站標題 + # setup_member: 成員設置 + # setup_translations: 語系設定 + # setup_designs: 版型設定 + # site: 網站 + # site_setting: 網站設定 + # super_pages: 可編頁面 + # structure: 網站結構 + # tags: 標籤 + # title: 標題 + # translation: 翻譯 + # type: 類型 + # up_to_date: 最新版本 + # update_error_link: 更新鏈接時出現錯誤。 + # update_error_page: 更新頁面時出現錯誤。 + # update_success_content: 內容已成功更新。 + # update_success_home: 首頁已成功更新。 + # update_success_layout: 樣板已成功更新。 + # update_success_link: 連結已成功更新。 + # update_success_page: 頁面已成功更新。 + # update_success_snippet: 片段已成功更新。 + # update_success_user: 用戶已成功更新 + # upload_design: 上傳設計 + # url: URL + # user: 用戶 + # user_new_interface: + # sys_basic_form: 系統基本資料表 + # password: 密碼 + # password_confirmation: 確認密碼 + # email: 使用者帳號信箱 + # user_role: + # auth: + # all_member: 所有會員 + # manager: 管理員 + # sub_manager: 次管理員 + # by_role: 根據身份 + # by_sub_role: 根據次身份 + # block_list: 封鎖名單 + # add_manager: 增加到管理員 + # add_sub_manager: 增加到次管理員 + # add_to_block_list: 封鎖名單 + # add_to_privilege_list: 特許名單 + # auth_by: -由%{user_display_name}授權 + # user: 使用會員 + # info: 用戶資料 + # panel: 用戶面板 + # role: 用戶身份 dashboard: bulletin: 公告 From b4f5a0b04b7642ad8a902fe6194f56886c979ff9 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 8 Nov 2012 01:24:01 +0800 Subject: [PATCH 02/15] all of user can get json of gallery from outside --- .../gallery/back_end/albums_controller.rb | 348 +++++++++--------- .../built_in_modules/gallery/config/routes.rb | 96 +++-- 2 files changed, 224 insertions(+), 220 deletions(-) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index 59c251a40..0c2034599 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -1,185 +1,191 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController -include AdminHelper - - # before_filter :force_order_for_visitor,:only=>[:index] - before_filter :force_order_for_user#,:except => [:index] + include AdminHelper - def index - if is_manager? || is_admin? || is_sub_manager? - @authenticated = true #turn this value to false for view only - else - @authenticated = false - end - @categorylist = GalleryCategory.all - @cid = params['cat'] - @tags = GalleryTag.all - end + before_filter :force_order_for_user, :except => [:index,:imgs] - def show - if is_manager? || is_admin? || is_sub_manager? - @authenticated = true #turn this value to false for view only - else - @authenticated = false - end - @album = GalleryAlbum.find(params[:id]) - @tags = GalleryTag.all - end + def index + if is_manager? || is_admin? || is_sub_manager? + @authenticated = true #turn this value to false for view only + else + @authenticated = false + end + @categorylist = GalleryCategory.all + @cid = params['cat'] + @tags = GalleryTag.all + end - def new - if is_manager? || is_admin? - @categorylist = GalleryCategory.all - elsif is_sub_manager? - @categorylist = GalleryCategory.authed_for_user(current_user,"new_album") - end - @album = GalleryAlbum.new - render :layout => false - end + def show + if is_manager? || is_admin? || is_sub_manager? + @authenticated = true #turn this value to false for view only + else + @authenticated = false + end + @album = GalleryAlbum.find(params[:id]) + @tags = GalleryTag.all + end - def create - album = GalleryAlbum.new(params[:gallery_album]) - album.save! - respond_to do |h| - h.js - end - end + def new + if is_manager? || is_admin? + @categorylist = GalleryCategory.all + elsif is_sub_manager? + @categorylist = GalleryCategory.authed_for_user(current_user,"new_album") + end + @album = GalleryAlbum.new + render :layout => false + end - def get_albums - @categoryids = params["cid"] - @tags = params["tid"] - @albums = Array.new - if @categoryids == "all" - if @tags - if @tags.kind_of?(Array) - @tags.each do |tag| - @albums << GalleryAlbum.where(tag_ids: tag) - end - else - @albums << GalleryAlbum.where(tag_ids: @tags) - end - else - @albums << GalleryAlbum.all - end - else - @categoryids.each do |id| - category = GalleryCategory.find(id) - if @tags - if @tags.kind_of?(Array) - @tags.each do |tag| - @albums << category.gallery_albums.where(tag_ids: tag) - end - else - @albums << category.gallery_albums.where(tag_ids: @tags) - end - else - @albums << category.gallery_albums.all - end - end - end - @output = Array.new - @albums.each do |album| - @albs = Array.new - album.each do |values| - tags = Array.new - values.tag_ids.each do |tag| - tags << GalleryTag.find(tag)[I18n.locale] - end - category = GalleryCategory.find(values.gallery_category_id).name - @albs << {"_id"=>values.id,"show_path"=>panel_gallery_back_end_album_path(values),"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags} - end - @output << @albs - end - render :json=>@output.to_json - end + def create + album = GalleryAlbum.new(params[:gallery_album]) + album.save! + respond_to do |h| + h.js + end + end - def destroy - album = GalleryAlbum.find(params[:id]) - album.delete - render :json =>{"success"=>true}.to_json - end + def get_albums + @categoryids = params["cid"] + @tags = params["tid"] + @albums = Array.new + if @categoryids == "all" + if @tags + if @tags.kind_of?(Array) + @tags.each do |tag| + @albums << GalleryAlbum.where(tag_ids: tag) + end + else + @albums << GalleryAlbum.where(tag_ids: @tags) + end + else + @albums << GalleryAlbum.all + end + else + @categoryids.each do |id| + category = GalleryCategory.find(id) + if @tags + if @tags.kind_of?(Array) + @tags.each do |tag| + @albums << category.gallery_albums.where(tag_ids: tag) + end + else + @albums << category.gallery_albums.where(tag_ids: @tags) + end + else + @albums << category.gallery_albums.all + end + end + end + @output = Array.new + @albums.each do |album| + @albs = Array.new + album.each do |values| + tags = Array.new + values.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + category = GalleryCategory.find(values.gallery_category_id).name + @albs << {"_id"=>values.id,"show_path"=>panel_gallery_back_end_album_path(values),"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags} + end + @output << @albs + end + render :json=>@output.to_json + end - def edit - if is_manager? || is_admin? || is_sub_manager? - @album = GalleryAlbum.find(params[:id]) - @images = @album.gallery_images.all - @album_name = @album.name_translations - @cover = @album.cover - @tags = GalleryTag.all - end - end + def destroy + album = GalleryAlbum.find(params[:id]) + album.delete + render :json =>{"success"=>true}.to_json + end - def set_cover - album = GalleryAlbum.find(params[:album_id]) - image = GalleryImage.find(params[:imageid]) - album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]}) - render :json =>{"success"=>true}.to_json - end + def edit + if is_manager? || is_admin? || is_sub_manager? + @album = GalleryAlbum.find(params[:id]) + @images = @album.gallery_images.all + @album_name = @album.name_translations + @cover = @album.cover + @tags = GalleryTag.all + end + end - def imgs - @album = GalleryAlbum.find(params[:album_id]) - @tag_names = Array.new - @images = @album.gallery_images.all - @output = Array.new - @images.each do |values| - tags = Array.new - values.tag_ids.each do |tag| - tags << GalleryTag.find(tag)[I18n.locale] - end - @output << {"_id"=>values.id,"theater_link"=>panel_gallery_back_end_album_image_path(values),"description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags} - end - if is_manager? || is_admin? || is_sub_manager? - @authenticated = true #turn this value to false for view only - else - @authenticated = false - end - if @authenticated - render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json - else - @album.tag_ids.each do |tag| - @tag_names << GalleryTag.find(tag)[I18n.locale] - end - render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json - end - end - def upload_panel - @album = GalleryAlbum.find(params[:album_id]) - render :layout => false - end - def upload_image - @album = GalleryAlbum.find(params[:album_id]) - @files = params['files'] - a = Array.new - @files.each do |file| - @image = @album.gallery_images.new - @image.file = file - @image.save! - a << {"thumbnail_url"=>@image.file.thumb.url} - end - render :json=>a.to_json - end - def images_tags - album = GalleryAlbum.find(params[:album_id]) - tags = Array.new - images = album.gallery_images.all - images.each do |image| - tags << {"id"=>image.id, "tags" => image.tag_ids} - end - render :json=>tags.to_json - end + def set_cover + album = GalleryAlbum.find(params[:album_id]) + image = GalleryImage.find(params[:imageid]) + album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]}) + render :json =>{"success"=>true}.to_json + end - def update - @album = GalleryAlbum.find(params[:id]) - @album.update_attributes(params[:gallery_album]) - if is_manager? || is_admin? || is_sub_manager? - @authenticated = true #turn this value to false for view only - else - @authenticated = false - end - if params['delete_cover'] == "true" - @album.update_attributes(:cover=>"default") - end - @tags = GalleryTag.all - render :action => :show - end + def imgs + @album = GalleryAlbum.find(params[:album_id]) + @tag_names = Array.new + @images = @album.gallery_images.all + @output = Array.new + @images.each do |values| + tags = Array.new + values.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + @output << { _id: values.id, + theater_link: panel_gallery_back_end_album_image_path(values), + description: values.description, + title: values.title, + file: values.file, + gallery_album_id: values.gallery_album_id, + tag_ids: values.tag_ids, + tag_names: tags} + end + if is_manager? || is_admin? || is_sub_manager? + @authenticated = true #turn this value to false for view only + else + @authenticated = false + end + if @authenticated + render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json + else + @album.tag_ids.each do |tag| + @tag_names << GalleryTag.find(tag)[I18n.locale] + end + render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json + end + end + def upload_panel + @album = GalleryAlbum.find(params[:album_id]) + render :layout => false + end + def upload_image + @album = GalleryAlbum.find(params[:album_id]) + @files = params['files'] + a = Array.new + @files.each do |file| + @image = @album.gallery_images.new + @image.file = file + @image.save! + a << {"thumbnail_url"=>@image.file.thumb.url} + end + render :json=>a.to_json + end + def images_tags + album = GalleryAlbum.find(params[:album_id]) + tags = Array.new + images = album.gallery_images.all + images.each do |image| + tags << {"id"=>image.id, "tags" => image.tag_ids} + end + render :json=>tags.to_json + end + + def update + @album = GalleryAlbum.find(params[:id]) + @album.update_attributes(params[:gallery_album]) + if is_manager? || is_admin? || is_sub_manager? + @authenticated = true #turn this value to false for view only + else + @authenticated = false + end + if params['delete_cover'] == "true" + @album.update_attributes(:cover=>"default") + end + @tags = GalleryTag.all + render :action => :show + end end diff --git a/vendor/built_in_modules/gallery/config/routes.rb b/vendor/built_in_modules/gallery/config/routes.rb index 77de541ed..b8c64f3c2 100644 --- a/vendor/built_in_modules/gallery/config/routes.rb +++ b/vendor/built_in_modules/gallery/config/routes.rb @@ -1,54 +1,52 @@ Rails.application.routes.draw do - namespace :panel do - namespace :gallery do - namespace :back_end do - match "get_albums" => "albums#get_albums" - match "upload_image" => "albums#upload_image" - match "save_tags" => "tags#save_tags" - match "albums/save_tags" => "tags#save_tags" - resources :albums do - match "set_cover" => "albums#set_cover" - match "imgs" => "albums#imgs" - match "upload_panel" => "albums#upload_panel" - match "images_tags" => "albums#images_tags" - end + namespace :panel do + namespace :gallery do + namespace :back_end do + match "get_albums" => "albums#get_albums" + match "upload_image" => "albums#upload_image" + match "save_tags" => "tags#save_tags" + match "albums/save_tags" => "tags#save_tags" + resources :albums do + match "set_cover" => "albums#set_cover" + match "imgs" => "albums#imgs" + match "upload_panel" => "albums#upload_panel" + match "images_tags" => "albums#images_tags" + end - match "album_images/#!/:id" => "album_images#show" - - resources :album_images + match "album_images/#!/:id" => "album_images#show" + resources :album_images + resources :gallery_categories + resources :tags - resources :gallery_categories - resources :tags - - end - namespace :front_end do - match "get_albums" => "albums#get_albums" - # match "orbit_galleries" => "orbit_galleries#index" - # match "gallery_category_save" => "orbit_galleries#new_category" - # match "categorylist" => "orbit_galleries#categorylist" - # match "gallery_category_delete" => "orbit_galleries#gallery_category_delete" - # match "add_album" => "orbit_galleries#add_album" - # match "create_album" => "orbit_galleries#create_album" - # match "get_albums" => "orbit_galleries#get_albums" - # match "upload_image" => "orbit_galleries#upload_image" - # match "upload_panel" => "orbit_galleries#upload_panel" - # match "get_images" => "orbit_galleries#get_images" - # match "theater" => "orbit_galleries#theater" - # match "delete_album" => "orbit_galleries#delete_album" - # match "edit_album" => "orbit_galleries#edit_album" - # match "set_cover" => "orbit_galleries#set_cover" - # match "delete_images" => "orbit_galleries#delete_images" - # match "update_album" => "orbit_galleries#update_album" - # match "save_tags" => "orbit_galleries#save_tags" - resources :albums do - member do - get "imgs" - get "theater" - end - end - resources :album_images - end - end - end + end + namespace :front_end do + match "get_albums" => "albums#get_albums" + # match "orbit_galleries" => "orbit_galleries#index" + # match "gallery_category_save" => "orbit_galleries#new_category" + # match "categorylist" => "orbit_galleries#categorylist" + # match "gallery_category_delete" => "orbit_galleries#gallery_category_delete" + # match "add_album" => "orbit_galleries#add_album" + # match "create_album" => "orbit_galleries#create_album" + # match "get_albums" => "orbit_galleries#get_albums" + # match "upload_image" => "orbit_galleries#upload_image" + # match "upload_panel" => "orbit_galleries#upload_panel" + # match "get_images" => "orbit_galleries#get_images" + # match "theater" => "orbit_galleries#theater" + # match "delete_album" => "orbit_galleries#delete_album" + # match "edit_album" => "orbit_galleries#edit_album" + # match "set_cover" => "orbit_galleries#set_cover" + # match "delete_images" => "orbit_galleries#delete_images" + # match "update_album" => "orbit_galleries#update_album" + # match "save_tags" => "orbit_galleries#save_tags" + resources :albums do + member do + get "imgs" + get "theater" + end + end + resources :album_images + end + end + end end From 11fefa100fd9df70d557e7312a28294254c4a0a1 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 8 Nov 2012 01:24:37 +0800 Subject: [PATCH 03/15] all of user can get json of gprs from outside --- .../gprs/back_end/locations_controller.rb | 92 ++++++++++++++----- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb index c09b13796..1aff62230 100644 --- a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb +++ b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb @@ -1,29 +1,73 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController - - def index - @newlocation = Location.new - end - def create - debugger - @newlocation = Location.new(params[:location]) - @newlocation.save! - render :action => "index" - end + before_filter :clean_values, :only => [:create, :update] - def get_locations - locations = Location.all - @data = Array.new + before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete] + before_filter :force_order_for_user,:except => :get_locations + before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations] - locations.each do |location| - picurl = "http://"+request.host + location.file.url - thumburl = "http://"+request.host + location.file.thumb.url - @data << {"name"=>location.name,"pic_url"=>picurl,"thumb_url"=>thumburl,"description"=>location.description} - end - render :json => @data.to_json - end - + def index + @locations = Location.all + respond_to do |format| + format.html # new.html.erb + format.json { render json: @locations } + end + end + + def new + @location = Location.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @location } + end + end + + def edit + @location = Location.find(params[:id]) + end + + def show + @location = Location..find(params[:id]) + respond_to do |format| + format.html + format.json { render json: @location } + end + end + + def create + debugger + @location = Location.new(params[:location]) + if @location.save + format.html { redirect_to @location } + format.json { render json: @location, status: :created, location: @location } + end + #render :action => "new" + end + + def destroy + @location = Location..find(params[:id]) + @location.destroy + + respond_to do |format| + format.json { head :no_content } + end + end + + def get_locations + locations = Location.all + @data = Array.new + + locations.each do |location| + picurl = "http://"+request.host + location.file.url + thumburl = "http://"+request.host + location.file.thumb.url + @data << { name: location.name, + pic_url: picurl, + thumb_url: thumburl, + longitude: location.longitude, + latitude: location.latitude, + description: location.description } + end + render :json => @data.to_json + end end - - - From dbfc70e5201f899c286589cacaddcdefcb1bde07 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 8 Nov 2012 01:26:33 +0800 Subject: [PATCH 04/15] Refine the location module, but it have some bugs about path ... --- .../panel/gprs/back_end/locations.js | 2 + .../panel/gprs/back_end/locations.css | 4 ++ .../panel/gprs/back_end/locations_helper.rb | 2 + .../gprs/app/models/location.rb | 17 +++-- .../gprs/back_end/locations/_form.html.erb | 34 ++++++++++ .../gprs/back_end/locations/edit.html.erb | 2 + .../gprs/back_end/locations/index.html.erb | 68 ++++++++----------- .../gprs/back_end/locations/new.html.erb | 1 + .../gprs/back_end/locations/show.html.erb | 0 vendor/built_in_modules/gprs/config/routes.rb | 18 +++-- .../back_end/locations_controller_test.rb | 14 ++++ .../gprs/back_end/locations_helper_test.rb | 4 ++ 12 files changed, 106 insertions(+), 60 deletions(-) create mode 100644 vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js create mode 100644 vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css create mode 100644 vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb create mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb create mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb create mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb create mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb create mode 100644 vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb create mode 100644 vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb diff --git a/vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js b/vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css b/vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb b/vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb new file mode 100644 index 000000000..50985d545 --- /dev/null +++ b/vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb @@ -0,0 +1,2 @@ +module Panel::Gprs::BackEnd::LocationsHelper +end diff --git a/vendor/built_in_modules/gprs/app/models/location.rb b/vendor/built_in_modules/gprs/app/models/location.rb index 2f955205e..f6455920b 100644 --- a/vendor/built_in_modules/gprs/app/models/location.rb +++ b/vendor/built_in_modules/gprs/app/models/location.rb @@ -1,12 +1,11 @@ class Location - include Mongoid::Document - include Mongoid::Timestamps + include Mongoid::Document + include Mongoid::Timestamps - mount_uploader :file, GprsUploader + mount_uploader :file, GprsUploader - field :name - field :description - field :longitude, type: Float - field :latitude, type: Float - -end \ No newline at end of file + field :name + field :description + field :longitude, type: Float + field :latitude, type: Float +end diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb new file mode 100644 index 000000000..efda0d9e5 --- /dev/null +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb @@ -0,0 +1,34 @@ +<%= form_for @location, :url => 'panel_gprs_back_end_locations_path' ,:class=>"form-horizontal" do |f| %> +
+ +
+ <%= f.text_field :name, :class=>"span4", :placeholder => "Area" %> +
+
+
+ +
+ <%= f.file_field :file %> +
+
+
+ +
+ <%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %> + <%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %> +
+
+
+ +
+ <%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %> +
+
+
+
+ <%= f.submit "Save", :class=>"btn" %> +
+
+ <% end %> + + diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb new file mode 100644 index 000000000..37afa8054 --- /dev/null +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb @@ -0,0 +1,2 @@ +<%= render 'form' %> + diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb index 912c0184f..78dd48a82 100644 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb @@ -1,42 +1,28 @@ + + + + + + + + + + + + + + <% @locations.each do |location| %> + + + + + + + + + <% end %> + +
<%= t('location.picture') %><%= t('location.name') %><%= t('location.longitude') %><%= t('location.latitude') %><%= t('location.description') %><%= t('location.edit') %><%= t('location.delete') %>
<%= image_tag(location.file, alt: location.file, size: "50x50" )%><%= location.name%><%= location.longitude%><%= location.latitude%><%= location.description%><%= link_to 'Edit', edit_panel_gprs_back_end_locations_path(location) %><%= link_to 'Destroy', location, method: :delete %> +
- -<%= form_for @newlocation, :url=>{:action => "create"}, :remote => true, :class=>"form-horizontal" do |f| %> -
- -
- - <%= f.text_field :name, :class=>"span4", :placeholder => "Area" %> -
-
-
- -
- - <%= f.file_field :file %> -
-
-
- -
- - <%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %> - <%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %> - - -
-
-
- -
- - <%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %> -
-
-
-
- - <%= f.submit "Save", :class=>"btn" %> -
-
- <% end %> - \ No newline at end of file +<%= link_to 'New', new_panel_gprs_back_end_locations_path %> diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb new file mode 100644 index 000000000..2d3436368 --- /dev/null +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb @@ -0,0 +1 @@ +<%= render 'form' %> diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/gprs/config/routes.rb b/vendor/built_in_modules/gprs/config/routes.rb index 050b2cbda..0ba8a27cb 100644 --- a/vendor/built_in_modules/gprs/config/routes.rb +++ b/vendor/built_in_modules/gprs/config/routes.rb @@ -1,14 +1,12 @@ Rails.application.routes.draw do - namespace :panel do - namespace :gprs do - namespace :back_end do + namespace :panel do + namespace :gprs do + namespace :back_end do - match "locations/get_locations" => "locations#get_locations" - - resources :locations - - end - end - end + match "locations/get_locations" => "locations#get_locations" + resources :locations + end + end + end end diff --git a/vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb b/vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb new file mode 100644 index 000000000..bb6d0908b --- /dev/null +++ b/vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb @@ -0,0 +1,14 @@ +require 'test_helper' + +class Panel::Gprs::BackEnd::LocationsControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + + test "should get edit" do + get :edit + assert_response :success + end + +end diff --git a/vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb b/vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb new file mode 100644 index 000000000..e1302ea29 --- /dev/null +++ b/vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class Panel::Gprs::BackEnd::LocationsHelperTest < ActionView::TestCase +end From e6a9555dd88d884492ef526ac27b6f261694dd82 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 8 Nov 2012 12:34:26 +0800 Subject: [PATCH 05/15] refine the location module done --- .../gprs/back_end/locations_controller.rb | 26 +++++++++---------- .../gprs/back_end/locations/_form.html.erb | 4 --- .../gprs/back_end/locations/edit.html.erb | 4 ++- .../gprs/back_end/locations/index.html.erb | 6 ++--- .../gprs/back_end/locations/new.html.erb | 4 ++- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb index 1aff62230..3a5a6ea4f 100644 --- a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb +++ b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb @@ -1,10 +1,10 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController - before_filter :clean_values, :only => [:create, :update] + #before_filter :clean_values, :only => [:create, :update] before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete] before_filter :force_order_for_user,:except => :get_locations - before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations] + #before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations] def index @locations = Location.all @@ -28,7 +28,7 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController end def show - @location = Location..find(params[:id]) + @location = Location.find(params[:id]) respond_to do |format| format.html format.json { render json: @location } @@ -36,22 +36,22 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController end def create - debugger @location = Location.new(params[:location]) - if @location.save - format.html { redirect_to @location } - format.json { render json: @location, status: :created, location: @location } - end - #render :action => "new" + @location.save! + redirect_to panel_gprs_back_end_locations_url + end + + def update + @location = Location.find(params[:id]) + @location.update_attributes(params[:location]) + redirect_to panel_gprs_back_end_locations_url end def destroy - @location = Location..find(params[:id]) + @location = Location.find(params[:id]) @location.destroy + redirect_to panel_gprs_back_end_locations_url - respond_to do |format| - format.json { head :no_content } - end end def get_locations diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb index efda0d9e5..62e8b21b3 100644 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb @@ -1,4 +1,3 @@ -<%= form_for @location, :url => 'panel_gprs_back_end_locations_path' ,:class=>"form-horizontal" do |f| %>
@@ -29,6 +28,3 @@ <%= f.submit "Save", :class=>"btn" %>
- <% end %> - - diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb index 37afa8054..82a59afad 100644 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb @@ -1,2 +1,4 @@ -<%= render 'form' %> +<%= form_for @location, :url=> panel_gprs_back_end_location_path(@location), :html => { :class=>"form-horizontal"} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb index 78dd48a82..6731688d2 100644 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb @@ -18,11 +18,11 @@ <%= location.longitude%> <%= location.latitude%> <%= location.description%> - <%= link_to 'Edit', edit_panel_gprs_back_end_locations_path(location) %> - <%= link_to 'Destroy', location, method: :delete %> + <%= link_to 'Edit', edit_panel_gprs_back_end_location_path(location) %> + <%= link_to 'Destroy', panel_gprs_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %> <% end %> -<%= link_to 'New', new_panel_gprs_back_end_locations_path %> +<%= link_to 'New', new_panel_gprs_back_end_location_path %> diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb index 2d3436368..4f911d839 100644 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb +++ b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb @@ -1 +1,3 @@ -<%= render 'form' %> +<%= form_for @location, :url=> panel_gprs_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> From 800279ea6924b96e60f6e791230a8032b158b9b2 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 8 Nov 2012 15:56:14 +0800 Subject: [PATCH 06/15] add get_bulletins_json function --- .../back_end/bulletins_controller.rb | 321 +++++++++--------- .../announcement/config/routes.rb | 14 +- 2 files changed, 175 insertions(+), 160 deletions(-) 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 b6c0703d1..c4c4606f4 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 @@ -4,11 +4,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController before_filter :clean_values, :only => [:create, :update] -# before_filter :for_admin_only,:only => [:] -# before_filter :for_app_manager,:only => [:index,:show,] + # before_filter :for_admin_only,:only => [:] + # before_filter :for_app_manager,:only => [:index,:show,] before_filter :force_order_for_visitor,:only=>[:index,:show,:get_sorted_and_filtered_bulletins] - before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_bulletins] - before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins] + before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_bulletins,:get_bulletins_json] + before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins,:get_bulletins_json] before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| controller.get_categorys('BulletinCategory') @@ -22,6 +22,28 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController render '/shared/preview/preview.html.erb',:layout=>false end + def get_bulletins_json + @bulletins = Bulletin.all + @data = Hash.new + @data[I18n.t("category")] = Hash.new + + @bulletins.each do |b| + deadline = b.deadline + + if not deadline.nil? + deadline = display_date_time(deadline) + else + deadline = I18n.t("no_deadline") + end + @data[I18n.t("category")][b.bulletin_category.title] = { title: b.title, + postdate: display_date_time(b.postdate), + deadline: deadline, + tag: b.sorted_tags.to_a, + } + end + render :json => @data.to_json + end + def index # @bulletins = Bulletin.all # @bulletins = Bulletin.desc("postdate desc") @@ -52,10 +74,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin_link = BulletinLink.new @link_url = panel_announcement_back_end_bulletins_path - + @bulletin_file = BulletinFile.new @file_url = panel_announcement_back_end_bulletins_path - + respond_to do |format| format.html # index.html.erb format.js { } @@ -84,13 +106,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin = session[:in_validate_object] session[:in_validate_object] = {} end - + @link_url = panel_announcement_back_end_bulletins_path get_tags respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @bulletin } - end + format.html # new.html.erb + format.xml { render :xml => @bulletin } + end end # GET /bulletins/1/edit @@ -100,85 +122,82 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController redirect_to :action => :index else # @summary_variable = @bulletin.summary_variable - - @link_url = panel_announcement_back_end_bulletin_path(@bulletin) - - get_tags + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + + get_tags end end # POST /bulletins # POST /bulletins.xml def create - get_tags - if params[:bulletin_link] - - @bulletin_link = BulletinLink.new(params[:bulletin_link]) + get_tags + if params[:bulletin_link] - respond_to do |format| - if @bulletin_link.save - format.js { render 'create_bulletin_link' } - end - end - - elsif params[:bulletin_file] - - @bulletin_file = BulletinFile.new(params[:bulletin_file]) + @bulletin_link = BulletinLink.new(params[:bulletin_link]) - respond_to do |format| - if @bulletin_file.save - format.js { render 'create_bulletin_file' } - end - end - - else - - @bulletin = Bulletin.new(params[:bulletin]) - @bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil) - - @bulletin.create_user_id = current_user.id - @bulletin.update_user_id = current_user.id - if(is_manager? || is_admin?) - @bulletin.is_checked = true - @bulletin.is_rejected = false - @bulletin.de_pending - end + respond_to do |format| + if @bulletin_link.save + format.js { render 'create_bulletin_link' } + end + end - respond_to do |format| - if @bulletin.save - - format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) } - format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } - # format.js - format.js { - @info = {"success"=>"true","redirect_url"=>panel_announcement_back_end_bulletins_url} - flash[:notice] = t('bulletin.create_bulletin_success') - render "/shared/preview/after_create.js.erb" - } - else - format.html { render :action => "new" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - format.js { - @info = {"success"=>"false","redirect_url"=>new_panel_announcement_back_end_bulletin_url(:bulletin => @bulletin)} - session[:in_validate_object] = @bulletin - render "/shared/preview/after_create.js.erb" - } - end - end - - end - + elsif params[:bulletin_file] + + @bulletin_file = BulletinFile.new(params[:bulletin_file]) + + respond_to do |format| + if @bulletin_file.save + format.js { render 'create_bulletin_file' } + end + end + + else + + @bulletin = Bulletin.new(params[:bulletin]) + @bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil) + + @bulletin.create_user_id = current_user.id + @bulletin.update_user_id = current_user.id + if(is_manager? || is_admin?) + @bulletin.is_checked = true + @bulletin.is_rejected = false + @bulletin.de_pending + end + + respond_to do |format| + if @bulletin.save + + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) } + format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } + # format.js + format.js { + @info = {"success"=>"true","redirect_url"=>panel_announcement_back_end_bulletins_url} + flash[:notice] = t('bulletin.create_bulletin_success') + render "/shared/preview/after_create.js.erb" + } + else + format.html { render :action => "new" } + format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } + format.js { + @info = {"success"=>"false","redirect_url"=>new_panel_announcement_back_end_bulletin_url(:bulletin => @bulletin)} + session[:in_validate_object] = @bulletin + render "/shared/preview/after_create.js.erb" + } + end + end + end end - def link_quick_add + def link_quick_add @bulletin_link = BulletinLink.new @link_url = panel_announcement_back_end_bulletins_path @bulletin_link.bulletin_id = params[:bulletin_id] - + respond_to do |format| format.js end - end def link_quick_edit @@ -189,14 +208,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end end - def file_quick_add + def file_quick_add @bulletin_file = BulletinFile.new @file_url = panel_announcement_back_end_bulletins_path @bulletin_file.bulletin_id = params[:bulletin_id] respond_to do |format| format.js end - end def file_quick_edit @@ -211,75 +229,71 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # PUT /bulletins/1.xml def update - if params[:bulletin_link] - - @bulletin_link = BulletinLink.find(params[:id]) + if params[:bulletin_link] - @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) + @bulletin_link = BulletinLink.find(params[:id]) + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) - respond_to do |format| - - if @bulletin_link.update_attributes(params[:bulletin_link]) - # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - format.js { render 'update_bulletin_link' } - end - end - - elsif params[:bulletin_file] - - @bulletin_file = BulletinFile.find(params[:id]) - - @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) + respond_to do |format| + if @bulletin_link.update_attributes(params[:bulletin_link]) + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js { render 'update_bulletin_link' } + end + end - respond_to do |format| - - if @bulletin_file.update_attributes(params[:bulletin_file]) - # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - format.js { render 'update_bulletin_file' } - end - end - - else - - @bulletin = Bulletin.find(params[:id]) - - # @bulletin.image.clear if params[:bulletin][:image_del] == '1' - # if params[:bulletin][:image_del] == '1' - # @bulletin.remove_image! - # @bulletin.image_del = nil - # params[:bulletin][:image_del] = nil - # end + elsif params[:bulletin_file] + + @bulletin_file = BulletinFile.find(params[:id]) + @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) + respond_to do |format| + + if @bulletin_file.update_attributes(params[:bulletin_file]) + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js { render 'update_bulletin_file' } + end + end + + else + + @bulletin = Bulletin.find(params[:id]) + + # @bulletin.image.clear if params[:bulletin][:image_del] == '1' + # if params[:bulletin][:image_del] == '1' + # @bulletin.remove_image! + # @bulletin.image_del = nil + # params[:bulletin][:image_del] = nil + # end - delete_out_invalid_date_from_params - respond_to do |format| - - if @bulletin.update_attributes(params[:bulletin]) - if(is_manager? || is_admin?) - @bulletin.is_checked = true - @bulletin.is_rejected = false - @bulletin.de_pending! - end - # if (params[:bulletin][:is_checked] == "false") - # @bulletin.is_rejected = true - # @bulletin.save! - # end - # if (@bulletin.deadline < @bulletin.postdate rescue nil) - # @bulletin.deadline = nil - # @bulletin.update_user_id = current_user.id - # @bulletin.save! - # end - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } - format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } - format.js { render 'toggle_enable' } - format.xml { head :ok } - else - get_tags - format.html { render :action => "edit" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - end - end - + delete_out_invalid_date_from_params + respond_to do |format| + + if @bulletin.update_attributes(params[:bulletin]) + if(is_manager? || is_admin?) + @bulletin.is_checked = true + @bulletin.is_rejected = false + @bulletin.de_pending! + end + # if (params[:bulletin][:is_checked] == "false") + # @bulletin.is_rejected = true + # @bulletin.save! + # end + # if (@bulletin.deadline < @bulletin.postdate rescue nil) + # @bulletin.deadline = nil + # @bulletin.update_user_id = current_user.id + # @bulletin.save! + # end + # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } + format.js { render 'toggle_enable' } + format.xml { head :ok } + else + get_tags + format.html { render :action => "edit" } + format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } + end + end + end end @@ -291,7 +305,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin.destroy respond_to do |format| - + format.html { redirect_to(panel_announcement_back_end_bulletins_url) } # format.xml { head :ok } format.js @@ -299,21 +313,21 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end # def top_edit - - # Bulletin.where(id: params[:id]).update_all( is_top: true ) - # respond_to do |format| - # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - # format.xml { head :ok } - # end - + + # Bulletin.where(id: params[:id]).update_all( is_top: true ) + # respond_to do |format| + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + # format.xml { head :ok } # end - + + # end + def load_quick_edit @bulletin = Bulletin.find(params[:id]) @type = params[:type] @bulletin_categories = BulletinCategory.all - #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 + #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 get_tags end @@ -325,9 +339,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) end - + protected - + def delete_out_invalid_date_from_params if((params[:bulletin]["deadline(1i)"] && params[:bulletin]["deadline(1i)"].blank?) or (params[:bulletin]["deadline(2i)"] && params[:bulletin]["deadline(2i)"].blank?) or (params[:bulletin]["deadline(3i)"] && params[:bulletin]["deadline(3i)"].blank?)) params[:bulletin].delete("deadline(1i)") @@ -361,10 +375,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # redirect_to :action => :index # end # end - + def get_tags - module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) - @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) rescue [] + module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) rescue [] end def clean_values @@ -377,5 +391,4 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end rescue nil end end - end diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 9de003d3b..857a4ac6e 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -6,6 +6,7 @@ Rails.application.routes.draw do match 'approval_setting' => "approvals#setting" ,:as => :approval_setting,:via => :get match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put + #match 'get_bulletins_json' => "bulletins#get_bulletins_json" ,:as => :bulletins_json_list,:via => :get resources :bulletins do match "approve/:bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post @@ -18,21 +19,22 @@ Rails.application.routes.draw do post "preview" put "preview" get 'delete' + get 'get_bulletins_json' end match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit end - + resources :bulletin_categorys - - resources :bulletin_links, :controller => 'bulletin_links' do + + resources :bulletin_links, :controller => 'bulletin_links' do match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit end - - resources :bulletin_files, :controller => 'bulletin_files' do + + resources :bulletin_files, :controller => 'bulletin_files' do match "file_quick_edit/:bulletin_file_id" => "bulletin_files#file_quick_edit" ,:as => :file_quick_edit end - + resources :tags end namespace :front_end do From 7595e20d0c5b3c2e3d0a7fa4f43f0ebdb2b32726 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 8 Nov 2012 16:01:08 +0800 Subject: [PATCH 07/15] fixed language of announcement filter --- .../panel/announcement/plugin/_profile.html.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb index 2cb15a650..5bb852e32 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb @@ -10,13 +10,13 @@ - - - - - + + + + + <% if not @user%> - + <% end %> @@ -35,7 +35,7 @@ <% if not bulletin.deadline.nil?%> <%else%> - + <% end %> <% end %> + + + \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb index 9cf6b355b..dd6d85785 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb @@ -1,26 +1,23 @@ <%= form_for @calendar, :url => panel_calendar_back_end_cal_path(@calendar), :remote => true do |f| %> -

Edit

-
-
- <%= label_tag("color", t("calendar.color")) %> - <%= f.text_field :color, :class => "color-picker miniColors", :size => "5", :maxlength => "5", :autocomplete=>"off",:value=>@calendar.color %> -
-
- -
- <%= f.fields_for :name_translations do |name| %> - <% @site_valid_locales.each_with_index do |locale, i| %> -
- <%= label_tag(locale, t("calendar.name")+"-"+I18nVariable.from_locale(locale)) %> -
- <%= name.text_field locale, :class => "input-xxlarge", :size=>"30", :value=>@calendar.name_translations[locale] %> -
-
+
<%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.start_date') %><%= t('bulletin.end_date') %><%= t('bulletin.tags') %><%= t('category') %><%= t('title') %><%= t('start_date') %><%= t('end_date') %><%= t('tags') %><%= t('bulletin.last_modified') %><%= t('last_modified') %>
<%= display_date_time(bulletin.deadline) %><%= t('bulletin.no_deadline') %><%= t('no_deadline') %>
From 80abfc80bfa7a6cdef61649f70719315abab1380 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Fri, 9 Nov 2012 10:41:49 +0800 Subject: [PATCH 08/15] fixed get_bulletins_json of gprs bug --- .../announcement/back_end/bulletins_controller.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 c4c4606f4..b0688a5ca 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 @@ -35,11 +35,20 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController else deadline = I18n.t("no_deadline") end - @data[I18n.t("category")][b.bulletin_category.title] = { title: b.title, + if @data[I18n.t("category")][b.bulletin_category.title].nil? + @data[I18n.t("category")][b.bulletin_category.title] = Array.new + @data[I18n.t("category")][b.bulletin_category.title] << { title: b.title, postdate: display_date_time(b.postdate), deadline: deadline, tag: b.sorted_tags.to_a, - } + } + else + @data[I18n.t("category")][b.bulletin_category.title] << { title: b.title, + postdate: display_date_time(b.postdate), + deadline: deadline, + tag: b.sorted_tags.to_a, + } + end end render :json => @data.to_json end From 624d12de6d22bdf69c2e98462861bf652347ff61 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Fri, 9 Nov 2012 16:24:23 +0800 Subject: [PATCH 09/15] make json readable --- .../controllers/panel/gprs/back_end/locations_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb index 3a5a6ea4f..5baec2cce 100644 --- a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb +++ b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb @@ -68,6 +68,10 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController latitude: location.latitude, description: location.description } end - render :json => @data.to_json + + #print readable json + render :json => JSON.pretty_generate({location: @data}) + + #render :json => {location: @data}.to_json end end From e4de229b223752ff23c0f022af33401623c3527c Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Fri, 9 Nov 2012 16:24:37 +0800 Subject: [PATCH 10/15] make json readable --- .../panel/announcement/back_end/bulletins_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 b0688a5ca..679a6b052 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 @@ -50,7 +50,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController } end end - render :json => @data.to_json + #render :json => @data.to_json + #to print readable json + render :json => JSON.pretty_generate(@data) end def index From 275c6f4c8a4931a39ab1e96e27c63e69a3602a4c Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Fri, 9 Nov 2012 16:25:11 +0800 Subject: [PATCH 11/15] get_album_json function can get readable json --- .../gallery/back_end/albums_controller.rb | 52 ++++++++++++++++--- .../built_in_modules/gallery/config/routes.rb | 3 ++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index 0c2034599..bf32b6937 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -1,7 +1,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController include AdminHelper - before_filter :force_order_for_user, :except => [:index,:imgs] + before_filter :force_order_for_user, :except => [:index,:get_album_json] def index if is_manager? || is_admin? || is_sub_manager? @@ -113,6 +113,47 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController render :json =>{"success"=>true}.to_json end + def get_album_json + albums = GalleryAlbum.all + output = Array.new + + albums.each do |album| + tag_names = Array.new + all_image = Array.new + + images = album.gallery_images.all + images.each do |image| + tags = Array.new + + image.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + + all_image << { + image_title: image.title, + image_description: image.description, + image_file: { url: "http://#{request.host_with_port+image.file.url}", + thumb: "http://#{request.host_with_port+image.file.thumb.to_s}"}, + image_tag_names: tags} + end + + album.tag_ids.each do |tag| + tag_names << GalleryTag.find(tag)[I18n.locale] + end + + output << { + album_cover_file: "http://#{request.host_with_port+album.cover_path}", + album_name: album.name, + album_tag_names: tag_names, + images: all_image + } + end + + #render :json=>{:images => @output, + # :tag_names => @tag_names}.to_json + render :json=>JSON.pretty_generate(output) + end + def imgs @album = GalleryAlbum.find(params[:album_id]) @tag_names = Array.new @@ -146,10 +187,12 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json end end + def upload_panel @album = GalleryAlbum.find(params[:album_id]) render :layout => false end + def upload_image @album = GalleryAlbum.find(params[:album_id]) @files = params['files'] @@ -186,11 +229,4 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController @tags = GalleryTag.all render :action => :show end - end - - - - - - diff --git a/vendor/built_in_modules/gallery/config/routes.rb b/vendor/built_in_modules/gallery/config/routes.rb index b8c64f3c2..8795594b0 100644 --- a/vendor/built_in_modules/gallery/config/routes.rb +++ b/vendor/built_in_modules/gallery/config/routes.rb @@ -11,6 +11,9 @@ Rails.application.routes.draw do match "imgs" => "albums#imgs" match "upload_panel" => "albums#upload_panel" match "images_tags" => "albums#images_tags" + collection do + get "get_album_json" + end end match "album_images/#!/:id" => "album_images#show" From 295aef32abaf273a7c61cf07f0026cae9277b7ed Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Fri, 9 Nov 2012 16:31:36 +0800 Subject: [PATCH 12/15] change host with host_with_port --- .../controllers/panel/gprs/back_end/locations_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb index 5baec2cce..884e5d13d 100644 --- a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb +++ b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb @@ -59,8 +59,8 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController @data = Array.new locations.each do |location| - picurl = "http://"+request.host + location.file.url - thumburl = "http://"+request.host + location.file.thumb.url + picurl = "http://#{request.host_with_port + location.file.url}", + thumburl = "http://#{request.host_with_port + location.file.thumb.url}" @data << { name: location.name, pic_url: picurl, thumb_url: thumburl, From e5d31f50a0c671eaa65989982cee832ff91572b7 Mon Sep 17 00:00:00 2001 From: devin Date: Thu, 1 Nov 2012 15:21:42 +0800 Subject: [PATCH 13/15] calendar "edit calendar" update --- .../app/assets/stylesheets/calendar.css | 15 +++++++ .../calendar/back_end/cals/_calendar.html.erb | 5 ++- .../calendar/back_end/cals/edit.html.erb | 43 +++++++++---------- .../panel/calendar/back_end/cals/new.html.erb | 3 +- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css index 8fa88b913..fd25b10e6 100644 --- a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css +++ b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css @@ -338,6 +338,21 @@ margin: 4px 0 0 0; } +/* category edit */ +.edit_cal { + margin: -8px; + background-color: whitesmoke; +} + +.edit_cal .table td, .edit_cal .table { + border: 0 !important; + background-color: transparent !important; + margin: 0 !important; +} +.main-list td { + border-top: solid 1px #ddd; +} + /* create / edit event panel */ #tags_panel { top: auto; diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/_calendar.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/_calendar.html.erb index c03b0d183..bc554c6df 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/_calendar.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/_calendar.html.erb @@ -1,8 +1,6 @@
-
-
+ + + <%= f.fields_for :name_translations do |name| %> + <% @site_valid_locales.each_with_index do |locale, i| %> + + <% end %> <% end %> - <% end %> - -
- <%= f.submit t("calendar.save"), :class=>"btn btn-primary" %> - -
+ + + + +
+ + <%= f.text_field :color, :class => "color-picker miniColors input-small", :maxlength => "5", :autocomplete=>"off",:value=>@calendar.color %> + + <%= name.text_field locale, :class => "input-large", :value=>@calendar.name_translations[locale] %> +
+ <%= f.submit t("calendar.save"), :class=>"btn btn-primary" %> + +
<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb index 80de4ed23..3c63da808 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb @@ -1,5 +1,6 @@ <%= stylesheet_link_tag "jquery.miniColors" %> <%= stylesheet_link_tag "calendar" %> +<%= stylesheet_link_tag "bootstrap-responsive" %> <%= javascript_include_tag "jquery.miniColors.min" %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "calendarAPI" %> @@ -57,7 +58,7 @@ <% end %> <% end %> -
+
<%= f.submit t("calendar.save"), :class=>"btn btn-primary" %>
<% end %> From a56d80698ff2e6e21267ce7c44f11a68e0477053 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 8 Nov 2012 17:01:59 +0800 Subject: [PATCH 14/15] desktop api update.. --- app/assets/javascripts/orbitTimeline.js | 8 +- app/assets/javascripts/orbitdesktop.js | 696 +++++------------- app/controllers/desktop_controller.rb | 8 +- .../desktop_publications_controller.rb | 1 - app/views/desktop/appstore.html.erb | 4 +- app/views/desktop/books.html.erb | 4 +- app/views/desktop/index.html.erb | 69 +- app/views/desktop/journal_p.html.erb | 4 +- app/views/desktop/research_d.html.erb | 4 +- app/views/desktop/research_p.html.erb | 4 +- app/views/desktop/seminar_p.html.erb | 4 +- app/views/desktop/settings.html.erb | 31 +- .../desktop/settings/connections.html.erb | 6 +- app/views/desktop/settings/themes.html.erb | 26 +- config/routes.rb | 57 +- 15 files changed, 310 insertions(+), 616 deletions(-) diff --git a/app/assets/javascripts/orbitTimeline.js b/app/assets/javascripts/orbitTimeline.js index bd2fbb78a..bdde5a240 100644 --- a/app/assets/javascripts/orbitTimeline.js +++ b/app/assets/javascripts/orbitTimeline.js @@ -59,7 +59,7 @@ var orbitTimeline = function(dom){ this.constructTimeScale = function(callbackFn){ var mon ="",year="",formname; var scale = $("
"); - $.getJSON("desktop_orbit/gettimelinespan",{"get":"papers"},function(years){ + $.getJSON("/desktop_orbit/gettimelinespan",{"get":"papers"},function(years){ var $ul = $("
    "); var startyear = years.startyear, endyear = years.endyear,year = years.startyear; $ul.append('
  • '+startyear+'
  • '); @@ -69,7 +69,7 @@ var orbitTimeline = function(dom){ } $("div#orbit div#year_navigation").html($ul); }) - $.getJSON("desktop_orbit/eventajaxload",{"event":"papers","from":t.fromdate},function(papersArray){ + $.getJSON("/desktop_orbit/eventajaxload",{"event":"papers","from":t.fromdate},function(papersArray){ $.each(papersArray,function(i,pa){ $.each(pa.papers,function(i,paper){ var dt = new Date(paper.created_at); @@ -150,7 +150,7 @@ var orbitTimeline = function(dom){ var scale = $("#scale_wrapper"); t.ajaxload = false; - $.getJSON("desktop_orbit/eventajaxload",{"from":t.fromdate},function(papersArray){ + $.getJSON("/desktop_orbit/eventajaxload",{"from":t.fromdate},function(papersArray){ $.each(papersArray,function(i,pa){ $.each(pa.papers,function(i,paper){ var dt = new Date(paper.created_at); @@ -235,7 +235,7 @@ var orbitTimeline = function(dom){ this.ajaxEventPull = function(){ if(!t.update){ t.update = true; - $.getJSON("desktop_orbit/ajaxeventpull",{"from":t.fromdate},function(){ + $.getJSON("/desktop_orbit/ajaxeventpull",{"from":t.fromdate},function(){ }) } diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 2b4eb6291..aeb80a24d 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -1,6 +1,8 @@ // JavaScript Document //harry //Inititialize function will initialize desktop + + $.extend($.expr[':'], { 'containsi': function (elem, i, match, array) { return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; @@ -17,19 +19,22 @@ var sortDescending = function(a, b) { }; var orbitDesktop = function(dom){ orbitDesktopAPI.apply(this); - o = this; + // o = this; this.contentHolder = dom; this.themesettings = ""; this.theme = "4f8d3f493b67fcd05f086359"; this.transitionTime = 500; this.currenthtml = "desktop.html"; this.currentface = "home"; - this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":"","orbit":"","books":"","seminar_p":"","research_d":"","research_p":""}; + this.desktopData = {}; this.tp = ""; this.sectionList; + this.data_method; this.initialize = function(){ + var theme = o.theme; var custom = false; + $.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){ if(desktopSettings){ if(desktopSettings.theme!="custom"){ @@ -50,7 +55,16 @@ var orbitDesktop = function(dom){ $("head").find("#dyn_css").remove(); $("head").append(customtheme); } - $(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();}); + $(document).ready(function(){ + o.loadWallpaper(customwallpaper); + o.bindDesktopEvents(); + o.loadIconCache(); + + $(o.contentHolder).empty().load("desktop",function(){ + o.desktopData["d_desktop"] = ""; + o.initializeDesktop("d_desktop","",false); + }) + }); }) } } @@ -65,105 +79,63 @@ var orbitDesktop = function(dom){ }) }; this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc - $("a#d_app_manager").click(function(){ - var target = $(this).attr("href"); + $(".docklist a").click(function(){ + var target = $(this).attr("id"); + var url = $(this).attr("href"); + o.data_method = $(this).attr("data-method"); if(o.currenthtml!=target){ + if(o.desktopData[o.currentface] == "undefined") + o.desktopData[o.currentface] = ""; o.desktopData[o.currentface] = $(o.contentHolder).html(); $("#content").hide("drop",o.transitionTime,function(){ - o.initializeAppSearch(target); + o.currenthtml = target; + o.currentface = target; + var cache = false; + if(!o.desktopData[o.currentface]){ + $(o.contentHolder).empty().load(url,function(){ + if(typeof o.data_method != "undefined" || o.data_method != "") + window.o[o.data_method](target,url,cache); + }); + }else{ + $(o.contentHolder).html(o.desktopData[o.currentface]); + cache = true; + if(typeof o.data_method != "undefined" || o.data_method != "") + window.o[o.data_method](target,url,cache); + } }); } - }); - $("a#d_desktop").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeDesktop(target); - }); + return false; + }) + $('body').on({ + click: function(){ + if(!$(this).hasClass('active')){ + var sub_data_method = $(this).attr('data-method'); + if(sub_data_method){ + $("#panel_r").load($(this).attr("href"),function(){ + // o.simple_drop_down(); + + // o.tinyscrollbar_ext({ + // main: '.tinycanvas', + // fill: '.s_grid_con' + // }) + window.o[o.data_method][sub_data_method](); + }) + } + $('.s_menu a').removeClass('thmc1 thmtxt active'); + $(this).addClass('thmc1 thmtxt active'); + } + return false; + }, + mouseenter: function(){ + if(!$(this).hasClass('active')){ + $(this).switchClass('admtxt','thmc1 thmtxt',0); + } + }, + mouseleave: function(){ + var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; + $(this).switchClass(t,'admtxt',0); } - }); - $("a#d_sections").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeSectionsManager(target); - }); - } - }); - $("#d_journal_p").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeJournalPapers(target); - }); - } - }); - $("a#d_settings").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeSettings(target); - }); - } - }); - $("a#d_appstore").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeAppstore(target); - }); - } - }); - $("a#d_orbit").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeOrbitTimeline(target); - }); - } - }); - $("a#d_books").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeBooks(target); - }); - } - }); - $("a#d_seminar_p").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeSeminar(target); - }); - } - }); - $("a#d_research_d").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeResearchDomain(target); - }); - } - }); - $("a#d_research_p").click(function(){ - var target = $(this).attr("href"); - if(o.currenthtml!=target){ - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.initializeResearchProject(target); - }); - } - }); + },'.s_menu a'); $(window).resize(function(){ var ww = $(window).width(); $("img#thmbackground").attr({"width":ww}); @@ -188,11 +160,8 @@ var orbitDesktop = function(dom){ }); }; - this.initializeDesktop = function(target){ //this is for initializing main desktops that are sections and tiles + this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles if(!target)target = "desktop"; - o.currenthtml = target; - o.currentface = "home"; - var bindHandlers = function(){ // this function will bind all the handlers in the desktop var groupWrapperWidth = 0; $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); @@ -339,7 +308,7 @@ var orbitDesktop = function(dom){ $group.find('.col'+colindex).append($li); } } - $("div#desktop div#group_wrapper").append($group); + $("div#desktop div#group_wrapper").append($group); }) bindHandlers(); o.initializeWidgets(); @@ -368,27 +337,23 @@ var orbitDesktop = function(dom){ loadTiles(o.sectionId); }) } - - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - loadTiles(o.sectionId); - loadSectionList(); - }); + if(cache){ + bindHandlers(); + o.initializeWidgets(); + bindSecondaryHandlers(); + $("div#desktop ul#section_list").empty(); + $.each(o.sectionList,function(i,section){ + var tempstyle=""; + if(section._id==o.sectionId){ + tempstyle = "style='display:none;'"; + $("div#desktop span#section_heading").text(section.name); + } + $("div#desktop ul#section_list").append($('
  • '+section.name+'
  • ')); + }) + bindSecondaryHandlers(); }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - bindHandlers(); - o.initializeWidgets(); - bindSecondaryHandlers(); - $("div#desktop ul#section_list").empty(); - $.each(o.sectionList,function(i,section){ - var tempstyle=""; - if(section._id==o.sectionId){ - tempstyle = "style='display:none;'"; - $("div#desktop span#section_heading").text(section.name); - } - $("div#desktop ul#section_list").append($('
  • '+section.name+'
  • ')); - }) - bindSecondaryHandlers(); + loadTiles(o.sectionId); + loadSectionList(); } }; @@ -396,9 +361,8 @@ var orbitDesktop = function(dom){ $.post("desktop/twitter",function(){}); }; - this.initializeAppSearch = function(target){ //this is application search ie is app manager initialization - o.currenthtml = target; - o.currentface = "apps_manager"; + this.initializeAppSearch = function(target,url,cache){ //this is application search ie is app manager initialization + var searchArray,allApps; var bindHandlers = function(){ // bind handler for app manager page var gn = $('.g_col').length, @@ -474,18 +438,13 @@ var orbitDesktop = function(dom){ bindHandlers(); }) } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - loadApps(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - bindHandlers(); - } + if(cache) + bindHandlers(); + else + loadApps(); }; - this.initializeSectionsManager = function(target){ // this is init function for section manager - o.currenthtml = target; - o.currentface = "sections"; + this.initializeSectionsManager = function(target,url,cache){ // this is init function for section manager + var elementParent,element,slabel; var bindHandlers = function(){ // this is bind handler for section manager page var groupWrapperWidth = 0; @@ -572,50 +531,15 @@ var orbitDesktop = function(dom){ bindHandlers(); }) } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - loadApps(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); + if(cache) bindHandlers(); - } + else + loadApps(); }; - this.initializeSettings = function(target){ //this is to initialize setting page - o.currenthtml = target; - o.currentface = "settings"; - var bindHandlers = function(){ // this is the bind handler function for setting page - $("div#settings ul#setting_left_nav li a").on({ - click: function(){ - if(!$(this).data("clicked")){ - var tfunc = $(this).attr("href"); - switch(tfunc){ - case "themes": - themes(); - break; - case "sections": - sections(); - break; - case "connection": - connection(); - break; - } - $("div#settings ul#setting_left_nav li a").removeClass('thmc1 thmtxt').data('clicked',null); - $(this).addClass('thmc1 thmtxt').data('clicked',true); - } - }, - mouseenter: function(){ - $(this).removeClass('admtxt').addClass('thmc1 thmtxt'); - }, - mouseleave: function(){ - var t = $(this).data('clicked') ? '' : 'thmc1 thmtxt'; - $(this).removeClass(t).addClass('admtxt'); - } - }); - - } - var sections = function(){ // this load section page in setting page + this.initializeSettings = function(target,url,cache){ //this is to initialize setting page + + this.initializeSettings.sections = function(){ // this load section page in setting page var bindHandlers = function(){ // binding handlers in section page $('.tinycanvas').each(function(){ var h = $(this).parent().height(), @@ -644,17 +568,17 @@ var orbitDesktop = function(dom){ }) }) } - $("div#settings div#panel_r").load("/desktop/settingsections",function(){ + $.getJSON("/desktop/get_desktop_settings",{"get":"sectionnames","desktopid":o.desktopId},function(sectionnames){ $("#desktop_names input").each(function(i){ $(this).val(sectionnames[i]); }) bindHandlers(); }) - }) + } - var themes = function(){ // this opens themes page in setting page + this.initializeSettings.themes = function(){ // this opens themes page in setting page var bindHandlers = function(){ // binding handlers in themes page // live change theme $(".theme_list > .ssl_item").click(function(){ @@ -760,7 +684,7 @@ var orbitDesktop = function(dom){ }); } - $("div#settings div#panel_r").load("/desktop/settingthemes",function(){ + $.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){ $('#st1 .theme_list [id='+theme+']') .addClass("thmc1 active", 300) @@ -770,10 +694,11 @@ var orbitDesktop = function(dom){ bindHandlers(); loadthmc(); }) - }) + } - var connection = function(){ + this.initializeSettings.connection = function(){ + var bindHandlers = function(){ $("#connection_setting ul a").click(function(){ var what = $(this).attr("for"), @@ -846,8 +771,8 @@ var orbitDesktop = function(dom){ } }) } - $("div#settings div#panel_r").load("/desktop/settingconnection",function(){ - $.getJSON("desktop/getaccounts",function(accounts){ + + $.getJSON("/otheraccounts/getaccounts",function(accounts){ $.each(accounts,function(i,account){ $ul = $("#"+account.type+"_connection"); $ul.find("input[type=text]").replaceWith("
    "+account.email+"
    ") @@ -859,64 +784,18 @@ var orbitDesktop = function(dom){ bindHandlers(); }) - }) } - - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - bindHandlers(); - themes(); - }); }; - this.initializeOrbitTimeline = function(target){ - o.currenthtml = target; - o.currentface = "orbit"; - var bindHandlers = function(){ - var timeline = new orbitTimeline("#timeline"); - timeline.initialize(); - } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop_orbit/"+target,function(){ - bindHandlers(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - bindHandlers(); - } - }; - this.initializeJournalPapers = function(target){ // this init journal papers - o.currenthtml = target; - o.currentface = "journal_p"; - var bindHandlers = function(){ // bind handler for journal paper - $('.s_menu a').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var tfunc = $(this).attr('href'); - switch(tfunc){ - case 'list': - list(); - break; - case 'addpaper': - addpaper(); - break; - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - }, - mouseenter: function(){ - if(!$(this).hasClass('active')){ - $(this).switchClass('admtxt','thmc1 thmtxt',0); - } - }, - mouseleave: function(){ - var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; - $(this).switchClass(t,'admtxt',0); - } - }); - } + this.initializeOrbitTimeline = function(target,url,cache){ + + var timeline = new orbitTimeline("#timeline"); + timeline.initialize(); - var list = function(){ // to open list part in journal papers page + }; + this.initializeJournalPapers = function(target,url,cache){ // this init journal papers + + this.initializeJournalPapers.list = function(){ // to open list part in journal papers page var journalData; var bindHandlers = function(){ // to bind handlers for list page o.simple_drop_down(); @@ -961,7 +840,7 @@ var orbitDesktop = function(dom){ $("#journal_p div#paper_list a").click(function(){ if($(this).hasClass("icon-check-empty")){ $(this).switchClass("icon-check-empty","icon-check",0); - } else if($(this).hasClass("icon-check")) { + } else if($(this) .hasClass("icon-check")) { $(this).switchClass("icon-check","icon-check-empty",0); } else if($(this).hasClass("icon-star")){ $(this).removeClass("icon-star").addClass("icon-star-empty"); @@ -1048,16 +927,14 @@ var orbitDesktop = function(dom){ bindSecondaryHandlers(); } - $("div#journal_p div#panel_r").load("/desktop/journal_p_list",function(){ - $.getJSON("/desktop_publications/getjournals",function(journals){ - journalData = eval(journals); - journalview(); - bindHandlers(); - }) + $.getJSON("/desktop_publications/getjournals",function(journals){ + journalData = eval(journals); + journalview(); + bindHandlers(); }) } - var addpaper = function(){ // to open add pages in journal papers page + this.initializeJournalPapers.addpaper = function(){ // to open add pages in journal papers page var bindHandlers = function(){ // to bind handlers for add page o.simple_drop_down(); @@ -1066,54 +943,15 @@ var orbitDesktop = function(dom){ fill: '.s_grid_con' }) } - $("div#journal_p div#panel_r").load("/desktop/journal_p_add",function(){ - bindHandlers(); - }) + bindHandlers(); } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - bindHandlers(); - list(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - bindHandlers(); - list(); - } + }; - this.initializeAppstore = function(target){ - o.currenthtml = target; - o.currentface = "appstore"; - var bindHandlers = function(){ - $('.s_menu a').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var tfunc = $(this).attr('href'); - switch(tfunc){ - case 'widgets': - widgets(); - break; - case 'onlinestore': - onlinestore(); - break; - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - }, - mouseenter: function(){ - if(!$(this).hasClass('active')){ - $(this).switchClass('admtxt','thmc1 thmtxt',0); - } - }, - mouseleave: function(){ - var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; - $(this).switchClass(t,'admtxt',0); - } - }); - } - var widgets = function(){ + this.initializeAppstore = function(target,url,cache){ + + + this.initializeAppstore.widgets = function(){ var bindHandlers = function(){ $("#widget_list a").click(function(){ var sectionid = $(this).attr("for"); @@ -1180,7 +1018,7 @@ var orbitDesktop = function(dom){ fill: '.list_t' }) } - $("div#apps_store div#panel_r").load("/desktop_appstore/widgets",function(){ + $.getJSON("/desktop_appstore/getuserwidgets",function(userwidgets){ var column = $('
      '), @@ -1230,62 +1068,25 @@ var orbitDesktop = function(dom){ counter++; }) $("#apps_store div#widget_list").append(column); - bindHandlers(); + }) - }) + } - var onlinestore = function(){ + this.initializeAppstore.onlinestore = function(){ var bindHandlers = function(){ } - $("div#apps_store div#panel_r").load("/desktop_appstore/onlinestore",function(){ + bindHandlers(); - }) - } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop_appstore/"+target,function(){ - onlinestore(); - bindHandlers(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - onlinestore(); - bindHandlers(); + } + this.initializeAppstore.onlinestore(); + bindHandlers(); } - this.initializeBooks = function(target){ - o.currenthtml = target; - o.currentface = "books"; - var bindHandlers = function(){ - $('.s_menu a').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var tfunc = $(this).attr('href'); - switch(tfunc){ - case 'list': - list(); - break; - case 'addbook': - addbook(); - break; - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - }, - mouseenter: function(){ - if(!$(this).hasClass('active')){ - $(this).switchClass('admtxt','thmc1 thmtxt',0); - } - }, - mouseleave: function(){ - var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; - $(this).switchClass(t,'admtxt',0); - } - }); - } + this.initializeBooks = function(target,url,cache){ + - var list = function(){ + this.initializeBooks.list = function(){ var bindHandlers = function(){ o.simple_drop_down(); @@ -1295,12 +1096,12 @@ var orbitDesktop = function(dom){ }) } - $("div#books div#panel_r").load("/desktop/books_list",function(){ + bindHandlers(); - }) + } - var addbook = function(){ + this.initializeBooks.addbook = function(){ var bindHandlers = function(){ o.simple_drop_down(); @@ -1310,55 +1111,17 @@ var orbitDesktop = function(dom){ }) } - - $("div#books div#panel_r").load("/desktop/books_add",function(){ - bindHandlers(); - }) - } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - list(); - bindHandlers(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - list(); + bindHandlers(); + } - } - this.initializeSeminar = function(target){ - o.currenthtml = target; - o.currentface = "seminar_p"; - var bindHandlers = function(){ - $('.s_menu a').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var tfunc = $(this).attr('href'); - switch(tfunc){ - case 'list': - list(); - break; - case 'addseminar': - addseminar(); - break; - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - }, - mouseenter: function(){ - if(!$(this).hasClass('active')){ - $(this).switchClass('admtxt','thmc1 thmtxt',0); - } - }, - mouseleave: function(){ - var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; - $(this).switchClass(t,'admtxt',0); - } - }); - } + this.initializeBooks.list(); - var list = function(){ + } + this.initializeSeminar = function(target,url,cache){ + + + this.initializeSeminar.list = function(){ var bindHandlers = function(){ o.tinyscrollbar_ext({ main : ".tinycanvas", @@ -1366,12 +1129,12 @@ var orbitDesktop = function(dom){ }) } - $("div#seminar_p div#panel_r").load("/desktop/seminar_p_list",function(){ + bindHandlers(); - }) + } - var addseminar = function(){ + this.initializeSeminar.addseminar = function(){ var bindHandlers = function(){ o.simple_drop_down(); @@ -1381,53 +1144,15 @@ var orbitDesktop = function(dom){ }) } - $("div#seminar_p div#panel_r").load("/desktop/seminar_p_add",function(){ - bindHandlers(); - }) - } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - list(); - bindHandlers(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - list(); bindHandlers(); + } + this.initializeSeminar.list(); + } - this.initializeResearchDomain = function(target){ - o.currenthtml = target; - o.currentface = "research_d"; - var bindHandlers = function(){ - $('.s_menu a').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var tfunc = $(this).attr('href'); - switch(tfunc){ - case 'list': - list(); - break; - case 'add': - add_this(); - break; - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - }, - mouseenter: function(){ - if(!$(this).hasClass('active')){ - $(this).switchClass('admtxt','thmc1 thmtxt',0); - } - }, - mouseleave: function(){ - var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; - $(this).switchClass(t,'admtxt',0); - } - }); - } - var list = function(){ + this.initializeResearchDomain = function(target,url,cache){ + + this.initializeResearchDomain.list = function(){ var bindHandlers = function(){ o.tinyscrollbar_ext({ main : ".tinycanvas", @@ -1435,67 +1160,25 @@ var orbitDesktop = function(dom){ }) } - $("div#research_d div#panel_r").load("/desktop/research_d_list",function(){ + bindHandlers(); - }) + } - var add_this = function(){ + this.initializeResearchDomain.add_this = function(){ var bindHandlers = function(){ - o.simple_drop_down(); - - o.tinyscrollbar_ext({ - main: '.tinycanvas', - fill: '.s_grid_con' - }) + } - $("div#research_d div#panel_r").load("/desktop/research_d_add",function(){ + bindHandlers(); - }) - } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - list(); - bindHandlers(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - list(); - bindHandlers(); + } + this.initializeResearchDomain.list(); + } - this.initializeResearchProject = function(target){ - o.currenthtml = target; - o.currentface = "research_p"; - var bindHandlers = function(){ - $('.s_menu a').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var tfunc = $(this).attr('href'); - switch(tfunc){ - case 'list': - list(); - break; - case 'add': - add_this(); - break; - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - }, - mouseenter: function(){ - if(!$(this).hasClass('active')){ - $(this).switchClass('admtxt','thmc1 thmtxt',0); - } - }, - mouseleave: function(){ - var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; - $(this).switchClass(t,'admtxt',0); - } - }); - } - var list = function(){ + this.initializeResearchProject = function(target,url,cache){ + + this.initializeResearchProject.list = function(){ var bindHandlers = function(){ o.tinyscrollbar_ext({ main : ".tinycanvas", @@ -1503,11 +1186,11 @@ var orbitDesktop = function(dom){ }) } - $("div#research_p div#panel_r").load("/desktop/research_p_list",function(){ + bindHandlers(); - }) + } - var add_this = function(){ + this.initializeResearchProject.add_this = function(){ var bindHandlers = function(){ o.simple_drop_down(); @@ -1517,20 +1200,12 @@ var orbitDesktop = function(dom){ }) } - $("div#research_p div#panel_r").load("/desktop/research_p_add",function(){ + bindHandlers(); - }) - } - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - list(); - bindHandlers(); - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - list(); - bindHandlers(); + } + this.initializeResearchProject.list(); + } this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper @@ -1566,7 +1241,7 @@ var orbitDesktop = function(dom){ }) }; this.saveWallpaper = function(wallpaper){ // this function saves wallpaper in db - $.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){ + $.post("/desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){ if(result[0].success=="true") o.notify("Wallpaper saved!!","success",2); else @@ -1698,3 +1373,16 @@ var uselessfunction = function(){ $.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"}); } + + + +orbitDesktop.prototype.initCourses = function(){ + o.notify("Hi there","",""); +} + +orbitDesktop.prototype.something = function(){ + o.notify("something","",""); +} + + + diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index ff6574411..279694b6d 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -27,17 +27,17 @@ class DesktopController< ApplicationController render :layout => false end - def settingthemes + def themes @themes = DesktopTheme.all # raise @themes.inspect render "desktop/settings/themes", :layout => false end - def settingsections + def sections render "desktop/settings/sections", :layout => false end - def settingconnection + def connections render "desktop/settings/connections", :layout => false end @@ -116,7 +116,7 @@ class DesktopController< ApplicationController if tile.data_category == "widget" widge = DesktopWidget.find(tile.desktop_widget_id.to_s) # data_content = widge.widget_layout.file - data_content = "desktop/widget_layout?id="+tile.desktop_widget_id.to_s + data_content = "/desktop/widget_layout?id="+tile.desktop_widget_id.to_s jsfile = widge.javascripts.collect{|js| js.file} cssfile = widge.css_default.file shape = widge.shape diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb index fc3f36ab9..14307022a 100644 --- a/app/controllers/desktop_publications_controller.rb +++ b/app/controllers/desktop_publications_controller.rb @@ -8,7 +8,6 @@ class DesktopPublicationsController< ApplicationController end def journal_p_add - debugger render "desktop/journal_pages/add", :layout => false end diff --git a/app/views/desktop/appstore.html.erb b/app/views/desktop/appstore.html.erb index ab83d9d93..d0a4d5b72 100644 --- a/app/views/desktop/appstore.html.erb +++ b/app/views/desktop/appstore.html.erb @@ -10,8 +10,8 @@
      diff --git a/app/views/desktop/books.html.erb b/app/views/desktop/books.html.erb index 861a9926c..6e8dd0dc7 100644 --- a/app/views/desktop/books.html.erb +++ b/app/views/desktop/books.html.erb @@ -13,8 +13,8 @@
        -
      • List
      • -
      • Add/Edit
      • +
      • List
      • +
      • Add/Edit
      • Books
      • Co-Authors
      • Tags & Keywords
      • diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index 039ae65fa..701e5c088 100755 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -1,59 +1,64 @@
          -
        • Home +
        • Home
            -
          • App Manager
          • -
          • All Sections
          • -
          • Settings
          • +
          • App Manager
          • +
          • All Sections
          • +
          • Settings
        • -
        • Publication +
        • Publication
            -
          • Journal Papers
          • -
          • Seminar Papers
          • -
          • Books
          • + +
          • Journal Papers
          • + +
          • Seminar Papers
          • + +
          • Books
          • + +
          • Books
        • -
        • Research +
        • Research
            -
          • Research Domain
          • -
          • Research Project
          • -
          • Patents
          • -
          • Labs
          • +
          • Research Domain
          • +
          • Research Project
          • +
          • Patents
          • +
          • Labs
        • -
        • Experience +
        • Experience
            -
          • Working
          • -
          • Education
          • -
          • Honors
          • -
          • Activities
          • -
          • Clubs
          • +
          • Working
          • +
          • Education
          • +
          • Honors
          • +
          • Activities
          • +
          • Clubs
        • -
        • Learning & Teaching +
        • Learning & Teaching
            -
          • Courses
          • -
          • Homework
          • -
          • Certification
          • +
          • Courses
          • +
          • Homework
          • +
          • Certification
        • -
        • Personal +
        • Personal
            -
          • myPage
          • -
          • Blog
          • -
          • Album
          • -
          • Calendar
          • -
          • Files
          • +
          • myPage
          • +
          • Blog
          • +
          • Album
          • +
          • Calendar
          • +
          • Files
        • -
        • Orbit +
        • Orbit
            -
          • Academia Connection
          • +
          • Academia Connection
        • -
        • AppStore
        • +
        • AppStore
        diff --git a/app/views/desktop/journal_p.html.erb b/app/views/desktop/journal_p.html.erb index 6dddb734f..07452f20c 100644 --- a/app/views/desktop/journal_p.html.erb +++ b/app/views/desktop/journal_p.html.erb @@ -13,8 +13,8 @@
          -
        • List
        • -
        • Add/Edit
        • +
        • List
        • +
        • Add/Edit
        • Journals
        • Co-Authors
        • Tags & Keywords
        • diff --git a/app/views/desktop/research_d.html.erb b/app/views/desktop/research_d.html.erb index f9b8bf5ca..e96691d39 100644 --- a/app/views/desktop/research_d.html.erb +++ b/app/views/desktop/research_d.html.erb @@ -13,8 +13,8 @@
            -
          • List
          • -
          • Add/Edit
          • +
          • List
          • +
          • Add/Edit
          • Domains
          • Co-Authors
          • Tags & Keywords
          • diff --git a/app/views/desktop/research_p.html.erb b/app/views/desktop/research_p.html.erb index 43eab7be0..085d3af40 100644 --- a/app/views/desktop/research_p.html.erb +++ b/app/views/desktop/research_p.html.erb @@ -13,8 +13,8 @@
            \ No newline at end of file diff --git a/app/views/desktop/settings/connections.html.erb b/app/views/desktop/settings/connections.html.erb index 148762da5..153a0a464 100644 --- a/app/views/desktop/settings/connections.html.erb +++ b/app/views/desktop/settings/connections.html.erb @@ -4,7 +4,7 @@
            • No Connection
            • -
            • Facebook

            • +
            • Facebook

            • @@ -16,7 +16,7 @@
            • No Connection
            • -
            • Twitter

            • +
            • Twitter

            • @@ -28,7 +28,7 @@
            • No Connection
            • -
            • Gmail

            • +
            • Gmail

            • diff --git a/app/views/desktop/settings/themes.html.erb b/app/views/desktop/settings/themes.html.erb index 6a3c34f83..fb1ac8a5a 100644 --- a/app/views/desktop/settings/themes.html.erb +++ b/app/views/desktop/settings/themes.html.erb @@ -12,7 +12,7 @@
              <% @themes.each do |theme| %> -
              <%= theme.name %>
              +
              <%= theme.name %>
              <% end %>
              @@ -63,18 +63,18 @@
            -
            1.jpg
            -
            2.jpg
            -
            3.jpg
            -
            4.jpg
            -
            5.jpg
            -
            6.jpg
            -
            7.jpg
            -
            8.jpg
            -
            9.jpg
            -
            10.jpg
            -
            11.jpg
            -
            12.jpg
            +
            1.jpg
            +
            2.jpg
            +
            3.jpg
            +
            4.jpg
            +
            5.jpg
            +
            6.jpg
            +
            7.jpg
            +
            8.jpg
            +
            9.jpg
            +
            10.jpg
            +
            11.jpg
            +
            12.jpg