replace old table layout with form-controls

This commit is contained in:
Uwe Steinmann 2018-06-21 17:56:22 +02:00
parent 60a71e2397
commit 09f35e33e6

View File

@ -229,262 +229,285 @@ $(document).ready( function() {
<input type="hidden" name="action" value="adduser"> <input type="hidden" name="action" value="adduser">
<?php <?php
} }
?> $this->formField(
<table class="table-condensed"> getMLText("user_login"),
<tr> array(
<td><?php printMLText("user_login");?>:</td> 'element'=>'input',
<td><input type="text" name="login" id="login" value="<?php print $currUser ? htmlspecialchars($currUser->getLogin()) : "";?>"></td> 'type'=>'text',
</tr> 'id'=>'login',
<tr> 'name'=>'login',
<td><?php printMLText("password");?>:</td> 'value'=>($currUser ? htmlspecialchars($currUser->getLogin()) : '')
<td><input type="password" class="pwd" rel="strengthbar<?php echo $currUser ? $currUser->getID() : "0"; ?>" name="pwd" id="pwd"><?php if($currUser && $currUser->isGuest()) echo ' <input type="checkbox" name="clearpwd" value="1" /> '.getMLText('clear_password'); ?></td> )
</tr> );
<?php $this->formField(
getMLText("password"),
'<input type="password" class="pwd form-control" rel="strengthbar'.($currUser ? $currUser->getID() : "0").'" name="pwd" id="pwd">'.(($currUser && $currUser->isGuest()) ? ' <input type="checkbox" name="clearpwd" value="1" /> '.getMLText('clear_password') : '')
);
if($passwordstrength > 0) { if($passwordstrength > 0) {
?> $this->formField(
<tr> getMLText("password_strength"),
<td><?php printMLText("password_strength");?>:</td> '<div id="strengthbar'.($currUser ? $currUser->getID() : "0").'" class="progress" style="width: 220px; height: 30px; margin-bottom: 8px;"><div class="bar bar-danger" style="width: 0%;"></div></div>'
<td> );
<div id="strengthbar<?php echo $currUser ? $currUser->getID() : "0"; ?>" class="progress" style="width: 220px; height: 30px; margin-bottom: 8px;"><div class="bar bar-danger" style="width: 0%;"></div></div>
</td>
</tr>
<?php
} }
?> $this->formField(
<tr> getMLText("confirm_pwd"),
<td><?php printMLText("confirm_pwd");?>:</td> array(
<td><input type="Password" name="pwdconf" id="pwdconf"></td> 'element'=>'input',
</tr> 'type'=>'password',
<?php 'id'=>'pwdconf',
if($passwordexpiration > 0) { 'name'=>'pwdconf',
?> )
<tr> );
<td><?php printMLText("password_expiration");?>:</td> if($passwordexpiration > 0) {
<td><select name="pwdexpiration"><?php if($currUser) { ?><option value=""><?php printMLText("keep");?></option><?php } ?><option value="now"><?php printMLText("now");?></option><option value="<?php echo date('Y-m-d H:i:s', time()+$passwordexpiration*86400); ?>"><?php printMLText("according_settings");?></option><option value="never"><?php printMLText("never");?></option></select> <?php echo $currUser ? $currUser->getPwdExpiration() : ""; ?></td> $options = array();
</tr> if($currUser)
<?php $options[] = array('', getMLText("keep"));
} $options[] = array('now', getMLText('now'));
?> $options[] = array(date('Y-m-d H:i:s', time()+$passwordexpiration*86400), getMLText("according_settings"));
<tr> $options[] = array('never', getMLText("never"));
<td><?php printMLText("user_name");?>:</td> $this->formField(
<td><input type="text" name="name" id="name" value="<?php print $currUser ? htmlspecialchars($currUser->getFullName()) : "";?>"></td> getMLText("password_expiration"),
</tr> array(
<tr> 'element'=>'select',
<td><?php printMLText("email");?>:</td> 'name'=>'pwdexpiration',
<td><input type="text" name="email" id="email" value="<?php print $currUser ? htmlspecialchars($currUser->getEmail()) : "";?>"></td> 'options'=>$options
</tr> )
<tr> );
<td><?php printMLText("comment");?>:</td> }
<td><textarea name="comment" id="comment" rows="4" cols="50"><?php print $currUser ? htmlspecialchars($currUser->getComment()) : "";?></textarea></td> $this->formField(
</tr> getMLText("user_name"),
<tr> array(
<td><?php printMLText("role");?>:</td> 'element'=>'input',
<td><select name="role"><option value="<?php echo SeedDMS_Core_User::role_user ?>"><?php printMLText("role_user"); ?></option><option value="<?php echo SeedDMS_Core_User::role_admin ?>" <?php if($currUser && $currUser->getRole() == SeedDMS_Core_User::role_admin) echo "selected"; ?>><?php printMLText("role_admin"); ?></option><option value="<?php echo SeedDMS_Core_User::role_guest ?>" <?php if($currUser && $currUser->getRole() == SeedDMS_Core_User::role_guest) echo "selected"; ?>><?php printMLText("role_guest"); ?></option></select></td> 'type'=>'text',
</tr> 'id'=>'name',
<tr> 'name'=>'name',
<td><?php printMLText("groups");?>:</td> 'value'=>($currUser ? htmlspecialchars($currUser->getFullName()) : '')
<td><select class="chzn-select" multiple="multiple" name="groups[]" data-placeholder="<?php printMLText('select_groups'); ?>"> )
<?php );
$this->formField(
getMLText("email"),
array(
'element'=>'input',
'type'=>'text',
'id'=>'email',
'name'=>'email',
'value'=>($currUser ? htmlspecialchars($currUser->getEmail()) : '')
)
);
$this->formField(
getMLText("comment"),
array(
'element'=>'textarea',
'name'=>'comment',
'id'=>'comment',
'rows'=>4,
'cols'=>50,
'value'=>($currUser ? htmlspecialchars($currUser->getComment()) : '')
)
);
$options = array();
$options[] = array(SeedDMS_Core_User::role_user, getMLText('role_user'));
$options[] = array(SeedDMS_Core_User::role_admin, getMLText('role_admin'), $currUser && $currUser->getRole() == SeedDMS_Core_User::role_admin);
$options[] = array(SeedDMS_Core_User::role_guest, getMLText('role_guest'), $currUser && $currUser->getRole() == SeedDMS_Core_User::role_guest);
$this->formField(
getMLText("role"),
array(
'element'=>'select',
'name'=>'role',
'options'=>$options
)
);
$options = array();
foreach($groups as $group) { foreach($groups as $group) {
echo '<option value="'.$group->getID().'"'.($currUser && $group->isMember($currUser) ? ' selected' : '').'>'.$group->getName().'</option>'; $options[] = array($group->getID(), $group->getName(), ($currUser && $group->isMember($currUser)));
} }
?> $this->formField(
</select></td> getMLText("groups"),
</tr> array(
<tr> 'element'=>'select',
<td><?php printMLText("home_folder")?>:</td> 'name'=>'groups[]',
<td><?php $this->printFolderChooser("form".($currUser ? $currUser->getId() : '0'), M_READ, -1, $currUser ? $dms->getFolder($currUser->getHomeFolder()) : 0, 'homefolder');?></td> 'class'=>'chzn-select',
</tr> 'multiple'=>true,
<tr> 'attributes'=>array(array('data-placeholder', getMLText('select_groups'))),
<td><?php printMLText("quota");?>:</td> 'options'=>$options
<td><input type="text" name="quota" value="<?php echo $currUser ? $currUser->getQuota() : ""; ?>"> )
<?php );
if($quota > 0) $this->formField(getMLText("home_folder"), $this->getFolderChooserHtml("form".($currUser ? $currUser->getId() : '0'), M_READ, -1, $currUser ? $dms->getFolder($currUser->getHomeFolder()) : 0, 'homefolder'));
echo $this->warningMsg(getMLText('current_quota', array('quota'=>SeedDMS_Core_File::format_filesize($quota)))); echo '<script language="JavaScript">';
else $this->printFolderChooserJs("form".($currUser ? $currUser->getId() : '0'));
echo $this->warningMsg(getMLText('quota_is_disabled')); echo '</script>';
?>
</td>
</tr>
<tr>
<td><?php printMLText("is_hidden");?>:</td>
<td><input type="checkbox" name="ishidden" value="1"<?php print ($currUser && $currUser->isHidden() ? " checked='checked'" : "");?>></td>
</tr>
<tr>
<td><?php printMLText("is_disabled");?>:</td>
<td><input type="checkbox" name="isdisabled" value="1"<?php print ($currUser && $currUser->isDisabled() ? " checked='checked'" : "");?>></td>
</tr>
<?php if ($enableuserimage){ ?> $this->formField(
getMLText("quota"),
<?php if ($currUser) { ?> array(
<tr> 'element'=>'input',
<td><?php printMLText("user_image");?>:</td> 'type'=>'text',
<td> 'id'=>'quota',
<?php 'name'=>'quota',
if ($currUser->hasImage()) 'value'=>($currUser ? $currUser->getQuota() : '')
print "<img src=\"".$httproot . "out/out.UserImage.php?userid=".$currUser->getId()."\">"; )
else );
printMLText("no_user_image"); if($quota > 0)
?> $this->warningMsg(getMLText('current_quota', array('quota'=>SeedDMS_Core_File::format_filesize($quota))));
</td> else
</tr> $this->warningMsg(getMLText('quota_is_disabled'));
<tr> $this->formField(
<td><?php printMLText("new_user_image");?>:</td> getMLText("is_hidden"),
<td> array(
<?php 'element'=>'input',
$this->printFileChooser('userfile', false, "image/jpeg"); 'type'=>'checkbox',
?> 'name'=>'ishidden',
</td> 'value'=>1,
</tr> 'checked'=>$currUser && $currUser->isHidden()
<?php } else { ?> )
<tr> );
<td><?php printMLText("user_image");?>:</td> $this->formField(
<td> getMLText("is_disabled"),
<?php array(
$this->printFileChooser('userfile', false, 'image/jpeg'); 'element'=>'input',
?> 'type'=>'checkbox',
</td> 'name'=>'isdisabled',
</tr> 'value'=>1,
<?php } ?> 'checked'=>$currUser && $currUser->isDisabled()
)
<?php );
if ($enableuserimage) {
if ($currUser) {
$this->formField(
getMLText("user_image"),
($currUser->hasImage() ? "<img src=\"".$httproot."out/out.UserImage.php?userid=".$currUser->getId()."\">" : getMLText('no_user_image'))
);
$this->formField(
getMLText("new_user_image"),
$this->getFileChooser('userfile', false, "image/jpeg")
);
} else {
$this->formField(
getMLText("user_image"),
$this->getFileChooser('userfile', false, "image/jpeg")
);
}
} }
if($workflowmode == "traditional" || $workflowmode == 'traditional_only_approval') { if($workflowmode == "traditional" || $workflowmode == 'traditional_only_approval') {
if($workflowmode == "traditional") { if($workflowmode == "traditional") {
?> $this->contentSubHeading(getMLText("mandatory_reviewers"));
$options = array();
<tr>
<td colspan="2"><?php printMLText("reviewers");?>:</td>
</tr>
<tr>
<td>
<div class="cbSelectTitle"><?php printMLText("individuals");?>:</div>
</td>
<td>
<select class="chzn-select" name="usrReviewers[]" multiple="multiple" data-placeholder="<?php printMLText('select_users'); ?>">
<?php
if($currUser) if($currUser)
$res=$currUser->getMandatoryReviewers(); $res=$currUser->getMandatoryReviewers();
else else
$res = array(); $res = array();
foreach ($users as $usr) { foreach ($users as $usr) {
if ($usr->isGuest() || ($currUser && $usr->getID() == $currUser->getID())) if ($usr->isGuest() || ($currUser && $usr->getID() == $currUser->getID()))
continue; continue;
$checked=false; $checked=false;
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $checked=true; foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $checked=true;
print "<option value=\"".$usr->getID()."\" ".($checked?"selected='selected' ":"").">". htmlspecialchars($usr->getLogin()." - ".$usr->getFullName())."</option>"; $options[] = array($usr->getID(), htmlspecialchars($usr->getLogin()." - ".$usr->getFullName()), $checked);
} }
?> $this->formField(
</select> getMLText("individuals"),
</td> array(
</tr> 'element'=>'select',
<tr> 'name'=>'usrReviewers[]',
<td> 'class'=>'chzn-select',
<div class="cbSelectTitle"><?php printMLText("groups");?>:</div> 'attributes'=>array(array('data-placeholder', getMLText('select_users'))),
</td> 'multiple'=>true,
<td> 'options'=>$options
<select class="chzn-select" name="grpReviewers[]" multiple="multiple" data-placeholder="<?php printMLText('select_groups'); ?>"> )
<?php );
$options = array();
foreach ($groups as $grp) { foreach ($groups as $grp) {
$checked=false; $checked=false;
foreach ($res as $r) if ($r['reviewerGroupID']==$grp->getID()) $checked=true; foreach ($res as $r) if ($r['reviewerGroupID']==$grp->getID()) $checked=true;
print "<option value=\"".$grp->getID()."\" ".($checked?"selected='selected' ":"").">". htmlspecialchars($grp->getName())."</option>"; $options[] = array($grp->getID(), htmlspecialchars($grp->getName()), $checked);
} }
?> $this->formField(
</select> getMLText("groups"),
</td> array(
</tr> 'element'=>'select',
<?php 'name'=>'grpReviewers[]',
} 'class'=>'chzn-select',
?> 'attributes'=>array(array('data-placeholder', getMLText('select_groups'))),
<tr> 'multiple'=>true,
<td colspan="2"><?php printMLText("approvers");?>:</td> 'options'=>$options
</tr> )
<tr> );
<td> }
<div class="cbSelectTitle"><?php printMLText("individuals");?>:</div>
</td>
<td>
<select class="chzn-select" name="usrApprovers[]" multiple="multiple" data-placeholder="<?php printMLText('select_users'); ?>">
<?php
if($currUser)
$res=$currUser->getMandatoryApprovers();
else
$res = array();
foreach ($users as $usr) {
if ($usr->isGuest() || ($currUser && $usr->getID() == $currUser->getID()))
continue;
$checked=false; $this->contentSubHeading(getMLText("mandatory_approvers"));
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $checked=true; $options = array();
if($currUser)
$res=$currUser->getMandatoryApprovers();
else
$res = array();
foreach ($users as $usr) {
if ($usr->isGuest() || ($currUser && $usr->getID() == $currUser->getID()))
continue;
print "<option value=\"".$usr->getID()."\" ".($checked?"selected='selected' ":"").">". htmlspecialchars($usr->getLogin()." - ".$usr->getFullName())."</option>"; $checked=false;
} foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $checked=true;
?>
</select>
</td>
</tr>
<tr>
<td>
<div class="cbSelectTitle"><?php printMLText("groups");?>:</div>
</td>
<td>
<select class="chzn-select" name="grpApprovers[]" multiple="multiple" data-placeholder="<?php printMLText('select_groups'); ?>">
<?php
foreach ($groups as $grp) {
$checked=false; $options[] = array($usr->getID(), htmlspecialchars($usr->getLogin()." - ".$usr->getFullName()), $checked);
foreach ($res as $r) if ($r['approverGroupID']==$grp->getID()) $checked=true; }
$this->formField(
getMLText("individuals"),
array(
'element'=>'select',
'name'=>'usrApprovers[]',
'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_users'))),
'multiple'=>true,
'options'=>$options
)
);
$options = array();
foreach ($groups as $grp) {
print "<option value=\"".$grp->getID()."\" ".($checked?"selected='selected' ":"").">". htmlspecialchars($grp->getName())."</option>"; $checked=false;
} foreach ($res as $r) if ($r['approverGroupID']==$grp->getID()) $checked=true;
?>
</select> $options[] = array($grp->getID(), htmlspecialchars($grp->getName()), $checked);
</td> }
</tr> $this->formField(
<?php getMLText("groups"),
array(
'element'=>'select',
'name'=>'grpApprovers[]',
'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_groups'))),
'multiple'=>true,
'options'=>$options
)
);
} else { } else {
$workflows = $dms->getAllWorkflows(); $workflows = $dms->getAllWorkflows();
if($workflows) { if($workflows) {
?> $this->contentSubHeading(getMLText("workflow"));
<tr> $options = array();
<td>
<div class="cbSelectTitle"><?php printMLText("workflow");?>:</div>
</td>
<td>
<select class="chzn-select" name="workflows[]" multiple="multiple" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php
print "<option value=\"\">"."</option>";
$mandatoryworkflows = $currUser ? $currUser->getMandatoryWorkflows() : array(); $mandatoryworkflows = $currUser ? $currUser->getMandatoryWorkflows() : array();
foreach ($workflows as $workflow) { foreach ($workflows as $workflow) {
print "<option value=\"".$workflow->getID()."\"";
$checked = false; $checked = false;
if($mandatoryworkflows) foreach($mandatoryworkflows as $mw) if($mw->getID() == $workflow->getID()) $checked = true; if($mandatoryworkflows) foreach($mandatoryworkflows as $mw) if($mw->getID() == $workflow->getID()) $checked = true;
if($checked) $options[] = array($workflow->getID(), htmlspecialchars($workflow->getName()), $checked);
echo " selected=\"selected\"";
print ">". htmlspecialchars($workflow->getName())."</option>";
} }
?> $this->formField(
</select> getMLText("workflow"),
</td> array(
</tr> 'element'=>'select',
<?php 'name'=>'workflows[]',
'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_workflow'))),
'multiple'=>true,
'options'=>$options
)
);
} }
} }
$this->formSubmit("<i class=\"icon-save\"></i> ".getMLText($currUser ? "save" : "add_user"));
?> ?>
<tr>
<td></td>
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText($currUser ? "save" : "add_user")?></button></td>
</tr>
</table>
</form> </form>
<?php <?php
} /* }}} */ } /* }}} */