User:Salvatore Ingala/GSoC 2011 application/example

Here is an example of how meta-configuration objects could look like. It defines most of the variables of Navigation popups. This object should be passed from the tool to some call to a javascript method (maybe exported by the window.mediaWiki object).

Exporting an object of this kind (and managing localization) is all the tool writers will need to do.

The shown format is just an example; the final format and the supported features will be decided after a more sensible design, of course.

{
  popupDelay: {
    type: 'decimal',
    default: 0.5,
    min: 0,
    description: 'popup-delay-description' //description strings are externalized for localization
  },
  popupHideDelay: {
    type: 'decimal',
    default: 0.5,
    min: 0,
    description: 'popup-hidedelay-description'
  },
  popupModifier: {
    type: 'string',
    default: '',
    description: 'popup-modifier-description',
    values: { //list of values to choose from
      '': 'popup-modifier-nothing',
      'ctrl': 'popup-modifier-ctrl',
      'shift': 'popup-modifier-shift',
      'alt': 'popup-modifier-alt',
      'meta': 'popup-modifier-ctrl'
    }
  },
  simplePopups: {
    type: 'boolean',
    default: false,
    description: 'popup-simple-popups'
  },
  popupModifier: {
    type: 'string',
    default: '',
    description: 'popup-modifier-description',
    values: {
      '': 'popup-modifier-nothing',
      'ctrl': 'popup-modifier-ctrl',
      'shift': 'popup-modifier-shift',
      'alt': 'popup-modifier-alt',
      'meta': 'popup-modifier-ctrl'
    }
  },
  popupStructure: {
    type: 'string',
    default: 'shortmenus',
    description: 'popup-structure-description',
    values: {
      'original': 'popup-structure-original',
      'fancy': 'popup-structure-fancy',
      'fancy2': 'popup-structure-fancy2',
      'menus': 'popup-structure-menus',
      'shortmenus': 'popup-structure-shortmenus',
      'lite': 'popup-structure-lite',
      'nostalgia': 'popup-structure-nostalgia'
    }
  },
  popupActionsMenu: {
    type: 'boolean',
    default: true,
    description: 'popup-actions-menu'
  },
  popupImages: {
    type: 'boolean',
    default: true,
    description: 'popup-images'
  },
  popupSubpopups: {
    type: 'boolean',
    default: true,
    description: 'popup-subpopups'
  },
  popupOnEditSelection: {
    type: 'boolean',
    default: true,
    description: 'popup-on-edit-selection'
  },
  popupAdminLinks: {
    type: 'boolean',
    default: function(){ /* TODO: Compute default value */ }, //computes the default value programmatically
    description: 'popup-admin-links'
  },
  popupShortcutKeys: {
    type: 'boolean',
    default: false,
    description: 'popup-shortcut-keys'
  },
  popupFixredirs: {
    type: 'boolean',
    default: false,
    description: 'popup-fix-redirs'
  },
  popupWatchRedirredPages: {
    type: 'string', //this differs from the documented version of the parameter (which has mixed type)
    default: 'null',
    description: 'popup-watch-redirred-pages-description',
    values: {
      'true': 'popup-watch-redirred-pages-true',
      'false': 'popup-watch-redirred-pages-false',
      'null': 'popup-watch-redirred-pages-null'
    }
  },
  popupRedirAutoClick: {
    type: 'string',
    default: 'wpDiff',
    description: 'popup-redir-auto-click-description',
    values: {
      'wpSave': 'popup-redir-auto-click-save',
      'wpPreview': 'popup-redir-auto-click-preview',
      'wpDiff': 'popup-redir-auto-click-diff'
    }
  },
  popupRedlinkRemoval: {
    type: 'boolean',
    default: false,
    description: 'popup-redlink-removal'
  },
  popupFixDabs: {
    type: 'boolean',
    default: false,
    description: 'popup-fix-dabs'
  },
  popupAllDabsStubs: {
    type: 'boolean',
    default: false,
    description: 'popup-all-dabs-stubs'
  },
  popupWatchDisambiggedPages: {
    type: 'string', //this differs from the documented version of the parameter (which has mixed type)
    default: 'null',
    description: 'popup-watch-disambigged-pages-description',
    values: {
      'true': 'popup-watch-disambigged-pages-true',
      'false': 'popup-watch-disambigged-pages-false',
      'null': 'popup-watch-disambigged-pages-null'
    }
  },
  popupNavLinks: {
    type: 'boolean',
    default: true,
    description: 'popup-nav-links'
  },
  popupLastEditLink: {
    type: 'boolean',
    default: true,
    description: 'popup-last-edit-link'
  },
  popupHistoricalLinks: {
    type: 'boolean',
    default: true,
    description: 'popup-historical-links'
  },
  popupPreviews: {
    type: 'boolean',
    default: true,
    description: 'popup-previews'
  },
  popupLastModified: {
    type: 'boolean',
    default: true,
    description: 'popup-last-modified'
  },
  popupDiffDates: {
    type: 'boolean',
    default: true,
    description: 'popup-diff-dates'
  },
  popupImageLinks: {
    type: 'boolean',
    default: true,
    description: 'popup-image-links'
  },
  popupOnlyArticleLinks: {
    type: 'boolean',
    default: true,
    description: 'popup-only-article-links'
  },
  imagePopupsForImages: {
    type: 'boolean',
    default: true,
    description: 'popup-image-popups-for-images'
  },
  popupMaxWidth: {
    type: '?integer', //optional integer (integer or false), a checkbox will be shown
    default: 350,
    description: 'popup-max-width'
  },
  popupInitialWidth: {
    type: '?integer', //optional integer (integer or false)
    default: false,
    description: 'popup-initial-width'
  },
  popupEditCounterTools: {
    type: 'string', 
    default: 'soxred',
    description: 'popup-edit-counter-tools-description',
    values: {
      'soxred': 'popup-edit-counter-tools-soxred',
      'interiot': 'popup-edit-counter-tools-interiot',
      'custom': 'popup-edit-counter-tools-custom'
    }
  },
  popupEditCounterUrl: {
    type: 'url',
    description: 'popup-edit-counter-url'
  },
  popupDragHandle: {
    type: '?string', //optional string
    default: false,
    description: 'popup-drag-handle-description',
    values: {
      'popupTopLinks': 'popup-drag-handle-popuptoplinks',
      //... other values
    }
  },
  popupAdjustDates {
    type: 'boolean',
    default: true,
    description: 'popup-adjust-dates'
  },
  popupThumbAction: {
    type: 'string',
    default: 'imagepage',
    description: 'popup-thumb-action-description',
    values: {
      'imagepage': 'popup-thumb-action-imagepage',
      'sizetoggle': 'popup-thumb-action-sizetoggle',
      'linkfull': 'popup-thumb-action-linkfull',
    }
  }
}