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,192 +229,216 @@ $(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',
'name'=>'pwdconf',
)
);
if($passwordexpiration > 0) { if($passwordexpiration > 0) {
?> $options = array();
<tr> if($currUser)
<td><?php printMLText("password_expiration");?>:</td> $options[] = array('', getMLText("keep"));
<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('now', getMLText('now'));
</tr> $options[] = array(date('Y-m-d H:i:s', time()+$passwordexpiration*86400), getMLText("according_settings"));
<?php $options[] = array('never', getMLText("never"));
$this->formField(
getMLText("password_expiration"),
array(
'element'=>'select',
'name'=>'pwdexpiration',
'options'=>$options
)
);
} }
?> $this->formField(
<tr> getMLText("user_name"),
<td><?php printMLText("user_name");?>:</td> array(
<td><input type="text" name="name" id="name" value="<?php print $currUser ? htmlspecialchars($currUser->getFullName()) : "";?>"></td> 'element'=>'input',
</tr> 'type'=>'text',
<tr> 'id'=>'name',
<td><?php printMLText("email");?>:</td> 'name'=>'name',
<td><input type="text" name="email" id="email" value="<?php print $currUser ? htmlspecialchars($currUser->getEmail()) : "";?>"></td> 'value'=>($currUser ? htmlspecialchars($currUser->getFullName()) : '')
</tr> )
<tr> );
<td><?php printMLText("comment");?>:</td> $this->formField(
<td><textarea name="comment" id="comment" rows="4" cols="50"><?php print $currUser ? htmlspecialchars($currUser->getComment()) : "";?></textarea></td> getMLText("email"),
</tr> array(
<tr> 'element'=>'input',
<td><?php printMLText("role");?>:</td> 'type'=>'text',
<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> 'id'=>'email',
</tr> 'name'=>'email',
<tr> 'value'=>($currUser ? htmlspecialchars($currUser->getEmail()) : '')
<td><?php printMLText("groups");?>:</td> )
<td><select class="chzn-select" multiple="multiple" name="groups[]" data-placeholder="<?php printMLText('select_groups'); ?>"> );
<?php $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 );
$this->formField(getMLText("home_folder"), $this->getFolderChooserHtml("form".($currUser ? $currUser->getId() : '0'), M_READ, -1, $currUser ? $dms->getFolder($currUser->getHomeFolder()) : 0, 'homefolder'));
echo '<script language="JavaScript">';
$this->printFolderChooserJs("form".($currUser ? $currUser->getId() : '0'));
echo '</script>';
$this->formField(
getMLText("quota"),
array(
'element'=>'input',
'type'=>'text',
'id'=>'quota',
'name'=>'quota',
'value'=>($currUser ? $currUser->getQuota() : '')
)
);
if($quota > 0) if($quota > 0)
echo $this->warningMsg(getMLText('current_quota', array('quota'=>SeedDMS_Core_File::format_filesize($quota)))); $this->warningMsg(getMLText('current_quota', array('quota'=>SeedDMS_Core_File::format_filesize($quota))));
else else
echo $this->warningMsg(getMLText('quota_is_disabled')); $this->warningMsg(getMLText('quota_is_disabled'));
?> $this->formField(
</td> getMLText("is_hidden"),
</tr> array(
<tr> 'element'=>'input',
<td><?php printMLText("is_hidden");?>:</td> 'type'=>'checkbox',
<td><input type="checkbox" name="ishidden" value="1"<?php print ($currUser && $currUser->isHidden() ? " checked='checked'" : "");?>></td> 'name'=>'ishidden',
</tr> 'value'=>1,
<tr> 'checked'=>$currUser && $currUser->isHidden()
<td><?php printMLText("is_disabled");?>:</td> )
<td><input type="checkbox" name="isdisabled" value="1"<?php print ($currUser && $currUser->isDisabled() ? " checked='checked'" : "");?>></td> );
</tr> $this->formField(
getMLText("is_disabled"),
<?php if ($enableuserimage){ ?> array(
'element'=>'input',
<?php if ($currUser) { ?> 'type'=>'checkbox',
<tr> 'name'=>'isdisabled',
<td><?php printMLText("user_image");?>:</td> 'value'=>1,
<td> 'checked'=>$currUser && $currUser->isDisabled()
<?php )
if ($currUser->hasImage()) );
print "<img src=\"".$httproot . "out/out.UserImage.php?userid=".$currUser->getId()."\">"; if ($enableuserimage) {
else if ($currUser) {
printMLText("no_user_image"); $this->formField(
?> getMLText("user_image"),
</td> ($currUser->hasImage() ? "<img src=\"".$httproot."out/out.UserImage.php?userid=".$currUser->getId()."\">" : getMLText('no_user_image'))
</tr> );
<tr> $this->formField(
<td><?php printMLText("new_user_image");?>:</td> getMLText("new_user_image"),
<td> $this->getFileChooser('userfile', false, "image/jpeg")
<?php );
$this->printFileChooser('userfile', false, "image/jpeg"); } else {
?> $this->formField(
</td> getMLText("user_image"),
</tr> $this->getFileChooser('userfile', false, "image/jpeg")
<?php } else { ?> );
<tr> }
<td><?php printMLText("user_image");?>:</td>
<td>
<?php
$this->printFileChooser('userfile', false, 'image/jpeg');
?>
</td>
</tr>
<?php } ?>
<?php
} }
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'))),
'multiple'=>true,
'options'=>$options
)
);
} }
?>
<tr> $this->contentSubHeading(getMLText("mandatory_approvers"));
<td colspan="2"><?php printMLText("approvers");?>:</td> $options = array();
</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) if($currUser)
$res=$currUser->getMandatoryApprovers(); $res=$currUser->getMandatoryApprovers();
else else
@ -426,65 +450,64 @@ $(document).ready( function() {
$checked=false; $checked=false;
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $checked=true; foreach ($res as $r) if ($r['approverUserID']==$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'=>'usrApprovers[]',
<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="grpApprovers[]" 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['approverGroupID']==$grp->getID()) $checked=true; foreach ($res as $r) if ($r['approverGroupID']==$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'=>'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(
getMLText("workflow"),
array(
'element'=>'select',
'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"));
?> ?>
</select>
</td>
</tr>
<?php
}
}
?>
<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
} /* }}} */ } /* }}} */