Changeset 245

Show
Ignore:
Timestamp:
01/02/08 20:53:22 (1 year ago)
Author:
chris
Message:

Fix restricted access to individual clauses.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lex/trunk/jsp/navclause.jsp

    r236 r245  
    8282                                if (min_m < new_min_m) min_m = new_min_m; 
    8383                                if (max_m > new_max_m) max_m = new_max_m; 
     84                                // System.out.println("book restricts to " + min_m + "-" + max_m); 
    8485                        } 
    8586                                 
     
    119120        try  
    120121        { 
    121                 int newChapNum = Integer.parseInt(request.getParameter("chapter")); 
    122                 selChapNum = newChapNum; 
     122                selChapNum = Integer.parseInt(request.getParameter("chapter")); 
    123123        }  
    124124        catch (Exception e) { /* ignore it and use default chapter */ } 
     
    172172                                if (min_m < new_min_m) min_m = new_min_m; 
    173173                                if (max_m > new_max_m) max_m = new_max_m; 
     174                                // System.out.println("chapter restricts to " + min_m + "-" + max_m); 
    174175                        } 
    175176                         
     
    205206        try 
    206207        {  
    207                 int newVerseNum = Integer.parseInt(request.getParameter("verse"));  
    208                 selVerseNum = newVerseNum; 
     208                selVerseNum = Integer.parseInt(request.getParameter("verse"));  
    209209        } 
    210210        catch (Exception e) { /* ignore it and use default chapter */ } 
     
    213213                boolean foundVerse = false; 
    214214         
    215                 Sheaf sheaf = emdros.getSheaf 
    216                 ( 
    217                         "SELECT ALL OBJECTS IN " + 
     215                FlatSheaf sheaf = emdros.getFlatSheaf 
     216                ( 
     217                        "GET OBJECTS HAVING MONADS IN " + 
    218218                        emdros.intersect(userTextAccessSet, min_m, max_m) + 
    219                         " WHERE [verse "+ 
    220                         "        book    = "+selBook+" AND "+ 
    221                         "        chapter = "+selChapNum+ 
    222                         "        GET verse, verse_label]" 
    223                 ); 
    224  
    225                 SheafConstIterator sci = sheaf.const_iterator(); 
    226                 while (sci.hasNext()) { 
    227                         Straw straw = sci.next(); 
    228                         MatchedObject verse = straw.const_iterator().next(); 
     219                        "[verse GET verse, verse_label]" 
     220                ); 
     221 
     222                FlatStrawConstIterator sci =  
     223                        sheaf.const_iterator().next().const_iterator(); 
     224                         
     225                while (sci.hasNext()) 
     226                { 
     227                        MatchedObject verse = sci.next(); 
    229228                         
    230229                        int thisVerseNum = verse.getEMdFValue("verse").getInt(); 
     
    236235                                min_m = som.first(); 
    237236                                max_m = som.last(); 
     237                                // System.out.println("verse restricts to " + min_m + "-" + max_m); 
    238238                        } 
    239239                                                         
    240240                        %> 
    241                         <option value=<%= 
     241                        <option value="<%= 
    242242                                thisVerseNum 
    243                         %><%= 
    244                                 thisVerseNum == selVerseNum ? " SELECTED" : "" 
     243                        %>"<%= 
     244                                thisVerseNum == selVerseNum ? " selected=\"selected\"" : "" 
    245245                        %>><%= 
    246246                                verse.getEMdFValue("verse_label").getString() 
    247                         %><
     247                        %></option><
    248248                } 
    249249                 
     
    269269        } 
    270270         
    271         try {  
    272                 int newClauseId = Integer.parseInt(request.getParameter("clause")); 
    273                 selClauseId = newClauseId; 
    274         } catch (Exception e) { /* ignore it and use default chapter */ } 
     271        try 
     272        {  
     273                selClauseId = Integer.parseInt(request.getParameter("clause")); 
     274        } 
     275        catch (Exception e) { /* ignore it and use default chapter */ } 
    275276         
    276277        MatchedObject verse = null; 
     
    285286                        "SELECT ALL OBJECTS IN " + 
    286287                        emdros.intersect(userTextAccessSet, min_m, max_m) + 
    287                         " WHERE [verse "+ 
    288                         "       book    = "+selBook+" AND "+ 
    289                         "       chapter = "+selChapNum+" AND "+ 
    290                         "       verse   = "+selVerseNum+ 
    291                         "       GET bart_gloss "+ 
    292                         "       [clause "+ 
    293                         "        [word GET phrase_dependent_part_of_speech, " + 
    294             "         graphical_preformative, " + 
    295             "         graphical_root_formation, " + 
    296             "         graphical_lexeme, " + 
    297             "         graphical_verbal_ending, " + 
    298             "         graphical_nominal_ending, " + 
    299             "         graphical_pron_suffix]" + 
    300                         "       ]"+ 
    301                         "      ]"); 
     288                        " WHERE " + 
     289                        "[clause "+ 
     290                        " [word GET phrase_dependent_part_of_speech, " + 
     291            "  graphical_preformative, " + 
     292            "  graphical_root_formation, " + 
     293            "  graphical_lexeme, " + 
     294            "  graphical_verbal_ending, " + 
     295            "  graphical_nominal_ending, " + 
     296            "  graphical_pron_suffix" + 
     297                        " ]"+ 
     298                        "]"); 
    302299                          
    303                 SheafConstIterator sci = sheaf.const_iterator(); 
    304                 while (sci.hasNext()) { 
    305                         Straw straw = sci.next(); 
    306                         verse = straw.const_iterator().next(); 
    307                          
    308                         SheafConstIterator clause_iter = 
    309                                 verse.getSheaf().const_iterator(); 
     300                SheafConstIterator clause_iter = 
     301                        sheaf.const_iterator(); 
    310302                                 
    311                         while (clause_iter.hasNext()) { 
    312                                 MatchedObject clause = 
    313                                         clause_iter.next().const_iterator().next(); 
    314  
    315                                 String lexemes = ""; 
     303                while (clause_iter.hasNext()) 
     304                { 
     305                        MatchedObject clause = 
     306                                clause_iter.next().const_iterator().next(); 
     307 
     308                        String lexemes = ""; 
    316309                                 
    317                                SheafConstIterator word_iter = 
    318                                        clause.getSheaf().const_iterator(); 
     310                        SheafConstIterator word_iter = 
     311                                clause.getSheaf().const_iterator(); 
    319312                                         
    320                                while (word_iter.hasNext()) { 
    321                                        MatchedObject word =  
    322                                                word_iter.next().const_iterator().next(); 
     313                        while (word_iter.hasNext()) 
     314                        { 
     315                                MatchedObject word = word_iter.next().const_iterator().next(); 
    323316                                                 
    324                                        lexemes += HebrewConverter.wordTranslitToHtml(word, generator); 
     317                                lexemes += HebrewConverter.wordTranslitToHtml(word, generator); 
    325318                                         
    326                                         if (word_iter.hasNext())  
    327                                         { 
    328                                                 lexemes += " "; 
    329                                         } 
     319                                if (word_iter.hasNext())  
     320                                { 
     321                                        lexemes += " "; 
    330322                                } 
     323                        } 
    331324                                 
    332                                 int thisClauseId = clause.getID_D(); 
    333                                 if (thisClauseId == selClauseId) 
    334                                         foundSelectedClause = true; 
     325                        int thisClauseId = clause.getID_D(); 
     326                        if (thisClauseId == selClauseId) 
     327                        { 
     328                                foundSelectedClause = true; 
     329                        } 
    335330                                         
    336                                 if (defaultClauseId == 0) 
    337                                         defaultClauseId = thisClauseId; 
     331                        if (defaultClauseId == 0) 
     332                        { 
     333                                defaultClauseId = thisClauseId; 
     334                        } 
    338335                                         
    339                                 %> 
    340                                 <option value=<%= 
    341                                         thisClauseId 
    342                                 %><%= 
    343                                         thisClauseId == selClauseId ? " SELECTED" : "" 
    344                                 %>><%= 
    345                                         lexemes 
    346                                 %><% 
    347                         } 
     336                        %> 
     337                        <option value=<%= 
     338                                thisClauseId 
     339                        %><%= 
     340                                thisClauseId == selClauseId ? " SELECTED" : "" 
     341                        %>><%= 
     342                                lexemes 
     343                        %><% 
    348344                } 
    349345                 
    350346                if (!foundSelectedClause) 
     347                { 
    351348                        selClauseId = defaultClauseId; 
     349                } 
    352350                         
    353351                session.setAttribute("clauseId", new Integer(selClauseId));