replace table with form controll

This commit is contained in:
Uwe Steinmann 2021-05-04 17:29:07 +02:00
parent 62d8197751
commit 9990fdb57d

View File

@ -115,99 +115,90 @@ myTA.focus();
<div> <div>
<?php <?php
$this->contentContainerStart(); $this->contentContainerStart();
?> $this->formField(
getMLText("keywords"),
<table> array(
'element'=>'textarea',
<tr> 'id'=>'keywordta',
<td valign="top" class="inputDescription"><?php echo getMLText("keywords")?>:</td> 'rows'=>4,
<td><textarea id="keywordta" rows="5" cols="30"></textarea></td> )
</tr> );
$options = array();
<tr> $options[] = array('-1', getMLText('choose_category'));
<td class="inputDescription"><?php echo getMLText("global_default_keywords")?>:</td>
<td>
<select _onchange="showKeywords(0)" id="categories0">
<option value="-1"><?php echo getMLText("choose_category")?>
<?php
foreach ($categories as $category) { foreach ($categories as $category) {
$owner = $category->getOwner(); $owner = $category->getOwner();
if (!$owner->isAdmin()) if($owner->isAdmin())
continue; $options[] = array(''.$category->getID(), htmlspecialchars($category->getName()));
print "<option value=\"".$category->getID()."\">" . htmlspecialchars($category->getName());
} }
?> $this->formField(
</select> getMLText("global_default_keywords"),
</td> array(
</tr> 'element'=>'select',
<?php 'id'=>'categories0',
'options'=>$options,
)
);
foreach ($categories as $category) { foreach ($categories as $category) {
$owner = $category->getOwner(); $owner = $category->getOwner();
if (!$owner->isAdmin()) if($owner->isAdmin()) {
continue;
?>
<tr id="keywords<?php echo $category->getID()?>" style="display : none;">
<td valign="top" class="inputDescription"><?php echo getMLText("default_keywords")?>:</td>
<td>
<?php
$lists = $category->getKeywordLists(); $lists = $category->getKeywordLists();
if(count($lists) == 0) print getMLText("no_default_keywords");
if (count($lists) == 0) print getMLText("no_default_keywords");
else { else {
print "<ul>"; $kw = array();
foreach ($lists as $list) { foreach ($lists as $list) {
print "<li><a class=\"insertkeyword\" keyword=\"".htmlspecialchars($list["keywords"])."\">".htmlspecialchars($list["keywords"])."</a></li>"; $kw[] = "<a class=\"insertkeyword\" keyword=\"".htmlspecialchars($list["keywords"])."\"><span class=\"badge badge-secondary\">".htmlspecialchars($list["keywords"])."</span></a>";
} }
print "</ul>"; echo '<div id="keywords'.$category->getId().'" style="display: none;">';
$this->formField(
getMLText("default_keywords"),
array(
'element'=>'plain',
'name'=>'categories0',
'value'=>implode(' ', $kw),
)
);
echo '</div>';
} }
?> }
</td> }
</tr> $options = array();
<?php } ?> $options[] = array('-1', getMLText('choose_category'));
<tr>
<td class="inputDescription"><?php echo getMLText("personal_default_keywords")?>:</td>
<td>
<select _onchange="showKeywords(1)" id="categories1">
<option value="-1"><?php echo getMLText("choose_category")?>
<?php
foreach ($categories as $category) { foreach ($categories as $category) {
$owner = $category->getOwner(); $owner = $category->getOwner();
if ($owner->isAdmin()) if(!$owner->isAdmin())
continue; $options[] = array(''.$category->getID(), htmlspecialchars($category->getName()));
print "<option value=\"".$category->getID()."\">" . htmlspecialchars($category->getName());
} }
?> $this->formField(
</select> getMLText("personal_default_keywords"),
</td> array(
</tr> 'element'=>'select',
<?php 'id'=>'categories1',
'options'=>$options,
)
);
foreach ($categories as $category) { foreach ($categories as $category) {
$owner = $category->getOwner(); $owner = $category->getOwner();
if ($owner->isAdmin()) if(!$owner->isAdmin()) {
continue;
?>
<tr id="keywords<?php echo $category->getID()?>" style="display : none;">
<td valign="top" class="inputDescription"><?php echo getMLText("default_keywords")?>:</td>
<td class="standardText">
<?php
$lists = $category->getKeywordLists(); $lists = $category->getKeywordLists();
if (count($lists) == 0) print getMLText("no_default_keywords"); if(count($lists) == 0) print getMLText("no_default_keywords");
else { else {
print "<ul>"; $kw = array();
foreach ($lists as $list) { foreach ($lists as $list) {
print "<li><a class=\"insertkeyword\" keyword=\"".htmlspecialchars($list["keywords"])."\">".htmlspecialchars($list["keywords"])."</a></li>"; $kw[] = "<a class=\"insertkeyword\" keyword=\"".htmlspecialchars($list["keywords"])."\"><span class=\"badge badge-secondary\">".htmlspecialchars($list["keywords"])."</span></a>";
}
echo '<div id="keywords'.$category->getId().'" style="display: none;">';
$this->formField(
getMLText("default_keywords"),
array(
'element'=>'plain',
'name'=>'categories0',
'value'=>implode(', ', $kw),
)
);
echo '</div>';
}
} }
print "</ul>";
} }
?>
</td>
</tr>
<?php } ?>
</table>
<?php
$this->contentContainerEnd(); $this->contentContainerEnd();
echo '<script src="../out/out.KeywordChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n"; echo '<script src="../out/out.KeywordChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
// $this->htmlEndPage(); // $this->htmlEndPage();