You need to sign in before continuing.

Commit fd047c5d7bd7ac9a69afd1350e6e535f3d3c96e4

Authored by kevin_fourie
1 parent ee2ca5bc

Merged in from DEV trunk...

KTS-1644
"Untranslateable strings in /lib/browse/Criteria.inc"
Fixed. Added _kt() so that strings are now translatable.

Committed By: Jonathan Byrne
Reviewed By: Megan Watson

WSA-113
"Implement returning of basic permissions returned by get_listing() and document detail."
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

WSA-113
"Implement returning of basic permissions returned by get_listing() and document detail."
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3136
"Implement Open Search with new search"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

Version Bump to 3.5.3 beta1


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8239 c91229c3-7414-0410-bfa2-8a42b809f60b
docs/VERSION-NAME.txt
1   -3.5.2
  1 +3.5.3 beta1
... ...
docs/VERSION-OSS.txt
1   -3.5.2
  1 +3.5.3 beta1
... ...
docs/VERSION.txt
1   -3.5.2
  1 +3.5.3 beta1
... ...
ktapi/KTAPIDocument.inc.php
... ... @@ -1443,6 +1443,24 @@ class KTAPI_Document extends KTAPI_FolderItem
1443 1443  
1444 1444 }
1445 1445  
  1446 + function get_permission_string($document)
  1447 + {
  1448 + $perms = 'R';
  1449 + if (Permission::userHasDocumentWritePermission($document))
  1450 + {
  1451 + $perms .= 'W';
  1452 +
  1453 + $user_id = $_SESSION['userID'];
  1454 + $co_user_id = $document->getCheckedOutUserID();
  1455 +
  1456 + if (!empty($co_user_id) && ($user_id == $co_user_id))
  1457 + {
  1458 + $perms .= 'E';
  1459 + }
  1460 + }
  1461 + return $perms;
  1462 + }
  1463 +
