Commit a390a976 by Masaru Abe

ストリーミング対応

parent c9d68471
......@@ -4,15 +4,14 @@
* Copyright (C) Agentec Co, Ltd. All rights reserved.
*/
/*
* User Environment Check Class
*/
//グローバルの名前空間用のオブジェクトを用意する
var AVWEB = {};
AVWEB.hasErrorKey = 'AVW_HASERR';
/*
* User Environment Check Class
*/
var UserEnvironment = function() {
this.appName = navigator.appName;
......@@ -42,6 +41,15 @@ var UserEnvironment = function() {
this.isAndroid = function() {
return (this.os == "android");
};
/* iOS check */
this.isIos = function() {
if(this.os == "ipad" || this.os == "iphone"){
return true;
} else {
return false;
}
};
/** check operating system */
function checkOS(userAgent) {
if(userAgent.toLowerCase().indexOf("windows") >= 0) {
......@@ -570,8 +578,10 @@ AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
// 送信パラメータの構築
var requestParams = 'contentId=' + params.contentId + '&sid=' + params.sid + '&pageNo=' + params.pageNo;
//apiUrl += '?' + requestParams;
apiUrl += '?' + requestParams + '&isBase64=true';
if( ClientData.isStreamingMode() ){
apiUrl += '&isStreaming=true';
}
// バイナリ形式で画像イメージを取得し、Base64にエンコードする
var xmlHttp;
......@@ -780,7 +790,8 @@ AVWEB.showSystemError = function() {
sticky: true,
text: errMes,
close: function() {
//ログアウト時と同じ後始末処理をしてログイン画面に戻す
if( ClientData.isStreamingMode() == false ){
//ストリーミングでなければログアウト時と同じ後始末処理をしてログイン画面に戻す
if( !HEADER.webLogoutEvent() ){
//ログアウト出来なかった
SessionStorageUtils.clear();
......@@ -788,6 +799,7 @@ AVWEB.showSystemError = function() {
AVWEB.avwScreenMove(COMMON.ScreenIds.Login);
}
}
}
});
/*
$().toastmessage('showToast', {
......@@ -824,7 +836,7 @@ AVWEB.avwClearError = function() {
/* ブラウザunload時に警告メッセージの出力設定を行う関数 */
AVWEB.avwSetLogoutNortice = function() {
window.onbeforeunload = function(event) {
if( ClientData.isGetitsMode() == true ){
if( ClientData.isGetitsMode() == true || ClientData.isStreamingMode() == true ){
COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
COMMON.RegisterLog();
} else {
......@@ -882,8 +894,15 @@ AVWEB.getApiUrl = function(accountPath) {
/* 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;
url = AVWEB.format(url, ClientData.userInfo_accountPath()) + '/' + apiName + '/?isStreaming=' + isStreaming;
return url;
};
......
......@@ -118,7 +118,8 @@ COMMON.ScreenIds = {
Setting : 'settings.html?__UPDATEID__',
BookmarkList : 'bookmark.html?__UPDATEID__',
ContentSearch : 'contentsearch.html?__UPDATEID__',
History: 'history.html?__UPDATEID__'
History: 'history.html?__UPDATEID__',
ContentViewStreaming : 'contentview_streaming.html?__UPDATEID__',
};
COMMON.Keys = {
......@@ -350,10 +351,13 @@ COMMON.Keys = {
userOpt_pageTransitionPeriod: 'userOpt_pageTransitionPeriod',
isGetitsMode: 'isGetitsMode',
isStreamingMode: 'isStreamingMode',
conf_apiUrl: 'conf_apiUrl',
conf_apiLoginUrl: 'conf_apiLoginUrl',
conf_apiResourceDlUrl: 'conf_apiResourceDlUrl'
conf_apiResourceDlUrl: 'conf_apiResourceDlUrl',
latitude: 'latitude',
longitude: 'longitude'
/* -------------------------------------------------------------------------------- */
};
......@@ -401,6 +405,9 @@ function LogEntity() {
this.readingEndDate = null;
this.readingTime = 0;
this.deviceTypeId = 4;
//GPS
this.latitude = '';
this.longitude = '';
//ページログ配列
this.pageLogArray = [];
//詳細ログ配列
......@@ -1625,6 +1632,21 @@ var ClientData = {
}
},
isStreamingMode: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.isStreamingMode, JSON.stringify(data));
} else {
if (SessionStorageUtils.get(COMMON.Keys.isStreamingMode) != 'undefined'
&& SessionStorageUtils.get(COMMON.Keys.isStreamingMode) != undefined
&& SessionStorageUtils.get(COMMON.Keys.isStreamingMode) != ''
&& SessionStorageUtils.get(COMMON.Keys.isStreamingMode) != null
&& SessionStorageUtils.get(COMMON.Keys.isStreamingMode) != 'null') {
return JSON.parse(SessionStorageUtils.get(COMMON.Keys.isStreamingMode));
}
return false;
}
},
conf_apiUrl: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.conf_apiUrl, data);
......@@ -1645,6 +1667,22 @@ var ClientData = {
} else {
return SessionStorageUtils.get(COMMON.Keys.conf_apiResourceDlUrl);
}
},
latitude: function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.latitude, data);
} else {
return SessionStorageUtils.get(COMMON.Keys.latitude);
}
},
longitude: function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.longitude, data);
} else {
return SessionStorageUtils.get(COMMON.Keys.longitude);
}
}
};
......@@ -2106,7 +2144,11 @@ COMMON.LockScreen = function() {
return;
}
//getitsでも発動しない
if( ClientData.isGetitsMode() == true ){
if(ClientData.isGetitsMode() == true){
return;
}
//ストリーミングでも発動しない
if(ClientData.isStreamingMode() == true){
return;
}
......@@ -2279,6 +2321,23 @@ COMMON.SetStartLog = function(strContentId) {
// Reading time
log.readingTime = log.readingEndDate.subtractBySeconds(log.readingStartDate);
//デバイスタイプ判定
var deviceType = 4;
if(ClientData.isStreamingMode()){
if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
deviceType = 1;
} else if(CONTENTVIEW_GENERAL.avwUserEnvObj.os == "iphone"){
deviceType = 2;
} else if(CONTENTVIEW_GENERAL.avwUserEnvObj.os == "android"){
deviceType = 3;
}
}
log.deviceTypeId = deviceType;
//GPS
log.latitude = ClientData.latitude();
log.longitude = ClientData.longitude();
//PageLog 1ページ目セット(1レコードは必須)
var pageLog = new PageLogEntity();
pageLog.contentid = strContentId;
......@@ -2292,6 +2351,27 @@ COMMON.SetStartLog = function(strContentId) {
ClientData.ContentLogData(arrContentLogs);
};
/*
Set starting log for reading content
*/
COMMON.SetGpsLog = function(strContentId) {
var arrContentLogs = ClientData.ContentLogData();
for (var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if (arrContentLogs[nIndex].contentid == strContentId) {
//GPS
arrContentLogs[nIndex].latitude = ClientData.latitude();
arrContentLogs[nIndex].longitude = ClientData.longitude();
break;
}
}
// Set back to storage
ClientData.ContentLogData(arrContentLogs);
};
// Set ending log for reading content
COMMON.SetEndLog = function(strContentId) {
......@@ -2331,6 +2411,11 @@ COMMON.SetPageLog = function(strContentId, strPageNo){
}
ClientData.ContentLogData(arrContentLogs);
//ストリーミングモード
if(ClientData.isStreamingMode()){
CONTENTVIEW_STREAMING.movePage(strPageNo + 1);
}
};
// 1アクションのオブジェクトログを作成
......@@ -2370,7 +2455,7 @@ COMMON.SetObjectLogActionTime = function( strContentId, objectId, actionTime ){
/*
Register reading log of content to server by calling api
*/
COMMON.RegisterLog = function() {
COMMON.RegisterLog = function(is) {
var arrContentLogs = ClientData.ContentLogData();
var isError = false;
......@@ -2495,9 +2580,12 @@ COMMON.RegisterLog = function() {
readingStartDate: dateStart.jpDateTimeString1(),
readingEndDate: dateEnd.jpDateTimeString1(),
readingTime: arrContentLogs[nIndex].readingTime,
deviceTypeId: 4,
deviceTypeId: arrContentLogs[nIndex].deviceTypeId,
latitude: arrContentLogs[nIndex].latitude,
longitude: arrContentLogs[nIndex].longitude,
pageLog: pageLogJson,
objectLog: objectLogJson
objectLog: objectLogJson,
isStreaming: ClientData.isStreamingMode()
};
//API送信結果判定
arrContentLogs[nIndex].sendResult = false;
......@@ -3002,3 +3090,26 @@ COMMON.formatStringBase64 = function(imgStr) {
return outputString;
};
//Get param url
COMMON.getUrlParam = function(name, url){
if(!url){
url = window.location.href;
}
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec(url);
if( results == null ){
return "";
}
else{
//alert("results[0]:" + results[0]);
//alert("results[1]:" + results[1]);
return results[1];
}
};
......@@ -68,6 +68,14 @@
}
</style>
<script type="text/javascript">
$(document).ready(function() {
//CONTENTVIEW.ready();
});
</script>
</head>
<body id="viewer" oncontextmenu="return false;">
......
......@@ -11,8 +11,7 @@ CONTENTVIEW_CALLAPI.abapi = function(name, param, method, callback) {
/* get Json stored content info */
CONTENTVIEW_CALLAPI.getJsonContentInfo = function() {
console.log("CONTENTVIEW_CALLAPI.getJsonContentInfo");
//console.log("CONTENTVIEW_CALLAPI.getJsonContentInfo");
AVWEB.avwGrabContentPageImage(ClientData.userInfo_accountPath(),
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), pageNo: 1 },
function (data) {
......@@ -35,6 +34,13 @@ console.log("CONTENTVIEW_CALLAPI.getJsonContentInfo");
//未使用
CONTENTVIEW_CALLAPI.webGetPageImageContentSize = function() {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webContentPageSize",
"GET",
......@@ -48,10 +54,18 @@ CONTENTVIEW_CALLAPI.webGetPageImageContentSize = function() {
//START TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
CONTENTVIEW_CALLAPI.webGetContentPageSize = function(){
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 6,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), getType: 6 },
params,
function (data) {
if( data.contentData.pageInfoData.pagesInfo ){
$.each(data.contentData.pageInfoData.pagesInfo, function(i, n){
......@@ -81,10 +95,18 @@ CONTENTVIEW_CALLAPI.getPageSizeByPageNo = function(pageNo){
//END TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
CONTENTVIEW_CALLAPI.webGetContentData = function() {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 1,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), getType: 1 },
params,
function (data) {
CONTENTVIEW_GENERAL.totalPage = data.contentData.allPageNum;
},
......@@ -93,10 +115,18 @@ CONTENTVIEW_CALLAPI.webGetContentData = function() {
/* get Json stored page title */
CONTENTVIEW_CALLAPI.getJsonDataPageTitle = function() {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 3,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), getType: 3 },
params,
function (data) {
CONTENTVIEW_GENERAL.dataPageTitle = [];
for (var nIndex = 0; nIndex < CONTENTVIEW_GENERAL.totalPage; nIndex++) {
......@@ -114,10 +144,18 @@ CONTENTVIEW_CALLAPI.getJsonDataPageTitle = function() {
/* get Json webGetContent4 */
CONTENTVIEW_CALLAPI.getJsonDataType4 = function() {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 4,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), getType: 4 },
params,
function (data) {
CONTENTVIEW_GENERAL.dataJsonType4 = data.contentData.linkData;
},
......@@ -126,10 +164,18 @@ CONTENTVIEW_CALLAPI.getJsonDataType4 = function() {
/* get Json webGetContent5 */
CONTENTVIEW_CALLAPI.getJsonDataType5 = function() {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 5,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), getType: 5 },
params,
function (data) {
CONTENTVIEW_GENERAL.dataJsonType5 = data.contentData.outlineData;
},
......@@ -138,11 +184,19 @@ CONTENTVIEW_CALLAPI.getJsonDataType5 = function() {
/* read file Json -> get page objects */
CONTENTVIEW_CALLAPI.getDataJsonFile = function() {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 2,
isStreaming: ClientData.isStreamingMode()
};
//get content from JSON
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
{ sid: ClientData.userInfo_sid(), contentId: CONTENTVIEW_GENERAL.contentID, getType: 2 },
params,
function (data) {
var JsonFile = data.contentData;
CONTENTVIEW_GENERAL.pageObjectsData = [];
......@@ -211,10 +265,18 @@ CONTENTVIEW_CALLAPI.getDataJsonFile = function() {
CONTENTVIEW_CALLAPI.loadDataBookmark = function(lstPageNo) {
if (CONTENTVIEW_GENERAL.isSendingData == true) {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
pageNos: lstPageNo[0],
thumbnailFlg: 1,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webContentPage",
"GET",
{ sid: ClientData.userInfo_sid(), contentId: CONTENTVIEW_GENERAL.contentID, pageNos: lstPageNo[0], thumbnailFlg: 1 },
params,
function (data) {
CONTENTVIEW_GETDATA.getDataLoaded(data.pages);
......@@ -265,10 +327,18 @@ CONTENTVIEW_CALLAPI.getSearchDataFromJson = function() {
arrPageNo += "," + (nIndex + 1);
}
}
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
thumbnailFlg: 0,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webContentPage",
"GET",
{ sid: ClientData.userInfo_sid(), contentId: CONTENTVIEW_GENERAL.contentID, thumbnailFlg: 0 },
params,
function (data) {
CONTENTVIEW_GENERAL.contentName = data.contentTitle;
CONTENTVIEW_GENERAL.dataWebContentPage = data;
......@@ -280,10 +350,19 @@ CONTENTVIEW_CALLAPI.getSearchDataFromJson = function() {
CONTENTVIEW_CALLAPI.loadDataSearch = function(lstPageNo) {
if (CONTENTVIEW_GENERAL.isSendingData == true) {
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
pageNos: lstPageNo[0],
thumbnailFlg: 1,
isStreaming: ClientData.isStreamingMode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webContentPage",
"GET",
{ sid: ClientData.userInfo_sid(), contentId: CONTENTVIEW_GENERAL.contentID, pageNos: lstPageNo[0], thumbnailFlg: 1 },
params,
function (data) {
CONTENTVIEW_GETDATA.getDataLoaded(data.pages);
......
......@@ -274,7 +274,7 @@ CONTENTVIEW_GENERAL.disableAllControl = function() {
$('#zoomout').unbind('click');
$('#zoomout').removeClass();
$('#zoomout').addClass('reduction_off');
if (CONTENTVIEW_GENERAL.avwUserEnvObj.os != "android") {
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid() == false) {
$("#slider_page").slider("option", "disabled", true);
}
......@@ -384,7 +384,7 @@ CONTENTVIEW_GENERAL.enableAllControl = function() {
}
if (CONTENTVIEW_GENERAL.avwUserEnvObj.os != "ipad" && CONTENTVIEW_GENERAL.avwUserEnvObj.os != "android") {
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() == false && CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid() == false) {
$('#button_next_canvas').css('display', 'block');
$('#button_pre_canvas').css('display', 'block');
}
......@@ -530,6 +530,11 @@ CONTENTVIEW_GENERAL.clearCanvas = function(targetCanvas) {
//};
CONTENTVIEW_GENERAL.showDialog = function(modal) {
if(ClientData.isStreamingMode()){
$("#dialog").css('z-index', 998);
$("#dialog").fadeIn(300);
} else {
$("#overlay").show();
$("#dialog").fadeIn(300);
......@@ -541,6 +546,8 @@ CONTENTVIEW_GENERAL.showDialog = function(modal) {
CONTENTVIEW_GENERAL.hideDialog();
});
}
}
};
CONTENTVIEW_GENERAL.hideDialog = function() {
......
......@@ -210,9 +210,13 @@ $(function () {
// Setup for easer [start]
// ---------------------------------
if(COMMON.isTouchDevice() == true){
if ($('#dlgGomu_dspOK').length) {
document.getElementById('dlgGomu_dspOK').addEventListener('touchstart',CONTENTVIEW_GOMU.touchStart_BtnOk_Gomu,false);
}
if ($('#dlgGomu_dspCancel').length) {
document.getElementById('dlgGomu_dspCancel').addEventListener('touchstart',CONTENTVIEW_GOMU.touchStart_BtnCancel_Gomu,false);
}
}
$("#dlgGomu_dspOK").click(CONTENTVIEW_GOMU.dlgGomu_dspOK_click);
$("#dlgGomu_dspCancel").click(CONTENTVIEW_GOMU.dlgGomu_dspCancel_click);
......
......@@ -32,7 +32,7 @@ CONTENTVIEW_MAKER.touchStart_BtnCancel_Maker = function(e){
CONTENTVIEW_MAKER.Maker_handleColorPickerEvent = function (){
if(CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad" || CONTENTVIEW_GENERAL.avwUserEnvObj.os == "android"){
if(CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()){
$('#dlgMaker .colorpicker').unbind('mouseenter');
$('#dlgMaker .colorpicker').unbind('mouseleave');
$('#makerColorwrapper').unbind('mouseleave');
......
......@@ -36,7 +36,7 @@ CONTENTVIEW_PEN.touchStart_BtnCancel_Pen = function(e){
CONTENTVIEW_PEN.Pen_handleColorPickerEvent = function() {
if(CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad" || CONTENTVIEW_GENERAL.avwUserEnvObj.os == "android"){
if(CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()){
$('#dlgPen .colorpicker').unbind('mouseenter');
$('#dlgPen .colorpicker').unbind('mouseleave');
$('#penColorwrapper').unbind('mouseleave');
......
//名前空間用のオブジェクトを用意する
var CONTENTVIEW_STREAMING = {};
CONTENTVIEW_STREAMING.ready = function(){
//CONTENTVIEW.handleDisplayToolbar();
};
CONTENTVIEW_STREAMING.movePage = function(pageNo){
console.log("CONTENTVIEW_STREAMING.movePage");
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
//ページ番号を送信
var url = "abookpagemove://?contentId=" + CONTENTVIEW_GENERAL.contentID + "&page=" + pageNo;
location.href = url;
}
};
CONTENTVIEW_STREAMING.moveContent = function(contentId){
console.log("CONTENTVIEW_STREAMING.moveContent");
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
//コンテンツIDを送信
var url = "abookopen://?contentId=" + contentId;
location.href = url;
}
};
CONTENTVIEW_STREAMING.sendLog = function(){
console.log("CONTENTVIEW_STREAMING.sendLog");
COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
COMMON.RegisterLog();
//送信終了を通知
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
var url = "abooksendlog://?send=true";
location.href = url;
//$("#debug").html("abooksendlog://?send=true");
}
};
CONTENTVIEW_STREAMING.initPageView = function(){
console.log("CONTENTVIEW_STREAMING.initPageView");
//初期描画完了を通知
//if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos()) {
var url = "abookopenfinish://?init=true";
location.href = url;
$("#debug").html("send abookopenfinish://?init=true");
}
};
......@@ -1078,7 +1078,7 @@ HEADER.downloadResourceById = function(contentId){
//Download resource
HEADER.getResourceByIdFromAPI = function(resourceId){
return AVWEB.getURL("webResourceDownload") + "/?sid=" + ClientData.userInfo_sid() + "&resourceId=" + resourceId + "&isDownload=true";
return AVWEB.getURL("webResourceDownload") + "&sid=" + ClientData.userInfo_sid() + "&resourceId=" + resourceId + "&isDownload=true";
};
// check is browser safari on Mac and Window devide ( not Ipad )
......
......@@ -177,7 +177,7 @@ LOGIN.processLogin = function() {
var apiLoginUrl = ClientData.conf_apiLoginUrl(); //sysSettings.apiLoginUrl;
//引数パラメータがあれば取得
var paramContentID = LOGIN.getUrlParams('cid');
var paramContentID = COMMON.getUrlParam('cid', '');
AVWEB.avwCmsApiWithUrl(apiLoginUrl, null, 'webClientLogin', 'GET', params, function (data) {
//requirePasswordChange = data.requirePasswordChange;
......@@ -524,86 +524,6 @@ LOGIN.loginWhenClickEnter = function(e){
}
};
$(document).ready(function (e) {
//セッションストレージクリア
SessionStorageUtils.clear();
AVWEB.avwUserSessionObj = null;
// create new session
AVWEB.avwCreateUserSession();
I18N.initi18n();
var sysSettings = AVWEB.avwSysSetting(); // get info in conf.json
//getitsサーバー設定確認
//getitsモード初期化
ClientData.isGetitsMode(false);
if( sysSettings.apiUrl == "" ){
//引数パラメータを取得
var siteUrl = LOGIN.getUrlParams('siteUrl');
var urlPath = LOGIN.getUrlParams('urlPath');
if(siteUrl != "" && urlPath != ""){
//getitsモード有効
ClientData.isGetitsMode(true);
//api接続先設定
ClientData.conf_apiUrl( siteUrl + "{0}/abvapi" );
ClientData.conf_apiLoginUrl( siteUrl + "nuabvapi" );
ClientData.conf_apiResourceDlUrl( siteUrl + "{0}/dl" );
//アカウント関連
ClientData.userInfo_accountPath(urlPath);
ClientData.userInfo_accountPath_session(urlPath);
ClientData.userInfo_loginId("");
ClientData.userInfo_loginId_session("");
}
} else {
//confのパラメータセット
ClientData.conf_apiUrl( sysSettings.apiUrl );
ClientData.conf_apiLoginUrl( sysSettings.apiLoginUrl );
ClientData.conf_apiResourceDlUrl( sysSettings. apiResourceDlUrl );
}
if( ClientData.isGetitsMode() == true ){
//念のため前回までの閲覧ログは削除
ClientData.ContentLogData([]);
$('#anonymous').show();
setTimeout(
function () {
LOGIN.initLoginGetitsUser();
},
LOGIN.timeWaitSplashScreen
);
} else if (COMMON.isAnonymousLogin()) {
$('#anonymous').show();
setTimeout(
function () {
LOGIN.initLoginAnonymousUser();
}, LOGIN.timeWaitSplashScreen);
}
else {
$('#normalUser').show();
$('#formlogin').hide();
$('#logologin').animate({ "margin-top": 0 }, LOGIN.timeWaitSplashScreen,
function () {
$('#formlogin').show();
$('#menu-language').animate({ opacity: 1 }, LOGIN.timeWaitSplashScreen);
$('#formlogin').animate({ opacity: 1 }, LOGIN.timeWaitSplashScreen);
$('.cnt_footer').animate({ opacity: 1 }, LOGIN.timeWaitSplashScreen);
}
);
LOGIN.initLoginNormalUser();
}
});
// init login for normal user
LOGIN.initLoginNormalUser = function() {
......@@ -696,7 +616,7 @@ LOGIN.initLoginAnonymousUser = function() {
if( ClientData.serviceOpt_catalog_edition() == 'Y'){
//引数パラメータがあれば取得
var paramContentID = LOGIN.getUrlParams('cid');
var paramContentID = COMMON.getUrlParam('cid', '');
//カタログ対応
if( paramContentID != '' ){
//OpenUrlでコンテンツ開く
......@@ -781,7 +701,7 @@ LOGIN.initLoginGetitsUser = function() {
$('#anonymous').fadeOut('slow', 'swing', function () {
//引数パラメータがあれば取得
var paramContentID = LOGIN.getUrlParams('cid');
var paramContentID = COMMON.getUrlParam('cid', '');
//カタログ対応
if( paramContentID != '' ){
//OpenUrlでコンテンツ開く
......@@ -894,20 +814,6 @@ LOGIN.alertMessageCancelFunction_callback = function(){
}
};
//Get param url
LOGIN.getUrlParams = function(name){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ){
return "";
}
else{
return results[1];
}
};
//Get urlPath String
LOGIN.getUrlPath = function(){
//URL文字列から事業者ID部分を抽出
......@@ -921,4 +827,86 @@ LOGIN.getUrlPath = function(){
}
};
//$(document).ready(function (e) {
LOGIN.ready = function(){
//セッションストレージクリア
SessionStorageUtils.clear();
AVWEB.avwUserSessionObj = null;
// create new session
AVWEB.avwCreateUserSession();
I18N.initi18n();
var sysSettings = AVWEB.avwSysSetting(); // get info in conf.json
//モード初期化
ClientData.isGetitsMode(false);
ClientData.isStreamingMode(false);
//getitsサーバー設定確認
if( sysSettings.apiUrl == "" ){
//引数パラメータを取得
var siteUrl = COMMON.getUrlParam('siteUrl', '');
var urlPath = COMMON.getUrlParam('urlPath', '');
if(siteUrl != "" && urlPath != ""){
//getitsモード有効
ClientData.isGetitsMode(true);
//api接続先設定
ClientData.conf_apiUrl( siteUrl + "{0}/abvapi" );
ClientData.conf_apiLoginUrl( siteUrl + "nuabvapi" );
ClientData.conf_apiResourceDlUrl( siteUrl + "{0}/dl" );
//アカウント関連
ClientData.userInfo_accountPath(urlPath);
ClientData.userInfo_accountPath_session(urlPath);
ClientData.userInfo_loginId("");
ClientData.userInfo_loginId_session("");
}
} else {
//confのパラメータセット
ClientData.conf_apiUrl( sysSettings.apiUrl );
ClientData.conf_apiLoginUrl( sysSettings.apiLoginUrl );
ClientData.conf_apiResourceDlUrl( sysSettings. apiResourceDlUrl );
}
if( ClientData.isGetitsMode() == true ){
//念のため前回までの閲覧ログは削除
ClientData.ContentLogData([]);
$('#anonymous').show();
setTimeout(
function () {
LOGIN.initLoginGetitsUser();
},
LOGIN.timeWaitSplashScreen
);
} else if (COMMON.isAnonymousLogin()) {
$('#anonymous').show();
setTimeout(
function () {
LOGIN.initLoginAnonymousUser();
}, LOGIN.timeWaitSplashScreen);
}
else {
$('#normalUser').show();
$('#formlogin').hide();
$('#logologin').animate({ "margin-top": 0 }, LOGIN.timeWaitSplashScreen,
function () {
$('#formlogin').show();
$('#menu-language').animate({ opacity: 1 }, LOGIN.timeWaitSplashScreen);
$('#formlogin').animate({ opacity: 1 }, LOGIN.timeWaitSplashScreen);
$('.cnt_footer').animate({ opacity: 1 }, LOGIN.timeWaitSplashScreen);
}
);
LOGIN.initLoginNormalUser();
}
};
//});
//名前空間用のオブジェクトを用意する
var STVIEW = {};
STVIEW.latitude = '';
STVIEW.longitude = '';
//Login Process
STVIEW.processLogin = function(cid,sid) {
var requireChangePassword = 0;
var skipPwdDate;
var params = {
cid: cid,
sid: sid
};
// Get url to login
var apiLoginUrl = ClientData.conf_apiLoginUrl();
//alert("aaaa");
$('#main-error-message').html("aaaaaa");
$('#main-error-message').show();
//window.location.href = "abvw/" + COMMON.ScreenIds.ContentViewStreaming;
//window.location.href = "./login.html";
//location.href = "http://web3.agentec.jp/";
//$('#main-error-message').html("bcdef");
//$('#main-error-message').show();
AVWEB.avwCmsApiWithUrl(apiLoginUrl, null, 'webClientStreamingLogin', 'GET', params, function (data) {
//requirePasswordChange = data.requirePasswordChange;
LOGIN.userinfo_sid = data.sid;
LOGIN.userInfo_userName = data.userName;
LOGIN.optionList = data.serviceOptionList;
LOGIN.getServiceOptionList();
if (data.result == 'success') {
// Save retrieved info
STVIEW.saveLoginInfo(data);
// set number new push message to 0
ClientData.pushInfo_newMsgNumber(0);
//ストリーミングモード有効化
ClientData.isStreamingMode(true);
//GPS情報
ClientData.latitude(STVIEW.latitude);
ClientData.longitude(STVIEW.longitude);
$('#main-error-message').css('display', 'none');
if (data.requirePasswordChange == 0) {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
$('#main-error-message').html("login ok move to:" + COMMON.ScreenIds.ContentViewStreaming);
$('#main-error-message').show();
//コンテンツIDセット
ClientData.contentInfo_contentId(cid);
//ストリーミングのビューアへ移動
AVWEB.avwScreenMove("abvw/" + COMMON.ScreenIds.ContentViewStreaming);
//$('#main-error-message').html("move...");
//$('#main-error-message').show();
} else {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').show();
return;
}
}
else {
LOGIN.login_errorMessage = data.errorMessage;
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), data.errorMessage).toString());
$('#main-error-message').show();
alert("Open Error1!");
}
}, function (xhr, statusText, errorThrown) {
if (xhr.responseText && xhr.status != 0) {
LOGIN.login_errorMessage = JSON.parse(xhr.responseText).errorMessage;
alert("Open Error21!:" + LOGIN.login_errorMessage);
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), JSON.parse(xhr.responseText).errorMessage).toString());
} else {
alert("Open Error22!:E001");
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
}
$('#main-error-message').show();
});
};
//check Save Login Info
STVIEW.saveLoginInfo = function(data) {
var lang = I18N.getCurrentLanguage();
// load language
I18N.changeLanguage(lang);
var accountPath = data.urlPath;
var loginId = data.loginId;
var date = new Date();
ClientData.userInfo_accountPath(accountPath);
ClientData.userInfo_loginId(loginId);
ClientData.userInfo_accountPath_session(accountPath);
ClientData.userInfo_loginId_session(loginId);
ClientData.userInfo_userName(LOGIN.userInfo_userName);
ClientData.userInfo_lastLoginTime(date.jpDateTimeString());
ClientData.userInfo_sid_local(LOGIN.userinfo_sid);
LOGIN.saveServiceUserOption();
//alert("url:" + ClientData.userInfo_accountPath() + " loginId:" + ClientData.userInfo_loginId());
// 不要なフラグ落とす
ClientData.common_contentDataChkFlg(false);
ClientData.userInfo_rememberLogin(false);
//ページジャンプ設定をクリア
ClientData.JumpQueue([]);
ClientData.IsJumpBack(false);
};
//$(document).ready(function () {
STVIEW.ready = function(){
//location.href="http://freebsd.csie.nctu.edu.tw/~freedom/html5/";
//return;
console.log("STVIEW.ready");
//---初期化
//セッションストレージクリア
SessionStorageUtils.clear();
AVWEB.avwUserSessionObj = null;
// create new session
AVWEB.avwCreateUserSession();
I18N.initi18n();
var sysSettings = AVWEB.avwSysSetting(); // get info in conf.json
//モード初期化
ClientData.isGetitsMode(false);
ClientData.isStreamingMode(false);
//confのパラメータセット
ClientData.conf_apiUrl( sysSettings.apiUrl );
ClientData.conf_apiLoginUrl( sysSettings.apiLoginUrl );
ClientData.conf_apiResourceDlUrl( sysSettings. apiResourceDlUrl );
//念のため前回までの閲覧ログは削除
ClientData.ContentLogData([]);
//---初期化
//引数の確認
var sid = COMMON.getUrlParam('sid', '');
var cid = COMMON.getUrlParam('cid', '');
var page = COMMON.getUrlParam('page', '');
var latitude = COMMON.getUrlParam('latitude', '');
var longitude = COMMON.getUrlParam('longitude', '');
var isView = false;
if( !sid || !cid ){
//表示出来ない
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').show();
return;
}
//ページ番号指定有り
if( page == "" || page == "0"){
ClientData.common_prePageNo(null)
} else {
ClientData.common_prePageNo(page);
}
//GPS
if( latitude != "" ){
STVIEW.latitude = latitude;
}
if( latitude != "" ){
STVIEW.longitude = longitude;
}
STVIEW.processLogin(cid,sid);
};
//});
......@@ -40,21 +40,25 @@
}
</style>
<![endif]-->
<!-- <script type="text/javascript">
<script type="text/javascript">
$('head').append(
'<style type="text/css">#container { display: none; } #fade, #loader { display: block; }</style>'
);
//$('head').append(
// '<style type="text/css">#container { display: none; } #fade, #loader { display: block; }</style>'
//);
//jQuery.event.add(window,"load",function() { // 全ての読み込み完了後に呼ばれる関数
// var pageH = $("#container").height();
// console.log("pageH:" + pageH);
//
// $("#fade").css("height", pageH).delay(900).fadeOut(800);
// $("#loader").delay(600).fadeOut(300);
// $("#container").css("display", "block");
//});
jQuery.event.add(window,"load",function() { // 全ての読み込み完了後に呼ばれる関数
var pageH = $("#container").height();
$(document).ready(function(){
LOGIN.ready();
});
$("#fade").css("height", pageH).delay(900).fadeOut(800);
$("#loader").delay(600).fadeOut(300);
$("#container").css("display", "block");
});
</script>-->
</script>
</head>
<body id="login">
......@@ -63,8 +67,10 @@ jQuery.event.add(window,"load",function() { // 全ての読み込み完了後に
</div>
<div id="normalUser">
<!--
<div id="loader"><img src="./abvw/img/login/loading_icon.gif" width="200" height="200"></div>
<div id="fade"></div>
-->
<div class="wrapper">
<div id="main">
<ul class="floatR" id="menu-language"><li class="language"><a id="language-ja"><img src="./abvw/img/common/flg_jpn.png" width="29" height="20"></a></li><li class="language"><a id="language-en"><img src="./abvw/img/common/flg_usa.png" width="29" height="20"></a></li><li class="language"><a id="language-ko"><img src="./abvw/img/common/flg_kor.png" width="29" height="20"></a></li></ul>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-store">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="-1">
<title></title>
<script type="text/javascript" src="./abvw/common/js/jquery-1.8.1.min.js?__UPDATEID__"></script>
<script type="text/javascript" src="./abvw/common/js/avweb.js?__UPDATEID__"></script>
<script type="text/javascript" src="./abvw/common/js/i18n.js?__UPDATEID__"></script>
<script type="text/javascript" src="./abvw/common/js/common.js?__UPDATEID__"></script>
<script type="text/javascript" src="./abvw/js/Limit_Access_Content.js?__UPDATEID__"></script>
<script type="text/javascript" src="./abvw/js/login.js?__UPDATEID__"></script>
<script type="text/javascript" src="./abvw/js/stview.js?__UPDATEID__"></script>
<style>
#loader-bg {
display: none;
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
/*background: #000;*/
z-index: 1;
}
#loader {
display: none;
position: fixed;
top: 50%;
left: 50%;
width: 200px;
height: 200px;
margin-top: -100px;
margin-left: -100px;
text-align: center;
color: #fff;
z-index: 2;
}
</style>
<script type="text/javascript">
$(function() {
var h = $(window).height();
$('#loader-bg ,#loader').height(h).css('display','block');
});
$(document).ready(function () {
//$('#main-error-message').html("document ready");
//$('#main-error-message').show();
STVIEW.ready();
//$('#loader-bg').delay(900).fadeOut(800);
//$('#loader').delay(600).fadeOut(300);
});
//デバイスから呼ばれる
function setLocation(latitude, longitude){
alert("stview receive setLocation:" + latitude + "," + longitude );
if( STVIEW.latitude != null ){
STVIEW.latitude = latitude;
}
if( STVIEW.longitude != null ){
STVIEW.longitude = longitude;
}
}
//デバイスから呼ばれる閲覧ログ送信指示
function sendLog(){
alert("stview receive sendLog ");
//送信終了を通知
//if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
var url = "abooksendlog://?send=true";
location.href = url;
//}
return true;
}
</script>
</head>
<body id="stview">
<div id="loader-bg">
<div id="loader">
<!--
<img src="abvw/img/view_loading.gif" width="64" height="64" alt="Now Loading..." />
<br />Now Loading...
-->
</div>
<p class="error lang" id="main-error-message" style="display:none;">メッセージ</p>
</div>
</body>
</html>
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