Commit 1faf86be authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Options concept work completed. Need to implement actual updates occuring.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6344 b35dd754-fafc-0310-a699-88a17e54d16e
parent bbf83586
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<optionsconfig> <optionsconfig>
<leftpanel></leftpanel> <leftpanel>
<item type="toggle" sysprop="plugin.gateway.aim.filetransfer" var="filetransfer" desc="File Transfer Enabled"/>
<item type="toggle" sysprop="plugin.gateway.aim.reconnect" var="reconnect" desc="Reconnect Automatically">
<item type="text" sysprop="plugin.gateway.aim.reconnectattempts" var="reconnectattempts" desc="Attempts" size="4" maxlength="4"/>
</item>
</leftpanel>
<rightpanel> <rightpanel>
<item type="text" sysprop="plugin.gateway.aim.connecthost" var="host" desc="Host"/> <item type="text" sysprop="plugin.gateway.aim.connecthost" var="host" desc="Host" default="login.oscar.aol.com"/>
<item type="text" sysprop="plugin.gateway.aim.connectport" var="port" desc="Port"/> <item type="text" sysprop="plugin.gateway.aim.connectport" var="port" desc="Port" default="5190"/>
</rightpanel> </rightpanel>
</optionsconfig> </optionsconfig>
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<optionsconfig> <optionsconfig>
<leftpanel></leftpanel> <leftpanel></leftpanel>
<rightpanel> <rightpanel>
<item type="text" sysprop="plugin.gateway.icq.connecthost" var="host" desc="Host"/> <item type="text" sysprop="plugin.gateway.icq.connecthost" var="host" desc="Host" default="login.oscar.aol.com"/>
<item type="text" sysprop="plugin.gateway.icq.connectport" var="port" desc="Port"/> <item type="text" sysprop="plugin.gateway.icq.connectport" var="port" desc="Port" default="5190"/>
<item type="text" sysprop="plugin.gateway.icq.encoding" var="encoding" desc="Encoding"/> <item type="text" sysprop="plugin.gateway.icq.encoding" var="encoding" desc="Encoding" default="iso-8859-1"/>
</rightpanel> </rightpanel>
</optionsconfig> </optionsconfig>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<optionsconfig> <optionsconfig>
<leftpanel></leftpanel> <leftpanel></leftpanel>
<rightpanel> <rightpanel>
<item type="text" sysprop="plugin.gateway.irc.connecthost" var="host" desc="Host"/> <item type="text" sysprop="plugin.gateway.irc.connecthost" var="host" desc="Host" default="irc.freenode.net"/>
<item type="text" sysprop="plugin.gateway.irc.connectport" var="port" desc="Port"/> <item type="text" sysprop="plugin.gateway.irc.connectport" var="port" desc="Port" default="7000"/>
</rightpanel> </rightpanel>
</optionsconfig> </optionsconfig>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<optionsconfig> <optionsconfig>
<leftpanel></leftpanel> <leftpanel></leftpanel>
<rightpanel> <rightpanel>
<item type="text" sysprop="plugin.gateway.msn.connecthost" var="host" desc="Host"/> <item type="text" sysprop="plugin.gateway.msn.connecthost" var="host" desc="Host" default="messenger.hotmail.com"/>
<item type="text" sysprop="plugin.gateway.msn.connectport" var="port" desc="Port"/> <item type="text" sysprop="plugin.gateway.msn.connectport" var="port" desc="Port" default="1863"/>
</rightpanel> </rightpanel>
</optionsconfig> </optionsconfig>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<optionsconfig> <optionsconfig>
<leftpanel></leftpanel> <leftpanel></leftpanel>
<rightpanel> <rightpanel>
<item type="text" sysprop="plugin.gateway.yahoo.connecthost" var="host" desc="Host"/> <item type="text" sysprop="plugin.gateway.yahoo.connecthost" var="host" desc="Host" default="scs.msg.yahoo.com"/>
<item type="text" sysprop="plugin.gateway.yahoo.connectport" var="port" desc="Port"/> <item type="text" sysprop="plugin.gateway.yahoo.connectport" var="port" desc="Port" port="5050"/>
</rightpanel> </rightpanel>
</optionsconfig> </optionsconfig>
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<%@ page import="org.dom4j.Attribute" %> <%@ page import="org.dom4j.Attribute" %>
<%@ page import="org.jivesoftware.util.Log" %> <%@ page import="org.jivesoftware.util.Log" %>
<%@ page import="org.dom4j.Document" %> <%@ page import="org.dom4j.Document" %>
<%@ page import="org.jivesoftware.util.JiveGlobals" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
...@@ -23,6 +24,7 @@ ...@@ -23,6 +24,7 @@
TransportType gatewayType = null; TransportType gatewayType = null;
boolean gwEnabled = false; boolean gwEnabled = false;
JspWriter out = null; JspWriter out = null;
Integer jsID = 0; // Javascript incrementable id
GatewaySettings(JspWriter out, GatewayPlugin plugin, TransportType gatewayType, GatewaySettings(JspWriter out, GatewayPlugin plugin, TransportType gatewayType,
String desc) { String desc) {
...@@ -32,49 +34,71 @@ ...@@ -32,49 +34,71 @@
this.out = out; this.out = out;
} }
// <tr valign = "middle" >
// <td width = "1%" ><input type = "checkbox"
// name = "filetransfer"
// value = "enabled" ></td >
// <td > Enable
// file transfer</td >
// </tr >
// <tr valign = "middle" >
// <td width = "1%" ><input type = "checkbox"
// name = "reconnect"
// value = "enabled" ></td >
// <td > Reconnect
// on disconnect</td >
// </tr >
// <tr valign = "middle" >
// <td width = "1%" > & nbsp;</td >
// <td > Reconnect
// Attemps:<input type = "text"
// style = "margin: 0.0px; padding: 0.0px"
// name = "reconnect_attempts"
// size = "4"
// maxlength = "4"
// value = "10" / ></td >
// </tr >
// <tr valign="middle">
// <td align="right" width="1%">Host:</td>
// <td><input type="text" name="host" value="blar" onChange="getElementById('testhost').innerHTML = this.value" /></td>
// </tr>
// <tr valign="middle">
// <td align="right" width="1%">Port:</td>
// <td><input type="text" name="host" value="1234" onChange="getElementById('testport').innerHTML = this.value" /></td>
// </tr>
void printConfigNode(Element node) { void printConfigNode(Element node) {
Log.debug("HI!");
try { try {
Attribute type = node.attribute("type"); Attribute type = node.attribute("type");
if (type.getText().equals("text")) { if (type.getText().equals("text")) {
// Required fields
Attribute desc = node.attribute("desc"); Attribute desc = node.attribute("desc");
Attribute var = node.attribute("var");
Attribute sysprop = node.attribute("sysprop");
// Optional fields
Attribute def = node.attribute("default");
Attribute size = node.attribute("size");
Attribute maxlen = node.attribute("maxlength");
if (desc == null || var == null || sysprop == null) {
Log.error("Missing variable from options config.");
return;
}
String defStr = "";
if (def != null) {
defStr = def.getText();
}
String setting = JiveGlobals.getProperty(sysprop.getText(), defStr);
String checkId = gatewayType.toString()+var.getText();
out.println("<tr valign='middle'>"); out.println("<tr valign='middle'>");
out.println("<td align='right' width='1%'>" + (desc != null ? desc.getText() : "&nbsp;") + ":</td>"); out.println("<td align='right' width='1%'><label for='" + checkId + "'>" + desc.getText() + "</label>:</td>");
out.println("<td><input type='text' name='var' value='blar'/></td>"); out.println("<td><input type='text' id='" + checkId + "' name='" + var.getText() + "'"+(size != null ? " size='"+size.getText()+"'" : "")+(size != null ? " maxlength='"+maxlen.getText()+"'" : "")+" value='"+setting+"'/></td>");
out.println("</tr>");
}
else if (type.getText().equals("toggle")) {
// Required fields
Attribute desc = node.attribute("desc");
Attribute var = node.attribute("var");
Attribute sysprop = node.attribute("sysprop");
// Optional fields
Attribute def = node.attribute("default");
if (desc == null || var == null || sysprop == null) {
Log.error("Missing variable from options config.");
return;
}
boolean defBool = false;
if (def != null && (def.getText().equals("1") || def.getText().equals("true") || def.getText().equals("enabled") || def.getText().equals("yes"))) {
defBool = true;
}
boolean setting = JiveGlobals.getBooleanProperty(sysprop.getText(), defBool);
String jsStr = gatewayType.toString()+(++jsID);
String checkId = gatewayType.toString()+var.getText();
out.println("<tr valign='top'>");
out.println("<td align='right' width='1%'><input type='checkbox' id='" + checkId +"' name='" + var.getText() + "' value='true' "+(setting ? " checked='checked'" : "")+" onClick='elem = document.getElementById(\""+jsStr+"\"); if (elem) { if (this.checked) { elem.style.display=\"table\"} else { elem.style.display=\"none\"} }'/></td>");
out.print("<td><label for='" + checkId + "'>" + desc.getText() + "</label>");
for (Object itemObj : node.elements("item")) {
Element item = (Element)itemObj;
out.println("<table id='"+jsStr+"' width='100%' style='display: "+(defBool ? "table" : "none")+"'>");
printConfigNode(item);
out.println("</table>");
}
out.println("</td>");
out.println("</tr>"); out.println("</tr>");
} }
} }
...@@ -124,7 +148,6 @@ ...@@ -124,7 +148,6 @@
if (leftPanel != null && leftPanel.nodeCount() > 0) { if (leftPanel != null && leftPanel.nodeCount() > 0) {
out.println("<table border='0' cellpadding='1' cellspacing='2'>"); out.println("<table border='0' cellpadding='1' cellspacing='2'>");
for (Object nodeObj : leftPanel.elements("item")) { for (Object nodeObj : leftPanel.elements("item")) {
Log.debug("whee!");
Element node = (Element)nodeObj; Element node = (Element)nodeObj;
printConfigNode(node); printConfigNode(node);
} }
...@@ -140,11 +163,10 @@ ...@@ -140,11 +163,10 @@
if (rightPanel != null && rightPanel.nodeCount() > 0) { if (rightPanel != null && rightPanel.nodeCount() > 0) {
out.println("<table border='0' cellpadding='1' cellspacing='2'>"); out.println("<table border='0' cellpadding='1' cellspacing='2'>");
for (Object nodeObj : rightPanel.elements("item")) { for (Object nodeObj : rightPanel.elements("item")) {
Log.debug("whee!");
Element node = (Element)nodeObj; Element node = (Element)nodeObj;
printConfigNode(node); printConfigNode(node);
} }
out.println("</table"); out.println("</table>");
} }
else { else {
out.println("&nbsp;"); out.println("&nbsp;");
......
...@@ -348,7 +348,7 @@ tr.jive-registrations-edit, tr.jive-registrations-editVisible td { ...@@ -348,7 +348,7 @@ tr.jive-registrations-edit, tr.jive-registrations-editVisible td {
/* *************************** */ /* *************************** */
/* add a gateway registrations */ /* add a gateway registration */
/* *************************** */ /* *************************** */
.jive-gateway-addregBtn { .jive-gateway-addregBtn {
display: block; display: block;
......
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