Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_web
check
Commits
852e7c32
Commit
852e7c32
authored
Sep 04, 2015
by
Masaru Abe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17533 パフォーマンス対応仕上げ
parent
1fcbc6ba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2907 additions
and
2975 deletions
+2907
-2975
abvw/common/js/common.js
+20
-18
abvw/js/bookmark.js
+897
-927
abvw/js/contentsearch.js
+1024
-1035
abvw/js/history.js
+966
-995
abvw/js/home.js
+0
-0
No files found.
abvw/common/js/common.js
View file @
852e7c32
...
...
@@ -3040,12 +3040,13 @@ COMMON.setResourceVersionData = function(conId) {
//check if insert new or edit
var
flag
=
false
;
if
(
ClientData
.
ResourceVersion
().
length
<=
0
||
ClientData
.
ResourceVersion
()
==
null
||
ClientData
.
ResourceVersion
()
==
'undefined'
)
{
tempResourceArr
=
[];
}
else
{
tempResourceArr
=
ClientData
.
ResourceVersion
();
}
//if (ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined') {
// tempResourceArr = [];
//}
//else {
// tempResourceArr = ClientData.ResourceVersion();
//}
tempResourceArr
=
ClientData
.
ResourceVersion
();
for
(
var
i
=
0
;
i
<
COMMON
.
resourceVersionArr
.
length
;
i
++
)
{
if
(
COMMON
.
resourceVersionArr
[
i
].
contentid
==
conId
)
{
...
...
@@ -3061,9 +3062,9 @@ COMMON.setResourceVersionData = function(conId) {
flag
=
true
;
break
;
}
else
{
flag
=
false
;
}
//
else {
//
flag = false;
//
}
}
if
(
!
flag
)
{
...
...
@@ -3085,12 +3086,13 @@ COMMON.setMetaVersionData = function(conId) {
//check if insert new or edit
var
flag
=
false
;
if
(
ClientData
.
MetaVersion
().
length
<=
0
||
ClientData
.
MetaVersion
()
==
null
||
ClientData
.
MetaVersion
()
==
'undefined'
)
{
tempMetaArr
=
[];
}
else
{
tempMetaArr
=
ClientData
.
MetaVersion
();
}
tempMetaArr
=
ClientData
.
MetaVersion
();
//if (ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined') {
// tempMetaArr = [];
//}
//else {
// tempMetaArr = ClientData.MetaVersion();
//}
for
(
var
i
=
0
;
i
<
COMMON
.
metaVersionArr
.
length
;
i
++
)
{
if
(
COMMON
.
metaVersionArr
[
i
].
contentid
==
conId
)
{
...
...
@@ -3106,9 +3108,9 @@ COMMON.setMetaVersionData = function(conId) {
flag
=
true
;
break
;
}
else
{
flag
=
false
;
}
//
else {
//
flag = false;
//
}
}
if
(
!
flag
)
{
...
...
abvw/js/bookmark.js
View file @
852e7c32
...
...
@@ -7,1080 +7,1050 @@ BOOKMARK.contentTypes = {};
BOOKMARK
.
contentName
=
{};
BOOKMARK
.
pathImgContentNone
=
'./img/page-none.png'
;
//Contains non-exist content
//
Contains non-exist content
BOOKMARK
.
bookmark_errorContent
=
[];
// Contain contents
BOOKMARK
.
collection_contents
=
[];
//ソート条件復帰
//
ソート条件復帰
BOOKMARK
.
searchDivision
=
"1"
;
BOOKMARK
.
sortType
=
"2"
;
//スクロール復帰
//
スクロール復帰
BOOKMARK
.
scrollTop
=
0
;
// Init function of page
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
if
(
!
AVWEB
.
avwCheckLogin
(
COMMON
.
ScreenIds
.
Login
))
return
;
if
(
!
AVWEB
.
avwCheckLogin
(
COMMON
.
ScreenIds
.
Login
))
return
;
//ソート条件デフォルト設定
if
(
AVWEB
.
avwSysSetting
().
sortTypeBookmark
!=
undefined
)
{
//
ソート条件デフォルト設定
if
(
AVWEB
.
avwSysSetting
().
sortTypeBookmark
!=
undefined
)
{
BOOKMARK
.
searchDivision
=
AVWEB
.
avwSysSetting
().
sortTypeBookmark
;
}
if
(
AVWEB
.
avwSysSetting
().
sortOrderBookmark
!=
undefined
)
{
if
(
AVWEB
.
avwSysSetting
().
sortOrderBookmark
!=
undefined
)
{
BOOKMARK
.
sortType
=
AVWEB
.
avwSysSetting
().
sortOrderBookmark
;
}
COMMON
.
LockScreen
();
document
.
title
=
I18N
.
i18nText
(
'dspShiori'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
// Set bookmark screen
ClientData
.
BookmarkScreen
(
COMMON
.
ScreenIds
.
BookmarkList
);
//Check if Force Change password
if
(
ClientData
.
requirePasswordChange
()
!=
1
)
{
// Synchronize bookmarks with server
BOOKMARK
.
SyncContent
();
// Collection all detail of pages
BOOKMARK
.
bookmark_collectAllPages
();
$
(
"#dspDelete"
).
click
(
BOOKMARK
.
dspDelete_Click
);
$
(
"#dspDelete1"
).
click
(
BOOKMARK
.
dspDelete1_Click
);
$
(
"#dspCancel"
).
click
(
BOOKMARK
.
dspCancel_Click
);
$
(
"#dspConfirmOK"
).
click
(
BOOKMARK
.
dspConfirmOK_Click
);
BOOKMARK
.
ClearGrid
();
//if (ClientData.BookMarkData().length == 0) {
if
(
BOOKMARK
.
collection_contents
.
length
==
0
){
// Show error
$
(
"#msgShioriNotExists"
).
show
();
$
(
"#dspDelete"
).
hide
();
$
(
"#dspDelete1"
).
hide
();
}
else
{
$
(
"#msgShioriNotExists"
).
hide
();
$
(
"#dspDelete"
).
show
();
$
(
"#dspDelete1"
).
show
();
}
// Show book in local storage
//BOOKMARK.ShowBookmark();
$
(
"a[name='dspRead']"
).
unbind
(
'click'
);
$
(
"a[name='dspRead']"
).
click
(
BOOKMARK
.
dspRead_Click
);
BOOKMARK
.
HideSorting
();
// Default sort is タイトル名, default is asc
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
dspTitleNm_Click
();
}
else
{
HEADER
.
checkForceChangePassword
();
}
if
(
COMMON
.
isAnonymousLogin
())
{
//プッシュメッセージ隠す
$
(
'#dspPushMessage'
).
hide
();
}
else
{
//プッシュメッセージ判定
if
(
ClientData
.
serviceOpt_apns
()
==
'Y'
||
ClientData
.
serviceOpt_usable_push_message
()
==
'Y'
){
//プッシュメッセージ表示
$
(
'#dspPushMessage'
).
show
();
}
else
{
$
(
'#dspPushMessage'
).
hide
();
}
}
//ダイアログ関連
$
(
"#dspTitleNm"
).
click
(
BOOKMARK
.
dspTitleNm_Click
);
$
(
"#dspTitleNmKn"
).
click
(
BOOKMARK
.
dspTitleNmKn_Click
);
$
(
"#dspPubDt"
).
click
(
BOOKMARK
.
dspPubDt_Click
);
// Check JP language and show title kana
if
(
I18N
.
getCurrentLanguage
()
!=
COMMON
.
Consts
.
ConstLanguage_Ja
)
{
$
(
"#dspTitleNmKn"
).
hide
();
$
(
"#dspTitleNmKn_Seperate"
).
hide
();
}
else
{
$
(
"#dspTitleNmKn"
).
show
();
$
(
"#dspTitleNmKn_Seperate"
).
show
();
}
//ビューア、共有表示パーツ読み込み
$
(
"#viewer"
).
load
(
"./inc_contentview.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
){
//読み込み完了時の処理
I18N
.
i18nReplaceText
();
});
COMMON
.
LockScreen
();
document
.
title
=
I18N
.
i18nText
(
'dspShiori'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
// Set bookmark screen
ClientData
.
BookmarkScreen
(
COMMON
.
ScreenIds
.
BookmarkList
);
// Check if Force Change password
if
(
ClientData
.
requirePasswordChange
()
!=
1
)
{
// Synchronize bookmarks with server
BOOKMARK
.
SyncContent
();
// Collection all detail of pages
BOOKMARK
.
bookmark_collectAllPages
();
$
(
"#dspDelete"
).
click
(
BOOKMARK
.
dspDelete_Click
);
$
(
"#dspDelete1"
).
click
(
BOOKMARK
.
dspDelete1_Click
);
$
(
"#dspCancel"
).
click
(
BOOKMARK
.
dspCancel_Click
);
$
(
"#dspConfirmOK"
).
click
(
BOOKMARK
.
dspConfirmOK_Click
);
BOOKMARK
.
ClearGrid
();
// if (ClientData.BookMarkData().length == 0) {
if
(
BOOKMARK
.
collection_contents
.
length
==
0
)
{
// Show error
$
(
"#msgShioriNotExists"
).
show
();
$
(
"#dspDelete"
).
hide
();
$
(
"#dspDelete1"
).
hide
();
}
else
{
$
(
"#msgShioriNotExists"
).
hide
();
$
(
"#dspDelete"
).
show
();
$
(
"#dspDelete1"
).
show
();
}
// Show book in local storage
// BOOKMARK.ShowBookmark();
$
(
"a[name='dspRead']"
).
unbind
(
'click'
);
$
(
"a[name='dspRead']"
).
click
(
BOOKMARK
.
dspRead_Click
);
BOOKMARK
.
HideSorting
();
// Default sort is タイトル名, default is asc
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
dspTitleNm_Click
();
}
else
{
HEADER
.
checkForceChangePassword
();
}
if
(
COMMON
.
isAnonymousLogin
())
{
// プッシュメッセージ隠す
$
(
'#dspPushMessage'
).
hide
();
}
else
{
// プッシュメッセージ判定
if
(
ClientData
.
serviceOpt_apns
()
==
'Y'
||
ClientData
.
serviceOpt_usable_push_message
()
==
'Y'
)
{
// プッシュメッセージ表示
$
(
'#dspPushMessage'
).
show
();
}
else
{
$
(
'#dspPushMessage'
).
hide
();
}
}
// ダイアログ関連
$
(
"#dspTitleNm"
).
click
(
BOOKMARK
.
dspTitleNm_Click
);
$
(
"#dspTitleNmKn"
).
click
(
BOOKMARK
.
dspTitleNmKn_Click
);
$
(
"#dspPubDt"
).
click
(
BOOKMARK
.
dspPubDt_Click
);
// Check JP language and show title kana
if
(
I18N
.
getCurrentLanguage
()
!=
COMMON
.
Consts
.
ConstLanguage_Ja
)
{
$
(
"#dspTitleNmKn"
).
hide
();
$
(
"#dspTitleNmKn_Seperate"
).
hide
();
}
else
{
$
(
"#dspTitleNmKn"
).
show
();
$
(
"#dspTitleNmKn_Seperate"
).
show
();
}
// ビューア、共有表示パーツ読み込み
$
(
"#viewer"
).
load
(
"./inc_contentview.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
)
{
// 読み込み完了時の処理
I18N
.
i18nReplaceText
();
});
});
BOOKMARK
.
refreshView
=
function
()
{
// Synchronize bookmarks with server
// Synchronize bookmarks with server
BOOKMARK
.
SyncContent
();
// Collection all detail of pages
BOOKMARK
.
bookmark_collectAllPages
();
BOOKMARK
.
ClearGrid
();
//if (ClientData.BookMarkData().length == 0) {
if
(
BOOKMARK
.
collection_contents
.
length
==
0
){
// Show error
$
(
"#msgShioriNotExists"
).
show
();
$
(
"#dspDelete"
).
hide
();
$
(
"#dspDelete1"
).
hide
();
}
else
{
$
(
"#msgShioriNotExists"
).
hide
();
$
(
"#dspDelete"
).
show
();
$
(
"#dspDelete1"
).
show
();
}
// Default sort is タイトル名, default is asc
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
//前と同じ状態にするので逆転させる
if
(
BOOKMARK
.
sortType
==
"1"
){
BOOKMARK
.
sortType
=
"2"
;
}
else
{
BOOKMARK
.
sortType
=
"1"
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
if
(
BOOKMARK
.
searchDivision
==
"1"
){
BOOKMARK
.
dspTitleNm_Click
();
}
else
if
(
BOOKMARK
.
searchDivision
==
"2"
){
BOOKMARK
.
dspTitleNmKn_Click
();
}
else
{
BOOKMARK
.
dspPubDt_Click
();
}
};
// Collection all detail of pages
BOOKMARK
.
bookmark_collectAllPages
();
BOOKMARK
.
ClearGrid
();
// if (ClientData.BookMarkData().length == 0) {
if
(
BOOKMARK
.
collection_contents
.
length
==
0
)
{
// Show error
$
(
"#msgShioriNotExists"
).
show
();
$
(
"#dspDelete"
).
hide
();
$
(
"#dspDelete1"
).
hide
();
}
else
{
$
(
"#msgShioriNotExists"
).
hide
();
$
(
"#dspDelete"
).
show
();
$
(
"#dspDelete1"
).
show
();
}
// Default sort is タイトル名, default is asc
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
// 前と同じ状態にするので逆転させる
if
(
BOOKMARK
.
sortType
==
"1"
)
{
BOOKMARK
.
sortType
=
"2"
;
}
else
{
BOOKMARK
.
sortType
=
"1"
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
if
(
BOOKMARK
.
searchDivision
==
"1"
)
{
BOOKMARK
.
dspTitleNm_Click
();
}
else
if
(
BOOKMARK
.
searchDivision
==
"2"
)
{
BOOKMARK
.
dspTitleNmKn_Click
();
}
else
{
BOOKMARK
.
dspPubDt_Click
();
}
};
/*
----------------------------------------------------------------------------
Event groups [start]
----------------------------------------------------------------------------
*/
*
----------------------------------------------------------------------------
*
Event groups [start]
*
----------------------------------------------------------------------------
*/
BOOKMARK
.
dspTitleNm_Click
=
function
()
{
var
isAsc
=
false
;
if
(
ClientData
.
sortOpt_searchDivision
()
==
"1"
)
{
// Name
if
(
ClientData
.
sortOpt_sortType
()
==
"1"
)
{
// ASC
isAsc
=
false
;
BOOKMARK
.
sortType
=
"2"
;
}
else
{
isAsc
=
true
;
BOOKMARK
.
sortType
=
"1"
;
}
}
else
{
BOOKMARK
.
searchDivision
=
"1"
;
BOOKMARK
.
sortType
=
"1"
;
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
isAsc
=
true
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
SortTitleName
(
isAsc
);
//changeStatusSort(this, isAsc);
HEADER
.
setStatusSort
(
'#dspTitleNm'
,
isAsc
);
var
isAsc
=
false
;
if
(
ClientData
.
sortOpt_searchDivision
()
==
"1"
)
{
// Name
if
(
ClientData
.
sortOpt_sortType
()
==
"1"
)
{
// ASC
isAsc
=
false
;
BOOKMARK
.
sortType
=
"2"
;
}
else
{
isAsc
=
true
;
BOOKMARK
.
sortType
=
"1"
;
}
}
else
{
BOOKMARK
.
searchDivision
=
"1"
;
BOOKMARK
.
sortType
=
"1"
;
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
isAsc
=
true
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
SortTitleName
(
isAsc
);
// changeStatusSort(this, isAsc);
HEADER
.
setStatusSort
(
'#dspTitleNm'
,
isAsc
);
};
BOOKMARK
.
dspTitleNmKn_Click
=
function
()
{
var
isAsc
=
false
;
if
(
ClientData
.
sortOpt_searchDivision
()
==
"2"
)
{
// Kana
if
(
ClientData
.
sortOpt_sortType
()
==
"1"
)
{
// ASC
isAsc
=
false
;
BOOKMARK
.
sortType
=
"2"
;
}
else
{
isAsc
=
true
;
BOOKMARK
.
sortType
=
"1"
;
}
}
else
{
BOOKMARK
.
searchDivision
=
"2"
;
BOOKMARK
.
sortType
=
"1"
;
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
// Kana
isAsc
=
true
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
SortTitleNameKana
(
isAsc
);
//changeStatusSort(this, isAsc);
HEADER
.
setStatusSort
(
'#dspTitleNmKn'
,
isAsc
);
var
isAsc
=
false
;
if
(
ClientData
.
sortOpt_searchDivision
()
==
"2"
)
{
// Kana
if
(
ClientData
.
sortOpt_sortType
()
==
"1"
)
{
// ASC
isAsc
=
false
;
BOOKMARK
.
sortType
=
"2"
;
}
else
{
isAsc
=
true
;
BOOKMARK
.
sortType
=
"1"
;
}
}
else
{
BOOKMARK
.
searchDivision
=
"2"
;
BOOKMARK
.
sortType
=
"1"
;
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
// Kana
isAsc
=
true
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
SortTitleNameKana
(
isAsc
);
// changeStatusSort(this, isAsc);
HEADER
.
setStatusSort
(
'#dspTitleNmKn'
,
isAsc
);
};
BOOKMARK
.
dspPubDt_Click
=
function
()
{
var
isAsc
=
false
;
if
(
ClientData
.
sortOpt_searchDivision
()
==
"3"
)
{
// Publish date
if
(
ClientData
.
sortOpt_sortType
()
==
"1"
)
{
// ASC
isAsc
=
false
;
BOOKMARK
.
sortType
=
"2"
;
}
else
{
isAsc
=
true
;
BOOKMARK
.
sortType
=
"1"
;
}
}
else
{
BOOKMARK
.
searchDivision
=
"3"
;
BOOKMARK
.
sortType
=
"1"
;
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
// Kana
isAsc
=
true
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
SortPubDate
(
isAsc
);
//changeStatusSort(this, isAsc);
HEADER
.
setStatusSort
(
'#dspPubDt'
,
isAsc
);
var
isAsc
=
false
;
if
(
ClientData
.
sortOpt_searchDivision
()
==
"3"
)
{
// Publish date
if
(
ClientData
.
sortOpt_sortType
()
==
"1"
)
{
// ASC
isAsc
=
false
;
BOOKMARK
.
sortType
=
"2"
;
}
else
{
isAsc
=
true
;
BOOKMARK
.
sortType
=
"1"
;
}
}
else
{
BOOKMARK
.
searchDivision
=
"3"
;
BOOKMARK
.
sortType
=
"1"
;
ClientData
.
sortOpt_searchDivision
(
BOOKMARK
.
searchDivision
);
// Kana
isAsc
=
true
;
}
ClientData
.
sortOpt_sortType
(
BOOKMARK
.
sortType
);
BOOKMARK
.
SortPubDate
(
isAsc
);
// changeStatusSort(this, isAsc);
HEADER
.
setStatusSort
(
'#dspPubDt'
,
isAsc
);
};
// Event of each button [読む]
BOOKMARK
.
dspRead_Click
=
function
()
{
var
jsondata
=
$
(
this
).
attr
(
"value"
);
var
data
=
JSON
.
parse
(
jsondata
);
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
data
.
contentid
,
function
(){
BOOKMARK
.
dspRead_Click_callback
(
data
);
},
function
(){
}
);
var
jsondata
=
$
(
this
).
attr
(
"value"
);
var
data
=
JSON
.
parse
(
jsondata
);
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
data
.
contentid
,
function
()
{
BOOKMARK
.
dspRead_Click_callback
(
data
);
},
function
()
{
});
};
//
BOOKMARK
.
dspRead_Click_callback
=
function
(
data
)
{
ClientData
.
contentInfo_contentId
(
data
.
contentid
);
ClientData
.
bookmark_pageNo
(
data
.
pageNo
);
ClientData
.
contentInfo_contentType
(
data
.
contentType
);
ClientData
.
IsRefresh
(
false
);
//
AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
//
表示
BOOKMARK
.
showContentView
();
ClientData
.
contentInfo_contentId
(
data
.
contentid
);
ClientData
.
bookmark_pageNo
(
data
.
pageNo
);
ClientData
.
contentInfo_contentType
(
data
.
contentType
);
ClientData
.
IsRefresh
(
false
);
//
AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
//
表示
BOOKMARK
.
showContentView
();
};
// Cancel dialog of deleting
BOOKMARK
.
dspCancel_Click
=
function
()
{
// Close dialog
//
$('#dlgConfirm').dialog('close');
$
(
"#delete_shiori"
).
hide
();
COMMON
.
unlockLayout
();
// Close dialog
//
$('#dlgConfirm').dialog('close');
$
(
"#delete_shiori"
).
hide
();
COMMON
.
unlockLayout
();
};
// Process deleting
BOOKMARK
.
dspConfirmOK_Click
=
function
()
{
// --------------------------------
// Process deleting [start]
// --------------------------------
// Get selected bookmarks
var
arrSelectedBookmarks
=
$
(
"input[name='chkDelete']:checked"
);
$
.
each
(
arrSelectedBookmarks
,
function
()
{
// Delete selected items on layout
var
contentid
=
JSON
.
parse
(
this
.
value
).
contentid
;
var
pageNo
=
JSON
.
parse
(
this
.
value
).
pageNo
;
$
(
this
).
parent
().
parent
().
parent
().
remove
();
// Remove from ClientData
var
bm
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
bm
.
length
-
1
;
nIndex
>=
0
;
nIndex
--
)
{
if
(
bm
[
nIndex
].
contentid
==
contentid
&&
bm
[
nIndex
].
pageNo
==
pageNo
)
{
bm
.
splice
(
nIndex
,
1
);
ClientData
.
isChangedBookmark
(
true
);
}
}
ClientData
.
BookMarkData
(
bm
);
if
(
ClientData
.
BookMarkData
().
length
==
0
)
{
// Show error
$
(
"#msgShioriNotExists"
).
show
();
$
(
"#dspDelete"
).
hide
();
$
(
"#dspDelete1"
).
hide
();
}
});
// --------------------------------
// Process deleting [ end ]
// --------------------------------
$
(
"#delete_shiori"
).
hide
();
COMMON
.
unlockLayout
();
// --------------------------------
// Process deleting [start]
// --------------------------------
// Get selected bookmarks
var
arrSelectedBookmarks
=
$
(
"input[name='chkDelete']:checked"
);
$
.
each
(
arrSelectedBookmarks
,
function
()
{
// Delete selected items on layout
var
contentid
=
JSON
.
parse
(
this
.
value
).
contentid
;
var
pageNo
=
JSON
.
parse
(
this
.
value
).
pageNo
;
$
(
this
).
parent
().
parent
().
parent
().
remove
();
// Remove from ClientData
var
bm
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
bm
.
length
-
1
;
nIndex
>=
0
;
nIndex
--
)
{
if
(
bm
[
nIndex
].
contentid
==
contentid
&&
bm
[
nIndex
].
pageNo
==
pageNo
)
{
bm
.
splice
(
nIndex
,
1
);
ClientData
.
isChangedBookmark
(
true
);
}
}
ClientData
.
BookMarkData
(
bm
);
if
(
ClientData
.
BookMarkData
().
length
==
0
)
{
// Show error
$
(
"#msgShioriNotExists"
).
show
();
$
(
"#dspDelete"
).
hide
();
$
(
"#dspDelete1"
).
hide
();
}
});
// --------------------------------
// Process deleting [ end ]
// --------------------------------
$
(
"#delete_shiori"
).
hide
();
COMMON
.
unlockLayout
();
};
BOOKMARK
.
dspDelete1_Click
=
function
()
{
BOOKMARK
.
dspDelete_Click
();
};
BOOKMARK
.
dspDelete_Click
=
function
()
{
if
(
$
(
"input[name='chkDelete']:checked"
).
length
>
0
)
{
COMMON
.
lockLayout
();
$
(
"#delete_shiori"
).
show
();
$
(
"#delete_shiori"
).
center
();
}
BOOKMARK
.
dspDelete_Click
=
function
()
{
if
(
$
(
"input[name='chkDelete']:checked"
).
length
>
0
)
{
COMMON
.
lockLayout
();
$
(
"#delete_shiori"
).
show
();
$
(
"#delete_shiori"
).
center
();
}
};
// Show detail content
BOOKMARK
.
ShowBookmark
=
function
(
showList
)
{
if
(
AVWEB
.
avwHasError
())
{
return
;
}
else
{
var
hasMemo
=
false
;
var
hasMarking
=
false
;
var
contentid
=
""
;
var
pageNo
=
0
;
if
(
showList
.
length
>
0
)
{
$
(
"#dspDelete"
).
show
();
$
(
"#dspDelete1"
).
show
();
}
//TotalThread = ClientData.BookMarkData().length;
for
(
var
nIndex
=
showList
.
length
-
1
;
nIndex
>=
0
;
nIndex
--
)
{
hasMarking
=
false
;
hasMemo
=
false
;
contentid
=
showList
[
nIndex
].
contentid
;
pageNo
=
showList
[
nIndex
].
pageNo
;
// Check if contentid has marking
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MarkingData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MarkingData
()[
nIndex1
].
contentid
==
contentid
&&
ClientData
.
MarkingData
()[
nIndex1
].
pageNo
==
pageNo
)
{
hasMarking
=
true
;
}
}
// Check if contentid has memo
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MemoData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MemoData
()[
nIndex1
].
contentid
==
contentid
&&
ClientData
.
MemoData
()[
nIndex1
].
pageNo
==
pageNo
)
{
hasMemo
=
true
;
}
}
var
pageDetail
;
var
contentTitle
=
""
;
var
contentTitleKana
=
""
;
var
contentType
=
""
;
// Search current page if collection that get details before
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
contentid
)
{
contentTitle
=
BOOKMARK
.
collection_contents
[
nIndex2
].
contentTitle
;
contentTitleKana
=
BOOKMARK
.
collection_contents
[
nIndex2
].
contentTitleKana
;
contentType
=
BOOKMARK
.
collection_contents
[
nIndex2
].
contentType
;
// Search in pages
for
(
var
nIndex3
=
0
;
nIndex3
<
BOOKMARK
.
collection_contents
[
nIndex2
].
pages
.
length
;
nIndex3
++
)
{
if
(
pageNo
==
BOOKMARK
.
collection_contents
[
nIndex2
].
pages
[
nIndex3
].
pageNo
)
{
pageDetail
=
BOOKMARK
.
collection_contents
[
nIndex2
].
pages
[
nIndex3
];
if
(
contentType
!=
COMMON
.
ContentTypeKeys
.
Type_PDF
){
pageDetail
.
pageText
=
""
;
}
break
;
}
}
}
}
if
(
pageDetail
)
{
// If bookmark does not exist
if
(
pageDetail
.
existed
==
true
)
{
// Show normal
BOOKMARK
.
UpdateBookmark
(
contentid
,
pageDetail
.
pageNo
,
contentTitle
,
contentTitleKana
);
var
pageThumbnail
=
(
pageDetail
.
pageThumbnail
!=
BOOKMARK
.
pathImgContentNone
)
?
(
"data:image/jpeg;base64,"
+
pageDetail
.
pageThumbnail
)
:
BOOKMARK
.
pathImgContentNone
;
BOOKMARK
.
insertRow
(
contentid
,
pageThumbnail
,
COMMON
.
htmlEncode
(
contentTitle
),
pageDetail
.
pageText
,
pageDetail
.
pageNo
,
hasMemo
,
hasMarking
,
nIndex
,
contentType
);
}
else
{
// Not existed -> Show error
BOOKMARK
.
insertRowError
(
contentid
,
COMMON
.
htmlEncode
(
contentTitle
),
pageDetail
.
pageNo
);
}
}
}
$
(
"a[name='dspRead']"
).
unbind
(
'click'
);
$
(
"a[name='dspRead']"
).
click
(
BOOKMARK
.
dspRead_Click
);
}
if
(
AVWEB
.
avwHasError
())
{
return
;
}
var
hasMemo
=
false
;
var
hasMarking
=
false
;
var
contentid
=
""
;
var
pageNo
=
0
;
if
(
showList
.
length
>
0
)
{
$
(
"#dspDelete"
).
show
();
$
(
"#dspDelete1"
).
show
();
}
// TotalThread = ClientData.BookMarkData().length;
for
(
var
nIndex
=
showList
.
length
-
1
;
nIndex
>=
0
;
nIndex
--
)
{
hasMarking
=
false
;
hasMemo
=
false
;
contentid
=
showList
[
nIndex
].
contentid
;
pageNo
=
showList
[
nIndex
].
pageNo
;
// Check if contentid has marking
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MarkingData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MarkingData
()[
nIndex1
].
contentid
==
contentid
&&
ClientData
.
MarkingData
()[
nIndex1
].
pageNo
==
pageNo
)
{
hasMarking
=
true
;
}
}
// Check if contentid has memo
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MemoData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MemoData
()[
nIndex1
].
contentid
==
contentid
&&
ClientData
.
MemoData
()[
nIndex1
].
pageNo
==
pageNo
)
{
hasMemo
=
true
;
}
}
var
pageDetail
;
var
contentTitle
=
""
;
var
contentTitleKana
=
""
;
var
contentType
=
""
;
// Search current page if collection that get details before
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
contentid
)
{
contentTitle
=
BOOKMARK
.
collection_contents
[
nIndex2
].
contentTitle
;
contentTitleKana
=
BOOKMARK
.
collection_contents
[
nIndex2
].
contentTitleKana
;
contentType
=
BOOKMARK
.
collection_contents
[
nIndex2
].
contentType
;
// Search in pages
for
(
var
nIndex3
=
0
;
nIndex3
<
BOOKMARK
.
collection_contents
[
nIndex2
].
pages
.
length
;
nIndex3
++
)
{
if
(
pageNo
==
BOOKMARK
.
collection_contents
[
nIndex2
].
pages
[
nIndex3
].
pageNo
)
{
pageDetail
=
BOOKMARK
.
collection_contents
[
nIndex2
].
pages
[
nIndex3
];
if
(
contentType
!=
COMMON
.
ContentTypeKeys
.
Type_PDF
)
{
pageDetail
.
pageText
=
""
;
}
break
;
}
}
}
}
if
(
pageDetail
)
{
// If bookmark does not exist
if
(
pageDetail
.
existed
==
true
)
{
// Show normal
BOOKMARK
.
UpdateBookmark
(
contentid
,
pageDetail
.
pageNo
,
contentTitle
,
contentTitleKana
);
var
pageThumbnail
=
(
pageDetail
.
pageThumbnail
!=
BOOKMARK
.
pathImgContentNone
)
?
(
"data:image/jpeg;base64,"
+
pageDetail
.
pageThumbnail
)
:
BOOKMARK
.
pathImgContentNone
;
BOOKMARK
.
insertRow
(
contentid
,
pageThumbnail
,
COMMON
.
htmlEncode
(
contentTitle
),
pageDetail
.
pageText
,
pageDetail
.
pageNo
,
hasMemo
,
hasMarking
,
nIndex
,
contentType
);
}
else
{
// Not existed -> Show error
BOOKMARK
.
insertRowError
(
contentid
,
COMMON
.
htmlEncode
(
contentTitle
),
pageDetail
.
pageNo
);
}
}
}
$
(
"a[name='dspRead']"
).
unbind
(
'click'
);
$
(
"a[name='dspRead']"
).
click
(
BOOKMARK
.
dspRead_Click
);
};
// Hide all sorting symbol
BOOKMARK
.
HideSorting
=
function
()
{
$
(
'#menu_sort li a'
).
removeClass
(
'ascending_sort'
).
removeClass
(
'descending_sort'
);
$
(
'#menu_sort li a'
).
removeClass
(
'ascending_sort'
).
removeClass
(
'descending_sort'
);
};
// Sort by title name
BOOKMARK
.
SortTitleName
=
function
(
isAsc
)
{
HEADER
.
setStatusSort
(
'#dspTitleNm'
,
isAsc
);
var
arrSource
=
ClientData
.
BookMarkData
();
var
arrTarget
=
[];
var
arrShowList
=
[];
var
strTemp
=
""
;
var
nTempIndex
=
0
;
var
isStop
=
false
;
while
(
!
isStop
)
{
if
(
arrSource
.
length
>
0
)
{
strTemp
=
""
;
// Lookup min item
for
(
var
nIndex
=
0
;
nIndex
<
arrSource
.
length
;
nIndex
++
)
{
if
(
strTemp
==
""
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitle
;
nTempIndex
=
nIndex
;
}
else
{
// ASC
if
(
isAsc
)
{
if
(
arrSource
[
nIndex
].
contentTitle
<
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitle
;
nTempIndex
=
nIndex
;
}
}
else
{
if
(
arrSource
[
nIndex
].
contentTitle
>
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitle
;
nTempIndex
=
nIndex
;
}
}
}
}
// Add to target array
arrTarget
.
push
(
arrSource
[
nTempIndex
]);
//表示対象なら表示用リストにプッシュ
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
arrSource
[
nTempIndex
].
contentid
)
{
arrShowList
.
push
(
arrSource
[
nTempIndex
]);
break
;
}
}
// Remove min item from source array
arrSource
.
splice
(
nTempIndex
,
1
);
}
else
{
isStop
=
true
;
}
}
BOOKMARK
.
ClearGrid
();
ClientData
.
BookMarkData
(
arrTarget
);
BOOKMARK
.
ShowBookmark
(
arrShowList
);
HEADER
.
setStatusSort
(
'#dspTitleNm'
,
isAsc
);
var
arrSource
=
ClientData
.
BookMarkData
();
var
arrTarget
=
[];
var
arrShowList
=
[];
var
strTemp
=
""
;
var
nTempIndex
=
0
;
var
isStop
=
false
;
while
(
!
isStop
)
{
if
(
arrSource
.
length
>
0
)
{
strTemp
=
""
;
// Lookup min item
for
(
var
nIndex
=
0
;
nIndex
<
arrSource
.
length
;
nIndex
++
)
{
if
(
strTemp
==
""
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitle
;
nTempIndex
=
nIndex
;
}
else
{
// ASC
if
(
isAsc
)
{
if
(
arrSource
[
nIndex
].
contentTitle
<
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitle
;
nTempIndex
=
nIndex
;
}
}
else
{
if
(
arrSource
[
nIndex
].
contentTitle
>
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitle
;
nTempIndex
=
nIndex
;
}
}
}
}
// Add to target array
arrTarget
.
push
(
arrSource
[
nTempIndex
]);
// 表示対象なら表示用リストにプッシュ
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
arrSource
[
nTempIndex
].
contentid
)
{
arrShowList
.
push
(
arrSource
[
nTempIndex
]);
break
;
}
}
// Remove min item from source array
arrSource
.
splice
(
nTempIndex
,
1
);
}
else
{
isStop
=
true
;
}
}
BOOKMARK
.
ClearGrid
();
ClientData
.
BookMarkData
(
arrTarget
);
BOOKMARK
.
ShowBookmark
(
arrShowList
);
};
// Clear all rows of grid
BOOKMARK
.
ClearGrid
=
function
()
{
var
arrSelectedBookmarks
=
$
(
"input[name='chkDelete']"
);
$
.
each
(
arrSelectedBookmarks
,
function
()
{
$
(
this
).
parent
().
parent
().
parent
().
remove
();
});
var
arrSelectedBookmarks
=
$
(
"input[name='chkDelete']"
);
$
.
each
(
arrSelectedBookmarks
,
function
()
{
$
(
this
).
parent
().
parent
().
parent
().
remove
();
});
};
// Sort by title name kana
BOOKMARK
.
SortTitleNameKana
=
function
(
isAsc
)
{
HEADER
.
setStatusSort
(
'#dspTitleNmKn'
,
isAsc
);
var
arrSource
=
ClientData
.
BookMarkData
();
var
arrTarget
=
[];
var
arrShowList
=
[];
var
strTemp
=
""
;
var
nTempIndex
=
0
;
var
isStop
=
false
;
while
(
!
isStop
)
{
if
(
arrSource
.
length
>
0
)
{
strTemp
=
""
;
// Lookup min item
for
(
var
nIndex
=
0
;
nIndex
<
arrSource
.
length
;
nIndex
++
)
{
if
(
strTemp
==
""
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitleKana
;
nTempIndex
=
nIndex
;
}
else
{
// ASC
if
(
isAsc
)
{
if
(
arrSource
[
nIndex
].
contentTitleKana
<
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitleKana
;
nTempIndex
=
nIndex
;
}
}
else
{
if
(
arrSource
[
nIndex
].
contentTitleKana
>
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitleKana
;
nTempIndex
=
nIndex
;
}
}
}
}
// Add to target array
arrTarget
.
push
(
arrSource
[
nTempIndex
]);
//表示対象なら表示用リストにプッシュ
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
arrSource
[
nTempIndex
].
contentid
)
{
arrShowList
.
push
(
arrSource
[
nTempIndex
]);
break
;
}
}
// Remove min item from source array
arrSource
.
splice
(
nTempIndex
,
1
);
}
else
{
isStop
=
true
;
}
}
BOOKMARK
.
ClearGrid
();
ClientData
.
BookMarkData
(
arrTarget
);
BOOKMARK
.
ShowBookmark
(
arrShowList
);
HEADER
.
setStatusSort
(
'#dspTitleNmKn'
,
isAsc
);
var
arrSource
=
ClientData
.
BookMarkData
();
var
arrTarget
=
[];
var
arrShowList
=
[];
var
strTemp
=
""
;
var
nTempIndex
=
0
;
var
isStop
=
false
;
while
(
!
isStop
)
{
if
(
arrSource
.
length
>
0
)
{
strTemp
=
""
;
// Lookup min item
for
(
var
nIndex
=
0
;
nIndex
<
arrSource
.
length
;
nIndex
++
)
{
if
(
strTemp
==
""
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitleKana
;
nTempIndex
=
nIndex
;
}
else
{
// ASC
if
(
isAsc
)
{
if
(
arrSource
[
nIndex
].
contentTitleKana
<
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitleKana
;
nTempIndex
=
nIndex
;
}
}
else
{
if
(
arrSource
[
nIndex
].
contentTitleKana
>
strTemp
)
{
strTemp
=
arrSource
[
nIndex
].
contentTitleKana
;
nTempIndex
=
nIndex
;
}
}
}
}
// Add to target array
arrTarget
.
push
(
arrSource
[
nTempIndex
]);
// 表示対象なら表示用リストにプッシュ
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
arrSource
[
nTempIndex
].
contentid
)
{
arrShowList
.
push
(
arrSource
[
nTempIndex
]);
break
;
}
}
// Remove min item from source array
arrSource
.
splice
(
nTempIndex
,
1
);
}
else
{
isStop
=
true
;
}
}
BOOKMARK
.
ClearGrid
();
ClientData
.
BookMarkData
(
arrTarget
);
BOOKMARK
.
ShowBookmark
(
arrShowList
);
};
// Sort by publish date
BOOKMARK
.
SortPubDate
=
function
(
isAsc
)
{
HEADER
.
setStatusSort
(
'#dspPubDt'
,
isAsc
);
var
arrSource
=
ClientData
.
BookMarkData
();
var
arrTarget
=
[];
var
arrShowList
=
[];
var
dateTemp
=
undefined
;
var
nTempIndex
=
0
;
var
isStop
=
false
;
while
(
!
isStop
)
{
if
(
arrSource
.
length
>
0
)
{
dateTemp
=
undefined
;
// Lookup min item
for
(
var
nIndex
=
0
;
nIndex
<
arrSource
.
length
;
nIndex
++
)
{
if
(
dateTemp
==
undefined
)
{
dateTemp
=
arrSource
[
nIndex
].
registerDate
;
nTempIndex
=
nIndex
;
}
else
{
// ASC
if
(
isAsc
)
{
if
(
arrSource
[
nIndex
].
registerDate
<
dateTemp
)
{
dateTemp
=
arrSource
[
nIndex
].
registerDate
;
nTempIndex
=
nIndex
;
}
}
else
{
if
(
arrSource
[
nIndex
].
registerDate
>
dateTemp
)
{
dateTemp
=
arrSource
[
nIndex
].
registerDate
;
nTempIndex
=
nIndex
;
}
}
}
}
// Add to target array
arrTarget
.
push
(
arrSource
[
nTempIndex
]);
//表示対象なら表示用リストにプッシュ
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
arrSource
[
nTempIndex
].
contentid
)
{
arrShowList
.
push
(
arrSource
[
nTempIndex
]);
break
;
}
}
// Remove min item from source array
arrSource
.
splice
(
nTempIndex
,
1
);
}
else
{
isStop
=
true
;
}
}
BOOKMARK
.
ClearGrid
();
ClientData
.
BookMarkData
(
arrTarget
);
BOOKMARK
.
ShowBookmark
(
arrShowList
);
HEADER
.
setStatusSort
(
'#dspPubDt'
,
isAsc
);
var
arrSource
=
ClientData
.
BookMarkData
();
var
arrTarget
=
[];
var
arrShowList
=
[];
var
dateTemp
=
undefined
;
var
nTempIndex
=
0
;
var
isStop
=
false
;
while
(
!
isStop
)
{
if
(
arrSource
.
length
>
0
)
{
dateTemp
=
undefined
;
// Lookup min item
for
(
var
nIndex
=
0
;
nIndex
<
arrSource
.
length
;
nIndex
++
)
{
if
(
dateTemp
==
undefined
)
{
dateTemp
=
arrSource
[
nIndex
].
registerDate
;
nTempIndex
=
nIndex
;
}
else
{
// ASC
if
(
isAsc
)
{
if
(
arrSource
[
nIndex
].
registerDate
<
dateTemp
)
{
dateTemp
=
arrSource
[
nIndex
].
registerDate
;
nTempIndex
=
nIndex
;
}
}
else
{
if
(
arrSource
[
nIndex
].
registerDate
>
dateTemp
)
{
dateTemp
=
arrSource
[
nIndex
].
registerDate
;
nTempIndex
=
nIndex
;
}
}
}
}
// Add to target array
arrTarget
.
push
(
arrSource
[
nTempIndex
]);
// 表示対象なら表示用リストにプッシュ
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
.
length
;
nIndex2
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex2
].
contentid
==
arrSource
[
nTempIndex
].
contentid
)
{
arrShowList
.
push
(
arrSource
[
nTempIndex
]);
break
;
}
}
// Remove min item from source array
arrSource
.
splice
(
nTempIndex
,
1
);
}
else
{
isStop
=
true
;
}
}
BOOKMARK
.
ClearGrid
();
ClientData
.
BookMarkData
(
arrTarget
);
BOOKMARK
.
ShowBookmark
(
arrShowList
);
};
/*
Update information of specified bookmark
*/
*
Update information of specified bookmark
*/
BOOKMARK
.
UpdateBookmark
=
function
(
contentid
,
pageNo
,
contentTitle
,
contentTitleKana
)
{
var
arrBookmarks
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
0
;
nIndex
<
arrBookmarks
.
length
;
nIndex
++
)
{
if
(
contentid
==
arrBookmarks
[
nIndex
].
contentid
&&
pageNo
==
arrBookmarks
[
nIndex
].
pageNo
)
{
if
(
contentTitle
!=
null
&&
contentTitle
!=
undefined
)
{
arrBookmarks
[
nIndex
].
contentTitle
=
contentTitle
;
}
if
(
contentTitleKana
!=
null
&&
contentTitleKana
!=
undefined
)
{
arrBookmarks
[
nIndex
].
contentTitleKana
=
contentTitleKana
;
}
break
;
}
}
// Set bookmark back to client data
ClientData
.
BookMarkData
(
arrBookmarks
);
var
arrBookmarks
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
0
;
nIndex
<
arrBookmarks
.
length
;
nIndex
++
)
{
if
(
contentid
==
arrBookmarks
[
nIndex
].
contentid
&&
pageNo
==
arrBookmarks
[
nIndex
].
pageNo
)
{
if
(
contentTitle
!=
null
&&
contentTitle
!=
undefined
)
{
arrBookmarks
[
nIndex
].
contentTitle
=
contentTitle
;
}
if
(
contentTitleKana
!=
null
&&
contentTitleKana
!=
undefined
)
{
arrBookmarks
[
nIndex
].
contentTitleKana
=
contentTitleKana
;
}
break
;
}
}
// Set bookmark back to client data
ClientData
.
BookMarkData
(
arrBookmarks
);
};
/*
Insert error row
*/
*
Insert error row
*/
BOOKMARK
.
insertRowError
=
function
(
contentid
,
pageTitle
,
pageNo
)
{
var
newRow
=
""
;
newRow
+=
"<section class='sectionBookmark'>"
;
newRow
+=
" <div class='cnt_section'>"
;
newRow
+=
'<span class="check">'
;
newRow
+=
"<input type='checkbox' name='chkDelete' value='{
\"
contentid
\"
:"
+
contentid
+
",
\"
pageNo
\"
:"
+
pageNo
+
"}' />"
;
newRow
+=
'</span>'
;
newRow
+=
" <div class='text'>"
;
newRow
+=
' <label class="name">'
+
COMMON
.
truncate
(
pageTitle
,
20
)
+
'</label>'
;
newRow
+=
' <div class="info">'
;
newRow
+=
" <label class='lang name' lang='msgShioriDeleted'>"
+
I18N
.
i18nText
(
'msgShioriDeleted'
)
+
"</label>"
;
newRow
+=
" </div>"
;
newRow
+=
" </div>"
;
newRow
+=
"</section>"
;
$
(
'#pnlTop'
).
after
(
newRow
);
var
newRow
=
""
;
newRow
+=
"<section class='sectionBookmark'>"
;
newRow
+=
" <div class='cnt_section'>"
;
newRow
+=
'<span class="check">'
;
newRow
+=
"<input type='checkbox' name='chkDelete' value='{
\"
contentid
\"
:"
+
contentid
+
",
\"
pageNo
\"
:"
+
pageNo
+
"}' />"
;
newRow
+=
'</span>'
;
newRow
+=
" <div class='text'>"
;
newRow
+=
' <label class="name">'
+
COMMON
.
truncate
(
pageTitle
,
20
)
+
'</label>'
;
newRow
+=
' <div class="info">'
;
newRow
+=
" <label class='lang name' lang='msgShioriDeleted'>"
+
I18N
.
i18nText
(
'msgShioriDeleted'
)
+
"</label>"
;
newRow
+=
" </div>"
;
newRow
+=
" </div>"
;
newRow
+=
"</section>"
;
$
(
'#pnlTop'
).
after
(
newRow
);
};
// Insert row to grid
// Insert row to grid
BOOKMARK
.
insertRow
=
function
(
contentid
,
pageThumbnail
,
pageTitle
,
pageText
,
pageNo
,
hasMemo
,
hasMarking
,
index
,
contentType
)
{
var
imgMarkingHide
=
'<img style="visibility:hidden" class="pen" alt="" src="./img/list/icon_pen.png" />'
;
var
imgMemoHide
=
'<img style="visibility:hidden" class="sticker" alt="" src="./img/list/icon_sticker.png" />'
;
var
imgMarking
=
'<img class="pen" alt="" src="./img/list/icon_pen.png" />'
;
var
imgMemo
=
'<img class="sticker" alt="" src="./img/list/icon_sticker.png" />'
;
var
newRow
=
""
;
newRow
+=
"<section class='sectionBookmark'>"
;
newRow
+=
'<div class="cnt_section">'
;
newRow
+=
'<span class="check">'
;
newRow
+=
"<input type='checkbox' name='chkDelete' value='{
\"
contentid
\"
:"
+
contentid
+
",
\"
pageNo
\"
:"
+
pageNo
+
",
\"
index
\"
: "
+
index
+
"}'/>"
;
newRow
+=
'</span>'
;
newRow
+=
'<a class="img" href="#">'
;
newRow
+=
'<img id="pageImg'
+
contentid
+
'" src="'
+
pageThumbnail
+
'" width="160" height="120" style="display:none;">'
;
newRow
+=
'<img id="loadingIcon'
+
contentid
+
"_"
+
pageNo
+
'" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
;
newRow
+=
'</a>'
;
newRow
+=
'<div class="text">'
;
newRow
+=
'<a class="name" href="#" title="'
+
pageTitle
+
'" ><div class ="pageTitle" >'
+
pageTitle
+
'</div></a>'
;
newRow
+=
'<div class="info">'
;
newRow
+=
'<ul class="date">'
;
var
contentText
=
COMMON
.
htmlEncode
(
COMMON
.
getLines
(
pageText
,
3
));
newRow
+=
'<li><label id="Label1">'
+
COMMON
.
truncate
(
contentText
,
60
)
+
'</label></li>'
;
newRow
+=
'</ul>'
;
newRow
+=
'<ul class="pic">'
;
//Resize Image
var
imgTemp
=
new
Image
();
imgTemp
.
onload
=
function
()
{
if
(
imgTemp
.
width
>
imgTemp
.
height
)
{
$
(
"img#pageImg"
+
contentid
).
attr
(
'height'
,
''
);
$
(
"img#pageImg"
+
contentid
).
removeAttr
(
'height'
);
$
(
"img#pageImg"
+
contentid
).
attr
(
'width'
,
'120'
);
var
realHeight
=
(
120
*
imgTemp
.
height
)
/
imgTemp
.
width
;
$
(
"img#pageImg"
+
contentid
).
css
(
'padding-top'
,
(
120
-
realHeight
)
/
2
+
'px'
);
}
else
{
$
(
"img#pageImg"
+
contentid
).
attr
(
'width'
,
''
);
$
(
"img#pageImg"
+
contentid
).
removeAttr
(
'width'
);
$
(
"img#pageImg"
+
contentid
).
attr
(
'height'
,
'120'
);
$
(
"img#pageImg"
+
contentid
).
css
(
'padding-top'
,
'0px'
);
}
$
(
"#loadingIcon"
+
contentid
+
"_"
+
pageNo
).
fadeOut
(
'slow'
,
function
()
{
$
(
"img#pageImg"
+
contentid
).
fadeIn
(
'slow'
);
});
};
imgTemp
.
src
=
pageThumbnail
;
if
(
hasMemo
)
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMemo
+
'</a></li>'
;
}
else
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMemoHide
+
'</a></li>'
;
}
if
(
hasMarking
)
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMarking
+
'</a></li>'
;
}
else
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMarkingHide
+
'</a></li>'
;
}
newRow
+=
'<li class="pageno"><label id="Label2" class="lang" lang="txtPage">'
+
I18N
.
i18nText
(
'txtPage'
)
+
'</label><label id="Label3">'
+
pageNo
+
'</label></li>'
;
newRow
+=
'<li>'
;
newRow
+=
"<a class='read read_open lang' name='dspRead' value='{
\"
contentid
\"
:
\"
"
+
contentid
+
"
\"
,
\"
pageNo
\"
:
\"
"
+
pageNo
+
"
\"
,
\"
contentType
\"
:
\"
"
+
contentType
+
"
\"
}' lang='txtRead'>"
+
I18N
.
i18nText
(
'txtRead'
)
+
"</a>"
;
newRow
+=
'</li>'
;
newRow
+=
'</ul>'
;
newRow
+=
'</div>'
;
newRow
+=
'</div>'
;
newRow
+=
'</div>'
;
newRow
+=
"</section>"
;
$
(
'#pnlTop'
).
after
(
newRow
);
};
var
imgMarkingHide
=
'<img style="visibility:hidden" class="pen" alt="" src="./img/list/icon_pen.png" />'
;
var
imgMemoHide
=
'<img style="visibility:hidden" class="sticker" alt="" src="./img/list/icon_sticker.png" />'
;
var
imgMarking
=
'<img class="pen" alt="" src="./img/list/icon_pen.png" />'
;
var
imgMemo
=
'<img class="sticker" alt="" src="./img/list/icon_sticker.png" />'
;
var
newRow
=
""
;
newRow
+=
"<section class='sectionBookmark'>"
;
newRow
+=
'<div class="cnt_section">'
;
newRow
+=
'<span class="check">'
;
newRow
+=
"<input type='checkbox' name='chkDelete' value='{
\"
contentid
\"
:"
+
contentid
+
",
\"
pageNo
\"
:"
+
pageNo
+
",
\"
index
\"
: "
+
index
+
"}'/>"
;
newRow
+=
'</span>'
;
newRow
+=
'<a class="img" href="#">'
;
newRow
+=
'<img id="pageImg'
+
contentid
+
'" src="'
+
pageThumbnail
+
'" width="160" height="120" style="display:none;">'
;
newRow
+=
'<img id="loadingIcon'
+
contentid
+
"_"
+
pageNo
+
'" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
;
newRow
+=
'</a>'
;
newRow
+=
'<div class="text">'
;
newRow
+=
'<a class="name" href="#" title="'
+
pageTitle
+
'" ><div class ="pageTitle" >'
+
pageTitle
+
'</div></a>'
;
newRow
+=
'<div class="info">'
;
newRow
+=
'<ul class="date">'
;
var
contentText
=
COMMON
.
htmlEncode
(
COMMON
.
getLines
(
pageText
,
3
));
newRow
+=
'<li><label id="Label1">'
+
COMMON
.
truncate
(
contentText
,
60
)
+
'</label></li>'
;
newRow
+=
'</ul>'
;
newRow
+=
'<ul class="pic">'
;
// Resize Image
var
imgTemp
=
new
Image
();
imgTemp
.
onload
=
function
()
{
if
(
imgTemp
.
width
>
imgTemp
.
height
)
{
$
(
"img#pageImg"
+
contentid
).
attr
(
'height'
,
''
);
$
(
"img#pageImg"
+
contentid
).
removeAttr
(
'height'
);
$
(
"img#pageImg"
+
contentid
).
attr
(
'width'
,
'120'
);
var
realHeight
=
(
120
*
imgTemp
.
height
)
/
imgTemp
.
width
;
$
(
"img#pageImg"
+
contentid
).
css
(
'padding-top'
,
(
120
-
realHeight
)
/
2
+
'px'
);
}
else
{
$
(
"img#pageImg"
+
contentid
).
attr
(
'width'
,
''
);
$
(
"img#pageImg"
+
contentid
).
removeAttr
(
'width'
);
$
(
"img#pageImg"
+
contentid
).
attr
(
'height'
,
'120'
);
$
(
"img#pageImg"
+
contentid
).
css
(
'padding-top'
,
'0px'
);
}
$
(
"#loadingIcon"
+
contentid
+
"_"
+
pageNo
).
fadeOut
(
'slow'
,
function
()
{
$
(
"img#pageImg"
+
contentid
).
fadeIn
(
'slow'
);
});
};
imgTemp
.
src
=
pageThumbnail
;
if
(
hasMemo
)
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMemo
+
'</a></li>'
;
}
else
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMemoHide
+
'</a></li>'
;
}
if
(
hasMarking
)
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMarking
+
'</a></li>'
;
}
else
{
newRow
+=
'<li><a href="javascript:void(0);" style="cursor: default;">'
+
imgMarkingHide
+
'</a></li>'
;
}
newRow
+=
'<li class="pageno"><label id="Label2" class="lang" lang="txtPage">'
+
I18N
.
i18nText
(
'txtPage'
)
+
'</label><label id="Label3">'
+
pageNo
+
'</label></li>'
;
newRow
+=
'<li>'
;
newRow
+=
"<a class='read read_open lang' name='dspRead' value='{
\"
contentid
\"
:
\"
"
+
contentid
+
"
\"
,
\"
pageNo
\"
:
\"
"
+
pageNo
+
"
\"
,
\"
contentType
\"
:
\"
"
+
contentType
+
"
\"
}' lang='txtRead'>"
+
I18N
.
i18nText
(
'txtRead'
)
+
"</a>"
;
newRow
+=
'</li>'
;
newRow
+=
'</ul>'
;
newRow
+=
'</div>'
;
newRow
+=
'</div>'
;
newRow
+=
'</div>'
;
newRow
+=
"</section>"
;
$
(
'#pnlTop'
).
after
(
newRow
);
};
/*
----------------------------------------------------------------------------
Event groups [ end ]
----------------------------------------------------------------------------
*/
*
----------------------------------------------------------------------------
*
Event groups [ end ]
*
----------------------------------------------------------------------------
*/
/*
Get all detail pages of content in bookmark
*/
*
Get all detail pages of content in bookmark
*/
BOOKMARK
.
bookmark_collectAllPages
=
function
()
{
var
arrBookMarks
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
collection_contents
.
length
;
nIndex
++
)
{
var
contentid
=
BOOKMARK
.
collection_contents
[
nIndex
].
contentid
;
var
pages
=
[];
// Collect all pages of current content
for
(
var
nIndex1
=
0
;
nIndex1
<
arrBookMarks
.
length
;
nIndex1
++
)
{
// Found content
if
(
arrBookMarks
[
nIndex1
].
contentid
==
contentid
)
{
pages
.
push
({
pageNo
:
arrBookMarks
[
nIndex1
].
pageNo
,
pageText
:
""
,
pageThumbnail
:
""
,
existed
:
false
});
}
}
// Add collected pages to content
BOOKMARK
.
collection_contents
[
nIndex
].
pages
=
pages
;
// Join pages to request to server
var
strPageNos
=
BOOKMARK
.
buildPageNos
(
BOOKMARK
.
collection_contents
[
nIndex
].
pages
);
// Call api to get all details of pages 1 time
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webContentPage"
,
"GET"
,
{
contentId
:
contentid
,
sid
:
ClientData
.
userInfo_sid
(),
pageNos
:
strPageNos
,
thumbnailFlg
:
1
},
function
(
data
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
contentTitle
=
data
.
contentTitle
;
BOOKMARK
.
collection_contents
[
nIndex
].
contentTitleKana
=
data
.
contentTitleKana
;
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
[
nIndex
].
pages
.
length
;
nIndex2
++
)
{
var
comparePageNo
=
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageNo
;
for
(
var
nIndex3
=
0
;
nIndex3
<
data
.
pages
.
length
;
nIndex3
++
)
{
if
(
data
.
pages
[
nIndex2
]
&&
comparePageNo
==
data
.
pages
[
nIndex2
].
pageNo
)
{
// Set flag to determine page existed
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
existed
=
true
;
// Store detail of page
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageText
=
data
.
pages
[
nIndex2
].
pageText
;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageThumbnail
=
data
.
pages
[
nIndex2
].
pageThumbnail
;
}
else
if
(
BOOKMARK
.
contentTypes
[
contentid
]
==
"none"
&&
data
.
pages
.
length
>
0
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
existed
=
true
;
// Store detail of page
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageText
=
''
;
//data.pages[0].pageText;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageThumbnail
=
BOOKMARK
.
pathImgContentNone
;
//data.pages[nIndex2].pageThumbnail;
}
}
}
},
function
()
{
// when server response error
if
(
BOOKMARK
.
contentTypes
[
contentid
]
==
"none"
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
contentTitle
=
BOOKMARK
.
contentName
[
contentid
];
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
[
nIndex
].
pages
.
length
;
nIndex2
++
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
existed
=
true
;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageThumbnail
=
BOOKMARK
.
pathImgContentNone
;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageText
=
''
;
}
}
}
);
}
var
arrBookMarks
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
collection_contents
.
length
;
nIndex
++
)
{
var
contentid
=
BOOKMARK
.
collection_contents
[
nIndex
].
contentid
;
var
pages
=
[];
// Collect all pages of current content
for
(
var
nIndex1
=
0
;
nIndex1
<
arrBookMarks
.
length
;
nIndex1
++
)
{
// Found content
if
(
arrBookMarks
[
nIndex1
].
contentid
==
contentid
)
{
pages
.
push
({
pageNo
:
arrBookMarks
[
nIndex1
].
pageNo
,
pageText
:
""
,
pageThumbnail
:
""
,
existed
:
false
});
}
}
// Add collected pages to content
BOOKMARK
.
collection_contents
[
nIndex
].
pages
=
pages
;
// Join pages to request to server
var
strPageNos
=
BOOKMARK
.
buildPageNos
(
BOOKMARK
.
collection_contents
[
nIndex
].
pages
);
// Call api to get all details of pages 1 time
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webContentPage"
,
"GET"
,
{
contentId
:
contentid
,
sid
:
ClientData
.
userInfo_sid
(),
pageNos
:
strPageNos
,
thumbnailFlg
:
1
},
function
(
data
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
contentTitle
=
data
.
contentTitle
;
BOOKMARK
.
collection_contents
[
nIndex
].
contentTitleKana
=
data
.
contentTitleKana
;
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
[
nIndex
].
pages
.
length
;
nIndex2
++
)
{
var
comparePageNo
=
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageNo
;
for
(
var
nIndex3
=
0
;
nIndex3
<
data
.
pages
.
length
;
nIndex3
++
)
{
if
(
data
.
pages
[
nIndex2
]
&&
comparePageNo
==
data
.
pages
[
nIndex2
].
pageNo
)
{
// Set flag to determine page existed
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
existed
=
true
;
// Store detail of page
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageText
=
data
.
pages
[
nIndex2
].
pageText
;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageThumbnail
=
data
.
pages
[
nIndex2
].
pageThumbnail
;
}
else
if
(
BOOKMARK
.
contentTypes
[
contentid
]
==
"none"
&&
data
.
pages
.
length
>
0
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
existed
=
true
;
// Store detail of page
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageText
=
''
;
// data.pages[0].pageText;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageThumbnail
=
BOOKMARK
.
pathImgContentNone
;
// data.pages[nIndex2].pageThumbnail;
}
}
}
},
function
()
{
// when server response error
if
(
BOOKMARK
.
contentTypes
[
contentid
]
==
"none"
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
contentTitle
=
BOOKMARK
.
contentName
[
contentid
];
for
(
var
nIndex2
=
0
;
nIndex2
<
BOOKMARK
.
collection_contents
[
nIndex
].
pages
.
length
;
nIndex2
++
)
{
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
existed
=
true
;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageThumbnail
=
BOOKMARK
.
pathImgContentNone
;
BOOKMARK
.
collection_contents
[
nIndex
].
pages
[
nIndex2
].
pageText
=
''
;
}
}
});
}
};
/*
Build pageNos
*/
*
Build pageNos
*/
BOOKMARK
.
buildPageNos
=
function
(
pages
)
{
var
strResult
=
""
;
for
(
var
nIndex
=
0
;
nIndex
<
pages
.
length
;
nIndex
++
)
{
if
(
strResult
==
""
)
{
strResult
=
""
+
pages
[
nIndex
].
pageNo
;
}
else
{
strResult
+=
","
+
pages
[
nIndex
].
pageNo
;
}
}
return
strResult
;
var
strResult
=
""
;
for
(
var
nIndex
=
0
;
nIndex
<
pages
.
length
;
nIndex
++
)
{
if
(
strResult
==
""
)
{
strResult
=
""
+
pages
[
nIndex
].
pageNo
;
}
else
{
strResult
+=
","
+
pages
[
nIndex
].
pageNo
;
}
}
return
strResult
;
};
/*
Check a content is error or not
*/
* Check a content is error or not
*/
BOOKMARK
.
IsErrorContent
=
function
(
strContentId
)
{
var
isError
=
false
;
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
bookmark_errorContent
.
length
;
nIndex
++
)
{
if
(
strContentId
==
BOOKMARK
.
bookmark_errorContent
[
nIndex
].
contentid
)
{
isError
=
true
;
break
;
}
}
return
isError
;
var
isError
=
false
;
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
bookmark_errorContent
.
length
;
nIndex
++
)
{
if
(
strContentId
==
BOOKMARK
.
bookmark_errorContent
[
nIndex
].
contentid
)
{
isError
=
true
;
break
;
}
}
return
isError
;
};
/*
Check a content is checked + ok
*/
* Check a content is checked + ok
*/
BOOKMARK
.
IsOKCheckedContent
=
function
(
strContentId
)
{
var
isOK
=
false
;
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
collection_contents
.
length
;
nIndex
++
)
{
if
(
strContentId
==
BOOKMARK
.
collection_contents
[
nIndex
].
contentid
)
{
isOK
=
true
;
break
;
}
}
return
isOK
;
var
isOK
=
false
;
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
collection_contents
.
length
;
nIndex
++
)
{
if
(
strContentId
==
BOOKMARK
.
collection_contents
[
nIndex
].
contentid
)
{
isOK
=
true
;
break
;
}
}
return
isOK
;
};
// Add OK checked content
BOOKMARK
.
AddContent
=
function
(
strContentId
,
contentType
)
{
var
isFound
=
false
;
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
collection_contents
.
length
;
nIndex
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex
].
contentid
==
strContentId
)
{
isFound
=
true
;
break
;
}
}
// Add to bufer if it does not exist
if
(
!
isFound
)
{
BOOKMARK
.
collection_contents
.
push
({
'contentid'
:
strContentId
,
'contentType'
:
contentType
,
'contentTitle'
:
""
,
'contentTitleKana'
:
""
,
'pages'
:
[]
});
}
var
isFound
=
false
;
for
(
var
nIndex
=
0
;
nIndex
<
BOOKMARK
.
collection_contents
.
length
;
nIndex
++
)
{
if
(
BOOKMARK
.
collection_contents
[
nIndex
].
contentid
==
strContentId
)
{
isFound
=
true
;
break
;
}
}
// Add to bufer if it does not exist
if
(
!
isFound
)
{
BOOKMARK
.
collection_contents
.
push
({
'contentid'
:
strContentId
,
'contentType'
:
contentType
,
'contentTitle'
:
""
,
'contentTitleKana'
:
""
,
'pages'
:
[]
});
}
};
/*
event of changing language
*/
*
event of changing language
*/
function
changeLanguageCallBackFunction
()
{
if
(
I18N
.
getCurrentLanguage
()
!=
COMMON
.
Consts
.
ConstLanguage_Ja
)
{
$
(
"#dspTitleNmKn"
).
hide
();
$
(
"#dspTitleNmKn_Seperate"
).
hide
();
$
(
"#txtTitleNmKnAsc"
).
hide
();
$
(
"#txtTitleNmKnDesc"
).
hide
();
}
else
{
$
(
"#dspTitleNmKn"
).
show
();
$
(
"#dspTitleNmKn_Seperate"
).
show
();
if
(
ClientData
.
sortOpt_searchDivision
()
==
2
)
{
// Kana
HEADER
.
setStatusSort
(
'#dspTitleNmKn'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
}
document
.
title
=
I18N
.
i18nText
(
'dspShiori'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
if
(
I18N
.
getCurrentLanguage
()
!=
COMMON
.
Consts
.
ConstLanguage_Ja
)
{
$
(
"#dspTitleNmKn"
).
hide
();
$
(
"#dspTitleNmKn_Seperate"
).
hide
();
$
(
"#txtTitleNmKnAsc"
).
hide
();
$
(
"#txtTitleNmKnDesc"
).
hide
();
}
else
{
$
(
"#dspTitleNmKn"
).
show
();
$
(
"#dspTitleNmKn_Seperate"
).
show
();
if
(
ClientData
.
sortOpt_searchDivision
()
==
2
)
{
// Kana
HEADER
.
setStatusSort
(
'#dspTitleNmKn'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
}
document
.
title
=
I18N
.
i18nText
(
'dspShiori'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
};
/*
Synchronize bookmark with server
. Check existence of content
-> Delete absence content in local
. Check existence of pages
-> Delete absence pages in local
*/
* Synchronize bookmark with server . Check existence of content -> Delete
* absence content in local
* . Check existence of pages -> Delete absence pages in local
*/
BOOKMARK
.
SyncContent
=
function
()
{
// Reset error contents
// Reset error contents
BOOKMARK
.
bookmark_errorContent
=
[];
// Reset ok checked content
// Reset ok checked content
BOOKMARK
.
collection_contents
=
[];
// Get bookmarks from local storage
var
arrBookmarks
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
arrBookmarks
.
length
-
1
;
nIndex
>=
0
;
nIndex
--
)
{
var
oneBookMark
=
arrBookmarks
[
nIndex
];
// ==================================
// Check existence of content [start]
// ==================================
if
(
BOOKMARK
.
IsErrorContent
(
oneBookMark
.
contentid
)
==
false
)
{
// If content is ok + checked
if
(
BOOKMARK
.
IsOKCheckedContent
(
oneBookMark
.
contentid
)
==
false
)
{
if
(
!
BOOKMARK
.
IsExistContent
(
oneBookMark
.
contentid
)[
"isExisted"
])
{
if
(
AVWEB
.
avwHasError
())
{
// System error excepting 404
AVWEB
.
showSystemError
();
return
;
}
else
{
// Add to list of error content
BOOKMARK
.
bookmark_errorContent
.
push
({
contentid
:
oneBookMark
.
contentid
});
// Remove bookmark
arrBookmarks
.
splice
(
nIndex
,
1
);
ClientData
.
isChangedBookmark
(
true
);
}
}
// ==================================
// Check existence of content [ end ]
// ==================================
else
{
// Add nromal content
BOOKMARK
.
AddContent
(
oneBookMark
.
contentid
,
BOOKMARK
.
IsExistContent
(
oneBookMark
.
contentid
)[
"contentType"
]);
}
}
}
else
{
arrBookmarks
.
splice
(
nIndex
,
1
);
ClientData
.
isChangedBookmark
(
true
);
}
}
// Set back to storage
ClientData
.
BookMarkData
(
arrBookmarks
);
// Get bookmarks from local storage
var
arrBookmarks
=
ClientData
.
BookMarkData
();
for
(
var
nIndex
=
arrBookmarks
.
length
-
1
;
nIndex
>=
0
;
nIndex
--
)
{
var
oneBookMark
=
arrBookmarks
[
nIndex
];
// ==================================
// Check existence of content [start]
// ==================================
if
(
BOOKMARK
.
IsErrorContent
(
oneBookMark
.
contentid
)
==
false
)
{
// If content is ok + checked
if
(
BOOKMARK
.
IsOKCheckedContent
(
oneBookMark
.
contentid
)
==
false
)
{
if
(
!
BOOKMARK
.
IsExistContent
(
oneBookMark
.
contentid
)[
"isExisted"
])
{
if
(
AVWEB
.
avwHasError
())
{
// System error excepting 404
AVWEB
.
showSystemError
();
return
;
}
else
{
// Add to list of error content
BOOKMARK
.
bookmark_errorContent
.
push
({
contentid
:
oneBookMark
.
contentid
});
// Remove bookmark
arrBookmarks
.
splice
(
nIndex
,
1
);
ClientData
.
isChangedBookmark
(
true
);
}
}
// ==================================
// Check existence of content [ end ]
// ==================================
else
{
// Add nromal content
BOOKMARK
.
AddContent
(
oneBookMark
.
contentid
,
BOOKMARK
.
IsExistContent
(
oneBookMark
.
contentid
)[
"contentType"
]);
}
}
}
else
{
arrBookmarks
.
splice
(
nIndex
,
1
);
ClientData
.
isChangedBookmark
(
true
);
}
}
// Set back to storage
ClientData
.
BookMarkData
(
arrBookmarks
);
};
/*
Check content whether existed or not
*/
*
Check content whether existed or not
*/
BOOKMARK
.
IsExistContent
=
function
(
strContentId
)
{
var
isExisted
=
false
;
var
contentType
=
''
;
var
result
=
[];
var
params
=
{
sid
:
ClientData
.
userInfo_sid
(),
getType
:
'1'
,
contentId
:
strContentId
};
result
[
"isExisted"
]
=
isExisted
;
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webGetContent"
,
'GET'
,
params
,
function
(
data
)
{
isExisted
=
true
;
contentType
=
data
.
contentData
.
contentType
;
result
[
"isExisted"
]
=
isExisted
;
result
[
"contentType"
]
=
contentType
;
// save content type
BOOKMARK
.
contentTypes
[
strContentId
]
=
contentType
;
BOOKMARK
.
contentName
[
strContentId
]
=
data
.
contentData
.
contentName
;
// save alert message level
LIMIT_ACCESS_CONTENT
.
messageLevel
[
strContentId
]
=
{
alertMessageLevel
:
data
.
contentData
.
alertMessageLevel
,
alertMessage
:
data
.
contentData
.
alertMessage
};
},
function
(
xmlHttpRequest
,
txtStatus
,
errorThrown
)
{
if
(
xmlHttpRequest
.
status
==
404
)
{
isExisted
=
false
;
}
else
{
// Show system error
isExisted
=
true
;
// Mark this flag to prevent bookmarks from deleting
AVWEB
.
showSystemError
();
}
});
return
result
;
};
var
isExisted
=
false
;
var
contentType
=
''
;
var
result
=
[];
var
params
=
{
sid
:
ClientData
.
userInfo_sid
(),
getType
:
'1'
,
contentId
:
strContentId
};
result
[
"isExisted"
]
=
isExisted
;
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webGetContent"
,
'GET'
,
params
,
function
(
data
)
{
isExisted
=
true
;
contentType
=
data
.
contentData
.
contentType
;
result
[
"isExisted"
]
=
isExisted
;
result
[
"contentType"
]
=
contentType
;
// save content type
BOOKMARK
.
contentTypes
[
strContentId
]
=
contentType
;
BOOKMARK
.
contentName
[
strContentId
]
=
data
.
contentData
.
contentName
;
// save alert message level
LIMIT_ACCESS_CONTENT
.
messageLevel
[
strContentId
]
=
{
alertMessageLevel
:
data
.
contentData
.
alertMessageLevel
,
alertMessage
:
data
.
contentData
.
alertMessage
};
},
function
(
xmlHttpRequest
,
txtStatus
,
errorThrown
)
{
if
(
xmlHttpRequest
.
status
==
404
)
{
isExisted
=
false
;
}
else
{
// Show system error
isExisted
=
true
;
// Mark this flag to prevent bookmarks from
// deleting
AVWEB
.
showSystemError
();
}
});
return
result
;
};
/*
----------------------------------------------------------------------------
Setting dialog [ end ]
----------------------------------------------------------------------------
*/
*
----------------------------------------------------------------------------
*
Setting dialog [ end ]
*
----------------------------------------------------------------------------
*/
BOOKMARK
.
showContentView
=
function
(){
//TOPに戻す
BOOKMARK
.
showContentView
=
function
()
{
//
TOPに戻す
var
y
=
0
;
if
(
document
.
documentElement
.
scrollTop
)
{
if
(
document
.
documentElement
.
scrollTop
)
{
y
=
document
.
documentElement
.
scrollTop
;
}
if
(
document
.
body
.
scrollTop
)
{
if
(
y
==
undefined
||
y
==
0
)
{
if
(
document
.
body
.
scrollTop
)
{
if
(
y
==
undefined
||
y
==
0
)
{
y
=
document
.
body
.
scrollTop
;
}
}
if
(
y
==
undefined
||
y
==
null
)
{
if
(
y
==
undefined
||
y
==
null
)
{
y
=
0
;
}
BOOKMARK
.
scrollTop
=
y
;
window
.
scrollTo
(
0
,
0
);
//試験
$
(
"#header-ws"
).
hide
();
$
(
"#ws-body"
).
hide
();
$
(
"#topcontrol"
).
hide
();
CONTENTVIEW_INITOBJECT
.
clearViewerComponent
();
CONTENTVIEW
.
cssInit
();
$
(
"#viewer"
).
show
();
window
.
scrollTo
(
0
,
0
);
//
試験
$
(
"#header-ws"
).
hide
();
$
(
"#ws-body"
).
hide
();
$
(
"#topcontrol"
).
hide
();
CONTENTVIEW_INITOBJECT
.
clearViewerComponent
();
CONTENTVIEW
.
cssInit
();
$
(
"#viewer"
).
show
();
CONTENTVIEW
.
ready
();
};
BOOKMARK
.
cssInit
=
function
(){
BOOKMARK
.
cssInit
=
function
()
{
$
(
'html'
).
css
({
'overflow-y'
:
'scroll'
});
'overflow-y'
:
'scroll'
});
$
(
'html,body'
).
css
({
'height'
:
'100%'
,
'margin'
:
'0'
,
'padding'
:
'0'
});
'height'
:
'100%'
,
'margin'
:
'0'
,
'padding'
:
'0'
});
$
(
'html>body'
).
css
({
'font-size'
:
'16px'
,
'font-size'
:
'68.75%'
});
'font-size'
:
'16px'
,
'font-size'
:
'68.75%'
});
$
(
'body'
).
css
({
'font-family'
:
'Verdana, helvetica, arial, sans-serif'
,
'font-size'
:
'68.75%'
,
'background'
:
'#fff'
,
'color'
:
'#333'
});
'font-family'
:
'Verdana, helvetica, arial, sans-serif'
,
'font-size'
:
'68.75%'
,
'background'
:
'#fff'
,
'color'
:
'#333'
});
};
BOOKMARK
.
downloadFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
//Download content
HEADER
.
downloadResourceById
(
contentId
);
};
if
(
e
)
{
e
.
preventDefault
();
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// Download content
HEADER
.
downloadResourceById
(
contentId
);
};
abvw/js/contentsearch.js
View file @
852e7c32
//名前空間用のオブジェクトを用意する
var
CONTENTSEARCH
=
{};
//Start Declare Variables
//
----Constant-----------//
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
=
1
;
//CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_TO = 15;
//
Start Declare Variables
//
----Constant-----------//
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
=
0
;
//
CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_TO = 15;
CONTENTSEARCH
.
DEFAULT_SORT_TYPE
=
'1'
;
CONTENTSEARCH
.
DEFAULT_SORT_ORDER
=
'1'
;
//CONTENTSEARCH.DEFAULT_SEARCH_DIVISION = 0;
//
CONTENTSEARCH.DEFAULT_SEARCH_DIVISION = 0;
CONTENTSEARCH
.
iNumberOfNextRecord
=
15
;
//Thumbnail array
//
Thumbnail array
CONTENTSEARCH
.
thumbnailArr
=
[];
//Content type array.
//
Content type array.
CONTENTSEARCH
.
contentTypeArr
=
[];
CONTENTSEARCH
.
contentIdArray
=
[];
...
...
@@ -22,227 +21,236 @@ CONTENTSEARCH.chkSearchTextEmpty = false;
CONTENTSEARCH
.
noRecordFlg
=
false
;
CONTENTSEARCH
.
home_isMove
=
false
;
//スクロール復帰
//
スクロール復帰
CONTENTSEARCH
.
scrollTop
=
0
;
$
(
document
).
ready
(
function
(){
if
(
!
AVWEB
.
avwCheckLogin
(
COMMON
.
ScreenIds
.
Login
))
{
return
;
}
//
ソート条件デフォルト設定
if
(
AVWEB
.
avwSysSetting
().
sortTypeSearch
!=
undefined
)
{
$
(
document
).
ready
(
function
()
{
if
(
!
AVWEB
.
avwCheckLogin
(
COMMON
.
ScreenIds
.
Login
))
{
return
;
}
//
ソート条件デフォルト設定
if
(
AVWEB
.
avwSysSetting
().
sortTypeSearch
!=
undefined
)
{
CONTENTSEARCH
.
DEFAULT_SORT_TYPE
=
AVWEB
.
avwSysSetting
().
sortTypeSearch
;
}
if
(
AVWEB
.
avwSysSetting
().
sortOrderSearch
!=
undefined
)
{
if
(
AVWEB
.
avwSysSetting
().
sortOrderSearch
!=
undefined
)
{
CONTENTSEARCH
.
DEFAULT_SORT_ORDER
=
AVWEB
.
avwSysSetting
().
sortOrderSearch
;
}
COMMON
.
LockScreen
();
document
.
title
=
I18N
.
i18nText
(
'txtSearchResult'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
// Set bookmark screen
ClientData
.
BookmarkScreen
(
COMMON
.
ScreenIds
.
ContentSearch
);
COMMON
.
LockScreen
();
document
.
title
=
I18N
.
i18nText
(
'txtSearchResult'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
// Set bookmark screen
ClientData
.
BookmarkScreen
(
COMMON
.
ScreenIds
.
ContentSearch
);
//Check if Force Change password
if
(
ClientData
.
requirePasswordChange
()
!=
1
)
{
//Format text display more record
//
Check if Force Change password
if
(
ClientData
.
requirePasswordChange
()
!=
1
)
{
//
Format text display more record
CONTENTSEARCH
.
formatDisplayMoreRecord
();
//
remove hover effect when is touch device
//
remove hover effect when is touch device
CONTENTSEARCH
.
removeHoverCss
();
//InitScreen
CONTENTSEARCH
.
initialScreen
();
//Render Grid
CONTENTSEARCH
.
renderGridView
();
//Go To Details Page
$
(
'#main-ws canvas'
).
live
(
'click'
,
CONTENTSEARCH
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchend'
,
CONTENTSEARCH
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
//Open dialog
// InitScreen
CONTENTSEARCH
.
initialScreen
();
// Render Grid
CONTENTSEARCH
.
renderGridView
();
// Go To Details Page
$
(
'#main-ws canvas'
).
live
(
'click'
,
CONTENTSEARCH
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchend'
,
CONTENTSEARCH
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
// Open dialog
$
(
'.dialog'
).
live
(
'click'
,
CONTENTSEARCH
.
titleClickFunction
);
//$('.dialog').live('touchstart', CONTENTSEARCH.titleClickFunction);
$
(
'.dialog'
).
live
(
'touchend'
,
CONTENTSEARCH
.
titleClickFunction
);
$
(
'.dialog'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
//Show Next Record
$
(
'a#control-nextrecord'
).
click
(
CONTENTSEARCH
.
showNextRecordFunction
);
//Sort Title
$
(
'#control-sort-title'
).
click
(
CONTENTSEARCH
.
sortByTitleFunction
);
//Sort by title kana
$
(
'#control-sort-titlekana'
).
click
(
CONTENTSEARCH
.
sortByTitleKanaFunction
);
//sort by release date
$
(
'#control-sort-releasedate'
).
click
(
CONTENTSEARCH
.
sortByReleaseDateFunction
);
//Go To Details Page
// $('.dialog').live('touchstart', CONTENTSEARCH.titleClickFunction);
$
(
'.dialog'
).
live
(
'touchend'
,
CONTENTSEARCH
.
titleClickFunction
);
$
(
'.dialog'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
// Show Next Record
$
(
'a#control-nextrecord'
).
click
(
CONTENTSEARCH
.
showNextRecordFunction
);
// Sort Title
$
(
'#control-sort-title'
).
click
(
CONTENTSEARCH
.
sortByTitleFunction
);
// Sort by title kana
$
(
'#control-sort-titlekana'
).
click
(
CONTENTSEARCH
.
sortByTitleKanaFunction
);
// sort by release date
$
(
'#control-sort-releasedate'
).
click
(
CONTENTSEARCH
.
sortByReleaseDateFunction
);
// Go To Details Page
$
(
'.button-details'
).
live
(
'click'
,
CONTENTSEARCH
.
readSubmenuFunction
);
//$('.button-details').live('touchstart', CONTENTSEARCH.readSubmenuFunction);
$
(
'.button-details'
).
live
(
'touchend'
,
CONTENTSEARCH
.
readSubmenuFunction
);
$
(
'.button-details'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
//Show Share Dialog
// $('.button-details').live('touchstart',
// CONTENTSEARCH.readSubmenuFunction);
$
(
'.button-details'
).
live
(
'touchend'
,
CONTENTSEARCH
.
readSubmenuFunction
);
$
(
'.button-details'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
// Show Share Dialog
$
(
'.button-share'
).
live
(
'click'
,
CONTENTSEARCH
.
showContentShareDlgFunction
);
$
(
'.button-share'
).
live
(
'touchend'
,
CONTENTSEARCH
.
showContentShareDlgFunction
);
$
(
'.button-share'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
$
(
'.button-share'
).
live
(
'touchmove'
,
function
()
{
CONTENTSEARCH
.
home_isMove
=
true
;
});
$
(
'#main-search'
).
click
(
CONTENTSEARCH
.
searchEventButtonFunction
);
$
(
'#txtSearchWs'
).
keydown
(
CONTENTSEARCH
.
mainSearchKeyDownFunction
);
$
(
'#main-search-content'
).
click
(
CONTENTSEARCH
.
mainSearchContentClickFunction
);
$
(
'#main-search-tag'
).
click
(
CONTENTSEARCH
.
mainSearchTagClickFunction
);
$
(
'#main-search-body'
).
click
(
CONTENTSEARCH
.
mainSearchBodyClickFunction
);
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
$
(
window
).
resize
(
function
()
{
if
(
$
(
"#contentDetail"
).
css
(
"display"
)
!=
"none"
)
{
// Refresh panel of detail to center.
$
(
"#contentDetail"
).
center
();
if
(
$
(
"#contentDetail"
).
height
()
>
$
(
window
).
height
())
{
$
(
window
).
resize
(
function
()
{
if
(
$
(
"#contentDetail"
).
css
(
"display"
)
!=
"none"
)
{
// Refresh panel of detail to center.
$
(
"#contentDetail"
).
center
();
if
(
$
(
"#contentDetail"
).
height
()
>
$
(
window
).
height
())
{
$
(
"#contentDetail"
).
css
(
'top'
,
'0'
);
}
}
}
});
}
else
{
//Check if Force Change password
}
else
{
//
Check if Force Change password
HEADER
.
checkForceChangePassword
();
}
if
(
COMMON
.
isAnonymousLogin
())
{
//プッシュメッセージ隠す
//
プッシュメッセージ隠す
$
(
'#dspPushMessage'
).
hide
();
}
else
{
//プッシュメッセージ判定
if
(
ClientData
.
serviceOpt_apns
()
==
'Y'
||
ClientData
.
serviceOpt_usable_push_message
()
==
'Y'
)
{
//プッシュメッセージ表示
//
プッシュメッセージ判定
if
(
ClientData
.
serviceOpt_apns
()
==
'Y'
||
ClientData
.
serviceOpt_usable_push_message
()
==
'Y'
)
{
//
プッシュメッセージ表示
$
(
'#dspPushMessage'
).
show
();
}
else
{
$
(
'#dspPushMessage'
).
hide
();
}
else
{
$
(
'#dspPushMessage'
).
hide
();
}
}
//詳細、共有表示パーツ読み込み
$
(
"#inc_detail"
).
load
(
"./inc_detail.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
){
//読み込み完了時の処理
I18N
.
i18nReplaceText
();
$
(
'.datepicker'
).
pickadate
({
format
:
'yyyy-mm-dd'
});
});
//ビューア、共有表示パーツ読み込み
$
(
"#viewer"
).
load
(
"./inc_contentview.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
){
//読み込み完了時の処理
I18N
.
i18nReplaceText
();
});
});
CONTENTSEARCH
.
mainSearchBodyClickFunction
=
function
(){
$
(
'#main-body'
).
attr
(
'checked'
,
'checked'
);
// 詳細、共有表示パーツ読み込み
$
(
"#inc_detail"
).
load
(
"./inc_detail.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
)
{
// 読み込み完了時の処理
I18N
.
i18nReplaceText
();
$
(
'.datepicker'
).
pickadate
({
format
:
'yyyy-mm-dd'
});
});
// ビューア、共有表示パーツ読み込み
$
(
"#viewer"
).
load
(
"./inc_contentview.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
)
{
// 読み込み完了時の処理
I18N
.
i18nReplaceText
();
});
});
CONTENTSEARCH
.
mainSearchBodyClickFunction
=
function
()
{
$
(
'#main-body'
).
attr
(
'checked'
,
'checked'
);
$
(
'#main-tag'
).
removeAttr
(
'checked'
);
$
(
'#main-content'
).
removeAttr
(
'checked'
);
};
CONTENTSEARCH
.
mainSearchTagClickFunction
=
function
(){
$
(
'#main-tag'
).
attr
(
'checked'
,
'checked'
);
CONTENTSEARCH
.
mainSearchTagClickFunction
=
function
()
{
$
(
'#main-tag'
).
attr
(
'checked'
,
'checked'
);
$
(
'#main-body'
).
removeAttr
(
'checked'
);
$
(
'#main-content'
).
removeAttr
(
'checked'
);
};
CONTENTSEARCH
.
mainSearchContentClickFunction
=
function
(){
$
(
'#main-content'
).
attr
(
'checked'
,
'checked'
);
CONTENTSEARCH
.
mainSearchContentClickFunction
=
function
()
{
$
(
'#main-content'
).
attr
(
'checked'
,
'checked'
);
$
(
'#main-tag'
).
removeAttr
(
'checked'
);
$
(
'#main-body'
).
removeAttr
(
'checked'
);
};
CONTENTSEARCH
.
mainSearchKeyDownFunction
=
function
(
e
){
var
code
=
(
e
.
keyCode
?
e
.
keyCode
:
e
.
which
);
if
(
code
==
13
)
{
//
Enter keycode
$
(
'#main-search'
).
click
();
}
CONTENTSEARCH
.
mainSearchKeyDownFunction
=
function
(
e
)
{
var
code
=
(
e
.
keyCode
?
e
.
keyCode
:
e
.
which
);
if
(
code
==
13
)
{
//
Enter keycode
$
(
'#main-search'
).
click
();
}
};
//Call API
CONTENTSEARCH
.
abapi
=
function
(
name
,
param
,
method
,
callback
){
//
Call API
CONTENTSEARCH
.
abapi
=
function
(
name
,
param
,
method
,
callback
)
{
AVWEB
.
avwCmsApi
(
ClientData
.
userInfo_accountPath
(),
name
,
method
,
param
,
callback
,
null
);
};
//
Initial screen
CONTENTSEARCH
.
initialScreen
=
function
(){
//
Initial screen
CONTENTSEARCH
.
initialScreen
=
function
()
{
var
searchText
=
ClientData
.
searchCond_searchText
();
var
searchDivision
=
ClientData
.
searchCond_searchDivision
();
$
(
'#txtSearchWs'
).
val
(
searchText
);
//ClientData.searchCond_searchText('');
if
(
searchDivision
==
1
){
$
(
'#main-tag'
).
attr
(
'checked'
,
false
);
$
(
'#main-body'
).
attr
(
'checked'
,
false
);
$
(
'#main-content'
).
attr
(
'checked'
,
'checked'
);
}
else
if
(
searchDivision
==
2
){
$
(
'#main-content'
).
attr
(
'checked'
,
false
);
$
(
'#main-body'
).
attr
(
'checked'
,
false
);
$
(
'#main-tag'
).
attr
(
'checked'
,
'checked'
);
}
else
{
$
(
'#main-content'
).
attr
(
'checked'
,
false
);
$
(
'#main-tag'
).
attr
(
'checked'
,
false
);
$
(
'#main-body'
).
attr
(
'checked'
,
'checked'
);
// ClientData.searchCond_searchText('');
if
(
searchDivision
==
1
)
{
$
(
'#main-tag'
).
attr
(
'checked'
,
false
);
$
(
'#main-body'
).
attr
(
'checked'
,
false
);
$
(
'#main-content'
).
attr
(
'checked'
,
'checked'
);
}
else
if
(
searchDivision
==
2
)
{
$
(
'#main-content'
).
attr
(
'checked'
,
false
);
$
(
'#main-body'
).
attr
(
'checked'
,
false
);
$
(
'#main-tag'
).
attr
(
'checked'
,
'checked'
);
}
else
{
$
(
'#main-content'
).
attr
(
'checked'
,
false
);
$
(
'#main-tag'
).
attr
(
'checked'
,
false
);
$
(
'#main-body'
).
attr
(
'checked'
,
'checked'
);
}
CONTENTSEARCH
.
handleLanguage
();
};
//
/Render Content
CONTENTSEARCH
.
renderContent
=
function
(
id
,
text
,
division
,
type
,
order
,
from
,
to
,
cateid
,
grpid
)
{
//
/Render Content
CONTENTSEARCH
.
renderContent
=
function
(
id
,
text
,
division
,
type
,
order
,
offset
,
limit
,
cateid
,
grpid
)
{
var
params
=
{
sid
:
id
,
searchText
:
text
,
searchDivision
:
division
,
sortType
:
type
,
sortOrder
:
order
,
recordFrom
:
from
,
recordTo
:
to
,
genreId
:
cateid
,
groupId
:
grpid
sid
:
id
,
searchText
:
text
,
searchDivision
:
division
,
sortType
:
type
,
sortOrder
:
order
,
recordFrom
:
offset
,
recordTo
:
limit
,
genreId
:
cateid
,
groupId
:
grpid
};
CONTENTSEARCH
.
abapi
(
'webContentList'
,
params
,
'POST'
,
function
(
data
)
{
$
.
each
(
data
.
contentList
,
function
(
i
,
post
)
{
var
outputDate
=
""
;
if
(
post
.
contentDeliveryDate
!=
null
&&
post
.
contentDeliveryDate
!=
undefined
&&
post
.
contentDeliveryDate
!=
'undefined'
)
{
outputDate
=
COMMON
.
formatDeliveryDate
(
post
.
contentDeliveryDate
);
CONTENTSEARCH
.
abapi
(
'webContentList'
,
params
,
'POST'
,
function
(
data
)
{
var
versionArr
=
ClientData
.
ResourceVersion
();
var
metaArr
=
ClientData
.
MetaVersion
();
var
readArr
=
ClientData
.
ReadingContentIds
();
$
.
each
(
data
.
contentList
,
function
(
i
,
post
)
{
var
outputDate
=
""
;
if
(
post
.
contentDeliveryDate
!=
null
&&
post
.
contentDeliveryDate
!=
undefined
&&
post
.
contentDeliveryDate
!=
'undefined'
)
{
outputDate
=
COMMON
.
formatDeliveryDate
(
post
.
contentDeliveryDate
);
}
var
htmlTemp
=
'<section class="sectionsearchlist">'
var
htmlTemp
=
'<section class="sectionsearchlist">'
+
' <div class="cnt_section_list">'
+
' <a class="img">'
+
' <canvas height="110" width="150" id="content-thumbnail'
+
post
.
contentId
+
'" contentid="'
+
post
.
contentId
+
'" style="display:none;">'
+
' </canvas>'
+
' <img id="loadingIcon'
+
post
.
contentId
+
'" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
+
' <img id="loadingIcon'
+
post
.
contentId
+
'" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
+
' </a>'
+
' <div class="text">'
+
' <a id="title'
+
post
.
contentId
+
'" class="name dialog" contentid="'
+
post
.
contentId
+
'" title="'
+
COMMON
.
htmlEncode
(
post
.
contentTitle
)
+
'" >'
+
' <img class="listIcon" src="'
+
HEADER
.
getIconTypeContent
(
post
.
contentType
)
+
'" width="20" height="20">'
+
' <img class="listIcon" src="'
+
HEADER
.
getIconTypeContent
(
post
.
contentType
)
+
'" width="20" height="20">'
+
' <div class="content-list">'
+
COMMON
.
htmlEncode
(
post
.
contentTitle
)
+
'</div>'
+
' </a>'
+
' <div class="info">'
...
...
@@ -259,96 +267,108 @@ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to
+
' </div>'
+
' </div>'
+
'</section>'
;
var
shareHtml
=
""
;
if
(
post
.
readerShare
==
'1'
)
{
shareHtml
=
'<li><a class="read lang button-share" contentid="'
+
post
.
contentId
+
'" lang="txtShare">共有</a></li>'
;
if
(
post
.
readerShare
==
'1'
)
{
shareHtml
=
'<li><a class="read lang button-share" contentid="'
+
post
.
contentId
+
'" lang="txtShare">共有</a></li>'
;
}
htmlTemp
=
htmlTemp
.
replace
(
/
\{
share
\}
/g
,
shareHtml
);
$
(
'#content-grid'
).
append
(
htmlTemp
);
CONTENTSEARCH
.
getNextRecordNumForList
();
//assign thumbnail to array
var
formatThumbnail
=
post
.
contentThumbnail
;
if
((
formatThumbnail
!=
null
)
&&
(
formatThumbnail
!=
'undefined'
)
&&
(
formatThumbnail
!=
''
)){
formatThumbnail
=
COMMON
.
formatStringBase64
(
formatThumbnail
);
}
CONTENTSEARCH
.
thumbnailArr
.
push
({
contentId
:
post
.
contentId
,
thumbnail
:
formatThumbnail
});
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//assign content type to array
CONTENTSEARCH
.
contentTypeArr
.
push
({
contentId
:
post
.
contentId
,
contentType
:
post
.
contentType
});
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
$
(
'#content-grid'
).
append
(
htmlTemp
);
// save alert message level
LIMIT_ACCESS_CONTENT
.
messageLevel
[
post
.
contentId
]
=
{
alertMessageLevel
:
post
.
alertMessageLevel
,
alertMessage
:
post
.
alertMessage
};
CONTENTSEARCH
.
getNextRecordNumForList
();
//Check if user has read this content or not.
CONTENTSEARCH
.
checkUserHasReadContent
(
post
.
contentId
,
post
.
resourceVersion
,
post
.
metaVersion
);
// assign thumbnail to array
var
formatThumbnail
=
post
.
contentThumbnail
;
if
((
formatThumbnail
!=
null
)
&&
(
formatThumbnail
!=
'undefined'
)
&&
(
formatThumbnail
!=
''
))
{
formatThumbnail
=
COMMON
.
formatStringBase64
(
formatThumbnail
);
}
//assign version to array
COMMON
.
resourceVersionArr
.
push
({
contentid
:
post
.
contentId
,
resourceversion
:
post
.
resourceVersion
});
CONTENTSEARCH
.
thumbnailArr
.
push
({
contentId
:
post
.
contentId
,
thumbnail
:
formatThumbnail
});
// assign content type to array
CONTENTSEARCH
.
contentTypeArr
.
push
({
contentId
:
post
.
contentId
,
contentType
:
post
.
contentType
});
// save alert message level
LIMIT_ACCESS_CONTENT
.
messageLevel
[
post
.
contentId
]
=
{
alertMessageLevel
:
post
.
alertMessageLevel
,
alertMessage
:
post
.
alertMessage
};
// Check if user has read this content or not.
CONTENTSEARCH
.
checkUserHasReadContent
(
post
.
contentId
,
post
.
resourceVersion
,
post
.
metaVersion
,
versionArr
,
metaArr
,
readArr
);
// assign version to array
COMMON
.
resourceVersionArr
.
push
({
contentid
:
post
.
contentId
,
resourceversion
:
post
.
resourceVersion
});
// assign meta version to array
COMMON
.
metaVersionArr
.
push
({
contentid
:
post
.
contentId
,
metaversion
:
post
.
metaVersion
});
// Check if content has marking or memo
CONTENTSEARCH
.
checkContentMarkingMemoOption
(
post
.
contentId
);
// renderViewDate
var
viewdate
=
CONTENTSEARCH
.
renderViewDate
(
post
.
contentId
,
readArr
);
if
(
viewdate
!=
null
||
viewdate
!=
'undefined'
)
{
$
(
'#lblVdate'
+
post
.
contentId
).
html
(
viewdate
);
}
});
//assign meta version to array
COMMON
.
metaVersionArr
.
push
({
contentid
:
post
.
contentId
,
metaversion
:
post
.
metaVersion
}
);
// Get Next record number for list
CONTENTSEARCH
.
getNextRecordNumForList
(
);
//Check if content has marking or memo
CONTENTSEARCH
.
checkContentMarkingMemoOption
(
post
.
contentId
);
// if (data.totalRecord < data.recordTo) {
// ClientData.searchCond_recordTo(data.totalRecord);
// } else {
// ClientData.searchCond_recordTo(data.recordTo);
// }
// ClientData.searchCond_recordFrom(data.recordFrom);
ClientData
.
searchCond_recordFrom
(
data
.
recordFrom
);
ClientData
.
searchCond_recordTo
(
data
.
recordTo
);
CONTENTSEARCH
.
totalPage
=
data
.
totalRecord
;
// Render Page number
if
(
CONTENTSEARCH
.
totalPage
==
0
)
{
CONTENTSEARCH
.
reRenderPageNumber
(
CONTENTSEARCH
.
totalPage
,
CONTENTSEARCH
.
totalPage
);
}
else
{
CONTENTSEARCH
.
reRenderPageNumber
(
ClientData
.
searchCond_recordTo
(),
CONTENTSEARCH
.
totalPage
);
}
//renderViewDate
var
viewdate
=
CONTENTSEARCH
.
renderViewDate
(
post
.
contentId
);
if
(
viewdate
!=
null
||
viewdate
!=
'undefined'
)
{
$
(
'#lblVdate'
+
post
.
contentId
).
html
(
viewdate
);
}
});
// Toggle scroll to top Control
CONTENTSEARCH
.
handleBackToTop
();
//Get Next record number for list
CONTENTSEARCH
.
getNextRecordNumForList
();
if
(
data
.
totalRecord
<
data
.
recordTo
){
ClientData
.
searchCond_recordTo
(
data
.
totalRecord
);
}
else
{
ClientData
.
searchCond_recordTo
(
data
.
recordTo
);
}
ClientData
.
searchCond_recordFrom
(
data
.
recordFrom
);
CONTENTSEARCH
.
totalPage
=
data
.
totalRecord
;
//Render Page number
if
(
CONTENTSEARCH
.
totalPage
==
0
){
CONTENTSEARCH
.
reRenderPageNumber
(
CONTENTSEARCH
.
totalPage
,
CONTENTSEARCH
.
totalPage
);
}
else
{
CONTENTSEARCH
.
reRenderPageNumber
(
ClientData
.
searchCond_recordTo
(),
CONTENTSEARCH
.
totalPage
);
}
//Toggle scroll to top Control
CONTENTSEARCH
.
handleBackToTop
();
//I18N.changeLanguage(ClientData.userInfo_language());
I18N
.
i18nReplaceText
();
// I18N.changeLanguage(ClientData.userInfo_language());
I18N
.
i18nReplaceText
();
});
};
//Handle Back To Top Button
CONTENTSEARCH
.
handleBackToTop
=
function
(){
if
(
ClientData
.
searchCond_recordTo
()
>=
CONTENTSEARCH
.
totalPage
){
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
}
else
{
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'visible'
);
// Handle Back To Top Button
CONTENTSEARCH
.
handleBackToTop
=
function
()
{
if
(
ClientData
.
searchCond_recordTo
()
>=
CONTENTSEARCH
.
totalPage
)
{
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
}
else
{
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'visible'
);
}
if
(
CONTENTSEARCH
.
totalPage
==
0
)
{
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
if
(
CONTENTSEARCH
.
totalPage
==
0
)
{
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
CONTENTSEARCH
.
displayResultNoRecord
();
CONTENTSEARCH
.
noRecordFlg
=
true
;
}
else
{
$
(
'#msgSearchNotExist'
).
hide
();
}
else
{
$
(
'#msgSearchNotExist'
).
hide
();
$
(
'#content-grid'
).
removeClass
(
'lang'
);
$
(
'#content-grid'
).
removeAttr
(
'lang'
);
CONTENTSEARCH
.
enableSort
();
...
...
@@ -356,35 +376,33 @@ CONTENTSEARCH.handleBackToTop = function(){
}
};
//Handle language
CONTENTSEARCH
.
handleLanguage
=
function
(){
//
Handle language
CONTENTSEARCH
.
handleLanguage
=
function
()
{
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'none'
);
$
(
'#separate'
).
css
(
'display'
,
'none'
);
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'none'
);
$
(
'#separate'
).
css
(
'display'
,
'none'
);
$
(
"#titlekana-sorttype"
).
html
(
''
);
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
||
ClientData
.
searchCond_sortType
()
!=
''
)
{
var
typeSort
=
ClientData
.
searchCond_sortType
();
var
orderSort
=
ClientData
.
searchCond_sortOrder
();
HEADER
.
setStatusSort
(
'#'
+
$
(
'#menu_sort li.current a'
).
attr
(
'id'
),
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
if
(
CONTENTSEARCH
.
noRecordFlg
){
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
}
else
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
||
ClientData
.
searchCond_sortType
()
!=
''
)
{
var
typeSort
=
ClientData
.
searchCond_sortType
();
var
orderSort
=
ClientData
.
searchCond_sortOrder
();
HEADER
.
setStatusSort
(
'#'
+
$
(
'#menu_sort li.current a'
).
attr
(
'id'
),
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
}
if
(
CONTENTSEARCH
.
noRecordFlg
)
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
}
else
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
}
}
};
//Initial Screen
CONTENTSEARCH
.
renderGridView
=
function
(){
//
Initial Screen
CONTENTSEARCH
.
renderGridView
=
function
()
{
var
fromPage
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
var
toPage
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
var
sortType
=
CONTENTSEARCH
.
DEFAULT_SORT_TYPE
;
...
...
@@ -392,142 +410,134 @@ CONTENTSEARCH.renderGridView = function(){
var
searchText
=
ClientData
.
searchCond_searchText
();
var
searchDivision
=
ClientData
.
searchCond_searchDivision
();
var
sid
=
ClientData
.
userInfo_sid
();
ClientData
.
searchCond_recordFrom
(
fromPage
);
ClientData
.
searchCond_recordTo
(
toPage
);
var
offsetPage
=
0
;
//CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var
limitPage
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
ClientData
.
searchCond_recordFrom
(
0
);
ClientData
.
searchCond_recordTo
(
0
);
ClientData
.
searchCond_sortType
(
sortType
);
ClientData
.
searchCond_sortOrder
(
sortOrder
);
ClientData
.
searchCond_searchDivision
(
searchDivision
);
ClientData
.
searchCond_genreId
(
''
);
ClientData
.
searchCond_groupId
(
''
);
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
//Handle display sort
//
Handle display sort
CONTENTSEARCH
.
handleSortDisp
();
//Language Handle
//
Language Handle
CONTENTSEARCH
.
handleLanguage
();
//Refresh GridView
//
Refresh GridView
CONTENTSEARCH
.
refreshGrid
();
//if(searchText == '' || searchText == null){
// CONTENTSEARCH.displayResultNoRecord();
// CONTENTSEARCH.chkSearchTextEmpty = true;
// CONTENTSEARCH.noRecordFlg = true;
// CONTENTSEARCH.reRenderPageNumber(0, 0);
//}
//else {
$
(
'#msgSearchNotExist'
).
hide
();
CONTENTSEARCH
.
chkSearchTextEmpty
=
false
;
//Render Gridview
CONTENTSEARCH
.
renderContent
(
sid
,
searchText
,
searchDivision
,
sortType
,
sortOrder
,
fromPage
,
toPage
,
genreId
,
groupId
);
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'visible'
);
//}
// Render Gridview
CONTENTSEARCH
.
renderContent
(
sid
,
searchText
,
searchDivision
,
sortType
,
sortOrder
,
offsetPage
,
limitPage
,
genreId
,
groupId
);
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'visible'
);
};
//
Canvas Click function
CONTENTSEARCH
.
canvasClickFunction
=
function
(
e
){
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
//
Canvas Click function
CONTENTSEARCH
.
canvasClickFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'id'
);
var
outputId
=
contentId
.
substring
(
17
);
var
checkflag
=
false
;
// Set content id for screen: content detail
// Set content id for screen: content detail
ClientData
.
contentInfo_contentId
(
outputId
);
// Get image of selected image
var
base64String
=
CONTENTSEARCH
.
returnThumbnail
(
outputId
);
ClientData
.
contentInfo_contentThumbnail
(
base64String
);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
outputId
);
ClientData
.
contentInfo_contentType
(
contentType
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
//Store Content id that user has read
if
(
ClientData
.
ReadingContentIds
().
length
>
0
){
CONTENTSEARCH
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
for
(
var
nIndex
=
0
;
nIndex
<
CONTENTSEARCH
.
contentIdArray
.
length
;
nIndex
++
){
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
contentid
==
outputId
){
// Store Content id that user has read
CONTENTSEARCH
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
if
(
CONTENTSEARCH
.
contentIdArray
.
length
>
0
)
{
for
(
var
nIndex
=
0
;
nIndex
<
CONTENTSEARCH
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
contentid
==
outputId
)
{
checkflag
=
true
;
break
;
}
else
{
}
else
{
checkflag
=
false
;
}
}
}
if
(
!
checkflag
){
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
if
(
!
checkflag
)
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
}
}
else
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
}
else
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
}
//Renew ReadingContentID
// Renew ReadingContentID
var
newArray
=
[];
ClientData
.
ReadingContentIds
(
newArray
);
//Set data for readingcontentid
// Set data for readingcontentid
ClientData
.
ReadingContentIds
(
CONTENTSEARCH
.
contentIdArray
);
//Set ResouceVersion for content
//
Set ResouceVersion for content
COMMON
.
setResourceVersionData
(
outputId
);
//Set MetaVersion for content
//
Set MetaVersion for content
COMMON
.
setMetaVersionData
(
outputId
);
//Close Submenu
//
Close Submenu
$
(
'#dlgSubMenu'
).
hide
();
//Delete 'new' icon
//
Delete 'new' icon
CONTENTSEARCH
.
drawEditImage
(
outputId
);
//Open content Detail
//
Open content Detail
DETAIL
.
openContentDetail
();
};
//Re-render page from and total record
CONTENTSEARCH
.
reRenderPageNumber
=
function
(
dispRecord
,
dispTotal
){
//
Re-render page from and total record
CONTENTSEARCH
.
reRenderPageNumber
=
function
(
dispRecord
,
dispTotal
)
{
if
(
dispTotal
)
{
if
(
dispTotal
)
{
$
(
'#dispPage'
).
html
(
dispRecord
);
$
(
'#totalPage'
).
html
(
dispTotal
);
$
(
'#dispPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'visible'
);
$
(
'#dispPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'visible'
);
}
else
{
$
(
'#dispPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#dispPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
}
};
//Show Next Record Function
CONTENTSEARCH
.
showNextRecordFunction
=
function
(){
var
fromPage
=
ClientData
.
searchCond_recordFrom
();
var
toPage
=
ClientData
.
searchCond_recordTo
();
//
Show Next Record Function
CONTENTSEARCH
.
showNextRecordFunction
=
function
()
{
//
var fromPage = ClientData.searchCond_recordFrom();
//
var toPage = ClientData.searchCond_recordTo();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
searchText
=
ClientData
.
searchCond_searchText
();
...
...
@@ -535,578 +545,592 @@ CONTENTSEARCH.showNextRecordFunction = function(){
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
var
sid
=
ClientData
.
userInfo_sid
();
var
totalrecord
=
CONTENTSEARCH
.
totalPage
;
if
(
fromPage
==
null
||
fromPage
==
'undefined'
){
fromPage
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
}
if
(
toPage
==
null
||
toPage
==
'undefined'
){
toPage
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
}
fromPage
=
eval
(
toPage
)
+
1
;
var
iRecordNumber
=
eval
(
totalrecord
)
-
eval
(
fromPage
);
if
(
iRecordNumber
<
CONTENTSEARCH
.
iNumberOfNextRecord
)
{
toPage
=
eval
(
fromPage
)
+
eval
(
iRecordNumber
);
}
else
{
toPage
=
eval
(
fromPage
)
+
(
eval
(
CONTENTSEARCH
.
iNumberOfNextRecord
)
-
1
);
var
totalrecord
=
CONTENTSEARCH
.
totalPage
;
// if (fromPage == null || fromPage == 'undefined') {
// fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
// }
// if (toPage == null || toPage == 'undefined') {
// toPage = CONTENTSEARCH.returnNumberDispRecordForList();
// }
var
offsetPage
=
ClientData
.
searchCond_recordTo
();
if
(
offsetPage
==
null
||
offsetPage
==
'undefined'
)
{
offsetPage
=
0
;
}
ClientData
.
searchCond_recordFrom
(
fromPage
);
ClientData
.
searchCond_recordTo
(
toPage
);
var
limitPage
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
// fromPage = eval(toPage) + 1;
// var iRecordNumber = eval(totalrecord) - eval(fromPage);
// if (iRecordNumber < CONTENTSEARCH.iNumberOfNextRecord) {
// toPage = eval(fromPage) + eval(iRecordNumber);
// } else {
// toPage = eval(fromPage) + (eval(CONTENTSEARCH.iNumberOfNextRecord) - 1);
// }
// ClientData.searchCond_recordFrom(fromPage);
// ClientData.searchCond_recordTo(toPage);
if
(
fromPage
<=
totalrecord
)
{
CONTENTSEARCH
.
renderContent
(
sid
,
searchText
,
searchDivision
,
sortType
,
sortOrder
,
fromPage
,
toPage
,
genreId
,
groupId
);
if
(
offsetPage
<=
totalrecord
)
{
CONTENTSEARCH
.
renderContent
(
sid
,
searchText
,
searchDivision
,
sortType
,
sortOrder
,
offsetPage
,
limitPage
,
genreId
,
groupId
);
}
};
//Sort By Title Function
CONTENTSEARCH
.
sortByTitleFunction
=
function
(){
//
Sort By Title Function
CONTENTSEARCH
.
sortByTitleFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sid
=
ClientData
.
userInfo_sid
();
var
recordFrom
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
var
recordTo
=
ClientData
.
searchCond_recordTo
();
//
var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
//
var recordTo = ClientData.searchCond_recordTo();
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'1'
){
var
offset
=
0
;
var
limit
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'1'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
}
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
HEADER
.
setStatusSort
(
'#control-sort-title'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
ClientData
.
searchCond_sortOrder
(
sortOrder
);
if
(
recordFrom
==
null
||
recordFrom
==
'undefined'
){
recordFrom
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
ClientData
.
searchCond_recordFrom
(
recordFrom
);
}
HEADER
.
setStatusSort
(
'#control-sort-title'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
// if (recordFrom == null || recordFrom == 'undefined') {
// recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
// ClientData.searchCond_recordFrom(recordFrom);
// }
// if (recordTo == null || recordTo == 'undefined') {
// recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
// ClientData.searchCond_recordFrom(recordTo);
// }
if
(
recordTo
==
null
||
recordTo
==
'undefined'
){
recordTo
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
ClientData
.
searchCond_recordFrom
(
recordTo
);
}
sortType
=
'1'
;
ClientData
.
searchCond_sortType
(
sortType
);
//refresh Gridview
//
refresh Gridview
CONTENTSEARCH
.
refreshGrid
();
//refresh add more record
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
CONTENTSEARCH
.
renderContent
(
sid
,
ClientData
.
searchCond_searchText
(),
ClientData
.
searchCond_searchDivision
(),
sortType
,
sortOrder
,
recordFrom
,
recordTo
,
genreId
,
groupId
);
//
refresh add more record
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
CONTENTSEARCH
.
renderContent
(
sid
,
ClientData
.
searchCond_searchText
(),
ClientData
.
searchCond_searchDivision
(),
sortType
,
sortOrder
,
offset
,
limit
,
genreId
,
groupId
);
};
//Sort By Title Kana function
CONTENTSEARCH
.
sortByTitleKanaFunction
=
function
(){
//
Sort By Title Kana function
CONTENTSEARCH
.
sortByTitleKanaFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sid
=
ClientData
.
userInfo_sid
();
var
recordFrom
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
var
recordTo
=
ClientData
.
searchCond_recordTo
();
//
var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
//
var recordTo = ClientData.searchCond_recordTo();
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
var
offset
=
0
;
var
limit
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'2'
){
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'2'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
}
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
if
(
recordFrom
==
null
||
recordFrom
==
'undefined'
)
{
recordFrom
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
ClientData
.
searchCond_recordFrom
(
recordFrom
);
}
if
(
recordTo
==
null
||
recordTo
==
'undefined'
){
recordTo
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
// if (recordFrom == null || recordFrom == 'undefined')
{
//
recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
//
ClientData.searchCond_recordFrom(recordFrom);
//
}
// if (recordTo == null || recordTo == 'undefined') {
// recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
// ClientData.searchCond_recordFrom(recordTo);
// }
ClientData
.
searchCond_recordFrom
(
recordTo
);
}
sortType
=
'2'
;
//refresh gridview
//
refresh gridview
CONTENTSEARCH
.
refreshGrid
();
//refresh add more record
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
//
refresh add more record
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
ClientData
.
searchCond_sortType
(
sortType
);
CONTENTSEARCH
.
renderContent
(
sid
,
ClientData
.
searchCond_searchText
(),
ClientData
.
searchCond_searchDivision
(),
sortType
,
sortOrder
,
recordFrom
,
recordTo
,
genreId
,
groupId
);
CONTENTSEARCH
.
renderContent
(
sid
,
ClientData
.
searchCond_searchText
(),
ClientData
.
searchCond_searchDivision
(),
sortType
,
sortOrder
,
offset
,
limit
,
genreId
,
groupId
);
};
//Sort By Release Date
CONTENTSEARCH
.
sortByReleaseDateFunction
=
function
(){
//
Sort By Release Date
CONTENTSEARCH
.
sortByReleaseDateFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sid
=
ClientData
.
userInfo_sid
();
var
recordFrom
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
var
recordTo
=
ClientData
.
searchCond_recordTo
();
//
var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
//
var recordTo = ClientData.searchCond_recordTo();
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'3'
){
var
offset
=
0
;
var
limit
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'3'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
}
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
if
(
recordFrom
==
null
||
recordFrom
==
'undefined'
){
recordFrom
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
ClientData
.
searchCond_recordFrom
(
recordFrom
);
}
if
(
recordTo
==
null
||
recordTo
==
'undefined'
){
recordTo
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
ClientData
.
searchCond_recordFrom
(
recordTo
);
}
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
// if (recordFrom == null || recordFrom == 'undefined') {
// recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
// ClientData.searchCond_recordFrom(recordFrom);
// }
// if (recordTo == null || recordTo == 'undefined') {
// recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
// ClientData.searchCond_recordFrom(recordTo);
// }
sortType
=
'3'
;
//refresh gridview
//
refresh gridview
CONTENTSEARCH
.
refreshGrid
();
//refresh add more record
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
ClientData
.
searchCond_sortType
(
sortType
);
CONTENTSEARCH
.
renderContent
(
sid
,
ClientData
.
searchCond_searchText
(),
ClientData
.
searchCond_searchDivision
(),
sortType
,
sortOrder
,
recordFrom
,
recordTo
,
genreId
,
groupId
);
//
refresh add more record
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
ClientData
.
searchCond_sortType
(
sortType
);
CONTENTSEARCH
.
renderContent
(
sid
,
ClientData
.
searchCond_searchText
(),
ClientData
.
searchCond_searchDivision
(),
sortType
,
sortOrder
,
offset
,
limit
,
genreId
,
groupId
);
};
//Get Thumnail base on contentid
CONTENTSEARCH
.
returnThumbnail
=
function
(
contentid
){
for
(
var
i
=
0
;
i
<
CONTENTSEARCH
.
thumbnailArr
.
length
;
i
++
){
if
(
CONTENTSEARCH
.
thumbnailArr
[
i
].
contentId
==
contentid
){
// Get Thumnail base on contentid
CONTENTSEARCH
.
returnThumbnail
=
function
(
contentid
)
{
for
(
var
i
=
0
;
i
<
CONTENTSEARCH
.
thumbnailArr
.
length
;
i
++
)
{
if
(
CONTENTSEARCH
.
thumbnailArr
[
i
].
contentId
==
contentid
)
{
return
CONTENTSEARCH
.
thumbnailArr
[
i
].
thumbnail
;
}
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content.
//Get content type base on contentid
CONTENTSEARCH
.
returnContentType
=
function
(
contentid
){
//Array Length
var
iArrCnt
=
CONTENTSEARCH
.
contentTypeArr
.
length
;
//Get contentType in array by contentId
for
(
var
i
=
0
;
i
<
iArrCnt
;
i
++
){
if
(
CONTENTSEARCH
.
contentTypeArr
[
i
].
contentId
==
contentid
)
{
return
CONTENTSEARCH
.
contentTypeArr
[
i
].
contentType
;
}
}
// Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary :
// Create new function to return content type of content.
// Get content type base on contentid
CONTENTSEARCH
.
returnContentType
=
function
(
contentid
)
{
// Array Length
var
iArrCnt
=
CONTENTSEARCH
.
contentTypeArr
.
length
;
// Get contentType in array by contentId
for
(
var
i
=
0
;
i
<
iArrCnt
;
i
++
)
{
if
(
CONTENTSEARCH
.
contentTypeArr
[
i
].
contentId
==
contentid
)
{
return
CONTENTSEARCH
.
contentTypeArr
[
i
].
contentType
;
}
}
};
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content.
//Dialog Read Button CLick
CONTENTSEARCH
.
readSubmenuFunction
=
function
(
e
){
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
CONTENTSEARCH
.
readSubmenuFunction_callback
(
contentId
);
},
function
(){
}
);
// End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary :
// Create new function to return content type of content.
// Dialog Read Button CLick
CONTENTSEARCH
.
readSubmenuFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
CONTENTSEARCH
.
readSubmenuFunction_callback
(
contentId
);
},
function
()
{
});
};
// read content callback
CONTENTSEARCH
.
readSubmenuFunction_callback
=
function
(
contentId
)
{
CONTENTSEARCH
.
readSubmenuFunction_callback
=
function
(
contentId
)
{
var
contentThumbnail
=
CONTENTSEARCH
.
returnThumbnail
(
contentId
);
var
date
=
new
Date
();
var
month
=
date
.
getMonth
()
+
1
;
var
month
=
date
.
getMonth
()
+
1
;
var
day
=
date
.
getDate
();
var
outputDate
=
COMMON
.
formatNormalDate
(
day
,
month
,
date
.
getFullYear
());
ClientData
.
contentInfo_contentId
(
contentId
);
ClientData
.
contentInfo_contentThumbnail
(
contentThumbnail
);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
// Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 --
// Summary : Assign content type of content.
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
contentId
);
ClientData
.
contentInfo_contentType
(
contentType
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
ClientData
.
contentInfo_contentType
(
contentType
);
// End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary
// : Assign content type of content.
var
checkflag
=
false
;
//Store Content id that user has read
if
(
ClientData
.
ReadingContentIds
().
length
>
0
){
CONTENTSEARCH
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
for
(
var
nIndex
=
0
;
nIndex
<
CONTENTSEARCH
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
contentid
==
contentId
)
{
//
Store Content id that user has read
CONTENTSEARCH
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
if
(
CONTENTSEARCH
.
contentIdArray
.
length
>
0
)
{
for
(
var
nIndex
=
0
;
nIndex
<
CONTENTSEARCH
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
contentid
==
contentId
)
{
checkflag
=
true
;
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
==
null
||
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
==
'undefined'
||
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
==
''
)
{
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
==
null
||
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
==
'undefined'
||
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
==
''
)
{
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
viewdate
=
outputDate
;
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
originviewdate
=
date
;
}
break
;
}
else
{
}
else
{
checkflag
=
false
;
}
}
}
if
(
!
checkflag
){
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
if
(
!
checkflag
)
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
}
}
else
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
}
else
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
}
//Renew ReadingContentID
// Renew ReadingContentID
var
newArray
=
[];
ClientData
.
ReadingContentIds
(
newArray
);
//Set ResouceVersion for content
// Set ResouceVersion for content
COMMON
.
setResourceVersionData
(
contentId
);
//Set MetaVersion for content
//
Set MetaVersion for content
COMMON
.
setMetaVersionData
(
contentId
);
//Set data for readingcontentid
//
Set data for readingcontentid
ClientData
.
ReadingContentIds
(
CONTENTSEARCH
.
contentIdArray
);
ClientData
.
IsRefresh
(
false
);
//Start Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download.
//For testing without other Type.
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Others
){
//Download content
HEADER
.
downloadResourceById
(
contentId
);
// redraw content remove new icon
CONTENTSEARCH
.
drawEditImage
(
contentId
);
}
else
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Link
){
//link content
HEADER
.
viewLinkContentById
(
contentId
);
// redraw content remove new icon
CONTENTSEARCH
.
drawEditImage
(
contentId
);
}
else
{
//Go to Conten view page
//AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
CONTENTSEARCH
.
drawEditImage
(
contentId
);
CONTENTSEARCH
.
showContentView
();
}
//End Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download.
};
//Check if Content Has marking or memo
CONTENTSEARCH
.
checkContentMarkingMemoOption
=
function
(
contentId
){
//Check if contentid has marking
if
(
ClientData
.
MarkingData
().
length
==
0
){
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
// Start Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 --
// Summary : Check content type other for download.
// For testing without other Type.
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Others
)
{
// Download content
HEADER
.
downloadResourceById
(
contentId
);
// redraw content remove new icon
CONTENTSEARCH
.
drawEditImage
(
contentId
);
}
else
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Link
)
{
// link content
HEADER
.
viewLinkContentById
(
contentId
);
// redraw content remove new icon
CONTENTSEARCH
.
drawEditImage
(
contentId
);
}
else
{
// Go to Conten view page
// AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
CONTENTSEARCH
.
drawEditImage
(
contentId
);
CONTENTSEARCH
.
showContentView
();
}
else
{
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MarkingData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MarkingData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
// End Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary
// : Check content type other for download.
};
// Check if Content Has marking or memo
CONTENTSEARCH
.
checkContentMarkingMemoOption
=
function
(
contentId
)
{
// Check if contentid has marking
if
(
ClientData
.
MarkingData
().
length
==
0
)
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MarkingData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MarkingData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
}
}
if
(
ClientData
.
MemoData
().
length
==
0
){
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
// Check if contentid has memo
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MemoData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MemoData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
}
if
(
ClientData
.
MemoData
().
length
==
0
)
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
// Check if contentid has memo
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MemoData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MemoData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
}
}
};
//Check if User has read content
CONTENTSEARCH
.
checkUserHasReadContent
=
function
(
contId
,
resourceVer
,
metaVer
)
{
var
imgThumb
=
new
Image
();
//imgThumb.src = CONTENTSEARCH.returnThumbnail(contId);
var
imgIconNew
=
new
Image
();
//imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
var
imgIconEdit
=
new
Image
();
//imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
contId
);
var
ctx
=
c
.
getContext
(
'2d'
);
var
readFlg
=
false
;
var
versionArr
=
ClientData
.
ResourceVersion
();
var
metaArr
=
ClientData
.
MetaVersion
();
var
readArr
=
ClientData
.
ReadingContentIds
();
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
var
contentThumbnail
=
CONTENTSEARCH
.
returnThumbnail
(
contId
);
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
contId
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
if
(
readArr
==
null
||
readArr
<=
0
||
readArr
==
'undefined'
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconNew
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
}
else
{
//Check if user has read this content or not
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
ReadingContentIds
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
ReadingContentIds
()[
nIndex1
].
contentid
==
contId
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
readFlg
=
true
;
break
;
}
else
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconNew
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
}
}
}
//Check if resource version has change
if
(
readFlg
)
{
if
(
versionArr
==
null
||
versionArr
<=
0
||
versionArr
==
'undefined'
)
{
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
versionArr
.
length
;
nIndex2
++
)
{
if
(
versionArr
[
nIndex2
].
contentid
==
contId
)
{
if
(
versionArr
[
nIndex2
].
resourceversion
!=
resourceVer
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconEdit
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_EDIT
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
break
;
}
}
}
}
if
(
metaArr
==
null
||
metaArr
<=
0
||
metaArr
==
'undefined'
)
{
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
metaArr
.
length
;
nIndex2
++
)
{
if
(
metaArr
[
nIndex2
].
contentid
==
contId
)
{
if
(
metaArr
[
nIndex2
].
metaversion
!=
metaVer
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconEdit
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_EDIT
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
break
;
}
}
}
}
readFlg
=
false
;
}
// Check if User has read content
CONTENTSEARCH
.
checkUserHasReadContent
=
function
(
contId
,
resourceVer
,
metaVer
,
versionArr
,
metaArr
,
readArr
)
{
var
imgThumb
=
new
Image
();
// imgThumb.src = CONTENTSEARCH.returnThumbnail(contId);
var
imgIconNew
=
new
Image
();
// imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
var
imgIconEdit
=
new
Image
();
// imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
contId
);
var
ctx
=
c
.
getContext
(
'2d'
);
var
readFlg
=
false
;
//var versionArr = ClientData.ResourceVersion();
//var metaArr = ClientData.MetaVersion();
//var readArr = ClientData.ReadingContentIds();
var
contentThumbnail
=
CONTENTSEARCH
.
returnThumbnail
(
contId
);
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
contId
);
if
(
readArr
.
length
<=
0
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconNew
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
// Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 --
// Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
// End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 --
// Summary : Check contentType to set thumbnail.
}
else
{
// Check if user has read this content or not
for
(
var
nIndex1
=
0
;
nIndex1
<
readArr
.
length
;
nIndex1
++
)
{
if
(
readArr
[
nIndex1
].
contentid
==
contId
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
readFlg
=
true
;
break
;
}
else
{
// imgThumb.onload = function() {
// var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
// ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
// imgIconNew.onload = function() {
// ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
// $("#loadingIcon" + contId).fadeOut('slow', function() {
// $('#content-thumbnail' + contId).fadeIn('slow');
// });
// };
// imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
// };
// // Start Function : No.12 -- Editor : Le Long -- Date :
// // 07/31/2013 -- Summary : Check contentType to set thumbnail.
//
// if (contentThumbnail == '' || contentThumbnail == null) {
// if (!COMMON.isPdfContent(contentType)) {
// var src = HEADER.getThumbnailForOtherType(contentType);
// if (src != '') {
// imgThumb.src = src;
// }
// }
// } else {
// imgThumb.src = contentThumbnail;
// }
//
// // End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013
// // -- Summary : Check contentType to set thumbnail.
}
}
}
// Check if resource version has change
if
(
readFlg
)
{
if
(
versionArr
==
null
||
versionArr
<=
0
||
versionArr
==
'undefined'
)
{
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
versionArr
.
length
;
nIndex2
++
)
{
if
(
versionArr
[
nIndex2
].
contentid
==
contId
)
{
if
(
versionArr
[
nIndex2
].
resourceversion
!=
resourceVer
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconEdit
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_EDIT
;
};
// Start Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
// End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break
;
}
}
}
}
if
(
metaArr
==
null
||
metaArr
<=
0
||
metaArr
==
'undefined'
)
{
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
metaArr
.
length
;
nIndex2
++
)
{
if
(
metaArr
[
nIndex2
].
contentid
==
contId
)
{
if
(
metaArr
[
nIndex2
].
metaversion
!=
metaVer
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconEdit
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_EDIT
;
};
// Start Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
// End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break
;
}
}
}
}
//readFlg = false;
}
else
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconNew
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
c
.
height
-
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
contId
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
contId
).
fadeIn
(
'slow'
);
});
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
}
};
//draw Edit Image
//
draw Edit Image
CONTENTSEARCH
.
drawEditImage
=
function
(
id
)
{
var
img
=
new
Image
();
var
imgSrc
=
CONTENTSEARCH
.
returnThumbnail
(
id
);
if
(
imgSrc
!=
null
){
}
else
{
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
id
);
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgSrc
=
src
;
}
}
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
id
);
//use getContext to use the canvas for drawing
var
ctx
=
c
.
getContext
(
'2d'
);
ctx
.
clearRect
(
0
,
0
,
c
.
width
,
c
.
height
);
img
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
img
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
img
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
id
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
id
).
fadeIn
(
'slow'
);
});
};
img
.
src
=
imgSrc
;
var
img
=
new
Image
();
var
imgSrc
=
CONTENTSEARCH
.
returnThumbnail
(
id
);
if
(
imgSrc
!=
null
)
{
}
else
{
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
id
);
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgSrc
=
src
;
}
}
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
id
);
// use getContext to use the canvas for drawing
var
ctx
=
c
.
getContext
(
'2d'
);
ctx
.
clearRect
(
0
,
0
,
c
.
width
,
c
.
height
);
img
.
onload
=
function
()
{
var
resizeImg
=
CONTENTSEARCH
.
resizeResourceThumbnail
(
img
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
img
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
id
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
id
).
fadeIn
(
'slow'
);
});
};
img
.
src
=
imgSrc
;
};
//Search Function
CONTENTSEARCH
.
searchEventButtonFunction
=
function
(){
var
fromPage
=
CONTENTSEARCH
.
DEFAULT_DISP_NUMBER_RECORD_FROM
;
var
toPage
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
//
Search Function
CONTENTSEARCH
.
searchEventButtonFunction
=
function
()
{
//
var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
//
var toPage = CONTENTSEARCH.returnNumberDispRecordForList();
var
sortType
=
CONTENTSEARCH
.
DEFAULT_SORT_TYPE
;
var
sortOrder
=
CONTENTSEARCH
.
DEFAULT_SORT_ORDER
;
var
searchText
=
$
(
'#txtSearchWs'
).
val
();
...
...
@@ -1114,21 +1138,20 @@ CONTENTSEARCH.searchEventButtonFunction = function(){
var
content
=
$
(
'#main-content'
).
attr
(
'checked'
);
var
tag
=
$
(
'#main-tag'
).
attr
(
'checked'
);
var
body
=
$
(
'#main-body'
).
attr
(
'checked'
);
var
offset
=
0
;
var
limit
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
if
(
content
==
'checked'
)
{
if
(
content
==
'checked'
)
{
searchDivision
=
$
(
'#searchbox-content'
).
val
();
}
if
(
tag
==
'checked'
)
{
if
(
tag
==
'checked'
)
{
searchDivision
=
$
(
'#searchbox-tag'
).
val
();
}
if
(
body
==
'checked'
)
{
if
(
body
==
'checked'
)
{
searchDivision
=
$
(
'#searchbox-body'
).
val
();
}
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
var
sid
=
ClientData
.
userInfo_sid
();
...
...
@@ -1136,212 +1159,183 @@ CONTENTSEARCH.searchEventButtonFunction = function(){
ClientData
.
searchCond_sortType
(
sortType
);
ClientData
.
searchCond_searchText
(
searchText
);
ClientData
.
searchCond_searchDivision
(
searchDivision
);
//refresh grid
//
refresh grid
CONTENTSEARCH
.
refreshGrid
();
//Handle display sort
//
Handle display sort
CONTENTSEARCH
.
handleSortDisp
();
//if(searchText == '' || searchText == null){
// CONTENTSEARCH.displayResultNoRecord();
// CONTENTSEARCH.chkSearchTextEmpty = true;
// CONTENTSEARCH.noRecordFlg = true;
// CONTENTSEARCH.reRenderPageNumber(0, 0);
//}
//else {
$
(
'#msgSearchNotExist'
).
hide
();
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
//
Render Gridview
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
//
Render Gridview
CONTENTSEARCH
.
chkSearchTextEmpty
=
false
;
CONTENTSEARCH
.
renderContent
(
sid
,
searchText
,
searchDivision
,
sortType
,
sortOrder
,
fromPage
,
toPage
,
genreId
,
groupId
);
//$('#control-nextrecord').css('visibility','visible');
//}
CONTENTSEARCH
.
renderContent
(
sid
,
searchText
,
searchDivision
,
sortType
,
sortOrder
,
offset
,
limit
,
genreId
,
groupId
);
};
//Render User view date
CONTENTSEARCH
.
renderViewDate
=
function
(
id
){
for
(
var
i
=
0
;
i
<
ClientData
.
ReadingContentIds
().
length
;
i
++
){
if
(
ClientData
.
ReadingContentIds
()[
i
].
contentid
==
id
){
return
ClientData
.
ReadingContentIds
()[
i
].
viewdate
;
// Render User view date
CONTENTSEARCH
.
renderViewDate
=
function
(
id
,
readingContentIds
)
{
for
(
var
i
=
0
;
i
<
readingContentIds
.
length
;
i
++
)
{
if
(
readingContentIds
[
i
].
contentid
==
id
)
{
return
readingContentIds
[
i
].
viewdate
;
}
}
};
//handle display sort direction
CONTENTSEARCH
.
handleSortDisp
=
function
(){
//
handle display sort direction
CONTENTSEARCH
.
handleSortDisp
=
function
()
{
var
typeSort
;
var
orderSort
;
if
(
ClientData
.
searchCond_sortType
()
==
null
||
ClientData
.
searchCond_sortType
()
==
'undefined'
||
ClientData
.
searchCond_sortType
()
==
''
)
{
if
(
ClientData
.
searchCond_sortType
()
==
null
||
ClientData
.
searchCond_sortType
()
==
'undefined'
||
ClientData
.
searchCond_sortType
()
==
''
)
{
$
(
'#title-sorttype'
).
html
(
''
);
$
(
'#title-sorttype'
).
html
(
''
);
$
(
'#titlekana-sorttype'
).
html
(
''
);
$
(
'#rDate-sorttype'
).
html
(
''
);
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
||
ClientData
.
searchCond_sortType
()
!=
''
){
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
||
ClientData
.
searchCond_sortType
()
!=
''
)
{
typeSort
=
ClientData
.
searchCond_sortType
();
orderSort
=
ClientData
.
searchCond_sortOrder
();
if
(
typeSort
==
1
){
HEADER
.
setStatusSort
(
'#control-sort-title'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
2
){
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
3
){
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
if
(
typeSort
==
1
)
{
HEADER
.
setStatusSort
(
'#control-sort-title'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
2
)
{
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
3
)
{
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
}
}
};
//function Open SubMenu Dialog
CONTENTSEARCH
.
titleClickFunction
=
function
(
e
){
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
checkflag
=
false
;
//
function Open SubMenu Dialog
CONTENTSEARCH
.
titleClickFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
checkflag
=
false
;
var
contentid
=
$
(
this
).
attr
(
'contentid'
);
// Get image of selected image
var
base64String
=
CONTENTSEARCH
.
returnThumbnail
(
contentid
);
ClientData
.
contentInfo_contentThumbnail
(
base64String
);
ClientData
.
contentInfo_contentId
(
contentid
);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
contentid
);
ClientData
.
contentInfo_contentType
(
contentType
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
// Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 --
// Summary : Assign content type of content.
var
contentType
=
CONTENTSEARCH
.
returnContentType
(
contentid
);
ClientData
.
contentInfo_contentType
(
contentType
);
// End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary
// : Assign content type of content.
// Store Content id that user has read
CONTENTSEARCH
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
if
(
CONTENTSEARCH
.
contentIdArray
.
length
>
0
)
{
//Store Content id that user has read
if
(
ClientData
.
ReadingContentIds
().
length
>
0
){
CONTENTSEARCH
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
for
(
var
nIndex
=
0
;
nIndex
<
CONTENTSEARCH
.
contentIdArray
.
length
;
nIndex
++
){
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
contentid
==
contentid
){
for
(
var
nIndex
=
0
;
nIndex
<
CONTENTSEARCH
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
CONTENTSEARCH
.
contentIdArray
[
nIndex
].
contentid
==
contentid
)
{
checkflag
=
true
;
break
;
}
else
{
}
else
{
checkflag
=
false
;
}
}
}
if
(
!
checkflag
){
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
if
(
!
checkflag
)
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
}
}
else
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
}
else
{
CONTENTSEARCH
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
}
//Renew ReadingContentID
// Renew ReadingContentID
var
newArray
=
[];
ClientData
.
ReadingContentIds
(
newArray
);
//Set data for readingcontentid
// Set data for readingcontentid
ClientData
.
ReadingContentIds
(
CONTENTSEARCH
.
contentIdArray
);
//Set ResouceVersion for content
//
Set ResouceVersion for content
COMMON
.
setResourceVersionData
(
contentid
);
//Set MetaVersion for content
//
Set MetaVersion for content
COMMON
.
setMetaVersionData
(
contentid
);
//Close Submenu
//
Close Submenu
$
(
'#dlgSubMenu'
).
hide
();
//Delete 'new' icon
//
Delete 'new' icon
CONTENTSEARCH
.
drawEditImage
(
contentid
);
//Open content Detail
//
Open content Detail
DETAIL
.
openContentDetail
();
};
//Get Number Disp Record For List
//
Get Number Disp Record For List
CONTENTSEARCH
.
returnNumberDispRecordForList
=
function
()
{
var
toPage
=
0
;
var
sysSettings
=
AVWEB
.
avwSysSetting
();
toPage
=
sysSettings
.
bookListCount
;
return
toPage
;
var
toPage
=
0
;
var
sysSettings
=
AVWEB
.
avwSysSetting
();
toPage
=
sysSettings
.
bookListCount
;
return
toPage
;
};
//Get number record disp next for list
CONTENTSEARCH
.
getNextRecordNumForList
=
function
(){
//
Get number record disp next for list
CONTENTSEARCH
.
getNextRecordNumForList
=
function
()
{
CONTENTSEARCH
.
iNumberOfNextRecord
=
CONTENTSEARCH
.
returnNumberDispRecordForList
();
};
//refresh sort order
//CONTENTSEARCH.refreshSortTypeOrder = function(){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('');
//};
//refresh GridView
CONTENTSEARCH
.
refreshGrid
=
function
(){
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
// refresh GridView
CONTENTSEARCH
.
refreshGrid
=
function
()
{
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#content-grid'
).
html
(
''
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
};
//format text display more record
CONTENTSEARCH
.
formatDisplayMoreRecord
=
function
(){
//
format text display more record
CONTENTSEARCH
.
formatDisplayMoreRecord
=
function
()
{
I18N
.
i18nReplaceText
();
//I18N.changeLanguage(ClientData.userInfo_language());
//
I18N.changeLanguage(ClientData.userInfo_language());
$
(
'#control-nextrecord'
).
html
(
AVWEB
.
format
(
I18N
.
i18nText
(
'dspViewMore'
),
CONTENTSEARCH
.
returnNumberDispRecordForList
()));
};
//CONTENTSEARCH.changeLanguageCallBackFunction = function(){
// CONTENTSEARCH.handleLanguage();
//
// CONTENTSEARCH.formatDisplayMoreRecord();
//
// if(CONTENTSEARCH.chkSearchTextEmpty){
// displayResultNoRecord();
// } else
// {
// if(!CONTENTSEARCH.noRecordFlg)
// {
// $('#control-nextrecord').css('visibility','visible');
// }
// enableSort();
// }
//
// document.title = I18N.i18nText('txtSearchResult') + ' | ' + I18N.i18nText('sysAppTitle');
//};
};
CONTENTSEARCH
.
displayResultNoRecord
=
function
(){
CONTENTSEARCH
.
displayResultNoRecord
=
function
()
{
I18N
.
i18nReplaceText
();
//$('#content-grid').html(I18N.i18nText('msgSearchNotExist'));
//$('#content-grid').css({ 'text-align': 'left', 'margin-top': '20px', 'clear': 'both' });
// $('#content-grid').html(I18N.i18nText('msgSearchNotExist'));
// $('#content-grid').css({ 'text-align': 'left', 'margin-top': '20px',
// 'clear': 'both' });
$
(
'#content-grid'
).
html
(
''
);
$
(
'#msgSearchNotExist'
).
show
();
$
(
'#msgSearchNotExist'
).
css
({
'text-align'
:
'left'
,
'margin-top'
:
'20px'
,
'clear'
:
'both'
});
$
(
'#msgSearchNotExist'
).
css
({
'text-align'
:
'left'
,
'margin-top'
:
'20px'
,
'clear'
:
'both'
});
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.control_sort_on'
).
hide
();
$
(
'.control_sort_off'
).
show
();
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
/*
$('#control-sort-titlekana').hide();
*/
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
/*
$('#control-sort-titlekana').hide();
*/
$
(
'#separate'
).
hide
();
$
(
'#control-sort-titlekana'
).
hide
();
$
(
'#control-sort-titlekana'
).
hide
();
}
};
CONTENTSEARCH
.
enableSort
=
function
(){
CONTENTSEARCH
.
enableSort
=
function
()
{
$
(
'.control_sort_on'
).
show
();
$
(
'.control_sort_off'
).
hide
();
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
$
(
'#control-sort-titlekana'
).
hide
();
$
(
'#separate'
).
hide
();
}
...
...
@@ -1350,121 +1344,116 @@ CONTENTSEARCH.enableSort = function(){
CONTENTSEARCH
.
resizeResourceThumbnail
=
function
(
mg
,
width
,
height
)
{
var
newWidth
;
var
newHeight
;
var
delta
=
Math
.
min
(
width
/
mg
.
width
,
height
/
mg
.
height
);
var
delta
=
Math
.
min
(
width
/
mg
.
width
,
height
/
mg
.
height
);
newHeight
=
parseInt
(
delta
*
mg
.
height
);
newWidth
=
parseInt
(
delta
*
mg
.
width
);
newHeight
=
parseInt
(
delta
*
mg
.
height
);
newWidth
=
parseInt
(
delta
*
mg
.
width
);
var
result
=
[
newWidth
,
newHeight
];
return
result
;
var
result
=
[
newWidth
,
newHeight
];
return
result
;
};
CONTENTSEARCH
.
removeHoverCss
=
function
(){
if
(
COMMON
.
isTouchDevice
())
{
CONTENTSEARCH
.
removeHoverCss
=
function
()
{
if
(
COMMON
.
isTouchDevice
())
{
$
(
'#control-sort-title'
).
removeClass
(
'nottouchdevice'
);
$
(
'#control-sort-titlekana'
).
removeClass
(
'nottouchdevice'
);
$
(
'#control-sort-releasedate'
).
removeClass
(
'nottouchdevice'
);
}
};
//Dialog Read Button CLick
//
Dialog Read Button CLick
CONTENTSEARCH
.
showContentShareDlgFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
SHARE
.
contentId
=
contentId
;
SHARE
.
contentTitle
=
""
;
SHARE
.
openContentShare
();
},
function
(){
//console.log("checkLimitContent_bbb");
}
);
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
SHARE
.
contentId
=
contentId
;
SHARE
.
contentTitle
=
""
;
SHARE
.
openContentShare
();
},
function
()
{
// console.log("checkLimitContent_bbb");
});
};
CONTENTSEARCH
.
showContentView
=
function
(){
//TOPに戻す
CONTENTSEARCH
.
showContentView
=
function
()
{
//
TOPに戻す
var
y
=
0
;
if
(
document
.
documentElement
.
scrollTop
)
{
if
(
document
.
documentElement
.
scrollTop
)
{
y
=
document
.
documentElement
.
scrollTop
;
}
if
(
document
.
body
.
scrollTop
)
{
if
(
y
==
undefined
||
y
==
0
)
{
if
(
document
.
body
.
scrollTop
)
{
if
(
y
==
undefined
||
y
==
0
)
{
y
=
document
.
body
.
scrollTop
;
}
}
if
(
y
==
undefined
||
y
==
null
)
{
if
(
y
==
undefined
||
y
==
null
)
{
y
=
0
;
}
CONTENTSEARCH
.
scrollTop
=
y
;
window
.
scrollTo
(
0
,
0
);
//試験
$
(
"#header-ws"
).
hide
();
$
(
"#ws-body"
).
hide
();
$
(
"#topcontrol"
).
hide
();
CONTENTVIEW_INITOBJECT
.
clearViewerComponent
();
CONTENTVIEW
.
cssInit
();
$
(
"#viewer"
).
show
();
window
.
scrollTo
(
0
,
0
);
//
試験
$
(
"#header-ws"
).
hide
();
$
(
"#ws-body"
).
hide
();
$
(
"#topcontrol"
).
hide
();
CONTENTVIEW_INITOBJECT
.
clearViewerComponent
();
CONTENTVIEW
.
cssInit
();
$
(
"#viewer"
).
show
();
CONTENTVIEW
.
ready
();
};
CONTENTSEARCH
.
cssInit
=
function
(){
CONTENTSEARCH
.
cssInit
=
function
()
{
$
(
'html'
).
css
({
'overflow-y'
:
'scroll'
});
'overflow-y'
:
'scroll'
});
$
(
'html,body'
).
css
({
'height'
:
'100%'
,
'margin'
:
'0'
,
'padding'
:
'0'
});
'height'
:
'100%'
,
'margin'
:
'0'
,
'padding'
:
'0'
});
$
(
'html>body'
).
css
({
'font-size'
:
'16px'
,
'font-size'
:
'68.75%'
});
'font-size'
:
'16px'
,
'font-size'
:
'68.75%'
});
$
(
'body'
).
css
({
'font-family'
:
'Verdana, helvetica, arial, sans-serif'
,
'font-size'
:
'68.75%'
,
'background'
:
'#fff'
,
'color'
:
'#333'
});
'font-family'
:
'Verdana, helvetica, arial, sans-serif'
,
'font-size'
:
'68.75%'
,
'background'
:
'#fff'
,
'color'
:
'#333'
});
};
//ダウンロードButton CLick
//
ダウンロードButton CLick
CONTENTSEARCH
.
downloadSubmenuFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
e
)
{
e
.
preventDefault
();
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
if
(
CONTENTSEARCH
.
home_isMove
==
true
)
{
CONTENTSEARCH
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
//Download content
HEADER
.
downloadResourceById
(
contentId
);
};
// Download content
HEADER
.
downloadResourceById
(
contentId
);
};
abvw/js/history.js
View file @
852e7c32
//名前空間用のオブジェクトを用意する
var
HISTORY
=
{};
//Start Declare Variables
//----Constant-----------//
//var DEFAULT_DISP_NUMBER_RECORD_FROM = 1;
//var DEFAULT_DISP_NUMBER_RECORD_TO = 15;
//
Start Declare Variables
//
----Constant-----------//
//
var DEFAULT_DISP_NUMBER_RECORD_FROM = 1;
//
var DEFAULT_DISP_NUMBER_RECORD_TO = 15;
HISTORY
.
DEFAULT_SORT_TYPE
=
'4'
;
HISTORY
.
DEFAULT_SORT_ORDER
=
'2'
;
HISTORY
.
DEFAULT_SEARCH_DIVISION
=
0
;
//var iNumberOfNextRecord = 15;
//
var iNumberOfNextRecord = 15;
//Thumbnail array
//
Thumbnail array
HISTORY
.
thumbnailArr
=
[];
//Contdent type array.
//
Contdent type array.
HISTORY
.
contentTypeArr
=
[];
HISTORY
.
contentIdArray
=
[];
...
...
@@ -23,626 +22,609 @@ HISTORY.contentViewData = [];
HISTORY
.
noRecordFlg
=
false
;
HISTORY
.
home_isMove
=
false
;
HISTORY
.
history_contentTitleKana
=
[];
//スクロール復帰
//
スクロール復帰
HISTORY
.
scrollTop
=
0
;
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
()
{
if
(
!
AVWEB
.
avwCheckLogin
(
COMMON
.
ScreenIds
.
Login
)){
if
(
!
AVWEB
.
avwCheckLogin
(
COMMON
.
ScreenIds
.
Login
))
{
return
;
}
//ソート条件デフォルト設定
if
(
AVWEB
.
avwSysSetting
().
sortTypeHistory
!=
undefined
)
{
//
ソート条件デフォルト設定
if
(
AVWEB
.
avwSysSetting
().
sortTypeHistory
!=
undefined
)
{
HISTORY
.
DEFAULT_SORT_TYPE
=
AVWEB
.
avwSysSetting
().
sortTypeHistory
;
}
if
(
AVWEB
.
avwSysSetting
().
sortOrderHistory
!=
undefined
)
{
if
(
AVWEB
.
avwSysSetting
().
sortOrderHistory
!=
undefined
)
{
HISTORY
.
DEFAULT_SORT_ORDER
=
AVWEB
.
avwSysSetting
().
sortOrderHistory
;
}
COMMON
.
LockScreen
();
COMMON
.
LockScreen
();
document
.
title
=
I18N
.
i18nText
(
'dspViewHistory'
)
+
' | '
+
I18N
.
i18nText
(
'sysAppTitle'
);
ClientData
.
BookmarkScreen
(
COMMON
.
ScreenIds
.
History
);
if
(
ClientData
.
requirePasswordChange
()
!=
1
){
if
(
ClientData
.
ReadingContentIds
()
==
null
||
ClientData
.
ReadingContentIds
()
==
'undefined'
||
ClientData
.
ReadingContentIds
().
length
==
0
){
}
else
{
HISTORY
.
syncReadingContent
();
}
if
(
ClientData
.
requirePasswordChange
()
!=
1
)
{
//var readingContentIds = ClientData.ReadingContentIds();
//if (readingContentIds == null || readingContentIds == 'undefined' || readingContentIds.length == 0) {
//} else {
// HISTORY.syncReadingContent();
//}
//
remove hover effect when is touch device
HISTORY
.
removeHoverCss
();
//
remove hover effect when is touch device
HISTORY
.
removeHoverCss
();
//
Render Grid
HISTORY
.
renderGridView
();
//
Render Grid
HISTORY
.
renderGridView
();
//Go To Details Page
HISTORY
.
makeContentIds
();
// Go To Details Page
$
(
'#main-ws canvas'
).
live
(
'click'
,
HISTORY
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchend'
,
HISTORY
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
$
(
'#main-ws canvas'
).
live
(
'touchend'
,
HISTORY
.
canvasClickFunction
);
$
(
'#main-ws canvas'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
//Open dialog
//
Open dialog
$
(
'.dialog'
).
live
(
'click'
,
HISTORY
.
titleClickFunction
);
//$('.dialog').live('touchstart', HISTORY.titleClickFunction);
$
(
'.dialog'
).
live
(
'touchend'
,
HISTORY
.
titleClickFunction
);
$
(
'.dialog'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
// $('.dialog').live('touchstart', HISTORY.titleClickFunction);
$
(
'.dialog'
).
live
(
'touchend'
,
HISTORY
.
titleClickFunction
);
$
(
'.dialog'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
//Sort Title
//
Sort Title
$
(
'#control-sort-title'
).
click
(
HISTORY
.
sortByTitleFunction
);
//Sort by title kana
//
Sort by title kana
$
(
'#control-sort-titlekana'
).
click
(
HISTORY
.
sortByTitleKanaFunction
);
//sort by release date
//
sort by release date
$
(
'#control-sort-releasedate'
).
click
(
HISTORY
.
sortByReleaseDateFunction
);
$
(
'#control-sort-viewdate'
).
click
(
HISTORY
.
sortByViewDateFunction
);
//Go To Details Page
//
Go To Details Page
$
(
'.button-details'
).
live
(
'click'
,
HISTORY
.
readSubmenuFunction
);
//$('.button-details').live('touchstart', HISTORY.readSubmenuFunction);
//
$('.button-details').live('touchstart', HISTORY.readSubmenuFunction);
$
(
'.button-details'
).
live
(
'touchend'
,
HISTORY
.
readSubmenuFunction
);
$
(
'.button-details'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
$
(
'.button-details'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
//Show Share Dialog
//
Show Share Dialog
$
(
'.button-share'
).
live
(
'click'
,
HISTORY
.
showContentShareDlgFunction
);
$
(
'.button-share'
).
live
(
'touchend'
,
HISTORY
.
showContentShareDlgFunction
);
$
(
'.button-share'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
$
(
'.button-share'
).
live
(
'touchmove'
,
function
()
{
HISTORY
.
home_isMove
=
true
;
});
$
(
window
).
resize
(
function
()
{
if
(
$
(
"#contentDetail"
).
css
(
"display"
)
!=
"none"
)
{
// Refresh panel of detail to center.
$
(
"#contentDetail"
).
center
();
if
(
$
(
"#contentDetail"
).
height
()
>
$
(
window
).
height
())
{
$
(
window
).
resize
(
function
()
{
if
(
$
(
"#contentDetail"
).
css
(
"display"
)
!=
"none"
)
{
// Refresh panel of detail to center.
$
(
"#contentDetail"
).
center
();
if
(
$
(
"#contentDetail"
).
height
()
>
$
(
window
).
height
())
{
$
(
"#contentDetail"
).
css
(
'top'
,
'0'
);
}
}
});
}
else
{
//Check if Force Change password
}
});
}
else
{
// Check if Force Change password
HEADER
.
checkForceChangePassword
();
}
if
(
COMMON
.
isAnonymousLogin
())
{
//プッシュメッセージ隠す
$
(
'#dspPushMessage'
).
hide
();
}
else
{
//プッシュメッセージ判定
if
(
ClientData
.
serviceOpt_apns
()
==
'Y'
||
ClientData
.
serviceOpt_usable_push_message
()
==
'Y'
){
//プッシュメッセージ表示
$
(
'#dspPushMessage'
).
show
();
}
else
{
$
(
'#dspPushMessage'
).
hide
();
}
}
//詳細、共有表示パーツ読み込み
$
(
"#inc_detail"
).
load
(
"./inc_detail.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
){
//読み込み完了時の処理
I18N
.
i18nReplaceText
();
$
(
'.datepicker'
).
pickadate
({
format
:
'yyyy-mm-dd'
});
});
//ビューア、共有表示パーツ読み込み
$
(
"#viewer"
).
load
(
"./inc_contentview.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
){
//読み込み完了時の処理
I18N
.
i18nReplaceText
();
});
});
//Call API
//HISTORY.abapi = function(name, param, method, callback){
// AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), name, method, param, callback, null);
//};
///Render Content
HISTORY
.
renderContent
=
function
(
id
,
text
,
division
,
type
,
order
,
from
,
to
,
cateid
,
grpid
)
{
var
params
=
{
sid
:
id
,
searchText
:
text
,
searchDivision
:
division
,
sortType
:
type
,
sortOrder
:
order
,
//recordFrom: from,
//recordTo: to,
categoryId
:
cateid
,
groupId
:
grpid
};
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
'webContentList'
,
'POST'
,
params
,
function
(
data
)
{
$
(
'#content-grid'
).
html
(
''
);
//var htmlTemp = "";
for
(
var
i
=
0
;
i
<
data
.
contentList
.
length
;
i
++
)
{
post
=
data
.
contentList
[
i
];
var
outputDate
=
COMMON
.
formatDeliveryDate
(
post
.
contentDeliveryDate
);
//renderViewDate
var
viewdate
=
HISTORY
.
renderViewDate
(
post
.
contentId
);
/*
if (viewdate != null && viewdate != 'undefined' && viewdate != '') {
var htmlTemp = '<section class="sectionhistory">'
+ ' <div class="cnt_section_list">'
+ ' <a class="img">'
+ ' <canvas height="110" width="150" id="content-thumbnail' + post.contentId + '" contentid="' + post.contentId + '" style="display:none;">'
+ ' </canvas>'
+ ' <img id="imgloading' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
+ ' </a>'
+ ' <div class="text">'
+ ' <a id="title' + post.contentId + '" class="name dialog" contentid="' + post.contentId + '">'
+ ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contentType)+'" width="20" height="20">'
+ COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20)
+ ' </a>'
+ ' <div class="info">'
+ ' <ul class="date">'
+ ' <li><span class="lang" lang="txtPubDt"> </span> : ' + outputDate + '</li>'
+ ' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate' + post.contentId + '"> </span></li>'
+ ' </ul>'
+ ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>'
+ ' </ul>'
+ ' </div>'
+ ' </div>'
+ ' </div>'
+ '</section>';
var shareHtml = "";
if( post.readerShare == '1' ){
shareHtml ='<li><a class="read lang button-share" contentid="' + post.contentId + '" lang="txtShare">'+I18N.i18nText("txtShare")+'</a></li>';
}
htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//効率化
//$('#content-grid').append(htmlTemp);
}*/
}
for
(
var
i
=
0
;
i
<
data
.
contentList
.
length
;
i
++
)
{
post
=
data
.
contentList
[
i
];
var
viewdate
=
HISTORY
.
renderViewDate
(
post
.
contentId
);
// save alert message level
LIMIT_ACCESS_CONTENT
.
messageLevel
[
post
.
contentId
]
=
{
alertMessageLevel
:
post
.
alertMessageLevel
,
alertMessage
:
post
.
alertMessage
};
}
if
(
viewdate
!=
null
&&
viewdate
!=
'undefined'
&&
viewdate
!=
''
)
{
if
(
COMMON
.
isAnonymousLogin
())
{
// プッシュメッセージ隠す
$
(
'#dspPushMessage'
).
hide
();
}
else
{
// プッシュメッセージ判定
if
(
ClientData
.
serviceOpt_apns
()
==
'Y'
||
ClientData
.
serviceOpt_usable_push_message
()
==
'Y'
)
{
// プッシュメッセージ表示
$
(
'#dspPushMessage'
).
show
();
}
else
{
$
(
'#dspPushMessage'
).
hide
();
}
}
//assign thumbnail to array
var
formatThumbnail
=
post
.
contentThumbnail
;
if
((
formatThumbnail
!=
null
)
&&
(
formatThumbnail
!=
'undefined'
)
&&
(
formatThumbnail
!=
''
)){
formatThumbnail
=
COMMON
.
formatStringBase64
(
formatThumbnail
);
}
// 詳細、共有表示パーツ読み込み
$
(
"#inc_detail"
).
load
(
"./inc_detail.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
)
{
// 読み込み完了時の処理
I18N
.
i18nReplaceText
();
$
(
'.datepicker'
).
pickadate
({
format
:
'yyyy-mm-dd'
});
});
HISTORY
.
thumbnailArr
.
push
({
contentId
:
post
.
contentId
,
thumbnail
:
formatThumbnail
});
// ビューア、共有表示パーツ読み込み
$
(
"#viewer"
).
load
(
"./inc_contentview.html?__UPDATEID__"
,
function
(
myData
,
myStatus
,
xhr
)
{
// 読み込み完了時の処理
I18N
.
i18nReplaceText
();
});
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//assign content type to array
HISTORY
.
contentTypeArr
.
push
({
contentId
:
post
.
contentId
,
contentType
:
post
.
contentType
});
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
});
//効率化
//Check if user has read this content or not.
//HISTORY.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
HISTORY
.
makeContentIds
=
function
(){
//並び替え
var
sortArr
=
ClientData
.
ReadingContentIds
();
if
(
sortArr
.
length
<=
0
){
return
"-1"
;
}
// var t;
// for ( var i = 0; i < sortArr.length; i++) {
// for ( var j = 1; j < sortArr.length - i; j++) {
// if (sortArr[j - 1].originviewdate > sortArr[j].originviewdate) {
// t = sortArr[j - 1];
// sortArr[j - 1] = sortArr[j];
// sortArr[j] = t;
// }
// }
// }
var
temp
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
originviewdate
>
sortArr
[
j
-
1
].
originviewdate
)
{
temp
=
sortArr
[
j
];
sortArr
[
j
]
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
temp
;
}
}
}
//assign version to array
COMMON
.
resourceVersionArr
.
push
({
contentid
:
post
.
contentId
,
resourceversion
:
post
.
resourceVersion
});
var
contentIds
=
""
;
var
cnt
=
0
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
//console.log("contentId:" + sortArr[i].contentid + " viewdate:" + sortArr[i].originviewdate)
if
(
sortArr
[
i
].
originviewdate
!=
null
&&
sortArr
[
i
].
originviewdate
!=
''
){
cnt
=
cnt
+
1
;
if
(
cnt
==
1
){
contentIds
=
sortArr
[
i
].
contentid
;
}
else
{
contentIds
=
contentIds
+
","
+
sortArr
[
i
].
contentid
;
}
if
(
cnt
==
50
){
break
;
}
}
}
return
contentIds
;
};
//assign meta version to array
COMMON
.
metaVersionArr
.
push
({
contentid
:
post
.
contentId
,
metaversion
:
post
.
metaVersion
});
// /Render Content
HISTORY
.
renderContent
=
function
(
id
,
text
,
division
,
type
,
order
)
{
var
contentIds
=
HISTORY
.
makeContentIds
();
var
params
=
{
sid
:
id
,
searchText
:
text
,
searchDivision
:
division
,
sortType
:
type
,
sortOrder
:
order
,
recordFrom
:
0
,
recordTo
:
99999
,
categoryId
:
''
,
groupId
:
''
,
contentIds
:
contentIds
};
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
'webContentList'
,
'POST'
,
params
,
function
(
data
)
{
$
(
'#content-grid'
).
html
(
''
);
var
readingContentIds
=
ClientData
.
ReadingContentIds
();
for
(
var
i
=
0
;
i
<
data
.
contentList
.
length
;
i
++
)
{
post
=
data
.
contentList
[
i
];
// save alert message level
LIMIT_ACCESS_CONTENT
.
messageLevel
[
post
.
contentId
]
=
{
alertMessageLevel
:
post
.
alertMessageLevel
,
alertMessage
:
post
.
alertMessage
};
//Check if content has marking or memo
HISTORY
.
checkContentMarkingMemoOption
(
post
.
contentId
);
var
viewdate
=
HISTORY
.
renderViewDate
(
post
.
contentId
,
readingContentIds
);
if
(
viewdate
!=
null
&&
viewdate
!=
'undefined'
&&
viewdate
!=
''
)
{
//効率化
//$('#lblVdate' + post.contentId).html(viewdate);
// assign thumbnail to array
var
formatThumbnail
=
post
.
contentThumbnail
;
if
((
formatThumbnail
!=
null
)
&&
(
formatThumbnail
!=
'undefined'
)
&&
(
formatThumbnail
!=
''
))
{
formatThumbnail
=
COMMON
.
formatStringBase64
(
formatThumbnail
);
}
HISTORY
.
addReadContentToArray
(
post
.
contentId
,
post
.
resourceVersion
,
post
.
metaVersion
,
post
.
contentThumbnail
,
post
.
contentTitle
,
HISTORY
.
returnContentTitleKana
(
post
.
contentId
),
post
.
contentDeliveryDate
,
post
.
contentType
,
post
.
readerShare
);
HISTORY
.
thumbnailArr
.
push
({
contentId
:
post
.
contentId
,
thumbnail
:
formatThumbnail
});
// assign content type to array
HISTORY
.
contentTypeArr
.
push
({
contentId
:
post
.
contentId
,
contentType
:
post
.
contentType
});
// assign version to array
COMMON
.
resourceVersionArr
.
push
({
contentid
:
post
.
contentId
,
resourceversion
:
post
.
resourceVersion
});
// assign meta version to array
COMMON
.
metaVersionArr
.
push
({
contentid
:
post
.
contentId
,
metaversion
:
post
.
metaVersion
});
// Check if content has marking or memo
HISTORY
.
checkContentMarkingMemoOption
(
post
.
contentId
);
// 効率化
// $('#lblVdate' + post.contentId).html(viewdate);
//HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId),
// post.contentDeliveryDate, post.contentType, post.readerShare);
var
originalViewDate
=
HISTORY
.
formatDate
(
HISTORY
.
returnOriginalViewDate
(
post
.
contentId
,
readingContentIds
));
HISTORY
.
addReadContentToArray
(
post
.
contentId
,
post
.
resourceVersion
,
post
.
metaVersion
,
post
.
contentThumbnail
,
post
.
contentTitle
,
post
.
contentNameKana
,
post
.
contentDeliveryDate
,
post
.
contentType
,
post
.
readerShare
,
originalViewDate
);
//HISTORY.showContentThumbnail();
}
}
}
}
if
(
data
.
recordFrom
)
{
ClientData
.
searchCond_recordFrom
(
data
.
recordFrom
);
}
if
(
data
.
recordTo
)
{
ClientData
.
searchCond_recordTo
(
data
.
recordTo
);
}
HISTORY
.
totalPage
=
data
.
totalRecord
;
//
Render Page number
HISTORY
.
reRenderPageNumber
(
HISTORY
.
totalPage
,
HISTORY
.
totalPage
);
if
(
data
.
recordFrom
)
{
ClientData
.
searchCond_recordFrom
(
data
.
recordFrom
);
}
if
(
data
.
recordTo
)
{
ClientData
.
searchCond_recordTo
(
data
.
recordTo
);
}
HISTORY
.
totalPage
=
data
.
totalRecord
;
//
Render Page number
HISTORY
.
reRenderPageNumber
(
HISTORY
.
totalPage
,
HISTORY
.
totalPage
);
},
null
);
},
null
);
};
//Handle language
HISTORY
.
handleLanguage
=
function
(){
//
Handle language
HISTORY
.
handleLanguage
=
function
()
{
//if(ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_En || ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_Ko)
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'none'
);
$
(
'#control-sort-titlekana-off'
).
css
(
'display'
,
'none'
);
$
(
'#label-sort-titlekana'
).
css
(
'display'
,
'none'
);
$
(
'#separate'
).
css
(
'display'
,
'none'
);
if
(
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_En
||
I18N
.
getCurrentLanguage
()
==
COMMON
.
Consts
.
ConstLanguage_Ko
)
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'none'
);
$
(
'#control-sort-titlekana-off'
).
css
(
'display'
,
'none'
);
$
(
'#label-sort-titlekana'
).
css
(
'display'
,
'none'
);
$
(
'#separate'
).
css
(
'display'
,
'none'
);
$
(
"#titlekana-sorttype"
).
html
(
''
);
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
||
ClientData
.
searchCond_sortType
()
!=
''
)
{
var
typeSort
=
ClientData
.
searchCond_sortType
();
var
orderSort
=
ClientData
.
searchCond_sortOrder
();
HEADER
.
setStatusSort
(
'#'
+
$
(
'#menu_sort li.current a'
).
attr
(
'id'
),
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
||
ClientData
.
searchCond_sortType
()
!=
''
)
{
var
typeSort
=
ClientData
.
searchCond_sortType
();
var
orderSort
=
ClientData
.
searchCond_sortOrder
();
HEADER
.
setStatusSort
(
'#'
+
$
(
'#menu_sort li.current a'
).
attr
(
'id'
),
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
if
(
HISTORY
.
noRecordFlg
)
{
$
(
'#label-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
if
(
HISTORY
.
noRecordFlg
)
{
$
(
'#label-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
$
(
'#control-sort-titlekana-off'
).
css
(
'display'
,
'block'
);
$
(
'#control-sort-titlekana-off'
).
css
(
'display'
,
'block'
);
$
(
'#content-grid'
).
html
(
"<div id='msgHistoryNotExist'>"
+
I18N
.
i18nText
(
'msgHistoryNotExist'
)
+
"</div>"
);
}
else
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
}
else
{
$
(
'#control-sort-titlekana'
).
css
(
'display'
,
'block'
);
$
(
'#separate'
).
css
(
'display'
,
'block'
);
}
}
};
//Initial Screen
HISTORY
.
renderGridView
=
function
(){
//
Initial Screen
HISTORY
.
renderGridView
=
function
()
{
var
fromPage
=
''
;
var
toPage
=
''
;
var
sortType
=
HISTORY
.
DEFAULT_SORT_TYPE
;
var
sortOrder
=
HISTORY
.
DEFAULT_SORT_ORDER
;
var
searchText
=
''
;
var
searchDivision
=
HISTORY
.
DEFAULT_SEARCH_DIVISION
;
var
genreId
=
''
;
var
groupId
=
''
;
var
sid
=
ClientData
.
userInfo_sid
();
ClientData
.
searchCond_recordFrom
(
fromPage
);
ClientData
.
searchCond_recordTo
(
toPage
);
ClientData
.
searchCond_recordFrom
(
0
);
ClientData
.
searchCond_recordTo
(
0
);
ClientData
.
searchCond_sortType
(
sortType
);
ClientData
.
searchCond_sortOrder
(
sortOrder
);
ClientData
.
searchCond_searchDivision
(
searchDivision
);
//Handle display sort
//
Handle display sort
HISTORY
.
handleSortDisp
();
//Display user name
//
Display user name
$
(
'#login-username'
).
html
(
ClientData
.
userInfo_loginId_session
());
//Refresh GridView
//
Refresh GridView
HISTORY
.
refreshGrid
();
if
(
ClientData
.
ReadingContentIds
()
==
null
||
ClientData
.
ReadingContentIds
()
==
'undefined'
||
ClientData
.
ReadingContentIds
().
length
==
0
){
var
readingContentIds
=
ClientData
.
ReadingContentIds
();
if
(
readingContentIds
.
length
==
0
)
{
HISTORY
.
displayResultNoRecord
();
HISTORY
.
noRecordFlg
=
true
;
HISTORY
.
reRenderPageNumber
(
0
,
0
);
}
else
{
//Render Gridview
HISTORY
.
renderContent
(
sid
,
searchText
,
searchDivision
,
3
,
sortOrder
,
fromPage
,
toPage
,
genreId
,
groupId
);
HISTORY
.
reRenderPageNumber
(
0
,
0
);
}
else
{
// Render Gridview
HISTORY
.
renderContent
(
sid
,
searchText
,
searchDivision
,
3
,
sortOrder
);
var
sortType
=
ClientData
.
searchCond_sortType
();
if
(
sortType
==
'1'
)
{
if
(
sortType
==
'1'
)
{
HISTORY
.
sortByTitleFunction
();
}
else
if
(
sortType
==
'2'
)
{
}
else
if
(
sortType
==
'2'
)
{
HISTORY
.
sortByTitleKanaFunction
();
}
else
if
(
sortType
==
'3'
)
{
}
else
if
(
sortType
==
'3'
)
{
HISTORY
.
sortByReleaseDateFunction
();
}
else
{
HISTORY
.
sortByViewDateFunction
();
}
}
//Language Handle
//
Language Handle
HISTORY
.
handleLanguage
();
};
//Canvas Click function
HISTORY
.
canvasClickFunction
=
function
(
e
){
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
//
Canvas Click function
HISTORY
.
canvasClickFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'id'
);
var
outputId
=
contentId
.
substring
(
17
);
// Set content id for screen: content detail
// Set content id for screen: content detail
ClientData
.
contentInfo_contentId
(
outputId
);
// Get image of selected image
var
base64String
=
HISTORY
.
returnThumbnail
(
outputId
);
ClientData
.
contentInfo_contentThumbnail
(
base64String
);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var
contentType
=
HISTORY
.
returnContentType
(
outputId
);
ClientData
.
contentInfo_contentType
(
contentType
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var
contentType
=
HISTORY
.
returnContentType
(
outputId
);
ClientData
.
contentInfo_contentType
(
contentType
);
//Store Content id that user has read
if
(
ClientData
.
ReadingContentIds
().
length
>
0
){
HISTORY
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
// Store Content id that user has read
var
checkflag
=
false
;
HISTORY
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
if
(
HISTORY
.
contentIdArray
.
length
>
0
)
{
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
contentid
==
outputId
)
{
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
contentid
==
outputId
)
{
checkflag
=
true
;
break
;
}
else
{
checkflag
=
false
;
}
}
if
(
!
checkflag
){
HISTORY
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
if
(
!
checkflag
)
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
}
}
else
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
}
else
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
outputId
,
viewdate
:
''
,
originviewdate
:
''
});
}
//Renew ReadingContentID
//
Renew ReadingContentID
var
newArray
=
[];
ClientData
.
ReadingContentIds
(
newArray
);
//Set data for readingcontentid
// Set data for readingcontentid
ClientData
.
ReadingContentIds
(
HISTORY
.
contentIdArray
);
//Set ResouceVersion for content
//
Set ResouceVersion for content
COMMON
.
setResourceVersionData
(
outputId
);
//Set MetaVersion for content
//
Set MetaVersion for content
COMMON
.
setMetaVersionData
(
outputId
);
//Delete 'new' icon
//
Delete 'new' icon
HISTORY
.
drawEditImage
(
outputId
);
//Open content Detail
//
Open content Detail
DETAIL
.
openContentDetail
();
};
//Re-render page from and total record
HISTORY
.
reRenderPageNumber
=
function
(
dispRecord
,
dispTotal
){
//
Re-render page from and total record
HISTORY
.
reRenderPageNumber
=
function
(
dispRecord
,
dispTotal
)
{
if
(
HISTORY
.
contentViewData
.
length
)
{
if
(
HISTORY
.
contentViewData
.
length
)
{
$
(
'#dispPage'
).
html
(
HISTORY
.
contentViewData
.
length
);
$
(
'#totalPage'
).
html
(
HISTORY
.
contentViewData
.
length
);
$
(
'#dispPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'visible'
);
$
(
'#dispPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'visible'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'visible'
);
}
else
{
$
(
'#dispPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#dispPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'#totalPage'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
}
};
//Sort By Title Function
HISTORY
.
sortByTitleFunction
=
function
(){
//
Sort By Title Function
HISTORY
.
sortByTitleFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sid
=
ClientData
.
userInfo_sid
();
var
recordFrom
=
null
;
var
recordTo
=
null
;
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'1'
){
//var sid = ClientData.userInfo_sid();
//var genreId = ClientData.searchCond_genreId();
//var groupId = ClientData.searchCond_groupId();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'1'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
HISTORY
.
sortByTitleDesc
();
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
HISTORY
.
sortByTitleAsc
();
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
ClientData
.
searchCond_sortOrder
(
sortOrder
);
HISTORY
.
sortByTitleAsc
();
}
HEADER
.
setStatusSort
(
'#control-sort-title'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
HEADER
.
setStatusSort
(
'#control-sort-title'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
sortType
=
'1'
;
ClientData
.
searchCond_sortType
(
sortType
);
//refresh Gridview
//HISTORY.refreshGrid();
//HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
};
//Sort By Title Kana function
HISTORY
.
sortByTitleKanaFunction
=
function
(){
//
Sort By Title Kana function
HISTORY
.
sortByTitleKanaFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sid
=
ClientData
.
userInfo_sid
();
var
recordFrom
=
null
;
var
recordTo
=
null
;
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'2'
){
//var sid = ClientData.userInfo_sid();
//var recordFrom = null;
//var recordTo = null;
//var genreId = ClientData.searchCond_genreId();
//var groupId = ClientData.searchCond_groupId();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'2'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
HISTORY
.
sortByTitleKanaDesc
();
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
HISTORY
.
sortByTitleKanaAsc
();
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
ClientData
.
searchCond_sortOrder
(
sortOrder
);
HISTORY
.
sortByTitleKanaAsc
();
}
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
sortType
=
'2'
;
//refresh gridview
//HISTORY.refreshGrid();
ClientData
.
searchCond_sortType
(
sortType
);
//HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, null, null, genreId, groupId);
};
//Sort By Release Date
HISTORY
.
sortByReleaseDateFunction
=
function
(){
//
Sort By Release Date
HISTORY
.
sortByReleaseDateFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
var
sid
=
ClientData
.
userInfo_sid
();
var
recordFrom
=
null
;
var
recordTo
=
null
;
var
genreId
=
ClientData
.
searchCond_genreId
();
var
groupId
=
ClientData
.
searchCond_groupId
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'3'
){
//var sid = ClientData.userInfo_sid();
//var recordFrom = null;
//var recordTo = null;
//var genreId = ClientData.searchCond_genreId();
//var groupId = ClientData.searchCond_groupId();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'3'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
HISTORY
.
sortByPublishDateDesc
();
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
HISTORY
.
sortByPublishDateAsc
();
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
ClientData
.
searchCond_sortOrder
(
sortOrder
);
HISTORY
.
sortByPublishDateAsc
();
}
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
sortType
=
'3'
;
ClientData
.
searchCond_sortType
(
sortType
);
//HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
};
//Sort By View Date
HISTORY
.
sortByViewDateFunction
=
function
(){
//
Sort By View Date
HISTORY
.
sortByViewDateFunction
=
function
()
{
var
sortOrder
=
ClientData
.
searchCond_sortOrder
();
var
sortType
=
ClientData
.
searchCond_sortType
();
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'4'
){
if
(
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
)
{
if
(
sortType
==
'4'
)
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Desc
;
HISTORY
.
sortByViewDateDesc
();
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
HISTORY
.
sortByViewDateAsc
();
}
ClientData
.
searchCond_sortOrder
(
sortOrder
);
}
else
{
}
else
{
sortOrder
=
COMMON
.
Consts
.
ConstOrderSetting_Asc
;
HISTORY
.
sortByViewDateAsc
();
ClientData
.
searchCond_sortOrder
(
sortOrder
);
}
HEADER
.
setStatusSort
(
'#control-sort-viewdate'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
HEADER
.
setStatusSort
(
'#control-sort-viewdate'
,
sortOrder
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
sortType
=
'4'
;
ClientData
.
searchCond_sortType
(
sortType
);
};
//Get Thumnail base on contentid
HISTORY
.
returnThumbnail
=
function
(
contentid
){
//
Get Thumnail base on contentid
HISTORY
.
returnThumbnail
=
function
(
contentid
)
{
for
(
var
i
=
0
;
i
<
HISTORY
.
thumbnailArr
.
length
;
i
++
)
{
if
(
HISTORY
.
thumbnailArr
[
i
].
contentId
==
contentid
)
{
for
(
var
i
=
0
;
i
<
HISTORY
.
thumbnailArr
.
length
;
i
++
)
{
if
(
HISTORY
.
thumbnailArr
[
i
].
contentId
==
contentid
)
{
return
HISTORY
.
thumbnailArr
[
i
].
thumbnail
;
}
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content.
//Get content type base on contentid
HISTORY
.
returnContentType
=
function
(
contentid
){
//Array Length
var
iArrCnt
=
HISTORY
.
contentTypeArr
.
length
;
//Get contentType in array by contentId
for
(
var
i
=
0
;
i
<
iArrCnt
;
i
++
){
if
(
HISTORY
.
contentTypeArr
[
i
].
contentId
==
contentid
)
{
return
HISTORY
.
contentTypeArr
[
i
].
contentType
;
}
}
// Get content type base on contentid
HISTORY
.
returnContentType
=
function
(
contentid
)
{
// Array Length
var
iArrCnt
=
HISTORY
.
contentTypeArr
.
length
;
// Get contentType in array by contentId
for
(
var
i
=
0
;
i
<
iArrCnt
;
i
++
)
{
if
(
HISTORY
.
contentTypeArr
[
i
].
contentId
==
contentid
)
{
return
HISTORY
.
contentTypeArr
[
i
].
contentType
;
}
}
};
//Dialog Read Button CLick
HISTORY
.
readSubmenuFunction
=
function
(
e
){
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
//
Dialog Read Button CLick
HISTORY
.
readSubmenuFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
HISTORY
.
readSubmenuFunction_callback
(
contentId
);
},
function
(){
}
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
HISTORY
.
readSubmenuFunction_callback
(
contentId
);
},
function
()
{
});
};
// read content callback
HISTORY
.
readSubmenuFunction_callback
=
function
(
contentId
){
var
contentThumbnail
=
HISTORY
.
returnThumbnail
(
contentId
);
HISTORY
.
readSubmenuFunction_callback
=
function
(
contentId
)
{
var
contentThumbnail
=
HISTORY
.
returnThumbnail
(
contentId
);
var
date
=
new
Date
();
var
month
=
date
.
getMonth
()
+
1
;
var
month
=
date
.
getMonth
()
+
1
;
var
day
=
date
.
getDate
();
var
outputDate
=
COMMON
.
formatNormalDate
(
day
,
month
,
date
.
getFullYear
());
...
...
@@ -650,348 +632,341 @@ HISTORY.readSubmenuFunction_callback = function(contentId){
ClientData
.
contentInfo_contentId
(
contentId
);
ClientData
.
contentInfo_contentThumbnail
(
contentThumbnail
);
//Start Function : No.12 -- Editor : Le Long -- Date : 08/01/2013 -- Summary : Store contentType to storage.
var
contentType
=
HISTORY
.
returnContentType
(
contentId
);
ClientData
.
contentInfo_contentType
(
contentType
);
//End Function : No.12 -- Editor : Le Long -- Date : 08/01/2013 -- Summary : Store contentType to storage.
var
checkflag
=
false
;
//Store Content id that user has read
if
(
ClientData
.
ReadingContentIds
().
length
>
0
){
HISTORY
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
//
Store Content id that user has read
HISTORY
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
if
(
HISTORY
.
contentIdArray
.
length
>
0
)
{
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
contentid
==
contentId
)
{
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
contentid
==
contentId
)
{
checkflag
=
true
;
if
(
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
==
null
||
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
==
'undefined'
||
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
==
''
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
==
null
||
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
==
'undefined'
||
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
==
''
)
{
HISTORY
.
contentIdArray
[
nIndex
].
viewdate
=
outputDate
;
HISTORY
.
contentIdArray
[
nIndex
].
originviewdate
=
date
;
}
break
;
}
else
{
checkflag
=
false
;
}
}
if
(
!
checkflag
){
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
if
(
!
checkflag
)
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
}
}
else
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
}
else
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentId
,
viewdate
:
outputDate
,
originviewdate
:
date
});
}
//Renew ReadingContentID
//
Renew ReadingContentID
var
newArray
=
[];
ClientData
.
ReadingContentIds
(
newArray
);
//Set ResouceVersion for content
// Set data for readingcontentid
ClientData
.
ReadingContentIds
(
HISTORY
.
contentIdArray
);
// Set ResouceVersion for content
COMMON
.
setResourceVersionData
(
contentId
);
//Set MetaVersion for content
//
Set MetaVersion for content
COMMON
.
setMetaVersionData
(
contentId
);
//Set data for readingcontentid
ClientData
.
ReadingContentIds
(
HISTORY
.
contentIdArray
);
ClientData
.
IsRefresh
(
false
);
//Start Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download.
//For testing without other Type.
//contentType = COMMON.ContentTypeKeys.Type_Others;
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Others
){
//Download content
HEADER
.
downloadResourceById
(
contentId
);
// redraw content remove new icon
HISTORY
.
drawEditImage
(
contentId
);
}
else
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Link
){
//link content
HEADER
.
viewLinkContentById
(
contentId
);
// redraw content remove new icon
HISTORY
.
drawEditImage
(
contentId
);
}
else
{
//Go to Conten view page
//AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
HISTORY
.
drawEditImage
(
contentId
);
HISTORY
.
showContentView
();
}
//End Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download.
};
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Others
)
{
// Download content
HEADER
.
downloadResourceById
(
contentId
);
// redraw content remove new icon
HISTORY
.
drawEditImage
(
contentId
);
}
else
if
(
contentType
==
COMMON
.
ContentTypeKeys
.
Type_Link
)
{
// link content
HEADER
.
viewLinkContentById
(
contentId
);
// redraw content remove new icon
HISTORY
.
drawEditImage
(
contentId
);
}
else
{
// Go to Conten view page
// AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
HISTORY
.
drawEditImage
(
contentId
);
HISTORY
.
showContentView
();
//Check if Content Has marking or memo
HISTORY
.
checkContentMarkingMemoOption
=
function
(
contentId
){
//Check if contentid has marking
if
(
ClientData
.
MarkingData
().
length
==
0
){
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MarkingData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MarkingData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
};
// Check if Content Has marking or memo
HISTORY
.
checkContentMarkingMemoOption
=
function
(
contentId
)
{
// Check if contentid has marking
if
(
ClientData
.
MarkingData
().
length
==
0
)
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MarkingData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MarkingData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgBookMark'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
}
}
if
(
ClientData
.
MemoData
().
length
==
0
){
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
if
(
ClientData
.
MemoData
().
length
==
0
)
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
else
{
// Check if contentid has memo
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MemoData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MemoData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
}
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
MemoData
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
MemoData
()[
nIndex1
].
contentid
==
contentId
)
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'visible'
);
break
;
}
else
{
$
(
'#imgMemo'
+
contentId
).
css
(
'visibility'
,
'hidden'
);
}
}
}
};
//Check if User has read content
HISTORY
.
checkUserHasReadContent
=
function
(
contId
,
resourceVer
,
metaVer
)
{
//
Check if User has read content
HISTORY
.
checkUserHasReadContent
=
function
(
contId
,
resourceVer
,
metaVer
,
versionArr
,
metaArr
,
readArr
)
{
var
imgThumb
=
new
Image
();
//imgThumb.src = HISTORY.returnThumbnail(contId);
var
imgIconNew
=
new
Image
();
//imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
var
imgIconEdit
=
new
Image
();
//imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
contId
);
var
ctx
=
c
.
getContext
(
'2d'
);
var
readFlg
=
false
;
var
versionArr
=
ClientData
.
ResourceVersion
();
var
metaArr
=
ClientData
.
MetaVersion
();
var
readArr
=
ClientData
.
ReadingContentIds
();
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
var
contentThumbnail
=
HISTORY
.
returnThumbnail
(
contId
);
var
contentType
=
HISTORY
.
returnContentType
(
contId
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
if
(
readArr
==
null
||
readArr
<=
0
||
readArr
==
'undefined'
){
imgThumb
.
onload
=
function
(){
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconNew
.
onload
=
function
(){
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
// imgThumb.src = HISTORY.returnThumbnail(contId);
var
imgIconNew
=
new
Image
();
// imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
var
imgIconEdit
=
new
Image
();
// imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
contId
);
var
ctx
=
c
.
getContext
(
'2d'
);
var
readFlg
=
false
;
//var versionArr = ClientData.ResourceVersion();
//var metaArr = ClientData.MetaVersion();
//var readArr = ClientData.ReadingContentIds();
var
contentThumbnail
=
HISTORY
.
returnThumbnail
(
contId
);
var
contentType
=
HISTORY
.
returnContentType
(
contId
);
if
(
readArr
.
length
<=
0
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
imgIconNew
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
HISTORY
.
showContentThumbnail
(
contId
);
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
}
else
{
//Check if user has read this content or not
for
(
var
nIndex1
=
0
;
nIndex1
<
ClientData
.
ReadingContentIds
().
length
;
nIndex1
++
)
{
if
(
ClientData
.
ReadingContentIds
()[
nIndex1
].
contentid
==
contId
){
imgThumb
.
onload
=
function
(){
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
HISTORY
.
showContentThumbnail
(
contId
);
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
readFlg
=
true
;
break
;
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
else
{
imgThumb
.
onload
=
function
(){
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
}
else
{
// Check if user has read this content or not
for
(
var
nIndex1
=
0
;
nIndex1
<
readArr
.
length
;
nIndex1
++
)
{
if
(
readArr
[
nIndex1
].
contentid
==
contId
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
HISTORY
.
showContentThumbnail
(
contId
);
imgIconNew
.
onload
=
function
(){
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
};
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
readFlg
=
true
;
break
;
}
else
{
// imgThumb.onload = function() {
// var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
// ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
// HISTORY.showContentThumbnail(contId);
// imgIconNew.onload = function() {
// ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, 0);
// };
// imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
// };
// if (contentThumbnail == '' || contentThumbnail == null) {
// if (!COMMON.isPdfContent(contentType)) {
// var src = HEADER.getThumbnailForOtherType(contentType);
// if (src != '') {
// imgThumb.src = src;
// }
// }
// } else {
// imgThumb.src = contentThumbnail;
// }
}
}
}
}
//Check if resource version has change
if
(
readFlg
){
if
(
versionArr
==
null
||
versionArr
<=
0
||
versionArr
==
'undefined'
){
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
versionArr
.
length
;
nIndex2
++
){
if
(
versionArr
[
nIndex2
].
contentid
==
contId
){
if
(
versionArr
[
nIndex2
].
resourceversion
!=
resourceVer
){
imgThumb
.
onload
=
function
(){
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
// Check if resource version has change
if
(
readFlg
)
{
if
(
versionArr
==
null
||
versionArr
<=
0
||
versionArr
==
'undefined'
)
{
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
versionArr
.
length
;
nIndex2
++
)
{
if
(
versionArr
[
nIndex2
].
contentid
==
contId
)
{
if
(
versionArr
[
nIndex2
].
resourceversion
!=
resourceVer
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
HISTORY
.
showContentThumbnail
(
contId
);
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
};
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
};
imgIconEdit
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_EDIT
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
break
;
};
// Start Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
break
;
}
}
}
}
if
(
metaArr
==
null
||
metaArr
<=
0
||
metaArr
==
'undefined'
){
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
metaArr
.
length
;
nIndex2
++
){
if
(
metaArr
[
nIndex2
].
contentid
==
contId
){
if
(
metaArr
[
nIndex2
].
metaversion
!=
metaVer
){
imgThumb
.
onload
=
function
(){
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
if
(
metaArr
==
null
||
metaArr
<=
0
||
metaArr
==
'undefined'
)
{
}
else
{
for
(
var
nIndex2
=
0
;
nIndex2
<
metaArr
.
length
;
nIndex2
++
)
{
if
(
metaArr
[
nIndex2
].
contentid
==
contId
)
{
if
(
metaArr
[
nIndex2
].
metaversion
!=
metaVer
)
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
HISTORY
.
showContentThumbnail
(
contId
);
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
};
imgIconEdit
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconEdit
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
};
imgIconEdit
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_EDIT
;
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
){
if
(
!
COMMON
.
isPdfContent
(
contentType
)){
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
){
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
break
;
};
// Start Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
// End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break
;
}
}
}
}
readFlg
=
false
;
//readFlg = false;
}
else
{
imgThumb
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
imgThumb
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
imgThumb
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
,
resizeImg
[
0
],
resizeImg
[
1
]);
HISTORY
.
showContentThumbnail
(
contId
);
imgIconNew
.
onload
=
function
()
{
ctx
.
drawImage
(
imgIconNew
,
c
.
width
/
2
-
resizeImg
[
0
]
/
2
,
0
);
};
imgIconNew
.
src
=
COMMON
.
DEFAULT_IMG_CONTENT_NEW
;
};
if
(
contentThumbnail
==
''
||
contentThumbnail
==
null
)
{
if
(
!
COMMON
.
isPdfContent
(
contentType
))
{
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgThumb
.
src
=
src
;
}
}
}
else
{
imgThumb
.
src
=
contentThumbnail
;
}
}
};
//draw Edit Image
//
draw Edit Image
HISTORY
.
drawEditImage
=
function
(
id
)
{
var
img
=
new
Image
();
var
imgSrc
=
HISTORY
.
returnThumbnail
(
id
);
var
img
=
new
Image
();
var
imgSrc
=
HISTORY
.
returnThumbnail
(
id
);
if
(
imgSrc
!=
null
)
{
if
(
imgSrc
!=
null
)
{
}
else
{
var
contentType
=
HISTORY
.
returnContentType
(
id
);
}
else
{
var
contentType
=
HISTORY
.
returnContentType
(
id
);
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgSrc
=
src
;
}
var
src
=
HEADER
.
getThumbnailForOtherType
(
contentType
);
if
(
src
!=
''
)
{
imgSrc
=
src
;
}
}
}
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
id
);
var
c
=
document
.
getElementById
(
'content-thumbnail'
+
id
);
//
use getContext to use the canvas for drawing
var
ctx
=
c
.
getContext
(
'2d'
);
ctx
.
clearRect
(
0
,
0
,
c
.
width
,
c
.
height
);
img
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
img
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
img
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
id
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
id
).
fadeIn
(
'slow'
);
});
};
//
use getContext to use the canvas for drawing
var
ctx
=
c
.
getContext
(
'2d'
);
ctx
.
clearRect
(
0
,
0
,
c
.
width
,
c
.
height
);
img
.
onload
=
function
()
{
var
resizeImg
=
HISTORY
.
resizeResourceThumbnail
(
img
,
c
.
width
,
c
.
height
);
ctx
.
drawImage
(
img
,
(
c
.
width
/
2
)
-
(
resizeImg
[
0
]
/
2
)
+
4
,
c
.
height
-
resizeImg
[
1
]
+
4
,
resizeImg
[
0
],
resizeImg
[
1
]);
$
(
"#loadingIcon"
+
id
).
fadeOut
(
'slow'
,
function
()
{
$
(
'#content-thumbnail'
+
id
).
fadeIn
(
'slow'
);
});
};
img
.
src
=
imgSrc
;
img
.
src
=
imgSrc
;
};
//Render User view date
HISTORY
.
renderViewDate
=
function
(
id
){
for
(
var
i
=
0
;
i
<
ClientData
.
ReadingContentIds
().
length
;
i
++
){
if
(
ClientData
.
ReadingContentIds
()[
i
].
contentid
==
id
){
return
ClientData
.
ReadingContentIds
()[
i
].
viewdate
;
// Render User view date
HISTORY
.
renderViewDate
=
function
(
id
,
readingContentIds
)
{
for
(
var
i
=
0
;
i
<
readingContentIds
.
length
;
i
++
)
{
if
(
readingContentIds
[
i
].
contentid
==
id
)
{
return
readingContentIds
[
i
].
viewdate
;
}
}
};
HISTORY
.
returnOriginalViewDate
=
function
(
id
)
{
for
(
var
i
=
0
;
i
<
ClientData
.
ReadingContentIds
().
length
;
i
++
)
{
if
(
ClientData
.
ReadingContentIds
()[
i
].
contentid
==
id
)
{
return
ClientData
.
ReadingContentIds
()
[
i
].
originviewdate
;
HISTORY
.
returnOriginalViewDate
=
function
(
id
,
readingContentIds
)
{
for
(
var
i
=
0
;
i
<
readingContentIds
.
length
;
i
++
)
{
if
(
readingContentIds
[
i
].
contentid
==
id
)
{
return
readingContentIds
[
i
].
originviewdate
;
}
}
};
//handle display sort direction
HISTORY
.
handleSortDisp
=
function
(){
//
handle display sort direction
HISTORY
.
handleSortDisp
=
function
()
{
$
(
'#control-sort-title'
).
removeClass
(
'active_tops'
);
$
(
'#control-sort-titlekana'
).
removeClass
(
'active_tops'
);
...
...
@@ -1001,43 +976,39 @@ HISTORY.handleSortDisp = function(){
var
typeSort
;
var
orderSort
;
if
(
ClientData
.
searchCond_sortType
()
==
null
||
ClientData
.
searchCond_sortType
()
==
'undefined'
||
ClientData
.
searchCond_sortType
()
==
''
)
{
if
(
ClientData
.
searchCond_sortType
()
==
null
||
ClientData
.
searchCond_sortType
()
==
'undefined'
||
ClientData
.
searchCond_sortType
()
==
''
)
{
$
(
'#title-sorttype'
).
html
(
''
);
$
(
'#title-sorttype'
).
html
(
''
);
$
(
'#titlekana-sorttype'
).
html
(
''
);
$
(
'#rDate-sorttype'
).
html
(
''
);
$
(
'#vDate-sorttype'
).
html
(
''
);
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
&&
ClientData
.
searchCond_sortType
()
!=
''
){
}
else
{
if
(
ClientData
.
searchCond_sortOrder
()
!=
null
&&
ClientData
.
searchCond_sortOrder
()
!=
'undefined'
&&
ClientData
.
searchCond_sortType
()
!=
''
)
{
typeSort
=
ClientData
.
searchCond_sortType
();
orderSort
=
ClientData
.
searchCond_sortOrder
();
if
(
typeSort
==
1
){
HEADER
.
setStatusSort
(
'#control-sort-title'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
2
){
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
3
){
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
{
HEADER
.
setStatusSort
(
'#control-sort-viewdate'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
if
(
typeSort
==
1
)
{
HEADER
.
setStatusSort
(
'#control-sort-title'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
2
)
{
HEADER
.
setStatusSort
(
'#control-sort-titlekana'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
if
(
typeSort
==
3
)
{
HEADER
.
setStatusSort
(
'#control-sort-releasedate'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
else
{
HEADER
.
setStatusSort
(
'#control-sort-viewdate'
,
orderSort
==
COMMON
.
Consts
.
ConstOrderSetting_Asc
);
}
}
}
};
//function Open SubMenu Dialog
HISTORY
.
titleClickFunction
=
function
(
e
){
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
//
function Open SubMenu Dialog
HISTORY
.
titleClickFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
var
contentid
=
$
(
this
).
attr
(
'contentid'
);
// Get image of selected image
...
...
@@ -1045,87 +1016,80 @@ HISTORY.titleClickFunction = function(e){
ClientData
.
contentInfo_contentThumbnail
(
base64String
);
ClientData
.
contentInfo_contentId
(
contentid
);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var
contentType
=
HISTORY
.
returnContentType
(
contentid
);
ClientData
.
contentInfo_contentType
(
contentType
);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var
contentType
=
HISTORY
.
returnContentType
(
contentid
);
ClientData
.
contentInfo_contentType
(
contentType
);
//Store Content id that user has read
if
(
ClientData
.
ReadingContentIds
().
length
>
0
){
HISTORY
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
var
checkflag
=
false
;
// Store Content id that user has read
HISTORY
.
contentIdArray
=
ClientData
.
ReadingContentIds
();
if
(
HISTORY
.
contentIdArray
.
length
>
0
)
{
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
contentid
==
contentid
)
{
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
contentIdArray
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
contentIdArray
[
nIndex
].
contentid
==
contentid
)
{
checkflag
=
true
;
break
;
}
else
{
checkflag
=
false
;
}
}
if
(
!
checkflag
){
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
if
(
!
checkflag
)
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
}
}
else
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
}
else
{
HISTORY
.
contentIdArray
.
push
({
contentid
:
contentid
,
viewdate
:
''
,
originviewdate
:
''
});
}
//Renew ReadingContentID
//
Renew ReadingContentID
var
newArray
=
[];
ClientData
.
ReadingContentIds
(
newArray
);
//Set data for readingcontentid
// Set data for readingcontentid
ClientData
.
ReadingContentIds
(
HISTORY
.
contentIdArray
);
//Set ResouceVersion for content
//
Set ResouceVersion for content
COMMON
.
setResourceVersionData
(
contentid
);
//Set MetaVersion for content
//
Set MetaVersion for content
COMMON
.
setMetaVersionData
(
contentid
);
//Delete 'new' icon
//
Delete 'new' icon
HISTORY
.
drawEditImage
(
contentid
);
//Open content Detail
//
Open content Detail
DETAIL
.
openContentDetail
();
};
//refresh sort order
//HISTORY.refreshSortTypeOrder = function(){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('');
//};
//refresh GridView
HISTORY
.
refreshGrid
=
function
(){
//$('#content-grid').html('');
$
(
'#content-grid'
).
empty
();
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
// refresh GridView
HISTORY
.
refreshGrid
=
function
()
{
// $('#content-grid').html('');
$
(
'#content-grid'
).
empty
();
$
(
'.pageNumControl'
).
css
(
'visibility'
,
'hidden'
);
};
HISTORY
.
sortByViewDateAsc
=
function
(){
var
sortArr
=
HISTORY
.
contentViewData
;
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
sortArr
[
j
-
1
].
originviewdate
>
sortArr
[
j
].
originviewdate
)
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
resultArr
=
sortArr
;
HISTORY
.
renderContentAfterSort
(
resultArr
);
HISTORY
.
sortByViewDateAsc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
sortArr
[
j
-
1
].
originviewdate
>
sortArr
[
j
].
originviewdate
)
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
resultArr
=
sortArr
;
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
formatDate
=
function
(
originDate
){
HISTORY
.
formatDate
=
function
(
originDate
)
{
var
sourceDate
=
new
Date
(
originDate
);
var
year
=
sourceDate
.
getFullYear
()
+
1
;
var
month
=
sourceDate
.
getMonth
();
...
...
@@ -1139,16 +1103,16 @@ HISTORY.formatDate = function(originDate){
return
newDate
;
};
HISTORY
.
sortByViewDateDesc
=
function
(){
HISTORY
.
sortByViewDateDesc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
temp
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
originviewdate
>
sortArr
[
j
-
1
].
originviewdate
)
{
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
originviewdate
>
sortArr
[
j
-
1
].
originviewdate
)
{
temp
=
sortArr
[
j
];
sortArr
[
j
]
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
temp
;
sortArr
[
j
-
1
]
=
temp
;
}
}
}
...
...
@@ -1157,52 +1121,71 @@ HISTORY.sortByViewDateDesc = function(){
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
addReadContentToArray
=
function
(
strContentId
,
strResourceVersion
,
strMetaVersion
,
strThumbnail
,
strTitle
,
strTitleKana
,
strDelivDate
,
contentType
,
readerShare
)
{
if
(
HISTORY
.
contentViewData
.
length
>
0
)
{
var
flag
;
for
(
var
j
=
0
;
j
<
HISTORY
.
contentViewData
.
length
;
j
++
)
{
if
(
HISTORY
.
contentViewData
[
j
].
contentid
==
strContentId
)
{
HISTORY
.
addReadContentToArray
=
function
(
strContentId
,
strResourceVersion
,
strMetaVersion
,
strThumbnail
,
strTitle
,
strTitleKana
,
strDelivDate
,
contentType
,
readerShare
,
originalViewDate
)
{
if
(
HISTORY
.
contentViewData
.
length
>
0
)
{
var
flag
=
false
;
for
(
var
j
=
0
;
j
<
HISTORY
.
contentViewData
.
length
;
j
++
)
{
if
(
HISTORY
.
contentViewData
[
j
].
contentid
==
strContentId
)
{
flag
=
true
;
break
;
}
else
{
flag
=
false
;
}
}
if
(
!
flag
){
HISTORY
.
contentViewData
.
push
({
contentid
:
strContentId
,
originviewdate
:
HISTORY
.
formatDate
(
HISTORY
.
returnOriginalViewDate
(
strContentId
)),
contenttitle
:
strTitle
,
contenttitlekana
:
strTitleKana
,
deliverydate
:
strDelivDate
,
resourceversion
:
strResourceVersion
,
metaversion
:
strMetaVersion
,
thumbnail
:
COMMON
.
formatStringBase64
(
strThumbnail
),
contenttype
:
contentType
,
readerShare
:
readerShare
});
if
(
!
flag
)
{
HISTORY
.
contentViewData
.
push
({
contentid
:
strContentId
,
originviewdate
:
originalViewDate
,
contenttitle
:
strTitle
,
contenttitlekana
:
strTitleKana
,
deliverydate
:
strDelivDate
,
resourceversion
:
strResourceVersion
,
metaversion
:
strMetaVersion
,
thumbnail
:
COMMON
.
formatStringBase64
(
strThumbnail
),
contenttype
:
contentType
,
readerShare
:
readerShare
});
}
}
else
{
HISTORY
.
contentViewData
.
push
({
contentid
:
strContentId
,
originviewdate
:
HISTORY
.
formatDate
(
HISTORY
.
returnOriginalViewDate
(
strContentId
)),
contenttitle
:
strTitle
,
contenttitlekana
:
strTitleKana
,
deliverydate
:
strDelivDate
,
resourceversion
:
strResourceVersion
,
metaversion
:
strMetaVersion
,
thumbnail
:
COMMON
.
formatStringBase64
(
strThumbnail
),
contenttype
:
contentType
,
readerShare
:
readerShare
});
}
else
{
HISTORY
.
contentViewData
.
push
({
contentid
:
strContentId
,
originviewdate
:
originalViewDate
,
contenttitle
:
strTitle
,
contenttitlekana
:
strTitleKana
,
deliverydate
:
strDelivDate
,
resourceversion
:
strResourceVersion
,
metaversion
:
strMetaVersion
,
thumbnail
:
COMMON
.
formatStringBase64
(
strThumbnail
),
contenttype
:
contentType
,
readerShare
:
readerShare
});
}
};
HISTORY
.
showContentThumbnail
=
function
(
conid
)
{
$
(
'img#imgloading'
+
conid
).
fadeOut
(
'slow'
,
function
()
{
$
(
'canvas#content-thumbnail'
+
conid
).
fadeIn
(
'slow'
);
$
(
'img#imgloading'
+
conid
).
fadeOut
(
'slow'
,
function
()
{
$
(
'canvas#content-thumbnail'
+
conid
).
fadeIn
(
'slow'
);
});
};
HISTORY
.
syncReadingContent
=
function
(){
HISTORY
.
syncReadingContent
=
function
()
{
var
readArr
=
ClientData
.
ReadingContentIds
();
var
metaArr
=
ClientData
.
MetaVersion
();
var
resourceArr
=
ClientData
.
ResourceVersion
();
for
(
var
i
=
readArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
readContent
=
readArr
[
i
];
if
(
!
HISTORY
.
IsExistContent
(
readContent
.
contentid
))
{
readArr
.
splice
(
i
,
1
);
metaArr
.
splice
(
i
,
1
);
resourceArr
.
splice
(
i
,
1
);
}
// Do not process next
if
(
AVWEB
.
avwHasError
())
{
return
;
}
for
(
var
i
=
readArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
readContent
=
readArr
[
i
];
if
(
!
HISTORY
.
IsExistContent
(
readContent
.
contentid
))
{
readArr
.
splice
(
i
,
1
);
metaArr
.
splice
(
i
,
1
);
resourceArr
.
splice
(
i
,
1
);
}
// Do not process next
if
(
AVWEB
.
avwHasError
())
{
return
;
}
}
ClientData
.
ReadingContentIds
(
readArr
);
...
...
@@ -1210,99 +1193,90 @@ HISTORY.syncReadingContent = function(){
ClientData
.
ResourceVersion
(
resourceArr
);
};
/*
Get content title kana if it existed
*/
HISTORY
.
getContentNameKana
=
function
(
strContentId
)
{
var
strContentNameKana
=
null
;
for
(
var
nIndex
=
0
;
nIndex
<
HISTORY
.
history_contentTitleKana
.
length
;
nIndex
++
)
{
if
(
HISTORY
.
history_contentTitleKana
[
nIndex
].
contentId
==
strContentId
)
{
strContentNameKana
=
HISTORY
.
history_contentTitleKana
[
nIndex
].
contentNameKana
;
break
;
}
}
return
strContentNameKana
;
};
/
//
*
// *
Get content title kana if it existed
//
*/
//
HISTORY.getContentNameKana = function(strContentId) {
//
var strContentNameKana = null;
// for (
var nIndex = 0; nIndex < HISTORY.history_contentTitleKana.length; nIndex++) {
//
if (HISTORY.history_contentTitleKana[nIndex].contentId == strContentId) {
//
strContentNameKana = HISTORY.history_contentTitleKana[nIndex].contentNameKana;
//
break;
//
}
//
}
//
return strContentNameKana;
//
};
/*
Check content whether existed or not
*/
*
Check content whether existed or not
*/
HISTORY
.
IsExistContent
=
function
(
strContentId
)
{
if
(
strContentId
==
null
||
strContentId
==
""
)
{
if
(
strContentId
==
null
||
strContentId
==
""
)
{
return
false
;
}
var
isExisted
=
true
;
var
params
=
{
sid
:
ClientData
.
userInfo_sid
(),
getType
:
'1'
,
contentId
:
strContentId
};
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webGetContent"
,
'GET'
,
params
,
function
(
data
)
{
isExisted
=
true
;
HISTORY
.
history_contentTitleKana
.
push
({
contentId
:
strContentId
,
contentNameKana
:
data
.
contentData
.
contentNameKana
});
},
function
(
xmlHttpRequest
,
txtStatus
,
errorThrown
)
{
if
(
xmlHttpRequest
.
status
==
404
)
{
isExisted
=
false
;
}
else
{
// Show system error
isExisted
=
true
;
// Mark this flag to prevent bookmarks from deleting
AVWEB
.
showSystemError
();
}
});
return
isExisted
;
var
isExisted
=
true
;
var
params
=
{
sid
:
ClientData
.
userInfo_sid
(),
getType
:
'1'
,
contentId
:
strContentId
};
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webGetContent"
,
'GET'
,
params
,
function
(
data
)
{
isExisted
=
true
;
HISTORY
.
history_contentTitleKana
.
push
({
contentId
:
strContentId
,
contentNameKana
:
data
.
contentData
.
contentNameKana
});
},
function
(
xmlHttpRequest
,
txtStatus
,
errorThrown
)
{
if
(
xmlHttpRequest
.
status
==
404
)
{
isExisted
=
false
;
}
else
{
// Show system error
isExisted
=
true
;
// Mark this flag to prevent bookmarks from
// deleting
AVWEB
.
showSystemError
();
}
});
return
isExisted
;
};
//HISTORY.changeLanguageCallBackFunction = function(){
// HISTORY.handleLanguage();
// document.title = I18N.i18nText('dspViewHistory') + ' | ' + I18N.i18nText('sysAppTitle');
//};
HISTORY
.
displayResultNoRecord
=
function
(){
HISTORY
.
displayResultNoRecord
=
function
()
{
I18N
.
i18nReplaceText
();
$
(
'#content-grid'
).
html
(
"<div id='msgHistoryNotExist'>"
+
I18N
.
i18nText
(
'msgHistoryNotExist'
)
+
"</div>"
);
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.control_sort_on'
).
hide
();
$
(
'.control_sort_off'
).
show
();
$
(
'#off-default'
).
addClass
(
'descending_sort'
);
$
(
'#control-nextrecord'
).
css
(
'visibility'
,
'hidden'
);
$
(
'.control_sort_on'
).
hide
();
$
(
'.control_sort_off'
).
show
();
$
(
'#off-default'
).
addClass
(
'descending_sort'
);
};
//HISTORY.enableSort = function(){
// $('.control_sort_on').show();
// $('.control_sort_off').hide();
//};
HISTORY
.
sortByTitleAsc
=
function
(){
HISTORY
.
sortByTitleAsc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
sortArr
[
j
-
1
].
contenttitle
.
toUpperCase
()
>
sortArr
[
j
].
contenttitle
.
toUpperCase
())
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
sortArr
[
j
-
1
].
contenttitle
.
toUpperCase
()
>
sortArr
[
j
].
contenttitle
.
toUpperCase
())
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
resultArr
=
sortArr
;
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
sortByTitleDesc
=
function
(){
HISTORY
.
sortByTitleDesc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
temp
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
contenttitle
.
toUpperCase
()
>
sortArr
[
j
-
1
].
contenttitle
.
toUpperCase
())
{
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
contenttitle
.
toUpperCase
()
>
sortArr
[
j
-
1
].
contenttitle
.
toUpperCase
())
{
temp
=
sortArr
[
j
];
sortArr
[
j
]
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
temp
;
sortArr
[
j
-
1
]
=
temp
;
}
}
}
...
...
@@ -1311,33 +1285,33 @@ HISTORY.sortByTitleDesc = function(){
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
sortByPublishDateAsc
=
function
(){
HISTORY
.
sortByPublishDateAsc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
-
1
].
deliverydate
)
>
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
].
deliverydate
))
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
-
1
].
deliverydate
)
>
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
].
deliverydate
))
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
resultArr
=
sortArr
;
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
sortByPublishDateDesc
=
function
(){
HISTORY
.
sortByPublishDateDesc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
temp
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
].
deliverydate
)
>
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
-
1
].
deliverydate
))
{
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
].
deliverydate
)
>
HISTORY
.
formatOriginalPublishDate
(
sortArr
[
j
-
1
].
deliverydate
))
{
temp
=
sortArr
[
j
];
sortArr
[
j
]
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
temp
;
sortArr
[
j
-
1
]
=
temp
;
}
}
}
...
...
@@ -1346,32 +1320,32 @@ HISTORY.sortByPublishDateDesc = function(){
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
sortByTitleKanaAsc
=
function
(){
HISTORY
.
sortByTitleKanaAsc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
sortArr
[
j
-
1
].
contenttitlekana
>
sortArr
[
j
].
contenttitlekana
)
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
t
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
sortArr
.
length
-
i
;
j
++
)
{
if
(
sortArr
[
j
-
1
].
contenttitlekana
>
sortArr
[
j
].
contenttitlekana
)
{
t
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
sortArr
[
j
];
sortArr
[
j
]
=
t
;
}
}
}
var
resultArr
=
sortArr
;
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
sortByTitleKanaDesc
=
function
(){
HISTORY
.
sortByTitleKanaDesc
=
function
()
{
var
sortArr
=
HISTORY
.
contentViewData
;
var
temp
;
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
contenttitlekana
>
sortArr
[
j
-
1
].
contenttitlekana
)
{
for
(
var
i
=
0
;
i
<
sortArr
.
length
;
i
++
)
{
for
(
var
j
=
sortArr
.
length
-
1
;
j
>
i
;
j
--
)
{
if
(
sortArr
[
j
].
contenttitlekana
>
sortArr
[
j
-
1
].
contenttitlekana
)
{
temp
=
sortArr
[
j
];
sortArr
[
j
]
=
sortArr
[
j
-
1
];
sortArr
[
j
-
1
]
=
temp
;
sortArr
[
j
-
1
]
=
temp
;
}
}
}
...
...
@@ -1380,36 +1354,39 @@ HISTORY.sortByTitleKanaDesc = function(){
HISTORY
.
renderContentAfterSort
(
resultArr
);
};
HISTORY
.
renderContentAfterSort
=
function
(
contentSortArr
){
HISTORY
.
renderContentAfterSort
=
function
(
contentSortArr
)
{
HISTORY
.
refreshGrid
();
//var htmlTemp = "";
for
(
var
i
=
0
;
i
<
contentSortArr
.
length
;
i
++
)
{
post
=
contentSortArr
[
i
];
var
versionArr
=
ClientData
.
ResourceVersion
();
var
metaArr
=
ClientData
.
MetaVersion
();
var
readArr
=
ClientData
.
ReadingContentIds
();
// var htmlTemp = "";
for
(
var
i
=
0
;
i
<
contentSortArr
.
length
;
i
++
)
{
post
=
contentSortArr
[
i
];
var
outputDeliveryDate
=
COMMON
.
formatDeliveryDate
(
post
.
deliverydate
);
var
htmlTemp
=
'<section class="sectionhistory">'
var
htmlTemp
=
'<section class="sectionhistory">'
+
' <div class="cnt_section_list">'
+
' <a class="img">'
+
' <canvas height="110" width="150" id="content-thumbnail'
+
post
.
contentid
+
'" contentid="'
+
post
.
contentid
+
'" style="display:none;">'
+
' </canvas>'
+
' <canvas height="110" width="150" id="content-thumbnail'
+
post
.
contentid
+
'" contentid="'
+
post
.
contentid
+
'" style="display:none;"></canvas>'
+
' <img id="imgloading'
+
post
.
contentid
+
'" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
+
' </a>'
+
' <div class="text">'
+
' <a id="title'
+
post
.
contentid
+
'" class="name dialog" contentid="'
+
post
.
contentid
+
'" title="'
+
COMMON
.
htmlEncode
(
post
.
contenttitle
)
+
'">'
+
' <img class="listIcon" src="'
+
HEADER
.
getIconTypeContent
(
post
.
contenttype
)
+
'" width="20" height="20">'
+
' <img class="listIcon" src="'
+
HEADER
.
getIconTypeContent
(
post
.
contenttype
)
+
'" width="20" height="20">'
+
' <div class="content-list">'
+
COMMON
.
htmlEncode
(
post
.
contenttitle
)
+
'</div>'
+
' </a>'
+
' <div class="info">'
+
' <ul class="date">'
+
' <li><span class="lang" lang="txtPubDt">'
+
I18N
.
i18nText
(
"txtPubDt"
)
+
'</span> : '
+
outputDeliveryDate
+
'</li>'
+
' <li><span class="lang" lang="txtViewDt">'
+
I18N
.
i18nText
(
"txtViewDt"
)
+
'</span>:<span id="lblVdate'
+
post
.
contentid
+
'"> </span></li>'
+
' <li><span class="lang" lang="txtPubDt">'
+
I18N
.
i18nText
(
"txtPubDt"
)
+
'</span> : '
+
outputDeliveryDate
+
'</li>'
+
' <li><span class="lang" lang="txtViewDt">'
+
I18N
.
i18nText
(
"txtViewDt"
)
+
'</span>:<span id="lblVdate'
+
post
.
contentid
+
'"> </span></li>'
+
' </ul>'
+
' <ul class="pic">'
+
' <li><img src="'
+
COMMON
.
DEFAULT_IMG_OPTION_MEMO
+
'" id="imgMemo'
+
post
.
contentid
+
'" class="sticker" /></li>'
+
' <li><img src="'
+
COMMON
.
DEFAULT_IMG_OPTION_MARKING
+
'" id="imgBookMark'
+
post
.
contentid
+
'" class="pen" /></li>'
+
' <li><ul class="iconList">{share}<li><a class="read lang button-details" contentid="'
+
post
.
contentid
+
'" lang="txtRead">'
+
I18N
.
i18nText
(
"txtRead"
)
+
'</a></li></ul></li>'
+
' <li><ul class="iconList">{share}<li><a class="read lang button-details" contentid="'
+
post
.
contentid
+
'" lang="txtRead">'
+
I18N
.
i18nText
(
"txtRead"
)
+
'</a></li></ul></li>'
+
' </ul>'
+
' </div>'
+
' </div>'
...
...
@@ -1417,34 +1394,38 @@ HISTORY.renderContentAfterSort = function(contentSortArr){
+
'</section>'
;
var
shareHtml
=
""
;
if
(
post
.
readerShare
==
'1'
)
{
shareHtml
=
'<li><a class="read lang button-share" contentid="'
+
post
.
contentid
+
'" lang="txtShare">'
+
I18N
.
i18nText
(
"txtShare"
)
+
'</a></li>'
;
if
(
post
.
readerShare
==
'1'
)
{
shareHtml
=
'<li><a class="read lang button-share" contentid="'
+
post
.
contentid
+
'" lang="txtShare">'
+
I18N
.
i18nText
(
"txtShare"
)
+
'</a></li>'
;
}
htmlTemp
=
htmlTemp
.
replace
(
/
\{
share
\}
/g
,
shareHtml
);
$
(
'#content-grid'
).
append
(
htmlTemp
);
var
viewdate
=
HISTORY
.
renderViewDate
(
post
.
contentid
,
readArr
);
$
(
'#lblVdate'
+
post
.
contentid
).
html
(
viewdate
);
// Check if user has read this content or not.
HISTORY
.
checkUserHasReadContent
(
post
.
contentid
,
post
.
resourceversion
,
post
.
metaversion
,
versionArr
,
metaArr
,
readArr
);
// Check if content has marking or memo
HISTORY
.
checkContentMarkingMemoOption
(
post
.
contentid
);
}
for
(
var
i
=
0
;
i
<
contentSortArr
.
length
;
i
++
)
{
post
=
contentSortArr
[
i
];
var
viewdate
=
HISTORY
.
renderViewDate
(
post
.
contentid
);
HISTORY
.
reRenderPageNumber
(
HISTORY
.
totalPage
,
HISTORY
.
totalPage
);
//Check if user has read this content or not.
HISTORY
.
checkUserHasReadContent
(
post
.
contentid
,
post
.
resourceversion
,
post
.
metaversion
);
//Check if content has marking or memo
HISTORY
.
checkContentMarkingMemoOption
(
post
.
contentid
);
$
(
'#lblVdate'
+
post
.
contentid
).
html
(
viewdate
);
HISTORY
.
showContentThumbnail
();
}
// for ( var i = 0; i < contentSortArr.length; i++) {
// post = contentSortArr[i];
// var viewdate = HISTORY.renderViewDate(post.contentid, readArr);
// // Check if user has read this content or not.
// HISTORY.checkUserHasReadContent(post.contentid, post.resourceversion, post.metaversion, versionArr, metaArr, readArr);
// // Check if content has marking or memo
// HISTORY.checkContentMarkingMemoOption(post.contentid);
// $('#lblVdate' + post.contentid).html(viewdate);
// HISTORY.showContentThumbnail();
// }
HISTORY
.
reRenderPageNumber
(
HISTORY
.
totalPage
,
HISTORY
.
totalPage
);
};
HISTORY
.
formatOriginalPublishDate
=
function
(
date
){
HISTORY
.
formatOriginalPublishDate
=
function
(
date
)
{
var
day
=
date
.
date
;
var
month
=
date
.
month
+
1
;
...
...
@@ -1457,50 +1438,47 @@ HISTORY.formatOriginalPublishDate = function(date){
return
resultDate
;
};
HISTORY
.
returnContentTitleKana
=
function
(
id
)
{
var
titleKana
;
// Get title kana from existed contents
titleKana
=
HISTORY
.
getContentNameKana
(
id
);
if
(
titleKana
!=
null
)
{
// Skip this case
}
else
{
var
params
=
{
contentId
:
id
,
sid
:
ClientData
.
userInfo_sid
(),
getType
:
1
};
// Get all pages of content
AVWEB
.
avwCmsApiSync
(
ClientData
.
userInfo_accountPath
(),
"webGetContent"
,
'GET'
,
params
,
function
(
data
)
{
// Success
titleKana
=
data
.
contentData
.
contentNameKana
;
},
null
);
}
return
titleKana
;
};
//HISTORY.returnContentTitleKana = function(id) {
// var titleKana;
//
// // Get title kana from existed contents
// titleKana = HISTORY.getContentNameKana(id);
//
// if (titleKana != null) {
// // Skip this case
// } else {
// var params = {
// contentId : id,
// sid : ClientData.userInfo_sid(),
// getType : 1
// };
//
// // Get all pages of content
// AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, function(data) {
// // Success
// titleKana = data.contentData.contentNameKana;
// }, null);
//
// }
// return titleKana;
//};
HISTORY
.
resizeResourceThumbnail
=
function
(
mg
,
width
,
height
)
{
var
newWidth
;
var
newHeight
;
var
delta
=
Math
.
min
(
width
/
mg
.
width
,
height
/
mg
.
height
);
var
delta
=
Math
.
min
(
width
/
mg
.
width
,
height
/
mg
.
height
);
newHeight
=
parseInt
(
delta
*
mg
.
height
);
newWidth
=
parseInt
(
delta
*
mg
.
width
);
var
result
=
[
newWidth
,
newHeight
];
newHeight
=
parseInt
(
delta
*
mg
.
height
);
newWidth
=
parseInt
(
delta
*
mg
.
width
);
var
result
=
[
newWidth
,
newHeight
];
return
result
;
return
result
;
};
HISTORY
.
removeHoverCss
=
function
(){
HISTORY
.
removeHoverCss
=
function
()
{
if
(
COMMON
.
isTouchDevice
())
{
if
(
COMMON
.
isTouchDevice
())
{
$
(
'#control-sort-title'
).
removeClass
(
'nottouchdevice'
);
$
(
'#control-sort-titlekana'
).
removeClass
(
'nottouchdevice'
);
$
(
'#control-sort-releasedate'
).
removeClass
(
'nottouchdevice'
);
...
...
@@ -1508,96 +1486,89 @@ HISTORY.removeHoverCss = function(){
}
};
//Dialog Read Button CLick
//
Dialog Read Button CLick
HISTORY
.
showContentShareDlgFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
SHARE
.
contentId
=
contentId
;
SHARE
.
contentTitle
=
""
;
SHARE
.
openContentShare
();
},
function
(){
//console.log("checkLimitContent_bbb");
}
);
if
(
e
)
{
e
.
preventDefault
();
}
if
(
HISTORY
.
home_isMove
==
true
)
{
HISTORY
.
home_isMove
=
false
;
return
;
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
// check limit of content
LIMIT_ACCESS_CONTENT
.
checkLimitContent
(
contentId
,
function
()
{
SHARE
.
contentId
=
contentId
;
SHARE
.
contentTitle
=
""
;
SHARE
.
openContentShare
();
},
function
()
{
// console.log("checkLimitContent_bbb");
});
};
HISTORY
.
showContentView
=
function
(){
HISTORY
.
showContentView
=
function
()
{
var
y
=
0
;
if
(
document
.
documentElement
.
scrollTop
)
{
if
(
document
.
documentElement
.
scrollTop
)
{
y
=
document
.
documentElement
.
scrollTop
;
}
if
(
document
.
body
.
scrollTop
)
{
if
(
y
==
undefined
||
y
==
0
)
{
if
(
document
.
body
.
scrollTop
)
{
if
(
y
==
undefined
||
y
==
0
)
{
y
=
document
.
body
.
scrollTop
;
}
}
if
(
y
==
undefined
||
y
==
null
)
{
if
(
y
==
undefined
||
y
==
null
)
{
y
=
0
;
}
//console.log("scrollTop:" + y);
//
console.log("scrollTop:" + y);
HISTORY
.
scrollTop
=
y
;
window
.
scrollTo
(
0
,
0
);
window
.
scrollTo
(
0
,
0
);
$
(
"#header-ws"
).
hide
();
$
(
"#ws-body"
).
hide
();
$
(
"#topcontrol"
).
hide
();
$
(
"#header-ws"
).
hide
();
$
(
"#ws-body"
).
hide
();
$
(
"#topcontrol"
).
hide
();
CONTENTVIEW_INITOBJECT
.
clearViewerComponent
();
CONTENTVIEW
.
cssInit
();
$
(
"#viewer"
).
show
();
CONTENTVIEW_INITOBJECT
.
clearViewerComponent
();
CONTENTVIEW
.
cssInit
();
$
(
"#viewer"
).
show
();
CONTENTVIEW
.
ready
();
};
HISTORY
.
cssInit
=
function
(){
HISTORY
.
cssInit
=
function
()
{
$
(
'html'
).
css
({
'overflow-y'
:
'scroll'
});
'overflow-y'
:
'scroll'
});
$
(
'html,body'
).
css
({
'height'
:
'100%'
,
'margin'
:
'0'
,
'padding'
:
'0'
});
'height'
:
'100%'
,
'margin'
:
'0'
,
'padding'
:
'0'
});
$
(
'html>body'
).
css
({
'font-size'
:
'16px'
,
'font-size'
:
'68.75%'
});
'font-size'
:
'16px'
,
'font-size'
:
'68.75%'
});
$
(
'body'
).
css
({
'font-family'
:
'Verdana, helvetica, arial, sans-serif'
,
'font-size'
:
'68.75%'
,
'background'
:
'#fff'
,
'color'
:
'#333'
});
'font-family'
:
'Verdana, helvetica, arial, sans-serif'
,
'font-size'
:
'68.75%'
,
'background'
:
'#fff'
,
'color'
:
'#333'
});
};
HISTORY
.
downloadFunction
=
function
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
}
if
(
e
)
{
e
.
preventDefault
();
}
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
//
Download content
HEADER
.
downloadResourceById
(
contentId
);
var
contentId
=
$
(
this
).
attr
(
'contentid'
);
//
Download content
HEADER
.
downloadResourceById
(
contentId
);
};
abvw/js/home.js
View file @
852e7c32
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment