From 9fee0433f957f5b6b601753d8de6d4ca881057dc Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 28 Dec 2007 13:59:22 +0000 Subject: [PATCH] ActionItem24: display unknown.png when there is no icon for that mime type --- app/helpers/cms_helper.rb | 10 +++++++++- public/images/icons-mime/README | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------- public/images/icons-mime/gnome-mime-empty.png | Bin 0 -> 540 bytes public/images/icons-mime/unknown.png | 1 + 4 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 public/images/icons-mime/gnome-mime-empty.png create mode 120000 public/images/icons-mime/unknown.png diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index c30ea09..95f15e3 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -11,7 +11,15 @@ module CmsHelper def icon_for_article(article) icon = article.icon_name - (icon =~ /\//) ? icon : "icons-mime/#{article.icon_name}" + if (icon =~ /\//) + icon + else + if File.exists?(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', "#{icon}.png")) + "icons-mime/#{icon}" + else + "icons-mime/unknown.png" + end + end end end diff --git a/public/images/icons-mime/README b/public/images/icons-mime/README index c954f36..7248846 100644 --- a/public/images/icons-mime/README +++ b/public/images/icons-mime/README @@ -1,18 +1,25 @@ -dlg-neu icons in Noosfero -========================= +mime icons in Noosfero +====================== -The icons in this directory are taken from the dlg-neu icon theme for GNOME, -section "mimetypes/". We take the SVG files and convert to 64x64 PNG images, so -these icons are in fact derived works based on dlg-neu's SVG files. +Icon Source Theme License +------------------------ -------------- ------- +gnome-mime-text-html.png dlg-neu GPLV2+ +gnome-mime-empty.png Nuovo GPLV2+ +ico-feed-on.png GPLv3 -Exception: ico-feed-on.png was made by Aurélio A. Heckert - and is licensed under the GNU General Public License, -version 3. +The icons in this directory are taken from some GNOME theme with compatible +license (i.e. GPLV2+ or GPLv3), section "mimetypes/". We take the SVG files and +convert to 24x24 PNG images, so these icons are in fact derived works of those +in the themes. + +Some icons are not taken from themes (e.g. ico-feed-on.png was made by Aurélio +A. Heckert and is licensed under the GNU General +Public License, version 3.) Structure ========= -To keep a trace back to dlg-neu theme, when rasterizing the SVG files we keep +To keep a trace back to original themes, when rasterizing the SVG files we keep the original filenames (replacing .svg by .png, obviously) and create symbolic links with names more sensible for Noosfero. @@ -22,29 +29,65 @@ Icons rasterization With rsvg, from the librsvg2-bin package (i.e. we use the same rasterization library as GNOME, so the icons must look like they do in GNOME). -$ rsvg -w 64 -h 64 .svg .png +$ rsvg -w 24 -h 24 .svg .png Licensing ========= -Their License is as follows (taken from -/usr/share/doc/gnome-icon-theme-dlg-neu/copyright on a Debian system): +dlg-neu icons (according to /usr/share/doc/gnome-icon-theme-dlg-neu/copyright +on a Debian system): + + Copyright Holders: Silvestre Herrera (silvestre.herrera@gmail.com) + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301 USA + +Nuovo icons (according to /usr/share/doc/gnome-icon-theme-nuovo/copyright on a +Debian system): + + Copyright Holders: Silvestre Herrera - This package is free software; you can redistribute it and/or modify + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301 USA + +ico-feed-on.png: + + Copyright holders: Aurélio A. Heckert + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This package is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA - -On Debian systems, the complete text of the GNU General -Public License can be found in `/usr/share/common-licenses/GPL'. + along with this program. If not, see . diff --git a/public/images/icons-mime/gnome-mime-empty.png b/public/images/icons-mime/gnome-mime-empty.png new file mode 100644 index 0000000..2a2727e Binary files /dev/null and b/public/images/icons-mime/gnome-mime-empty.png differ diff --git a/public/images/icons-mime/unknown.png b/public/images/icons-mime/unknown.png new file mode 120000 index 0000000..3a18748 --- /dev/null +++ b/public/images/icons-mime/unknown.png @@ -0,0 +1 @@ +gnome-mime-empty.png \ No newline at end of file -- libgit2 0.21.2