Changeset 65


Ignore:
Timestamp:
11/15/12 17:31:20 (7 years ago)
Author:
nhoyt
Message:

ff-overlay.js

  • Moved openPreferencesWindow fn. here; added calls to initFromGeneralPrefs and initFromEvaluationPrefs in ainspector.onLoad fn.

ff-overlay.xul

  • Deleted script tag for preferences.js; added script tags for preferences/general.js and preferences/evaluation.js

preferences/evaluation.js

  • New file with fns. for handling evaluation preferences branch.

preferences/evaluation.xul

  • Moved strings to DTD; added Restore Defaults button.

preferences/general.js

  • Most of the code that was in preferences.js is now here: fns. for handling general preferences branch.

preferences/options.js

  • Added fns. setStatePrefpaneEvaluation, initPrefpaneEvaluation and resetEvaluationPrefs.
  • Added handling of notifyOptionsEvaluationPrefChange callback variable.

preferences.js

  • Renamed to preferences/general.js and moved openPreferencesWindow fn. to ff-overlay.js
Location:
trunk/proto-08/chrome
Files:
1 added
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/proto-08/chrome/content/ff-overlay.js

    r51 r65  
    211211}; 
    212212 
     213/** 
     214 * @function openPreferencesWindow 
     215 * 
     216 * @memberOf ainspector 
     217 * 
     218 * @desc Instantiate the preferences window and save a reference to it; if it 
     219 *       already exists, bring it to the front. 
     220 */ 
     221 
     222ainspector.openPreferencesWindow = function () { 
     223  if (ainspector.preferencesWindow == null || ainspector.preferencesWindow.closed) { 
     224 
     225    var instantApply = Application.prefs.get("browser.preferences.instantApply"); 
     226    var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply.value ? ",dialog=no" : ",modal"); 
     227    ainspector.preferencesWindow = 
     228      window.openDialog('chrome://ai-sidebar/content/preferences/options.xul', "ainspector-preferences", features); 
     229  } 
     230  ainspector.preferencesWindow.focus(); 
     231}; 
     232 
    213233ainspector.onLoad = function () { 
    214234  // change logger enabled and level properties here (and only here) 
     
    225245 
    226246  // initializations 
    227   ainspector.setGeneralPreferences(); 
     247  ainspector.initFromGeneralPrefs(); 
     248  ainspector.initFromEvaluationPrefs(); 
    228249  ainspector.preferencesWindow = null; 
    229250}; 
  • trunk/proto-08/chrome/content/ff-overlay.xul

    r51 r65  
    1515  <script src="utilities/progress.js"/> 
    1616  <script src="utilities/utils.js"/> 
    17   <script src="preferences.js"/> 
     17  <script src="preferences/general.js"/> 
     18  <script src="preferences/evaluation.js"/> 
    1819  <script src="ff-overlay.js"/> 
    1920 
  • trunk/proto-08/chrome/content/preferences/evaluation.xul

    r63 r65  
    66  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 
    77 
    8   <prefpane id="ai-pane-evaluation"> 
     8  <prefpane id="ai-pane-evaluation" onpaneload="ainspector.options.initPrefpaneEvaluation()"> 
    99    <preferences> 
    1010      <preference id="ai-ruleset-pref" type="int" 
     
    3737          <radio id="ai-ruleset-strict" 
    3838            group="ai-ruleset-group" value="0" 
    39             label="WCAG 2.0 ARIA: Strict"/> 
     39            label="&label.ruleset.aria.strict;"/> 
    4040          <radio id="ai-ruleset-transitional" 
    4141            group="ai-ruleset-group" value="1" 
    42             label="WCAG 2.0 ARIA: Transitional"/> 
     42            label="&label.ruleset.aria.transitional;"/> 
    4343        </radiogroup> 
    4444      </vbox> 
    4545      <spacer height="12"/> 
    4646      <checkbox id="ai-enable-rec-rules" preference="ai-enable-rec-rules-pref" 
    47         label="Enable recommended rules"/> 
     47        label="&label.enable.rec.rules;"/> 
    4848    </groupbox> 
    4949 
     
    5454          <radio id="ai-wcag-level-aaa" 
    5555            group="ai-wcag-level-group" value="0" 
    56             label="A, AA, AAA (high)"/> 
     56            label="&label.wcag.level.aaa;"/> 
    5757          <radio id="ai-wcag-level-aaa" 
    5858            group="ai-wcag-level-group" value="1" 
    59             label="A, AA (intermediate)"/> 
     59            label="&label.wcag.level.aa;"/> 
    6060          <radio id="ai-wcag-level-aaa" 
    6161            group="ai-wcag-level-group" value="2" 
    62             label="A (low)"/> 
     62            label="&label.wcag.level.a;"/> 
    6363        </radiogroup> 
    6464      </vbox> 
     
    6969      <vbox> 
    7070        <checkbox id="ai-show-page-mc" preference="ai-show-page-mc-pref" 
    71           label="Manual checks: page-level"/> 
     71          label="&label.show.page.mc;"/> 
    7272        <checkbox id="ai-show-elem-mc" preference="ai-show-elem-mc-pref" 
    73           label="Manual checks: element-level"/> 
     73          label="&label.show.elem.mc;"/> 
    7474        <checkbox id="ai-show-pass" preference="ai-show-pass-pref" 
    75           label="Pass"/> 
     75          label="&label.show.pass;"/> 
    7676        <checkbox id="ai-show-hidden" preference="ai-show-hidden-pref" 
    77           label="Hidden"/> 
     77          label="&label.show.hidden;"/> 
    7878      </vbox> 
    7979    </groupbox> 
     
    8383      <vbox> 
    8484        <checkbox id="ai-layout-tables" preference="ai-layout-tables-pref" 
    85           label="Allow table markup used for page layout"/> 
     85          label="&label.page.layout;"/> 
    8686        <checkbox id="ai-broken-links" preference="ai-broken-links-pref" 
    87           label="Check for broken links"/> 
     87          label="&label.broken.links;"/> 
    8888      </vbox> 
    8989    </groupbox> 
    9090 
     91    <vbox class="secondary"> 
     92      <hbox> 
     93        <button id="ai-button-restore-evaluation" 
     94          label="&button.label.restore;" 
     95          oncommand="ainspector.options.resetEvaluationPrefs()"/> 
     96      </hbox> 
     97    </vbox> 
     98 
    9199 </prefpane> 
    92100</overlay> 
  • trunk/proto-08/chrome/content/preferences/general.js

    r64 r65  
    4040    }, 
    4141 
    42     setPref: function (name, value) { 
    43       if (name === "showMenu") { 
    44         prefUtils.setBoolPref(name, value); 
    45         return; 
    46       } 
    47       if (name === "sidebarCom") { 
    48         prefUtils.setComplexValue(name, value); 
    49         return; 
    50       } 
    51       if (name === "toolbarCom") { 
    52         prefUtils.setComplexValue(name, value); 
    53         return; 
    54       } 
    55       if (name === "sidebarMod") { 
    56         prefUtils.setIntPref(name, value); 
    57         return; 
    58       } 
    59       if (name === "toolbarMod") { 
    60         prefUtils.setIntPref(name, value); 
    61         return; 
    62       } 
    63     }, 
    64  
    6542    hasUserValues: function () { 
    6643      return prefUtils.hasUserValues(); 
     
    7451 
    7552/** 
    76  * @function setGeneralPreferences 
     53 * @function initFromGeneralPrefs 
    7754 * 
    7855 * @memberOf ainspector 
    7956 * 
    80  * @desc Initialize widgets and key elements based on user prefs. 
     57 * @desc Initialize widgets and key elements based on general preferences. 
    8158 */ 
    8259 
    83 ainspector.setGeneralPreferences = function () { 
     60ainspector.initFromGeneralPrefs = function () { 
    8461  ainspector.menu.hidden = !(ainspector.generalPrefs.getPref('showMenu')); 
    8562 
     
    154131 
    155132ainspector.generalPrefListener.register(); 
    156  
    157 /* 
    158 ainspector.evaluationPrefListener = new OAA_WEB_ACCESSIBILITY_UTILS.PrefListener( 
    159   "extensions.ainspector.evaluation.", ainspector.onEvaluationPrefChange); 
    160 */ 
    161  
    162 /** 
    163  * @function openPreferencesWindow 
    164  * 
    165  * @memberOf ainspector 
    166  * 
    167  * @desc Instantiate the preferences window and save a reference to it; if it 
    168  *       already exists, bring it to the front. 
    169  */ 
    170  
    171 ainspector.openPreferencesWindow = function () { 
    172   if (ainspector.preferencesWindow == null || ainspector.preferencesWindow.closed) { 
    173  
    174     var instantApply = Application.prefs.get("browser.preferences.instantApply"); 
    175     var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply.value ? ",dialog=no" : ",modal"); 
    176     ainspector.preferencesWindow = 
    177       window.openDialog('chrome://ai-sidebar/content/preferences/options.xul', "ainspector-preferences", features); 
    178   } 
    179   ainspector.preferencesWindow.focus(); 
    180 }; 
  • trunk/proto-08/chrome/content/preferences/options.js

    r64 r65  
    2222  var hasUserValues = ainspector.generalPrefs.hasUserValues(); 
    2323  var button = document.getElementById('ai-button-restore-general'); 
     24  if (button) button.disabled = !hasUserValues; 
     25}; 
     26 
     27/** 
     28 * @function setStatePrefpaneEvaluation 
     29 * 
     30 * @memberOf ainspector.options 
     31 * 
     32 * @desc Dynamically set the state of the Restore Defaults button. 
     33 */ 
     34 
     35ainspector.options.setStatePrefpaneEvaluation = function () { 
     36  var hasUserValues = ainspector.evaluationPrefs.hasUserValues(); 
     37  var button = document.getElementById('ai-button-restore-evaluation'); 
    2438  if (button) button.disabled = !hasUserValues; 
    2539}; 
     
    8296 
    8397/** 
     98 * @function initPrefpaneEvaluation 
     99 * 
     100 * @memberOf ainspector.options 
     101 * 
     102 * @desc Set state in Evaluation Preferences pane. 
     103 */ 
     104 
     105ainspector.options.initPrefpaneEvaluation = function () { 
     106 
     107  // Set state of "Restore Defaults" button 
     108  ainspector.options.setStatePrefpaneEvaluation(); 
     109}; 
     110 
     111/** 
    84112 * @function resetGeneralPrefs 
    85113 * 
     
    91119ainspector.options.resetGeneralPrefs = function () { 
    92120  var nls = ainspector.nlsProperties; 
    93   var title = nls.getString("pref.confirm.reset.title"); 
     121  var title = nls.getString("pref.confirm.resetGeneral.title"); 
    94122  var message = nls.getString("pref.confirm.reset.message"); 
    95123 
     
    99127  if (promptService.confirm(window, title, message)) { 
    100128    ainspector.resetGeneralPrefs(); 
     129  } 
     130}; 
     131 
     132/** 
     133 * @function resetEvaluationPrefs 
     134 * 
     135 * @memberOf ainspector.options 
     136 * 
     137 * @desc Reset all preferences in the evaluation branch to their default values. 
     138 */ 
     139 
     140ainspector.options.resetEvaluationPrefs = function () { 
     141  var nls = ainspector.nlsProperties; 
     142  var title = nls.getString("pref.confirm.resetEvaluation.title"); 
     143  var message = nls.getString("pref.confirm.reset.message"); 
     144 
     145  var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] 
     146                        .getService(Components.interfaces.nsIPromptService); 
     147 
     148  if (promptService.confirm(window, title, message)) { 
     149    ainspector.resetEvaluationPrefs(); 
    101150  } 
    102151}; 
     
    114163  // Set shared namespace variable to local callback for responding 
    115164  // to changes in this dialog. 
    116   ainspector.notifyOptionsGeneralPrefChange = ainspector.options.setStatePrefpaneGeneral; 
     165  ainspector.notifyOptionsGeneralPrefChange    = ainspector.options.setStatePrefpaneGeneral; 
     166  ainspector.notifyOptionsEvaluationPrefChange = ainspector.options.setStatePrefpaneEvaluation; 
    117167 
    118168  // Set shared namespace variable to reference this dialog window 
     
    132182 
    133183  // Set shared namespace callback variable to null when dialog is not open. 
    134   ainspector.notifyOptionsGeneralPrefChange = null; 
     184  ainspector.notifyOptionsGeneralPrefChange    = null; 
     185  ainspector.notifyOptionsEvaluationPrefChange = null; 
    135186}; 
    136187 
  • trunk/proto-08/chrome/content/preferences/options.xul

    r64 r65  
    88<prefwindow id="ainspector-preferences" 
    99  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
    10   width="330"> 
     10  style="width:24em;"> 
    1111 
    1212  <script src="options.js"/> 
  • trunk/proto-08/chrome/locale/en-US/ainspector.properties

    r56 r65  
    1717pref.label.shift.accel.win=Control+Shift 
    1818 
    19 pref.confirm.reset.title=Restore Defaults: Keyboard & Menu 
     19pref.confirm.resetGeneral.title=Restore Defaults: General 
     20pref.confirm.resetEvaluation.title=Restore Defaults: Evaluation 
    2021pref.confirm.reset.message=Reset these preferences to their default values? 
    2122 
  • trunk/proto-08/chrome/locale/en-US/options.dtd

    r63 r65  
    1717<!ENTITY button.label.restore "Restore Defaults"> 
    1818 
     19<!-- Evaluation preferences --> 
     20 
    1921<!ENTITY groupbox.caption.ruleset "Ruleset"> 
     22 
     23<!ENTITY label.ruleset.aria.strict "WCAG 2.0 ARIA Strict"> 
     24<!ENTITY label.ruleset.aria.transitional "WCAG 2.0 ARIA Transitional"> 
     25<!ENTITY label.enable.rec.rules "Enable recommended rules"> 
     26 
    2027<!ENTITY groupbox.caption.wcagLevel "WCAG 2.0 Success Criteria Level"> 
     28 
     29<!ENTITY label.wcag.level.aaa "A, AA, AAA (high)"> 
     30<!ENTITY label.wcag.level.aa  "A, AA (intermediate)"> 
     31<!ENTITY label.wcag.level.a   "A (low)"> 
     32 
    2133<!ENTITY groupbox.caption.resultFilters "Show Evaluation Results"> 
     34 
     35<!ENTITY label.show.page.mc "Page-level manual checks"> 
     36<!ENTITY label.show.elem.mc "Element-level manual checks"> 
     37<!ENTITY label.show.pass    "Pass"> 
     38<!ENTITY label.show.hidden  "Hidden"> 
     39 
    2240<!ENTITY groupbox.caption.otherOptions "Other Evaluation Options"> 
     41 
     42<!ENTITY label.page.layout  "Allow table markup for page layout"> 
     43<!ENTITY label.broken.links "Check for broken links"> 
Note: See TracChangeset for help on using the changeset viewer.