Commit 48b03076 by vietdo

#16382 アンケートコンテンツ・試験コンテンツ

parent 82cfc9b8
......@@ -13,12 +13,12 @@ AVWEB.hasErrorKey = 'AVW_HASERR';
* User Environment Check Class
*/
var UserEnvironment = function() {
this.appName = navigator.appName;
this.userAgent = navigator.userAgent;
this.os = checkOS(this.userAgent);
this.browser = checkBrowser(this.userAgent);
/* windows os check */
this.isWindows = function() {
return (this.os == "windows");
......@@ -27,12 +27,12 @@ var UserEnvironment = function() {
this.isMac = function() {
return (this.os == "mac");
};
/* ipad check */
this.isIpad = function() {
return (this.os == "ipad");
};
/* iphone check */
this.isIphone = function() {
return (this.os == "iphone");
......@@ -57,7 +57,7 @@ var UserEnvironment = function() {
return false;
}
};
/** check operating system */
function checkOS(userAgent) {
if(userAgent.toLowerCase().indexOf("windows") >= 0) {
......@@ -79,7 +79,7 @@ var UserEnvironment = function() {
};
/** check user browser */
function checkBrowser(userAgent) {
if(userAgent.toLowerCase().indexOf("msie") >= 0) {
return "msie";
}
......@@ -98,7 +98,7 @@ var UserEnvironment = function() {
if(userAgent.toLowerCase().indexOf("opera") >= 0) {
return "opera";
}
return "unknown";
};
};
......@@ -166,7 +166,7 @@ UserSetting.prototype.show = function(elmid) {
}
tags = tags + "</p>";
$(elmid).html(tags);
}
}
};
/* ユーザ設定のキーリストを取得 */
UserSetting.prototype.keys = function() {
......@@ -204,7 +204,7 @@ UserSetting.prototype.removeAll = function() {
var storage = window.localStorage;
if(storage) {
storage.remove(this.US_KEY);
}
}
};
/*
......@@ -215,7 +215,7 @@ var UserSession = function() {
};
/* Initialize User Session */
UserSession.prototype.init = function(option) {
this.available = false;
if(option == 'restore') {
var value = null;
......@@ -230,7 +230,7 @@ UserSession.prototype.init = function(option) {
}
} else {
this.set("init", new Date().toLocaleString());
this.available = true;
this.available = true;
}
};
/* store key, value item to user session */
......@@ -246,7 +246,7 @@ UserSession.prototype.set = function(key, value) {
} else {
storage.setItem("AVWS_" + key, value);
}
}
}
};
/* get session item value */
UserSession.prototype.get = function(key) {
......@@ -256,7 +256,7 @@ UserSession.prototype.get = function(key) {
} else {
throw new Error("Session Destroyed.");
}
return value;
return value;
};
/* get item value from session storage */
UserSession.prototype._get = function(key) {
......@@ -273,7 +273,7 @@ UserSession.prototype.destroy = function() {
if(storage) {
storage.clear();
this.available = false;
}
}
};
/* show user session object list */
UserSession.prototype.show = function(elmid) {
......@@ -287,7 +287,7 @@ UserSession.prototype.show = function(elmid) {
}
tags = tags + "</p>";
$(elmid).html(tags);
}
}
};
/*
* Variables
......@@ -299,7 +299,7 @@ AVWEB.avwSysSettingObj = null;
/* Initialize system */
$(function () {
// システム設定ファイルの配置先パスの決定
var location = window.location.toString().toLowerCase();
var sysFile = '';
......@@ -324,7 +324,7 @@ $(function () {
alert(error);
}
});
// ロード時に一旦エラー状態をクリアしておく
AVWEB.avwClearError();
});
......@@ -372,13 +372,13 @@ AVWEB.avwCheckLogin = function(option) {
/* エラー画面を表示 */
var tags = '<div id="avw-auth-error">' +
'<div style="display:table; width:100%; height:100%;">' +
'<div style="display:table; width:100%; height:100%;">' +
'<div style="display:table-cell; text-align:center; vertical-align:middle;">' +
'<p><h4>Authentication error</h4>Please use it after login.</p>' +
'<p><h4>Authentication error</h4>Please use it after login.</p>' +
'<div><button id="avw-unauth-ok">OK</button></div>' +
'</div></div></div>';
$('body').prepend(tags);
$('#avw-auth-error').css({
$('#avw-auth-error').css({
'opacity': 1,
'position': 'fixed',
'top': '0',
......@@ -387,14 +387,14 @@ AVWEB.avwCheckLogin = function(option) {
'height': $(window).height(),
'zIndex': '10000'
});
// resize error page
// resize error page
$(window).resize(function() {
$('#avw-auth-error').css( {
'width': $(window).width(),
'height': $(window).height()
});
});
});
var returnPage;
if(option) {
returnPage = option
......@@ -439,10 +439,10 @@ AVWEB.avwCmsApiSyncWithUrl = function(url, accountPath, apiName, type, params, s
/* CMS API Call */
AVWEB._callCmsApi = function(url, accountPath, apiName, type, params, async, success, error) {
// アプリケーション設定取得
var sysSettings = AVWEB.avwSysSetting();
// url 構築
var apiUrl;
if(!url) {
......@@ -454,17 +454,17 @@ AVWEB._callCmsApi = function(url, accountPath, apiName, type, params, async, suc
apiUrl = AVWEB.format(apiUrl, accountPath);
}
apiUrl = apiUrl + '/' + apiName + '/';
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
params.pid = CONTENTVIEW_GENERAL.pid;
}
//----------------------------------------------------------------------------------
// for IE: 暫定的に対応 (これをすることでIE9でもCrossDomainリクエストが可能だがアクセスのたびに警告が出る)
$.support.cors = true;
//----------------------------------------------------------------------------------
// ajax によるAPIの実行(json)
$.ajax( {
async: (async) ? async : false,
......@@ -499,37 +499,37 @@ AVWEB._callCmsApi = function(url, accountPath, apiName, type, params, async, suc
else {
AVWEB.showSystemError();
}
}
}
});
};
/* CMS API Call */
AVWEB._callCmsApiWhen = function(accountPath, apiName, type, params ) {
// アプリケーション設定取得
var sysSettings = AVWEB.avwSysSetting();
// url 構築
var apiUrl = ClientData.conf_apiUrl();
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
apiUrl = apiUrl + '/' + apiName + '/';
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
params.pid = CONTENTVIEW_GENERAL.pid;
}
//----------------------------------------------------------------------------------
// for IE: 暫定的に対応 (これをすることでIE9でもCrossDomainリクエストが可能だがアクセスのたびに警告が出る)
$.support.cors = true;
//----------------------------------------------------------------------------------
// ajax によるAPIの実行(json)
var ajaxObj = $.ajax( {
async: true,
......@@ -549,9 +549,9 @@ AVWEB._callCmsApiWhen = function(accountPath, apiName, type, params ) {
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
}
});
return ajaxObj;
};
/*
......@@ -650,23 +650,23 @@ AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
requestParams = requestParams + '&pid=' + CONTENTVIEW_GENERAL.pid;
}
apiUrl += '?' + requestParams + '&isBase64=true';
if( ClientData.isStreamingMode() ){
apiUrl += '&isStreaming=true';
}
// バイナリ形式で画像イメージを取得し、Base64にエンコードする
var xmlHttp;
var ie = false;
//if(window.ActiveXObject) {
// xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
// ie = true;
//} else {
//xmlHttp = new XMLHttpRequest();
//}
//IE10以降はXMLHttpRequestを優先して使う
try{
xmlHttp = new XMLHttpRequest();
......@@ -679,14 +679,14 @@ AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
return;
}
}
xmlHttp.open('get', apiUrl);
xmlHttp.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xmlHttp.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
/*
if(xmlHttp.overrideMimeType) {
// for FF, Chrome, Safari
xmlHttp.overrideMimeType('text/plain; charset=x-user-defined');
xmlHttp.overrideMimeType('text/plain; charset=x-user-defined');
}
*/
xmlHttp.onreadystatechange = function () {
......@@ -696,13 +696,13 @@ AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
//base64 encode
var ids = new ImageDataScheme();
var src; // Image Data URI
if(ie) {
// for IE
src = ids.convImageToDataScheme(xmlHttp.responseBody, ie);
} else {
// for FF, Chrome, Safari
src = ids.convImageToDataScheme(xmlHttp.responseText, ie);
src = ids.convImageToDataScheme(xmlHttp.responseText, ie);
}
*/
var src; // Image Data URI
......@@ -712,7 +712,7 @@ AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
src = 'data:image/png;base64,' + xmlHttp.responseBody;
} else {
// for FF, Chrome, Safari
src = 'data:image/png;base64,' + xmlHttp.responseText;
src = 'data:image/png;base64,' + xmlHttp.responseText;
}
*/
src = 'data:image/png;base64,' + xmlHttp.responseText;
......@@ -742,11 +742,11 @@ AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
* ]
*/
AVWEB.avwUploadBackupFile = function(accountPath, params, async, success, error) {
/* API実行準備*/
var sysSettings = AVWEB.avwSysSetting();
var apiName = 'uploadBackupFile'; // API名
//url 構築
var apiUrl;
apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
......@@ -754,25 +754,25 @@ AVWEB.avwUploadBackupFile = function(accountPath, params, async, success, error)
apiUrl = AVWEB.format(apiUrl, accountPath)
}
apiUrl = apiUrl + '/' + apiName + '/';
/* POST(multipart/form-data)送信準備 */
var body = '';
var boundary = '';
// boundaryを構築
var date = new Date();
boundary = '------------------------' + date.getMilliseconds()
boundary = '------------------------' + date.getMilliseconds()
+ (date.getMonth() + 1)
+ date.getMinutes()
+ date.getFullYear()
+ date.getDay()
+ date.getHours()
+ date.getSeconds();
// bodyを構築
for(var i = 0; i < params.length; i++) {
var item = params[i];
body += '--' + boundary + '\r\n';
body += '--' + boundary + '\r\n';
body += 'Content-Disposition: form-data; name="' + item.name + '"';
if(item.fileName) {
body += '; filename="' + item.fileName + '"\r\n';
......@@ -786,7 +786,7 @@ AVWEB.avwUploadBackupFile = function(accountPath, params, async, success, error)
body += item.content + '\r\n';
}
body += '--' + boundary + '--\r\n';
// ajax によるAPIの実行(json)
$.ajax( {
async: (async) ? async : false,
......@@ -801,7 +801,7 @@ AVWEB.avwUploadBackupFile = function(accountPath, params, async, success, error)
*/
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
/*
* uploadBackupFileは multipart/form-data でPOST送信する
*/
......@@ -821,11 +821,11 @@ AVWEB.avwUploadBackupFile = function(accountPath, params, async, success, error)
AVWEB.showSystemError();
}
}
});
});
};
/* show system error message */
AVWEB.showSystemError = function(textId) {
if(AVWEB.avwHasError()) {
// すでにエラー状態であればエラーを表示しない
return;
......@@ -833,11 +833,11 @@ AVWEB.showSystemError = function(textId) {
// エラー状態にセット
AVWEB.avwSetErrorState();
}
if( !textId ){
textId = 'sysErrorCallApi01';
}
// create DOM element for showing error message
var errMes = I18N.i18nText(textId);
var tags = '<div id="avw-sys-error"></div>';
......@@ -853,12 +853,12 @@ AVWEB.showSystemError = function(textId) {
'background': '#999',
'z-index': 90000
});
// resize error page
// resize error page
$(window).resize(function() {
$('#avw-sys-error').css( {
'width': $(window).width(),
'height': $(window).height()
});
});
});
// show error messages
$().toastmessage({ position: 'middle-center' });
......@@ -886,7 +886,7 @@ AVWEB.showSystemError = function(textId) {
sticky: true,
text: errMes,
close: function() { isShowErrorMessage = false; }
});
});
*/
};
/* エラー状態を取得 */
......@@ -927,7 +927,7 @@ AVWEB.avwSetLogoutNortice = function() {
var e = event || window.event;
if(e) {
e.returnValue = message;
}
}
return message;
}
};
......@@ -937,7 +937,7 @@ AVWEB.avwScreenMove = function(url) {
window.onbeforeunload = null;
window.location = url;
};
/* Debug Log */
/* Debug Log */
AVWEB.avwLog = function(msg) {
if(AVWEB.avwSysSetting().debug) {
console.log(msg);
......@@ -969,26 +969,26 @@ AVWEB.getApiUrl = function(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
return apiUrl;
};
/* get url */
AVWEB.getURL = function(apiName) {
//var sysSettings = AVWEB.avwSysSetting();
var isStreaming = "false";
if(ClientData.isStreamingMode()){
isStreaming = "true";
}
var url = ClientData.conf_apiResourceDlUrl(); //sysSettings.apiResourceDlUrl;
url = AVWEB.format(url, ClientData.userInfo_accountPath()) + '/' + apiName + '/?isStreaming=' + isStreaming;
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
url = url + '&pid=' + CONTENTVIEW_GENERAL.pid;
}
return url;
};
......
......@@ -2125,8 +2125,10 @@ CONTENTVIEW.displayOverlayForSpecifyContentType = function( resourceUrl ){
}
CONTENTVIEW.handleForContentTypeHTML(linkUrlTmp);
}
else if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Exam) {
else if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Exam){
CONTENTVIEW.handleForContentTypeExam(resourceUrl);
} else if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Enquete){
CONTENTVIEW.handleForContentTypeEnquete(resourceUrl);
}
if (COMMON.isTouchDevice() == true) {
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
......@@ -2365,7 +2367,31 @@ CONTENTVIEW.handleForContentTypeExam = function(resourceUrl){
}
else{
$container.html('<iframe src="'+ resourceUrl +'" style="position: absolute; width: 100%; height: 100%; "> </iframe>');
$container.css('overflow', 'hidden');
$container.css('overflow', 'hidden');
}
//END TRB00076 - EDITOR : Long - Date : 09/24/2013 - Summary : Fix for scrolling on ipad
$container.show();
};
CONTENTVIEW.handleForContentTypeEnquete = function(resourceUrl){
//Create Dialog overlay
var $container = $('#dialog');
$container.html('');
$container.css('left','0%');
$container.css('width','100%');
$container.css('background-color','white');
//START TRB00076 - EDITOR : Long - Date : 09/24/2013 - Summary : Fix for scrolling on ipad
if(CONTENTVIEW_GENERAL.avwUserEnvObj.isIos()){
$container.html('<iframe src="'+ resourceUrl +'" style="position: absolute; width: 100%;"></iframe>');
$container.css('overflow', 'scroll');
$container.css('-webkit-overflow-scrolling', 'touch');
}
else{
$container.html('<iframe src="'+ resourceUrl +'" style="position: absolute; width: 100%; height: 100%; "> </iframe>');
$container.css('overflow', 'hidden');
}
//END TRB00076 - EDITOR : Long - Date : 09/24/2013 - Summary : Fix for scrolling on ipad
$container.show();
......@@ -5692,7 +5718,6 @@ CONTENTVIEW.ready = function(initContentId){
getType: 1,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
......@@ -5754,18 +5779,25 @@ CONTENTVIEW.ready = function(initContentId){
else{
if(CONTENTVIEW_GENERAL.contentType == "exam" || CONTENTVIEW_GENERAL.contentType == "enquete") {
var isShowResult, isSendResult;
if(data.contentData.showResult == 1){
isShowResult = true;
} else {
isShowResult = false;
}
if(data.contentData.sendResult == 1){
isSendResult = true;
if(CONTENTVIEW_GENERAL.contentType == "exam") {
if(data.contentData.showResult == 1){
isShowResult = true;
} else {
isShowResult = false;
}
if(data.contentData.sendResult == 1){
isSendResult = true;
} else {
isSendResult = false;
}
}
var contentId = data.contentData.contentId;
var url;
if(CONTENTVIEW_GENERAL.contentType == "exam"){
url = CONTENTVIEW_GETDATA.getURLPageImage("webEnqueteReply/init") + "&abObjectId=&sid=" + CONTENTVIEW.getSessionId()+"&contentId="+contentId+"&isShowResult="+isShowResult+"&isSendResult="+isSendResult;
} else {
isSendResult = false;
url = CONTENTVIEW_GETDATA.getURLPageImage("webEnqueteReply/init") + "&abObjectId=&sid=" + CONTENTVIEW.getSessionId()+"&contentId="+contentId;
}
var contentId = data.contentData.contentId;
var url = CONTENTVIEW_GETDATA.getURLPageImage("webEnqueteReply/init") + "&sid=" + CONTENTVIEW.getSessionId()+"&contentId="+contentId+"&isShowResult="+isShowResult+"&isSendResult="+isSendResult;
/* init footer toolbar */
$('#footer_toolbar_2').hide();
$('#footer_toolbar_1').show();
......@@ -5788,7 +5820,7 @@ CONTENTVIEW.ready = function(initContentId){
//enable SpecifyControl
CONTENTVIEW.enableControlForMediaAndHtmlType();
 CONTENTVIEW.displayOverlayForSpecifyContentType(url);
$(window).resize(function () {
$(window).resize(function () {
//Check if content is zooming
if(CONTENTVIEW.isZoomingContent){
......@@ -5799,19 +5831,19 @@ CONTENTVIEW.ready = function(initContentId){
//$container.css('height', h);
//$container.css('width', w);
}
});
});
CONTENTVIEW.handleSliderBar();
$('#lblSlider').text('/ ' + 1);
CONTENTVIEW.handleSliderBar();
$('#lblSlider').text('/ ' + 1);
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid() == false) {
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid() == false) {
$("#slider_page").slider("option", "disabled", true);
}
}
COMMON.disable('#txtSearch', '#txtSlider');
} else {
COMMON.disable('#txtSearch', '#txtSlider');
}else {
CONTENTVIEW_INITOBJECT.initPage();
}
}
}
//ストリーミングならデバイス側に初期表示済通知
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment