forked from science-ation/science-ation
- Fix the create user, ask for an email, not a name (because need to insert a unique username,year pair now). Make it a popup window.
- TODO: use AJAX to give feedback as to whether the username already exists.
This commit is contained in:
parent
cb39440d16
commit
d3acfa1fe9
@ -31,14 +31,6 @@
|
|||||||
if($_POST['users_uid'])
|
if($_POST['users_uid'])
|
||||||
$uid = intval($_POST['users_uid']);
|
$uid = intval($_POST['users_uid']);
|
||||||
|
|
||||||
/* Some actions we want to redirect to the personal editor, so deal with those first */
|
|
||||||
if($_POST['add_member']) {
|
|
||||||
$email = $_POST['add_member'];
|
|
||||||
$u = user_create('committee', $email);
|
|
||||||
user_save($u);
|
|
||||||
header("location: {$config['SFIABDIRECTORY']}/user_personal.php?edit={$u['id']}");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now, start the output for this page */
|
/* Now, start the output for this page */
|
||||||
send_header("Committee Management",
|
send_header("Committee Management",
|
||||||
@ -56,15 +48,19 @@ if($_POST['users_uid'])
|
|||||||
|
|
||||||
function openeditor(id)
|
function openeditor(id)
|
||||||
{
|
{
|
||||||
currentid=id;
|
window.open("user_editor_window.php?id="+id,"User Editor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
|
||||||
/* else
|
|
||||||
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;*/
|
|
||||||
|
|
||||||
window.open("user_editor_window.php?id="+currentid,"User Editor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function neweditor()
|
||||||
|
{
|
||||||
|
var username = document.forms.addmember.add_member.value;
|
||||||
|
window.open("user_editor_window.php?type=committee&username="+username,"User Editor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
|
||||||
|
document.forms.addmember.add_member.value = "";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getElement(e,f)
|
function getElement(e,f)
|
||||||
{
|
{
|
||||||
if(document.layers)
|
if(document.layers)
|
||||||
@ -129,7 +125,6 @@ function actionSubmit()
|
|||||||
</script>
|
</script>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
|
|
||||||
if($_POST['addcommittee'])
|
if($_POST['addcommittee'])
|
||||||
{
|
{
|
||||||
//add a new committee
|
//add a new committee
|
||||||
@ -217,15 +212,6 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee'])
|
|||||||
echo happy(i18n("Committee member unlinked from committee"));
|
echo happy(i18n("Committee member unlinked from committee"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This seems to be unused (there would also be an sql error on the INSERT :p) :
|
|
||||||
if($_POST['add_member_to_committees_id'])
|
|
||||||
{
|
|
||||||
$add = intval($_POST['add_member_to_committees_id']);
|
|
||||||
mysql_query("INSERT INTO committees_link (committees_id,users_uid) VALUES ('$add')");
|
|
||||||
$edit=$_POST['committees_members_id'];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
echo "<table>";
|
echo "<table>";
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
@ -241,12 +227,12 @@ if($_POST['add_member_to_committees_id'])
|
|||||||
echo "</td><td width=\"40\"> </td><td>";
|
echo "</td><td width=\"40\"> </td><td>";
|
||||||
|
|
||||||
echo "<h4>".i18n("Add Committee Member")."</h4>\n";
|
echo "<h4>".i18n("Add Committee Member")."</h4>\n";
|
||||||
echo "<form method=\"post\" action=\"committees.php\">\n";
|
echo "<form method=\"post\" name=\"addmember\" action=\"committees.php\">\n";
|
||||||
echo "<table>\n";
|
echo "<table>\n";
|
||||||
echo "<tr><td>".i18n("Member Email").": </td><td>";
|
echo "<tr><td>".i18n("Member Email").": </td><td>";
|
||||||
echo "<input type=\"text\" size=\"15\" name=\"add_member\" />\n";
|
echo "<input type=\"text\" size=\"15\" name=\"add_member\" />\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo " <td><input type=\"submit\" value=\"".i18n("Add")."\" /></td></tr>\n";
|
echo " <td><input type=\"submit\" onclick=\"neweditor();\"value=\"".i18n("Add")."\" /></td></tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
|
@ -63,7 +63,23 @@ $tabs = array('personal' => array(
|
|||||||
$selected = $_GET['tab'];
|
$selected = $_GET['tab'];
|
||||||
if(!array_key_exists($selected, $tabs)) $selected = 'personal';
|
if(!array_key_exists($selected, $tabs)) $selected = 'personal';
|
||||||
|
|
||||||
$id = $_GET['id'];
|
if(array_key_exists('username',$_GET)) {
|
||||||
|
$username = $_GET['username'];
|
||||||
|
$type = $_GET['type'];
|
||||||
|
$un = mysql_escape_string($username);
|
||||||
|
$q = mysql_query("SELECT id,MAX(year),deleted FROM users WHERE username='$un'");
|
||||||
|
$r = mysql_fetch_object($q);
|
||||||
|
if($r->deleted == 'no') {
|
||||||
|
echo "Username already exists.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$u = user_create($type, $username);
|
||||||
|
$u['email'] = $username;
|
||||||
|
user_save($u);
|
||||||
|
$id = $u['id'];
|
||||||
|
} else {
|
||||||
|
$id = $_GET['id'];
|
||||||
|
}
|
||||||
|
|
||||||
$u = user_load($id);
|
$u = user_load($id);
|
||||||
send_popup_header(i18n("User Editor").": {$u['name']}");
|
send_popup_header(i18n("User Editor").": {$u['name']}");
|
||||||
|
Loading…
Reference in New Issue
Block a user