Commit 327ff110 authored by Holger Bergunde's avatar Holger Bergunde Committed by holger.bergunde

updated just married plugin to 1.0.1

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13271 b35dd754-fafc-0310-a699-88a17e54d16e
parent 2a63b401
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
<h1> <h1>
Just married Plugin Changelog Just married Plugin Changelog
</h1> </h1>
<p><b>1.0.1 </b> -- August 28, 2012</p>
<ul>
<li>Change name and mail address if necessary </li>
</ul>
<p><b>1.0.0 </b> -- July 30, 2012</p> <p><b>1.0.0 </b> -- July 30, 2012</p>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<name>Just married</name> <name>Just married</name>
<description>Allows admins to rename or copy users</description> <description>Allows admins to rename or copy users</description>
<author>Holger Bergunde</author> <author>Holger Bergunde</author>
<version>1.0.0 </version> <version>1.0.1 </version>
<date>7/30/2012</date> <date>8/28/2012</date>
<minServerVersion>3.3.0</minServerVersion> <minServerVersion>3.3.0</minServerVersion>
<adminconsole> <adminconsole>
......
...@@ -31,14 +31,18 @@ public class JustMarriedPlugin implements Plugin { ...@@ -31,14 +31,18 @@ public class JustMarriedPlugin implements Plugin {
public void initializePlugin(PluginManager manager, File pluginDirectory) { public void initializePlugin(PluginManager manager, File pluginDirectory) {
} }
public static boolean changeName(String currentUserName, String newUserName, boolean deleteOldUser) { public static boolean changeName(String currentUserName, String newUserName, boolean deleteOldUser,
String newEmail, String newRealName) {
UserManager userManager = UserManager.getInstance(); UserManager userManager = UserManager.getInstance();
try { try {
User currentUser = userManager.getUser(currentUserName); User currentUser = userManager.getUser(currentUserName);
// Old user found, create new one // Old user found, create new one
String password = AuthFactory.getPassword(currentUserName); String password = AuthFactory.getPassword(currentUserName);
User newUser = userManager.createUser(newUserName, password, currentUser.getName(), currentUser.getEmail()); String newName = (newRealName == null | newRealName.length() == 0) ? currentUser.getName() : newRealName;
String newMail = (newEmail == null | newEmail.length() == 0) ? currentUser.getEmail() : newEmail;
User newUser = userManager.createUser(newUserName, password, currentUser.getName(), newMail);
newUser.setName(newName);
newUser.setNameVisible(currentUser.isNameVisible()); newUser.setNameVisible(currentUser.isNameVisible());
newUser.setEmailVisible(currentUser.isEmailVisible()); newUser.setEmailVisible(currentUser.isEmailVisible());
newUser.setCreationDate(currentUser.getCreationDate()); newUser.setCreationDate(currentUser.getCreationDate());
......
...@@ -399,24 +399,11 @@ p small { ...@@ -399,24 +399,11 @@ p small {
line-height: 27px line-height: 27px
} }
h1,h2,h3,h4,h5,h6 {
margin: 0;
font-family: inherit;
font-weight: bold;
color: inherit;
text-rendering: optimizelegibility
}
h1 small,h2 small,h3 small,h4 small,h5 small,h6 small { h1 small,h2 small,h3 small,h4 small,h5 small,h6 small {
font-weight: normal; font-weight: normal;
color: #999 color: #999
} }
h1 {
font-size: 30px;
line-height: 36px
}
h1 small { h1 small {
font-size: 18px font-size: 18px
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
String oldName = request.getParameter("oldName"); String oldName = request.getParameter("oldName");
String newName = request.getParameter("newName"); String newName = request.getParameter("newName");
String keepCopy = request.getParameter("copy"); String keepCopy = request.getParameter("copy");
String newEmail = request.getParameter("email");
String newRealName = request.getParameter("realName");
%> %>
<html> <html>
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
<div class="jive-contentBox"> <div class="jive-contentBox">
<% <%
if (oldName != null && newName != null && oldName.trim().length() > 0 && newName.trim().length() > 0) { if (oldName != null && newName != null && oldName.trim().length() > 0 && newName.trim().length() > 0) {
boolean success = JustMarriedPlugin.changeName(oldName, newName, keepCopy == null ? true : false); boolean success = JustMarriedPlugin.changeName(oldName, newName, keepCopy == null ? true : false, newEmail, newRealName);
if (success) { if (success) {
out.write("<div class=\"success\">Sucessfully renamed user " + oldName + " to " + newName out.write("<div class=\"success\">Sucessfully renamed user " + oldName + " to " + newName
+ "!</div>"); + "!</div>");
...@@ -38,24 +40,38 @@ ...@@ -38,24 +40,38 @@
<form class="form-horizontal"> <form class="form-horizontal">
<fieldset> <fieldset>
<legend>Change the name here</legend> <legend>Change the name here</legend>
<label class="control-label" for="input01">Current username</label> <label class="control-label" for="input01">Current username*</label>
<div <div
<%out.write(oldName != null && oldName.length() == 0 ? "class=\"control-group error\"" <%out.write(oldName != null && oldName.length() == 0 ? "class=\"control-group error\""
: "class=\"controls\"");%>> : "class=\"controls\"");%>>
<input type="text" name="oldName" class="input-xlarge" <input type="text" name="oldName" style="height:26px"
class="input-xlarge"
<%out.write(oldName != null && oldName.length() == 0 ? "id=\"inputError\"" : "id=\"input01\"");%>> <%out.write(oldName != null && oldName.length() == 0 ? "id=\"inputError\"" : "id=\"input01\"");%>>
<p class="help-block">The current username e.g user.name <p class="help-block">The current username e.g user.name
(without server)</p> (without server)</p>
</div> </div>
<label class="control-label" for="input01">New username</label> <label class="control-label" for="input01">New username*</label>
<div <div
<%out.write(newName != null && newName.length() == 0 ? "class=\"control-group error\"" <%out.write(newName != null && newName.length() == 0 ? "class=\"control-group error\""
: "class=\"controls\"");%>> : "class=\"controls\"");%>>
<input type="text" name="newName" class="input-xlarge" <input type="text" name="newName" style="height:26px"
class="input-xlarge"
<%out.write(newName != null && newName.length() == 0 ? "id=\"inputError\"" : "id=\"input01\"");%>> <%out.write(newName != null && newName.length() == 0 ? "id=\"inputError\"" : "id=\"input01\"");%>>
<p class="help-block">The new username e.g user.newname <p class="help-block">The new username e.g user.newname
(without server)</p> (without server)</p>
</div> </div>
<label class="control-label" for="input01">New E-Mail address</label>
<div class="controls">
<input type="text" name="email" style="height:26px"
class="input-xlarge" id="input01">
<p class="help-block">New email address. Will copy address from old user if field is empty.</p>
</div>
<label class="control-label" for="input01">New Name</label>
<div class="controls">
<input type="text" name="realName" style="height:26px"
class="input-xlarge" id="input01">
<p class="help-block">Will copy name from old user if field is empty.</p>
</div>
<div class="control-group"> <div class="control-group">
<label class="checkbox"> <input type="checkbox" <label class="checkbox"> <input type="checkbox"
id="optionsCheckbox2" name="copy" value="keepCopy"> Keep a id="optionsCheckbox2" name="copy" value="keepCopy"> Keep a
...@@ -65,6 +81,7 @@ ...@@ -65,6 +81,7 @@
<div class="control-group"> <div class="control-group">
<button type="submit" class="btn btn-primary">Rename user</button> <button type="submit" class="btn btn-primary">Rename user</button>
</div> </div>
<p class="help-block">* Mandatory item</p>
</fieldset> </fieldset>
</form> </form>
......
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