2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

new "client" pages

NEW feature: pass generator for  new user add
This commit is contained in:
Alex
2015-03-23 11:45:48 +03:00
parent 43a1979a7d
commit 979981adb6
2 changed files with 453 additions and 402 deletions

View File

@@ -106,8 +106,6 @@ function vqd($client_id,$questionnaire_id)
} }
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$db->StartTrans(); $db->StartTrans();
@@ -132,7 +130,6 @@ if (isset($_POST['submit']))
} }
$sql = "SELECT questionnaire_id,description $sql = "SELECT questionnaire_id,description
FROM questionnaire FROM questionnaire
WHERE enabled = 1 WHERE enabled = 1
@@ -140,14 +137,14 @@ $sql = "SELECT questionnaire_id,description
$questionnaires = $db->GetAll($sql); $questionnaires = $db->GetAll($sql);
$sql = "SELECT client_id,firstname as description $sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username
FROM client FROM client
ORDER by client_id ASC"; ORDER by client_id ASC";
$clients = $db->GetAll($sql); $clients = $db->GetAll($sql);
xhtml_head(T_("Assign clients to questionnaires"),false,array("../css/table.css")); xhtml_head(T_("Assign clients to questionnaires"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/iCheck/icheck.min.js"));
?> ?>
@@ -206,7 +203,6 @@ function checkQid(q)
} }
function checkVid(v) function checkVid(v)
{ {
@@ -229,51 +225,50 @@ function checkVid(v)
VidOn = 0; VidOn = 0;
} }
</script> </script>
</head> </head>
<body> <body>
<?php <?php
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Client") . "&emsp;</th>";
print "<form action=\"\" method=\"post\"><table>";
print "<tr><th></th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>"; print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
} }
print "</tr>"; print "</tr></thead>";
$class = 0;
foreach($clients as $v) foreach($clients as $v)
{ {
print "<tr class='"; print "<tr class=''>
if ($class == 0) {$class = 1; print "even";} else {$class = 0; print "odd";} <th>&emsp;{$v['username']}&emsp;</th>
print "'>"; <th>&emsp;<a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a>&emsp;</th>";
print "<th><a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a></th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
$checked = ""; $checked = "";
if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\""; if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
print "<td><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" $checked></input></td>"; print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" $checked></input></td>";
} }
print "</tr>"; print "</tr>";
} }
print "</table><p><input type=\"submit\" name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></p></form>"; print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>";
xhtml_foot(); xhtml_foot();
?> ?>
<script type="text/javascript">
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
increaseArea: '30%'
});
</script>

View File

@@ -78,7 +78,7 @@ if (isset($_POST['client']))
$htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT); $htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT);
} }
$a = T_("Added: $client"); $a = T_("Added: $client");
} }
else else
$a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name"); $a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name");
@@ -86,7 +86,7 @@ if (isset($_POST['client']))
} }
xhtml_head(T_("Add a client")); xhtml_head(T_("Add a client"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
$sql = "SELECT Time_zone_name as value, Time_zone_name as description $sql = "SELECT Time_zone_name as value, Time_zone_name as description
FROM timezone_template"; FROM timezone_template";
@@ -97,27 +97,83 @@ $rs = $db->GetAll($sql);
if ($a) if ($a)
{ {
?> ?>
<h3><?php echo $a; ?></h3> <div class='alert alert-info'><?php echo $a; ?></div>
<?php <?php
} }
?> ?>
<h1><?php echo T_("Add a client"); ?></h1>
<p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><?php echo T_("Assign client to Questionnaire"); ?></a> <?php echo T_("tool."); ?></p> <script type="text/javascript">
<p><?php echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p> //Password generator
<form enctype="multipart/form-data" action="" method="post"> upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
<p><?php echo T_("Enter the username of a client to add:"); ?> <input name="client" type="text"/></p> low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?> dig = new Array('0','1','2','3','4','5','6','7','8','9');
<p><?php echo T_("Enter the password of a client to add:"); ?> <input name="password" type="text"/></p> sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
function rnd(x,y,z) {
var num;
do {
num = parseInt(Math.random()*z);
if (num >= x && num <= y) break;
} while (true);
return(num);
}
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
function generate() {
var pwd = '';
var res, s;
var k = 0;
var n = document.addclient.number.value;
var pass = new Array();
var w = rnd(30,80,100);
for (var r = 0; r < w; r++) {
res = rnd(1,25,100); pass[k] = upp[res]; k++;
res = rnd(1,25,100); pass[k] = low[res]; k++;
res = rnd(1,9,100); pass[k] = dig[res]; k++;
res = rnd(1,24,100); pass[k] = sym[res]; k++;
}
for (var i = 0; i < n; i++) {
s = rnd(1,k-1,100);
pwd+= pass[s];
}
document.addclient.password.value = pwd;
}
</script>
<div class="well">
<p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><?php echo T_("Assign client to Questionnaire"); ?></a> <?php echo T_("tool."); ?></p>
<p><?php echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p></div>
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal" name="addclient" >
<div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the username of a client to add:"); ?></label>
<input name="client" type="text" class="form-control pull-left" required size="40" />
</div>
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the password of a client to add:"); ?></label>
<input name="password" type="text" class="form-control pull-left" size="40" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" />
<div class="form-inline">&emsp;&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div>
</div>
<?php } ?> <?php } ?>
<p><?php echo T_("Enter the first name of a client to add:"); ?> <input name="firstname" type="text"/></p> <div class="form-group form-inline">
<p><?php echo T_("Enter the surname of a client to add:"); ?> <input name="lastname" type="text"/></p> <label class="control-label col-sm-3"><?php echo T_("Enter the first name of a client to add:"); ?></label>
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE"))); ?> </p> <input name="firstname" type="text" class="form-control pull-left" size="40" />
<p><input type="submit" value="<?php echo T_("Add user"); ?>" /></p> </div>
<div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the surname of a client to add:"); ?></label>
<input name="lastname" type="text" class="form-control pull-left" size="40"/>
</div>
<div class="form-group form-inline">
<label class="control-label col-sm-3"><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a></label>";
display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"pull-left"); ?>
</div>
<input type="submit" value="<?php echo T_("Add a client"); ?>" class="btn btn-primary col-sm-offset-3 col-sm-3"/>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
?> ?>