From fba2aa5b547af74a479ab4cfa4b427186fe86f53 Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Thu, 25 Sep 2008 12:16:26 +0000 Subject: [PATCH] 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. --- lib/mime.inc.php | 16 ++++++++++------ plugins/ktcore/KTColumns.inc.php | 46 +++++++++++++++++++++++++++------------------- resources/css/kt-contenttypes.css | 25 +++++++++++++++---------- resources/css/kt-ie-icons.css | 22 ++++++++++++++++++++++ resources/mimetypes/shortcuts/access.gif | Bin 0 -> 667 bytes resources/mimetypes/shortcuts/code.gif | Bin 0 -> 657 bytes resources/mimetypes/shortcuts/database.gif | Bin 0 -> 667 bytes resources/mimetypes/shortcuts/excel.gif | Bin 0 -> 664 bytes resources/mimetypes/shortcuts/flash.gif | Bin 0 -> 649 bytes resources/mimetypes/shortcuts/html.gif | Bin 0 -> 680 bytes resources/mimetypes/shortcuts/image.gif | Bin 0 -> 664 bytes resources/mimetypes/shortcuts/openoffice.gif | Bin 0 -> 628 bytes resources/mimetypes/shortcuts/pdf.gif | Bin 0 -> 644 bytes resources/mimetypes/shortcuts/php.gif | Bin 0 -> 646 bytes resources/mimetypes/shortcuts/run.gif | Bin 0 -> 639 bytes resources/mimetypes/shortcuts/text-x-generic.gif | Bin 0 -> 383 bytes resources/mimetypes/shortcuts/text-x-generic.png | Bin 0 -> 616 bytes resources/mimetypes/shortcuts/vector-image.gif | Bin 0 -> 670 bytes resources/mimetypes/shortcuts/word.gif | Bin 0 -> 673 bytes resources/mimetypes/shortcuts/x-directory-normal.gif | Bin 0 -> 600 bytes resources/mimetypes/shortcuts/x-directory-normal.png | Bin 0 -> 714 bytes resources/mimetypes/shortcuts/zip.gif | Bin 0 -> 658 bytes 22 files changed, 74 insertions(+), 35 deletions(-) create mode 100755 resources/mimetypes/shortcuts/access.gif create mode 100755 resources/mimetypes/shortcuts/code.gif create mode 100755 resources/mimetypes/shortcuts/database.gif create mode 100755 resources/mimetypes/shortcuts/excel.gif create mode 100755 resources/mimetypes/shortcuts/flash.gif create mode 100755 resources/mimetypes/shortcuts/html.gif create mode 100755 resources/mimetypes/shortcuts/image.gif create mode 100755 resources/mimetypes/shortcuts/openoffice.gif create mode 100755 resources/mimetypes/shortcuts/pdf.gif create mode 100755 resources/mimetypes/shortcuts/php.gif create mode 100755 resources/mimetypes/shortcuts/run.gif create mode 100755 resources/mimetypes/shortcuts/text-x-generic.gif create mode 100644 resources/mimetypes/shortcuts/text-x-generic.png create mode 100755 resources/mimetypes/shortcuts/vector-image.gif create mode 100755 resources/mimetypes/shortcuts/word.gif create mode 100755 resources/mimetypes/shortcuts/x-directory-normal.gif create mode 100644 resources/mimetypes/shortcuts/x-directory-normal.png create mode 100755 resources/mimetypes/shortcuts/zip.gif diff --git a/lib/mime.inc.php b/lib/mime.inc.php index 941c06b..9345d31 100644 --- a/lib/mime.inc.php +++ b/lib/mime.inc.php @@ -183,13 +183,17 @@ class KTMime { return null; } - function getIconPath($iMimeTypeId) { - $cached = KTUtil::arrayGet($GLOBALS['_KT_icon_path_cache'], $iMimeTypeId); - if (!empty($cached)) { - return $cached; + function getIconPath($iMimeTypeId, $type = null) { + $icon = KTUtil::arrayGet($GLOBALS['_KT_icon_path_cache'], $iMimeTypeId); + if (empty($icon)) { + $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId] = KTMime::_getIconPath($iMimeTypeId); + $icon = $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId]; } - $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId] = KTMime::_getIconPath($iMimeTypeId); - return $GLOBALS['_KT_icon_path_cache'][$iMimeTypeId]; + + if(!empty($type)){ + $icon .= '_'.$type; + } + return $icon; } function _getIconPath($iMimeTypeId) { diff --git a/plugins/ktcore/KTColumns.inc.php b/plugins/ktcore/KTColumns.inc.php index 8fc39d1..a54d887 100644 --- a/plugins/ktcore/KTColumns.inc.php +++ b/plugins/ktcore/KTColumns.inc.php @@ -166,25 +166,33 @@ class AdvancedTitleColumn extends AdvancedColumn { // use inline, since its just too heavy to even _think_ about using smarty. function renderData($aDataRow) { - if ($aDataRow["type"] == "folder") { - $contenttype = 'folder'; - $link = $this->renderFolderLink($aDataRow); - if($aDataRow['folder']->isSymbolicLink()){ - return "
 
$link
 "; - }else{ - return "
 
$link"; - } + if ($aDataRow["type"] == "folder") { + $contenttype = 'folder'; + $link = $this->renderFolderLink($aDataRow); + + // If folder is a shortcut display the shortcut mime icon + if($aDataRow['folder']->isSymbolicLink()){ + $contenttype .= '_shortcut'; + } + // Separate the link from the mime icon to allow for right-to-left languages + return "
 
$link"; } else { - $contenttype = $this->_mimeHelper($aDataRow["document"]->getMimeTypeId()); - $link = $this->renderDocumentLink($aDataRow); + $type = ''; + $size = ''; + if($aDataRow['document']->isSymbolicLink()){ + // If document is a shortcut - display the shortcut mime type + $type = 'shortcut'; + }else{ + // Display the document size if it is not a shortcut + $size = $this->prettySize($aDataRow["document"]->getSize()); + $size = " ($size)"; + } - //Render an image instead of the size in case of a shortcut - if($aDataRow['document']->isSymbolicLink()){ - return "
 
$link"; - }else{ - $size = $this->prettySize($aDataRow["document"]->getSize()); - return "
 
$link
 ($size)"; - } + $link = $this->renderDocumentLink($aDataRow); + $contenttype = $this->_mimeHelper($aDataRow["document"]->getMimeTypeId(), $type); + + // Separate the link from the mime icon and the size to allow for right-to-left languages + return "
 
$link
$size"; } } @@ -197,9 +205,9 @@ class AdvancedTitleColumn extends AdvancedColumn { return $finalSize . $label; } - function _mimeHelper($iMimeTypeId) { + function _mimeHelper($iMimeTypeId, $type = null) { require_once(KT_LIB_DIR . '/mime.inc.php'); - return KTMime::getIconPath($iMimeTypeId); + return KTMime::getIconPath($iMimeTypeId, $type); } } diff --git a/resources/css/kt-contenttypes.css b/resources/css/kt-contenttypes.css index fb51789..a23c721 100644 --- a/resources/css/kt-contenttypes.css +++ b/resources/css/kt-contenttypes.css @@ -17,27 +17,32 @@ } .contenttype.office { background-image: url(../../resources/mimetypes/office.png); } -.contenttype.office.shortcut { background-image: url(../../resources/mimetypes/shortcuts/office.png); } +.contenttype.office_shortcut { background-image: url(../../resources/mimetypes/shortcuts/office.png); } .contenttype.word { background-image: url(../../resources/mimetypes/word.png); } -.contenttype.word.shortcut { background-image: url(../../resources/mimetypes/shortcuts/word.png); } +.contenttype.word_shortcut { background-image: url(../../resources/mimetypes/shortcuts/word.png); } .contenttype.database { background-image: url(../../resources/mimetypes/database.png); } -.contenttype.database.shortcut { background-image: url(../../resources/mimetypes/shortcuts/database.png); } +.contenttype.database_shortcut { background-image: url(../../resources/mimetypes/shortcuts/database.png); } .contenttype.excel { background-image: url(../../resources/mimetypes/excel.png); } -.contenttype.excel.shortcut { background-image: url(../../resources/mimetypes/shortcuts/excel.png); } +.contenttype.excel_shortcut { background-image: url(../../resources/mimetypes/shortcuts/excel.png); } .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.png); } -.contenttype.openoffice.shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); } +.contenttype.openoffice_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); } .contenttype.opendocument { background-image: url(../../resources/mimetypes/openoffice.png); } -.contenttype.opendocument.shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); } +.contenttype.opendocument_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.png); } .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.png); } -.contenttype.pdf.shortcut { background-image: url(../../resources/mimetypes/shortcuts/pdf.png); } +.contenttype.pdf_shortcut { background-image: url(../../resources/mimetypes/shortcuts/pdf.png); } .contenttype.image { background-image: url(../../resources/mimetypes/image.png); } -.contenttype.image.shortcut { background-image: url(../../resources/mimetypes/shortcuts/image.png); } +.contenttype.image_shortcut { background-image: url(../../resources/mimetypes/shortcuts/image.png); } .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.png); } -.contenttype.compressed.shortcut { background-image: url(../../resources/mimetypes/shortcuts/zip.png); } +.contenttype.compressed_shortcut { background-image: url(../../resources/mimetypes/shortcuts/zip.png); } .contenttype.html { background-image: url(../../resources/mimetypes/html.png); } -.contenttype.html.shortcut { background-image: url(../../resources/mimetypes/shortcuts/html.png); } +.contenttype.html_shortcut { background-image: url(../../resources/mimetypes/shortcuts/html.png); } .contenttype.txt, .contenttype.text, .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.png); } +.contenttype.txt_shortcut, +.contenttype.text_shortcut, +.contenttype.unspecified_type_shortcut { background-image: url(../../resources/mimetypes/shortcuts/text-x-generic.png); } + .contenttype.folder { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.png); } +.contenttype.folder_shortcut { background-image: url(../../resources/mimetypes/shortcuts/x-directory-normal.png); } diff --git a/resources/css/kt-ie-icons.css b/resources/css/kt-ie-icons.css index 55b0905..15cd91b 100644 --- a/resources/css/kt-ie-icons.css +++ b/resources/css/kt-ie-icons.css @@ -34,11 +34,14 @@ .ktActionLink.ktMoveUp, .ktAction.ktMoveUp { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-up.gif); } .ktActionLink.ktMoveDown, .ktAction.ktMoveDown { background-image: url(../../thirdparty/icon-theme/16x16/actions/move-down.gif); } .ktBlock {margin: 0.5em 0;} + +/* Mime type icons */ .contenttype.office { background-image: url(../../resources/mimetypes/office.gif); } .contenttype.word { background-image: url(../../resources/mimetypes/word.gif); } .contenttype.database { background-image: url(../../resources/mimetypes/database.gif); } .contenttype.excel { background-image: url(../../resources/mimetypes/excel.gif); } .contenttype.openoffice { background-image: url(../../resources/mimetypes/openoffice.gif); } +.contenttype.opendocument { background-image: url(../../resources/mimetypes/openoffice.gif); } .contenttype.pdf { background-image: url(../../resources/mimetypes/pdf.gif); } .contenttype.image { background-image: url(../../resources/mimetypes/image.gif); } .contenttype.compressed { background-image: url(../../resources/mimetypes/zip.gif); } @@ -49,6 +52,25 @@ .contenttype.unspecified_type { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/text-x-generic.gif); } .contenttype.folder { background-image: url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.gif); } +/* Mime type short cut icons - IE gets confused if the last class is the same for multiple selection so we append _shortcut instead of +using .shortcut */ +.contenttype.txt_shortcut, +.contenttype.text_shortcut, +.contenttype.unspecified_type_shortcut { background-image: url(../../resources/mimetypes/shortcuts/text-x-generic.gif); } +.contenttype.folder_shortcut { background-image: url(../../resources/mimetypes/shortcuts/x-directory-normal.gif); } + +.contenttype.html_shortcut { background-image: url(../../resources/mimetypes/shortcuts/html.gif); } +.contenttype.office_shortcut { background-image: url(../../resources/mimetypes/shortcuts/office.gif); } +.contenttype.word_shortcut { background-image: url(../../resources/mimetypes/shortcuts/word.gif); } +.contenttype.database_shortcut { background-image: url(../../resources/mimetypes/shortcuts/database.gif); } +.contenttype.excel_shortcut { background-image: url(../../resources/mimetypes/shortcuts/excel.gif); } +.contenttype.openoffice_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.gif); } +.contenttype.opendocument_shortcut { background-image: url(../../resources/mimetypes/shortcuts/openoffice.gif); } +.contenttype.pdf_shortcut { background-image: url(../../resources/mimetypes/shortcuts/pdf.gif); } +.contenttype.image_shortcut { background-image: url(../../resources/mimetypes/shortcuts/image.gif); } +.contenttype.compressed_shortcut { background-image: url(../../resources/mimetypes/shortcuts/zip.gif); } + + /* IE is woefully unable to */ #portletbar { width: 200px; diff --git a/resources/mimetypes/shortcuts/access.gif b/resources/mimetypes/shortcuts/access.gif new file mode 100755 index 0000000..d70eaff Binary files /dev/null and b/resources/mimetypes/shortcuts/access.gif differ diff --git a/resources/mimetypes/shortcuts/code.gif b/resources/mimetypes/shortcuts/code.gif new file mode 100755 index 0000000..af893eb Binary files /dev/null and b/resources/mimetypes/shortcuts/code.gif differ diff --git a/resources/mimetypes/shortcuts/database.gif b/resources/mimetypes/shortcuts/database.gif new file mode 100755 index 0000000..a4031b4 Binary files /dev/null and b/resources/mimetypes/shortcuts/database.gif differ diff --git a/resources/mimetypes/shortcuts/excel.gif b/resources/mimetypes/shortcuts/excel.gif new file mode 100755 index 0000000..d920acd Binary files /dev/null and b/resources/mimetypes/shortcuts/excel.gif differ diff --git a/resources/mimetypes/shortcuts/flash.gif b/resources/mimetypes/shortcuts/flash.gif new file mode 100755 index 0000000..5289272 Binary files /dev/null and b/resources/mimetypes/shortcuts/flash.gif differ diff --git a/resources/mimetypes/shortcuts/html.gif b/resources/mimetypes/shortcuts/html.gif new file mode 100755 index 0000000..9db83ad Binary files /dev/null and b/resources/mimetypes/shortcuts/html.gif differ diff --git a/resources/mimetypes/shortcuts/image.gif b/resources/mimetypes/shortcuts/image.gif new file mode 100755 index 0000000..49f4e7e Binary files /dev/null and b/resources/mimetypes/shortcuts/image.gif differ diff --git a/resources/mimetypes/shortcuts/openoffice.gif b/resources/mimetypes/shortcuts/openoffice.gif new file mode 100755 index 0000000..a28037c Binary files /dev/null and b/resources/mimetypes/shortcuts/openoffice.gif differ diff --git a/resources/mimetypes/shortcuts/pdf.gif b/resources/mimetypes/shortcuts/pdf.gif new file mode 100755 index 0000000..facd654 Binary files /dev/null and b/resources/mimetypes/shortcuts/pdf.gif differ diff --git a/resources/mimetypes/shortcuts/php.gif b/resources/mimetypes/shortcuts/php.gif new file mode 100755 index 0000000..e655e25 Binary files /dev/null and b/resources/mimetypes/shortcuts/php.gif differ diff --git a/resources/mimetypes/shortcuts/run.gif b/resources/mimetypes/shortcuts/run.gif new file mode 100755 index 0000000..e054736 Binary files /dev/null and b/resources/mimetypes/shortcuts/run.gif differ diff --git a/resources/mimetypes/shortcuts/text-x-generic.gif b/resources/mimetypes/shortcuts/text-x-generic.gif new file mode 100755 index 0000000..3655acf Binary files /dev/null and b/resources/mimetypes/shortcuts/text-x-generic.gif differ diff --git a/resources/mimetypes/shortcuts/text-x-generic.png b/resources/mimetypes/shortcuts/text-x-generic.png new file mode 100644 index 0000000..86c86e1 Binary files /dev/null and b/resources/mimetypes/shortcuts/text-x-generic.png differ diff --git a/resources/mimetypes/shortcuts/vector-image.gif b/resources/mimetypes/shortcuts/vector-image.gif new file mode 100755 index 0000000..b9061f3 Binary files /dev/null and b/resources/mimetypes/shortcuts/vector-image.gif differ diff --git a/resources/mimetypes/shortcuts/word.gif b/resources/mimetypes/shortcuts/word.gif new file mode 100755 index 0000000..a2873f1 Binary files /dev/null and b/resources/mimetypes/shortcuts/word.gif differ diff --git a/resources/mimetypes/shortcuts/x-directory-normal.gif b/resources/mimetypes/shortcuts/x-directory-normal.gif new file mode 100755 index 0000000..cbb751b Binary files /dev/null and b/resources/mimetypes/shortcuts/x-directory-normal.gif differ diff --git a/resources/mimetypes/shortcuts/x-directory-normal.png b/resources/mimetypes/shortcuts/x-directory-normal.png new file mode 100644 index 0000000..af6d2c9 Binary files /dev/null and b/resources/mimetypes/shortcuts/x-directory-normal.png differ diff --git a/resources/mimetypes/shortcuts/zip.gif b/resources/mimetypes/shortcuts/zip.gif new file mode 100755 index 0000000..bcd48b1 Binary files /dev/null and b/resources/mimetypes/shortcuts/zip.gif differ -- libgit2 0.21.4