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
a00f0951
Commit
a00f0951
authored
Apr 24, 2013
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#216
parent
e70f4bde
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
25 deletions
+38
-25
core/src/main/java/org/b3log/solo/plugin/broadcast/ChanceProcessor.java
...java/org/b3log/solo/plugin/broadcast/ChanceProcessor.java
+19
-5
war/src/main/webapp/plugins/b3log-broadcast/plugin.ftl
war/src/main/webapp/plugins/b3log-broadcast/plugin.ftl
+18
-19
war/src/main/webapp/plugins/b3log-broadcast/plugin.properties
...src/main/webapp/plugins/b3log-broadcast/plugin.properties
+1
-1
No files found.
core/src/main/java/org/b3log/solo/plugin/broadcast/ChanceProcessor.java
View file @
a00f0951
...
@@ -18,6 +18,7 @@ package org.b3log.solo.plugin.broadcast;
...
@@ -18,6 +18,7 @@ package org.b3log.solo.plugin.broadcast;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.concurrent.Future
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -30,6 +31,7 @@ import org.b3log.latke.servlet.annotation.RequestProcessing;
...
@@ -30,6 +31,7 @@ import org.b3log.latke.servlet.annotation.RequestProcessing;
import
org.b3log.latke.servlet.annotation.RequestProcessor
;
import
org.b3log.latke.servlet.annotation.RequestProcessor
;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.HTTPResponse
;
import
org.b3log.latke.urlfetch.URLFetchService
;
import
org.b3log.latke.urlfetch.URLFetchService
;
import
org.b3log.latke.urlfetch.URLFetchServiceFactory
;
import
org.b3log.latke.urlfetch.URLFetchServiceFactory
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.latke.util.Requests
;
...
@@ -49,7 +51,7 @@ import org.json.JSONObject;
...
@@ -49,7 +51,7 @@ import org.json.JSONObject;
* Broadcast chance processor.
* Broadcast chance processor.
*
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
7, May 16, 2012
* @version 1.0.0.
8, Apr 24, 2013
* @since 0.6.0
* @since 0.6.0
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -246,7 +248,7 @@ public final class ChanceProcessor {
...
@@ -246,7 +248,7 @@ public final class ChanceProcessor {
* "broadcast": {
* "broadcast": {
* "title": "",
* "title": "",
* "content": "",
* "content": "",
* "link": ""
* "link": ""
// optional
* }
* }
* }
* }
* </pre>
* </pre>
...
@@ -300,9 +302,21 @@ public final class ChanceProcessor {
...
@@ -300,9 +302,21 @@ public final class ChanceProcessor {
httpRequest
.
setRequestMethod
(
HTTPRequestMethod
.
POST
);
httpRequest
.
setRequestMethod
(
HTTPRequestMethod
.
POST
);
httpRequest
.
setPayload
(
broadcastRequest
.
toString
().
getBytes
(
"UTF-8"
));
httpRequest
.
setPayload
(
broadcastRequest
.
toString
().
getBytes
(
"UTF-8"
));
urlFetchService
.
fetchAsync
(
httpRequest
);
@SuppressWarnings
(
"unchecked"
)
final
Future
<
HTTPResponse
>
future
=
(
Future
<
HTTPResponse
>)
urlFetchService
.
fetchAsync
(
httpRequest
);
final
HTTPResponse
result
=
future
.
get
();
if
(
HttpServletResponse
.
SC_OK
==
result
.
getResponseCode
())
{
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
optionMgmtService
.
removeOption
(
Option
.
ID_C_BROADCAST_CHANCE_EXPIRATION_TIME
);
LOGGER
.
info
(
"Submits broadcast successfully"
);
return
;
}
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
}
catch
(
final
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Submits broadcast failed"
,
e
);
LOGGER
.
log
(
Level
.
SEVERE
,
"Submits broadcast failed"
,
e
);
...
...
war/src/main/webapp/plugins/b3log-broadcast/plugin.ftl
View file @
a00f0951
...
@@ -96,7 +96,7 @@
...
@@ -96,7 +96,7 @@
url: "http://symphony.b3log.org/apis/broadcasts",
url: "http://symphony.b3log.org/apis/broadcasts",
dataType: "jsonp",
dataType: "jsonp",
jsonp: "callback",
jsonp: "callback",
beforeSend: function
() {
beforeSend: function() {
$("#b3logBroadcastList").css("background",
$("#b3logBroadcastList").css("background",
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent");
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent");
},
},
...
@@ -104,8 +104,8 @@
...
@@ -104,8 +104,8 @@
$("#b3logBroadcastList").html("Loading Symphony broadcasts failed :-(").css("background", "none");
$("#b3logBroadcastList").html("Loading Symphony broadcasts failed :-(").css("background", "none");
},
},
success: function(result) {
success: function(result) {
if (result.sc) {
var articles = result.articles;
var articles = result.articles;
if (0 === articles.length) {
if (0 === articles.length) {
return;
return;
}
}
...
@@ -122,7 +122,6 @@
...
@@ -122,7 +122,6 @@
listHTML += "</ul>";
listHTML += "</ul>";
$("#b3logBroadcastList").html(listHTML).css("background", "none");
$("#b3logBroadcastList").html(listHTML).css("background", "none");
}
},
},
complete: function(XMLHttpRequest, textStatus) {
complete: function(XMLHttpRequest, textStatus) {
$("#loadMsg").text("");
$("#loadMsg").text("");
...
...
war/src/main/webapp/plugins/b3log-broadcast/plugin.properties
View file @
a00f0951
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#
#
rendererId
=
admin-main.ftl
rendererId
=
admin-main.ftl
author
=
<a href="http://88250.b3log.org">88250</a> & <a href="http://vanessa.b3log.org">Vanessa</a>
author
=
<a href="http://88250.b3log.org">88250</a> & <a href="http://vanessa.b3log.org">Vanessa</a>
name
=
b3log b
roadcast
name
=
B3log B
roadcast
version
=
0.0.1
version
=
0.0.1
types
=
ADMIN
types
=
ADMIN
...
...
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