2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of KeywordChooser view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for KeywordChooser view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
class SeedDMS_View_KeywordChooser extends SeedDMS_Theme_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2015-12-14 14:16:32 +00:00
|
|
|
function js() { /* {{{ */
|
2012-12-14 07:53:13 +00:00
|
|
|
$form = $this->params['form'];
|
2021-03-10 14:58:22 +00:00
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2012-12-14 07:53:13 +00:00
|
|
|
?>
|
|
|
|
var targetObj = document.<?php echo $form ?>.keywords;
|
|
|
|
var myTA;
|
|
|
|
|
|
|
|
function insertKeywords(keywords) {
|
|
|
|
|
|
|
|
if (navigator.appName == "Microsoft Internet Explorer") {
|
|
|
|
myTA.value += " " + keywords;
|
|
|
|
}
|
|
|
|
//assuming Mozilla
|
|
|
|
else {
|
|
|
|
selStart = myTA.selectionStart;
|
|
|
|
|
|
|
|
myTA.value = myTA.value.substring(0,myTA.selectionStart) + " "
|
|
|
|
+ keywords
|
|
|
|
+ myTA.value.substring(myTA.selectionStart,myTA.value.length);
|
|
|
|
|
|
|
|
myTA.selectionStart = selStart + keywords.length+1;
|
|
|
|
myTA.selectionEnd = selStart + keywords.length+1;
|
|
|
|
}
|
|
|
|
myTA.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
function cancel() {
|
2014-11-07 07:06:08 +00:00
|
|
|
// window.close();
|
2012-12-14 07:53:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function acceptKeywords() {
|
|
|
|
targetObj.value = myTA.value;
|
2014-11-07 07:06:08 +00:00
|
|
|
// window.close();
|
2012-12-14 07:53:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
obj = new Array();
|
|
|
|
obj[0] = -1;
|
|
|
|
obj[1] = -1;
|
|
|
|
function showKeywords(which) {
|
|
|
|
if (obj[which] != -1)
|
|
|
|
obj[which].style.display = "none";
|
|
|
|
|
|
|
|
list = document.getElementById("categories" + which);
|
|
|
|
|
|
|
|
id = list.options[list.selectedIndex].value;
|
|
|
|
if (id == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
obj[which] = document.getElementById("keywords" + id);
|
|
|
|
obj[which].style.display = "";
|
|
|
|
}
|
2015-12-14 14:16:32 +00:00
|
|
|
|
|
|
|
$('#categories0').change(function(ev) {
|
|
|
|
showKeywords(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#categories1').change(function(ev) {
|
|
|
|
showKeywords(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.insertkeyword').click(function(ev) {
|
|
|
|
attr_keyword = $(ev.currentTarget).attr('keyword');
|
|
|
|
insertKeywords(attr_keyword);
|
|
|
|
});
|
|
|
|
|
|
|
|
myTA = document.getElementById("keywordta");
|
|
|
|
myTA.value = targetObj.value;
|
|
|
|
myTA.focus();
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$categories = $this->params['categories'];
|
|
|
|
|
|
|
|
// $this->htmlStartPage(getMLText("use_default_keywords"));
|
|
|
|
?>
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
<div>
|
|
|
|
<?php
|
|
|
|
$this->contentContainerStart();
|
2021-05-04 15:29:07 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("keywords"),
|
|
|
|
array(
|
|
|
|
'element'=>'textarea',
|
|
|
|
'id'=>'keywordta',
|
|
|
|
'rows'=>4,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$options = array();
|
|
|
|
$options[] = array('-1', getMLText('choose_category'));
|
|
|
|
foreach ($categories as $category) {
|
|
|
|
$owner = $category->getOwner();
|
|
|
|
if($owner->isAdmin())
|
|
|
|
$options[] = array(''.$category->getID(), htmlspecialchars($category->getName()));
|
|
|
|
}
|
|
|
|
$this->formField(
|
|
|
|
getMLText("global_default_keywords"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'categories0',
|
|
|
|
'options'=>$options,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
foreach ($categories as $category) {
|
|
|
|
$owner = $category->getOwner();
|
|
|
|
if($owner->isAdmin()) {
|
2012-12-14 07:53:13 +00:00
|
|
|
$lists = $category->getKeywordLists();
|
2021-05-04 15:35:24 +00:00
|
|
|
if(count($lists)) {
|
2021-05-04 15:29:07 +00:00
|
|
|
$kw = array();
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach ($lists as $list) {
|
2021-05-04 15:29:07 +00:00
|
|
|
$kw[] = "<a class=\"insertkeyword\" keyword=\"".htmlspecialchars($list["keywords"])."\"><span class=\"badge badge-secondary\">".htmlspecialchars($list["keywords"])."</span></a>";
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
2021-05-04 15:29:07 +00:00
|
|
|
echo '<div id="keywords'.$category->getId().'" style="display: none;">';
|
|
|
|
$this->formField(
|
|
|
|
getMLText("default_keywords"),
|
|
|
|
array(
|
|
|
|
'element'=>'plain',
|
|
|
|
'name'=>'categories0',
|
|
|
|
'value'=>implode(' ', $kw),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
echo '</div>';
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
2021-05-04 15:29:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$options = array();
|
|
|
|
$options[] = array('-1', getMLText('choose_category'));
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach ($categories as $category) {
|
|
|
|
$owner = $category->getOwner();
|
2021-05-04 15:29:07 +00:00
|
|
|
if(!$owner->isAdmin())
|
|
|
|
$options[] = array(''.$category->getID(), htmlspecialchars($category->getName()));
|
|
|
|
}
|
|
|
|
$this->formField(
|
|
|
|
getMLText("personal_default_keywords"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'categories1',
|
|
|
|
'options'=>$options,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
foreach ($categories as $category) {
|
|
|
|
$owner = $category->getOwner();
|
|
|
|
if(!$owner->isAdmin()) {
|
|
|
|
$lists = $category->getKeywordLists();
|
2021-05-04 15:35:24 +00:00
|
|
|
if(count($lists)) {
|
2021-05-04 15:29:07 +00:00
|
|
|
$kw = array();
|
|
|
|
foreach ($lists as $list) {
|
|
|
|
$kw[] = "<a class=\"insertkeyword\" keyword=\"".htmlspecialchars($list["keywords"])."\"><span class=\"badge badge-secondary\">".htmlspecialchars($list["keywords"])."</span></a>";
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
2021-05-04 15:29:07 +00:00
|
|
|
echo '<div id="keywords'.$category->getId().'" style="display: none;">';
|
|
|
|
$this->formField(
|
|
|
|
getMLText("default_keywords"),
|
|
|
|
array(
|
|
|
|
'element'=>'plain',
|
|
|
|
'name'=>'categories0',
|
|
|
|
'value'=>implode(', ', $kw),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->contentContainerEnd();
|
2015-12-14 14:16:32 +00:00
|
|
|
echo '<script src="../out/out.KeywordChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
// $this->htmlEndPage();
|
2014-06-24 14:12:02 +00:00
|
|
|
// echo "</body>\n</html>\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|