2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of UserDefaultKeywords 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
|
|
|
|
*/
|
|
|
|
require_once("class.Bootstrap.php");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for UserDefaultKeywords 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@
|
|
|
|
*/
|
2013-02-14 11:10:53 +00:00
|
|
|
class SeedDMS_View_UserDefaultKeywords extends SeedDMS_Bootstrap_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
function js() { /* {{{ */
|
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2012-12-14 07:53:13 +00:00
|
|
|
?>
|
|
|
|
obj = -1;
|
|
|
|
function showKeywords(selectObj) {
|
|
|
|
if (obj != -1)
|
|
|
|
obj.style.display = "none";
|
|
|
|
|
|
|
|
id = selectObj.options[selectObj.selectedIndex].value;
|
|
|
|
if (id == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
obj = document.getElementById("keywords" + id);
|
|
|
|
obj.style.display = "";
|
|
|
|
}
|
2016-03-18 14:33:18 +00:00
|
|
|
|
|
|
|
sel = document.getElementById("selector");
|
2016-03-23 07:57:54 +00:00
|
|
|
sel.selectedIndex=0;
|
2016-03-18 14:33:18 +00:00
|
|
|
showKeywords(sel);
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('body').on('submit', '#form1', function(ev){
|
|
|
|
if(checkForm()) return;
|
2016-03-22 13:47:13 +00:00
|
|
|
ev.preventDefault();
|
2016-03-18 14:33:18 +00:00
|
|
|
});
|
|
|
|
$( "#selector" ).change(function() {
|
|
|
|
showKeywords(this);
|
|
|
|
// $('div.ajax').trigger('update', {userid: $(this).val()});
|
|
|
|
});
|
|
|
|
});
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
2016-03-18 14:33:18 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$categories = $this->params['categories'];
|
|
|
|
|
|
|
|
$this->htmlStartPage(getMLText("edit_default_keywords"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("my_account"), "my_account");
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->contentHeading(getMLText("edit_default_keywords"));
|
|
|
|
?>
|
|
|
|
<div class="row-fluid">
|
2017-01-04 06:03:05 +00:00
|
|
|
<div class="span4">
|
2018-04-26 06:50:44 +00:00
|
|
|
<?php $this->contentContainerStart(); ?>
|
2017-01-04 06:03:05 +00:00
|
|
|
<form class="form-horizontal">
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
$selected=0;
|
|
|
|
$count=2;
|
2018-06-07 05:46:19 +00:00
|
|
|
$options = array();
|
|
|
|
$options[] = array('-1', getMLText("choose_category"));
|
|
|
|
$options[] = array('0', getMLText("new_default_keyword_category"));
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach ($categories as $category) {
|
|
|
|
|
|
|
|
$owner = $category->getOwner();
|
|
|
|
if ($owner->getID() != $user->getID()) continue;
|
|
|
|
|
|
|
|
if (isset($_GET["categoryid"]) && $category->getID()==$_GET["categoryid"]) $selected=$count;
|
2018-06-07 05:46:19 +00:00
|
|
|
$options[] = array($category->getID(), htmlspecialchars($category->getName()));
|
2012-12-14 07:53:13 +00:00
|
|
|
$count++;
|
|
|
|
}
|
2018-04-26 06:50:44 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("selection"),
|
2018-06-07 05:46:19 +00:00
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'selector',
|
|
|
|
'options'=>$options,
|
|
|
|
)
|
2018-04-26 06:50:44 +00:00
|
|
|
);
|
2012-12-14 07:53:13 +00:00
|
|
|
?>
|
2017-01-04 06:03:05 +00:00
|
|
|
</form>
|
2018-04-26 06:50:44 +00:00
|
|
|
<?php $this->contentContainerEnd(); ?>
|
2017-01-04 06:03:05 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="span8">
|
2018-04-26 06:50:44 +00:00
|
|
|
<?php $this->contentContainerStart(); ?>
|
2017-01-04 06:03:05 +00:00
|
|
|
|
|
|
|
<div id="keywords0" style="display : none;">
|
|
|
|
<form class="form-horizontal" action="../op/op.UserDefaultKeywords.php" method="post" name="addcategory">
|
|
|
|
<input type="hidden" name="action" value="addcategory">
|
2018-04-26 06:50:44 +00:00
|
|
|
<?php
|
|
|
|
$this->formField(
|
|
|
|
getMLText("name"),
|
2018-06-07 05:46:19 +00:00
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'name'=>'name',
|
|
|
|
)
|
2018-04-26 06:50:44 +00:00
|
|
|
);
|
|
|
|
$this->formSubmit(getMLText("new_default_keyword_category"));
|
|
|
|
?>
|
2017-01-04 06:03:05 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
foreach ($categories as $category) {
|
|
|
|
$owner = $category->getOwner();
|
|
|
|
if ($owner->getID() != $user->getID()) continue;
|
|
|
|
|
2017-01-04 06:03:05 +00:00
|
|
|
print "<div id=\"keywords".$category->getID()."\" style=\"display : none;\">";
|
2012-12-14 07:53:13 +00:00
|
|
|
?>
|
2017-01-04 06:03:05 +00:00
|
|
|
<div class="controls">
|
|
|
|
<form class="form-horizontal" action="../op/op.UserDefaultKeywords.php" method="post">
|
|
|
|
<?php echo createHiddenFieldWithKey('removecategory'); ?>
|
|
|
|
<input type="hidden" name="action" value="removecategory">
|
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $category->getID()?>">
|
|
|
|
<button type="submit" class="btn" title="<?php echo getMLText("delete")?>"><i class="icon-remove"></i> <?php printMLText("rm_default_keyword_category");?></button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<form class="form-inline" action="../op/op.UserDefaultKeywords.php" method="post" name="<?php echo "category".$category->getID()?>">
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label"><?php echo getMLText("name")?>:</label>
|
|
|
|
<div class="controls">
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php echo createHiddenFieldWithKey('editcategory'); ?>
|
|
|
|
<input type="hidden" name="action" value="editcategory">
|
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $category->getID()?>">
|
|
|
|
<input name="name" type="text" value="<?php echo htmlspecialchars($category->getName())?>">
|
2013-04-19 13:22:25 +00:00
|
|
|
<button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
|
2017-01-04 06:03:05 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label"><?php echo getMLText("default_keywords")?>:</label>
|
|
|
|
<div class="controls">
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
$lists = $category->getKeywordLists();
|
|
|
|
if (count($lists) == 0)
|
|
|
|
print getMLText("no_default_keywords");
|
|
|
|
else
|
|
|
|
foreach ($lists as $list) {
|
|
|
|
?>
|
2014-04-01 04:42:15 +00:00
|
|
|
<form class="form-inline" style="display: inline-block;margin-bottom: 0px;" action="../op/op.UserDefaultKeywords.php" method="post" name="<?php echo "cat".$category->getID().".".$list["id"]?>">
|
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $category->getID()?>">
|
|
|
|
<input type="hidden" name="keywordsid" value="<?php echo $list["id"]?>">
|
|
|
|
<input type="hidden" name="action" value="editkeywords">
|
2012-12-14 07:53:13 +00:00
|
|
|
<input type="text" name="keywords" value="<?php echo htmlspecialchars($list["keywords"]) ?>">
|
2013-05-22 20:47:33 +00:00
|
|
|
<button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
|
2012-12-14 07:53:13 +00:00
|
|
|
</form>
|
|
|
|
<form style="display: inline-block;" method="post" action="../op/op.UserDefaultKeywords.php" >
|
|
|
|
<?php echo createHiddenFieldWithKey('removekeywords'); ?>
|
2014-04-01 04:42:15 +00:00
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $category->getID()?>">
|
|
|
|
<input type="hidden" name="keywordsid" value="<?php echo $list["id"]?>">
|
|
|
|
<input type="hidden" name="action" value="removekeywords">
|
2013-05-22 20:47:33 +00:00
|
|
|
<button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("delete")?></button>
|
2012-12-14 07:53:13 +00:00
|
|
|
</form>
|
|
|
|
<br>
|
|
|
|
<?php } ?>
|
2017-01-04 06:03:05 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="controls">
|
2012-12-14 07:53:13 +00:00
|
|
|
<form class="form-inline" action="../op/op.UserDefaultKeywords.php" method="post" name="<?php echo $category->getID().".add"?>">
|
|
|
|
<?php echo createHiddenFieldWithKey('newkeywords'); ?>
|
2013-02-18 20:02:52 +00:00
|
|
|
<input type="hidden" name="action" value="newkeywords">
|
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $category->getID()?>">
|
2012-12-14 07:53:13 +00:00
|
|
|
<input type="text" name="keywords">
|
|
|
|
<input type="submit" class="btn" value="<?php printMLText("new_default_keywords");?>">
|
|
|
|
</form>
|
2017-01-04 06:03:05 +00:00
|
|
|
</div>
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2017-01-04 06:03:05 +00:00
|
|
|
</div>
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php } ?>
|
2018-04-26 06:50:44 +00:00
|
|
|
<?php $this->contentContainerEnd(); ?>
|
2012-12-14 07:53:13 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|