Feature Proposal: Replace the old ICON macro with JQICON

Motivation

While Investigating Item14493, it became obvious that our ICON rendering and update / skinning features were horribly complex. Turns out the JQICON does mostly everything that ICON should do.

Description and Documentation

Remove the Foswiki::Render::IconImage module. Replace the Foswiki::Macros::ICON with the JQICON functionality from the JQueryPlugin. Add some minor features to improve compatibility.

This is mostly refactoring of existing code. The following features of ICON would need porting into JQICON
  • Support for the quote= argument. I propose that this should be added for backwards compatibility, but documented as deprecated. The quote= feature can be handled by overriding the format= string.
  • The ability to render ICONs from templates should be preserved, but also documented as deprecated.
    • Remove the icons.tmpl template.
  • Support for the ICONTOPIC setting.
    • Add DocumentGraphics to the end of the search path. (The FamFam icons are missing some important icons).
    • Allow it to be manually set in the search path
    • Allow it to be a list.
    • Remove it from DefaultPreferences.
My thinking on ICONTOPIC. Some sites may have replaced DocumentGraphics with their own local graphics files. These sites can move it to the front of the search path if they want their ICONs to always apply. This also allows web and application specific ICON overrides.

There are a couple of features supported by the templates that could be improved for easier access.
  • Specify alt= and topic= strings for the icon
  • Specify non-standard sizes
  • Specify a default format= string for the icon
This needs some discussion, but my thought is to add a | table | to the Icon topic with the attached icon. When an ICON is found on the search path, the topic can be read to retrieve any defaults. (These should be cached). if not found, then the defaults as currently used by JQICON would be applied.

Icon-name
alt
title
height
width
class
animate
style
format string

This could all be accomplished just by the format string override, however that requires writing html.

Examples

It's pretty compatible. Adding the following Set to the SitePreferences, along with adding DocumentGraphics to the ICON search path allows ICON to be replaced today.
Set ICON = %JQICON{"%DEFAULT%" alt="%alt{default=""}%" title="%title{default=""}%"}%

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: GeorgeClark - 30 Sep 2017

Discussion

Discussion in the 10/2 release meeting. Adding tabular override of ICON defaults is too much overhead. ICON needs to be extremely fast. The recommended solution is for applications to pre-define ICONs with custom macros eg. Set OPEN = %ICON{icon with desired overrides to the settings}%

ICONTOPIC can probably be supported but needs to be restricted by a bin/configure setting. There may be implications of allowing graphics to be loaded from any topic.

-- GeorgeClark - 02 Oct 2017
 
Topic revision: r3 - 30 Jan 2018, MichaelDaum - This page was cached on 15 Nov 2018 - 01:23.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy