From c2d316449f85bd2b74ae9ffaa3d08b7a5ee282cf Mon Sep 17 00:00:00 2001 From: Alex Bitney Date: Sun, 7 Feb 2016 00:00:41 +0200 Subject: added tags when posting new message added templates engine (rythm engine) and moved something to it. WARNING: textext plugin does not work when minimized, and also I fixed bug in it. --- src/main/java/com/juick/http/www/NewMessage.java | 33 +++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/main/java/com/juick/http/www/NewMessage.java') diff --git a/src/main/java/com/juick/http/www/NewMessage.java b/src/main/java/com/juick/http/www/NewMessage.java index d3178c59..c8eb6ede 100644 --- a/src/main/java/com/juick/http/www/NewMessage.java +++ b/src/main/java/com/juick/http/www/NewMessage.java @@ -17,13 +17,10 @@ */ package com.juick.http.www; +import com.alibaba.fastjson.JSONArray; import com.juick.JuickApplication; import com.juick.Tag; -import com.juick.server.CrosspostQueries; -import com.juick.server.MessagesQueries; -import com.juick.server.SubscriptionsQueries; -import com.juick.server.TagQueries; -import com.juick.server.UserQueries; +import com.juick.server.*; import com.juick.xmpp.JID; import com.juick.xmpp.Message; import com.juick.xmpp.Stream; @@ -161,13 +158,25 @@ public class NewMessage { List tags = new ArrayList<>(); String tagsArr[] = new String[1]; if (tagsStr != null && !tagsStr.isEmpty()) { - tagsArr = tagsStr.split("[ \\,]"); - for (int i = 0; i < tagsArr.length; i++) { - if (tagsArr[i].startsWith("*")) { - tagsArr[i] = tagsArr[i].substring(1); + if (tagsStr.startsWith("[")) { + // new json tags format with auto-completion + JSONArray parse = (JSONArray)JSONArray.parse(tagsStr); + ArrayList tagsList = new ArrayList<>(); + for(int i=0; i 64) { - tagsArr[i] = tagsArr[i].substring(0, 64); + tagsArr = tagsList.toArray(new String[tagsList.size()]); + } else { + tagsArr = tagsStr.split("[ \\,]"); + for (int i = 0; i < tagsArr.length; i++) { + if (tagsArr[i].startsWith("*")) { + tagsArr[i] = tagsArr[i].substring(1); + } + if (tagsArr[i].length() > 64) { + tagsArr[i] = tagsArr[i].substring(0, 64); + } } } tags = TagQueries.getTags(sql, tagsArr, true); @@ -289,7 +298,7 @@ public class NewMessage { out.println("

Отправить в Facebook

"); } out.println("

Отправить в Google+

"); - out.println("

Ссылка на сообщение: http://juick.com/" + mid + "

"); + out.println("

Ссылка на сообщение: http://"+Endpoints.wwwJuickCom+"/" + mid + "

"); out.println(""); PageTemplates.pageFooter(request, out, visitor, false); -- cgit v1.2.3