2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of Categories 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
|
|
|
|
2017-12-04 14:23:27 +00:00
|
|
|
/**
|
|
|
|
* Include class to preview documents
|
|
|
|
*/
|
|
|
|
require_once("SeedDMS/Preview.php");
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
/**
|
|
|
|
* Class which outputs the html page for Categories 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_Categories extends SeedDMS_Theme_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-02-05 16:26:45 +00:00
|
|
|
function js() { /* {{{ */
|
|
|
|
$selcat = $this->params['selcategory'];
|
2021-03-10 14:58:22 +00:00
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2020-05-13 14:05:33 +00:00
|
|
|
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
|
2012-12-14 07:53:13 +00:00
|
|
|
?>
|
2016-02-05 16:26:45 +00:00
|
|
|
$(document).ready( function() {
|
|
|
|
$( "#selector" ).change(function() {
|
|
|
|
$('div.ajax').trigger('update', {categoryid: $(this).val()});
|
2020-06-19 06:08:56 +00:00
|
|
|
window.history.pushState({"html":"","pageTitle":""},"", '../out/out.Categories.php?categoryid=' + $(this).val());
|
2016-02-05 16:26:45 +00:00
|
|
|
});
|
|
|
|
});
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
2017-12-19 09:52:24 +00:00
|
|
|
$this->printDeleteFolderButtonJs();
|
|
|
|
$this->printDeleteDocumentButtonJs();
|
2020-03-04 21:26:05 +00:00
|
|
|
$this->printClickDocumentJs();
|
2016-02-05 16:26:45 +00:00
|
|
|
} /* }}} */
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-02-05 16:26:45 +00:00
|
|
|
function info() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$selcat = $this->params['selcategory'];
|
2017-12-04 14:23:27 +00:00
|
|
|
$cachedir = $this->params['cachedir'];
|
|
|
|
$previewwidth = $this->params['previewWidthList'];
|
|
|
|
$timeout = $this->params['timeout'];
|
2019-01-18 12:07:39 +00:00
|
|
|
$xsendfile = $this->params['xsendfile'];
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-02-05 16:26:45 +00:00
|
|
|
if($selcat) {
|
|
|
|
$this->contentHeading(getMLText("category_info"));
|
2017-12-04 14:23:27 +00:00
|
|
|
$c = $selcat->countDocumentsByCategory();
|
2021-05-04 15:29:30 +00:00
|
|
|
echo "<table class=\"table table-condensed table-sm\">\n";
|
2017-12-04 14:23:27 +00:00
|
|
|
echo "<tr><td>".getMLText('document_count')."</td><td>".($c)."</td></tr>\n";
|
2016-02-05 16:26:45 +00:00
|
|
|
echo "</table>";
|
2017-12-04 14:23:27 +00:00
|
|
|
|
|
|
|
$documents = $selcat->getDocumentsByCategory(10);
|
2017-12-19 09:46:19 +00:00
|
|
|
if($documents) {
|
2022-01-03 18:14:13 +00:00
|
|
|
print $this->folderListHeader();
|
|
|
|
print "<tbody>\n";
|
2019-01-18 12:07:39 +00:00
|
|
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
2017-12-19 09:46:19 +00:00
|
|
|
foreach($documents as $doc) {
|
|
|
|
echo $this->documentListRow($doc, $previewer);
|
|
|
|
}
|
|
|
|
print "</tbody></table>";
|
2017-12-04 14:23:27 +00:00
|
|
|
}
|
2016-02-05 16:26:45 +00:00
|
|
|
}
|
|
|
|
} /* }}} */
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2017-12-04 12:45:48 +00:00
|
|
|
function actionmenu() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$selcat = $this->params['selcategory'];
|
2017-01-04 06:03:05 +00:00
|
|
|
|
2017-12-04 12:45:48 +00:00
|
|
|
if($selcat && !$selcat->isUsed()) {
|
2012-12-14 07:53:13 +00:00
|
|
|
?>
|
|
|
|
<form style="display: inline-block;" method="post" action="../op/op.Categories.php" >
|
|
|
|
<?php echo createHiddenFieldWithKey('removecategory'); ?>
|
2017-12-04 12:45:48 +00:00
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $selcat->getID()?>">
|
2017-01-01 13:48:40 +00:00
|
|
|
<input type="hidden" name="action" value="removecategory">
|
2020-10-08 07:08:33 +00:00
|
|
|
<button class="btn btn-danger" type="submit"><i class="fa fa-remove"></i> <?php echo getMLText("rm_document_category")?></button>
|
2012-12-14 07:53:13 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
2017-12-04 12:45:48 +00:00
|
|
|
} /* }}} */
|
2017-01-04 06:03:05 +00:00
|
|
|
|
2017-12-04 12:45:48 +00:00
|
|
|
function showCategoryForm($category) { /* {{{ */
|
|
|
|
?>
|
2017-01-04 06:03:05 +00:00
|
|
|
<form class="form-horizontal" style="margin-bottom: 0px;" action="../op/op.Categories.php" method="post">
|
|
|
|
<?php if(!$category) { ?>
|
|
|
|
<?php echo createHiddenFieldWithKey('addcategory'); ?>
|
|
|
|
<input type="hidden" name="action" value="addcategory">
|
|
|
|
<?php } else { ?>
|
|
|
|
<?php echo createHiddenFieldWithKey('editcategory'); ?>
|
|
|
|
<input type="hidden" name="action" value="editcategory">
|
|
|
|
<input type="hidden" name="categoryid" value="<?php echo $category->getID()?>">
|
|
|
|
<?php } ?>
|
2018-04-23 13:50:46 +00:00
|
|
|
<?php
|
2021-05-01 12:50:04 +00:00
|
|
|
$this->contentContainerStart();
|
2018-04-23 13:50:46 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("name"),
|
2018-06-07 05:46:19 +00:00
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'name'=>'name',
|
|
|
|
'value'=>($category ? htmlspecialchars($category->getName()) : '')
|
|
|
|
)
|
2018-04-23 13:50:46 +00:00
|
|
|
);
|
2021-05-01 12:50:04 +00:00
|
|
|
$this->contentContainerEnd();
|
2020-08-27 05:52:52 +00:00
|
|
|
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
|
2018-04-23 13:50:46 +00:00
|
|
|
?>
|
2017-01-04 06:03:05 +00:00
|
|
|
</form>
|
|
|
|
|
2016-02-05 16:26:45 +00:00
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function form() { /* {{{ */
|
|
|
|
$selcat = $this->params['selcategory'];
|
|
|
|
|
|
|
|
$this->showCategoryForm($selcat);
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$categories = $this->params['categories'];
|
|
|
|
$selcat = $this->params['selcategory'];
|
|
|
|
|
|
|
|
$this->htmlStartPage(getMLText("admin_tools"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
|
|
|
|
|
|
|
$this->contentHeading(getMLText("global_document_categories"));
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(6);
|
2016-02-05 16:26:45 +00:00
|
|
|
?>
|
2016-11-04 07:31:43 +00:00
|
|
|
<form class="form-horizontal">
|
2016-02-05 16:26:45 +00:00
|
|
|
<?php
|
2021-05-04 15:29:30 +00:00
|
|
|
$options = array();
|
|
|
|
$options[] = array("-1", getMLText("choose_category"));
|
|
|
|
$options[] = array("0", getMLText("new_document_category"));
|
|
|
|
foreach ($categories as $category) {
|
|
|
|
$options[] = array($category->getID(), htmlspecialchars($category->getName()), $selcat && $category->getID()==$selcat->getID());
|
|
|
|
}
|
|
|
|
$this->formField(
|
|
|
|
null, //getMLText("selection"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'selector',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'options'=>$options,
|
|
|
|
'placeholder'=>getMLText('choose_category'),
|
|
|
|
)
|
|
|
|
);
|
2016-02-05 16:26:45 +00:00
|
|
|
?>
|
2016-11-04 07:31:43 +00:00
|
|
|
</form>
|
2017-12-04 14:23:27 +00:00
|
|
|
<div class="ajax" style="margin-bottom: 15px;" data-view="Categories" data-action="actionmenu" <?php echo ($selcat ? "data-query=\"categoryid=".$selcat->getID()."\"" : "") ?>></div>
|
2016-02-05 16:26:45 +00:00
|
|
|
<div class="ajax" data-view="Categories" data-action="info" <?php echo ($selcat ? "data-query=\"categoryid=".$selcat->getID()."\"" : "") ?>></div>
|
2020-10-08 05:57:23 +00:00
|
|
|
<?php
|
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(6);
|
|
|
|
?>
|
2016-02-05 16:26:45 +00:00
|
|
|
<div class="ajax" data-view="Categories" data-action="form" <?php echo ($selcat ? "data-query=\"categoryid=".$selcat->getID()."\"" : "") ?>></div>
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
|
|
|
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|