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; return $content;
} /* }}} */ } /* }}} */
function printDocumentChooserHtml($formName) { /* {{{ */ function getDocumentChooserHtml($formName) { /* {{{ */
print "<input type=\"hidden\" id=\"docid".$formName."\" name=\"docid\" value=\"\">"; $content = '';
print "<div class=\"input-append\">\n"; $content .= "<input type=\"hidden\" id=\"docid".$formName."\" name=\"docid\" value=\"\">";
print "<input type=\"text\" id=\"choosedocsearch".$formName."\" data-target=\"docid".$formName."\" data-provide=\"typeahead\" name=\"docname".$formName."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; $content .= "<div class=\"input-append\">\n";
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"; $content .= "<input type=\"text\" id=\"choosedocsearch".$formName."\" data-target=\"docid".$formName."\" data-provide=\"typeahead\" name=\"docname".$formName."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />";
print "</div>\n"; $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";
<div class="modal hide" id="docChooser<?php echo $formName ?>" tabindex="-1" role="dialog" aria-labelledby="docChooserLabel" aria-hidden="true"> $content .= '
<div class="modal hide" id="docChooser'.$formName.'" tabindex="-1" role="dialog" aria-labelledby="docChooserLabel" aria-hidden="true">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <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>
<div class="modal-body"> <div class="modal-body">
<p><?php printMLText('tree_loading') ?></p> <p>'.getMLText('tree_loading').'</p>
</div> </div>
<div class="modal-footer"> <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>
</div> </div>
<?php ';
return $content;
} /* }}} */
function printDocumentChooserHtml($formName) { /* {{{ */
echo self::getDocumentChooserHtml($formName);
} /* }}} */ } /* }}} */
function printDocumentChooserJs($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->contentHeading(getMLText("edit_document_notify"));
$this->contentContainerStart(); $this->contentContainerStart();
print "<form method=\"post\" action=\"../op/op.ManageNotify.php?type=document&action=add\" name=\"form2\">"; 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 /* 'form1' must be passed to printDocumentChooser() because the typeahead
* function is currently hardcoded on this value */ * function is currently hardcoded on this value */
$this->printDocumentChooserHtml("form2"); $this->formField(getMLText("choose_target_document"), $this->getDocumentChooserHtml("form2"));
print "<br /><button type='submit' class='btn'><i class=\"icon-plus\"></i> ".getMLText("add")."</button>"; $this->formSubmit("<i class=\"icon-plus\"></i> ".getMLText('add'));
print "</form>"; print "</form>";
$this->contentContainerEnd(); $this->contentContainerEnd();

View File

@ -1380,19 +1380,24 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$this->contentContainerStart(); $this->contentContainerStart();
?> ?>
<br> <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;?>"> <input type="hidden" name="documentid" value="<?php print $documentid;?>">
<?php printMLText("add_document_link");?>: <?php $this->formField(getMLText("add_document_link"), $this->getDocumentChooserHtml("form1")); ?>
<?php $this->printDocumentChooserHtml("form1");?>
<?php <?php
if ($document->getAccessMode($user) >= M_READWRITE) { if ($document->getAccessMode($user) >= M_READWRITE) {
print "<label class=\"checkbox\">"; $this->formField(
print "<input type=\"checkbox\" name=\"public\" value=\"true\" checked />"; getMLText("document_link_public"),
print getMLText("document_link_public"); array(
print "</label>"; '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> </form>
<?php <?php
$this->contentContainerEnd(); $this->contentContainerEnd();