Commit b9b2d102 authored by Liang Ding's avatar Liang Ding

��ȡ���շ��� 0.4.6��Merge remote-tracking branch 'origin/0.4.6'

Conflicts:
	core/src/main/java/org/b3log/solo/service/TagQueryService.java
	core/src/main/java/org/b3log/solo/util/Articles.java
	core/src/test/java/org/b3log/solo/repository/impl/UserRepositoryImplTestCase.java
	war/src/main/webapp/CHANGE_LOGS.html
	war/src/main/webapp/css/default-admin.css
	war/src/main/webapp/css/default-base.css
	war/src/main/webapp/css/default-init.css
	war/src/main/webapp/js/admin/admin.js
	war/src/main/webapp/js/admin/editorKindEditor.js
	war/src/main/webapp/js/admin/editorTinyMCE.js
	war/src/main/webapp/js/admin/pageList.js
	war/src/main/webapp/js/admin/preference.js
	war/src/main/webapp/js/admin/tablePaginate.js
	war/src/main/webapp/js/lib/jquery/jquery.bowknot.min.js
parents 8b5d0f46 b632302e
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Copyright (c) 2009, 2010, 2011, 2012, 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.
*/
package org.b3log.solo.processor;
import org.b3log.latke.Latkes;
import org.b3log.latke.annotation.RequestProcessing;
import org.b3log.latke.annotation.RequestProcessor;
import org.b3log.latke.servlet.HTTPRequestContext;
import org.b3log.latke.servlet.HTTPRequestMethod;
import org.b3log.latke.servlet.renderer.JSONRenderer;
import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Statistic;
import org.b3log.solo.repository.StatisticRepository;
import org.b3log.solo.repository.impl.StatisticRepositoryImpl;
import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.TagQueryService;
import org.b3log.solo.util.Articles;
import org.json.JSONObject;
/**
* Blog processor.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.0, Jun 28, 2012
* @since 0.4.6
*/
@RequestProcessor
public final class BlogProcessor {
/**
* Article utilities.
*/
private Articles articleUtils = Articles.getInstance();
/**
* Tag query service.
*/
private TagQueryService tagQueryService = TagQueryService.getInstance();
/**
* Preference query service.
*/
private PreferenceQueryService preferenceQueryService = PreferenceQueryService.getInstance();
/**
* Statistic repository.
*/
private StatisticRepository statisticRepository = StatisticRepositoryImpl.getInstance();
/**
* Gets blog information.
*
* <ul>
* <li>Time of the recent updated article</li>
* <li>Article count</li>
* <li>Comment count</li>
* <li>Tag count</li>
* <li>Serve path</li>
* <li>Static serve path</li>
* <li>Solo version</li>
* <li>Runtime environment (GAE/LOCAL)</li>
* <li>Locale</li>
* </ul>
*
* @param context the specified context
* @throws Exception exception
*/
@RequestProcessing(value = "/blog/info", method = HTTPRequestMethod.GET)
public void getRecentArticleTime(final HTTPRequestContext context) throws Exception {
final JSONRenderer renderer = new JSONRenderer();
context.setRenderer(renderer);
final JSONObject jsonObject = new JSONObject();
renderer.setJSONObject(jsonObject);
jsonObject.put("recentArticleTime", articleUtils.getRecentArticleTime());
final JSONObject statistic = statisticRepository.get(Statistic.STATISTIC);
jsonObject.put("articleCount", statistic.getLong(Statistic.STATISTIC_PUBLISHED_ARTICLE_COUNT));
jsonObject.put("commentCount", statistic.getLong(Statistic.STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT));
jsonObject.put("tagCount", tagQueryService.getTagCount());
jsonObject.put("servePath", Latkes.getServePath());
jsonObject.put("staticServePath", Latkes.getStaticServePath());
jsonObject.put("version", SoloServletListener.VERSION);
jsonObject.put("runtimeEnv", Latkes.getRuntimeEnv());
jsonObject.put("locale", Latkes.getLocale());
}
}
...@@ -33,7 +33,11 @@ import org.json.JSONObject; ...@@ -33,7 +33,11 @@ import org.json.JSONObject;
* Tag query service. * Tag query service.
* *
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
<<<<<<< HEAD
* @version 1.0.0.2, Nov 11, 2011 * @version 1.0.0.2, Nov 11, 2011
=======
* @version 1.0.0.3, Jun 28, 2012
>>>>>>> origin/0.4.6
* @since 0.4.0 * @since 0.4.0
*/ */
public final class TagQueryService { public final class TagQueryService {
...@@ -41,8 +45,12 @@ public final class TagQueryService { ...@@ -41,8 +45,12 @@ public final class TagQueryService {
/** /**
* Logger. * Logger.
*/ */
<<<<<<< HEAD
private static final Logger LOGGER = private static final Logger LOGGER =
Logger.getLogger(TagQueryService.class.getName()); Logger.getLogger(TagQueryService.class.getName());
=======
private static final Logger LOGGER = Logger.getLogger(TagQueryService.class.getName());
>>>>>>> origin/0.4.6
/** /**
* Tag repository. * Tag repository.
*/ */
...@@ -65,8 +73,12 @@ public final class TagQueryService { ...@@ -65,8 +73,12 @@ public final class TagQueryService {
* </pre>, returns {@code null} if not found * </pre>, returns {@code null} if not found
* @throws ServiceException service exception * @throws ServiceException service exception
*/ */
<<<<<<< HEAD
public JSONObject getTagByTitle(final String tagTitle) public JSONObject getTagByTitle(final String tagTitle)
throws ServiceException { throws ServiceException {
=======
public JSONObject getTagByTitle(final String tagTitle) throws ServiceException {
>>>>>>> origin/0.4.6
try { try {
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
...@@ -88,6 +100,25 @@ public final class TagQueryService { ...@@ -88,6 +100,25 @@ public final class TagQueryService {
} }
/** /**
<<<<<<< HEAD
=======
* Gets the count of tags.
*
* @return count of tags
* @throws ServiceException service exception
*/
public long getTagCount() throws ServiceException {
try {
return tagRepository.count();
} catch (final RepositoryException e) {
LOGGER.log(Level.SEVERE, "Gets tags failed", e);
throw new ServiceException(e);
}
}
/**
>>>>>>> origin/0.4.6
* Gets all tags. * Gets all tags.
* *
* @return for example, * @return for example,
......
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -28,10 +31,14 @@ import javax.servlet.http.HttpServletRequest; ...@@ -28,10 +31,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.b3log.solo.model.Article; import org.b3log.solo.model.Article;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
<<<<<<< HEAD
import org.b3log.latke.repository.FilterOperator; import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.Query; import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.RepositoryException; import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.SortDirection; import org.b3log.latke.repository.SortDirection;
=======
import org.b3log.latke.repository.*;
>>>>>>> origin/0.4.6
import org.b3log.latke.service.ServiceException; import org.b3log.latke.service.ServiceException;
import org.b3log.latke.user.UserService; import org.b3log.latke.user.UserService;
import org.b3log.latke.user.UserServiceFactory; import org.b3log.latke.user.UserServiceFactory;
...@@ -136,6 +143,7 @@ public final class Articles { ...@@ -136,6 +143,7 @@ public final class Articles {
} }
/** /**
<<<<<<< HEAD
* Gets the specified article's author. * Gets the specified article's author.
* *
* <p> * <p>
...@@ -436,6 +444,26 @@ public final class Articles { ...@@ -436,6 +444,26 @@ public final class Articles {
} }
return true; return true;
=======
* Gets time of the recent updated article.
*
* @return time of the recent updated article, returns {@code 0} if not found
* @throws ServiceException service exception
*/
public long getRecentArticleTime() throws ServiceException {
try {
final List<JSONObject> recentArticles = articleRepository.getRecentArticles(1);
if (recentArticles.isEmpty()) {
return 0;
}
final JSONObject recentArticle = recentArticles.get(0);
return ((Date) recentArticle.get(Article.ARTICLE_UPDATE_DATE)).getTime();
} catch (final Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
throw new ServiceException("Gets recent article time failed");
}
>>>>>>> origin/0.4.6
} }
/** /**
...@@ -608,4 +636,7 @@ public final class Articles { ...@@ -608,4 +636,7 @@ public final class Articles {
} }
} }
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -102,6 +103,8 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase { ...@@ -102,6 +103,8 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase {
} }
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -204,4 +207,7 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase { ...@@ -204,4 +207,7 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase {
Assert.assertEquals(found.getString(User.USER_PASSWORD), "pass1"); Assert.assertEquals(found.getString(User.USER_PASSWORD), "pass1");
} }
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
...@@ -337,6 +338,8 @@ ...@@ -337,6 +338,8 @@
</body> </body>
</html> </html>
======= =======
=======
>>>>>>> origin/0.4.6
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
...@@ -684,4 +687,7 @@ ...@@ -684,4 +687,7 @@
</ul> </ul>
</body> </body>
</html> </html>
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/** /**
* admin style * admin style
* *
...@@ -655,6 +656,8 @@ button#submitArticle { ...@@ -655,6 +656,8 @@ button#submitArticle {
z-index: 1; z-index: 1;
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -1330,4 +1333,7 @@ button#submitArticle { ...@@ -1330,4 +1333,7 @@ button#submitArticle {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/** /**
* base style * base style
* *
...@@ -502,6 +503,8 @@ button:hover,.button:hover { ...@@ -502,6 +503,8 @@ button:hover,.button:hover {
cursor: pointer; cursor: pointer;
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -1020,5 +1023,8 @@ button:hover,.button:hover { ...@@ -1020,5 +1023,8 @@ button:hover,.button:hover {
#captcha, #captchaReply { #captcha, #captchaReply {
cursor: pointer; cursor: pointer;
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
/* end comment */ /* end comment */
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/** /**
* 403, 500, article-pwd, init, login and kill-browser page style. * 403, 500, article-pwd, init, login and kill-browser page style.
* *
...@@ -226,6 +227,8 @@ input:focus { ...@@ -226,6 +227,8 @@ input:focus {
margin-top: 18px; margin-top: 18px;
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -476,5 +479,8 @@ input:focus { ...@@ -476,5 +479,8 @@ input:focus {
font-weight: bold; font-weight: bold;
margin-top: 18px; margin-top: 18px;
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
/* end init and login */ /* end init and login */
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -254,6 +255,8 @@ $.extend(Admin.prototype, { ...@@ -254,6 +255,8 @@ $.extend(Admin.prototype, {
} }
}); });
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -508,5 +511,8 @@ $.extend(Admin.prototype, { ...@@ -508,5 +511,8 @@ $.extend(Admin.prototype, {
this.setCurByHash(); this.setCurByHash();
} }
}); });
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
var admin = new Admin(); var admin = new Admin();
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -96,6 +97,8 @@ admin.editors.KindEditor = { ...@@ -96,6 +97,8 @@ admin.editors.KindEditor = {
} }
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -194,5 +197,8 @@ admin.editors.KindEditor = { ...@@ -194,5 +197,8 @@ admin.editors.KindEditor = {
$("#" + id).val(content); $("#" + id).val(content);
} }
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
}; };
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -123,6 +124,8 @@ admin.editors.tinyMCE = { ...@@ -123,6 +124,8 @@ admin.editors.tinyMCE = {
} }
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -248,5 +251,8 @@ admin.editors.tinyMCE = { ...@@ -248,5 +251,8 @@ admin.editors.tinyMCE = {
$("#" + id).val(content); $("#" + id).val(content);
} }
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
}; };
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -435,6 +436,8 @@ admin.register["page-list"] = { ...@@ -435,6 +436,8 @@ admin.register["page-list"] = {
"init": admin.pageList.init, "init": admin.pageList.init,
"refresh": admin.pageList.getList "refresh": admin.pageList.getList
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -870,5 +873,8 @@ admin.register["page-list"] = { ...@@ -870,5 +873,8 @@ admin.register["page-list"] = {
"obj": admin.pageList, "obj": admin.pageList,
"init": admin.pageList.init, "init": admin.pageList.init,
"refresh": admin.pageList.getList "refresh": admin.pageList.getList
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
} }
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -222,6 +223,8 @@ admin.register["preference"] = { ...@@ -222,6 +223,8 @@ admin.register["preference"] = {
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -491,5 +494,8 @@ admin.register["preference"] = { ...@@ -491,5 +494,8 @@ admin.register["preference"] = {
"refresh": function () { "refresh": function () {
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
} }
\ No newline at end of file
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -112,6 +113,8 @@ $.extend(TablePaginate.prototype, { ...@@ -112,6 +113,8 @@ $.extend(TablePaginate.prototype, {
this.currentPage = currentPage; this.currentPage = currentPage;
} }
======= =======
=======
>>>>>>> origin/0.4.6
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -225,5 +228,8 @@ $.extend(TablePaginate.prototype, { ...@@ -225,5 +228,8 @@ $.extend(TablePaginate.prototype, {
}); });
this.currentPage = currentPage; this.currentPage = currentPage;
} }
<<<<<<< HEAD
>>>>>>> origin/0.4.6
=======
>>>>>>> origin/0.4.6 >>>>>>> origin/0.4.6
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment