diff --git a/plugins/ktcore/KTColumns.inc.php b/plugins/ktcore/KTColumns.inc.php
index 8c1c194..14bbb40 100644
--- a/plugins/ktcore/KTColumns.inc.php
+++ b/plugins/ktcore/KTColumns.inc.php
@@ -1,12 +1,12 @@
link_folders = KTUtil::arrayGet($aOptions, 'link_folders', $this->link_folders, false);
- $this->link_documents = KTUtil::arrayGet($aOptions, 'link_documents', $this->link_documents, false);
+ $this->link_documents = KTUtil::arrayGet($aOptions, 'link_documents', $this->link_documents, false);
parent::setOptions($aOptions);
}
-
+
function AdvancedTitleColumn() {
$this->label = _kt("Title");
- }
-
- // what is used for sorting
+ }
+
+ // what is used for sorting
// query addition is:
// [0] => join claus
// [1] => join params
- // [2] => ORDER
-
- function addToFolderQuery() {
- return array(null,
- null,
+ // [2] => ORDER
+
+ function addToFolderQuery() {
+ return array(null,
+ null,
"F.name",
- );
+ );
}
- function addToDocumentQuery() {
- return array(null,
- null,
+ function addToDocumentQuery() {
+ return array(null,
+ null,
"DM.name"
- );
+ );
}
-
+
function renderFolderLink($aDataRow) {
/* this check has to be done so that any titles longer than 40 characters is not displayed incorrectly.
as mozilla cannot wrap text without white spaces */
- if (mb_strlen($aDataRow["folder"]->getName(), 'UTF-8') > 40) {
+ if (mb_strlen($aDataRow["folder"]->getName(), 'UTF-8') > 40) {
mb_internal_encoding("UTF-8");
$outStr = htmlentities(mb_substr($aDataRow["folder"]->getName(), 0, 40, 'UTF-8')."...", ENT_NOQUOTES, 'UTF-8');
}else{
@@ -90,15 +90,15 @@ class AdvancedTitleColumn extends AdvancedColumn {
function renderDocumentLink($aDataRow) {
/* this check has to be done so that any titles longer than 40 characters is not displayed incorrectly.
as mozilla cannot wrap text without white spaces */
- if (mb_strlen($aDataRow["document"]->getName(), 'UTF-8') > 40) {
+ if (mb_strlen($aDataRow["document"]->getName(), 'UTF-8') > 40) {
mb_internal_encoding("UTF-8");
$outStr = htmlentities(mb_substr($aDataRow["document"]->getName(), 0, 40, 'UTF-8')."...", ENT_NOQUOTES, 'UTF-8');
}else{
$outStr = htmlentities($aDataRow["document"]->getName(), ENT_NOQUOTES, 'UTF-8');
}
-
+
if($this->link_documents) {
- $outStr = 'getFilename().'">' .
+ $outStr = 'getFilename(), ENT_QUOTES, 'UTF-8').'">' .
$outStr . '';
}
return $outStr;
@@ -116,7 +116,7 @@ class AdvancedTitleColumn extends AdvancedColumn {
function buildFolderLink($aDataRow) {
if (is_null(KTUtil::arrayGet($this->aOptions, 'direct_folder'))) {
$dest = KTUtil::arrayGet($this->aOptions, 'folder_link');
- $params = kt_array_merge(KTUtil::arrayGet($this->aOptions, 'qs_params', array()),
+ $params = kt_array_merge(KTUtil::arrayGet($this->aOptions, 'qs_params', array()),
array('fFolderId' => $aDataRow['folder']->getId()));
if (empty($dest)) {
@@ -129,9 +129,9 @@ class AdvancedTitleColumn extends AdvancedColumn {
return KTBrowseUtil::getUrlForFolder($aDataRow['folder']);
}
}
-
+
// use inline, since its just too heavy to even _think_ about using smarty.
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
if ($aDataRow["type"] == "folder") {
$contenttype = 'folder';
$link = $this->renderFolderLink($aDataRow);
@@ -143,11 +143,11 @@ class AdvancedTitleColumn extends AdvancedColumn {
return sprintf('%s (%s)', $contenttype, $link, $size);
}
}
-
+
function prettySize($size) {
$finalSize = $size;
$label = 'b';
-
+
if ($finalSize > 1000) { $label='Kb'; $finalSize = floor($finalSize/1000); }
if ($finalSize > 1000) { $label='Mb'; $finalSize = floor($finalSize/1000); }
return $finalSize . $label;
@@ -159,7 +159,7 @@ class AdvancedTitleColumn extends AdvancedColumn {
}
}
-/*
+/*
* Column to handle dates
*/
@@ -168,17 +168,17 @@ class AdvancedDateColumn extends AdvancedColumn {
var $document_field_function;
var $folder_field_function;
- var $sortable = true;
+ var $sortable = true;
var $document_sort_column;
var $folder_sort_column;
var $namespace = 'ktcore.columns.genericdate';
-
+
function AdvancedDateColumn() {
$this->label = _kt('Generic Date Function');
}
// use inline, since its just too heavy to even _think_ about using smarty.
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
$outStr = '';
if (($aDataRow["type"] == "folder") && (!is_null($this->folder_field_function))) {
$res = call_user_func(array($aDataRow["folder"], $this->folder_field_function));
@@ -186,7 +186,7 @@ class AdvancedDateColumn extends AdvancedColumn {
// now reformat this into something "pretty"
return date("Y-m-d H:i", $dColumnDate);
-
+
} else if (($aDataRow["type"] == "document") && (!is_null($this->document_field_function))) {
$res = call_user_func(array($aDataRow["document"], $this->document_field_function));
$dColumnDate = strtotime($res);
@@ -210,11 +210,11 @@ class AdvancedDateColumn extends AdvancedColumn {
class CreationDateColumn extends AdvancedDateColumn {
var $document_field_function = 'getCreatedDateTime';
var $folder_field_function = null;
-
+
var $document_sort_column = "D.created";
var $folder_sort_column = null;
var $namespace = 'ktcore.columns.creationdate';
-
+
function CreationDateColumn() {
$this->label = _kt('Created');
}
@@ -223,11 +223,11 @@ class CreationDateColumn extends AdvancedDateColumn {
class ModificationDateColumn extends AdvancedDateColumn {
var $document_field_function = 'getLastModifiedDate';
var $folder_field_function = null;
-
+
var $document_sort_column = "D.modified";
var $folder_sort_column = null;
var $namespace = 'ktcore.columns.modificationdate';
-
+
function ModificationDateColumn() {
$this->label = _kt('Modified');
}
@@ -236,25 +236,25 @@ class ModificationDateColumn extends AdvancedDateColumn {
class AdvancedUserColumn extends AdvancedColumn {
var $document_field_function;
var $folder_field_function;
- var $sortable = false; // by default
+ var $sortable = false; // by default
var $document_sort_column;
var $folder_sort_column;
var $namespace = 'ktcore.columns.genericuser';
-
+
function AdvancedUserColumn() {
- $this->label = null; // abstract.
+ $this->label = null; // abstract.
}
-
+
// use inline, since its just too heavy to even _think_ about using smarty.
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
$iUserId = null;
if (($aDataRow["type"] == "folder") && (!is_null($this->folder_field_function))) {
if (method_exists($aDataRow['folder'], $this->folder_field_function)) {
- $iUserId = call_user_func(array($aDataRow['folder'], $this->folder_field_function));
+ $iUserId = call_user_func(array($aDataRow['folder'], $this->folder_field_function));
}
} else if (($aDataRow["type"] == "document") && (!is_null($this->document_field_function))) {
if (method_exists($aDataRow['document'], $this->document_field_function)) {
- $iUserId = call_user_func(array($aDataRow['document'], $this->document_field_function));
+ $iUserId = call_user_func(array($aDataRow['document'], $this->document_field_function));
}
}
if (is_null($iUserId)) {
@@ -271,7 +271,7 @@ class AdvancedUserColumn extends AdvancedColumn {
function addToFolderQuery() {
return array(null, null, null);
}
-
+
function addToDocumentQuery() {
return array(null, null, null);
}
@@ -280,20 +280,20 @@ class AdvancedUserColumn extends AdvancedColumn {
class CreatorColumn extends AdvancedUserColumn {
var $document_field_function = "getCreatorID";
var $folder_field_function = "getCreatorID";
- var $sortable = true; // by default
+ var $sortable = true; // by default
var $namespace = 'ktcore.columns.creator';
-
+
function CreatorColumn() {
- $this->label = _kt("Creator"); // abstract.
+ $this->label = _kt("Creator"); // abstract.
}
}
class AdvancedSelectionColumn extends AdvancedColumn {
var $rangename = null;
var $show_folders = true;
- var $show_documents = true;
-
- var $namespace = "ktcore.columns.selection";
+ var $show_documents = true;
+
+ var $namespace = "ktcore.columns.selection";
function AdvancedSelectionColumn() {
$this->label = '';
@@ -302,40 +302,40 @@ class AdvancedSelectionColumn extends AdvancedColumn {
function setOptions($aOptions) {
AdvancedColumn::setOptions($aOptions);
$this->rangename = KTUtil::arrayGet($this->aOptions, 'rangename', $this->rangename);
- $this->show_folders = KTUtil::arrayGet($this->aOptions, 'show_folders', $this->show_folders, false);
- $this->show_documents = KTUtil::arrayGet($this->aOptions, 'show_documents', $this->show_documents, false);
+ $this->show_folders = KTUtil::arrayGet($this->aOptions, 'show_folders', $this->show_folders, false);
+ $this->show_documents = KTUtil::arrayGet($this->aOptions, 'show_documents', $this->show_documents, false);
}
- function renderHeader($sReturnURL) {
+ function renderHeader($sReturnURL) {
global $main;
$main->requireJSResource("resources/js/toggleselect.js");
-
+
return sprintf('', $this->rangename);
-
+
}
-
+
// only include the _f or _d IF WE HAVE THE OTHER TYPE.
- function renderData($aDataRow) {
- $localname = $this->rangename;
-
- if (($aDataRow["type"] === "folder") && ($this->show_folders)) {
+ function renderData($aDataRow) {
+ $localname = htmlentities($this->rangename,ENT_QUOTES,'UTF-8');
+
+ if (($aDataRow["type"] === "folder") && ($this->show_folders)) {
if ($this->show_documents) {
- $localname .= "_f[]";
+ $localname .= "_f[]";
}
- $v = $aDataRow["folderid"];
- } else if (($aDataRow["type"] === "document") && $this->show_documents) {
+ $v = $aDataRow["folderid"];
+ } else if (($aDataRow["type"] === "document") && $this->show_documents) {
if ($this->show_folders) {
- $localname .= "_d[]";
+ $localname .= "_d[]";
}
- $v = $aDataRow["docid"];
- } else {
- return ' ';
+ $v = $aDataRow["docid"];
+ } else {
+ return ' ';
}
-
+
return sprintf('', $localname, $v);
}
-
-
+
+
// no label, but we do have a title
function getName() {
return _kt("Multiple Selection");
@@ -350,36 +350,36 @@ class AdvancedSingleSelectionColumn extends AdvancedSelectionColumn {
parent::AdvancedSelectionColumn();
$this->label = null;
}
-
+
function renderHeader() {
- return ' ';
+ return ' ';
}
-
+
// only include the _f or _d IF WE HAVE THE OTHER TYPE.
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
$localname = $this->rangename;
-
- if (($aDataRow["type"] === "folder") && ($this->show_folders)) {
+
+ if (($aDataRow["type"] === "folder") && ($this->show_folders)) {
if ($this->show_documents) {
- $localname .= "_f";
+ $localname .= "_f";
}
- $v = $aDataRow["folderid"];
- } else if (($aDataRow["type"] === "document") && $this->show_documents) {
+ $v = $aDataRow["folderid"];
+ } else if (($aDataRow["type"] === "document") && $this->show_documents) {
if ($this->show_folders) {
- $localname .= "_d";
+ $localname .= "_d";
}
- $v = $aDataRow["docid"];
- } else {
- return ' ';
+ $v = $aDataRow["docid"];
+ } else {
+ return ' ';
}
-
+
return '';
}
// no label, but we do have a title
function getName() {
return _kt("Single Selection");
- }
+ }
}
@@ -389,16 +389,16 @@ class AdvancedWorkflowColumn extends AdvancedColumn {
function AdvancedWorkflowColumn() {
$this->label = _kt("Workflow State");
- $this->sortable = false;
+ $this->sortable = false;
}
-
+
// use inline, since its just too heavy to even _think_ about using smarty.
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
// only _ever_ show this for documents.
- if ($aDataRow["type"] === "folder") {
+ if ($aDataRow["type"] === "folder") {
return ' ';
}
-
+
$oWorkflow = KTWorkflowUtil::getWorkflowForDocument($aDataRow['document']);
$oState = KTWorkflowUtil::getWorkflowStateForDocument($aDataRow['document']);
if (($oState == null) || ($oWorkflow == null)) {
@@ -415,21 +415,21 @@ class AdvancedWorkflowColumn extends AdvancedColumn {
class AdvancedDownloadColumn extends AdvancedColumn {
var $namespace = 'ktcore.columns.download';
-
+
function AdvancedDownloadColumn() {
$this->label = null;
}
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
// only _ever_ show this for documents.
- if ($aDataRow["type"] === "folder") {
+ if ($aDataRow["type"] === "folder") {
return ' ';
}
-
+
$link = KTUtil::ktLink('action.php','ktcore.actions.document.view', 'fDocumentId=' . $aDataRow['document']->getId());
return sprintf('%s', $link, _kt('Download Document'), _kt('Download Document'));
}
-
+
function getName() { return _kt('Download'); }
}
@@ -437,17 +437,17 @@ class AdvancedDownloadColumn extends AdvancedColumn {
class DocumentIDColumn extends AdvancedColumn {
var $bSortable = false;
var $namespace = 'ktcore.columns.docid';
-
+
function DocumentIDColumn() {
$this->label = _kt("Document ID");
}
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
// only _ever_ show this for documents.
- if ($aDataRow["type"] === "folder") {
+ if ($aDataRow["type"] === "folder") {
return ' ';
}
-
+
return htmlentities($aDataRow['document']->getId(), ENT_NOQUOTES, 'UTF-8');
}
}
@@ -455,21 +455,21 @@ class DocumentIDColumn extends AdvancedColumn {
class ContainingFolderColumn extends AdvancedColumn {
var $namespace = 'ktcore.columns.containing_folder';
-
+
function ContainingFolderColumn() {
$this->label = _kt("View Folder");
}
- function renderData($aDataRow) {
+ function renderData($aDataRow) {
// only _ever_ show this for documents.
- if ($aDataRow["type"] === "folder") {
+ if ($aDataRow["type"] === "folder") {
return ' ';
}
-
+
$link = KTBrowseUtil::getUrlForFolder($aDataRow['document']->getFolderId());
return sprintf('%s', $link, _kt('View Folder'), _kt('View Folder'));
}
-
+
function getName() { return _kt('Opening Containing Folder'); }
}