Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
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
Commits
40002d01
Commit
40002d01
authored
May 29, 2013
by
wangdx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the initial page listen to keydown event[ESC and ENTER]
parent
4a63380f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
645 additions
and
626 deletions
+645
-626
core/solo-core.iml
core/solo-core.iml
+0
-1
war/bae/solo-bae.iml
war/bae/solo-bae.iml
+0
-1
war/gae/solo-gae.iml
war/gae/solo-gae.iml
+0
-1
war/h2/solo-h2.iml
war/h2/solo-h2.iml
+0
-1
war/mysql/solo-mysql.iml
war/mysql/solo-mysql.iml
+0
-1
war/solo-war.iml
war/solo-war.iml
+15
-0
war/src/main/webapp/init.ftl
war/src/main/webapp/init.ftl
+9
-0
war/src/main/webapp/js/admin/latkeAdmin.js
war/src/main/webapp/js/admin/latkeAdmin.js
+621
-621
No files found.
core/solo-core.iml
View file @
40002d01
...
...
@@ -3,7 +3,6 @@
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
isTestSource=
"false"
/>
...
...
war/bae/solo-bae.iml
View file @
40002d01
...
...
@@ -16,7 +16,6 @@
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
...
...
war/gae/solo-gae.iml
View file @
40002d01
...
...
@@ -16,7 +16,6 @@
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
...
...
war/h2/solo-h2.iml
View file @
40002d01
...
...
@@ -16,7 +16,6 @@
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
...
...
war/mysql/solo-mysql.iml
View file @
40002d01
...
...
@@ -16,7 +16,6 @@
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
...
...
war/solo-war.iml
View file @
40002d01
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"FacetManager"
>
<facet
type=
"web"
name=
"Web"
>
<configuration>
<descriptors>
<deploymentDescriptor
name=
"web.xml"
url=
"file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml"
/>
</descriptors>
<webroots>
<root
url=
"file://$MODULE_DIR$/src/main/webapp"
relative=
"/"
/>
</webroots>
</configuration>
<facet
type=
"google-app-engine"
name=
"Google App Engine"
>
<configuration
/>
</facet>
</facet>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
...
...
war/src/main/webapp/init.ftl
View file @
40002d01
...
...
@@ -165,6 +165,14 @@
"
display
"
:
"
block
"
,
"
opacity
"
:
1
});
$
(
window
).
unbind
().
keydown
(
function
(
e
){
if
(
e
.
keyCode
==
27
){
// esc
$
(
returnTo
);
$
(
window
).
unbind
();
}
else
if
(
e
.
keyCode
==
13
){
// enter
$
(
initSys
);
}
});
}
};
...
...
@@ -192,6 +200,7 @@
};
if
(
confirm
(
"
${confirmInitLabel}
"
))
{
$
(
window
).
unbind
();
$
(
"
#tip
"
).
html
(
"
<img src='${staticServePath}/images/loading.gif'/> loading...
"
)
$
.
ajax
({
url
:
"
${contextPath}/init
"
,
...
...
war/src/main/webapp/js/admin/latkeAdmin.js
View file @
40002d01
...
...
@@ -2706,268 +2706,268 @@ admin.register["link-list"] = {
"
obj
"
:
admin
.
linkList
,
"
init
"
:
admin
.
linkList
.
init
,
"
refresh
"
:
admin
.
linkList
.
getList
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* preference for admin.
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.8, May 28, 2013
*/
/* preference 相关操作 */
admin
.
preference
=
{
locale
:
""
,
editorType
:
""
,
/*
* 初始化
*/
init
:
function
()
{
$
(
"
#tabPreference
"
).
tabs
();
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
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
);
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
);
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
);
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
);
$
(
"
#randomArticlesDisplayCount
"
).
val
(
preference
.
randomArticlesDisplayCount
);
$
(
"
#keyOfSolo
"
).
val
(
preference
.
keyOfSolo
);
preference
.
enableArticleUpdateHint
?
$
(
"
#enableArticleUpdateHint
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
#enableArticleUpdateHint
"
).
removeAttr
(
"
checked
"
);
preference
.
allowVisitDraftViaPermalink
?
$
(
"
#allowVisitDraftViaPermalink
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
allowVisitDraftViaPermalink
"
).
removeAttr
(
"
checked
"
);
admin
.
preference
.
locale
=
preference
.
localeString
;
admin
.
preference
.
editorType
=
preference
.
editorType
;
// skin
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
preference
.
skinDirName
);
var
skins
=
eval
(
'
(
'
+
preference
.
skins
+
'
)
'
);
var
skinsHTML
=
""
;
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
var
selectedClass
=
""
;
if
(
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
selectedClass
+=
"
selected
"
;
}
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
"
/preview.png'/><div>
"
+
skins
[
i
].
skinName
+
"
</div></div>
"
;
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='clear'></div>
"
);
$
(
"
.skinItem
"
).
click
(
function
()
{
$
(
"
.skinItem
"
).
removeClass
(
"
selected
"
);
$
(
this
).
addClass
(
"
selected
"
);
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
this
.
title
);
});
// sign
var
signs
=
eval
(
'
(
'
+
preference
.
signs
+
'
)
'
);
for
(
var
j
=
1
;
j
<
signs
.
length
;
j
++
)
{
$
(
"
#preferenceSign
"
+
j
).
val
(
signs
[
j
].
signHTML
);
$
(
"
#preferenceSignButton
"
+
j
).
tip
({
content
:
signs
[
j
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
j
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
),
position
:
"
bottom
"
});
}
// Article list style
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
);
// Editor Type
$
(
"
#editorType
"
).
val
(
preference
.
editorType
);
// Feed output
$
(
"
#feedOutputMode
"
).
val
(
preference
.
feedOutputMode
);
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
);
// Commentable
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* @description 参数校验
*/
validate
:
function
()
{
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#mostUsedTagDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexTagDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#mostUsedTagDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#recentCommentDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexRecentCommentDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#recentCommentDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#mostCommentArticleDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostCommentArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#mostCommentArticleDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#mostViewArticleDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostViewArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#mostViewArticleDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#articleListDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
pageSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#articleListDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#articleListPaginationWindowSize
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
windowSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#articleListPaginationWindowSize
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#randomArticlesDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
randomArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#randomArticlesDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#relevantArticlesDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
relevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#relevantArticlesDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
externalRelevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#externalRelevantArticlesDisplayCount
"
).
focus
();
return
false
;
}
return
true
;
},
/*
* @description 更新
*/
update
:
function
()
{
if
(
!
admin
.
preference
.
validate
())
{
return
;
}
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
signs
=
[{
"
oId
"
:
0
,
"
signHTML
"
:
""
},
{
"
oId
"
:
1
,
"
signHTML
"
:
$
(
"
#preferenceSign1
"
).
val
()
},
{
"
oId
"
:
2
,
"
signHTML
"
:
$
(
"
#preferenceSign2
"
).
val
()
},
{
"
oId
"
:
3
,
"
signHTML
"
:
$
(
"
#preferenceSign3
"
).
val
()
}];
var
requestJSONObject
=
{
"
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
(),
"
htmlHead
"
:
$
(
"
#htmlHead
"
).
val
(),
"
externalRelevantArticlesDisplayCount
"
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
"
relevantArticlesDisplayCount
"
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
"
randomArticlesDisplayCount
"
:
$
(
"
#randomArticlesDisplayCount
"
).
val
(),
"
enableArticleUpdateHint
"
:
$
(
"
#enableArticleUpdateHint
"
).
prop
(
"
checked
"
),
"
signs
"
:
signs
,
"
keyOfSolo
"
:
$
(
"
#keyOfSolo
"
).
val
(),
"
allowVisitDraftViaPermalink
"
:
$
(
"
#allowVisitDraftViaPermalink
"
).
prop
(
"
checked
"
),
"
articleListStyle
"
:
$
(
"
#articleListDisplay
"
).
val
(),
"
editorType
"
:
$
(
"
#editorType
"
).
val
(),
"
feedOutputMode
"
:
$
(
"
#feedOutputMode
"
).
val
(),
"
feedOutputCnt
"
:
$
(
"
#feedOutputCnt
"
).
val
(),
"
commentable
"
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
)
}
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
if
(
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
||
$
(
"
#editorType
"
).
val
()
!==
admin
.
preference
.
editorType
)
{
window
.
location
.
reload
();
}
// update article and preferences signs
for
(
var
i
=
1
;
i
<
signs
.
length
;
i
++
)
{
if
(
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
length
===
1
)
{
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
$
(
"
#preferenceSignButton
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
};
/*
* 注册到 admin 进行管理
*/
admin
.
register
[
"
preference
"
]
=
{
"
obj
"
:
admin
.
preference
,
"
init
"
:
admin
.
preference
.
init
,
"
refresh
"
:
function
()
{
admin
.
clearTip
();
}
};
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* preference for admin.
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.8, May 28, 2013
*/
/* preference 相关操作 */
admin
.
preference
=
{
locale
:
""
,
editorType
:
""
,
/*
* 初始化
*/
init
:
function
()
{
$
(
"
#tabPreference
"
).
tabs
();
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
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
);
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
);
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
);
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
);
$
(
"
#randomArticlesDisplayCount
"
).
val
(
preference
.
randomArticlesDisplayCount
);
$
(
"
#keyOfSolo
"
).
val
(
preference
.
keyOfSolo
);
preference
.
enableArticleUpdateHint
?
$
(
"
#enableArticleUpdateHint
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
#enableArticleUpdateHint
"
).
removeAttr
(
"
checked
"
);
preference
.
allowVisitDraftViaPermalink
?
$
(
"
#allowVisitDraftViaPermalink
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
allowVisitDraftViaPermalink
"
).
removeAttr
(
"
checked
"
);
admin
.
preference
.
locale
=
preference
.
localeString
;
admin
.
preference
.
editorType
=
preference
.
editorType
;
// skin
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
preference
.
skinDirName
);
var
skins
=
eval
(
'
(
'
+
preference
.
skins
+
'
)
'
);
var
skinsHTML
=
""
;
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
var
selectedClass
=
""
;
if
(
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
selectedClass
+=
"
selected
"
;
}
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
"
/preview.png'/><div>
"
+
skins
[
i
].
skinName
+
"
</div></div>
"
;
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='clear'></div>
"
);
$
(
"
.skinItem
"
).
click
(
function
()
{
$
(
"
.skinItem
"
).
removeClass
(
"
selected
"
);
$
(
this
).
addClass
(
"
selected
"
);
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
this
.
title
);
});
// sign
var
signs
=
eval
(
'
(
'
+
preference
.
signs
+
'
)
'
);
for
(
var
j
=
1
;
j
<
signs
.
length
;
j
++
)
{
$
(
"
#preferenceSign
"
+
j
).
val
(
signs
[
j
].
signHTML
);
$
(
"
#preferenceSignButton
"
+
j
).
tip
({
content
:
signs
[
j
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
j
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
),
position
:
"
bottom
"
});
}
// Article list style
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
);
// Editor Type
$
(
"
#editorType
"
).
val
(
preference
.
editorType
);
// Feed output
$
(
"
#feedOutputMode
"
).
val
(
preference
.
feedOutputMode
);
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
);
// Commentable
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* @description 参数校验
*/
validate
:
function
()
{
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#mostUsedTagDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexTagDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#mostUsedTagDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#recentCommentDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexRecentCommentDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#recentCommentDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#mostCommentArticleDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostCommentArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#mostCommentArticleDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#mostViewArticleDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostViewArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#mostViewArticleDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#articleListDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
pageSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#articleListDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#articleListPaginationWindowSize
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
windowSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#articleListPaginationWindowSize
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#randomArticlesDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
randomArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#randomArticlesDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#relevantArticlesDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
relevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#relevantArticlesDisplayCount
"
).
focus
();
return
false
;
}
else
if
(
!
/^
\d
+$/
.
test
(
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
externalRelevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
);
$
(
"
#externalRelevantArticlesDisplayCount
"
).
focus
();
return
false
;
}
return
true
;
},
/*
* @description 更新
*/
update
:
function
()
{
if
(
!
admin
.
preference
.
validate
())
{
return
;
}
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
signs
=
[{
"
oId
"
:
0
,
"
signHTML
"
:
""
},
{
"
oId
"
:
1
,
"
signHTML
"
:
$
(
"
#preferenceSign1
"
).
val
()
},
{
"
oId
"
:
2
,
"
signHTML
"
:
$
(
"
#preferenceSign2
"
).
val
()
},
{
"
oId
"
:
3
,
"
signHTML
"
:
$
(
"
#preferenceSign3
"
).
val
()
}];
var
requestJSONObject
=
{
"
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
(),
"
htmlHead
"
:
$
(
"
#htmlHead
"
).
val
(),
"
externalRelevantArticlesDisplayCount
"
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
"
relevantArticlesDisplayCount
"
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
"
randomArticlesDisplayCount
"
:
$
(
"
#randomArticlesDisplayCount
"
).
val
(),
"
enableArticleUpdateHint
"
:
$
(
"
#enableArticleUpdateHint
"
).
prop
(
"
checked
"
),
"
signs
"
:
signs
,
"
keyOfSolo
"
:
$
(
"
#keyOfSolo
"
).
val
(),
"
allowVisitDraftViaPermalink
"
:
$
(
"
#allowVisitDraftViaPermalink
"
).
prop
(
"
checked
"
),
"
articleListStyle
"
:
$
(
"
#articleListDisplay
"
).
val
(),
"
editorType
"
:
$
(
"
#editorType
"
).
val
(),
"
feedOutputMode
"
:
$
(
"
#feedOutputMode
"
).
val
(),
"
feedOutputCnt
"
:
$
(
"
#feedOutputCnt
"
).
val
(),
"
commentable
"
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
)
}
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
if
(
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
||
$
(
"
#editorType
"
).
val
()
!==
admin
.
preference
.
editorType
)
{
window
.
location
.
reload
();
}
// update article and preferences signs
for
(
var
i
=
1
;
i
<
signs
.
length
;
i
++
)
{
if
(
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
length
===
1
)
{
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
$
(
"
#preferenceSignButton
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
};
/*
* 注册到 admin 进行管理
*/
admin
.
register
[
"
preference
"
]
=
{
"
obj
"
:
admin
.
preference
,
"
init
"
:
admin
.
preference
.
init
,
"
refresh
"
:
function
()
{
admin
.
clearTip
();
}
};
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
...
...
@@ -3144,365 +3144,365 @@ admin.register["plugin-list"] = {
admin
.
claerTip
();
}
};
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* user list for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.7, May 28, 2013
*/
/* user-list 相关操作 */
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:
{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:
{
'
oId
'
:
""
,
"
userRole
"
:
""
},
/*
* 初始化 table, pagination
*/
init
:
function
(
page
)
{
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentNameLabel
,
index
:
"
userName
"
,
width
:
230
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentEmailLabel
,
index
:
"
userEmail
"
,
minWidth
:
180
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
roleLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]);
this
.
tablePagination
.
initPagination
();
this
.
getList
(
page
);
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
230
,
"
modal
"
:
true
,
"
hideFooter
"
:
true
});
},
/*
* 根据当前页码获取列表
* @pagNum 当前页码
*/
getList
:
function
(
pageNum
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
this
.
pageInfo
.
currentPage
=
pageNum
;
var
that
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/users/
"
+
pageNum
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
users
=
result
.
users
;
var
userData
=
[];
admin
.
userList
.
pageInfo
.
currentCount
=
users
.
length
;
admin
.
userList
.
pageInfo
.
pageCount
=
result
.
pagination
.
paginationPageCount
;
if
(
users
.
length
<
1
)
{
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
for
(
var
i
=
0
;
i
<
users
.
length
;
i
++
)
{
userData
[
i
]
=
{};
userData
[
i
].
userName
=
users
[
i
].
userName
;
userData
[
i
].
userEmail
=
users
[
i
].
userEmail
;
if
(
"
adminRole
"
===
users
[
i
].
userRole
)
{
userData
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
;
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
;
}
else
{
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
\
<a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userName
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
+
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.changeRole('
"
+
users
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
changeRoleLabel
+
"
</a>
"
;
if
(
"
defaultRole
"
===
users
[
i
].
userRole
)
{
userData
[
i
].
isAdmin
=
Label
.
commonUserLabel
;
}
else
{
userData
[
i
].
isAdmin
=
Label
.
visitorUserLabel
;
}
}
that
.
tablePagination
.
updateTablePagination
(
userData
,
pageNum
,
result
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
},
/*
* 添加用户
*/
add
:
function
()
{
if
(
this
.
validate
())
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userName
"
).
val
(),
"
userEmail
"
:
$
(
"
#userEmail
"
).
val
(),
"
userURL
"
:
$
(
"
#userURL
"
).
val
(),
"
userPassword
"
:
$
(
"
#userPassword
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
POST
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
$
(
"
#userName
"
).
val
(
""
);
$
(
"
#userEmail
"
).
val
(
""
);
$
(
"
#userURL
"
).
val
(
""
);
$
(
"
#userPassword
"
).
val
(
""
);
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
++
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
admin
.
userList
.
pageInfo
.
pageCount
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
admin
.
userList
.
pageInfo
.
pageCount
);
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
pageCount
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 获取用户
* @id 用户 id
*/
get
:
function
(
id
,
userRole
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
$userEmailUpdate
=
$
(
"
#userEmailUpdate
"
);
$
(
"
#userNameUpdate
"
).
val
(
result
.
user
.
userName
).
data
(
"
userInfo
"
,
{
'
oId
'
:
id
,
"
userRole
"
:
userRole
});
$userEmailUpdate
.
val
(
result
.
user
.
userEmail
);
if
(
"
adminRole
"
===
userRole
)
{
$userEmailUpdate
.
attr
(
"
disabled
"
,
"
disabled
"
);
}
else
{
$userEmailUpdate
.
removeAttr
(
"
disabled
"
);
}
$
(
"
#userURLUpdate
"
).
val
(
result
.
user
.
userURL
);
$
(
"
#userPasswordUpdate
"
).
val
(
result
.
user
.
userPassword
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 更新用户
*/
update
:
function
()
{
if
(
this
.
validate
(
"
Update
"
))
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
userInfo
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userNameUpdate
"
).
val
(),
"
oId
"
:
userInfo
.
oId
,
"
userEmail
"
:
$
(
"
#userEmailUpdate
"
).
val
(),
"
userURL
"
:
$
(
"
#userURLUpdate
"
).
val
(),
"
userRole
"
:
userInfo
.
userRole
,
"
userPassword
"
:
$
(
"
#userPasswordUpdate
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 删除用户
* @id 用户 id
* @userName 用户名称
*/
del
:
function
(
id
,
userName
)
{
var
isDelete
=
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
userLabel
+
'
"
'
+
userName
+
'
"?
'
);
if
(
isDelete
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
DELETE
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
pageNum
=
admin
.
userList
.
pageInfo
.
currentPage
;
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
1
&&
admin
.
userList
.
pageInfo
.
pageCount
!==
1
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
--
;
pageNum
=
admin
.
userList
.
pageInfo
.
pageCount
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
pageNum
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
pageNum
);
}
admin
.
userList
.
getList
(
pageNum
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/**
* 修改角色
* @param id
*/
changeRole
:
function
(
id
)
{
$
(
"
#tipMsg
"
).
text
(
""
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/changeRole/
"
+
id
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
pageNum
=
admin
.
userList
.
pageInfo
.
currentPage
;
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
1
&&
admin
.
userList
.
pageInfo
.
pageCount
!==
1
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
--
;
pageNum
=
admin
.
userList
.
pageInfo
.
pageCount
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
pageNum
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
pageNum
);
}
admin
.
userList
.
getList
(
pageNum
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 验证字段
* @status 更新或者添加时进行验证
*/
validate
:
function
(
status
)
{
if
(
!
status
)
{
status
=
""
;
}
var
userName
=
$
(
"
#userName
"
+
status
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
userName
.
length
||
userName
.
length
>
20
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
);
$
(
"
#userName
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userEmail
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailCannotEmptyLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
!
/^
((([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
(\.([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
)
*
)
|
((\x
22
)((((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(([\x
01-
\x
08
\x
0b
\x
0c
\x
0e-
\x
1f
\x
7f
]
|
\x
21|
[\x
23-
\x
5b
]
|
[\x
5d-
\x
7e
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(\\([\x
01-
\x
09
\x
0b
\x
0c
\x
0d-
\x
7f
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
]))))
*
(((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(\x
22
)))
@
((([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.)
+
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.?
$/i
.
test
(
$
(
"
#userEmail
"
+
status
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailInvalidLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userPassword
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
passwordEmptyLabel
);
$
(
"
#userPassword
"
+
status
).
focus
();
}
else
{
return
true
;
}
return
false
;
}
};
/*
* 注册到 admin 进行管理
*/
admin
.
register
[
"
user-list
"
]
=
{
"
obj
"
:
admin
.
userList
,
"
init
"
:
admin
.
userList
.
init
,
"
refresh
"
:
function
()
{
admin
.
clearTip
();
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* user list for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.7, May 28, 2013
*/
/* user-list 相关操作 */
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:
{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:
{
'
oId
'
:
""
,
"
userRole
"
:
""
},
/*
* 初始化 table, pagination
*/
init
:
function
(
page
)
{
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentNameLabel
,
index
:
"
userName
"
,
width
:
230
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentEmailLabel
,
index
:
"
userEmail
"
,
minWidth
:
180
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
roleLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]);
this
.
tablePagination
.
initPagination
();
this
.
getList
(
page
);
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
230
,
"
modal
"
:
true
,
"
hideFooter
"
:
true
});
},
/*
* 根据当前页码获取列表
* @pagNum 当前页码
*/
getList
:
function
(
pageNum
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
this
.
pageInfo
.
currentPage
=
pageNum
;
var
that
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/users/
"
+
pageNum
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
users
=
result
.
users
;
var
userData
=
[];
admin
.
userList
.
pageInfo
.
currentCount
=
users
.
length
;
admin
.
userList
.
pageInfo
.
pageCount
=
result
.
pagination
.
paginationPageCount
;
if
(
users
.
length
<
1
)
{
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
for
(
var
i
=
0
;
i
<
users
.
length
;
i
++
)
{
userData
[
i
]
=
{};
userData
[
i
].
userName
=
users
[
i
].
userName
;
userData
[
i
].
userEmail
=
users
[
i
].
userEmail
;
if
(
"
adminRole
"
===
users
[
i
].
userRole
)
{
userData
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
;
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
;
}
else
{
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
\
<a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userName
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
+
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.changeRole('
"
+
users
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
changeRoleLabel
+
"
</a>
"
;
if
(
"
defaultRole
"
===
users
[
i
].
userRole
)
{
userData
[
i
].
isAdmin
=
Label
.
commonUserLabel
;
}
else
{
userData
[
i
].
isAdmin
=
Label
.
visitorUserLabel
;
}
}
that
.
tablePagination
.
updateTablePagination
(
userData
,
pageNum
,
result
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
},
/*
* 添加用户
*/
add
:
function
()
{
if
(
this
.
validate
())
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userName
"
).
val
(),
"
userEmail
"
:
$
(
"
#userEmail
"
).
val
(),
"
userURL
"
:
$
(
"
#userURL
"
).
val
(),
"
userPassword
"
:
$
(
"
#userPassword
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
POST
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
$
(
"
#userName
"
).
val
(
""
);
$
(
"
#userEmail
"
).
val
(
""
);
$
(
"
#userURL
"
).
val
(
""
);
$
(
"
#userPassword
"
).
val
(
""
);
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
++
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
admin
.
userList
.
pageInfo
.
pageCount
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
admin
.
userList
.
pageInfo
.
pageCount
);
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
pageCount
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 获取用户
* @id 用户 id
*/
get
:
function
(
id
,
userRole
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
$userEmailUpdate
=
$
(
"
#userEmailUpdate
"
);
$
(
"
#userNameUpdate
"
).
val
(
result
.
user
.
userName
).
data
(
"
userInfo
"
,
{
'
oId
'
:
id
,
"
userRole
"
:
userRole
});
$userEmailUpdate
.
val
(
result
.
user
.
userEmail
);
if
(
"
adminRole
"
===
userRole
)
{
$userEmailUpdate
.
attr
(
"
disabled
"
,
"
disabled
"
);
}
else
{
$userEmailUpdate
.
removeAttr
(
"
disabled
"
);
}
$
(
"
#userURLUpdate
"
).
val
(
result
.
user
.
userURL
);
$
(
"
#userPasswordUpdate
"
).
val
(
result
.
user
.
userPassword
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 更新用户
*/
update
:
function
()
{
if
(
this
.
validate
(
"
Update
"
))
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
userInfo
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userNameUpdate
"
).
val
(),
"
oId
"
:
userInfo
.
oId
,
"
userEmail
"
:
$
(
"
#userEmailUpdate
"
).
val
(),
"
userURL
"
:
$
(
"
#userURLUpdate
"
).
val
(),
"
userRole
"
:
userInfo
.
userRole
,
"
userPassword
"
:
$
(
"
#userPasswordUpdate
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 删除用户
* @id 用户 id
* @userName 用户名称
*/
del
:
function
(
id
,
userName
)
{
var
isDelete
=
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
userLabel
+
'
"
'
+
userName
+
'
"?
'
);
if
(
isDelete
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
DELETE
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
pageNum
=
admin
.
userList
.
pageInfo
.
currentPage
;
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
1
&&
admin
.
userList
.
pageInfo
.
pageCount
!==
1
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
--
;
pageNum
=
admin
.
userList
.
pageInfo
.
pageCount
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
pageNum
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
pageNum
);
}
admin
.
userList
.
getList
(
pageNum
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/**
* 修改角色
* @param id
*/
changeRole
:
function
(
id
)
{
$
(
"
#tipMsg
"
).
text
(
""
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/changeRole/
"
+
id
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
pageNum
=
admin
.
userList
.
pageInfo
.
currentPage
;
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
1
&&
admin
.
userList
.
pageInfo
.
pageCount
!==
1
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
--
;
pageNum
=
admin
.
userList
.
pageInfo
.
pageCount
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
pageNum
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
pageNum
);
}
admin
.
userList
.
getList
(
pageNum
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 验证字段
* @status 更新或者添加时进行验证
*/
validate
:
function
(
status
)
{
if
(
!
status
)
{
status
=
""
;
}
var
userName
=
$
(
"
#userName
"
+
status
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
userName
.
length
||
userName
.
length
>
20
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
);
$
(
"
#userName
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userEmail
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailCannotEmptyLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
!
/^
((([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
(\.([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
)
*
)
|
((\x
22
)((((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(([\x
01-
\x
08
\x
0b
\x
0c
\x
0e-
\x
1f
\x
7f
]
|
\x
21|
[\x
23-
\x
5b
]
|
[\x
5d-
\x
7e
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(\\([\x
01-
\x
09
\x
0b
\x
0c
\x
0d-
\x
7f
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
]))))
*
(((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(\x
22
)))
@
((([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.)
+
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.?
$/i
.
test
(
$
(
"
#userEmail
"
+
status
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailInvalidLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userPassword
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
passwordEmptyLabel
);
$
(
"
#userPassword
"
+
status
).
focus
();
}
else
{
return
true
;
}
return
false
;
}
};
/*
* 注册到 admin 进行管理
*/
admin
.
register
[
"
user-list
"
]
=
{
"
obj
"
:
admin
.
userList
,
"
init
"
:
admin
.
userList
.
init
,
"
refresh
"
:
function
()
{
admin
.
clearTip
();
}
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
...
...
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