{"id":10931,"date":"2021-08-10T19:21:54","date_gmt":"2021-08-10T11:21:54","guid":{"rendered":"https:\/\/www.hkmu.edu.hk\/ito\/announcements\/"},"modified":"2023-08-17T16:30:40","modified_gmt":"2023-08-17T08:30:40","slug":"announcements","status":"publish","type":"page","link":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/","title":{"rendered":"\u901a\u544a"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"10931\" class=\"elementor elementor-10931 elementor-10921\" data-elementor-settings=\"[]\">\n\t\t\t\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t<section class=\"has_eae_slider wavo-column-gap-default elementor-section elementor-top-section elementor-element elementor-element-65a72e4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"65a72e4\" data-element_type=\"section\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[{&quot;jet_parallax_layout_image&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;},&quot;_id&quot;:&quot;f25ea2d&quot;,&quot;jet_parallax_layout_image_tablet&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;},&quot;jet_parallax_layout_image_mobile&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;},&quot;jet_parallax_layout_speed&quot;:{&quot;unit&quot;:&quot;%&quot;,&quot;size&quot;:50,&quot;sizes&quot;:[]},&quot;jet_parallax_layout_type&quot;:&quot;scroll&quot;,&quot;jet_parallax_layout_direction&quot;:null,&quot;jet_parallax_layout_fx_direction&quot;:null,&quot;jet_parallax_layout_z_index&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_x&quot;:50,&quot;jet_parallax_layout_bg_x_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_x_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_y&quot;:50,&quot;jet_parallax_layout_bg_y_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_y_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_size&quot;:&quot;auto&quot;,&quot;jet_parallax_layout_bg_size_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_size_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_animation_prop&quot;:&quot;transform&quot;,&quot;jet_parallax_layout_on&quot;:[&quot;desktop&quot;,&quot;tablet&quot;]}]}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6fe7edf\" data-id=\"6fe7edf\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d0f4fdf elementor-widget elementor-widget-shortcode\" data-id=\"d0f4fdf\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-shortcode\"><style>\r\n    .table-container {\r\n        margin-bottom: 50px;\r\n    }\r\n\r\n    tr.header-section td:nth-child(3),\r\n    tr.header-section td:nth-child(4) {\r\n        text-align: center;\r\n        width: 8vw;\r\n    }\r\n    tr.announcement td:nth-child(3),\r\n    tr.announcement td:nth-child(4) {\r\n        text-align: center;\r\n    }\r\n    .OU_DESC{\r\n        margin: 20px 0;\r\n    }\r\n\r\n    @media screen and (max-width: 600px) {\r\n        .table-container {\r\n            max-width: 100%;\r\n            overflow-x: auto;\r\n        }\r\n\r\n        .table-container table {\r\n            width: 100%;\r\n            border-collapse: collapse;\r\n        }\r\n\r\n        .table-container th, .table-container td {\r\n            padding: 8px;\r\n            text-align: left;\r\n            white-space: nowrap;\r\n        }\r\n    }\r\n<\/style>\r\n\r\n\r\n<div class=\"table-container\">\r\n    <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\t\t\t\t\t\r\n        <tbody id=\"ITO-container\">\r\n            <tr class=\"header-section\">\r\n                <td width=\"10\"><img decoding=\"async\" src=\"\/WEB\/images\/general\/ue6\/spacer.gif\" width=\"10\" border=\"0\" alt=\" \"><\/td>\r\n                <td>&nbsp;<\/td>\r\n                <td><u>\u767c\u4f48\u65e5\u671f<\/u><\/td>\r\n                <td><u>\u5c46\u6eff\u65e5\u671f<\/u><\/td>\r\n            <\/tr>\r\n        <\/tbody>\r\n    <\/table>\r\n<\/div>\r\n\r\n\r\n<script>\r\n    \/\/   -------------------------------------------   Variable Setting   -------------------------------------------\r\n    var env = 'service';\r\n    var OU_UNIT = 'ITU';\r\n    var CONTAINER_UNIT = 'ITO';\r\n    var lang ='chi';\r\n    var PREVIEW = '';\r\n    var url_lang = lang;\r\n    if( url_lang == 'chi' ){\r\n        url_lang = 'tc\/';\r\n    }else if( url_lang == 'sim' ){\r\n        url_lang = 'sc\/';\r\n    }else{\r\n        url_lang = '';\r\n    }\r\n    \/\/https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\r\n    var subsite_url = 'https:\/\/www.hkmu.edu.hk\/ito\/'+url_lang+'announcements';\r\n    var aid = '';\r\n\r\n\r\n    \/\/   -------------------------------------------   AJAX Call   -------------------------------------------\r\n    if( aid.length > 1 ){\r\n        \/\/ Create an XMLHttpRequest object\r\n        var xhr = new XMLHttpRequest();\r\n\r\n        \/\/ Define the URL and the request method\r\n        var url = 'https:\/\/'+env+'.hkmu.edu.hk\/WebAPI\/rest\/V1\/Announcement';\r\n        var method = 'GET';\r\n\r\n        \/\/ Construct the API URL with the query parameters\r\n        var queryParams = 'OU_ANNOUNCE_ID=' + encodeURIComponent(aid) + '&LANG=' + encodeURIComponent(lang) + '&PREVIEW=' + encodeURIComponent(PREVIEW);\r\n        var api_url = url + '?' + queryParams;\r\n\r\n        \/\/ Set up the request\r\n        xhr.open(method, api_url, true);\r\n        \/\/ Define the callback function to handle the response\r\n        xhr.onload = function () {\r\n            if (xhr.status === 200) {\r\n                var response = JSON.parse(xhr.responseText);\r\n\r\n                \/\/ Process the response data\r\n                \/\/ Access the JSON data here\r\n                console.log(response);\r\n                renderContentHTML(response);\r\n            }else{\r\n                \/\/ Request resulted in an error (e.g., 404 or 500)\r\n                handleError(xhr.status);\r\n            }\r\n        };\r\n\r\n        xhr.onerror = function() {\r\n            \/\/ An error occurred during the request\r\n            handleError(xhr.status);\r\n        };\r\n\r\n        \/\/ Send the request\r\n        xhr.send();\r\n\r\n    }else{\r\n        \/\/ Create an XMLHttpRequest object\r\n        var xhr = new XMLHttpRequest();\r\n\r\n        \/\/ Define the URL and the request method\r\n        var url = 'https:\/\/'+env+'.hkmu.edu.hk\/WebAPI\/rest\/V1\/AnnouncementList_V2';\r\n        var method = 'GET';\r\n\r\n        \/\/ Construct the API URL with the query parameters\r\n        var queryParams = 'OU_UNIT=' + encodeURIComponent(OU_UNIT) + '&LANG=' + encodeURIComponent(lang) + '&PREVIEW=' + encodeURIComponent(PREVIEW);\r\n        var api_url = url + '?' + queryParams;\r\n\r\n        \/\/ Set up the request\r\n        xhr.open(method, api_url, true);\r\n        \/\/ Define the callback function to handle the response\r\n        xhr.onload = function () {\r\n            if (xhr.status === 200) {\r\n                var response = JSON.parse(xhr.responseText);\r\n\r\n                \/\/ Process the response data\r\n                \/\/ Access the JSON data here\r\n                console.log(response);\r\n                renderHTML(response);\r\n            }else{\r\n                \/\/ Request resulted in an error (e.g., 404 or 500)\r\n                handleError(xhr.status);\r\n            }\r\n        };\r\n\r\n        xhr.onerror = function() {\r\n            \/\/ An error occurred during the request\r\n            handleError(xhr.status);\r\n        };\r\n\r\n        \/\/ Send the request\r\n        xhr.send();\r\n    }\r\n\r\n\r\n    \/\/   -------------------------------------------   Function to render HTML code   -------------------------------------------\r\n    function renderHTML(data) {\r\n        \/\/ Select the container element where the HTML code will be added\r\n        let container = document.getElementById(CONTAINER_UNIT+'-container');\r\n        container.classList.add(OU_UNIT);\r\n\r\n        \/\/ Generate HTML elements based on the data\r\n        for (var i = 0; i < data.length; i++) {\r\n            let announcement = data[i];\r\n\r\n            \/\/ Create a new HTML element\r\n            let tr = document.createElement('tr');\r\n            tr.classList.add('announcement');\r\n            tr.classList.add('announcement'+OU_UNIT);\r\n            tr.classList.add(i);\r\n\r\n            \/\/ handle the date variable\r\n            let PUB_DATE = '-';\r\n            if( announcement.OU_PUB_DATE != '' ){\r\n                PUB_DATE = announcement.OU_PUB_DATE;\r\n                PUB_DATE = convertDateFormat(PUB_DATE, lang);\r\n            }\r\n\r\n            let EXP_DATE = '-';\r\n            if( announcement.OU_EXP_DATE != '' ){\r\n                EXP_DATE = announcement.OU_EXP_DATE;\r\n                EXP_DATE = convertDateFormat(EXP_DATE, lang);\r\n            }\r\n\r\n            \/\/ avoid multiple language title is null issues.\r\n            let myTitle = announcement.OU_TITLE_ENG;\r\n            if( lang == 'chi' ){\r\n                myTitle = announcement.OU_TITLE_CHI;\r\n            }else if( lang == 'sim' ){\r\n                myTitle = announcement.OU_TITLE_SIM;\r\n            }\r\n\r\n            if( myTitle == '' ){\r\n                myTitle = announcement.OU_TITLE_ENG;\r\n            }\r\n\r\n\r\n            \/\/ control display or not\r\n            let myShow = announcement.OU_SHOW_ADMIN;\r\n            let myUnit = announcement.OU_UNIT;\r\n\r\n\t\t\t\/*20240118 hhyue add myURL*\/\r\n\t\t\tvar myURL = announcement.OU_URL;\r\n\t\t\tif ( myURL == null || myURL == \" \" || myURL == \"\"){\r\n\t\t\t\tmyURL = subsite_url+'?lang='+lang+'&amp;aid='+announcement.OU_ANNOUNCE_ID;\r\n\t\t\t}\r\n\t\t\t\r\n            if ( myShow == \"Y\" && myUnit == OU_UNIT ){\r\n\r\n                let SHOW_TIME = new Date().getFullYear();\r\n                let SHOW_PUB_DATE = announcement.OU_PUB_DATE.toString().substring(0,4);\r\n                let SHOW_EXP_DATE = announcement.OU_EXP_DATE.toString().substring(0,4);\r\n                \/\/console.log('SHOW_TIME: '+SHOW_TIME);\r\n                \/\/console.log('SHOW_PUB_DATE: '+SHOW_PUB_DATE);\r\n                \/\/console.log('SHOW_EXP_DATE: '+SHOW_EXP_DATE);\r\n\r\n                if (SHOW_TIME - 1 <= SHOW_PUB_DATE || SHOW_TIME === SHOW_EXP_DATE) {\r\n                    \/\/ Set the content of the HTML element\r\n                    tr.innerHTML = \r\n                    '<td style=\"padding:5px; width:30px\"><img decoding=\"async\" src=\"https:\/\/www.hkmu.edu.hk\/data\/images\/arrow.gif\"><\/td>' +\r\n                    '<td style=\"padding:5px;\"><a href=\"'+myURL+'\" target=\"_blank\" >'+myTitle+'<\/a><\/td>'+\r\n                    '<td style=\"padding:5px; \">'+PUB_DATE+'<\/td>'+\r\n                    '<td style=\"padding:5px; \">'+EXP_DATE+'<\/td>';\r\n\r\n                    \/\/ Append the HTML element to the container\r\n                    container.appendChild(tr);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    function renderContentHTML(data) {\r\n        \/\/ Select the container element where the HTML code will be added\r\n        let container = document.getElementById(CONTAINER_UNIT+'-container');\r\n        container.classList.add(OU_UNIT);\r\n        \/\/ Create a new HTML element\r\n        let div = document.createElement('div');\r\n        div.classList.add('announcement');\r\n        div.classList.add('announcement'+OU_UNIT);\r\n\r\n        \/\/ Generate HTML elements based on the data\r\n        let announcement = data[0];\r\n\r\n        \/\/ handle the date variable\r\n        let PUB_DATE = '-';\r\n        if( announcement.OU_PUB_DATE != '' ){\r\n            PUB_DATE = announcement.OU_PUB_DATE;\r\n            PUB_DATE = convertDateFormat(PUB_DATE, lang);\r\n        }\r\n\r\n        div.innerHTML = \r\n        '<h3>'+announcement.OU_TITLE+'<\/h3>'+\r\n        '<p>'+PUB_DATE+'<\/p><hr\/>'+\r\n        '<div class=\"OU_DESC\">'+announcement.OU_DESC+'<\/div>';\r\n\r\n        \/\/ Append the HTML element to the container\r\n        container.appendChild(div);\r\n\r\n    }\r\n\r\n    function convertDateFormat(inputDateTime, lang){\r\n        const date = new Date(inputDateTime);\r\n        let formattedDate = `${date.getDate().toString().padStart(2, '0')}-${date.toLocaleString('en-GB', { month: 'short' }).toUpperCase()}-${date.getFullYear().toString().substring(2)}`;\r\n        if( lang == 'chi' || lang == 'sim' ){\r\n            formattedDate = `${date.getDate().toString().padStart(2, '0')}-${date.toLocaleString('zh-HK', { month: 'short' }).toUpperCase()}-${date.getFullYear().toString().substring(2)}`;\r\n        }\r\n        \/\/console.log(formattedDate+lang); \/\/ Output: 09-OCT-23\r\n        return formattedDate;\r\n    }\r\n\r\n    function handleError(status) {\r\n        if (status === 404) {\r\n            console.log(\"404 Error: Resource not found\");\r\n            document.getElementById(CONTAINER_UNIT+'-container').innerHTML = 'Loading......';\r\n        } else if (status === 500) {\r\n            console.log(\"500 Error: Internal server error\");\r\n            document.getElementById(CONTAINER_UNIT+'-container').innerHTML = 'Loading......';\r\n        } else {\r\n            console.log(\"An error occurred: \" + status);\r\n            document.getElementById(CONTAINER_UNIT+'-container').innerHTML = 'Loading......';\r\n        }\r\n    }\r\n    \r\n<\/script><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_expiration-date-status":"","_expiration-date":0,"_expiration-date-type":"","_expiration-date-categories":[],"_expiration-date-options":[]},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.3 (Yoast SEO v21.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u901a\u544a - Information Technology Office - Hong Kong Metropolitan University<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u901a\u544a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/\" \/>\n<meta property=\"og:site_name\" content=\"Information Technology Office - Hong Kong Metropolitan University\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-17T08:30:40+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u901a\u544a - Information Technology Office - Hong Kong Metropolitan University","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/","og_locale":"zh_TW","og_type":"article","og_title":"\u901a\u544a","og_url":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/","og_site_name":"Information Technology Office - Hong Kong Metropolitan University","article_modified_time":"2023-08-17T08:30:40+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/","url":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/","name":"\u901a\u544a - Information Technology Office - Hong Kong Metropolitan University","isPartOf":{"@id":"https:\/\/www.hkmu.edu.hk\/ito\/#website"},"datePublished":"2021-08-10T11:21:54+00:00","dateModified":"2023-08-17T08:30:40+00:00","breadcrumb":{"@id":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/announcements\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u8cc7\u8a0a\u79d1\u6280\u8655","item":"\/ito\/tc\/"},{"@type":"ListItem","position":2,"name":"\u901a\u544a"}]},{"@type":"WebSite","@id":"https:\/\/www.hkmu.edu.hk\/ito\/#website","url":"https:\/\/www.hkmu.edu.hk\/ito\/","name":"Information Technology Office - Hong Kong Metropolitan University","description":"Information Technology Office - Hong Kong Metropolitan University","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hkmu.edu.hk\/ito\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-TW"}]}},"_links":{"self":[{"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/pages\/10931"}],"collection":[{"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/comments?post=10931"}],"version-history":[{"count":7,"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/pages\/10931\/revisions"}],"predecessor-version":[{"id":18734,"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/pages\/10931\/revisions\/18734"}],"wp:attachment":[{"href":"https:\/\/www.hkmu.edu.hk\/ito\/tc\/wp-json\/wp\/v2\/media?parent=10931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}