Commit 08b1897b3426fa68f5695bb506daa06a40680fe7

Authored by kevin_fourie
1 parent 11a9c696

Merged in from STABLE trunk...

KTC-594
"When a shortcut is made to an XML, RTF, TXT or CSS file there is no indication that it is a shortcut after the process has completed."
Fixed. Added the folder mime icon and the generic icon. The shortcut css class are now .folder_shortcut not .folder.shortcut - IE gets confused sometimes.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3a-Release-Branch@9392 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/mime.inc.php
@@ -183,13 +183,17 @@ class KTMime { @@ -183,13 +183,17 @@ class KTMime {
183 return null; 183 return null;
184 } 184 }
185 185
186 - function getIconPath($iMimeTypeId) {  
187 - $cached = KTUtil::arrayGet($GLOBALS['_KT_icon_path_cache'], $iMimeTypeId);  
188 - if (!empty($cached)) {  
189 - return $cached; 186 + function getIconPath($iMimeTypeId, $type = null) {
  187 + $icon = KTUtil::arrayGet($GLOBALS['_KT_icon_path_cache'], $iMimeTypeId);
  188 + if (empty($icon)) {
  189 + $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId] = KTMime::_getIconPath($iMimeTypeId);
  190 + $icon = $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId];
190 } 191 }
191 - $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId] = KTMime::_getIconPath($iMimeTypeId);  
192 - return $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId]; 192 +
  193 + if(!empty($type)){
  194 + $icon .= '_'.$type;
  195 + }
  196 + return $icon;
193 } 197 }
194 198
195 function _getIconPath($iMimeTypeId) { 199 function _getIconPath($iMimeTypeId) {
plugins/ktcore/KTColumns.inc.php
@@ -166,25 +166,33 @@ class AdvancedTitleColumn extends AdvancedColumn { @@ -166,25 +166,33 @@ class AdvancedTitleColumn extends AdvancedColumn {
166 166
167 // use inline, since its just too heavy to even _think_ about using smarty. 167 // use inline, since its just too heavy to even _think_ about using smarty.
168 function renderData($aDataRow) { 168 function renderData($aDataRow) {
169 - if ($aDataRow["type"] == "folder") {  
170 - $contenttype = 'folder';  
171 - $link = $this->renderFolderLink($aDataRow);  
172 - if($aDataRow['folder']->isSymbolicLink()){  
173 - return "<div style='float: left' class='contenttype $contenttype'>&nbsp;</div><div style='float: left'>$link</div>&nbsp;<img src='resources/tango-icons/shortcut.png' />";  
174 - }else{  
175 - return "<div style='float: left' class='contenttype $contenttype'>&nbsp;</div>$link";  
176 - } 169 + if ($aDataRow["type"] == "folder") {
  170 + $contenttype = 'folder';
  171 + $link = $this->renderFolderLink($aDataRow);
  172 +
  173 + // If folder is a shortcut display the shortcut mime icon
  174 + if($aDataRow['folder']->isSymbolicLink()){
  175 + $contenttype .= '_shortcut';
  176 + }
  177 + // Separate the link from the mime icon to allow for right-to-left languages
  178 + return "<div style='float: left' class='contenttype $contenttype'>&nbsp;</div>$link";
177 } else { 179 } else {
178 - $contenttype = $this->_mimeHelper($aDataRow["document"]->getMimeTypeId());  
179 - $link = $this->renderDocumentLink($aDataRow); 180 + $type = '';
  181 + $size = '';
  182 + if($aDataRow['document']->isSymbolicLink()){
  183 + // If document is a shortcut - display the shortcut mime type
  184 + $type = 'shortcut';
  185 + }else{
  186 + // Display the document size if it is not a shortcut
  187 + $size = $this->prettySize($aDataRow["document"]->getSize());
  188 + $size = "&nbsp;($size)";
  189 + }
180 190
181 - //Render an image instead of the size in case of a shortcut  
182 - if($aDataRow['document']->isSymbolicLink()){  
183 - return "<div style='float: left' class='contenttype $contenttype shortcut'>&nbsp;</div>$link";  
184 - }else{  
185 - $size = $this->prettySize($aDataRow["document"]->getSize());  
186 - return "<div style='float: left' class='contenttype $contenttype'>&nbsp;</div><div style='float: left'>$link</div>&nbsp;($size)";  
187 - } 191 + $link = $this->renderDocumentLink($aDataRow);
  192 + $contenttype = $this->_mimeHelper($aDataRow["document"]->getMimeTypeId(), $type);
  193 +
  194 + // Separate the link from the mime icon and the size to allow for right-to-left languages
  195 + return "<div style='float: left' class='contenttype $contenttype'>&nbsp;</div><div style='float: left'>$link</div>$size";
188 } 196 }
189 } 197 }
190 198
@@ -197,9 +205,9 @@ class AdvancedTitleColumn extends AdvancedColumn { @@ -197,9 +205,9 @@ class AdvancedTitleColumn extends AdvancedColumn {
197 return $finalSize . $label; 205 return $finalSize . $label;
198 } 206 }
199 207
200 - function _mimeHelper($iMimeTypeId) { 208 + function _mimeHelper($iMimeTypeId, $type = null) {
201 require_once(KT_LIB_DIR . '/mime.inc.php'); 209 require_once(KT_LIB_DIR . '/mime.inc.php');
202 - return KTMime::getIconPath($iMimeTypeId); 210 + return KTMime::getIconPath($iMimeTypeId, $type);
203 } 211 }
204 } 212 }
205 213
resources/css/kt-contenttypes.css
@@ -17,27 +17,32 @@ @@ -17,27 +17,32 @@
17 } 17 }
18 18
19 .contenttype.office { background-image: url(../../resources/mimetypes/office.png); } 19 .contenttype.office { background-image: url(../../resources/mimetypes/office.png); }
20 -.contenttype.office.shortcut { background-image: url(../../resources/mimetypes/shortcuts/office.png); } 20 +.contenttype.office_shortcut { background-image: url(../../resources/mimetypes/shortcuts/office.png); }
21 .contenttype.word { background-image: url(../../resources/mimetypes/word.png); } 21 .contenttype.word { background-image: url(../../resources/mimetypes/word.png); }
22 -.contenttype.word.shortcut { background-image: url(../../resources/mimetypes/shortcuts/word.png); } 22 +.contenttype.word_shortcut { background-image: url(../../resources/mimetypes/shortcuts/word.png); }
23 .contenttype.database { background-image: url(../../resources/mimetypes/database.png); } 23 .contenttype.database { background-image: url(../../resources/mimetypes/database.png); }
24 -.contenttype.database.shortcut { background-image: url(../../resources/mimetypes/shortcuts/database.png); } 24 +.contenttype.database_shortcut { background-image: url(../../resources/mimetypes/shortcuts/database.png); }
25 .contenttype.excel { background-image: url(../../resources/mimetypes/excel.png); } 25 .contenttype.excel { background-image: url(../../resources/mimetypes/excel.png); }
26 -.contenttype.excel.shortcut { background-image: url(../../resources/mimetypes/shortcuts/excel.png); } 26 +.contenttype.excel_shortcut { background-image: url(../../resources/mimetypes/shortcuts/excel.png); }
27 .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.png); } 27 .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.png); }
28 -.contenttype.openoffice.shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); } 28 +.contenttype.openoffice_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); }
29 .contenttype.opendocument { background-image: url(../../resources/mimetypes/openoffice.png); } 29 .contenttype.opendocument { background-image: url(../../resources/mimetypes/openoffice.png); }
30 -.contenttype.opendocument.shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); } 30 +.contenttype.opendocument_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); }
31 .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.png); } 31 .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.png); }
32 -.contenttype.pdf.shortcut { background-image: url(../../resources/mimetypes/shortcuts/pdf.png); } 32 +.contenttype.pdf_shortcut { background-image: url(../../resources/mimetypes/shortcuts/pdf.png); }
33 .contenttype.image { background-image: url(../../resources/mimetypes/image.png); } 33 .contenttype.image { background-image: url(../../resources/mimetypes/image.png); }
34 -.contenttype.image.shortcut { background-image: url(../../resources/mimetypes/shortcuts/image.png); } 34 +.contenttype.image_shortcut { background-image: url(../../resources/mimetypes/shortcuts/image.png); }
35 .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.png); } 35 .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.png); }
36 -.contenttype.compressed.shortcut { background-image: url(../../resources/mimetypes/shortcuts/zip.png); } 36 +.contenttype.compressed_shortcut { background-image: url(../../resources/mimetypes/shortcuts/zip.png); }
37 .contenttype.html { background-image: url(../../resources/mimetypes/html.png); } 37 .contenttype.html { background-image: url(../../resources/mimetypes/html.png); }
38 -.contenttype.html.shortcut { background-image: url(../../resources/mimetypes/shortcuts/html.png); } 38 +.contenttype.html_shortcut { background-image: url(../../resources/mimetypes/shortcuts/html.png); }
39 39
40 .contenttype.txt, 40 .contenttype.txt,
41 .contenttype.text, 41 .contenttype.text,
42 .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.png); } 42 .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.png); }
  43 +.contenttype.txt_shortcut,
  44 +.contenttype.text_shortcut,
  45 +.contenttype.unspecified_type_shortcut { background-image: url(../../resources/mimetypes/shortcuts/text-x-generic.png); }
  46 +
43 .contenttype.folder { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.png); } 47 .contenttype.folder { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.png); }
  48 +.contenttype.folder_shortcut { background-image: url(../../resources/mimetypes/shortcuts/x-directory-normal.png); }
resources/css/kt-ie-icons.css
@@ -34,11 +34,14 @@ @@ -34,11 +34,14 @@
34 .ktActionLink.ktMoveUp, .ktAction.ktMoveUp { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-up.gif); } 34 .ktActionLink.ktMoveUp, .ktAction.ktMoveUp { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-up.gif); }
35 .ktActionLink.ktMoveDown, .ktAction.ktMoveDown { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-down.gif); } 35 .ktActionLink.ktMoveDown, .ktAction.ktMoveDown { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-down.gif); }
36 .ktBlock {margin: 0.5em 0;} 36 .ktBlock {margin: 0.5em 0;}
  37 +
  38 +/* Mime type icons */
37 .contenttype.office { background-image: url(../../resources/mimetypes/office.gif); } 39 .contenttype.office { background-image: url(../../resources/mimetypes/office.gif); }
38 .contenttype.word { background-image: url(../../resources/mimetypes/word.gif); } 40 .contenttype.word { background-image: url(../../resources/mimetypes/word.gif); }
39 .contenttype.database { background-image: url(../../resources/mimetypes/database.gif); } 41 .contenttype.database { background-image: url(../../resources/mimetypes/database.gif); }
40 .contenttype.excel { background-image: url(../../resources/mimetypes/excel.gif); } 42 .contenttype.excel { background-image: url(../../resources/mimetypes/excel.gif); }
41 .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.gif); } 43 .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.gif); }
  44 +.contenttype.opendocument { background-image: url(../../resources/mimetypes/openoffice.gif); }
42 .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.gif); } 45 .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.gif); }
43 .contenttype.image { background-image: url(../../resources/mimetypes/image.gif); } 46 .contenttype.image { background-image: url(../../resources/mimetypes/image.gif); }
44 .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.gif); } 47 .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.gif); }
@@ -49,6 +52,25 @@ @@ -49,6 +52,25 @@
49 .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.gif); } 52 .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.gif); }
50 .contenttype.folder { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.gif); } 53 .contenttype.folder { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.gif); }
51 54
  55 +/* Mime type short cut icons - IE gets confused if the last class is the same for multiple selection so we append _shortcut instead of
  56 +using .shortcut */
  57 +.contenttype.txt_shortcut,
  58 +.contenttype.text_shortcut,
  59 +.contenttype.unspecified_type_shortcut { background-image: url(../../resources/mimetypes/shortcuts/text-x-generic.gif); }
  60 +.contenttype.folder_shortcut { background-image: url(../../resources/mimetypes/shortcuts/x-directory-normal.gif); }
  61 +
  62 +.contenttype.html_shortcut { background-image: url(../../resources/mimetypes/shortcuts/html.gif); }
  63 +.contenttype.office_shortcut { background-image: url(../../resources/mimetypes/shortcuts/office.gif); }
  64 +.contenttype.word_shortcut { background-image: url(../../resources/mimetypes/shortcuts/word.gif); }
  65 +.contenttype.database_shortcut { background-image: url(../../resources/mimetypes/shortcuts/database.gif); }
  66 +.contenttype.excel_shortcut { background-image: url(../../resources/mimetypes/shortcuts/excel.gif); }
  67 +.contenttype.openoffice_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.gif); }
  68 +.contenttype.opendocument_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.gif); }
  69 +.contenttype.pdf_shortcut { background-image: url(../../resources/mimetypes/shortcuts/pdf.gif); }
  70 +.contenttype.image_shortcut { background-image: url(../../resources/mimetypes/shortcuts/image.gif); }
  71 +.contenttype.compressed_shortcut { background-image: url(../../resources/mimetypes/shortcuts/zip.gif); }
  72 +
  73 +
52 /* IE is woefully unable to */ 74 /* IE is woefully unable to */
53 #portletbar { 75 #portletbar {
54 width: 200px; 76 width: 200px;
resources/mimetypes/shortcuts/access.gif 0 → 100755

667 Bytes

resources/mimetypes/shortcuts/code.gif 0 → 100755

657 Bytes

resources/mimetypes/shortcuts/database.gif 0 → 100755

667 Bytes

resources/mimetypes/shortcuts/excel.gif 0 → 100755

664 Bytes

resources/mimetypes/shortcuts/flash.gif 0 → 100755

649 Bytes

resources/mimetypes/shortcuts/html.gif 0 → 100755

680 Bytes

resources/mimetypes/shortcuts/image.gif 0 → 100755

664 Bytes

resources/mimetypes/shortcuts/openoffice.gif 0 → 100755

628 Bytes

resources/mimetypes/shortcuts/pdf.gif 0 → 100755

644 Bytes

resources/mimetypes/shortcuts/php.gif 0 → 100755

646 Bytes

resources/mimetypes/shortcuts/run.gif 0 → 100755

639 Bytes

resources/mimetypes/shortcuts/text-x-generic.gif 0 → 100755

383 Bytes

resources/mimetypes/shortcuts/text-x-generic.png 0 → 100644

616 Bytes

resources/mimetypes/shortcuts/vector-image.gif 0 → 100755

670 Bytes

resources/mimetypes/shortcuts/word.gif 0 → 100755

673 Bytes

resources/mimetypes/shortcuts/x-directory-normal.gif 0 → 100755

600 Bytes

resources/mimetypes/shortcuts/x-directory-normal.png 0 → 100644

714 Bytes

resources/mimetypes/shortcuts/zip.gif 0 → 100755

658 Bytes