Changeset 1003 for trunk


Ignore:
Timestamp:
05/16/08 18:04:41 (11 years ago)
Author:
douglas
Message:

Ticket #1213 partial rollback of duplicated code...

Location:
trunk/plugins/UnsavedChanges
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/UnsavedChanges/lang/es.js

    r1002 r1003  
    44  "You have unsaved changes in the editor": "Usted no ha guardado sus modificaciones" 
    55}; 
    6 // I18N constants 
    7 // LANG: "es", ENCODING: UTF-8 
    8 { 
    9   "You have unsaved changes in the editor": "Usted no ha guardado sus modificaciones" 
    10 }; 
  • trunk/plugins/UnsavedChanges/lang/fr.js

    r1002 r1003  
    44  "You have unsaved changes in the editor": "Vous n'avez pas enregistré vos modifications" 
    55}; 
    6 // I18N constants 
    7 // LANG: "fr", ENCODING: UTF-8 
    8 { 
    9   "You have unsaved changes in the editor": "Vous n'avez pas enregistré vos modifications" 
    10 }; 
  • trunk/plugins/UnsavedChanges/lang/fr_ca.js

    r1002 r1003  
    44  "You have unsaved changes in the editor": "Tu n'as pas enregistré tes modifications" 
    55}; 
    6 // I18N constants 
    7 // LANG: "fr_ca", ENCODING: UTF-8 
    8 { 
    9   "You have unsaved changes in the editor": "Tu n'as pas enregistré tes modifications" 
    10 }; 
  • trunk/plugins/UnsavedChanges/unsaved-changes.js

    r1002 r1003  
    5454    license:'LGPL' 
    5555} 
    56  
    57 function UnsavedChanges(editor) { 
    58     // Keep a copy of the editor to perform any necessary functions 
    59     var editor = editor; 
    60  
    61     // Private variable for storing the unmodified contents.  This is necessary 
    62     // because whenDocReady needs a closure to reference this object. 
    63     var defaultValue; 
    64  
    65     // Variable to allow the protector to be bypassed in the case of submit. 
    66     var bypass = false; 
    67  
    68     var protector = function(event) { 
    69         if (bypass) { 
    70             return; 
    71         } 
    72  
    73         if (defaultValue != editor.getEditorContent()) { 
    74             // This needs to use _lc for multiple languages 
    75             var dirty_prompt = Xinha._lc('You have unsaved changes in the editor', 'UnsavedChanges'); 
    76             event.returnValue = dirty_prompt; 
    77             return dirty_prompt; 
    78         } 
    79     } 
    80  
    81     this.onBeforeSubmit = function() { 
    82         bypass = true; 
    83     } 
    84  
    85     // Setup to be called when the plugin is loaded. 
    86     // We need a copy of the initial content for detection to work properly, so 
    87     // we will setup a callback for when the document is ready to store an 
    88     // unmodified copy of the content. 
    89     this.onGenerate = function() { 
    90         editor.whenDocReady(function () { 
    91             // Copy the original, unmodified contents to check for changes 
    92             defaultValue = defaultValue || editor.getEditorContent(); 
    93  
    94             // Set up the blocker 
    95             Xinha._addEvent(window, 'beforeunload', protector); 
    96         }); 
    97     } 
    98  
    99 } 
    100  
    101 // An object containing metadata for this plugin 
    102 UnsavedChanges._pluginInfo = { 
    103     name:'UnsavedChanges', 
    104     version:'3.7', 
    105     developer:'Douglas Mayle', 
    106     developer_url:'http://douglas.mayle.org', 
    107     c_owner:'Douglas Mayle', 
    108     sponsor:'The Open Planning Project', 
    109     sponsor_url:'http://topp.openplans.org', 
    110     license:'LGPL' 
    111 } 
    112  
Note: See TracChangeset for help on using the changeset viewer.