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
32962daa
Unverified
Commit
32962daa
authored
Sep 28, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
#12515 移除自定义模板方法
parent
d6e5c614
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
98 deletions
+0
-98
src/main/java/org/b3log/solo/processor/util/FillTagArticles.java
...n/java/org/b3log/solo/processor/util/FillTagArticles.java
+0
-95
src/main/java/org/b3log/solo/service/DataModelService.java
src/main/java/org/b3log/solo/service/DataModelService.java
+0
-3
No files found.
src/main/java/org/b3log/solo/processor/util/FillTagArticles.java
deleted
100644 → 0
View file @
d6e5c614
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2018, 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
.
processor
.
util
;
import
freemarker.template.TemplateMethodModelEx
;
import
freemarker.template.TemplateModelException
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.ioc.inject.Inject
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.annotation.Service
;
import
org.b3log.solo.model.Tag
;
import
org.b3log.solo.service.ArticleQueryService
;
import
org.b3log.solo.service.TagQueryService
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Fill tag articles.
*
* @author <a href="mailto:385321165@qq.com">DASHU</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.2, Apr 12, 2017
* @since 0.6.1
*/
@Service
public
class
FillTagArticles
implements
TemplateMethodModelEx
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
FillTagArticles
.
class
);
/**
* Arg size.
*/
private
static
final
int
ARG_SIZE
=
3
;
/**
* Tag query service.
*/
@Inject
private
TagQueryService
tagQueryService
;
/**
* Article query service.
*/
@Inject
private
ArticleQueryService
articleQueryService
;
@Override
public
Object
exec
(
final
List
arguments
)
throws
TemplateModelException
{
if
(
arguments
.
size
()
!=
ARG_SIZE
)
{
LOGGER
.
debug
(
"FillTagArticles with wrong arguments!"
);
throw
new
TemplateModelException
(
"Wrong arguments!"
);
}
final
String
tagTitle
=
(
String
)
arguments
.
get
(
0
);
final
int
currentPageNum
=
Integer
.
parseInt
((
String
)
arguments
.
get
(
1
));
final
int
pageSize
=
Integer
.
parseInt
((
String
)
arguments
.
get
(
2
));
try
{
final
JSONObject
result
=
tagQueryService
.
getTagByTitle
(
tagTitle
);
if
(
null
==
result
)
{
return
new
ArrayList
<
JSONObject
>();
}
final
JSONObject
tag
=
result
.
getJSONObject
(
Tag
.
TAG
);
final
String
tagId
=
tag
.
getString
(
Keys
.
OBJECT_ID
);
final
List
<
JSONObject
>
ret
=
articleQueryService
.
getArticlesByTag
(
tagId
,
currentPageNum
,
pageSize
);
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Fill tag articles failed"
,
e
);
}
return
null
;
}
}
src/main/java/org/b3log/solo/service/DataModelService.java
View file @
32962daa
...
...
@@ -714,7 +714,6 @@ public class DataModelService {
LOGGER
.
debug
(
"Filling side...."
);
Template
template
=
Skins
.
getSkinTemplate
(
request
,
"side.ftl"
);
if
(
null
==
template
)
{
LOGGER
.
debug
(
"The skin dose not contain [side.ftl] template"
);
...
...
@@ -725,8 +724,6 @@ public class DataModelService {
}
}
dataModel
.
put
(
"fillTagArticles"
,
fillTagArticles
);
if
(
Templates
.
hasExpression
(
template
,
"<#list recentArticles as article>"
))
{
fillRecentArticles
(
dataModel
,
preference
);
}
...
...
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