use formField() instead of plain html

This commit is contained in:
Uwe Steinmann 2018-06-21 11:56:05 +02:00
parent 639b11b52b
commit 1fa1644fce
3 changed files with 33 additions and 23 deletions

View File

@ -1095,26 +1095,32 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
return $content;
} /* }}} */
function printDocumentChooserHtml($formName) { /* {{{ */
print "<input type=\"hidden\" id=\"docid".$formName."\" name=\"docid\" value=\"\">";
print "<div class=\"input-append\">\n";
print "<input type=\"text\" id=\"choosedocsearch".$formName."\" data-target=\"docid".$formName."\" data-provide=\"typeahead\" name=\"docname".$formName."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />";
print "<a data-target=\"#docChooser".$formName."\" href=\"../out/out.DocumentChooser.php?form=".$formName."&folderid=".$this->params['rootfolderid']."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".getMLText("document")."…</a>\n";
print "</div>\n";
?>
<div class="modal hide" id="docChooser<?php echo $formName ?>" tabindex="-1" role="dialog" aria-labelledby="docChooserLabel" aria-hidden="true">
function getDocumentChooserHtml($formName) { /* {{{ */
$content = '';
$content .= "<input type=\"hidden\" id=\"docid".$formName."\" name=\"docid\" value=\"\">";
$content .= "<div class=\"input-append\">\n";
$content .= "<input type=\"text\" id=\"choosedocsearch".$formName."\" data-target=\"docid".$formName."\" data-provide=\"typeahead\" name=\"docname".$formName."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />";
$content .= "<a data-target=\"#docChooser".$formName."\" href=\"../out/out.DocumentChooser.php?form=".$formName."&folderid=".$this->params['rootfolderid']."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".getMLText("document")."…</a>\n";
$content .= "</div>\n";
$content .= '
<div class="modal hide" id="docChooser'.$formName.'" tabindex="-1" role="dialog" aria-labelledby="docChooserLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="docChooserLabel"><?php printMLText("choose_target_document") ?></h3>
<h3 id="docChooserLabel">'.getMLText("choose_target_document").'</h3>
</div>
<div class="modal-body">
<p><?php printMLText('tree_loading') ?></p>
<p>'.getMLText('tree_loading').'</p>
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"><?php printMLText("close") ?></button>
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">'.getMLText("close").'</button>
</div>
</div>
<?php
';
return $content;
} /* }}} */
function printDocumentChooserHtml($formName) { /* {{{ */
echo self::getDocumentChooserHtml($formName);
} /* }}} */
function printDocumentChooserJs($formName) { /* {{{ */

View File

@ -193,11 +193,10 @@ class SeedDMS_View_ManageNotify extends SeedDMS_Bootstrap_Style {
$this->contentHeading(getMLText("edit_document_notify"));
$this->contentContainerStart();
print "<form method=\"post\" action=\"../op/op.ManageNotify.php?type=document&action=add\" name=\"form2\">";
$this->contentSubHeading(getMLText("choose_target_document"));
/* 'form1' must be passed to printDocumentChooser() because the typeahead
* function is currently hardcoded on this value */
$this->printDocumentChooserHtml("form2");
print "<br /><button type='submit' class='btn'><i class=\"icon-plus\"></i> ".getMLText("add")."</button>";
$this->formField(getMLText("choose_target_document"), $this->getDocumentChooserHtml("form2"));
$this->formSubmit("<i class=\"icon-plus\"></i> ".getMLText('add'));
print "</form>";
$this->contentContainerEnd();

View File

@ -1380,19 +1380,24 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$this->contentContainerStart();
?>
<br>
<form action="../op/op.AddDocumentLink.php" name="form1" class="form-inline">
<form action="../op/op.AddDocumentLink.php" name="form1" class="form-horizontal">
<input type="hidden" name="documentid" value="<?php print $documentid;?>">
<?php printMLText("add_document_link");?>:
<?php $this->printDocumentChooserHtml("form1");?>
<?php $this->formField(getMLText("add_document_link"), $this->getDocumentChooserHtml("form1")); ?>
<?php
if ($document->getAccessMode($user) >= M_READWRITE) {
print "<label class=\"checkbox\">";
print "<input type=\"checkbox\" name=\"public\" value=\"true\" checked />";
print getMLText("document_link_public");
print "</label>";
$this->formField(
getMLText("document_link_public"),
array(
'element'=>'input',
'type'=>'checkbox',
'name'=>'public',
'value'=>'true',
'checked'=>true
)
);
}
$this->formSubmit("<i class=\"icon-save\"></i> ".getMLText('save'));
?>
<button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
</form>
<?php
$this->contentContainerEnd();