Source code: com/xpn/xwiki/api/XWiki.java
1 /**
2 * ===================================================================
3 *
4 * Copyright (c) 2003 Ludovic Dubost, All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details, published at
15 * http://www.gnu.org/copyleft/gpl.html or in gpl.txt in the
16 * root folder of this distribution.
17 *
18 * User: ludovic
19 * Date: 26 f�vr. 2004
20 * Time: 17:50:47
21 */
22
23 package com.xpn.xwiki.api;
24
25 import com.sun.image.codec.jpeg.JPEGCodec;
26 import com.sun.image.codec.jpeg.JPEGImageEncoder;
27 import com.xpn.xwiki.XWikiContext;
28 import com.xpn.xwiki.XWikiException;
29 import com.xpn.xwiki.web.Utils;
30 import com.xpn.xwiki.plugin.calendar.CalendarPlugin;
31 import com.xpn.xwiki.plugin.calendar.CalendarPlugin;
32 import com.xpn.xwiki.render.XWikiVelocityRenderer;
33 import com.xpn.xwiki.stats.impl.DocumentStats;
34 import com.xpn.xwiki.stats.api.XWikiStatsService;
35 import com.xpn.xwiki.doc.XWikiDocument;
36 import com.xpn.xwiki.objects.meta.MetaClass;
37 import com.xpn.xwiki.objects.BaseObject;
38 import org.apache.commons.jrcs.diff.Chunk;
39 import org.apache.velocity.VelocityContext;
40
41 import java.awt.image.BufferedImage;
42 import java.io.IOException;
43 import java.io.OutputStream;
44 import java.util.*;
45 import java.net.MalformedURLException;
46
47 public class XWiki extends Api {
48 private com.xpn.xwiki.XWiki xwiki;
49
50 public XWiki(com.xpn.xwiki.XWiki xwiki, XWikiContext context) {
51 super(context);
52 this.xwiki = xwiki;
53 }
54
55 public com.xpn.xwiki.XWiki getXWiki() {
56 if (checkProgrammingRights())
57 return xwiki;
58 else
59 return null;
60 }
61
62 public String getVersion() {
63 return xwiki.getVersion();
64 }
65
66 public String getRequestURL() throws XWikiException {
67 return com.xpn.xwiki.XWiki.getRequestURL(context.getRequest()).toString();
68 }
69
70 /**
71 * Loads an Document from the database. Rights are checked before sending back the document.
72 * @param fullname Fullname of the XWiki document to be loaded
73 * @return a Document object or null if it is not accessible
74 * @throws XWikiException
75 */
76 public Document getDocument(String fullname) throws XWikiException {
77 XWikiDocument doc = xwiki.getDocument(fullname, context);
78 if (xwiki.getRightService().hasAccessLevel("view", context.getUser(), doc.getFullName(), context)==false) {
79 return null;
80 }
81
82 Document newdoc = new Document(doc, context);
83 return newdoc;
84 }
85
86 /**
87 * Returns wether a document exists or not
88 * @param fullname Fullname of the XWiki document to be loaded
89 * @return true if the document exists, false if not
90 * @throws XWikiException
91 */
92 public boolean exists(String fullname) throws XWikiException {
93 return xwiki.exists(fullname, context);
94 }
95
96 /**
97 * Verify the rights the current user has on a document
98 * @param docname fullname of the document
99 * @param right right to check ("view", "edit", "admin", "delete")
100 * @return true if it exists
101 */
102 public boolean checkAccess(String docname, String right) {
103 try {
104 XWikiDocument doc =new XWikiDocument();
105 doc.setFullName(docname, context);
106 return context.getWiki().checkAccess(right, doc, context);
107 } catch (XWikiException e) {
108 return false;
109 }
110 }
111
112
113 /**
114 * Loads an Document from the database. Rights are checked before sending back the document.
115 *
116 * @param web Space to use in case no space is defined in the fullname
117 * @param fullname Fullname or relative name of the document to load
118 * @return a Document object or null if it is not accessible
119 * @throws XWikiException
120 */
121 public Document getDocument(String web, String fullname) throws XWikiException {
122 XWikiDocument doc = xwiki.getDocument(web, fullname, context);
123 if (xwiki.getRightService().hasAccessLevel("view", context.getUser(), doc.getFullName(), context)==false) {
124 return null;
125 }
126
127 Document newdoc = new Document(doc, context);
128 return newdoc;
129 }
130
131 /**
132 * Load a specific revision of a document
133 * @param doc Document for which to load a specific revision
134 * @param rev Revision number
135 * @return Specific revision of a document
136 * @throws XWikiException
137 */
138 public Document getDocument(Document doc, String rev) throws XWikiException {
139 if ((doc==null)||(doc.getDoc()==null))
140 return null;
141
142 if (xwiki.getRightService().hasAccessLevel("view", context.getUser(), doc.getFullName(), context)==false) {
143 // Finally we return null, otherwise showing search result is a real pain
144 return null;
145 }
146
147 try {
148 XWikiDocument revdoc = xwiki.getDocument(doc.getDoc(), rev, context);
149 Document newdoc = new Document(revdoc, context);
150 return newdoc;
151 } catch (Exception e) {
152 // Can't read versioned document
153 e.printStackTrace();
154 return null;
155 }
156 }
157
158 /**
159 * Transform a text in a form compatible text
160 * @param content text to transform
161 * @return encoded result
162 */
163 public String getFormEncoded(String content) {
164 return xwiki.getFormEncoded(content);
165 }
166
167 /**
168 * Transform a text in a URL compatible text
169 * @param content text to transform
170 * @return encoded result
171 */
172
173 public String getURLEncoded(String content) {
174 return xwiki.getURLEncoded(content);
175 }
176
177 /**
178 * Transform a text in a XML compatible text
179 * @param content text to transform
180 * @return encoded result
181 */
182 public String getXMLEncoded(String content) {
183 return xwiki.getXMLEncoded(content);
184 }
185
186 /**
187 * Output content in the edit content textarea
188 * @param content content to output
189 * @return the textarea text content
190 */
191 public String getTextArea(String content) {
192 return xwiki.getTextArea(content, context);
193 }
194
195 /**
196 * Output content in the edit content htmlarea
197 * @param content content to output
198 * @return the htmlarea text content
199 */
200 public String getHTMLArea(String content) {
201 return xwiki.getHTMLArea(content, context);
202 }
203
204 /**
205 * Get the list of available classes in the wiki
206 * @return list of classes names
207 * @throws XWikiException
208 */
209 public List getClassList() throws XWikiException {
210 return xwiki.getClassList(context);
211 }
212
213 /**
214 * Get the global MetaClass object
215 * @return MetaClass object
216 */
217 public MetaClass getMetaclass() {
218 return xwiki.getMetaclass();
219 }
220
221 public List search(String wheresql) throws XWikiException {
222 return xwiki.search(wheresql, context);
223 }
224
225 public List search(String wheresql, int nb, int start) throws XWikiException {
226 return xwiki.search(wheresql, nb, start, context);
227 }
228
229 public List searchDocuments(String wheresql) throws XWikiException {
230 return xwiki.getStore().searchDocumentsNames(wheresql, context);
231 }
232
233 public List searchDocuments(String wheresql, int nb, int start) throws XWikiException {
234 return xwiki.getStore().searchDocumentsNames(wheresql, nb, start, context);
235 }
236
237 public List searchDocuments(String wheresql, int nb, int start, String selectColumns) throws XWikiException {
238 return xwiki.getStore().searchDocumentsNames(wheresql, nb, start, selectColumns, context);
239 }
240
241 public List searchDocuments(String wheresql, boolean distinctbylanguage) throws XWikiException {
242 return xwiki.getStore().searchDocuments(wheresql, context);
243 }
244
245 public List searchDocuments(String wheresql, boolean distinctbylanguage, int nb, int start) throws XWikiException {
246 return xwiki.getStore().searchDocuments(wheresql, nb, start, context);
247 }
248
249 public String parseContent(String content) {
250 return xwiki.parseContent(content, context);
251 }
252
253 public String parseTemplate(String template) {
254 return xwiki.parseTemplate(template, context);
255 }
256
257 /**
258 * Designed to include dynamic content, such as Servlets or JSPs, inside Velocity
259 * templates; works by creating a RequestDispatcher, buffering the output,
260 * then returning it as a string.
261 *
262 * @author LBlaze
263 */
264 public String invokeServletAndReturnAsString(String url) {
265 return xwiki.invokeServletAndReturnAsString(url, context);
266 }
267
268 public String getSkinFile(String filename) {
269 return xwiki.getSkinFile(filename, context);
270 }
271
272 public String getSkin() {
273 return xwiki.getSkin(context);
274 }
275
276 public String getBaseSkin() {
277 return xwiki.getBaseSkin(context);
278 }
279
280 public String getWebCopyright() {
281 return xwiki.getWebCopyright(context);
282 }
283
284 public String getXWikiPreference(String prefname) {
285 return xwiki.getXWikiPreference(prefname, context);
286 }
287
288 public String getXWikiPreference(String prefname, String default_value) {
289 return xwiki.getXWikiPreference(prefname, default_value, context);
290 }
291
292 public String getWebPreference(String prefname) {
293 return xwiki.getWebPreference(prefname, context);
294 }
295
296 public String getWebPreference(String prefname, String default_value) {
297 return xwiki.getWebPreference(prefname, default_value, context);
298 }
299
300 public long getXWikiPreferenceAsLong(String prefname, long default_value) {
301 return xwiki.getXWikiPreferenceAsLong(prefname, default_value, context);
302 }
303
304 public long getXWikiPreferenceAsLong(String prefname) {
305 return xwiki.getXWikiPreferenceAsLong(prefname, context);
306 }
307
308 public long getWebPreferenceAsLong(String prefname, long default_value) {
309 return xwiki.getWebPreferenceAsLong(prefname, default_value, context);
310 }
311
312 public long getWebPreferenceAsLong(String prefname) {
313 return xwiki.getWebPreferenceAsLong(prefname, context);
314 }
315
316 public int getXWikiPreferenceAsInt(String prefname, int default_value) {
317 return xwiki.getXWikiPreferenceAsInt(prefname, default_value, context);
318 }
319
320 public int getXWikiPreferenceAsInt(String prefname) {
321 return xwiki.getXWikiPreferenceAsInt(prefname, context);
322 }
323
324 public int getWebPreferenceAsInt(String prefname, int default_value) {
325 return xwiki.getWebPreferenceAsInt(prefname, default_value, context);
326 }
327
328 public int getWebPreferenceAsInt(String prefname) {
329 return xwiki.getWebPreferenceAsInt(prefname, context);
330 }
331
332 public String getUserPreference(String prefname) {
333 return xwiki.getUserPreference(prefname, context);
334 }
335
336 public String getUserPreferenceFromCookie(String prefname) {
337 return xwiki.getUserPreferenceFromCookie(prefname, context);
338 }
339
340 public String getLanguagePreference() {
341 return xwiki.getLanguagePreference(context);
342 }
343
344 public boolean isVirtual() {
345 return xwiki.isVirtual();
346 }
347
348 public boolean isMultiLingual() {
349 return xwiki.isMultiLingual(context);
350 }
351
352 public void flushCache() {
353 xwiki.flushCache();
354 }
355
356 public int createUser() throws XWikiException {
357 return createUser(false, "edit");
358 }
359
360 public int createUser(boolean withValidation) throws XWikiException {
361 return createUser(withValidation, "edit");
362 }
363
364 public int createUser(boolean withValidation, String userRights) throws XWikiException {
365 boolean registerRight;
366 try {
367 if (checkProgrammingRights()) {
368 registerRight = true;
369 } else {
370 registerRight = xwiki.getRightService().hasAccessLevel("register", context.getUser(),
371 "XWiki.XWikiPreferences", context);
372 }
373
374 if (registerRight)
375 return xwiki.createUser(withValidation, userRights, context);
376 else
377 return -1;
378
379 } catch (Exception e) {
380 e.printStackTrace();
381 return -2;
382 }
383
384 }
385
386 public int createNewWiki(String wikiName, String wikiUrl, String wikiAdmin,
387 String baseWikiName, boolean failOnExist) throws XWikiException {
388 return createNewWiki(wikiName, wikiUrl, wikiAdmin, baseWikiName, "", null, failOnExist);
389 }
390
391 public int createNewWiki(String wikiName, String wikiUrl, String wikiAdmin,
392 String baseWikiName, String description, boolean failOnExist) throws XWikiException {
393 return createNewWiki(wikiName, wikiUrl, wikiAdmin, baseWikiName, description, null, failOnExist);
394 }
395
396 public int createNewWiki(String wikiName, String wikiUrl, String wikiAdmin,
397 String baseWikiName, String description, String language, boolean failOnExist) throws XWikiException {
398 if (checkProgrammingRights())
399 return xwiki.createNewWiki(wikiName, wikiUrl, wikiAdmin, baseWikiName, description, language, failOnExist, context);
400 else return -1;
401 }
402
403 public int validateUser(boolean withConfirmEmail) throws XWikiException {
404 return xwiki.validateUser(withConfirmEmail, context);
405 }
406
407 public void sendMessage(String sender, String recipient, String message) throws XWikiException {
408 if (checkProgrammingRights())
409 xwiki.sendMessage(sender, recipient, message, context);
410 }
411
412 public void sendMessage(String sender, String[] recipient, String message) throws XWikiException {
413 if (checkProgrammingRights())
414 xwiki.sendMessage(sender, recipient, message, context);
415 }
416
417
418 public boolean copyDocument(String docname, String targetdocname) throws XWikiException {
419 if (checkProgrammingRights())
420 return xwiki.copyDocument(docname, targetdocname, null, null, null, false, context);
421 else
422 return false;
423 }
424
425 public boolean copyDocument(String docname, String targetdocname, String wikilanguage) throws XWikiException {
426 if (checkProgrammingRights())
427 return xwiki.copyDocument(docname, targetdocname, null, null, wikilanguage, false, context);
428 else
429 return false;
430 }
431
432 public boolean copyDocument(String docname, String sourceWiki, String targetWiki, String wikilanguage) throws XWikiException {
433 if (checkProgrammingRights())
434 return xwiki.copyDocument(docname, docname, sourceWiki, targetWiki, wikilanguage, true, context);
435 else
436 return false;
437 }
438
439 public boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki, String wikilanguage, boolean reset) throws XWikiException {
440 if (checkProgrammingRights())
441 return xwiki.copyDocument(docname, targetdocname, sourceWiki, targetWiki, wikilanguage, reset, context);
442 else
443 return false;
444 }
445
446 public String includeTopic(String topic) throws XWikiException {
447 return includeTopic(topic, true);
448 }
449
450 public String includeForm(String topic) throws XWikiException {
451 return includeForm(topic, true);
452 }
453
454 public String includeTopic(String topic, boolean pre) throws XWikiException {
455 if (pre)
456 return "{pre}" + xwiki.include(topic, context, false) + "{/pre}";
457 else
458 return xwiki.include(topic, context, false);
459 }
460
461 public String includeForm(String topic, boolean pre) throws XWikiException {
462 if (pre)
463 return "{pre}" + xwiki.include(topic, context, true) + "{/pre}";
464 else
465 return xwiki.include(topic, context, true);
466 }
467
468 public boolean hasAccessLevel(String level) {
469 try {
470 return xwiki.getRightService().hasAccessLevel(level, context.getUser(), context.getDoc().getFullName(), context);
471 } catch (Exception e) {
472 return false;
473 }
474 }
475
476 public boolean hasAccessLevel(String level, String user, String docname) {
477 try {
478 return xwiki.getRightService().hasAccessLevel(level, user, docname, context);
479 } catch (Exception e) {
480 return false;
481 }
482 }
483
484 public String renderText(String text, Document doc) {
485 return xwiki.getRenderingEngine().renderText(text, doc.getDoc(), context);
486 }
487
488 public String renderChunk(Chunk chunk, Document doc) {
489 return renderChunk(chunk, false, doc);
490 }
491
492 public String renderChunk(Chunk chunk, boolean source, Document doc) {
493 StringBuffer buf = new StringBuffer();
494 chunk.toString(buf, "", "\n");
495 if (source==true)
496 return buf.toString();
497
498 try {
499 return xwiki.getRenderingEngine().renderText(buf.toString(), doc.getDoc(), context);
500 } catch (Exception e) {
501 return buf.toString();
502 }
503 }
504
505 public List getSpaces() throws XWikiException {
506 return xwiki.getSpaces(context);
507 }
508
509 public List getSpaceDocsName(String SpaceName) throws XWikiException {
510 return xwiki.getSpaceDocsName(SpaceName, context);
511 }
512
513 // Usefull date functions
514 public Date getCurrentDate() {
515 return xwiki.getCurrentDate();
516 }
517
518 public Date getDate() {
519 return xwiki.getCurrentDate();
520 }
521
522 public int getTimeDelta(long time) {
523 return xwiki.getTimeDelta(time);
524 }
525
526 public Date getDate(long time) {
527 return xwiki.getDate(time);
528 }
529
530 public String[] split(String str, String sep) {
531 return xwiki.split(str, sep);
532 }
533
534 public String printStrackTrace(Throwable e) {
535 return xwiki.printStrackTrace(e);
536 }
537
538 public String getEncoding() {
539 return xwiki.getEncoding();
540 }
541
542 public Object getNull() {
543 return null;
544 }
545
546 public String getNl() {
547 return "\n";
548 }
549
550 public String getAttachmentURL(String fullname, String filename) throws XWikiException {
551 return xwiki.getAttachmentURL(fullname, filename, context);
552 }
553
554 public String getURL(String fullname, String action) throws XWikiException {
555 return xwiki.getURL(fullname, action, context);
556 }
557
558 public String getURL(String fullname, String action, String querystring) throws XWikiException {
559 return xwiki.getURL(fullname, action, querystring, context);
560 }
561
562 public java.lang.Object getService(String className) throws XWikiException {
563 if (hasProgrammingRights())
564 return xwiki.getService(className);
565 else
566 return null;
567 }
568
569 public java.lang.Object getPortalService(String className) throws XWikiException {
570 if (hasProgrammingRights())
571 return xwiki.getPortalService(className);
572 else
573 return null;
574 }
575
576 public List getArrayList() {
577 return new ArrayList();
578 }
579
580 public Map getHashMap() {
581 return new HashMap();
582 }
583
584 public void outputImage(BufferedImage image) throws IOException {
585 JPEGImageEncoder encoder;
586 OutputStream ostream = context.getResponse().getOutputStream();
587 encoder = JPEGCodec.createJPEGEncoder(ostream);
588 encoder.encode(image);
589 ostream.flush();
590 }
591
592 public DocumentStats getCurrentMonthXWikiStats(String action) {
593 return context.getWiki().getStatsService(context).getDocMonthStats("", "view", new Date(), context);
594 }
595
596 public String getRefererText(String referer) {
597 try {
598 return xwiki.getRefererText(referer, context);
599 } catch (Exception e) {
600 return "";
601 }
602 }
603
604 public String getShortRefererText(String referer, int length) {
605 try {
606 return xwiki.getRefererText(referer, context).substring(0, length);
607 } catch (Exception e) {
608 return xwiki.getRefererText(referer, context);
609 }
610 }
611
612 public String getFullNameSQL() {
613 return xwiki.getFullNameSQL();
614 }
615
616 public String getUserName(String user) {
617 return xwiki.getUserName(user, null, context);
618 }
619
620 public String getUserName(String user, String format) {
621 return xwiki.getUserName(user, format, context);
622 }
623
624 public String getLocalUserName(String user) {
625 try {
626 return xwiki.getUserName(user.substring(user.indexOf(":") + 1), null, context);
627 } catch (Exception e) {
628 return xwiki.getUserName(user, null, context);
629 }
630 }
631
632 public String getLocalUserName(String user, String format) {
633 try {
634 return xwiki.getUserName(user.substring(user.indexOf(":") + 1), format, context);
635 } catch (Exception e) {
636 return xwiki.getUserName(user, format, context);
637 }
638 }
639
640 public String formatDate(Date date) {
641 return xwiki.formatDate(date, null, context);
642 }
643
644
645 public String formatDate(Date date, String format) {
646 return xwiki.formatDate(date, format, context);
647 }
648
649 /**
650 * Returns a plugin from the plugin API. Plugin Rights can be verified.
651 * @param name Name of the plugin to retrieve (either short of full class name)
652 * @return a plugin object
653 */
654 public Api get(String name) {
655 return xwiki.getPluginApi(name, context);
656 }
657
658 /**
659 * Returns a plugin from the plugin API. Plugin Rights can be verified.
660 * @param name Name of the plugin to retrieve (either short of full class name)
661 * @return a plugin object
662 */
663 public Api getPlugin(String name) {
664 return xwiki.getPluginApi(name, context);
665 }
666
667 /**
668 * Returns the recently visited pages for a specific action
669 * @param action ("view" or "edit")
670 * @param size how many recent actions to retrieve
671 * @return a ArrayList of document names
672 */
673 public java.util.Collection getRecentActions(String action, int size) {
674 XWikiStatsService stats = context.getWiki().getStatsService(context);
675 if (stats==null)
676 return new ArrayList();
677 else
678 return stats.getRecentActions(action, size, context);
679 }
680
681 /**
682 * Returns the Advertisement system from the preferences
683 * @return "google" or "none"
684 */
685 public String getAdType() {
686 return xwiki.getAdType(context);
687 }
688
689 /**
690 * Returns the Advertisement client ID from the preferences
691 * @return an Ad affiliate ID
692 */
693 public String getAdClientId() {
694 return xwiki.getAdClientId(context);
695 }
696
697 /**
698 * Retrieves a int from a String
699 * @param str String to convert to int
700 * @return the int or zero in case of exception
701 */
702 public int parseInt(String str) {
703 try {
704 return Integer.parseInt(str);
705 } catch (Exception e) {
706 return 0;
707 }
708 }
709
710 /**
711 * Retrieves a int from a String
712 * @param str String to convert to int
713 * @return the int or zero in case of exception
714 */
715 public Integer parseInteger(String str) {
716 return new Integer(parseInt(str));
717 }
718
719 /**
720 * Retrieves a long from a String
721 * @param str String to convert to long
722 * @return the long or zero in case of exception
723 */
724 public long parseLong(String str) {
725 try {
726 return Long.parseLong(str);
727 } catch (Exception e) {
728 return 0;
729 }
730 }
731
732 /**
733 * Retrieves a float from a String
734 * @param str String to convert to float
735 * @return the float or zero in case of exception
736 */
737 public float parseFloat(String str) {
738 try {
739 return Float.parseFloat(str);
740 } catch (Exception e) {
741 return 0;
742 }
743 }
744
745 /**
746 * Retrieves a double from a String
747 * @param str String to convert to double
748 * @return the double or zero in case of exception
749 */
750 public double parseDouble(String str) {
751 try {
752 return Double.parseDouble(str);
753 } catch (Exception e) {
754 return 0;
755 }
756 }
757
758 /**
759 * Returns the content of an HTTP/HTTPS URL protected using Basic Authentication
760 * @param surl url to retrieve
761 * @param username username for the basic authentication
762 * @param password password for the basic authentication
763 * @return Content of the specified URL
764 * @throws IOException
765 */
766 public String getURLContent(String surl, String username, String password) throws IOException {
767 try {
768 return xwiki.getURLContent(surl, username, password);
769 } catch (Exception e) {
770 return "";
771 }
772 }
773
774 /**
775 * Returns the content of an HTTP/HTTPS URL
776 * @param surl url to retrieve
777 * @return Content of the specified URL
778 * @throws IOException
779 */
780 public String getURLContent(String surl) throws IOException {
781 try {
782 return xwiki.getURLContent(surl);
783 } catch (Exception e) {
784 return "";
785 }
786 }
787
788 /**
789 * Filters text to be include in = or like clause in SQL
790 * @param text text to filter
791 * @return filtered text
792 */
793 public String sqlfilter(String text) {
794 return Utils.SQLFilter(text);
795 }
796
797 /**
798 * Returns the list of Macros documents in the specified content
799 * @param defaultweb Default Web to use for relative path names
800 * @param content Content to parse
801 * @return ArrayList of document names
802 */
803 public List getIncludedMacros(String defaultweb, String content) {
804 return xwiki.getIncludedMacros(defaultweb, content, context);
805 }
806
807
808 /**
809 * returns true if xwiki.readonly is set in the configuration file
810 *
811 * @return the value of xwiki.isReadOnly()
812 *
813 * @see #com.xpn.xwiki.XWiki
814 *
815 */
816 public boolean isReadOnly () {
817 return xwiki.isReadOnly();
818 }
819
820 public void setReadOnly (boolean ro) {
821 if (hasAdminRights()) {
822 xwiki.setReadOnly(ro);
823 }
824 }
825 }