XWiki Presentation

Download Report

Transcript XWiki Presentation

XWiki Presentation
Web/Wiki History
2
3
1
(1) Representative event:
1991 Web first used in a
small, academic community
Technologies
becoming
popular: HTTP,
HTML, GIF, JPEG
Content view&edit:
Tim Berners Lee
Browser+Editor; HTML
preprocessors
(2) ~1997 E-commerce
application Amazon.com
IPO
Presentation-oriented
HTML, JavaScript, Java
Applets, PHP
WYSIWYG editors
(FrontPage), Navigator
and MS Explorer
(3) ~2001 Collaborative
content creation in
Wikipedia.org starts
CSS; XHTML and XMLrelated markup; J2EE
Web Apps
(servlets+JSP)
Web-based Content
management systems
(CMS), wiki-formats
(4) Since 2005 - AJAX, Web RubyRails, Semantic
2.0, www.37signals.com,
Web (RDF/OWL), SOA
Google Docs, Mashups,
2nd generation wikis.
Content syndication
(RSS+RDF), portlets,
wiki extensible by
macros, plugins and
scripting
4
"Long Tail" & 2nd Generation Wikis
• Pareto principle (80-20
rule) and "Long Tail".
Various software solutions
- spellcheckers,
Amazon.com, Google.com
show that it is essential to
handle "long tails" well.
- Applications like Atlassian Confluence and XWiki claim to
be the MS Access and MS Excel of the Web age.
- It should be easy to configure simple Web forms and sort
all kinds of simple data and documents - to bring the
advantages of packaged development to the everyday user.
Remarks on XWiki Installation
• Windows installer - Jetty Web Server + HSQLDB (usually a private
XWiki)
• Multiple user XWiki - e.g. Apache2+Tomcat5.5 + MySQL.
XWiki pre-defined objects/templates
Custom objects/templates
XWiki J2EE Web Application (Struts, Hibernate, Maven2 modules...)
Java Application Server
• Jetty
• Apache Tomcat
• Apache Geronimo
• Resin
• JBoss
• Oracle OC4J
• BEA WebLogic
• IBM WebSphere
... Anything that can run J2EE Servlet
2.4 spec.
Database Server
• Hypersonic (HSQLDB)
• MySQL
• Postgre
• Oracle XE
... Anything one can connect via
JDBC or ODBC.
Spaces
•
•
•
•
Space - a logical grouping of pages
Every page belongs to a space
Easier to manage user permissions
Wiki-Notation: [MySpace.MyPage]; external link:
– http://localhost:8080/xwiki/bin/view/MySpace/MyPage
• Each space has default starting-page:
[MySpace.WebHome]; external link:
http://localhost:8080/xwiki/bin/view/MySpace/
Note the ending slash (/)!
• Space "Main" is pre-defined; [Main.WebHome] is the
default homepage document
Creating a new page or space
• Create a link to
an empty page;
Click on it!
• Links to
nonexisting pages
display with "?".
Clicking that link
also creates
page.
Administer a Page or Space
• Pick a space, press [Add Access Right Entry]
• Select a group or a user; pick level and allow/deny
• Levels:
admin/view/edit/comment/delete/register/programming
Headings
• Prefix line with number for heading
1 for heading
1.1 for sub-heading
1.1.1 for sub-sub-heading
» Etc
• Always use "1" and "1.1" (not "2", "2.3", etc.)
• Needs to be at the start of line
• Can also use html tags (like <h1>...</h1> etc.)
Table of Content - macro
• Note! Long Web documents are not good.
• Use velocity macro #toc(init max number)
– Init = Heading level to display
– Max = Maximum number of nested levels
– Number = Boolean, whether to number results
• Automatically creates links to headings
• Examples:
#toc("" "" "") or, say,
#toc(1 5 true)
Text Effects
• Bold
Surround text with asterisks i.e. *Bold*
Equivalent to strong tag - <strong>Bold</strong>
• Italics
Surround text with tildes i.e. ~~Italics~~
Equivalent to emphasized tag i.e. <em>Italics</em>
• Strike
– Surround text with dashes i.e. –Stricken–
– Use deleted tag i.e. <del>Stricken</del>
Lists and Bullet Points
• Prefix text with * (or 1. 1.1. 1.a )
• The number of *’s controls indent.
Consider also using headings / toc
• Examples:
1. First
* Shopping List
** Cake
*** Flour
*** Eggs
*** Sugar
** Bananas
** Tomatoes
1. Second
1*. Second sub-bullet
1*. Second sub-bullet
1. Third. Should not introduce\\
line-breaks, except forced ones.
1a. Third A
1a. Third B
1. Fourth
Creating a Hyperlink
Syntax:
• Link to external website - [Text label >
http://www.accenture.lv] or just [http://www.accenture.lv]
• Link with different display text
[label > Space.Name] or [label|Space.Name]
(pipe allows refactoring of links, when pages are
renamed).
• Link to given space and page [Space.SomeName] (the
link is displayed with space "Some Name").
• Link to page in same space [SomeName]
Quiz
• Question: What is the difference between two
links: [MyProject.], [MyProject.WebHome] and
[MyProject] if used in the document
[OtherSpace.Aa]
• Answer: The first two refer to the default page
(WebHome) of the space "MyProject". The last
one refers to a page "MyProject" in the current
document space. Their links are respectively:
– http://localhost:8080/xwiki/bin/view/MyProject/
and
– http://localhost:8080/xwiki/bin/view/OtherSpace/MyProject
Tables
• Creates an IBM formatted table
• Each row must be on it’s own line
• Example:
{table}
Head1 | Head2 | Head3
Row1.1 | Row1.2 | Row1.3
Row2.1 | Row2.2 | Row 2.3
{table}
Attachments and Pictures
• You can attach large files to a page
• To display a link to an attachment
– {attach:filename.doc}
• To display an image in the page
– {image:picture.jpg}
• To display a remote image
– <img
src=“/xwiki/bin/download/{Space}/{Page}/pict
ure.jpg” />
Escaping
Use \ to escape individual characters
• Example
– \{table} , \[Button\]
– \\ to display \
• May need to use html to display certain
characters
– &lt; instead of <
– &gt; instead of >
– &#x5C; or &#92; instead of \
Displaying Code
• Use {code:xml} or {code} (i.e. {code:java}) tags
to indicate that a block of text is code.
• Example
{code:java}
try {
// Load the JDBC driver
String driverName = "org.gjt.mm.mysql.Driver";
Class.forName(driverName);
} catch (ClassNotFoundException e) {
// Could not find the driver
}
{code}
Blocks of Plaintext
• Use {PRE} text {/PRE} to stop the wiki
processing text.
• Use <PRE> text </PRE> to stop HTML
processing text.
Using Velocity macros
• #toc('' '' '')
• Highlighted blocks:
– #info('Info message')
– #warning('Warning message')
– #error('Error message')
– #floatingbox('Surrounded box with text')
• #includeInContext("MySpace.MyPage")
• Find more (and define your own) under
/xwiki/skins/albatross/macros.vm
XWiki Distributions
• XWiki Enterprise , an
extensible Enterprise
wiki,
• XWiki Enterprise
Manager , an
application for
managing farms of
wikis,
• XWiki Watch , a
collaborative RSS
reader with a UI built
using GWT,
• Chronopolys, a
project management
application for
managing portfolio of
projects
• Nearbee, a wiki
focused on work
spaces with the ability
to invite users to
share them .
Editing Objects
1
2
3
Some Predefined Objects
• Open
– any article,
– a blog entry,
– a user page
with "Edit"->
"Objects".
• You should see
something like this:
Editing Objects
• From the Objects editor you
can add new (predefined)
objects to your document.
• Each document in some
space is a list of zero or more
objects (plus the
template/text of the
document itself).
• Typically each document
contains one object - an
instance of "XWiki.TagClass"
Various Modes of Looking at the
Document
• "Edit" -> "Objects" opens a predefined
form with text-boxes.
• There are two more modes: (simply)
"view" and "inline" (or "inline form").
Defining Your own Object Classes
http://localhost:8080/xwiki/bin/view/XWiki/XWikiClasses
Class "Todo" - Step 1
• Open some existing classes
• Create a new class - Todo
This is the
default content
for the TODO
Class wizard:
Class "Todo" - Step 2
• First click "Edit the Class" and add the class attributes
(i.e. the properties for all future "Todo" objects).
• It is not easy to remove properties once added - one can
only Rollback the class definition or re-create it.
Script for Displaying Todo's
1 Todos
#set ($hql = ", BaseObject as obj where
obj.name=doc.fullName
and obj.className='XWiki.TodoClass' and
obj.name<>'XWiki.TodoClassTemplate'")
#set ($todos= $xwiki.searchDocuments($hql))
{table}
Description|Assignee|Date|Status
#foreach ($todo in $todos)
#set ($todoDoc = $xwiki.getDocument($todo))
#set ($todoObj =
$todoDoc.getObject("XWiki.TodoClass"))
[$todoObj.Description>$todo] | $todoObj.Assignee |
$todoObj.TargetDate | $todoObj.Status
#end
{table}
Result to display Todo's
• For this to work robustly, use
Making Todo list sortable/filterable
<table id="todoTable" class="grid sortable filterable doOddEven" cellpadding="0" cellspacing="0"
border="0">
<tr class="sortHeader">
<th>Description</th>
<th>Assignee</th>
<th>Date</th>
<th class="unsortable selectFilter">Status</th>
</tr>
#foreach ($todo in $todos)
<tr>
#set ($todoDoc = $xwiki.getDocument($todo))
#set ($todoObj = $todoDoc.getObject("XWiki.TodoClass"))
<td>[$todoObj.Description>$todo]</td>
<td>$todoObj.Assignee</td>
<td>$todoObj.TargetDate</td>
<td>$todoObj.Status</td>
</tr>
#end
</table>
Resulting List of Todo's
• Also click to link "tags" (after you have
tagged some documents).
Adding Pagination
1 Todos
<form...
</form>
#set($itemsPerPage = 5)
#if($request.ipp)
#set($itemsPerPage = $xwiki.parseInt($request.ipp))
#end
#set($pageNumber = 0)
#if($request.page)
#set($pageNumber = $xwiki.parseInt($request.page))
#end
#set($startAt = $itemsPerPage * $pageNumber)
#if($startAt < 0)
#set($startAt = 0)
#end
#set ($hql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.TodoClass' and
obj.name<>'XWiki.TodoClassTemplate'")
#set ($count = $xwiki.getXWiki().search("select count(doc) from XWikiDocument doc ${hql}", $context.context).get(0))
#set($endAt = $itemsPerPage * ($pageNumber + 1))
#if($endAt > $count)
#set($endAt = $count)
#end
#if($startAt > $endAt)
#set($startAt = $endAt)
#end
#set($totalPages = ($count - 1) / $itemsPerPage)
#set($crtPageNumber = $startAt / $itemsPerPage)
#set ($todos= $xwiki.searchDocuments($hql, $itemsPerPage, $startAt))
<table...
</table>
#pagedViewLinks($itemsPerPage $totalPages $crtPageNumber)
Resulting List of Todo's
• View your objects as paginated list (+ have
a simple form for creating new objects).
Add Todo's to the Panel
• http://localhost:8080/xwiki/bin/view/Panels/
• Add a script between
"panelheader" and
"panelfooter"
• Should use Hibernate
Query language
(HQL)
#set ($hql = ... )
#foreach ($todo in
$xwiki.searchDoc
uments($hql, 5,
0))
* [$todo]
#end
Extending XWiki Markup Language
• Can use Plugins as JARs or Groovy
scripting.
• An example of adding LaTeX plugin to
XWiki is seen
http://www.ante.lv/xwiki/bin/view/MetaAnte
/RenderingLatex .
XWiki Admin Concerns
• Manage Users
• Manage Space and Page Access
• Configure private blogging spaces and
similar spaces for users' private use
• Ensure that can migrate to newer versions
• Create backups for the whole wiki or some
spaces only
• Ensure that XWiki content is available
offline
Administration:Managing Users
• Registered user typically has more rights than someone
not logged in ("XWikiGuest" vs. a member of "XWiki All
Group")
• User registration can be done with confirmation e-mail or
just by declaring users data (first/last name, blog
address, etc.)
• Reset password is
• Deleting user == delete his/her object:
–
–
–
–
Log in as one of adminstrators
Click top-right link "Administration"
Open tab "Users & Groups"
In the "Users
Backups
• Export XAR files - essentially ZIP archives,
which contain XWiki-markup pages (with
meta-information).
– Readable and nice; XAR files can be easily
edited to select only those spaces you want to
import back, etc.
– Downside - XAR mechanism does not work
for sufficiently large XWiki sites (around 10M).
• Use "mysqldump" or similar database
backup.
XWiki Offline
• http://code.xwiki.org/xwiki/bin/view/Extensi
ons/XEclipseExtension
• Export XWiki and import to your local
machine.
• Create the browsable off-line HTML
(standard Web-Crawler)
Examples
• http://wiki.bonita.objectweb.org/xwiki/bin/vi
ew/Main/WebHome - Workflow system
Bonita
• http://club.mandriva.com/xwiki/bin/view/Ma
in/2008_released - Mandriva user forum
References
• http://www.xwiki.org/xwiki/bin/view/Main/