1446 1464 /**
1447 1465 * This returns detailed information on the document.
1448 1466 *
... ... @@ -1587,7 +1605,7 @@ class KTAPI_Document extends KTAPI_FolderItem
1587 1605 $detail['is_immutable'] = (bool) $document->getImmutable();
1588 1606  
1589 1607 // check permissions
1590   - $detail['permissions'] = 'n/a';
  1608 + $detail['permissions'] = KTWSAPI_Document::get_permission_string($document);
1591 1609  
1592 1610 // get workflow name
1593 1611 $workflowid = $document->getWorkflowId();
... ...
ktapi/KTAPIFolder.inc.php
... ... @@ -321,6 +321,16 @@ class KTAPI_Folder extends KTAPI_FolderItem
321 321 return $user;
322 322 }
323 323  
  324 + function get_permission_string($folder)
  325 + {
  326 + $perms = 'R';
  327 + if (Permission::userHasFolderWritePermission($folder))
  328 + {
  329 + $perms .= 'W';
  330 + }
  331 + return $perms;
  332 + }
  333 +
324 334 function get_listing($depth=1, $what='DF')
325 335 {
326 336 if ($depth < 1)
... ... @@ -389,7 +399,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
389 399 'version' => 'n/a',
390 400  
391 401 'is_immutable'=> 'n/a',
392   - 'permissions' => 'n/a',
  402 + 'permissions' => KTWSAPI_Folder::get_permission_string($folder),
393 403  
394 404 'workflow'=>'n/a',
395 405 'workflow_state'=>'n/a',
... ... @@ -523,7 +533,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
523 533 'version' => $document->getMajorVersionNumber() . '.' . $document->getMinorVersionNumber(),
524 534  
525 535 'is_immutable'=> $document->getImmutable()?'true':'false',
526   - 'permissions' => 'n/a',
  536 + 'permissions' => KTWSAPI_Document::get_permission_string($document),
527 537  
528 538 'workflow'=> $workflow,
529 539 'workflow_state'=> $state,
... ...
lib/browse/Criteria.inc
... ... @@ -731,16 +731,21 @@ class SizeCriterion extends BrowseCriterion {
731 731 'M'=>'Megabytes');
732 732  
733 733 var $aTypeAssocs = array('B' => 1, 'KB' => 1024, 'M' => 1048576);
  734 +
  735 + var $aCmps = array();
734 736  
735   - var $aCmps = array('LT'=>'Less than',
736   - 'GT'=>'Greater than',
737   - 'EQ'=>'Equal to',
738   - 'NEQ'=>'Not equal to');
739   -
740   - var $aCmpAssocs = array('LT' => '<', 'GT' => '>', 'EQ' => '=', 'NEQ' => '!=');
  737 + var $aCmpAssocs = array();
741 738  
742 739 function SizeCriterion() {
743   - $this->sDisplay = _kt('File Size');
  740 + $this->sDisplay = _kt('File Size');
  741 +
  742 + $this->aCmps = array('LT'=>_kt('Less than'),
  743 + 'GT'=>_kt('Greater than'),
  744 + 'EQ'=>_kt('Equal to'),
  745 + 'NEQ'=>_kt('Not equal to'));
  746 +
  747 + $this->aCmpAssocs = array('LT' => '<', 'GT' => '>', 'EQ' => '=', 'NEQ' => '!=');
  748 +
744 749 }
745 750  
746 751 function documentDisplay ($oDocument) {
... ... @@ -918,15 +923,18 @@ class TagCloudCriterion extends BrowseCriterion {
918 923 class DateCreatedDeltaCriterion extends DateCreatedCriterion {
919 924 var $sDocumentField = 'created';
920 925 var $sSortField = 'created';
921   - var $aTypes = array('MINUTE'=>'Minutes',
922   - 'HOUR'=>'Hours',
923   - 'DAY'=>'Days',
924   - 'MONTH'=>'Months',
925   - 'YEAR'=>'Years');
  926 + var $aTypes = array();
926 927 var $sNamespace = 'ktcore.criteria.datecreateddelta';
927 928  
928 929 function DateCreatedDeltaCriterion() {
929   - $this->sDisplay = _kt('Date Created Delta');
  930 + $this->sDisplay = _kt('Date Created Delta');
  931 +
  932 + $this->aTypes = array('MINUTE'=>_kt('Minutes'),
  933 + 'HOUR'=>_kt('Hours'),
  934 + 'DAY'=>_kt('Days'),
  935 + 'MONTH'=>_kt('Months'),
  936 + 'YEAR'=>_kt('Years')
  937 + );
930 938 }
931 939  
932 940 function parameterDisplay($aData) {
... ... @@ -951,7 +959,7 @@ class DateCreatedDeltaCriterion extends DateCreatedCriterion {
951 959  
952 960 $sToRender = $this->getNotWidget($aPreValue);
953 961  
954   - $sToRender .= '<input name="'.$sNumWidget.'" value="'.$aPreValue[$sNumWidget].'"/>'.$sSelect.' ago';
  962 + $sToRender .= '<input name="'.$sNumWidget.'" value="'.$aPreValue[$sNumWidget].'"/>'.$sSelect._kt(' ago');
955 963 return $sToRender;
956 964 }
957 965  
... ...
lib/util/ktutil.inc
... ... @@ -49,6 +49,14 @@ class KTUtil {
49 49 const TB = 1099511627776;
50 50 const PB = 1125899906842624;
51 51  
  52 + static function kt_url()
  53 + {
  54 + global $default;
  55 +
  56 + return ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'] . $default->rootUrl;
  57 +
  58 + }
  59 +
52 60 static function computePeriod($diff, $suffix = null, $returnArray=false)
53 61 {
54 62 if (is_null($suffix))
... ... @@ -229,7 +237,7 @@ class KTUtil {
229 237 if (!is_array($aArray)) {
230 238 $aArray = (array) $aArray;
231 239 }
232   -
  240 +
233 241 if ($aArray !== 0 && $aArray !== '0' && empty($aArray)) {
234 242 return $mDefault;
235 243 }
... ...
plugins/search2/openSearchDescription.php 0 → 100644
  1 +<?php
  2 +
  3 +require_once('../../config/dmsDefaults.php');
  4 +
  5 +//header('Content-Type: text/xml');
  6 +
  7 +$url = KTUtil::kt_url();
  8 +
  9 +$search_url = $url . "/search2.php?action=process&amp;txtQuery=GeneralText+contains+%22{searchTerms}%22";
  10 +
  11 +$xml .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
  12 +
  13 +$xml = "<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\">\r\n";
  14 +$xml .= "<ShortName>KnowledgeTree " ._kt('Quick Search') . "</ShortName>\r\n";
  15 +$xml .= "<Description>" . _kt('Search metadata and content on KnowledgeTree') . "</Description>\r\n";
  16 +$xml .= "<Image width=\"16\" height=\"16\" type=\"image/x-icon\">$url/resources/favicon.ico</Image>\r\n";
  17 +$xml .= "<Url type=\"text/html\" template=\"$search_url\"/>\r\n";
  18 +$xml .= "<OutputEncoding>UTF-8</OutputEncoding>\n";
  19 +$xml .= "<InputEncoding>UTF-8</InputEncoding>\n";
  20 +$xml .= "</OpenSearchDescription>";
  21 +
  22 +print $xml;
  23 +
  24 +?>
0 25 \ No newline at end of file
... ...
templates/kt3/standard_page.smarty
... ... @@ -20,6 +20,8 @@
20 20  
21 21 <link rel="icon" href="{$rootUrl}/resources/favicon.ico" type="image/x-icon">
22 22 <link rel="shortcut icon" href="{$rootUrl}/resources/favicon.ico" type="image/x-icon">
  23 + <link rel="search" type="application/opensearchdescription+xml" title="KnowledgeTree Quick Search" href="{$rootUrl}/plugins/search2/openSearchDescription.php">
  24 +
23 25  
24 26 {if $refreshTimeout}
25 27 <meta http-equiv="refresh" content="{$refreshTimeout}" />
... ...