[Unicode]   Common Locale Data Repository : Bug Tracking Home | Site Map | Search
 

Changeset 4379


Ignore:
Timestamp:
10/23/09 17:26:36 (8 years ago)
Author:
srloomis
Message:

cldrbug 2132: update easy steps

Location:
trunk/tools/java/org/unicode/cldr/web
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/java/org/unicode/cldr/web/JspWebContext.java

    r4369 r4379  
    55 
    66import java.io.IOException; 
     7import java.util.HashSet; 
     8import java.util.Set; 
    79 
    810import javax.servlet.http.HttpServletRequest; 
     
    5759                return supplementalData; 
    5860        } 
     61         
     62        /** 
     63         * Is JSP debugging on? 
     64         * @return 
     65         */ 
     66        public boolean debugJsp() { 
     67                return this.prefBool(SurveyMain.PREF_DEBUGJSP); 
     68        } 
     69         
     70        /** 
     71         * Process data, without any hint. 
     72         * @return 
     73         */ 
     74        public SummarizingSubmissionResultHandler processDataSubmission() { 
     75                return processDataSubmission(null); 
     76        } 
     77         
     78        /** 
     79         * Process data. 
     80         * @param xpathHint 
     81         * @return 
     82         */ 
     83        public SummarizingSubmissionResultHandler processDataSubmission(String xpathHint) { 
     84                SummarizingSubmissionResultHandler ssrh  = null; 
     85                 
     86                String podBases = this.field("pod_bases", null); 
     87                if(podBases==null) { 
     88                        if(debugJsp()) { 
     89                                this.println("Submitting data for base "+xpathHint+"<br>"); 
     90                        } 
     91                        ssrh = SurveyForum.processDataSubmission(this, xpathHint, ssrh); 
     92                } else { 
     93                        for (String base : podBases.split(",")) { 
     94                                if(base!=null&&!base.isEmpty()) { 
     95                                        int xpathNumber = Integer.parseInt(base); 
     96                                        String xpath = sm.xpt.getById(xpathNumber); 
     97                                        if(debugJsp()) { 
     98                                                this.println("Submitting data for base "+xpathNumber+":"+xpath+"<br>"); 
     99                                        } 
     100                                        ssrh = SurveyForum.processDataSubmission(this, xpath, ssrh); 
     101                                } 
     102                        } 
     103                } 
     104                if(debugJsp()) { 
     105                        this.println(".. done submitting. SSRH:"+ssrh.toString()+"<br>"); 
     106                } 
     107                this.put("ssrh",ssrh); // TODO: move to constant or API 
     108                return ssrh; 
     109        } 
     110         
     111        Set<String> ourPodBases = null; 
     112         
     113        private void addPodBase(String base) { 
     114                if(ourPodBases==null) { 
     115                        ourPodBases =   new HashSet<String>(); 
     116                } 
     117                ourPodBases.add(base); 
     118//              if(false || debugJsp()) { 
     119//                      this.println("<tr><td>added base: "+base+"</td></tr>"); 
     120//              } 
     121        } 
     122         
     123        public void openTable() { 
     124                SurveyForum.printSectionTableOpenShort(this, null); 
     125        } 
     126        /** 
     127         * Show one xpath. 
     128         * @param xpath 
     129         */ 
     130        public void showXpath(String xpath) { 
     131                String podBase = SurveyForum.showXpathShort(this, xpath, xpath); 
     132                addPodBase(podBase); 
     133        } 
     134        /** 
     135         * Convenience: show xpaths from an array 
     136         * @param xpaths 
     137         */ 
     138        public void showXpath(String[] xpaths) { 
     139                for(String xpath : xpaths) { 
     140                        showXpath(xpath); 
     141                } 
     142        } 
     143        /** 
     144         * End of the table. 
     145         */ 
     146        public void closeTable() { 
     147                SurveyForum.printSectionTableCloseShort(this, null); 
     148        } 
     149        /** 
     150         * Important for mixed-xpath pages. Notify the server which xpaths to check on. 
     151         */ 
     152        public void doneWithXpaths() { 
     153                StringBuffer sb = null; 
     154                for(String base : ourPodBases) { 
     155                        int xpath = sm.xpt.getByXpath(base); 
     156                        if(sb==null) { 
     157                                sb = new StringBuffer(Integer.toString(xpath)); 
     158                        } else { 
     159                                sb.append(','); 
     160                                sb.append(Integer.toString(xpath)); 
     161                        } 
     162                } 
     163                if(debugJsp()) { 
     164                        this.println("Submitting hidden field for bases: "+sb+"<br>"); 
     165                } 
     166                this.println("<input name='pod_bases' type='hidden' value='"+sb+"'>"); 
     167        } 
    59168} 
  • trunk/tools/java/org/unicode/cldr/web/SurveyForum.java

    r4155 r4379  
    548548     } 
    549549     
    550     public static void showXpath(WebContext baseCtx, String section_xpath, int item_xpath) { 
     550    public static String showXpath(WebContext baseCtx, String section_xpath, int item_xpath) { 
    551551        String base_xpath = section_xpath; 
    552552        CLDRLocale loc = baseCtx.getLocale(); 
     
    576576         
    577577//        ctx.printHelpHtml(section, item_xpath); 
     578        return podBase; 
    578579    } 
    579580 
     
    585586     */ 
    586587    public static SummarizingSubmissionResultHandler processDataSubmission(WebContext ctx, String baseXpath) { 
    587         SummarizingSubmissionResultHandler ssrh = new SummarizingSubmissionResultHandler(); 
     588        return processDataSubmission(ctx,baseXpath,null); 
     589    } 
     590    /** 
     591     *  
     592     * @param ctx 
     593     * @param baseXpath 
     594     * @param ssrh ResultHandler, if null one will be created. 
     595     * @return true if no errors were detected, otherwise false. 
     596     */ 
     597    public static SummarizingSubmissionResultHandler processDataSubmission(WebContext ctx, String baseXpath, SummarizingSubmissionResultHandler ssrh) { 
     598        if(ssrh == null) { 
     599                ssrh = new SummarizingSubmissionResultHandler(); 
     600        } 
    588601        ctx.sm.vet.processPodChanges(ctx, DataSection.xpathToSectionBase(baseXpath), ssrh); 
    589602        return ssrh; 
     
    613626     
    614627    public static void printSectionTableOpenShort(WebContext ctx, String base_xpath) { 
    615         String podBase = DataSection.xpathToSectionBase(base_xpath); 
    616         DataSection section = ctx.getSection(podBase);    
    617         SurveyMain.printSectionTableOpenShort(ctx, section); 
     628        DataSection section = null; 
     629        if(base_xpath != null) { 
     630                String podBase = DataSection.xpathToSectionBase(base_xpath); 
     631                section = ctx.getSection(podBase);    
     632        } 
     633        SurveyMain.printSectionTableOpenShort(ctx, section); 
    618634    } 
    619635     
    620636    public static void printSectionTableCloseShort(WebContext ctx,String base_xpath) { 
    621         String podBase = DataSection.xpathToSectionBase(base_xpath);         
    622         DataSection section = ctx.getSection(podBase); 
     637        DataSection section = null; 
     638        if(base_xpath != null) { 
     639                String podBase = DataSection.xpathToSectionBase(base_xpath); 
     640                section = ctx.getSection(podBase);    
     641        } 
    623642        ctx.sm.printSectionTableClose(ctx, section); 
    624643    } 
    625644     
    626     public static void showXpathShort(WebContext baseCtx, String section_xpath, int item_xpath) { 
     645    /** 
     646     * @param baseCtx 
     647     * @param section_xpath 
     648     * @param item_xpath 
     649     * @return pod base used  
     650     */ 
     651    public static String showXpathShort(WebContext baseCtx, String section_xpath, int item_xpath) { 
    627652        String base_xpath = section_xpath; 
    628653        CLDRLocale loc = baseCtx.getLocale(); 
     
    636661        DataSection section = ctx.getSection(podBase); 
    637662        baseCtx.sm.showPeasShort(ctx, section, item_xpath); 
    638     } 
    639  
    640     public static void showXpathShort(WebContext baseCtx, String section_xpath, String item_xpath) { 
    641         showXpathShort(baseCtx, section_xpath, baseCtx.sm.xpt.getByXpath(item_xpath)); 
    642     } 
    643  
    644     public static void showXpathShort(WebContext baseCtx, String item_xpath) { 
     663        return podBase; 
     664    } 
     665 
     666    public static String showXpathShort(WebContext baseCtx, String section_xpath, String item_xpath) { 
     667        return showXpathShort(baseCtx, section_xpath, baseCtx.sm.xpt.getByXpath(item_xpath)); 
     668    } 
     669 
     670    public static String showXpathShort(WebContext baseCtx, String item_xpath) { 
    645671        String section_xpath = DataSection.xpathToSectionBase(item_xpath); 
    646         showXpathShort(baseCtx, section_xpath, baseCtx.sm.xpt.getByXpath(item_xpath)); 
    647     } 
    648  
    649     public static void showXpath(WebContext baseCtx, String section_xpath, String item_xpath) { 
    650         showXpath(baseCtx, section_xpath, baseCtx.sm.xpt.getByXpath(item_xpath)); 
     672        return showXpathShort(baseCtx, section_xpath, baseCtx.sm.xpt.getByXpath(item_xpath)); 
     673    } 
     674 
     675    public static String showXpath(WebContext baseCtx, String section_xpath, String item_xpath) { 
     676        return showXpath(baseCtx, section_xpath, baseCtx.sm.xpt.getByXpath(item_xpath)); 
    651677    } 
    652678     
  • trunk/tools/java/org/unicode/cldr/web/SurveyMain.java

    r4353 r4379  
    258258    static final String PREF_ADV = "p_adv"; // show advanced prefs? 
    259259    static final String PREF_XPATHS = "p_xpaths"; // show xpaths? 
     260    public static final String PREF_DEBUGJSP = "p_debugjsp"; // debug JSPs? 
    260261    public static final String PREF_COVLEV = "p_covlev"; // covlev 
    261262    public static final String PREF_COVTYP = "p_covtyp"; // covtyp 
     
    37793780    } 
    37803781 
    3781     boolean showTogglePref(WebContext ctx, String pref, String what) { 
     3782    /**  
     3783     * Show a toggleable preference 
     3784     * @param ctx 
     3785     * @param pref which preference 
     3786     * @param what description of preference 
     3787     * @return 
     3788     */ 
     3789    public boolean showTogglePref(WebContext ctx, String pref, String what) { 
    37823790        boolean val = ctx.prefBool(pref); 
    37833791        WebContext nuCtx = (WebContext)ctx.clone(); 
     
    37933801        return val; 
    37943802    } 
     3803     
    37953804    String showListPref(WebContext ctx, String pref, String what, String[] list) { 
    37963805        return showListPref(ctx,pref,what,list,false); 
     
    65906599    } 
    65916600 
     6601    /** 
     6602     * section may be null. 
     6603     * @param ctx 
     6604     * @param section 
     6605     */ 
    65926606    static void printSectionTableOpenShort(WebContext ctx, DataSection section) { 
    65936607        ctx.println("<a name='st_data'></a>"); 
    6594         ctx.println("<table summary='Data Items for "+ctx.getLocale().toString()+" " + section.xpathPrefix + "' class='data' border='1'>"); 
     6608        ctx.print("<table "); 
     6609        if(section != null) { 
     6610                ctx.print(" summary='Data Items for "+ctx.getLocale().toString()+" " + section.xpathPrefix + "' "); 
     6611        } 
     6612        ctx.println("class='data' border='1'>"); 
    65956613            ctx.println("<tr class='headingb'>\n"+ 
    65966614                        " <th colspan='1' width='50%'>"+BASELINE_NAME+"</th>\n"+              // 3 
     
    66006618    } 
    66016619 
     6620    /** 
     6621     * Section may be null. 
     6622     * @param ctx 
     6623     * @param section 
     6624     */ 
    66026625    void printSectionTableClose(WebContext ctx, DataSection section) { 
    66036626        List<String> refsList = (List<String>) ctx.temporaryStuff.get("references"); 
    6604         if((refsList != null) && (!refsList.isEmpty())) { 
     6627        if(section!=null && (refsList != null) && (!refsList.isEmpty())) { 
    66056628            ctx.println("<tr></tr>"); 
    66066629            ctx.println("<tr class='heading'><th class='partsection' align='left' colspan='"+PODTABLE_WIDTH+"'>References</th></tr>"); 
  • trunk/tools/java/org/unicode/cldr/web/data/root/tmpl/new.jsp

    r4372 r4379  
    1     <%@ include file="report_top.jspf" %> 
     1<%@ include file="report_top.jspf" %> 
    22 
    33<%@ page import="com.ibm.icu.util.Currency" %> 
     
    66<h2>New items for 1.8, or cases where the English has changed</h2> 
    77<% 
     8 
    89//  Copy "x=___"  from input to output URL 
    910subCtx.setQuery(SurveyMain.QUERY_SECTION,subCtx.field(SurveyMain.QUERY_SECTION)); 
    1011 
    1112%><p>The first set are new territories. All of these should be translated.</p><% 
     13 
     14 
     15subCtx.openTable();  
     16 
     17             // (OPTIONAL array notation)   
     18subCtx.showXpath(new String[]  
     19                 {"//ldml/localeDisplayNames/territories/territory[@type=\"AC\"]", 
     20                                  "//ldml/localeDisplayNames/territories/territory[@type=\"CP\"]", 
     21                                  "//ldml/localeDisplayNames/territories/territory[@type=\"DG\"]", 
     22                                  "//ldml/localeDisplayNames/territories/territory[@type=\"EA\"]", 
     23                                  "//ldml/localeDisplayNames/territories/territory[@type=\"IC\"]", 
     24                                  "//ldml/localeDisplayNames/territories/territory[@type=\"TA\"]"}); 
     25 
     26subCtx.closeTable(); 
     27 
     28 
     29              
     30%><p>The following have alternative values or newly modified English. All of these should be translated.</p><% 
     31 
    1232SurveyForum.printSectionTableOpenShort(subCtx, thisBaseXpath); 
    1333 
    14 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"AC\"]"); 
    15 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CP\"]"); 
    16 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"DG\"]"); 
    17 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"EA\"]"); 
    18 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"IC\"]"); 
    19 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"TA\"]"); 
     34subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"MM\"]"); 
     35subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"PS\"]"); 
    2036 
    21 SurveyForum.printSectionTableCloseShort(subCtx, thisBaseXpath); 
    22 %><p>The following have alternative values or newly modified English. All of these should be translated.</p><% 
    23 SurveyForum.printSectionTableOpenShort(subCtx, thisBaseXpath); 
     37subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"CD\"]"); 
     38subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"CD\"][@alt=\"variant\"]"); 
     39subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"CG\"]"); 
     40subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"CG\"][@alt=\"variant\"]"); 
     41subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"CI\"]"); 
     42subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"CI\"][@alt=\"variant\"]"); 
     43subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"FK\"]"); 
     44subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"FK\"][@alt=\"variant\"]"); 
     45subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"HK\"][@alt=\"short\"]"); 
     46subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"HK\"]"); 
     47subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"MK\"]"); 
     48subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"MK\"][@alt=\"variant\"]"); 
     49subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"MO\"][@alt=\"short\"]"); 
     50subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"MO\"]"); 
     51subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"TL\"]"); 
     52subCtx.showXpath("//ldml/localeDisplayNames/territories/territory[@type=\"TL\"][@alt=\"variant\"]"); 
    2453 
    25 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"MM\"]"); 
    26 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"PS\"]"); 
     54subCtx.closeTable(); 
     55%><p>The following are new cases of language or language variants. Translating these is optional but recommended.</p><% 
    2756 
    28 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CD\"]"); 
    29 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CD\"][@alt=\"variant\"]"); 
    30 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CG\"]"); 
    31 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CG\"][@alt=\"variant\"]"); 
    32 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CI\"]"); 
    33 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"CI\"][@alt=\"variant\"]"); 
    34 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"FK\"]"); 
    35 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"FK\"][@alt=\"variant\"]"); 
    36 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"HK\"][@alt=\"short\"]"); 
    37 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"HK\"]"); 
    38 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"MK\"]"); 
    39 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"MK\"][@alt=\"variant\"]"); 
    40 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"MO\"][@alt=\"short\"]"); 
    41 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"MO\"]"); 
    42 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"TL\"]"); 
    43 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/territories/territory[@type=\"TL\"][@alt=\"variant\"]"); 
     57subCtx.openTable();  
    4458 
    45 SurveyForum.printSectionTableCloseShort(subCtx, thisBaseXpath); 
    46 %><p>The following are new cases of language or language variants. Translating these is optional but recommended.</p><% 
    47 SurveyForum.printSectionTableOpenShort(subCtx, thisBaseXpath); 
     59subCtx.showXpath("//ldml/localeDisplayNames/languages/language[@type=\"yue\"]"); 
     60subCtx.showXpath("//ldml/localeDisplayNames/languages/language[@type=\"swb\"]"); 
     61             
     62subCtx.showXpath("//ldml/localeDisplayNames/variants/variant[@type=\"PINYIN\"]"); 
     63subCtx.showXpath("//ldml/localeDisplayNames/variants/variant[@type=\"WADEGILE\"]"); 
    4864 
    49 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/languages/language[@type=\"yue\"]"); 
    50 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/languages/language[@type=\"swb\"]"); 
    51              
    52 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/variants/variant[@type=\"PINYIN\"]"); 
    53 SurveyForum.showXpathShort(subCtx, "//ldml/localeDisplayNames/variants/variant[@type=\"WADEGILE\"]"); 
     65subCtx.closeTable(); 
    5466 
    55 SurveyForum.printSectionTableCloseShort(subCtx, thisBaseXpath); 
     67subCtx.doneWithXpaths(); // print hidden field notifying which bases to accept submission for.  
     68 
    5669%> 
  • trunk/tools/java/org/unicode/cldr/web/data/root/tmpl/r_steps.jsp

    r4355 r4379  
    3636         
    3737        if(baseXpathForOldStage!=null) {  // handle submit of old data? 
     38                if(ctx.debugJsp()) { 
    3839                        %>  <h2>Processing data for xpath <%= baseXpathForOldStage %>  </h2>   <% 
    39                          
     40                } 
     41 
    4042                // process the submission. ssrh contains detailed results. 
    41                 ssrh = SurveyForum.processDataSubmission(ctx, baseXpathForOldStage); 
    42                 ctx.put("ssrh",ssrh); // TODO: move to constant or API 
     43                ssrh = ctx.processDataSubmission(baseXpathForOldStage); 
    4344                moveForward = !ssrh.hadErrors(); // move forward if no errors. 
    4445                if(moveForward == false) { 
  • trunk/tools/java/org/unicode/cldr/web/data/root/tmpl/report_menu.jsp

    r4154 r4379  
    1414<% 
    1515        /* } */   // uncomment to restrict to logged in users 
     16 
     17        { 
     18                // Show the 'JSP debug' menu when on a jsp section. 
     19                String section=subCtx.field(SurveyMain.QUERY_SECTION); 
     20                if(section!=null&&section.startsWith("r_")) { 
     21                        %><%@ include file="debug_jsp.jspf" %><% 
     22                } 
     23        } 
    1624%> 
  • trunk/tools/java/org/unicode/cldr/web/data/root/tmpl/report_top.jspf

    r4152 r4379  
    22<%@ include file="stcontext.jspf" %> 
    33<% 
    4 WebContext subCtx = ctx; 
     4JspWebContext subCtx = ctx; 
    55String thisBaseXpath = (String)ctx.get("thisBaseXpath"); 
    66Integer thisStep = (Integer)ctx.get("thisStep"); 
  • trunk/tools/java/org/unicode/cldr/web/data/root/tmpl/stcontext.jspf

    r4369 r4379  
    1313    Boolean zoomedIn = (Boolean)ctx.get(WebContext.ZOOMED_IN); 
    1414    Boolean canModify = (Boolean)ctx.get(WebContext.CAN_MODIFY); 
     15     
    1516%> 
Note: See TracChangeset for help on using the changeset viewer.