Produced by Araxis Merge on Fri Jun 13 14:30:54 2008 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 13 14:30:54 2008 UTC | ||
| 2 | C:\devel_jahia\corp_V2TemplatesSP4\src\jsp\blogs | declarations.inc | Fri Jun 13 14:30:10 2008 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 316 |
| Removed | 0 | 0 |
| Whitespace | All differences in whitespace within lines are ignored |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | <%-- | |||||
| 2 | Copyright 2002-2006 Jahia Ltd | |||||
| 3 | ||||||
| 4 | Licensed u nder the J AHIA COMMO N DEVELOPM ENT AND DI STRIBUTION LICENSE ( JCDDL), | |||||
| 5 | Version 1. 0 (the "Li cense"), o r (at your option) a ny later v ersion; yo u may | |||||
| 6 | not use th is file ex cept in co mpliance w ith the Li cense. You should ha ve | |||||
| 7 | received a copy of t he License along wit h this pro gram; if n ot, you ma y obtain | |||||
| 8 | a copy of the Licens e at | |||||
| 9 | ||||||
| 10 | http://ww w.jahia.or g/license/ | |||||
| 11 | ||||||
| 12 | Unless req uired by a pplicable law or agr eed to in writing, s oftware | |||||
| 13 | distribute d under th e License is distrib uted on an "AS IS" B ASIS, | |||||
| 14 | WITHOUT WA RRANTIES O R CONDITIO NS OF ANY KIND, eith er express or implie d. | |||||
| 15 | See the Li cense for the specif ic languag e governin g permissi ons and | |||||
| 16 | limitation s under th e License. | |||||
| 17 | --%><%! | |||||
| 18 | public Str ing printM onthView(l ong t, Str ing bypass Url, Strin g range, | |||||
| 19 | org.ap ache.log4j .Logger lo gger,boole an display AllSiteEnt ries, | |||||
| 20 | JahiaD ata jData, HttpServle tRequest r equest) | |||||
| 21 | throws Jah iaExceptio n { | |||||
| 22 | Simple DateFormat sdf = new SimpleDat eFormat( " dd/MM/yy k k:mm", jDa ta.getProc essingCont ext().getL ocale() ); | |||||
| 23 | sdf.se tTimeZone( TimeZone.g etTimeZone ("UTC")); | |||||
| 24 | //Cale ndar cal = new Grego rianCalend ar(new Loc ale("CH_fr ")); | |||||
| 25 | Calend ar cal = n ew Gregori anCalendar (); | |||||
| 26 | long n ow = cal.g etTimeInMi llis(); | |||||
| 27 | if (t != -1){ | |||||
| 28 | ca l.setTime( new Date(t )); | |||||
| 29 | } else { | |||||
| 30 | // d etect pagi nation req uest for o ptimizatio n | |||||
| 31 | Stri ng paginat ion = requ est.getPar ameter("ct nscroll_bl ogEntries" ); | |||||
| 32 | if ( paginatio n != null && !"".equ als(pagina tion) ){ | |||||
| 33 | Da te lastDat e = (Date) jData.para ms().getSe ssion().ge tAttribute ("blog.pri ntMonthVie w.date"); | |||||
| 34 | if ( lastDat e != null ){ | |||||
| 35 | cal.setTim e(lastDate ); | |||||
| 36 | } | |||||
| 37 | } | |||||
| 38 | } | |||||
| 39 | jData. params().g etSession( ).setAttri bute("blog .printMont hView.date ",cal.getT ime()); | |||||
| 40 | ||||||
| 41 | boolea n isLastCu rrentDivCl osed = fal se; | |||||
| 42 | String Buffer buf = new Str ingBuffer( ); | |||||
| 43 | ||||||
| 44 | int cu rrDay = cal.get( C alendar.DA Y_OF_MONTH ); | |||||
| 45 | int cu rrWeek = cal.get( C alendar.WE EK_OF_YEAR ); | |||||
| 46 | int cu rrMonth = cal.get( C alendar.MO NTH ); | |||||
| 47 | int cu rrYear = cal.get( C alendar.YE AR ); | |||||
| 48 | ||||||
| 49 | ||||||
| 50 | cal.se tFirstDayO fWeek( Cal endar.MOND AY ); | |||||
| 51 | cal.se t( Calenda r.DAY_OF_M ONTH, 1 ); // 1 is s tart date | |||||
| 52 | ||||||
| 53 | // mak e filter t o get all blog entri es for cur rent month | |||||
| 54 | cal.se t( Calenda r.HOUR_OF_ DAY, 0 ); | |||||
| 55 | cal.se t( Calenda r.MINUTE, 0); | |||||
| 56 | cal.se t( Calenda r.SECOND, 0); | |||||
| 57 | Date l owerVal = cal.getTim e(); | |||||
| 58 | cal.ad d( Calenda r.MONTH, 1 ); | |||||
| 59 | Date u pperVal = cal.getTim e(); | |||||
| 60 | cal.ad d( Calenda r.MONTH, - 1 ); | |||||
| 61 | cal.se t( Calenda r.SECOND, 1); | |||||
| 62 | logger .debug("pr intMonthVi ew -> Filt er from " + | |||||
| 63 | sd f.format( (new Date( lowerVal.g etTime())) ) + " to " + | |||||
| 64 | sd f.format( (new Date( upperVal.g etTime())) )); | |||||
| 65 | ||||||
| 66 | Vector container FilterVect or = new V ector(); | |||||
| 67 | ||||||
| 68 | Contai nerFilterB yContainer Definition entriesDe fFilter = | |||||
| 69 | ne w Containe rFilterByC ontainerDe finition(" blogEntrie s", jData. params().g etEntryLoa dRequest() ); | |||||
| 70 | contai nerFilterV ector.add( entriesDef Filter); | |||||
| 71 | ||||||
| 72 | Contai nerFilterB ean dateFi lter = new Container FilterBean ("blogDate ",true,jDa ta.params( ).getEntry LoadReques t()); | |||||
| 73 | dateFi lter.addCl ause(Conta inerFilter Bean.COMP_ SMALLER, S tring.valu eOf(upperV al.getTime ()) ); | |||||
| 74 | contai nerFilterV ector.add( dateFilter ); | |||||
| 75 | ||||||
| 76 | dateFi lter = new Container FilterBean ("blogDate ",true,jDa ta.params( ).getEntry LoadReques t()); | |||||
| 77 | dateFi lter.addCl ause(Conta inerFilter Bean.COMP_ BIGGER, St ring.value Of(lowerVa l.getTime( )) ); | |||||
| 78 | contai nerFilterV ector.add( dateFilter ); | |||||
| 79 | ||||||
| 80 | if ( c ontainerFi lterVector .size()>0 ) { | |||||
| 81 | Co ntainerFil ters conta inerFilter s ; | |||||
| 82 | if (displayA llSiteEntr ies) { | |||||
| 83 | containe rFilters = new Conta inerFilter s(containe rFilterVec tor,jData. params().g etSiteID() ,"blogEntr ies"); | |||||
| 84 | } else { | |||||
| 85 | containe rFilters = new Conta inerFilter s("blogEnt ries", jDa ta.params( ), contain erFilterVe ctor); | |||||
| 86 | } | |||||
| 87 | cont ainerFilte rs.setCont extID("pri ntMonthVie w"); | |||||
| 88 | requ est.setAtt ribute("bl ogEntries_ filter_han dler",cont ainerFilte rs); | |||||
| 89 | } | |||||
| 90 | Hashta ble dayHas Entry = ne w Hashtabl e(); | |||||
| 91 | JahiaC ontainerLi st entries = jData.c ontainers( ).getConta inerList( "blogEntri es" ); | |||||
| 92 | if (en tries != n ull) { | |||||
| 93 | en tries.setI sContainer sLoaded(fa lse); | |||||
| 94 | En umeration entriesEnu m = entrie s.getConta iners(); | |||||
| 95 | wh ile (entri esEnum.has MoreElemen ts()) { | |||||
| 96 | JahiaCon tainer ent ry = (Jahi aContainer ) entriesE num.nextEl ement(); | |||||
| 97 | long dat eLong = -1 ; | |||||
| 98 | try { | |||||
| 99 | date Long = Lon g.parseLon g((String) entry.getF ieldObject ("blogDate ")); | |||||
| 100 | Cale ndar entry Date = new Gregorian Calendar() ; | |||||
| 101 | entr yDate.setT ime(new Da te(dateLon g)); | |||||
| 102 | int entryDay = entryDate .get(Calen dar.DAY_OF _MONTH); | |||||
| 103 | //lo gger.debug ("Thers is an entry on day " + entryDay) ; | |||||
| 104 | dayH asEntry.pu t(Integer. toString(e ntryDay)," true"); | |||||
| 105 | } catch (NumberFor matExcepti on nfe) { | |||||
| 106 | } | |||||
| 107 | } | |||||
| 108 | } | |||||
| 109 | ca l.set( Cal endar.DAY_ OF_MONTH, currDay ); | |||||
| 110 | ca l.set( Cal endar.HOUR , 12 ); | |||||
| 111 | // dis play next/ previous m onth | |||||
| 112 | buf.ap pend("<h2> "); | |||||
| 113 | ||||||
| 114 | // add link to p revious mo nth | |||||
| 115 | cal.ad d( Calenda r.MONTH, - 1 ); | |||||
| 116 | ||||||
| 117 | ||||||
| 118 | long d ayDate = c al.getTime InMillis() ; | |||||
| 119 | buf.ap pend( "<a href=\"" + bypassUrl + "?t=" + dayDate + "&ran ge=month\" ><<< /a>" ); | |||||
| 120 | ||||||
| 121 | // cur rent month | |||||
| 122 | cal.ad d( Calenda r.MONTH, 1 ); | |||||
| 123 | ||||||
| 124 | ||||||
| 125 | dayDat e = cal.ge tTimeInMil lis(); | |||||
| 126 | buf.ap pend( "<a href=\"" + bypassUrl + "?t=" + dayDate + "&ran ge=month\" >" ); | |||||
| 127 | sdf.ap plyPattern ("MMMM"); | |||||
| 128 | buf.ap pend( sdf. format( ca l.getTime( ) ) ); | |||||
| 129 | buf.ap pend( "</a >" ); | |||||
| 130 | buf.ap pend( "<a href=\"" + bypassUrl + "?t=" + dayDate + "&ran ge=year\"> " ); | |||||
| 131 | buf.ap pend( cal. get( Calen dar.YEAR ) ); | |||||
| 132 | buf.ap pend( "</a >" ); | |||||
| 133 | ||||||
| 134 | // add link to n ext month | |||||
| 135 | cal.ad d( Calenda r.MONTH, 1 ); | |||||
| 136 | dayDat e = cal.ge tTimeInMil lis(); | |||||
| 137 | buf.ap pend( "<a href=\"" + bypassUrl + "?t=" + dayDate + "&ran ge=month\" >>>< /a>\n" ); | |||||
| 138 | buf.ap pend("</h2 >"); | |||||
| 139 | ||||||
| 140 | // ret urn to the current d ate | |||||
| 141 | cal.ad d( Calenda r.MONTH, - 1 ); | |||||
| 142 | ||||||
| 143 | dayDat e = cal.ge tTimeInMil lis(); | |||||
| 144 | /* | |||||
| 145 | debug stuff | |||||
| 146 | Simple DateFormat form = ne w SimpleDa teFormat( "dd/MM/yy kk:mm" ); | |||||
| 147 | buf.ap pend(form. format(day Date)); | |||||
| 148 | */ | |||||
| 149 | buf.ap pend("<div class=\"p re\"><pre> "); | |||||
| 150 | ||||||
| 151 | buf.ap pend( "<sp an class=\ "days\"> "); | |||||
| 152 | buf.ap pend(getRe sourceBund le("blog.m o","mo",jD ata) + " " ); | |||||
| 153 | buf.ap pend(getRe sourceBund le("blog.t u","tu",jD ata) + " " ); | |||||
| 154 | buf.ap pend(getRe sourceBund le("blog.w e","we",jD ata) + " " ); | |||||
| 155 | buf.ap pend(getRe sourceBund le("blog.t h","th",jD ata) + " " ); | |||||
| 156 | buf.ap pend(getRe sourceBund le("blog.f r","fr",jD ata) + " " ); | |||||
| 157 | buf.ap pend(getRe sourceBund le("blog.s a","sa",jD ata) + " " ); | |||||
| 158 | buf.ap pend(getRe sourceBund le("blog.s u","su",jD ata)); | |||||
| 159 | buf.ap pend("</sp an>\n"); | |||||
| 160 | ||||||
| 161 | // get current m onth | |||||
| 162 | cal.se t( Calenda r.MONTH, c urrMonth ) ; | |||||
| 163 | cal.se t( Calenda r.DAY_OF_M ONTH, 1 ); // 1 is s tart date | |||||
| 164 | cal.se t( Calenda r.HOUR_OF_ DAY,12);// mid-day | |||||
| 165 | cal.se tFirstDayO fWeek(Cale ndar.MONDA Y); | |||||
| 166 | int we ekOfYear = cal.get(C alendar.WE EK_OF_YEAR ); | |||||
| 167 | if( we ekOfYear = = currWeek ) { | |||||
| 168 | bu f.append(" <span id=\ "currentwe ek\">"); | |||||
| 169 | } else { | |||||
| 170 | bu f.append(" <span>"); | |||||
| 171 | } | |||||
| 172 | ||||||
| 173 | ||||||
| 174 | if( (w eekOfYear == currWee k) && "wee k".equals( range)) { | |||||
| 175 | bu f.append(" <span clas s=\"curren tweek\">") ; | |||||
| 176 | } else { | |||||
| 177 | bu f.append(" <span>"); | |||||
| 178 | } | |||||
| 179 | if (we ekOfYear < 10) { | |||||
| 180 | bu f.append( " " ); | |||||
| 181 | } | |||||
| 182 | buf.ap pend( "<a href=\"" + bypassUrl + "?t=" + cal.getTi meInMillis () + "& ;range=wee k\" class= \"weekOfYe ar\">"); | |||||
| 183 | buf.ap pend(weekO fYear + "< /a> "); | |||||
| 184 | int fi rstWeekOfY ear = week OfYear; | |||||
| 185 | ||||||
| 186 | // don 't display previous month days | |||||
| 187 | int do w = cal.ge t( Calenda r.DAY_OF_W EEK ); | |||||
| 188 | if (do w == 1) { | |||||
| 189 | do w = 8; | |||||
| 190 | } | |||||
| 191 | for( i nt i = Cal endar.MOND AY; i < do w; i++ ){ | |||||
| 192 | bu f.append( " &nb sp; " ); | |||||
| 193 | } | |||||
| 194 | ||||||
| 195 | while( cal.get( Calendar.M ONTH ) == currMonth ) { | |||||
| 196 | in t d = cal. get( Calen dar.DAY_OF _MONTH ); | |||||
| 197 | bo olean hasE ntry = day HasEntry.g et( Intege r.toString (d))!=null ; | |||||
| 198 | we ekOfYear = cal.get(C alendar.WE EK_OF_YEAR ); | |||||
| 199 | da yDate = ca l.getTimeI nMillis(); | |||||
| 200 | if (cal.get( Calendar. DAY_OF_WEE K ) == Cal endar.MOND AY) { | |||||
| 201 | isLastCu rrentDivCl osed = fal se; | |||||
| 202 | } | |||||
| 203 | if ( (cal.get ( Calendar .DAY_OF_WE EK ) == Ca lendar.MON DAY ) && | |||||
| 204 | (firstWe ekOfYear ! = weekOfYe ar)) { | |||||
| 205 | if( (wee kOfYear == currWeek) && "week" .equals(ra nge)) { | |||||
| 206 | buf. append("<s pan class= \"currentw eek\">"); | |||||
| 207 | } else { | |||||
| 208 | buf. append("<s pan>"); | |||||
| 209 | } | |||||
| 210 | if (week OfYear < 1 0) { | |||||
| 211 | buf. append(" " ); | |||||
| 212 | } | |||||
| 213 | buf.appe nd( "<a hr ef=\"" + b ypassUrl + "?t=" + d ayDate + " &range =week\" cl ass=\"week OfYear\">" ); | |||||
| 214 | buf.appe nd(weekOfY ear + "</a > "); | |||||
| 215 | } | |||||
| 216 | if (d < 10) { | |||||
| 217 | buf.appe nd( " " ); | |||||
| 218 | } | |||||
| 219 | ||||||
| 220 | bu f.append( "<a href=\ "" + bypas sUrl + "?t =" + dayDa te + "& ;range=day \""); | |||||
| 221 | if ((currDay == d ) && (! "week" .equals(ra nge)) && ( ! "month". equals(ran ge))&& (! "year".equ als(range) ) ) { | |||||
| 222 | buf.appen d( " class =\"current day\"" ); | |||||
| 223 | } | |||||
| 224 | if ( hasEntr y ) { | |||||
| 225 | buf.appe nd("style= 'text-deco ration:und erline;'") ; | |||||
| 226 | } | |||||
| 227 | bu f.append( ">"); | |||||
| 228 | bu f.append(d ); | |||||
| 229 | bu f.append( "</a>" ); | |||||
| 230 | if ( cal.get( Calendar. DAY_OF_WEE K ) == Cal endar.SUND AY ) { | |||||
| 231 | buf.appe nd("</span >\n"); | |||||
| 232 | logger.d ebug("isLa stCurrentD ivClosed i s closed h ere"); | |||||
| 233 | isLastCu rrentDivCl osed = tru e; | |||||
| 234 | } else { | |||||
| 235 | buf.appe nd( " " ); | |||||
| 236 | } | |||||
| 237 | ca l.add( Cal endar.DAY_ OF_MONTH, 1 ); | |||||
| 238 | } | |||||
| 239 | logger .debug("is LastCurren tDivClosed is " + is LastCurren tDivClosed ); | |||||
| 240 | if (! isLastCurr entDivClos ed) { | |||||
| 241 | bu f.append(" </span>"); | |||||
| 242 | } | |||||
| 243 | buf.ap pend("</pr e></div>") ; | |||||
| 244 | buf.ap pend( " <a href=\"" + bypassUr l + "?t=" + now + "& amp;range= day\">"); | |||||
| 245 | buf.ap pend(getRe sourceBund le("blog.t oday","Tod ay",jData) + " "); | |||||
| 246 | buf.ap pend("</a> | \n" ); | |||||
| 247 | buf.ap pend( " <a href=\"" + bypassUr l + "?t=" + now + "& amp;range= week\">"); | |||||
| 248 | buf.ap pend(getRe sourceBund le("blog.t hisWeek"," This week" ,jData) + " "); | |||||
| 249 | buf.ap pend("</a> \n" ); | |||||
| 250 | return ( buf.toSt ring() ); | |||||
| 251 | } // print MonthView | |||||
| 252 | ||||||
| 253 | ||||||
| 254 | public Arr ayList bui ldCategory Tree (Arra yList cate gories, Ca tegory cur rentCatego ry, Princi pal p) | |||||
| 255 | throws Jah iaExceptio n { | |||||
| 256 | if ( c urrentCate gory != nu ll ){ | |||||
| 257 | Li st childCa tegories = currentCa tegory.get ChildCateg ories(p); | |||||
| 258 | It erator chi ldIter = c hildCatego ries.itera tor(); | |||||
| 259 | wh ile (child Iter.hasNe xt()) { | |||||
| 260 | Category curChildC ategory = (Category) childIter .next(); | |||||
| 261 | categori es.add(cur ChildCateg ory.getKey ()); | |||||
| 262 | buildCat egoryTree( categories , curChild Category, p); | |||||
| 263 | } | |||||
| 264 | } | |||||
| 265 | return categorie s; | |||||
| 266 | } | |||||
| 267 | %> | |||||
| 268 | <% | |||||
| 269 | ||||||
| 270 | // get all categorie s | |||||
| 271 | Category r ootCategor y = Catego ry.getRoot Category(u ser); | |||||
| 272 | List categ oriesAL = buildCateg oryTree (n ew ArrayLi st(), root Category, user); | |||||
| 273 | Collection s.sort(cat egoriesAL) ; | |||||
| 274 | ||||||
| 275 | ||||||
| 276 | ||||||
| 277 | SimpleDate Format sdf = new Sim pleDateFor mat( "dd/M M/yy kk:mm z+2" ); | |||||
| 278 | //sdf.setT imeZone(Ti meZone.get TimeZone(" UTC")); | |||||
| 279 | ||||||
| 280 | ||||||
| 281 | ||||||
| 282 | boolean is NewPage = false; | |||||
| 283 | Integer sa vedPageID = (Integer )session.g etAttribut e("pageId" ); | |||||
| 284 | if (savedP ageID != n ull){ | |||||
| 285 | if (sa vedPageID. intValue() != curren tPageId){ | |||||
| 286 | is NewPage = true; | |||||
| 287 | } | |||||
| 288 | } | |||||
| 289 | ||||||
| 290 | jParams.se tCacheExpi rationDela y(0);// [m s] | |||||
| 291 | ||||||
| 292 | ||||||
| 293 | long t = - 1; | |||||
| 294 | try { | |||||
| 295 | t = Lo ng.parseLo ng(request .getParame ter("t")); | |||||
| 296 | } catch (N umberForma tException nfe) { | |||||
| 297 | //t = (Calendar. getInstanc e()).getTi meInMillis (); | |||||
| 298 | } | |||||
| 299 | ||||||
| 300 | // try to get the en tryId from parameter or from s ession, th en set in session. | |||||
| 301 | int entryI d = -1; | |||||
| 302 | try { | |||||
| 303 | entryI d = Intege r.parseInt (request.g etParamete r("entryId ")); | |||||
| 304 | logger .debug("Se t attribut e [" + cur rentPageId + "_entry Id] to ses sion with value [" + entryId + "]"); | |||||
| 305 | } catch (N umberForma tException nfe) { | |||||
| 306 | } | |||||
| 307 | String req uestedCate gory = req uest.getPa rameter("c ategory"); | |||||
| 308 | if (reques tedCategor y != null) { | |||||
| 309 | entryI d = -1; | |||||
| 310 | } | |||||
| 311 | logger.deb ug("entryI d is [" + entryId +" ]"); | |||||
| 312 | String ran ge = reque st.getPara meter("ran ge"); | |||||
| 313 | if (range == null) { | |||||
| 314 | range = "month"; | |||||
| 315 | } | |||||
| 316 | %> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2007 Araxis Ltd (www.araxis.com). All rights reserved.