Commit af9b11e40c71bb0db8616d9338d6f8c914199346

Authored by Kevin Cyster
1 parent 4b0d7e6b

Fix of KTS-4107 and SUP-1591. Search results containing folder shortcuts - not r…

…eferencing correct locations

Committed By: Kevin Cyster

Reviewed By: Megan Watson
search2/indexing/indexerCore.inc.php
... ... @@ -407,6 +407,10 @@ class DocumentShortcutResultItem extends ProxyResultItem
407 407  
408 408 class FolderShortcutResultItem extends ProxyResultItem
409 409 {
  410 + var $parentId;
  411 + var $linkedId;
  412 + var $full_path;
  413 +
410 414 public function getFolderID() { return $this->getId(); }
411 415 public function getMimeIconPath() { return 'folder_shortcut'; }
412 416  
... ...
search2/search/search.inc.php
... ... @@ -764,7 +764,7 @@ function resolveSearchShortcuts($result)
764 764 if (!empty($folderIds))
765 765 {
766 766  
767   - $sql = "SELECT f.id, f.linked_folder_id from folders f ";
  767 + $sql = "SELECT f.id, f.parent_id, f.linked_folder_id, f.full_path from folders f ";
768 768 $sql .= 'INNER JOIN permission_lookups AS PL ON f.permission_lookup_id = PL.id '. "\n";
769 769 $sql .= 'INNER JOIN permission_lookup_assignments AS PLA ON PL.id = PLA.permission_lookup_id AND PLA.permission_id = '.$permId. " \n";
770 770 $sql .= " WHERE f.linked_folder_id in ($folderIds) AND PLA.permission_descriptor_id IN ($sPermissionDescriptors)";
... ... @@ -775,8 +775,13 @@ function resolveSearchShortcuts($result)
775 775 {
776 776 $id = $row['id'];
777 777 $linked_id = $row['linked_folder_id'];
  778 +
  779 + $shortFolder = new FolderShortcutResultItem($id, $result['folders'][$linked_id]);
  780 + $shortFolder->parentId = $row['parent_id'];
  781 + $shortFolder->linkedId = $row['linked_folder_id'];
  782 + $shortFolder->full_path = $row['full_path'];
778 783  
779   - $result['shortfolders'][$id] = new FolderShortcutResultItem($id, $result['folders'][$linked_id]);
  784 + $result['shortfolders'][$id] = $shortFolder;
780 785 }
781 786 }
782 787 return $result;
... ...
templates/ktcore/search2/search_results.smarty
... ... @@ -156,25 +156,24 @@ function onShowAll(showall)
156 156 <span class="contenttype {$hit->MimeIconPath}">
157 157  
158 158 {if $hit->IsDocument}
159   - &nbsp;&nbsp;<a href="{$rootUrl}/view.php?fDocumentId={$hit->Id}"><B>{$hit->Title|mb_truncate:30:'...':true}</b></a>
160   - {if $hit->Title != $hit->Filename}
161   - &nbsp;&nbsp;
162   - <font style=" color: green "> - {i18n}Filename:{/i18n} {$hit->Filename|mb_truncate:30:'...':true}</font>
163   - {/if}
164   - {if $hit->IsAvailable}
165   - &nbsp;&nbsp;
166   - <img src="{$rootUrl}/resources/graphics/download.png" title="Download Document" onclick="document.location='{$rootUrl}/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId={$hit->Id}';"></a>
167   -
168   - {/if}
  159 + &nbsp;&nbsp;<a href="{$rootUrl}/view.php?fDocumentId={$hit->Id}"><B>{$hit->Title|mb_truncate:30:'...':true}</b></a>
  160 + {if $hit->Title != $hit->Filename}
  161 + &nbsp;&nbsp;
  162 + <font style=" color: green "> - {i18n}Filename:{/i18n} {$hit->Filename|mb_truncate:30:'...':true}</font>
  163 + {/if}
  164 + {if $hit->IsAvailable}
  165 + &nbsp;&nbsp;
  166 + <img src="{$rootUrl}/resources/graphics/download.png" title="Download Document" onclick="document.location='{$rootUrl}/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId={$hit->Id}';"></a>
  167 + {/if}
169 168  
170 169  
171   - {if !$hit->IsAvailable}
172   - &nbsp;&nbsp;
173   - <font style=" color: red "><B> * {i18n}NOT AVAILABLE{/i18n} * </B></font>
174   - {/if}
  170 + {if !$hit->IsAvailable}
  171 + &nbsp;&nbsp;
  172 + <font style=" color: red "><B> * {i18n}NOT AVAILABLE{/i18n} * </B></font>
  173 + {/if}
175 174  
176 175 {else}
177   - &nbsp;&nbsp;<a href="{$rootUrl}/browse.php?fFolderId={$hit->RealId}{if $hit->IsProxy}&fShortcutFolder={$hit->Id}{/if}"><B>{$hit->Title|mb_truncate:30:'...':true}</b></a>
  176 + &nbsp;&nbsp;<a href="{$rootUrl}/browse.php?fFolderId={$hit->RealId}{if $hit->IsProxy}&fShortcutFolder={$hit->parentId}{/if}"><B>{$hit->Title|mb_truncate:30:'...':true}</b></a>
178 177  
179 178 {/if}
180 179  
... ... @@ -193,7 +192,7 @@ function onShowAll(showall)
193 192 {if $hit->IsDocument}
194 193 <font style=" color: green "><a href="{$rootUrl}/browse.php?fFolderId={$hit->FolderId}" tag="{$hit->FullPath}">{$hit->FullPath|mb_truncate:30:'...':true}</a>/{$hit->Title|mb_truncate:30:'...':true} - {$hit->Filesize}</font>
195 194 {else}
196   - <font style=" color: green "><a href="{$rootUrl}/browse.php?fFolderId={$hit->FolderId}" tag="{$hit->FullPath}">{$hit->FullPath|mb_truncate:30:'...':true}</a></font>
  195 + <font style=" color: green "><a href="{$rootUrl}/browse.php?{if $hit->IsProxy}fFolderId={$hit->linkedId}&fShortcutFolder={$hit->parentId}{else}fFolderId={$hit->FolderId}{/if}" tag="{if $hit->IsProxy}{$hit-full_path}{else}{$hit->FullPath}{/if}">{if $hit->IsProxy}/{$hit->full_path|mb_truncate:30:'...':true}{else}{$hit->FullPath|mb_truncate:30:'...':true}{/if}{}</a></font>
197 196 {/if}
198 197 </td>
199 198 <td align=right><nobr>
... ...