Commit e23608cd by Jung Kwangkyu

#18453 閲覧ログ件数不一致

parent 384433ca
......@@ -67,7 +67,7 @@ COMMON.Consts = {
// Lock screen timer
ConstLockScreenTime: 1800000
};
/*Content Type Keys*/
......@@ -220,7 +220,7 @@ COMMON.Keys = {
serviceOpt_reader_readinglog_object: 'reader_readinglog_object',
// Session :事業者オプション(serviceOpt)_コンテンツ共有モード:Interger(0:なし , 1:ABook, 2:getits)
serviceOpt_content_share: 'content_share',
// Session :共通(common)_コンテンツID:Integer
common_contentId: 'common_contentId',
// Local :共通(common)_コンテンツID:Integer
......@@ -353,13 +353,13 @@ COMMON.Keys = {
userOpt_pageTransition: 'userOpt_pageTransition',
// Local :ユーザオプション(userOpt)_アニメーション時間:Float
userOpt_pageTransitionPeriod: 'userOpt_pageTransitionPeriod',
isGetitsMode: 'isGetitsMode',
isStreamingMode: 'isStreamingMode',
conf_apiUrl: 'conf_apiUrl',
conf_apiLoginUrl: 'conf_apiLoginUrl',
conf_apiResourceDlUrl: 'conf_apiResourceDlUrl',
latitude: 'latitude',
longitude: 'longitude',
//ダイハツカスタム グループ認証コード
......@@ -367,7 +367,7 @@ COMMON.Keys = {
authGroupName: 'authGroupName',
authGroupId: 'authGroupId'
/* -------------------------------------------------------------------------------- */
};
// Entity for Bookmark
......@@ -378,7 +378,7 @@ function BookMarkEntity() {
this.contentTitle = "";
this.contentTitleKana = "";
this.registerDate = new Date();
//Add for phase2
this.bookmarkid = "";
};
......@@ -390,7 +390,7 @@ function MemoEntity() {
this.posX = -1;
this.posY = -1;
this.Text = "";
//Add for phase2
this.memoid = "";
this.registerDate = new Date();
......@@ -401,7 +401,7 @@ function MarkingEntity() {
this.contentid = "";
this.pageNo = -1;
this.content = "";
//Add for phase2
this.markingid = "";
this.registerDate = new Date();
......@@ -453,7 +453,7 @@ COMMON.getDataMemo = function(jsonString) {
var memoDataFromServer = jsonString.data;
var arrLocalMemo = ClientData.MemoData();
for (var i = 0; i < memoDataFromServer.length; i++) {
var objServerMemo = new MemoEntity();
objServerMemo.contentid = memoDataFromServer[i].contentid;
......@@ -556,8 +556,8 @@ If has any param (args.length > 0) -> setter
If has not param (args.length = 0) -> getter
. Get from session:
+ if it existed and key existed in localstorage -> return result
+ else:
* set value from local to sessionstorage -> return value of sessionstorage if value is not empty,
+ else:
* set value from local to sessionstorage -> return value of sessionstorage if value is not empty,
otherwise, return default result.
*/
......@@ -565,9 +565,16 @@ COMMON.operateData = function(args, strKey, returnDefaultData) {
if (args.length > 0) {
var data = args[0];
LocalStorageUtils.set(strKey, data);
SessionStorageUtils.set(strKey, JSON.stringify(data));
if (data.length > 0) {
LocalStorageUtils.set(strKey, data);
SessionStorageUtils.set(strKey, JSON.stringify(data));
} else {
console.log("getUniqueId : " + LocalStorageUtils.getUniqueId());
LocalStorageUtils.remove(strKey);
SessionStorageUtils.remove(strKey);
}
} else {
if (SessionStorageUtils.get(strKey) != 'undefined'
&& SessionStorageUtils.get(strKey) != undefined
&& SessionStorageUtils.get(strKey) != ''
......@@ -637,7 +644,7 @@ var ClientData = {
}
},
// Local
// Local
JumpQueue: function (data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, COMMON.Keys.JumpQueue, []);
......@@ -705,6 +712,7 @@ var ClientData = {
// Local: content log collection
ContentLogData: function (data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, COMMON.Keys.ContentLogData, []);
}
......@@ -1042,7 +1050,7 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.memo_pageNo, undefined);
}
},
// Local :ユーザオプション(userOpt)_バックアップデフォルト_マーキング:Interger
userOpt_bkMakingFlag: function (data) {
if (arguments.length > 0) {
......@@ -1052,7 +1060,7 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.userOpt_bkMakingFlag, undefined);
}
},
// Local :ユーザオプション(userOpt)_バックアップデフォルト_メモ:Interger
userOpt_bkMemoFlag: function (data) {
if (arguments.length > 0) {
......@@ -1062,7 +1070,7 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.userOpt_bkMemoFlag, undefined);
}
},
// Local :ユーザオプション(userOpt)_バックアップデフォルト_しおり:Interger
userOpt_bkShioriFlag: function (data) {
if (arguments.length > 0) {
......@@ -1072,7 +1080,7 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.userOpt_bkShioriFlag, undefined);
}
},
// Local :ユーザオプション(userOpt)_ビューのアニメーション種類:Interger
userOpt_pageTransition: function (data) {
if (arguments.length > 0) {
......@@ -1082,7 +1090,7 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.userOpt_pageTransition, undefined);
}
},
// Local :ユーザオプション(userOpt)_アニメーション時間:Float
userOpt_pageTransitionPeriod: function (data) {
if (arguments.length > 0) {
......@@ -1092,7 +1100,7 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.userOpt_pageTransitionPeriod, undefined);
}
},
// Session
memo_copyText: function (data) {
if (arguments.length > 0) {
......@@ -1225,7 +1233,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.serviceOpt_usable_readinglog_object);
}
},
// Session :事業者オプション(serviceOpt)_getits_GPS使用可:Char(Y:可能, N:不可)
serviceOpt_reader_usable_readinglog_gps: function (data) {
if (arguments.length > 0) {
......@@ -1242,7 +1250,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.serviceOpt_reader_readinglog_object);
}
},
// Session :事業者オプション(serviceOpt)_コンテンツ共有モード:Interger(0:なし , 1:ABook, 2:getits)
serviceOpt_content_share: function (data) {
if (arguments.length > 0) {
......@@ -1251,8 +1259,8 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.serviceOpt_content_share);
}
},
// Session :事業者オプション(serviceOpt)_カタログエディション:Char(Y:可能, N:不可)
serviceOpt_catalog_edition: function (data) {
if (arguments.length > 0) {
......@@ -1624,7 +1632,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.serviceOpt_web_screen_lock_wait);
}
},
isGetitsMode: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.isGetitsMode, JSON.stringify(data));
......@@ -1639,7 +1647,7 @@ var ClientData = {
return false;
}
},
isStreamingMode: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.isStreamingMode, JSON.stringify(data));
......@@ -1654,7 +1662,7 @@ var ClientData = {
return false;
}
},
conf_apiUrl: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.conf_apiUrl, data);
......@@ -1676,7 +1684,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.conf_apiResourceDlUrl);
}
},
latitude: function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.latitude, data);
......@@ -1684,7 +1692,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.latitude);
}
},
longitude: function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.longitude, data);
......@@ -1692,7 +1700,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.longitude);
}
},
authCode: function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.authCode, data);
......@@ -1714,7 +1722,7 @@ var ClientData = {
return SessionStorageUtils.get(COMMON.Keys.authGroupId);
}
}
};
// -------------------------------------------------
......@@ -2144,13 +2152,13 @@ COMMON.getBase64Image = function(imgSource) {
// get time wait lockscreen
COMMON.getTimeWaitLockScreen = function() {
var timeWaitLockScreen = -1;
if (ClientData.serviceOpt_web_screen_lock() == "Y")
if (ClientData.serviceOpt_web_screen_lock() == "Y")
{
var sysSettings = AVWEB.avwSysSetting();
if (isNaN(ClientData.serviceOpt_web_screen_lock_wait())) {
timeWaitLockScreen = sysSettings.screenlockTimeDefault * 60000;
}
else
else
{
var temp = ClientData.serviceOpt_web_screen_lock_wait();
timeWaitLockScreen = temp * 60000; // time unit is minute
......@@ -2161,7 +2169,7 @@ COMMON.getTimeWaitLockScreen = function() {
timeWaitLockScreen = -1;
}
}
}
}
return timeWaitLockScreen;
};
......@@ -2181,8 +2189,8 @@ COMMON.LockScreen = function() {
if(ClientData.isStreamingMode() == true){
return;
}
var timeWaitLockScreen = COMMON.getTimeWaitLockScreen();
var timeWaitLockScreen = COMMON.getTimeWaitLockScreen();
if (timeWaitLockScreen > 0) {
//var message = I18N.i18nText("sysInfoScrLock01");
SCREENLOCK.screenLock({
......@@ -2200,7 +2208,7 @@ COMMON.LockScreen = function() {
// The function will be called at the time: loading
$(function () {
// Init setting values
// Init setting values
if (AVWEB.avwUserSession()) { // Logged
// View mode default
......@@ -2262,7 +2270,7 @@ $(function () {
});
// Unlock the locked screen by inputing password on screen to check authentication
COMMON.unlockFunction = function(inputPass) {
COMMON.unlockFunction = function(inputPass) {
var forceUnlockFunc = arguments[1]; // added secret arguments : forceUnlockFunction
var result = false;
var params = {
......@@ -2307,7 +2315,7 @@ COMMON.unlockFunction = function(inputPass) {
}
);
if (result == true) {
//ビューア画面ならイベントのアンロック
if ($("#viewer").length) {
......@@ -2332,13 +2340,13 @@ COMMON.SetStartLog = function(strContentId) {
//#18453
//閲覧開始時間が一致する2レコードあるのはこの処理が同時に2重で実行された可能性有り
//busyフラグで排他してみる
var isFound = false;
var arrContentLogs = ClientData.ContentLogData();
for (var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if (arrContentLogs[nIndex].contentid == strContentId) {
if(!ClientData.isStreamingMode()){
arrContentLogs[nIndex].readingStartDate = new Date();
arrContentLogs[nIndex].readingEndDate = (new Date()).addSeconds(1);
......@@ -2355,13 +2363,13 @@ COMMON.SetStartLog = function(strContentId) {
var log = new LogEntity();
log.readingStartDate = curr;
log.contentid = strContentId;
// Set 1 second
curr1.setSeconds(curr.getSeconds() + 1);
log.readingEndDate = curr1;
// Reading time
log.readingTime = log.readingEndDate.subtractBySeconds(log.readingStartDate);
//デバイスタイプ判定
var deviceType = 4;
if(ClientData.isStreamingMode()){
......@@ -2374,20 +2382,20 @@ COMMON.SetStartLog = function(strContentId) {
}
}
log.deviceTypeId = deviceType;
//GPS
log.latitude = ClientData.latitude();
log.longitude = ClientData.longitude();
//PageLog 1ページ目セット(1レコードは必須)
var pageLog = new PageLogEntity();
pageLog.contentid = strContentId;
log.pageLogArray.push(pageLog);
// Add to storage
arrContentLogs.push(log);
}
// Set back to storage
ClientData.ContentLogData(arrContentLogs);
};
......@@ -2409,7 +2417,7 @@ COMMON.SetGpsLog = function(strContentId) {
}
// Set back to storage
ClientData.ContentLogData(arrContentLogs);
};
......@@ -2418,17 +2426,17 @@ COMMON.SetEndLog = function(strContentId) {
//var log = new LogEntity(); //無駄なのでコメント
var arrContentLogs = ClientData.ContentLogData();
for(var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if(arrContentLogs[nIndex].contentid == strContentId) {
// Found content -> set ending date
var dateEnd = new Date();
var dateStart = new Date(arrContentLogs[nIndex].readingStartDate);
arrContentLogs[nIndex].readingEndDate = dateEnd;
// Calculate to seconds
arrContentLogs[nIndex].readingTime = dateEnd.subtractBySeconds(dateStart);
}
}
ClientData.ContentLogData(arrContentLogs);
......@@ -2436,18 +2444,18 @@ COMMON.SetEndLog = function(strContentId) {
// 1ページ分のページ閲覧ログを作成
COMMON.SetPageLog = function(strContentId, strPageNo){
var arrContentLogs = ClientData.ContentLogData();
for(var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if(arrContentLogs[nIndex].contentid == strContentId) {
//PageLog追加
var pageLog = new PageLogEntity();
pageLog.contentid = strContentId;
pageLog.pageNo = strPageNo + 1; //0始まりのページ番号
arrContentLogs[nIndex].pageLogArray.push(pageLog);
}
}
ClientData.ContentLogData(arrContentLogs);
......@@ -2456,19 +2464,19 @@ COMMON.SetPageLog = function(strContentId, strPageNo){
if(ClientData.isStreamingMode()){
CONTENTVIEW_STREAMING.movePage(strPageNo + 1);
}
};
// 1アクションのオブジェクトログを作成
COMMON.SetObjectLog = function(strContentId, objectLog){
var arrContentLogs = ClientData.ContentLogData();
for(var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if(arrContentLogs[nIndex].contentid == strContentId) {
//ObjectLog追加
arrContentLogs[nIndex].objectLogArray.push(objectLog);
}
}
ClientData.ContentLogData(arrContentLogs);
......@@ -2477,9 +2485,9 @@ COMMON.SetObjectLog = function(strContentId, objectLog){
// 前回の1アクションのオブジェクトログの利用時間を設定
COMMON.SetObjectLogActionTime = function( strContentId, objectId, actionTime ){
var arrContentLogs = ClientData.ContentLogData();
for(var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if(arrContentLogs[nIndex].contentid == strContentId) {
if( arrContentLogs[nIndex].objectLogArray.length > 0 ){
......@@ -2501,14 +2509,14 @@ COMMON.RegisterLog = function(isUnload) {
if(isUnload == null){
isUnload = false;
}
var arrContentLogs = ClientData.ContentLogData();
//ブラウザ閉じる場合は重複を回避するためログデータ先に削除
if(isUnload){
ClientData.ContentLogData([]);
}
var isError = false;
for (var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
var dateEnd = new Date(arrContentLogs[nIndex].readingEndDate);
......@@ -2517,13 +2525,13 @@ COMMON.RegisterLog = function(isUnload) {
//ページログJSONデータの作成
var pageLogJson = "";
var objectLogJson = "";
//biz/adモードで詳細ログY か getitsでgetits詳細ログY の場合
if((ClientData.isGetitsMode() == false && ClientData.serviceOpt_usable_readinglog_object() == 'Y') || (ClientData.isGetitsMode() == true && ClientData.serviceOpt_reader_readinglog_object() == 'Y')){
var pageLogArray = arrContentLogs[nIndex].pageLogArray;
//詳細ログオプションが有効ならページ閲覧ログデータ作成
if( pageLogArray != null && pageLogArray.length > 0 ){
var lines = [];
//終了時間と閲覧時間の設定
var pageLogStart;
......@@ -2538,7 +2546,7 @@ COMMON.RegisterLog = function(isUnload) {
pageLogEnd = new Date(pageLogArray[nIndex2 -1].readingEndDate);
//時間差から閲覧秒セット
pageLogArray[nIndex2 -1].readingTime = pageLogEnd.subtractBySeconds(pageLogStart);
}
//最終レコードの処理
if( pageLogArray[pageLogArray.length - 1].readingEndDate == null ){
......@@ -2548,7 +2556,7 @@ COMMON.RegisterLog = function(isUnload) {
pageLogEnd = new Date(pageLogArray[pageLogArray.length - 1].readingEndDate);
//時間差から閲覧秒セット
pageLogArray[pageLogArray.length -1].readingTime = pageLogEnd.subtractBySeconds(pageLogStart);
//JSONデータ作成
for (var nIndex2 = 0; nIndex2 < pageLogArray.length; nIndex2++) {
pageLogStart = new Date(pageLogArray[nIndex2].readingStartDate);
......@@ -2565,7 +2573,7 @@ COMMON.RegisterLog = function(isUnload) {
}
}
//alert("PageLog Lines:" + JSON.stringify( lines ) );
if( lines.length > 0 ){
pageLogJson = "{ header:[\"pageNo\",\"readingStartDate\",\"readingEndDate\",\"readingTime\"],lines:";
pageLogJson = pageLogJson + JSON.stringify( lines );
......@@ -2573,19 +2581,19 @@ COMMON.RegisterLog = function(isUnload) {
//console.log("JSON:" + pageLogJson);
}
}
var objectLogArray = arrContentLogs[nIndex].objectLogArray;
//詳細ログオプションが有効ならページ閲覧ログデータ作成
if( objectLogArray != null && objectLogArray.length > 0 ){
var lines = [];
var actionDate;
//JSONデータ作成
for (var nIndex2 = 0; nIndex2 < objectLogArray.length; nIndex2++) {
actionDate = new Date(objectLogArray[nIndex2].actionDate);
var line = [];
if( objectLogArray[nIndex2].objectId != null ){
line.push(actionDate.jpDateTimeString1());
line.push(objectLogArray[nIndex2].pageNo);
......@@ -2604,14 +2612,14 @@ COMMON.RegisterLog = function(isUnload) {
} else {
line.push("");
}
lines.push(line);
//console.log("ObjectLog Line:" + JSON.stringify( line ) );
}
}
//console.log("ObjectLog Lines:" + JSON.stringify( lines ) );
if( lines.length > 0 ){
objectLogJson = "{ header:[\"actionDate\",\"pageNo\",\"objectId\",\"resourceId\",\"mediaType\",\"actionType\",\"actionValue\",\"actionTime\",\"locationX\",\"locationY\",\"locationHeight\",\"locationWidth\",\"eventType\"],";
objectLogJson = objectLogJson + "lines:";
......@@ -2619,11 +2627,11 @@ COMMON.RegisterLog = function(isUnload) {
objectLogJson = objectLogJson + "}";
//console.log("JSON:" + objectLogJson);
}
}
}
var params = {
sid: ClientData.userInfo_sid(),
contentId: arrContentLogs[nIndex].contentid,
......@@ -2661,7 +2669,7 @@ COMMON.RegisterLog = function(isUnload) {
}
);
};
if (AVWEB.avwHasError()) {
return;
}
......@@ -2724,8 +2732,8 @@ COMMON.WaitProcess = function() {
});
$("#avw-sys-modal-wait-img").center();
// resize error page
// resize error page
$(window).resize(function () {
$('#avw-sys-modal-wait').css({
'width': $(window).width(),
......@@ -2759,7 +2767,7 @@ COMMON.lockLayout = function() {
'background': '#999',
'z-index': 100
});
// resize error page
// resize error page
$(window).resize(function () {
$('#avw-sys-modal').css({
'width': $(window).width(),
......@@ -2841,10 +2849,10 @@ COMMON.convertToDate = function(input) {
var nSecond = 0;
var strTemp = input;
var nIndex;
dateResult = new Date();
try {
// Get year
nIndex = strTemp.indexOf("-");
nYear = Number(strTemp.substr(0, nIndex));
......@@ -2868,20 +2876,20 @@ COMMON.convertToDate = function(input) {
strTemp = strTemp.substr(nIndex + 1);
nIndex = strTemp.indexOf(".");
nSecond = Number(strTemp.substr(0, nIndex));
dateResult.setYear(nYear);
dateResult.setMonth(nMonth-1);
dateResult.setDate(nDay);
dateResult.setHours(nHour);
dateResult.setMinutes(nMinute);
dateResult.setSeconds(nSecond);
} catch(e) {
//
}
return dateResult;
};
/*
......@@ -3000,7 +3008,7 @@ COMMON.isAnonymousLogin = function() {
/* Check if current browser is IE9 */
COMMON.isIE9 = function() {
var ua = window.navigator.userAgent.toLowerCase();
if (/msie 9.0/.test(ua)) {
return true;
}
......@@ -3019,7 +3027,7 @@ COMMON.isIE10 = function() {
//Check content type is pdf content
COMMON.isPdfContent = function(contentType){
if(!(contentType == COMMON.ContentTypeKeys.Type_PDF)){
return false;
return false;
}
else{
return true;
......@@ -3086,7 +3094,7 @@ COMMON.setMetaVersionData = function(conId) {
// tempMetaArr = ClientData.MetaVersion();
//}
tempMetaArr = ClientData.MetaVersion();
for (var i = 0; i < COMMON.metaVersionArr.length; i++) {
if (COMMON.metaVersionArr[i].contentid == conId) {
tempMeta = COMMON.metaVersionArr[i].metaversion;
......@@ -3146,18 +3154,18 @@ COMMON.formatStringBase64 = function(imgStr) {
//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);
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]);
......
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