Changeset 2223


Ignore:
Timestamp:
07/15/08 12:48:20 (6 years ago)
Author:
mosipov
Message:

ASSIGNED - #2361: Provide interface for locale resolution

Location:
FCKeditor.Java/trunk/java-core/src/main
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/ConnectorServlet.java

    r2217 r2223  
    3434import net.fckeditor.handlers.ConnectorHandler; 
    3535import net.fckeditor.handlers.ExtensionsHandler; 
     36import net.fckeditor.handlers.LocaleResolverHandler; 
    3637import net.fckeditor.handlers.RequestCycleHandler; 
    3738import net.fckeditor.handlers.ResourceTypeHandler; 
     
    115116 
    116117                XmlResponse xr; 
     118                LocaleResolverHandler lrh = new LocaleResolverHandler(request); 
    117119 
    118120                if (!RequestCycleHandler.isEnabledForFileBrowsing(request)) 
    119                         xr = new XmlResponse(XmlResponse.EN_ERROR, Messages.NOT_AUTHORIZED_FOR_BROWSING); 
     121                        xr = new XmlResponse(XmlResponse.EN_ERROR, lrh.getString("message.connector.fileBrowsing.disabled")); 
    120122                else if (!CommandHandler.isValidForGet(commandStr)) 
    121                         xr = new XmlResponse(XmlResponse.EN_ERROR, Messages.INVALID_COMMAND); 
     123                        xr = new XmlResponse(XmlResponse.EN_ERROR, lrh.getString("message.connector.invalid_command_specified")); 
    122124                else if (typeStr != null && !ResourceTypeHandler.isValid(typeStr)) 
    123                         xr = new XmlResponse(XmlResponse.EN_ERROR, Messages.INVALID_TYPE); 
     125                        xr = new XmlResponse(XmlResponse.EN_ERROR, lrh.getString("message.connector.invalid_type_specified")); 
    124126                else if (!UtilsFile.isValidPath(currentFolderStr)) 
    125                         xr = new XmlResponse(XmlResponse.EN_ERROR, Messages.INVALID_CURRENT_FOLDER); 
     127                        xr = new XmlResponse(XmlResponse.EN_ERROR, lrh.getString("message.connector.invalid_current_folder_speficied")); 
    126128                else { 
    127129                        CommandHandler command = CommandHandler.getCommand(commandStr); 
     
    206208 
    207209                UploadResponse ur; 
     210                LocaleResolverHandler lrh = new LocaleResolverHandler(request); 
    208211 
    209212                // if this is a QuickUpload request, 'commandStr' and 'currentFolderStr' 
     
    216219                if (!RequestCycleHandler.isEnabledForFileUpload(request)) 
    217220                        ur = new UploadResponse(UploadResponse.SC_SECURITY_ERROR, null, null, 
    218                                 Messages.NOT_AUTHORIZED_FOR_UPLOAD); 
     221                                lrh.getString("message.connector.fileUpload.disabled")); 
    219222                else if (!CommandHandler.isValidForPost(commandStr)) 
    220                         ur = new UploadResponse(UploadResponse.SC_ERROR, null, null, Messages.INVALID_COMMAND); 
     223                        ur = new UploadResponse(UploadResponse.SC_ERROR, null, null, lrh.getString("message.connector.invalid_command_specified")); 
    221224                else if (typeStr != null && !ResourceTypeHandler.isValid(typeStr)) 
    222                         ur = new UploadResponse(UploadResponse.SC_ERROR, null, null, Messages.INVALID_TYPE); 
     225                        ur = new UploadResponse(UploadResponse.SC_ERROR, null, null, lrh.getString("message.connector.invalid_type_specified")); 
    223226                else if (!UtilsFile.isValidPath(currentFolderStr)) 
    224                         ur = UploadResponse.UR_INVALID_CURRENT_FOLDER; 
     227                        ur = new UploadResponse(UploadResponse.SC_ERROR, null, null, 
     228                                        lrh.getString("message.connector.invalid_current_folder_speficied")); 
    225229                else { 
    226230                        ResourceTypeHandler resourceType = ResourceTypeHandler.getDefaultResourceType(typeStr); 
     
    235239 
    236240                        if (!currentDir.exists()) 
    237                                 ur = UploadResponse.UR_INVALID_CURRENT_FOLDER; 
     241                                ur = new UploadResponse(UploadResponse.SC_ERROR, null, null, 
     242                                                lrh.getString("message.connector.invalid_current_folder_speficied")); 
    238243                        else { 
    239244 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/localization/impl/JstlResolver.java

    r2217 r2223  
    1212        public Locale resolveLocale(HttpServletRequest request) { 
    1313                 
    14                 // TODO need to check locale is null? 
    1514                return (Locale) Config.get(request.getSession(), Config.FMT_LOCALE); 
    1615        } 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java

    r2151 r2223  
    2121package net.fckeditor.response; 
    2222 
    23 import net.fckeditor.connector.Messages; 
    2423import net.fckeditor.tool.Utils; 
    2524 
     
    6463        public static final int SC_SECURITY_ERROR = 203; 
    6564         
    66         /** UploadResponse INVALID CURRENT FOLDER */ 
    67         public static final UploadResponse UR_INVALID_CURRENT_FOLDER = new UploadResponse( 
    68                         UploadResponse.SC_ERROR, null, null, 
    69                         Messages.INVALID_CURRENT_FOLDER); 
    70  
    7165        /** 
    7266         * Constructs the response with variable amount of parameters. 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tags/CheckTag.java

    r2151 r2223  
    3131import javax.servlet.jsp.tagext.TagSupport; 
    3232 
    33 import net.fckeditor.handlers.PropertiesLoader; 
     33import net.fckeditor.handlers.LocaleResolverHandler; 
    3434import net.fckeditor.handlers.RequestCycleHandler; 
    3535import net.fckeditor.tool.Compatibility; 
    3636 
    3737/** 
     38 * TODO Rework JavaDoc when ticket #2361 
    3839 * This tag displays information about browser and user capabilities. There are 
    3940 * tree available commands (CompatibleBrowser, FileBrowsing, FileUpload) which 
     
    5051        private static final String FILE_BROWSING = "FileBrowsing"; 
    5152        private static final String COMPATIBLE_BROWSER = "CompatibleBrowser"; 
    52         private static final String PROPERTY_MESSAGE_FILE_BROWSING_DISABLED = "message.enabled_tag.connector.file_browsing.disabled"; 
    53         private static final String PROPERTY_MESSAGE_FILE_BROWSING_ENABLED = "message.enabled_tag.connector.file_browsing.enabled"; 
    54         private static final String PROPERTY_MESSAGE_FILE_UPLOAD_DISABLED = "message.enabled_tag.connector.file_upload.disalbed"; 
    55         private static final String PROPERTY_MESSAGE_FILE_UPLOAD_ENABLED = "message.enabled_tag.connector.file_upload.enabled"; 
    56         private static final String PROPERTY_MESSAGE_NOT_COMPATIBLE_BROWSER = "message.enabled_tag.compatible_browser.no"; 
    57         private static final String PROPERTY_MESSAGE_COMPATIBLE_BROWSER = "message.enabled_tag.compatible_browser.yes"; 
    5853        private static Set<String> commands = new HashSet<String>(3); 
    5954 
     
    8378 
    8479                HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); 
     80                LocaleResolverHandler lrh = new LocaleResolverHandler(request); 
    8581                String response = null; 
    8682 
    8783                if (command.equals(FILE_UPLOAD)) { 
    8884                        if (RequestCycleHandler.isEnabledForFileUpload(request)) 
    89                                 response = PropertiesLoader 
    90                                         .getProperty(CheckTag.PROPERTY_MESSAGE_FILE_UPLOAD_ENABLED); 
     85                                response = lrh.getString("message.connector.fileUpload.enabled"); 
    9186                        else 
    92                                 response = PropertiesLoader 
    93                                         .getProperty(CheckTag.PROPERTY_MESSAGE_FILE_UPLOAD_DISABLED); 
     87                                response = lrh.getString("message.connector.fileUpload.disabled"); 
    9488                } 
    9589 
    9690                if (command.equals(FILE_BROWSING)) { 
    9791                        if (RequestCycleHandler.isEnabledForFileBrowsing(request)) 
    98                                 response = PropertiesLoader 
    99                                         .getProperty(CheckTag.PROPERTY_MESSAGE_FILE_BROWSING_ENABLED); 
     92                                response = lrh.getString("message.connector.fileBrowsing.enabled"); 
    10093                        else 
    101                                 response = PropertiesLoader 
    102                                         .getProperty(CheckTag.PROPERTY_MESSAGE_FILE_BROWSING_DISABLED); 
     94                                response = lrh.getString("message.connector.fileBrowsing.disabled"); 
    10395                } 
    10496                if (command.equals(COMPATIBLE_BROWSER)) { 
    10597                        if (Compatibility.isCompatibleBrowser(request)) 
    106                                 response = PropertiesLoader 
    107                                         .getProperty(CheckTag.PROPERTY_MESSAGE_COMPATIBLE_BROWSER); 
     98                                response = lrh.getString("message.compatible_browser.yes"); 
    10899                        else 
    109                                 response = PropertiesLoader 
    110                                         .getProperty(CheckTag.PROPERTY_MESSAGE_NOT_COMPATIBLE_BROWSER); 
     100                                response = lrh.getString("message.compatible_browser.no"); 
    111101                } 
    112102 
  • FCKeditor.Java/trunk/java-core/src/main/resources/net/fckeditor/handlers/default.properties

    r1632 r2223  
    6161fckeditor.width = 100% 
    6262 
    63 # some messages 
    64 message.enabled_tag.compatible_browser.no = Your browser is not compatible 
    65 message.enabled_tag.compatible_browser.yes = Your browser is fully compatible 
    66 message.enabled_tag.connector.file_browsing.disabled = The Connector is disabled for FileBrowsing 
    67 message.enabled_tag.connector.file_browsing.enabled = The Connector is enabled for FileBrowsing 
    68 message.enabled_tag.connector.file_upload.disabled = The Connector is disabled for FileUpload 
    69 message.enabled_tag.connector.file_upload.enabled = The Connector is enabled for FileUpload 
     63# default LocaleResolver implementation 
     64localization.localeResolverImpl = net.fckeditor.localization.impl.AcceptLanguageHeaderResolver 
     65 
     66# default messages (localizable) 
     67message.compatible_browser.no = Your browser is not compatible 
     68message.compatible_browser.yes = Your browser is fully compatible 
     69 
     70message.connector.fileUpload.disabled = You are not authorized to upload files! 
     71message.connector.fileUpload.enabled = You are authorized to upload files! 
     72message.connector.fileBrowsing.disabled = You are not authorized to browse files! 
     73message.connector.fileBrowsing.enabled = You are authorized to browse files! 
     74message.connector.invalid_command_specified = Invalid command specified 
     75message.connector.invalid_type_specified = Invalid resource type specified 
     76message.connector.invalid_current_folder_speficied = Invalid current folder specified 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy