Commit 24c7d3c5c2fa60a9d93699cd9795c8da778939ed

Authored by Jalaloedien
1 parent d47b3335

KTS-1638

"RSS feed logo to be changed and action item to be moved"
Implemented.

Reviewed By: Kevin

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6173 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/rssplugin/KTrss.inc.php
@@ -22,10 +22,6 @@ require_once(KT_LIB_DIR . "/documentmanagement/documentcontentversion.inc.php"); @@ -22,10 +22,6 @@ require_once(KT_LIB_DIR . "/documentmanagement/documentcontentversion.inc.php");
22 require_once(KT_LIB_DIR . "/metadata/fieldset.inc.php"); 22 require_once(KT_LIB_DIR . "/metadata/fieldset.inc.php");
23 require_once(KT_LIB_DIR . "/security/Permission.inc"); 23 require_once(KT_LIB_DIR . "/security/Permission.inc");
24 24
25 -// widget includes.  
26 -require_once(KT_LIB_DIR . "/widgets/portlet.inc.php");  
27 -require_once(KT_LIB_DIR . "/widgets/fieldsetDisplay.inc.php");  
28 -require_once(KT_LIB_DIR . "/widgets/FieldsetDisplayRegistry.inc.php");  
29 require_once(KT_LIB_DIR . "/actions/documentaction.inc.php"); 25 require_once(KT_LIB_DIR . "/actions/documentaction.inc.php");
30 require_once(KT_LIB_DIR . "/browse/browseutil.inc.php"); 26 require_once(KT_LIB_DIR . "/browse/browseutil.inc.php");
31 27
@@ -100,7 +96,10 @@ class KTrss{ @@ -100,7 +96,10 @@ class KTrss{
100 "LIMIT 1"; 96 "LIMIT 1";
101 $aParams = array($document_id, $iUserId); 97 $aParams = array($document_id, $iUserId);
102 $aDocumentsInfo = DBUtil::getResultArray(array($sQuery, $aParams)); 98 $aDocumentsInfo = DBUtil::getResultArray(array($sQuery, $aParams));
103 - $aDocuments[] = $aDocumentsInfo; 99 + $aDocumentsInfo['itemType'] = 'document';
  100 + if($aDocumentsInfo){
  101 + $aDocuments[] = $aDocumentsInfo;
  102 + }
104 } 103 }
105 } 104 }
106 if (PEAR::isError($aDocuments)) { 105 if (PEAR::isError($aDocuments)) {
@@ -127,6 +126,7 @@ class KTrss{ @@ -127,6 +126,7 @@ class KTrss{
127 "LIMIT 1"; 126 "LIMIT 1";
128 $aParams = array($folder_id, $iUserId); 127 $aParams = array($folder_id, $iUserId);
129 $aFoldersInfo = DBUtil::getResultArray(array($sQuery, $aParams)); 128 $aFoldersInfo = DBUtil::getResultArray(array($sQuery, $aParams));
  129 + $aFoldersInfo['itemType'] = 'folder';
130 if($aFoldersInfo){ 130 if($aFoldersInfo){
131 $aFolders[] = $aFoldersInfo; 131 $aFolders[] = $aFoldersInfo;
132 } 132 }
@@ -201,41 +201,14 @@ class KTrss{ @@ -201,41 +201,14 @@ class KTrss{
201 "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n". 201 "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n".
202 "</image>\n"; 202 "</image>\n";
203 foreach($aItems as $item){ 203 foreach($aItems as $item){
  204 + if($item['itemType'] == 'folder'){
  205 + $sTypeSelect = 'folder.transactions&amp;fFolderId';
  206 + }elseif($item['itemType'] == 'document'){
  207 + $sTypeSelect = 'document.transactionhistory&amp;fDocumentId';
  208 + }
204 $feed .= "<item>" . 209 $feed .= "<item>" .
205 "<title>".$item[0]['name']."</title>\n" . 210 "<title>".$item[0]['name']."</title>\n" .
206 - "<link>".$hostPath."view.php?fDocumentId=".$item[0]['id']."</link>\n" .  
207 - "<description>".$item[0]['transaction']."</description>\n".  
208 - "</item>\n";  
209 - }  
210 - $feed .= "</channel>\n" .  
211 - "</rss>\n";  
212 -  
213 - return $feed;  
214 - }  
215 -  
216 - // Takes in an array as a parameter and returns rss 2.0 compatible xml  
217 - function arrayToXMLSingle($aItems){  
218 - // Build path to host  
219 - $aPath = explode('/', trim($_SERVER['PHP_SELF']));  
220 - $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/";  
221 - $feed = "<?xml version=\"1.0\"?>\n";  
222 - $feed .= "<rss version=\"2.0\">\n".  
223 - "<channel>\n" .  
224 - "<title>KnowledgeTree RSS</title>\n" .  
225 - "<copyright>(c) 2006 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved - KnowledgeTree Version: OSS 3.3 beta 7</copyright>\n" .  
226 - "<link>".$hostPath."</link>\n" .  
227 - "<description>KT-RSS</description>\n" .  
228 - "<image>\n".  
229 - "<title>KNowledgeTree RSS</title>\n".  
230 - "<width>140</width>\n".  
231 - "<height>28</height>".  
232 - "<link>".$hostPath."knowledgeTree/</link>\n".  
233 - "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n".  
234 - "</image>\n";  
235 - foreach($aItems as $item){  
236 - $feed .= "<item>" .  
237 - "<title>".$item[0]['name']."</title>\n" .  
238 - "<link>".$hostPath."view.php?fDocumentId=".$item[0]['id']."</link>\n" . 211 + "<link>".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$item[0]['id']."</link>\n" .
239 "<description>".$item[0]['transaction']."</description>\n". 212 "<description>".$item[0]['transaction']."</description>\n".
240 "</item>\n"; 213 "</item>\n";
241 } 214 }
@@ -370,5 +343,36 @@ class KTrss{ @@ -370,5 +343,36 @@ class KTrss{
370 return false; 343 return false;
371 } 344 }
372 } 345 }
  346 +
  347 + function getRssLinkIcon(){
  348 + // built server path
  349 + $sHostPath = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/";
  350 +
  351 + // create image
  352 + $icon = "<img src='".$sHostPath."resources/graphics/rss.gif' alt='RSS' border=0/>";
  353 +
  354 + return $icon;
  355 + }
  356 +
  357 + function getRssLink($iItemId, $sItemType){
  358 + $item = strToLower($sItemType);
  359 + if($item == 'folder'){
  360 + $sItemParameter = '?folderId';
  361 + }else if($item == 'document'){
  362 + $sItemParameter = '?docId';
  363 + }
  364 +
  365 + // built server path
  366 + $sHostPath = "http://".$_SERVER['HTTP_HOST'];
  367 +
  368 + // build link
  369 + $sLink = $sHostPath.KTBrowseUtil::buildBaseUrl('rss').$sItemParameter.'='.$iItemId;
  370 +
  371 + return $sLink;
  372 + }
  373 +
  374 + function getImageLink($iItemId, $sItemType){
  375 + return "<a href='".KTrss::getRssLink($iItemId, $sItemType)."' target='_blank'>".KTrss::getRssLinkIcon()."</a>";
  376 + }
373 } 377 }
374 ?> 378 ?>
plugins/rssplugin/RSSDocumentLinkAction.php
1 <?php 1 <?php
2 -require_once(KT_LIB_DIR . '/actions/folderaction.inc.php'); 2 +require_once(KT_LIB_DIR . '/actions/documentaction.inc.php');
3 require_once(KT_LIB_DIR . '/permissions/permission.inc.php'); 3 require_once(KT_LIB_DIR . '/permissions/permission.inc.php');
4 require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php'); 4 require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php');
5 require_once(KT_LIB_DIR . '/browse/browseutil.inc.php'); 5 require_once(KT_LIB_DIR . '/browse/browseutil.inc.php');
@@ -8,6 +8,7 @@ require_once(KT_LIB_DIR . &#39;/plugins/plugin.inc.php&#39;); @@ -8,6 +8,7 @@ require_once(KT_LIB_DIR . &#39;/plugins/plugin.inc.php&#39;);
8 require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); 8 require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
9 9
10 require_once(KT_LIB_DIR . '/roles/Role.inc'); 10 require_once(KT_LIB_DIR . '/roles/Role.inc');
  11 +require_once(KT_DIR. '/plugins/rssplugin/KTrss.inc.php');
11 12
12 class RSSDocumentLinkAction extends KTDocumentAction { 13 class RSSDocumentLinkAction extends KTDocumentAction {
13 var $sName = 'ktcore.rss.plugin.document.link'; 14 var $sName = 'ktcore.rss.plugin.document.link';
@@ -15,9 +16,6 @@ class RSSDocumentLinkAction extends KTDocumentAction { @@ -15,9 +16,6 @@ class RSSDocumentLinkAction extends KTDocumentAction {
15 var $sDisplayName = "RSS"; 16 var $sDisplayName = "RSS";
16 17
17 function getDisplayName() { 18 function getDisplayName() {
18 - // built server path  
19 - $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/";  
20 -  
21 //get document object 19 //get document object
22 $oDocument = $this->oDocument; 20 $oDocument = $this->oDocument;
23 21
@@ -25,7 +23,26 @@ class RSSDocumentLinkAction extends KTDocumentAction { @@ -25,7 +23,26 @@ class RSSDocumentLinkAction extends KTDocumentAction {
25 $iFId = $oDocument->getID(); 23 $iFId = $oDocument->getID();
26 24
27 // return link...there MIGHT be a nicer way of doing this? 25 // return link...there MIGHT be a nicer way of doing this?
28 - return "<a href='".KTBrowseUtil::buildBaseUrl('rss')."?docId=".$iFId."' target='_blank'><img src='".$hostPath."resources/graphics/rss.gif' alt='RSS' border=0/></a>"; 26 + return "RSS ".KTrss::getImageLink($iFId, 'document');
  27 + }
  28 +
  29 + function do_main() {
  30 + //get document object
  31 + $oDocument = $this->oDocument;
  32 +
  33 + // get document id
  34 + $iDId = $oDocument->getID();
  35 +
  36 + $oTemplating =& KTTemplating::getSingleton();
  37 + $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssdocumentaction');
  38 +
  39 + $aTemplateData = array(
  40 + 'context' => $this,
  41 + 'link' => KTrss::getRssLink($iDId, 'document'),
  42 + 'linkIcon' => KTrss::getImageLink($iDId, 'document'),
  43 + );
  44 +
  45 + return $oTemplate->render($aTemplateData);
29 } 46 }
30 } 47 }
31 ?> 48 ?>
32 \ No newline at end of file 49 \ No newline at end of file
plugins/rssplugin/RSSFolderLinkAction.php
@@ -8,16 +8,14 @@ require_once(KT_LIB_DIR . &#39;/plugins/plugin.inc.php&#39;); @@ -8,16 +8,14 @@ require_once(KT_LIB_DIR . &#39;/plugins/plugin.inc.php&#39;);
8 require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); 8 require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
9 9
10 require_once(KT_LIB_DIR . '/roles/Role.inc'); 10 require_once(KT_LIB_DIR . '/roles/Role.inc');
  11 +require_once(KT_DIR. '/plugins/rssplugin/KTrss.inc.php');
11 12
12 class RSSFolderLinkAction extends KTFolderAction { 13 class RSSFolderLinkAction extends KTFolderAction {
13 var $sName = 'ktcore.rss.plugin.folder.link'; 14 var $sName = 'ktcore.rss.plugin.folder.link';
14 var $_sShowPermission = "ktcore.permissions.read"; 15 var $_sShowPermission = "ktcore.permissions.read";
15 - var $sDisplayName = "RSS"; 16 + var $sDisplayName = 'RSS';
16 17
17 function getDisplayName() { 18 function getDisplayName() {
18 - // built server path  
19 - $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/";  
20 -  
21 //get folder object 19 //get folder object
22 $oFolder = $this->oFolder; 20 $oFolder = $this->oFolder;
23 21
@@ -25,7 +23,26 @@ class RSSFolderLinkAction extends KTFolderAction { @@ -25,7 +23,26 @@ class RSSFolderLinkAction extends KTFolderAction {
25 $iFId = $oFolder->getID(); 23 $iFId = $oFolder->getID();
26 24
27 // return link...there MIGHT be a nicer way of doing this? 25 // return link...there MIGHT be a nicer way of doing this?
28 - return "<a href='".KTBrowseUtil::buildBaseUrl('rss')."?folderId=".$iFId."'><img src='".$hostPath."resources/graphics/rss.gif' alt='RSS' border=0/></a>"; 26 + return "RSS ".KTrss::getImageLink($iFId, 'folder');
  27 + }
  28 +
  29 + function do_main() {
  30 + //get folder object
  31 + $oFolder = $this->oFolder;
  32 +
  33 + // get folder id
  34 + $iFId = $oFolder->getID();
  35 +
  36 + $oTemplating =& KTTemplating::getSingleton();
  37 + $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssfolderaction');
  38 +
  39 + $aTemplateData = array(
  40 + 'context' => $this,
  41 + 'link' => KTrss::getRssLink($iFId, 'folder'),
  42 + 'linkIcon' => KTrss::getImageLink($iFId, 'folder'),
  43 + );
  44 +
  45 + return $oTemplate->render($aTemplateData);
29 } 46 }
30 } 47 }
31 ?> 48 ?>
32 \ No newline at end of file 49 \ No newline at end of file
plugins/rssplugin/RSSPlugin.php
@@ -26,7 +26,7 @@ require_once(&#39;RSSDocumentLinkAction.php&#39;); @@ -26,7 +26,7 @@ require_once(&#39;RSSDocumentLinkAction.php&#39;);
26 26
27 function setup() { 27 function setup() {
28 $this->registerAction('folderaction', 'RSSFolderLinkAction', 'ktcore.rss.plugin.folder.link', $sFilename = null); 28 $this->registerAction('folderaction', 'RSSFolderLinkAction', 'ktcore.rss.plugin.folder.link', $sFilename = null);
29 - $this->registerAction('documentaction', 'RSSDocumentLinkAction', 'ktcore.rss.document.plugin', $sFilename = null); 29 + $this->registerAction('documentaction', 'RSSDocumentLinkAction', 'ktcore.rss.plugin.document.link', $sFilename = null);
30 $this->registerDashlet('RSSDashlet', 'ktcore.rss.feed.dashlet', 'RSSDashlet.php'); 30 $this->registerDashlet('RSSDashlet', 'ktcore.rss.feed.dashlet', 'RSSDashlet.php');
31 $this->registerPage('managerssfeeds', 'ManageRSSFeedsDispatcher'); 31 $this->registerPage('managerssfeeds', 'ManageRSSFeedsDispatcher');
32 32
plugins/rssplugin/templates/RSSPlugin/dashlet.smarty
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 <td>{$internalrss.items[i].pubDate}</td> 75 <td>{$internalrss.items[i].pubDate}</td>
76 </tr> 76 </tr>
77 <tr> 77 <tr>
78 - <td colspan='2'><a href='{$internalrss.items[i].link}'>...full story</a></td> 78 + <td colspan='2'><a href='{$internalrss.items[i].link}'>...read more story</a></td>
79 </tr> 79 </tr>
80 <tr><td colspan='2'><hr><br></td></tr> 80 <tr><td colspan='2'><hr><br></td></tr>
81 {/section} 81 {/section}
plugins/rssplugin/templates/RSSPlugin/rssdocumentaction.smarty 0 → 100644
  1 +<h2><img src="{$rootUrl}/resources/graphics/title_bullet.png"/>Document RSS</h2>
  2 +<p>
  3 +You can copy the following link into any RSS aggregator to create a feed to the selected document.
  4 +<ul>
  5 + <li>{$link}</li>
  6 +</ul>
  7 +Another way of quickly accessing a RSS feed for a document of folder is by RSS icon {$linkIcon},
  8 +which you will find in your actions portlet on the left.
  9 +</p>
0 \ No newline at end of file 10 \ No newline at end of file
plugins/rssplugin/templates/RSSPlugin/rssfolderaction.smarty 0 → 100644
  1 +<h2><img src="{$rootUrl}/resources/graphics/title_bullet.png"/>Folder RSS</h2>
  2 +<p>
  3 +You can copy the following link into any RSS aggragator to create a feed to the selected folder.
  4 +<ul>
  5 + <li>{$link}</li>
  6 +</ul>
  7 +Another way of quickly accessing a RSS feed to a document of folder is by RSS icon {$linkIcon},
  8 +which you will find in your actions portlet on the left.
  9 +</p>
0 \ No newline at end of file 10 \ No newline at end of file
resources/graphics/rss.gif

456 Bytes | W: | H:

652 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin