Commit fba2aa5b547af74a479ab4cfa4b427186fe86f53

Authored by Megan Watson
1 parent ebf08fad

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/trunk@9389 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/mime.inc.php
... ... @@ -183,13 +183,17 @@ class KTMime {
183 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 199 function _getIconPath($iMimeTypeId) {
... ...
plugins/ktcore/KTColumns.inc.php
... ... @@ -166,25 +166,33 @@ class AdvancedTitleColumn extends AdvancedColumn {
166 166  
167 167 // use inline, since its just too heavy to even _think_ about using smarty.
168 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 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 205 return $finalSize . $label;
198 206 }
199 207  
200   - function _mimeHelper($iMimeTypeId) {
  208 + function _mimeHelper($iMimeTypeId, $type = null) {
201 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 17 }
18 18  
19 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 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 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 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 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 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 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 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 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 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 40 .contenttype.txt,
41 41 .contenttype.text,
42 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 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 34 .ktActionLink.ktMoveUp, .ktAction.ktMoveUp { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-up.gif); }
35 35 .ktActionLink.ktMoveDown, .ktAction.ktMoveDown { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-down.gif); }
36 36 .ktBlock {margin: 0.5em 0;}
  37 +
  38 +/* Mime type icons */
37 39 .contenttype.office { background-image: url(../../resources/mimetypes/office.gif); }
38 40 .contenttype.word { background-image: url(../../resources/mimetypes/word.gif); }
39 41 .contenttype.database { background-image: url(../../resources/mimetypes/database.gif); }
40 42 .contenttype.excel { background-image: url(../../resources/mimetypes/excel.gif); }
41 43 .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.gif); }
  44 +.contenttype.opendocument { background-image: url(../../resources/mimetypes/openoffice.gif); }
42 45 .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.gif); }
43 46 .contenttype.image { background-image: url(../../resources/mimetypes/image.gif); }
44 47 .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.gif); }
... ... @@ -49,6 +52,25 @@
49 52 .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.gif); }
50 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 74 /* IE is woefully unable to */
53 75 #portletbar {
54 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