Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
09c41fad
Unverified
Commit
09c41fad
authored
Mar 06, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
Fix #12699
parent
0b721591
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
110 additions
and
62 deletions
+110
-62
src/main/java/org/b3log/solo/model/Option.java
src/main/java/org/b3log/solo/model/Option.java
+0
-10
src/main/java/org/b3log/solo/processor/B3Receiver.java
src/main/java/org/b3log/solo/processor/B3Receiver.java
+7
-7
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
+0
-7
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+0
-2
src/main/java/org/b3log/solo/service/InitService.java
src/main/java/org/b3log/solo/service/InitService.java
+0
-6
src/main/java/org/b3log/solo/service/OptionQueryService.java
src/main/java/org/b3log/solo/service/OptionQueryService.java
+5
-5
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+0
-4
src/main/java/org/b3log/solo/upgrade/V320_330.java
src/main/java/org/b3log/solo/upgrade/V320_330.java
+87
-0
src/main/resources/lang_en_US.properties
src/main/resources/lang_en_US.properties
+0
-2
src/main/resources/lang_zh_CN.properties
src/main/resources/lang_zh_CN.properties
+0
-2
src/main/resources/local.properties
src/main/resources/local.properties
+10
-10
src/main/webapp/admin/admin-preference.ftl
src/main/webapp/admin/admin-preference.ftl
+0
-2
src/main/webapp/js/admin/admin.min.js
src/main/webapp/js/admin/admin.min.js
+1
-1
src/main/webapp/js/admin/preference.js
src/main/webapp/js/admin/preference.js
+0
-4
No files found.
src/main/java/org/b3log/solo/model/Option.java
View file @
09c41fad
...
@@ -162,11 +162,6 @@ public final class Option {
...
@@ -162,11 +162,6 @@ public final class Option {
*/
*/
public
static
final
String
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"allowVisitDraftViaPermalink"
;
public
static
final
String
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"allowVisitDraftViaPermalink"
;
/**
* Key of allow register.
*/
public
static
final
String
ID_C_ALLOW_REGISTER
=
"allowRegister"
;
/**
/**
* Key of version.
* Key of version.
*/
*/
...
@@ -396,11 +391,6 @@ public final class Option {
...
@@ -396,11 +391,6 @@ public final class Option {
*/
*/
public
static
final
String
DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"false"
;
public
static
final
String
DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"false"
;
/**
* Default allow register.
*/
public
static
final
String
DEFAULT_ALLOW_REGISTER
=
"true"
;
/**
/**
* Default allow comment article/page.
* Default allow comment article/page.
*/
*/
...
...
src/main/java/org/b3log/solo/processor/B3Receiver.java
View file @
09c41fad
...
@@ -290,13 +290,6 @@ public class B3Receiver {
...
@@ -290,13 +290,6 @@ public class B3Receiver {
final
JSONObject
commenter
=
userRepository
.
getByUserName
(
commentName
);
final
JSONObject
commenter
=
userRepository
.
getByUserName
(
commentName
);
if
(
null
==
commenter
)
{
if
(
null
==
commenter
)
{
// 社区回帖同步博客评论 https://github.com/b3log/solo/issues/12691
// 社区回帖同步博客评论 https://github.com/b3log/solo/issues/12691
if
(!
optionQueryService
.
allowRegister
())
{
ret
.
put
(
Keys
.
CODE
,
1
);
ret
.
put
(
Keys
.
MSG
,
"Not allow register"
);
return
;
}
final
JSONObject
addUserReq
=
new
JSONObject
();
final
JSONObject
addUserReq
=
new
JSONObject
();
addUserReq
.
put
(
User
.
USER_NAME
,
commentName
);
addUserReq
.
put
(
User
.
USER_NAME
,
commentName
);
addUserReq
.
put
(
UserExt
.
USER_AVATAR
,
commentThumbnailURL
);
addUserReq
.
put
(
UserExt
.
USER_AVATAR
,
commentThumbnailURL
);
...
@@ -314,6 +307,13 @@ public class B3Receiver {
...
@@ -314,6 +307,13 @@ public class B3Receiver {
}
}
}
}
if
(!
optionQueryService
.
allowComment
()
||
!
article
.
optBoolean
(
Article
.
ARTICLE_COMMENTABLE
))
{
ret
.
put
(
Keys
.
CODE
,
1
);
ret
.
put
(
Keys
.
MSG
,
"Not allow comment"
);
return
;
}
String
commentContent
=
symCmt
.
getString
(
"content"
);
// Markdown
String
commentContent
=
symCmt
.
getString
(
"content"
);
// Markdown
final
Transaction
transaction
=
commentRepository
.
beginTransaction
();
final
Transaction
transaction
=
commentRepository
.
beginTransaction
();
...
...
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
View file @
09c41fad
...
@@ -190,13 +190,6 @@ public class OAuthProcessor {
...
@@ -190,13 +190,6 @@ public class OAuthProcessor {
}
else
{
}
else
{
user
=
userQueryService
.
getUserByName
(
userName
);
user
=
userQueryService
.
getUserByName
(
userName
);
if
(
null
==
user
)
{
if
(
null
==
user
)
{
if
(!
optionQueryService
.
allowRegister
())
{
context
.
attr
(
Keys
.
MSG
,
langPropsService
.
get
(
"notAllowRegisterLabel"
));
context
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
}
final
JSONObject
addUserReq
=
new
JSONObject
();
final
JSONObject
addUserReq
=
new
JSONObject
();
addUserReq
.
put
(
User
.
USER_NAME
,
userName
);
addUserReq
.
put
(
User
.
USER_NAME
,
userName
);
addUserReq
.
put
(
UserExt
.
USER_AVATAR
,
userAvatar
);
addUserReq
.
put
(
UserExt
.
USER_AVATAR
,
userAvatar
);
...
...
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
09c41fad
...
@@ -162,7 +162,6 @@ public class PreferenceConsole {
...
@@ -162,7 +162,6 @@ public class PreferenceConsole {
* "signHTML": ""
* "signHTML": ""
* }, ...]",
* }, ...]",
* "allowVisitDraftViaPermalink": boolean,
* "allowVisitDraftViaPermalink": boolean,
* "allowRegister": boolean,
* "version": "",
* "version": "",
* "articleListStyle": "", // Optional values: "titleOnly"/"titleAndContent"/"titleAndAbstract"
* "articleListStyle": "", // Optional values: "titleOnly"/"titleAndContent"/"titleAndAbstract"
* "commentable": boolean,
* "commentable": boolean,
...
@@ -241,7 +240,6 @@ public class PreferenceConsole {
...
@@ -241,7 +240,6 @@ public class PreferenceConsole {
* "signHTML": ""
* "signHTML": ""
* }, ...],
* }, ...],
* "allowVisitDraftViaPermalink": boolean,
* "allowVisitDraftViaPermalink": boolean,
* "allowRegister": boolean,
* "articleListStyle": "",
* "articleListStyle": "",
* "commentable": boolean,
* "commentable": boolean,
* "feedOutputMode: "",
* "feedOutputMode: "",
...
...
src/main/java/org/b3log/solo/service/InitService.java
View file @
09c41fad
...
@@ -605,12 +605,6 @@ public class InitService {
...
@@ -605,12 +605,6 @@ public class InitService {
allowVisitDraftViaPermalinkOpt
.
put
(
Option
.
OPTION_VALUE
,
DefaultPreference
.
DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK
);
allowVisitDraftViaPermalinkOpt
.
put
(
Option
.
OPTION_VALUE
,
DefaultPreference
.
DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK
);
optionRepository
.
add
(
allowVisitDraftViaPermalinkOpt
);
optionRepository
.
add
(
allowVisitDraftViaPermalinkOpt
);
final
JSONObject
allowRegisterOpt
=
new
JSONObject
();
allowRegisterOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_ALLOW_REGISTER
);
allowRegisterOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
allowRegisterOpt
.
put
(
Option
.
OPTION_VALUE
,
DefaultPreference
.
DEFAULT_ALLOW_REGISTER
);
optionRepository
.
add
(
allowRegisterOpt
);
final
JSONObject
commentableOpt
=
new
JSONObject
();
final
JSONObject
commentableOpt
=
new
JSONObject
();
commentableOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_COMMENTABLE
);
commentableOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_COMMENTABLE
);
commentableOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
commentableOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
...
...
src/main/java/org/b3log/solo/service/OptionQueryService.java
View file @
09c41fad
...
@@ -63,17 +63,17 @@ public class OptionQueryService {
...
@@ -63,17 +63,17 @@ public class OptionQueryService {
}
}
/**
/**
* Checks whether allow
register
.
* Checks whether allow
comment globally
.
*
*
* @return {@code true} to allow
register
, returns {@code false} otherwise
* @return {@code true} to allow
comment
, returns {@code false} otherwise
*/
*/
public
boolean
allow
Register
()
{
public
boolean
allow
Comment
()
{
try
{
try
{
final
JSONObject
opt
=
optionRepository
.
get
(
Option
.
ID_C_
ALLOW_REGISTER
);
final
JSONObject
opt
=
optionRepository
.
get
(
Option
.
ID_C_
COMMENTABLE
);
return
opt
.
optBoolean
(
Option
.
OPTION_VALUE
);
return
opt
.
optBoolean
(
Option
.
OPTION_VALUE
);
}
catch
(
final
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Checks allow
register
failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Checks allow
comment
failed"
,
e
);
return
false
;
return
false
;
}
}
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
09c41fad
...
@@ -191,10 +191,6 @@ public class PreferenceMgmtService {
...
@@ -191,10 +191,6 @@ public class PreferenceMgmtService {
allowVisitDraftViaPermalinkOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
));
allowVisitDraftViaPermalinkOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
));
optionRepository
.
update
(
Option
.
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
,
allowVisitDraftViaPermalinkOpt
);
optionRepository
.
update
(
Option
.
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
,
allowVisitDraftViaPermalinkOpt
);
final
JSONObject
allowRegisterOpt
=
optionRepository
.
get
(
Option
.
ID_C_ALLOW_REGISTER
);
allowRegisterOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_ALLOW_REGISTER
));
optionRepository
.
update
(
Option
.
ID_C_ALLOW_REGISTER
,
allowRegisterOpt
);
final
JSONObject
articleListDisplayCountOpt
=
optionRepository
.
get
(
Option
.
ID_C_ARTICLE_LIST_DISPLAY_COUNT
);
final
JSONObject
articleListDisplayCountOpt
=
optionRepository
.
get
(
Option
.
ID_C_ARTICLE_LIST_DISPLAY_COUNT
);
articleListDisplayCountOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_ARTICLE_LIST_DISPLAY_COUNT
));
articleListDisplayCountOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_ARTICLE_LIST_DISPLAY_COUNT
));
optionRepository
.
update
(
Option
.
ID_C_ARTICLE_LIST_DISPLAY_COUNT
,
articleListDisplayCountOpt
);
optionRepository
.
update
(
Option
.
ID_C_ARTICLE_LIST_DISPLAY_COUNT
,
articleListDisplayCountOpt
);
...
...
src/main/java/org/b3log/solo/upgrade/V320_330.java
0 → 100644
View file @
09c41fad
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2019, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org
.
b3log
.
solo
.
upgrade
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.ioc.BeanManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.FilterOperator
;
import
org.b3log.latke.repository.PropertyFilter
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.repository.jdbc.util.Connections
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.repository.ArticleRepository
;
import
org.b3log.solo.repository.OptionRepository
;
import
org.json.JSONObject
;
import
java.sql.Connection
;
import
java.sql.Statement
;
import
java.util.List
;
/**
* Upgrade script from v3.2.0 to v3.3.0.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Mar 6, 2019
* @since 3.3.0
*/
public
final
class
V320_330
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
V320_330
.
class
);
/**
* Performs upgrade from v3.2.0 to v3.3.0.
*
* @throws Exception upgrade fails
*/
public
static
void
perform
()
throws
Exception
{
final
String
fromVer
=
"3.2.0"
;
final
String
toVer
=
"3.3.0"
;
LOGGER
.
log
(
Level
.
INFO
,
"Upgrading from version ["
+
fromVer
+
"] to version ["
+
toVer
+
"]...."
);
final
BeanManager
beanManager
=
BeanManager
.
getInstance
();
final
OptionRepository
optionRepository
=
beanManager
.
getReference
(
OptionRepository
.
class
);
final
ArticleRepository
articleRepository
=
beanManager
.
getReference
(
ArticleRepository
.
class
);
try
{
final
Transaction
transaction
=
optionRepository
.
beginTransaction
();
optionRepository
.
remove
(
"allowRegister"
);
final
JSONObject
versionOpt
=
optionRepository
.
get
(
Option
.
ID_C_VERSION
);
versionOpt
.
put
(
Option
.
OPTION_VALUE
,
toVer
);
optionRepository
.
update
(
Option
.
ID_C_VERSION
,
versionOpt
);
transaction
.
commit
();
LOGGER
.
log
(
Level
.
INFO
,
"Upgraded from version ["
+
fromVer
+
"] to version ["
+
toVer
+
"] successfully"
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Upgrade failed!"
,
e
);
throw
new
Exception
(
"Upgrade failed from version ["
+
fromVer
+
"] to version ["
+
toVer
+
"]"
);
}
}
}
src/main/resources/lang_en_US.properties
View file @
09c41fad
...
@@ -70,8 +70,6 @@ dynamicLabel=Dynamic
...
@@ -70,8 +70,6 @@ dynamicLabel=Dynamic
exportSQLLabel
=
Export SQL file
exportSQLLabel
=
Export SQL file
exportJSONLabel
=
Export JSON file
exportJSONLabel
=
Export JSON file
exportHexoLabel
=
Export Hexo file
exportHexoLabel
=
Export Hexo file
notAllowRegisterLabel
=
Not allow register
allowRegister1Label
=
Allow Register:
footerContent1Label
=
Footer:
footerContent1Label
=
Footer:
userAvatar1Label
=
Avatar:
userAvatar1Label
=
Avatar:
staticErrorLabel
=
<h2>Latke Configuraton Error</h2>
\
staticErrorLabel
=
<h2>Latke Configuraton Error</h2>
\
...
...
src/main/resources/lang_zh_CN.properties
View file @
09c41fad
...
@@ -70,8 +70,6 @@ dynamicLabel=\u52A8\u6001
...
@@ -70,8 +70,6 @@ dynamicLabel=\u52A8\u6001
exportSQLLabel
=
\u
5BFC
\u
51FA SQL
\u6587\u
4EF6
exportSQLLabel
=
\u
5BFC
\u
51FA SQL
\u6587\u
4EF6
exportJSONLabel
=
\u
5BFC
\u
51FA JSON
\u6587\u
4EF6
exportJSONLabel
=
\u
5BFC
\u
51FA JSON
\u6587\u
4EF6
exportHexoLabel
=
\u
5BFC
\u
51FA Hexo
\u6587\u
4EF6
exportHexoLabel
=
\u
5BFC
\u
51FA Hexo
\u6587\u
4EF6
notAllowRegisterLabel
=
\u6682\u
4E0D
\u
5F00
\u
653E
\u
6CE8
\u
518C
\u
FF01
allowRegister1Label
=
\u5141\u
8BB8
\u
6CE8
\u
518C
\u
FF1A
footerContent1Label
=
\u9875\u
811A
\u
FF1A
footerContent1Label
=
\u9875\u
811A
\u
FF1A
userAvatar1Label
=
\u5934\u
50CF
\u
FF1A
userAvatar1Label
=
\u5934\u
50CF
\u
FF1A
staticErrorLabel
=
<h2><a href='https://hacpai.com/tag/Latke' target='_blank'>Latke</a>
\u
914D
\u
7F6E
\u9519\u
8BEF</h2>
\
staticErrorLabel
=
<h2><a href='https://hacpai.com/tag/Latke' target='_blank'>Latke</a>
\u
914D
\u
7F6E
\u9519\u
8BEF</h2>
\
...
...
src/main/resources/local.properties
View file @
09c41fad
...
@@ -23,18 +23,18 @@
...
@@ -23,18 +23,18 @@
#
#
#### H2 runtime ####
#### H2 runtime ####
runtimeDatabase
=
H2
#
runtimeDatabase=H2
jdbc.username
=
root
#
jdbc.username=root
jdbc.password
=
#
jdbc.password=
jdbc.driver
=
org.h2.Driver
#
jdbc.driver=org.h2.Driver
jdbc.URL
=
jdbc:h2:~/solo_h2/db
#
jdbc.URL=jdbc:h2:~/solo_h2/db
#### MySQL runtime ####
#### MySQL runtime ####
#
runtimeDatabase=MYSQL
runtimeDatabase
=
MYSQL
#
jdbc.username=root
jdbc.username
=
root
#
jdbc.password=123456
jdbc.password
=
123456
#
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.driver
=
com.mysql.cj.jdbc.Driver
#
jdbc.URL=jdbc:mysql://localhost:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC
jdbc.URL
=
jdbc:mysql://localhost:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC
# The minConnCnt MUST larger or equal to 3
# The minConnCnt MUST larger or equal to 3
jdbc.minConnCnt
=
5
jdbc.minConnCnt
=
5
...
...
src/main/webapp/admin/admin-preference.ftl
View file @
09c41fad
...
@@ -106,8 +106,6 @@
...
@@ -106,8 +106,6 @@
<input id="allowVisitDraftViaPermalink" type="checkbox" class="normalInput"/>
<input id="allowVisitDraftViaPermalink" type="checkbox" class="normalInput"/>
<label for="commentable">${allowComment1Label}</label>
<label for="commentable">${allowComment1Label}</label>
<input id="commentable" type="checkbox" class="normalInput"/>
<input id="commentable" type="checkbox" class="normalInput"/>
<label for="allowRegister">${allowRegister1Label}</label>
<input id="allowRegister" type="checkbox" class="normalInput"/>
<label for="feedOutputMode">${feedOutputModel1Label}</label>
<label for="feedOutputMode">${feedOutputModel1Label}</label>
<select id="feedOutputMode">
<select id="feedOutputMode">
<option value="abstract">${abstractLabel}</option>
<option value="abstract">${abstractLabel}</option>
...
...
src/main/webapp/js/admin/admin.min.js
View file @
09c41fad
...
@@ -8,7 +8,7 @@ admin.draftList={tablePagination:new TablePaginate("draft"),init:function(t){thi
...
@@ -8,7 +8,7 @@ admin.draftList={tablePagination:new TablePaginate("draft"),init:function(t){thi
admin
.
pageList
=
{
tablePagination
:
new
TablePaginate
(
"
page
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
type
:
"
link
"
,
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
pageOrder
"
,
width
:
60
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
pageTitle
"
,
width
:
300
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
permalinkLabel
,
index
:
"
pagePermalink
"
,
minWidth
:
100
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
openMethodLabel
,
index
:
"
pageTarget
"
,
width
:
120
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
typeLabel
,
index
:
"
pageType
"
,
width
:
80
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
e
),
admin
.
editors
.
pageEditor
=
new
SoloEditor
({
id
:
"
pageContent
"
}),
$
(
"
.fn-type
"
).
click
(
function
(){
var
e
=
$
(
this
);
e
.
hasClass
(
"
selected
"
)
||
(
$
(
"
.fn-type
"
).
removeClass
(
"
selected
"
),
e
.
addClass
(
"
selected
"
),
admin
.
pageList
.
type
=
e
.
data
(
"
type
"
),
"
page
"
===
admin
.
pageList
.
type
?
$
(
"
#pagePagePanel
"
).
slideDown
():
$
(
"
#pagePagePanel
"
).
slideUp
())})},
getList
:
function
(
p
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/pages/
"
+
p
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
pages
,
n
=
[];
admin
.
pageList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
pageList
.
pageInfo
.
pageCount
=
0
===
e
.
pagination
.
paginationPageCount
?
1
:
e
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
){
n
[
i
]
=
{},
0
===
i
?
1
===
t
.
length
?
n
[
i
].
pageOrder
=
""
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span></div>
'
:
i
===
t
.
length
-
1
?
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
;
var
g
=
""
;
""
!==
t
[
i
].
pageIcon
&&
(
g
=
"
<img class='navigation-icon' src='
"
+
t
[
i
].
pageIcon
+
"
'/>
"
),
n
[
i
].
pageTitle
=
g
+
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pageTitle
+
"
</a>
"
,
n
[
i
].
pagePermalink
=
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pagePermalink
+
"
</a>
"
,
n
[
i
].
pageTarget
=
t
[
i
].
pageOpenTarget
,
n
[
i
].
pageType
=
t
[
i
].
pageType
,
n
[
i
].
comments
=
t
[
i
].
pageCommentCount
,
n
[
i
].
expendRow
=
"
<span><a href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.get('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
pageTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
t
[
i
].
oId
+
"
', 'page')
\"
>
"
+
Label
.
commentLabel
+
"
</a></span>
"
}
l
.
tablePagination
.
updateTablePagination
(
n
,
p
,
e
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
t
,
$
(
"
#pageTitle
"
).
val
(
e
.
page
.
pageTitle
),
$
(
"
#pagePermalink
"
).
val
(
e
.
page
.
pagePermalink
),
$
(
"
#pageTarget
"
).
val
(
e
.
page
.
pageOpenTarget
),
$
(
"
#pageIcon
"
).
val
(
e
.
page
.
pageIcon
),
"
page
"
===
e
.
page
.
pageType
?
$
(
$
(
"
.fn-type
"
).
get
(
1
)).
click
():
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
,
e
.
page
.
pageCommentable
),
admin
.
editors
.
pageEditor
.
setContent
(
e
.
page
.
pageContent
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
navLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
pageList
.
pageInfo
.
currentPage
;
1
===
admin
.
pageList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
(
admin
.
pageList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
pageList
.
pageInfo
.
pageCount
);
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
==
n
[
n
.
length
-
1
]?
admin
.
pageList
.
getList
(
t
):
admin
.
setHashByPage
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
admin
.
pageList
.
id
=
""
,
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
),
admin
.
pageList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
pageCount
++
;
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
pageList
.
pageInfo
.
pageCount
==
t
[
t
.
length
-
1
]?
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
pageCount
):
admin
.
setHashByPage
(
admin
.
pageList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
update
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
oId
:
this
.
id
,
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
""
,
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
validate
:
function
(){
if
(
""
===
$
(
"
#pageTitle
"
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#pageTitle
"
).
focus
();
else
{
if
(
"
link
"
!==
admin
.
pageList
.
type
||
""
!==
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
\s
/g
,
""
))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
linkEmptyLabel
)}
return
!
1
},
submit
:
function
(){
""
!==
this
.
id
?
this
.
update
():
this
.
add
()},
changeOrder
:
function
(
e
,
a
,
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
n
=
{
oId
:
e
.
toString
(),
direction
:
t
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
n
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
page-list
"
]
=
{
obj
:
admin
.
pageList
,
init
:
admin
.
pageList
.
init
,
refresh
:
admin
.
pageList
.
getList
};
admin
.
pageList
=
{
tablePagination
:
new
TablePaginate
(
"
page
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
type
:
"
link
"
,
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
pageOrder
"
,
width
:
60
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
pageTitle
"
,
width
:
300
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
permalinkLabel
,
index
:
"
pagePermalink
"
,
minWidth
:
100
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
openMethodLabel
,
index
:
"
pageTarget
"
,
width
:
120
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
typeLabel
,
index
:
"
pageType
"
,
width
:
80
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
e
),
admin
.
editors
.
pageEditor
=
new
SoloEditor
({
id
:
"
pageContent
"
}),
$
(
"
.fn-type
"
).
click
(
function
(){
var
e
=
$
(
this
);
e
.
hasClass
(
"
selected
"
)
||
(
$
(
"
.fn-type
"
).
removeClass
(
"
selected
"
),
e
.
addClass
(
"
selected
"
),
admin
.
pageList
.
type
=
e
.
data
(
"
type
"
),
"
page
"
===
admin
.
pageList
.
type
?
$
(
"
#pagePagePanel
"
).
slideDown
():
$
(
"
#pagePagePanel
"
).
slideUp
())})},
getList
:
function
(
p
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/pages/
"
+
p
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
pages
,
n
=
[];
admin
.
pageList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
pageList
.
pageInfo
.
pageCount
=
0
===
e
.
pagination
.
paginationPageCount
?
1
:
e
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
){
n
[
i
]
=
{},
0
===
i
?
1
===
t
.
length
?
n
[
i
].
pageOrder
=
""
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span></div>
'
:
i
===
t
.
length
-
1
?
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
;
var
g
=
""
;
""
!==
t
[
i
].
pageIcon
&&
(
g
=
"
<img class='navigation-icon' src='
"
+
t
[
i
].
pageIcon
+
"
'/>
"
),
n
[
i
].
pageTitle
=
g
+
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pageTitle
+
"
</a>
"
,
n
[
i
].
pagePermalink
=
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pagePermalink
+
"
</a>
"
,
n
[
i
].
pageTarget
=
t
[
i
].
pageOpenTarget
,
n
[
i
].
pageType
=
t
[
i
].
pageType
,
n
[
i
].
comments
=
t
[
i
].
pageCommentCount
,
n
[
i
].
expendRow
=
"
<span><a href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.get('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
pageTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
t
[
i
].
oId
+
"
', 'page')
\"
>
"
+
Label
.
commentLabel
+
"
</a></span>
"
}
l
.
tablePagination
.
updateTablePagination
(
n
,
p
,
e
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
t
,
$
(
"
#pageTitle
"
).
val
(
e
.
page
.
pageTitle
),
$
(
"
#pagePermalink
"
).
val
(
e
.
page
.
pagePermalink
),
$
(
"
#pageTarget
"
).
val
(
e
.
page
.
pageOpenTarget
),
$
(
"
#pageIcon
"
).
val
(
e
.
page
.
pageIcon
),
"
page
"
===
e
.
page
.
pageType
?
$
(
$
(
"
.fn-type
"
).
get
(
1
)).
click
():
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
,
e
.
page
.
pageCommentable
),
admin
.
editors
.
pageEditor
.
setContent
(
e
.
page
.
pageContent
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
navLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
pageList
.
pageInfo
.
currentPage
;
1
===
admin
.
pageList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
(
admin
.
pageList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
pageList
.
pageInfo
.
pageCount
);
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
==
n
[
n
.
length
-
1
]?
admin
.
pageList
.
getList
(
t
):
admin
.
setHashByPage
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
admin
.
pageList
.
id
=
""
,
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
),
admin
.
pageList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
pageCount
++
;
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
pageList
.
pageInfo
.
pageCount
==
t
[
t
.
length
-
1
]?
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
pageCount
):
admin
.
setHashByPage
(
admin
.
pageList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
update
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
oId
:
this
.
id
,
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
""
,
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
validate
:
function
(){
if
(
""
===
$
(
"
#pageTitle
"
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#pageTitle
"
).
focus
();
else
{
if
(
"
link
"
!==
admin
.
pageList
.
type
||
""
!==
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
\s
/g
,
""
))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
linkEmptyLabel
)}
return
!
1
},
submit
:
function
(){
""
!==
this
.
id
?
this
.
update
():
this
.
add
()},
changeOrder
:
function
(
e
,
a
,
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
n
=
{
oId
:
e
.
toString
(),
direction
:
t
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/page/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
n
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
page-list
"
]
=
{
obj
:
admin
.
pageList
,
init
:
admin
.
pageList
.
init
,
refresh
:
admin
.
pageList
.
getList
};
admin
.
others
=
{
init
:
function
(){
$
(
"
#tabOthers
"
).
tabs
(),
$
(
"
#loadMsg
"
).
text
(
""
)},
removeUnusedTags
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
)}})},
exportSQL
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/export/sql
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#tipMsg
"
).
text
(
t
.
msg
):
window
.
location
=
latkeConfig
.
servePath
+
"
/console/export/sql
"
}})},
exportJSON
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/export/json
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#tipMsg
"
).
text
(
t
.
msg
):
window
.
location
=
latkeConfig
.
servePath
+
"
/console/export/json
"
}})},
exportHexo
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/export/hexo
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#tipMsg
"
).
text
(
t
.
msg
):
window
.
location
=
latkeConfig
.
servePath
+
"
/console/export/hexo
"
}})},
getUnusedTags
:
function
(){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
)?
t
.
unusedTags
.
length
:
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
.
others
=
{
obj
:
admin
.
others
,
init
:
admin
.
others
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
others
=
{
init
:
function
(){
$
(
"
#tabOthers
"
).
tabs
(),
$
(
"
#loadMsg
"
).
text
(
""
)},
removeUnusedTags
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
)}})},
exportSQL
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/export/sql
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#tipMsg
"
).
text
(
t
.
msg
):
window
.
location
=
latkeConfig
.
servePath
+
"
/console/export/sql
"
}})},
exportJSON
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/export/json
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#tipMsg
"
).
text
(
t
.
msg
):
window
.
location
=
latkeConfig
.
servePath
+
"
/console/export/json
"
}})},
exportHexo
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/export/hexo
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#tipMsg
"
).
text
(
t
.
msg
):
window
.
location
=
latkeConfig
.
servePath
+
"
/console/export/hexo
"
}})},
getUnusedTags
:
function
(){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
)?
t
.
unusedTags
.
length
:
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
.
others
=
{
obj
:
admin
.
others
,
init
:
admin
.
others
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
linkList
=
{
tablePagination
:
new
TablePaginate
(
"
link
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
init
:
function
(
i
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkTitleLabel
,
index
:
"
linkTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
urlLabel
,
index
:
"
linkAddress
"
,
minWidth
:
180
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkDescriptionLabel
,
index
:
"
linkDescription
"
,
width
:
360
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
i
),
$
(
"
#updateLink
"
).
dialog
({
title
:
$
(
"
#updateLink
"
).
data
(
"
title
"
),
width
:
700
,
height
:
290
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
l
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
0
===
l
&&
(
l
=
1
),
this
.
pageInfo
.
currentPage
=
l
;
var
s
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/links/
"
+
l
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
i
.
links
,
t
=
[];
admin
.
linkList
.
pageInfo
.
currentCount
=
n
.
length
,
admin
.
linkList
.
pageInfo
.
pageCount
=
0
===
i
.
pagination
.
paginationPageCount
?
1
:
i
.
pagination
.
paginationPageCount
;
for
(
var
a
=
0
;
a
<
n
.
length
;
a
++
)
t
[
a
]
=
{},
0
===
a
?
1
===
n
.
length
?
t
[
a
].
linkOrder
=
""
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
a
===
n
.
length
-
1
?
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
t
[
a
].
linkTitle
=
n
[
a
].
linkTitle
,
t
[
a
].
linkAddress
=
"
<a target='_blank' class='no-underline' href='
"
+
n
[
a
].
linkAddress
+
"
'>
"
+
n
[
a
].
linkAddress
+
"
</a>
"
,
t
[
a
].
linkDescription
=
n
[
a
].
linkDescription
,
t
[
a
].
expendRow
=
"
<span><a href='
"
+
n
[
a
].
linkAddress
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.get('
"
+
n
[
a
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.del('
"
+
n
[
a
].
oId
+
"
', '
"
+
encodeURIComponent
(
n
[
a
].
linkTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a></span>
"
;
s
.
tablePagination
.
updateTablePagination
(
t
,
l
,
i
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitle
"
).
val
(),
linkAddress
:
$
(
"
#linkAddress
"
).
val
(),
linkDescription
:
$
(
"
#linkDescription
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
$
(
"
#linkTitle
"
).
val
(
""
),
$
(
"
#linkAddress
"
).
val
(
""
),
$
(
"
#linkDescription
"
).
val
(
""
),
admin
.
linkList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
pageCount
++
;
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
linkList
.
pageInfo
.
pageCount
!==
parseInt
(
n
[
n
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
linkList
.
pageInfo
.
pageCount
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#updateLink
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
+
n
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
(
admin
.
linkList
.
id
=
n
,
$
(
"
#linkTitleUpdate
"
).
val
(
i
.
link
.
linkTitle
),
$
(
"
#linkAddressUpdate
"
).
val
(
i
.
link
.
linkAddress
),
$
(
"
#linkDescriptionUpdate
"
).
val
(
i
.
link
.
linkDescription
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitleUpdate
"
).
val
(),
oId
:
this
.
id
,
linkAddress
:
$
(
"
#linkAddressUpdate
"
).
val
(),
linkDescription
:
$
(
"
#linkDescriptionUpdate
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
$
(
"
#updateLink
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
i
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
permalinkLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
+
i
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
admin
.
linkList
.
pageInfo
.
currentPage
;
1
===
admin
.
linkList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
(
admin
.
linkList
.
pageInfo
.
pageCount
--
,
n
=
admin
.
linkList
.
pageInfo
.
pageCount
);
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
n
!==
parseInt
(
t
[
t
.
length
-
1
])
&&
admin
.
setHashByPage
(
n
),
admin
.
linkList
.
getList
(
n
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
i
){
if
(
i
||
(
i
=
""
),
""
===
$
(
"
#linkTitle
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#linkTitle
"
+
i
).
focus
().
val
(
""
);
else
if
(
""
===
$
(
"
#linkAddress
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
addressEmptyLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
);
else
{
if
(
/^
\w
+:
\/\/
/
.
test
(
$
(
"
#linkAddress
"
+
i
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
addressInvalidLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
)}
return
!
1
},
changeOrder
:
function
(
i
,
e
,
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
oId
:
i
.
toString
(),
direction
:
n
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
link-list
"
]
=
{
obj
:
admin
.
linkList
,
init
:
admin
.
linkList
.
init
,
refresh
:
admin
.
linkList
.
getList
};
admin
.
linkList
=
{
tablePagination
:
new
TablePaginate
(
"
link
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
init
:
function
(
i
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkTitleLabel
,
index
:
"
linkTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
urlLabel
,
index
:
"
linkAddress
"
,
minWidth
:
180
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkDescriptionLabel
,
index
:
"
linkDescription
"
,
width
:
360
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
i
),
$
(
"
#updateLink
"
).
dialog
({
title
:
$
(
"
#updateLink
"
).
data
(
"
title
"
),
width
:
700
,
height
:
290
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
l
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
0
===
l
&&
(
l
=
1
),
this
.
pageInfo
.
currentPage
=
l
;
var
s
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/links/
"
+
l
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
i
.
links
,
t
=
[];
admin
.
linkList
.
pageInfo
.
currentCount
=
n
.
length
,
admin
.
linkList
.
pageInfo
.
pageCount
=
0
===
i
.
pagination
.
paginationPageCount
?
1
:
i
.
pagination
.
paginationPageCount
;
for
(
var
a
=
0
;
a
<
n
.
length
;
a
++
)
t
[
a
]
=
{},
0
===
a
?
1
===
n
.
length
?
t
[
a
].
linkOrder
=
""
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
a
===
n
.
length
-
1
?
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
t
[
a
].
linkTitle
=
n
[
a
].
linkTitle
,
t
[
a
].
linkAddress
=
"
<a target='_blank' class='no-underline' href='
"
+
n
[
a
].
linkAddress
+
"
'>
"
+
n
[
a
].
linkAddress
+
"
</a>
"
,
t
[
a
].
linkDescription
=
n
[
a
].
linkDescription
,
t
[
a
].
expendRow
=
"
<span><a href='
"
+
n
[
a
].
linkAddress
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.get('
"
+
n
[
a
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.del('
"
+
n
[
a
].
oId
+
"
', '
"
+
encodeURIComponent
(
n
[
a
].
linkTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a></span>
"
;
s
.
tablePagination
.
updateTablePagination
(
t
,
l
,
i
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitle
"
).
val
(),
linkAddress
:
$
(
"
#linkAddress
"
).
val
(),
linkDescription
:
$
(
"
#linkDescription
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
$
(
"
#linkTitle
"
).
val
(
""
),
$
(
"
#linkAddress
"
).
val
(
""
),
$
(
"
#linkDescription
"
).
val
(
""
),
admin
.
linkList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
pageCount
++
;
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
linkList
.
pageInfo
.
pageCount
!==
parseInt
(
n
[
n
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
linkList
.
pageInfo
.
pageCount
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#updateLink
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
+
n
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
(
admin
.
linkList
.
id
=
n
,
$
(
"
#linkTitleUpdate
"
).
val
(
i
.
link
.
linkTitle
),
$
(
"
#linkAddressUpdate
"
).
val
(
i
.
link
.
linkAddress
),
$
(
"
#linkDescriptionUpdate
"
).
val
(
i
.
link
.
linkDescription
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitleUpdate
"
).
val
(),
oId
:
this
.
id
,
linkAddress
:
$
(
"
#linkAddressUpdate
"
).
val
(),
linkDescription
:
$
(
"
#linkDescriptionUpdate
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
$
(
"
#updateLink
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
i
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
permalinkLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/
"
+
i
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
admin
.
linkList
.
pageInfo
.
currentPage
;
1
===
admin
.
linkList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
(
admin
.
linkList
.
pageInfo
.
pageCount
--
,
n
=
admin
.
linkList
.
pageInfo
.
pageCount
);
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
n
!==
parseInt
(
t
[
t
.
length
-
1
])
&&
admin
.
setHashByPage
(
n
),
admin
.
linkList
.
getList
(
n
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
i
){
if
(
i
||
(
i
=
""
),
""
===
$
(
"
#linkTitle
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#linkTitle
"
+
i
).
focus
().
val
(
""
);
else
if
(
""
===
$
(
"
#linkAddress
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
addressEmptyLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
);
else
{
if
(
/^
\w
+:
\/\/
/
.
test
(
$
(
"
#linkAddress
"
+
i
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
addressInvalidLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
)}
return
!
1
},
changeOrder
:
function
(
i
,
e
,
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
oId
:
i
.
toString
(),
direction
:
n
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/link/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
link-list
"
]
=
{
obj
:
admin
.
linkList
,
init
:
admin
.
linkList
.
init
,
refresh
:
admin
.
linkList
.
getList
};
admin
.
preference
=
{
locale
:
""
,
init
:
function
(){
$
(
"
#tabPreference
"
).
tabs
(),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
result
,
textStatus
){
if
(
$
(
"
#tipMsg
"
).
text
(
result
.
msg
),
result
.
sc
){
var
preference
=
result
.
preference
;
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
),
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
),
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
),
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
),
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
),
$
(
"
#localeString
"
).
val
(
preference
.
localeString
),
$
(
"
#timeZoneId
"
).
val
(
preference
.
timeZoneId
),
$
(
"
#noticeBoard
"
).
val
(
preference
.
noticeBoard
),
$
(
"
#footerContent
"
).
val
(
preference
.
footerContent
),
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
),
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
),
$
(
"
#randomArticlesDisplayCount
"
).
val
(
preference
.
randomArticlesDisplayCount
),
$
(
"
#customVars
"
).
val
(
preference
.
customVars
),
"
true
"
===
preference
.
enableArticleUpdateHint
?
$
(
"
#enableArticleUpdateHint
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
#enableArticleUpdateHint
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
allowVisitDraftViaPermalink
?
$
(
"
#allowVisitDraftViaPermalink
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
allowVisitDraftViaPermalink
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
allowRegister
?
$
(
"
#allowRegister
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
#allowRegister
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
),
admin
.
preference
.
locale
=
preference
.
localeString
,
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
preference
.
skinDirName
);
for
(
var
skins
=
eval
(
"
(
"
+
preference
.
skins
+
"
)
"
),
skinsHTML
=
""
,
i
=
0
;
i
<
skins
.
length
;
i
++
){
var
selectedClass
=
""
;
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
&&
(
selectedClass
+=
"
selected
"
),
skinsHTML
+=
'
<div class="fn__left skinItem
'
+
selectedClass
+
'
"><div class="ft__center">
'
+
skins
[
i
].
skinName
+
'
</div><img class="skinPreview" src="
'
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
'
/preview.png"/><div><button class="update small" data-name="
'
+
skins
[
i
].
skinDirName
+
'
">
'
+
Label
.
enableLabel
+
'
</button><button class="small" onclick="window.open(
\'
'
+
latkeConfig
.
servePath
+
"
?skin=
"
+
skins
[
i
].
skinName
+
"
')
\"
>
"
+
Label
.
previewLabel
+
"
</button></div></div>
"
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='fn__clear'></div>
"
),
$
(
"
.skinItem .update
"
).
click
(
function
(){
$
(
"
.skinItem
"
).
removeClass
(
"
selected
"
),
$
(
this
).
closest
(
"
.skinItem
"
).
addClass
(
"
selected
"
),
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
$
(
this
).
data
(
"
name
"
)),
admin
.
preference
.
update
()});
for
(
var
signs
=
eval
(
"
(
"
+
preference
.
signs
+
"
)
"
),
j
=
1
;
j
<
signs
.
length
;
j
++
)
$
(
"
#preferenceSign
"
+
j
).
val
(
signs
[
j
].
signHTML
);
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
),
$
(
"
#feedOutputMode
"
).
val
(
preference
.
feedOutputMode
),
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(){
return
/^
\d
+$/
.
test
(
$
(
"
#mostUsedTagDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#recentCommentDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostCommentArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostViewArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListPaginationWindowSize
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#randomArticlesDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#relevantArticlesDisplayCount
"
).
val
())?
!!
/^
\d
+$/
.
test
(
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
())
||
(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
externalRelevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
relevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#relevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
randomArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#randomArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
windowSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListPaginationWindowSize
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
pageSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostViewArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostViewArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostCommentArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostCommentArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexRecentCommentDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#recentCommentDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexTagDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostUsedTagDisplayCount
"
).
focus
(),
!
1
)},
update
:
function
(){
if
(
admin
.
preference
.
validate
()){
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
e
=
[{
oId
:
0
,
signHTML
:
""
},{
oId
:
1
,
signHTML
:
$
(
"
#preferenceSign1
"
).
val
()},{
oId
:
2
,
signHTML
:
$
(
"
#preferenceSign2
"
).
val
()},{
oId
:
3
,
signHTML
:
$
(
"
#preferenceSign3
"
).
val
()}],
t
=
{
preference
:{
metaKeywords
:
$
(
"
#metaKeywords
"
).
val
(),
metaDescription
:
$
(
"
#metaDescription
"
).
val
(),
blogTitle
:
$
(
"
#blogTitle
"
).
val
(),
blogSubtitle
:
$
(
"
#blogSubtitle
"
).
val
(),
mostCommentArticleDisplayCount
:
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(),
mostViewArticleDisplayCount
:
$
(
"
#mostViewArticleDisplayCount
"
).
val
(),
recentCommentDisplayCount
:
$
(
"
#recentCommentDisplayCount
"
).
val
(),
mostUsedTagDisplayCount
:
$
(
"
#mostUsedTagDisplayCount
"
).
val
(),
articleListDisplayCount
:
$
(
"
#articleListDisplayCount
"
).
val
(),
articleListPaginationWindowSize
:
$
(
"
#articleListPaginationWindowSize
"
).
val
(),
skinDirName
:
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
),
localeString
:
$
(
"
#localeString
"
).
val
(),
timeZoneId
:
$
(
"
#timeZoneId
"
).
val
(),
noticeBoard
:
$
(
"
#noticeBoard
"
).
val
(),
footerContent
:
$
(
"
#footerContent
"
).
val
(),
htmlHead
:
$
(
"
#htmlHead
"
).
val
(),
externalRelevantArticlesDisplayCount
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
relevantArticlesDisplayCount
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
randomArticlesDisplayCount
:
$
(
"
#randomArticlesDisplayCount
"
).
val
(),
enableArticleUpdateHint
:
$
(
"
#enableArticleUpdateHint
"
).
prop
(
"
checked
"
),
signs
:
e
,
allowVisitDraftViaPermalink
:
$
(
"
#allowVisitDraftViaPermalink
"
).
prop
(
"
checked
"
),
articleListStyle
:
$
(
"
#articleListDisplay
"
).
val
(),
feedOutputMode
:
$
(
"
#feedOutputMode
"
).
val
(),
feedOutputCnt
:
$
(
"
#feedOutputCnt
"
).
val
(),
commentable
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
),
allowRegister
:
$
(
"
#allowRegister
"
).
prop
(
"
checked
"
),
customVars
:
$
(
"
#customVars
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
&&
window
.
location
.
reload
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}}},
admin
.
register
.
preference
=
{
obj
:
admin
.
preference
,
init
:
admin
.
preference
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
preference
=
{
locale
:
""
,
init
:
function
(){
$
(
"
#tabPreference
"
).
tabs
(),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
result
,
textStatus
){
if
(
$
(
"
#tipMsg
"
).
text
(
result
.
msg
),
result
.
sc
){
var
preference
=
result
.
preference
;
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
),
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
),
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
),
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
),
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
),
$
(
"
#localeString
"
).
val
(
preference
.
localeString
),
$
(
"
#timeZoneId
"
).
val
(
preference
.
timeZoneId
),
$
(
"
#noticeBoard
"
).
val
(
preference
.
noticeBoard
),
$
(
"
#footerContent
"
).
val
(
preference
.
footerContent
),
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
),
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
),
$
(
"
#randomArticlesDisplayCount
"
).
val
(
preference
.
randomArticlesDisplayCount
),
$
(
"
#customVars
"
).
val
(
preference
.
customVars
),
"
true
"
===
preference
.
enableArticleUpdateHint
?
$
(
"
#enableArticleUpdateHint
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
#enableArticleUpdateHint
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
allowVisitDraftViaPermalink
?
$
(
"
#allowVisitDraftViaPermalink
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
allowVisitDraftViaPermalink
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
),
admin
.
preference
.
locale
=
preference
.
localeString
,
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
preference
.
skinDirName
);
for
(
var
skins
=
eval
(
"
(
"
+
preference
.
skins
+
"
)
"
),
skinsHTML
=
""
,
i
=
0
;
i
<
skins
.
length
;
i
++
){
var
selectedClass
=
""
;
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
&&
(
selectedClass
+=
"
selected
"
),
skinsHTML
+=
'
<div class="fn__left skinItem
'
+
selectedClass
+
'
"><div class="ft__center">
'
+
skins
[
i
].
skinName
+
'
</div><img class="skinPreview" src="
'
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
'
/preview.png"/><div><button class="update small" data-name="
'
+
skins
[
i
].
skinDirName
+
'
">
'
+
Label
.
enableLabel
+
'
</button><button class="small" onclick="window.open(
\'
'
+
latkeConfig
.
servePath
+
"
?skin=
"
+
skins
[
i
].
skinName
+
"
')
\"
>
"
+
Label
.
previewLabel
+
"
</button></div></div>
"
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='fn__clear'></div>
"
),
$
(
"
.skinItem .update
"
).
click
(
function
(){
$
(
"
.skinItem
"
).
removeClass
(
"
selected
"
),
$
(
this
).
closest
(
"
.skinItem
"
).
addClass
(
"
selected
"
),
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
$
(
this
).
data
(
"
name
"
)),
admin
.
preference
.
update
()});
for
(
var
signs
=
eval
(
"
(
"
+
preference
.
signs
+
"
)
"
),
j
=
1
;
j
<
signs
.
length
;
j
++
)
$
(
"
#preferenceSign
"
+
j
).
val
(
signs
[
j
].
signHTML
);
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
),
$
(
"
#feedOutputMode
"
).
val
(
preference
.
feedOutputMode
),
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(){
return
/^
\d
+$/
.
test
(
$
(
"
#mostUsedTagDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#recentCommentDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostCommentArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostViewArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListPaginationWindowSize
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#randomArticlesDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#relevantArticlesDisplayCount
"
).
val
())?
!!
/^
\d
+$/
.
test
(
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
())
||
(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
externalRelevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
relevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#relevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
randomArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#randomArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
windowSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListPaginationWindowSize
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
pageSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostViewArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostViewArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostCommentArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostCommentArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexRecentCommentDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#recentCommentDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexTagDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostUsedTagDisplayCount
"
).
focus
(),
!
1
)},
update
:
function
(){
if
(
admin
.
preference
.
validate
()){
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
e
=
[{
oId
:
0
,
signHTML
:
""
},{
oId
:
1
,
signHTML
:
$
(
"
#preferenceSign1
"
).
val
()},{
oId
:
2
,
signHTML
:
$
(
"
#preferenceSign2
"
).
val
()},{
oId
:
3
,
signHTML
:
$
(
"
#preferenceSign3
"
).
val
()}],
t
=
{
preference
:{
metaKeywords
:
$
(
"
#metaKeywords
"
).
val
(),
metaDescription
:
$
(
"
#metaDescription
"
).
val
(),
blogTitle
:
$
(
"
#blogTitle
"
).
val
(),
blogSubtitle
:
$
(
"
#blogSubtitle
"
).
val
(),
mostCommentArticleDisplayCount
:
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(),
mostViewArticleDisplayCount
:
$
(
"
#mostViewArticleDisplayCount
"
).
val
(),
recentCommentDisplayCount
:
$
(
"
#recentCommentDisplayCount
"
).
val
(),
mostUsedTagDisplayCount
:
$
(
"
#mostUsedTagDisplayCount
"
).
val
(),
articleListDisplayCount
:
$
(
"
#articleListDisplayCount
"
).
val
(),
articleListPaginationWindowSize
:
$
(
"
#articleListPaginationWindowSize
"
).
val
(),
skinDirName
:
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
),
localeString
:
$
(
"
#localeString
"
).
val
(),
timeZoneId
:
$
(
"
#timeZoneId
"
).
val
(),
noticeBoard
:
$
(
"
#noticeBoard
"
).
val
(),
footerContent
:
$
(
"
#footerContent
"
).
val
(),
htmlHead
:
$
(
"
#htmlHead
"
).
val
(),
externalRelevantArticlesDisplayCount
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
relevantArticlesDisplayCount
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
randomArticlesDisplayCount
:
$
(
"
#randomArticlesDisplayCount
"
).
val
(),
enableArticleUpdateHint
:
$
(
"
#enableArticleUpdateHint
"
).
prop
(
"
checked
"
),
signs
:
e
,
allowVisitDraftViaPermalink
:
$
(
"
#allowVisitDraftViaPermalink
"
).
prop
(
"
checked
"
),
articleListStyle
:
$
(
"
#articleListDisplay
"
).
val
(),
feedOutputMode
:
$
(
"
#feedOutputMode
"
).
val
(),
feedOutputCnt
:
$
(
"
#feedOutputCnt
"
).
val
(),
commentable
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
),
customVars
:
$
(
"
#customVars
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
&&
window
.
location
.
reload
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}}},
admin
.
register
.
preference
=
{
obj
:
admin
.
preference
,
init
:
admin
.
preference
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
pluginList
=
{
tablePagination
:
new
TablePaginate
(
"
plugin
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
pluginNameLabel
,
index
:
"
name
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
statusLabel
,
index
:
"
status
"
,
minWidth
:
80
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
200
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
versionLabel
,
index
:
"
version
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
$
(
"
#pluginSetting
"
).
dialog
({
width
:
700
,
height
:
180
,
modal
:
!
0
,
hideFooter
:
!
0
}),
this
.
getList
(
t
)},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/plugins/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
admin
.
pluginList
.
pageInfo
.
currentPage
=
n
;
for
(
var
a
=
t
.
plugins
,
i
=
0
;
i
<
a
.
length
;
i
++
)
a
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.changeStatus('
"
+
a
[
i
].
oId
+
"
', '
"
+
a
[
i
].
status
+
"
')
\"
>
"
,
"
ENABLED
"
===
a
[
i
].
status
?(
a
[
i
].
status
=
Label
.
enabledLabel
,
a
[
i
].
expendRow
+=
Label
.
disableLabel
):(
a
[
i
].
status
=
Label
.
disabledLabel
,
a
[
i
].
expendRow
+=
Label
.
enableLabel
),
a
[
i
].
expendRow
+=
"
</a>
"
,
"
{}
"
!=
a
[
i
].
setting
&&
(
a
[
i
].
expendRow
+=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.toSetting('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
settingLabel
+
"
</a>
"
);
l
.
tablePagination
.
updateTablePagination
(
t
.
plugins
,
n
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
toSetting
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
oId
:
t
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/plugin/toSetting
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
$
(
"
#pluginSetting
"
).
html
(
t
),
$
(
"
#pluginSetting
"
).
dialog
(
"
open
"
),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
changeStatus
:
function
(
t
,
e
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
a
=
{
oId
:
t
,
status
:
e
=
"
ENABLED
"
===
e
?
"
DISABLED
"
:
"
ENABLED
"
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/plugin/status/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
?(
$
(
"
#loadMsg
"
).
text
(
""
),
window
.
location
.
reload
()):
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
plugin-list
"
]
=
{
obj
:
admin
.
pluginList
,
init
:
admin
.
pluginList
.
init
,
refresh
:
function
(){
$
(
"
#loadMsg
"
).
text
(
""
)}};
admin
.
pluginList
=
{
tablePagination
:
new
TablePaginate
(
"
plugin
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
pluginNameLabel
,
index
:
"
name
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
statusLabel
,
index
:
"
status
"
,
minWidth
:
80
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
200
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
versionLabel
,
index
:
"
version
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
$
(
"
#pluginSetting
"
).
dialog
({
width
:
700
,
height
:
180
,
modal
:
!
0
,
hideFooter
:
!
0
}),
this
.
getList
(
t
)},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/plugins/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
admin
.
pluginList
.
pageInfo
.
currentPage
=
n
;
for
(
var
a
=
t
.
plugins
,
i
=
0
;
i
<
a
.
length
;
i
++
)
a
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.changeStatus('
"
+
a
[
i
].
oId
+
"
', '
"
+
a
[
i
].
status
+
"
')
\"
>
"
,
"
ENABLED
"
===
a
[
i
].
status
?(
a
[
i
].
status
=
Label
.
enabledLabel
,
a
[
i
].
expendRow
+=
Label
.
disableLabel
):(
a
[
i
].
status
=
Label
.
disabledLabel
,
a
[
i
].
expendRow
+=
Label
.
enableLabel
),
a
[
i
].
expendRow
+=
"
</a>
"
,
"
{}
"
!=
a
[
i
].
setting
&&
(
a
[
i
].
expendRow
+=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.toSetting('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
settingLabel
+
"
</a>
"
);
l
.
tablePagination
.
updateTablePagination
(
t
.
plugins
,
n
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
toSetting
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
oId
:
t
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/plugin/toSetting
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
$
(
"
#pluginSetting
"
).
html
(
t
),
$
(
"
#pluginSetting
"
).
dialog
(
"
open
"
),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
changeStatus
:
function
(
t
,
e
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
a
=
{
oId
:
t
,
status
:
e
=
"
ENABLED
"
===
e
?
"
DISABLED
"
:
"
ENABLED
"
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/plugin/status/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
?(
$
(
"
#loadMsg
"
).
text
(
""
),
window
.
location
.
reload
()):
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
plugin-list
"
]
=
{
obj
:
admin
.
pluginList
,
init
:
admin
.
pluginList
.
init
,
refresh
:
function
(){
$
(
"
#loadMsg
"
).
text
(
""
)}};
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:{
oId
:
""
,
userRole
:
""
},
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
userNameLabel
,
index
:
"
userName
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
roleLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
e
),
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
450
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
n
;
var
o
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/users/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
users
,
s
=
[];
if
(
admin
.
userList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
userList
.
pageInfo
.
pageCount
=
e
.
pagination
.
paginationPageCount
,
t
.
length
<
1
)
return
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
),
void
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
Label
.
uploadMsg
);
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
)
s
[
i
]
=
{},
s
[
i
].
userName
=
t
[
i
].
userName
,
"
adminRole
"
===
t
[
i
].
userRole
?(
s
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
,
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
):(
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
userName
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.changeRole('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
changeRoleLabel
+
"
</a>
"
,
"
defaultRole
"
===
t
[
i
].
userRole
?
s
[
i
].
isAdmin
=
Label
.
commonUserLabel
:
s
[
i
].
isAdmin
=
Label
.
visitorUserLabel
),
o
.
tablePagination
.
updateTablePagination
(
s
,
n
,
e
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
,
s
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
$
(
"
#userURLUpdate
"
).
val
(
e
.
user
.
userURL
),
$
(
"
#userAvatarUpdate
"
).
val
(
e
.
user
.
userAvatar
),
$
(
"
#userB3KeyUpdate
"
).
val
(
e
.
user
.
userB3Key
),
$
(
"
#userNameUpdate
"
).
val
(
e
.
user
.
userName
).
data
(
"
userInfo
"
,{
oId
:
t
,
userRole
:
s
})),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
),
a
=
{
userName
:
$
(
"
#userNameUpdate
"
).
val
(),
oId
:
e
.
oId
,
userURL
:
$
(
"
#userURLUpdate
"
).
val
(),
userRole
:
e
.
userRole
,
userAvatar
:
$
(
"
#userAvatarUpdate
"
).
val
(),
userB3Key
:
$
(
"
#userB3KeyUpdate
"
).
val
()};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
e
,
a
){
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
userLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
changeRole
:
function
(
e
){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/changeRole/
"
+
e
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(
e
){
e
||
(
e
=
""
);
var
a
=
$
(
"
#userName
"
+
e
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
return
!
(
a
.
length
<
2
||
20
<
a
.
length
)
||
(
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
),
$
(
"
#userName
"
+
e
).
focus
(),
!
1
)}},
admin
.
register
[
"
user-list
"
]
=
{
obj
:
admin
.
userList
,
init
:
admin
.
userList
.
init
,
refresh
:
admin
.
userList
.
getList
};
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:{
oId
:
""
,
userRole
:
""
},
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
userNameLabel
,
index
:
"
userName
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
roleLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
e
),
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
450
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
n
;
var
o
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/users/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
users
,
s
=
[];
if
(
admin
.
userList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
userList
.
pageInfo
.
pageCount
=
e
.
pagination
.
paginationPageCount
,
t
.
length
<
1
)
return
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
),
void
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
Label
.
uploadMsg
);
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
)
s
[
i
]
=
{},
s
[
i
].
userName
=
t
[
i
].
userName
,
"
adminRole
"
===
t
[
i
].
userRole
?(
s
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
,
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
):(
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
userName
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.changeRole('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
changeRoleLabel
+
"
</a>
"
,
"
defaultRole
"
===
t
[
i
].
userRole
?
s
[
i
].
isAdmin
=
Label
.
commonUserLabel
:
s
[
i
].
isAdmin
=
Label
.
visitorUserLabel
),
o
.
tablePagination
.
updateTablePagination
(
s
,
n
,
e
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
,
s
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
$
(
"
#userURLUpdate
"
).
val
(
e
.
user
.
userURL
),
$
(
"
#userAvatarUpdate
"
).
val
(
e
.
user
.
userAvatar
),
$
(
"
#userB3KeyUpdate
"
).
val
(
e
.
user
.
userB3Key
),
$
(
"
#userNameUpdate
"
).
val
(
e
.
user
.
userName
).
data
(
"
userInfo
"
,{
oId
:
t
,
userRole
:
s
})),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
),
a
=
{
userName
:
$
(
"
#userNameUpdate
"
).
val
(),
oId
:
e
.
oId
,
userURL
:
$
(
"
#userURLUpdate
"
).
val
(),
userRole
:
e
.
userRole
,
userAvatar
:
$
(
"
#userAvatarUpdate
"
).
val
(),
userB3Key
:
$
(
"
#userB3KeyUpdate
"
).
val
()};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
e
,
a
){
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
userLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
changeRole
:
function
(
e
){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/changeRole/
"
+
e
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(
e
){
e
||
(
e
=
""
);
var
a
=
$
(
"
#userName
"
+
e
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
return
!
(
a
.
length
<
2
||
20
<
a
.
length
)
||
(
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
),
$
(
"
#userName
"
+
e
).
focus
(),
!
1
)}},
admin
.
register
[
"
user-list
"
]
=
{
obj
:
admin
.
userList
,
init
:
admin
.
userList
.
init
,
refresh
:
admin
.
userList
.
getList
};
admin
.
categoryList
=
{
tablePagination
:
new
TablePaginate
(
"
category
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
categoryTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
"
URI
"
,
index
:
"
categoryURI
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
descriptionLabel
,
index
:
"
categoryDesc
"
,
minWidth
:
180
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
t
),
$
(
"
#categoryUpdate
"
).
dialog
({
title
:
$
(
"
#categoryUpdate
"
).
data
(
"
title
"
),
width
:
700
,
height
:
358
,
modal
:
!
0
,
hideFooter
:
!
0
}),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tags
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
if
(
!
(
t
.
tags
.
length
<=
0
)){
for
(
var
a
=
[],
o
=
0
;
o
<
t
.
tags
.
length
;
o
++
)
a
.
push
(
t
.
tags
[
o
].
tagTitle
);
$
(
"
#categoryTags
"
).
completed
({
height
:
160
,
buttonText
:
Label
.
selectLabel
,
data
:
a
}),
$
(
"
#loadMsg
"
).
text
(
""
)}}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
getList
:
function
(
g
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
g
;
var
n
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/categories/
"
+
g
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
var
a
=
t
.
categories
,
o
=
[];
admin
.
categoryList
.
pageInfo
.
currentCount
=
a
.
length
,
admin
.
categoryList
.
pageInfo
.
pageCount
=
0
===
t
.
pagination
.
paginationPageCount
?
1
:
t
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
o
[
i
]
=
{},
0
===
i
?
1
===
a
.
length
?
o
[
i
].
linkOrder
=
""
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
i
===
a
.
length
-
1
?
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
o
[
i
].
categoryTitle
=
a
[
i
].
categoryTitle
,
o
[
i
].
categoryURI
=
a
[
i
].
categoryURI
,
o
[
i
].
categoryDesc
=
a
[
i
].
categoryDescription
,
o
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.categoryList.get('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.categoryList.del('
"
+
a
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
a
[
i
].
categoryTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
;
n
.
tablePagination
.
updateTablePagination
(
o
,
g
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
categoryTitle
:
$
(
"
#categoryName
"
).
val
(),
categoryTags
:
$
(
"
#categoryTags
"
).
val
(),
categoryURI
:
$
(
"
#categoryURI
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDesc
"
).
val
()};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
$
(
"
#categoryName
"
).
val
(
""
),
$
(
"
#categoryTags
"
).
val
(
""
),
$
(
"
#categoryURI
"
).
val
(
""
),
$
(
"
#categoryDesc
"
).
val
(
""
),
admin
.
categoryList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
pageCount
++
;
var
a
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
categoryList
.
pageInfo
.
pageCount
!==
parseInt
(
a
[
a
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#categoryUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
+
a
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
$
(
"
#categoryNameUpdate
"
).
val
(
t
.
categoryTitle
).
data
(
"
oId
"
,
a
),
$
(
"
#categoryURIUpdate
"
).
val
(
t
.
categoryURI
),
$
(
"
#categoryDescUpdate
"
).
val
(
t
.
categoryDescription
),
$
(
"
#categoryTagsUpdate
"
).
val
(
t
.
categoryTags
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
categoryTitle
:
$
(
"
#categoryNameUpdate
"
).
val
(),
oId
:
$
(
"
#categoryNameUpdate
"
).
data
(
"
oId
"
),
categoryTags
:
$
(
"
#categoryTagsUpdate
"
).
val
(),
categoryURI
:
$
(
"
#categoryURIUpdate
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDescUpdate
"
).
val
()};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
t
,
e
){
$
(
"
#categoryUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
t
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
categoryLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
+
t
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
var
a
=
admin
.
categoryList
.
pageInfo
.
currentPage
;
1
===
admin
.
categoryList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
(
admin
.
categoryList
.
pageInfo
.
pageCount
--
,
a
=
admin
.
categoryList
.
pageInfo
.
pageCount
);
var
o
=
window
.
location
.
hash
.
split
(
"
/
"
);
a
!==
parseInt
(
o
[
o
.
length
-
1
])
&&
admin
.
setHashByPage
(
a
),
admin
.
categoryList
.
getList
(
a
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
t
){
t
||
(
t
=
""
);
var
e
=
$
(
"
#categoryName
"
+
t
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
e
.
length
<
2
||
32
<
e
.
length
)
$
(
"
#tipMsg
"
).
text
(
Label
.
categoryTooLongLabel
),
$
(
"
#categoryName
"
+
t
).
focus
();
else
{
if
(
""
!==
$
.
trim
(
$
(
"
#categoryTags
"
+
t
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
tagsEmptyLabel
),
$
(
"
#categoryTags
"
+
t
).
focus
()}
return
!
1
},
changeOrder
:
function
(
t
,
e
,
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
o
=
{
oId
:
t
.
toString
(),
direction
:
a
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
o
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
category-list
"
]
=
{
obj
:
admin
.
categoryList
,
init
:
admin
.
categoryList
.
init
,
refresh
:
admin
.
categoryList
.
getList
};
admin
.
categoryList
=
{
tablePagination
:
new
TablePaginate
(
"
category
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
categoryTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
"
URI
"
,
index
:
"
categoryURI
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
descriptionLabel
,
index
:
"
categoryDesc
"
,
minWidth
:
180
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
t
),
$
(
"
#categoryUpdate
"
).
dialog
({
title
:
$
(
"
#categoryUpdate
"
).
data
(
"
title
"
),
width
:
700
,
height
:
358
,
modal
:
!
0
,
hideFooter
:
!
0
}),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tags
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
if
(
!
(
t
.
tags
.
length
<=
0
)){
for
(
var
a
=
[],
o
=
0
;
o
<
t
.
tags
.
length
;
o
++
)
a
.
push
(
t
.
tags
[
o
].
tagTitle
);
$
(
"
#categoryTags
"
).
completed
({
height
:
160
,
buttonText
:
Label
.
selectLabel
,
data
:
a
}),
$
(
"
#loadMsg
"
).
text
(
""
)}}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
getList
:
function
(
g
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
g
;
var
n
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/categories/
"
+
g
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
var
a
=
t
.
categories
,
o
=
[];
admin
.
categoryList
.
pageInfo
.
currentCount
=
a
.
length
,
admin
.
categoryList
.
pageInfo
.
pageCount
=
0
===
t
.
pagination
.
paginationPageCount
?
1
:
t
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
o
[
i
]
=
{},
0
===
i
?
1
===
a
.
length
?
o
[
i
].
linkOrder
=
""
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
i
===
a
.
length
-
1
?
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
o
[
i
].
categoryTitle
=
a
[
i
].
categoryTitle
,
o
[
i
].
categoryURI
=
a
[
i
].
categoryURI
,
o
[
i
].
categoryDesc
=
a
[
i
].
categoryDescription
,
o
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.categoryList.get('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.categoryList.del('
"
+
a
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
a
[
i
].
categoryTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
;
n
.
tablePagination
.
updateTablePagination
(
o
,
g
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
categoryTitle
:
$
(
"
#categoryName
"
).
val
(),
categoryTags
:
$
(
"
#categoryTags
"
).
val
(),
categoryURI
:
$
(
"
#categoryURI
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDesc
"
).
val
()};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
$
(
"
#categoryName
"
).
val
(
""
),
$
(
"
#categoryTags
"
).
val
(
""
),
$
(
"
#categoryURI
"
).
val
(
""
),
$
(
"
#categoryDesc
"
).
val
(
""
),
admin
.
categoryList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
pageCount
++
;
var
a
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
categoryList
.
pageInfo
.
pageCount
!==
parseInt
(
a
[
a
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#categoryUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
+
a
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
$
(
"
#categoryNameUpdate
"
).
val
(
t
.
categoryTitle
).
data
(
"
oId
"
,
a
),
$
(
"
#categoryURIUpdate
"
).
val
(
t
.
categoryURI
),
$
(
"
#categoryDescUpdate
"
).
val
(
t
.
categoryDescription
),
$
(
"
#categoryTagsUpdate
"
).
val
(
t
.
categoryTags
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
categoryTitle
:
$
(
"
#categoryNameUpdate
"
).
val
(),
oId
:
$
(
"
#categoryNameUpdate
"
).
data
(
"
oId
"
),
categoryTags
:
$
(
"
#categoryTagsUpdate
"
).
val
(),
categoryURI
:
$
(
"
#categoryURIUpdate
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDescUpdate
"
).
val
()};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
t
,
e
){
$
(
"
#categoryUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
t
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
categoryLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/
"
+
t
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
var
a
=
admin
.
categoryList
.
pageInfo
.
currentPage
;
1
===
admin
.
categoryList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
(
admin
.
categoryList
.
pageInfo
.
pageCount
--
,
a
=
admin
.
categoryList
.
pageInfo
.
pageCount
);
var
o
=
window
.
location
.
hash
.
split
(
"
/
"
);
a
!==
parseInt
(
o
[
o
.
length
-
1
])
&&
admin
.
setHashByPage
(
a
),
admin
.
categoryList
.
getList
(
a
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
t
){
t
||
(
t
=
""
);
var
e
=
$
(
"
#categoryName
"
+
t
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
e
.
length
<
2
||
32
<
e
.
length
)
$
(
"
#tipMsg
"
).
text
(
Label
.
categoryTooLongLabel
),
$
(
"
#categoryName
"
+
t
).
focus
();
else
{
if
(
""
!==
$
.
trim
(
$
(
"
#categoryTags
"
+
t
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
tagsEmptyLabel
),
$
(
"
#categoryTags
"
+
t
).
focus
()}
return
!
1
},
changeOrder
:
function
(
t
,
e
,
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
o
=
{
oId
:
t
.
toString
(),
direction
:
a
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/category/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
o
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
category-list
"
]
=
{
obj
:
admin
.
categoryList
,
init
:
admin
.
categoryList
.
init
,
refresh
:
admin
.
categoryList
.
getList
};
...
...
src/main/webapp/js/admin/preference.js
View file @
09c41fad
...
@@ -78,9 +78,6 @@ admin.preference = {
...
@@ -78,9 +78,6 @@ admin.preference = {
'
true
'
===
preference
.
allowVisitDraftViaPermalink
?
$
(
'
true
'
===
preference
.
allowVisitDraftViaPermalink
?
$
(
'
#allowVisitDraftViaPermalink
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
#allowVisitDraftViaPermalink
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
allowVisitDraftViaPermalink
'
).
removeAttr
(
'
checked
'
)
'
allowVisitDraftViaPermalink
'
).
removeAttr
(
'
checked
'
)
'
true
'
===
preference
.
allowRegister
?
$
(
'
#allowRegister
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
#allowRegister
'
).
removeAttr
(
'
checked
'
)
'
true
'
===
preference
.
commentable
?
$
(
'
#commentable
'
).
'
true
'
===
preference
.
commentable
?
$
(
'
#commentable
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
commentable
'
).
removeAttr
(
'
checked
'
)
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
commentable
'
).
removeAttr
(
'
checked
'
)
...
@@ -258,7 +255,6 @@ admin.preference = {
...
@@ -258,7 +255,6 @@ admin.preference = {
'
feedOutputMode
'
:
$
(
'
#feedOutputMode
'
).
val
(),
'
feedOutputMode
'
:
$
(
'
#feedOutputMode
'
).
val
(),
'
feedOutputCnt
'
:
$
(
'
#feedOutputCnt
'
).
val
(),
'
feedOutputCnt
'
:
$
(
'
#feedOutputCnt
'
).
val
(),
'
commentable
'
:
$
(
'
#commentable
'
).
prop
(
'
checked
'
),
'
commentable
'
:
$
(
'
#commentable
'
).
prop
(
'
checked
'
),
'
allowRegister
'
:
$
(
'
#allowRegister
'
).
prop
(
'
checked
'
),
'
customVars
'
:
$
(
'
#customVars
'
).
val
(),
'
customVars
'
:
$
(
'
#customVars
'
).
val
(),
},
},
}
}
...
...
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