⬆️ ⬇️

Say a word about poor XWiki - 2

image



In the first part of the article, I talked about how to make the standard interface more comfortable, but since then enough water has flowed out to release new versions of the xWiki engine , and the interface has changed towards improved usability . Therefore, in the new article, I propose to discuss tuning and more fine-tuning xWiki for a portable client (based on the Jetty and HSQLDB combination). I’ll make a reservation right away, I don’t think this is the best implementation possible, but given the ease of deployment of the portable version (copied to the right folder and launched), I think that for individual work or a small team in Spartan conditions is the best option.



Welcome under cut



Exposition

First a few comments:

')

1. In order for xWiki to start it is necessary that Java be installed on the PC used as the host

2. The portable version, the configuration of which will be discussed, is launched on both a PC running Windows and Linux, but in a couple of moments, which will be discussed separately, the tuning will be different.

3. In the author’s opinion, based on his empirical experience, for a comfortable work for a separate dedicated host, it is desirable to have a separate dual-core processor of the Intel / AMD family and RAM of at least 3-4GB, or a similarly configured virtual machine). If the host is a PC / laptop for office work, I recommend upgrading the RAM to at least 4GB, as well as installing an i3 processor (or its equivalent) or higher.

4. To correctly make changes to the configuration files of the wiki engine, use Notepad ++ or similar.

5. After each change, I recommend doing an intermediate backup of versions, just in case.

6. The program was customized for yourself, for the convenience of structuring the results of work by the VET / estimator engineer.



Outset

Download the latest, at the time of this writing, version of XWiki, please follow this link:

enterprise.xwiki.org/xwiki/bin/view/Main/Download

Installation
Installation options support: Windows, Debian, web container (web server) - * .war, multisystem format - *. Jar and a portable version of the wiki based on the Jetty + HSQLDB combination, which, IMHO, is most convenient for user setup / operation in both Windows and Linux.



To start tuning and tuning work, you need to unpack the files from the ZIP archive into the root of the disk (it is also recommended to rename the folder to a shorter path, for example: “D: \ xwiki”).

File and directory structure
. .

DIR data _____________ Data and DB

DIR jetty _____________Jetti

DIR META-INF _________ License and Software Notes

DIR webapps __________ xWiki engine

start_xwiki.bat

start_xwiki.sh

start_xwiki_debug.bat

start_xwiki_debug.sh

stop_xwiki.bat

stop_xwiki.sh



Start is carried out by the start_xwiki.bat file for Windows (start_xwiki.sh for Linux via the terminal), in which all the necessary settings are already specified. It is recommended to minimize the console window. Now we need to open a web browser window (the console window is absolutely not recommended to close) and enter the specified URL from the console (terminal), like: http: // localhost : 8080 / xwiki / bin / view / Main /



Now you can work



Default administrator login and password:

Login: Admin

Password: admin



Development

I. Structure of information storage.
For data storage, the portable version based on Jetti uses the HSQLDB base with all its pluses and minuses, in particular, there is a software restriction on investments exceeding 32 MB (which can be increased if desired, but not from this database). Perhaps in your particular case, this will be more than enough, but if HSQLDB is clogged with small files (photo 1..30Mb) to more than 4GB, the system starts working slower, and at some point simply refuses to accept new investments. In order to separate the text and attachments, as well as the best approach, the following method, namely: xWiki supports storing files in folders on your hard disk.



First we change the location storing the attached files from the database to the file system. To do this, you need to make changes to xwiki.cfg (.. \ webapps \ xwiki \ WEB-INF \) (The sequence of characters # - # and # in the configuration files means comment)



xwiki.store.attachment.hint = file

xwiki.store.attachment.versioning.hint = file

xwiki.store.attachment.recyclebin.hint = file



The first variable here means that the attachments will be written to the hard disk. The second means that the attachment versions will also be stored on the hard disk, the third means that the basket with deleted files will also be stored on the hard disk. The disadvantage of this solution is the load on the path to the files that fall on the file system.



Also in the documentation on the site should be noted that the hands in this file structure do not need to be picked, otherwise there will be a mismatch between the data and links, as well as you can get an error.



famous bug
There is a bug in XWiki, which prevents rest restoring attachments from the recycle bin. This is the way to get the document. If you delete your system together

One of the options to avoid any problems with the attachments in the filesystem.



approximate translation

There is an error in XWiki that prevents you from recovering deleted attachments from the recycle bin through the user interface: you will find an empty LiveTable. The action to remove the attachment knocks down the version counter of the document, so the right way to restore the attachment is to roll back to the correct version. If you delete the document with the application, and then click the button again to remove the document from history permanently, the attached file will be deleted from the system together. One option is to avoid confusion with attachments in the file system until this error is fixed, simply turn off the recycle bin for all deleted attachments.



Since In the user interface in the basket, deleted attachments do not appear (this does not apply to deleted pages), I recommend disabling the basket for deleted files and their versions until this bug is fixed:

storage.attachment.recyclebin = 0

xwiki.store.attachment.versioning = 0



In order for the action to take effect - restart XWiki



Now we change the 32Mb limit on the size of the attachments, since it is no longer relevant, for this you need:

1. Go to: http: // "yourwiki" / xwiki / bin / edit / XWiki / XWikiPreferences? Editor = object

2. Expand the list of "XWikiPreferences 0"

3. Scroll down to “Maximum Upload Size” and change it to any other value (in bytes !!!)

4. Scroll down to the Save button.



In order for the action to take effect - to forcibly refresh the page.



Ii. Interface Setup
General tuning of the XWiki interface was carried out in the previous article ; therefore, the author will not dwell on this in detail, but will focus on compiling new information.



Iii. Office Integration Setup
Of course, I mean Open Office / Libre Office . First you need to install one of the packages in the system. Next, you need to make changes to xwiki.properties (.. \ webapps \ xwiki \ WEB-INF \) and set the parameter:

openoffice.autoStart = true



as well as prescribe the paths to directories of the installed office suite in the following variables:

openoffice.homePath = C: / Users / {user} /AppData/Roaming/openOffice.org/3

openoffice.profilePath = C: / Program Files / OpenOffice.org 3



Known bug and workaround
Because of the XWiki bug bug 7164 , XWiki ignores the openoffice.homePath variable for the office server in the xwiki.properties file. To do this, you must additionally modify the start_xwiki.bat file in the XWiki directory in Windows by inserting the following line in it (taking into account your path to the installed office package):

set XWIKI_OPTS =% XWIKI_OPTS% -Doffice.home = "C: \ Program Files \ LibreOffice 3.4"



for Linux, modify the start_xwiki.sh file

set XWIKI_OPTS =% XWIKI_OPTS% -Doffice.path = / usr / lib / libreoffice /


and restart XWiki.



image



image

approx. Link to a detailed description of the installations in English.



Iv. Extensions for comfortable work and administration
A general list of extensions is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Main

Installation of all extensions is carried out from admin panel. In total there are 2 ways to install the extension:

1. Go to the “Administer Wiki” -> “Extension Manager” -> “Add Extensions”. Next, enter the name or part of the name / functional in Latin in the search line and press “Enter”;

2. Download the file (s) with the * .xar extension from the site, go to the “Administer Wiki” -> “Content” -> “Import”, select and load the file, click on it in the window and then agree to import it.



Administration: Export Attachments - Export All Attachments
Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Export+All+Attachments

code available by reference
=Export Attachments=



{{info}}

By default, the export is made from the **current database** and from **all spaces**.

{{/info}}



{{velocity}}

{{html}}

; Database:

: />

; Space name:

: />

; Path to directory to write to:

: />

; /> Confirm

: />



{{/html}}

{{/velocity}}



{{groovy}}

import com.xpn.xwiki.*;

import com.xpn.xwiki.api.*;

import com.xpn.xwiki.doc.*;



import org.apache.commons.io.FileUtils;



import java.io.File;

import java.net.URL;



class ExportedAttachments {

static attachmentsNo = 0;

}



// Export attachments

def void exportAttachments(XWikiContext context) {

def dirPath = request.dirpath + "/";

def dir = new File(dirPath);



String hqlDocCount = "select distinct count(doc.name) from XWikiDocument as doc";

String hqlDocList = "select doc.fullName from XWikiDocument as doc";



if(request.spaceName && request.spaceName != ''){

hqlDocCount += " where doc.web='" + request.spaceName + "'";

hqlDocList += " where doc.web='" + request.spaceName + "'";

}



XWiki wiki = context.getWiki();



int total = wiki.getStore().search(hqlDocCount, 0, 0, context).get(0);

println "**" + total + "** documents to search for attachments";



List documentNames = null;

int offset = 0;

while (documentNames == null || documentNames.size() == 100) {

documentNames = wiki.getStore().search(hqlDocList, 100, offset, context);



for (docName in documentNames) {

try {

XWikiDocument doc = context.getWiki().getDocument(docName, context);

exportDocAttachments(doc, dir, context);

} catch (Exception e) {

println "{{error}} Error : " + e + "{{/error}}";

}

}



offset += documentNames.size();

}



println "";

println "((({{info}}Export done.{{/info}})))";

println "**" + ExportedAttachments.attachmentsNo + "** attachments exported.";

}



// Export attachments for the given document

def void exportDocAttachments(XWikiDocument doc, File dir, XWikiContext context) {

if(doc.getAttachmentList().size() > 0){

println "* **" + doc.fullName + "**";



for (XWikiAttachment attach in doc.getAttachmentList()) {

println "** " + attach.filename;



try {

// Create file

File spaceDir = new File(dir, java.net.URLEncoder.encode(doc.web));

File docDir = new File(spaceDir, java.net.URLEncoder.encode(doc.name));

File destinationFile = new File(docDir, java.net.URLEncoder.encode(attach.filename));

def attachmentURL = doc.getExternalAttachmentURL(attach.filename, 'download', context);



// Copy attachment from URL

URL url = new URL(attachmentURL);

FileUtils.copyURLToFile(url, destinationFile);



ExportedAttachments.attachmentsNo++;



}catch(Exception e){

println "{{error}} Error: Could not create file: " + e + "{{/error}}";

}

}

}

}



// Handle request

if(request.confirm && request.dirpath){

// Set database

def currentDatabase = xcontext.getDatabase();

def newDatabase = currentDatabase;

if(request.dbName && request.dbName != ''){

newDatabase = request.dbName

}

xcontext.setDatabase(newDatabase);



println "=Exporting attachments from **" + newDatabase + "** wiki=";



// Export

exportAttachments(xcontext.context);



// Reset database

xcontext.setDatabase(currentDatabase);

}

{{/groovy}}





Conveniently in order to massively save all attachments in each specific Wiki / SubWiki. For this, a separate page is created with any name, then the code is copied, the page is saved and the form fields are manually filled in the resulting object.



Disadvantages of the solution - filling is done manually, because XWiki works in UTF-8 encoding in Cyrillic filenames and letters and numbers are transformed, which causes inconvenience. How to solve it? At the moment, the author is in a creative search.



Attachment Gallery - Lightbox Macro
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Lightbox+Macro

Installation and configuration discussed in the previous article.



Task Manager - Task Manager Application
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Task+Manager+Application



The most that no task manager to eat. The advantages are free and, relatively, flexible, the minuses rest on the path length limits for the attached files, which is why, if running under Windows, it is recommended to give the file names of the attachments shorter, as well as the names of the tasks and Projects. It is also recommended to avoid the "quotation marks", because When editing, the editor tries to cut the name of the task at the end of the phrase after the first “quotation mark”.



The external display of the columns can be changed; in the author’s view, there is some more unnecessary information for personal use, but the important item - “% complete” in the standard display is missing. Thus, we go to the Task Manager page, select the Edit page with a normal editor, not WYSIWYG, and copy the following text:

Code
{{velocity}}

#set ($discard = $services.localization.use('document', 'TaskManager.TaskManagerTranslations'))

#set ($discard = $xwiki.ssfx.use('uicomponents/widgets/userpicker/userPicker.css'))

#set ($columnsProperties = {

'number': {"type":"number","size":10},

'name': {"type":"text","size":10, "link":"view"},

'project': {"type":"list","size":10},

'status': {"type":"list","size":10,"html":true},

'severity': {"type":"list","size":10,"html":true},

'reporter': {"type":"text","size":10,"html":true},

'assignee': {"type":"text","size":10,"html":true},

'duedate': {"type":"text","size":10},

'progress': {"type":"number","size":10, "html":true},

'_actions': {"sortable":false,"filterable":false,"html":true,"actions":["edit","delete"]}

})

#set ($options = {

'className': 'TaskManager.TaskManagerClass',

'resultPage': 'TaskManager.TaskManagerLiveTableResults',

'translationPrefix': 'taskmanager.livetable.',

'tagCloud': true,

'rowCount': 1000,

'maxPages': 100,

'selectedColumn': 'number',

'defaultOrder': 'asc'

})

#set ($columns = ['number', 'name', 'project', 'progress', 'status', 'severity', 'reporter', 'assignee', 'duedate', '_actions'])

#livetable('taskmanager' $columns $columnsProperties $options)

{{/velocity}}



Here the 'progress' field is added: 'progress': {"type": "number", "size": 10, "html": true},, i.e. progress in the line #set ($ columns = ['number', 'name', 'project', 'progress', 'status', 'severity', 'reporter', 'assignee', 'duedate', '_actions'] ) This parameter is added after the project, in case if in your opinion some columns are superfluous, then their display can be removed here, by editing the line.



What this Task Manager does not know how to do is notify about an overdue task and generally signal. Perhaps the authors will add this in the next version or there will be a new Task Manager with improved functionality. However, it is good for structuring information and general work with the Wiki platform. Of the minuses, it is also worth noting the absence of a WYSIWYG editor when creating and editing tasks, but the macros and programming code do these pages correctly.



File Manager - File Manager Application
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/File+Manager+Application

The option to keep the necessary files on hand is a personal / public mini cloud. In contrast, Export All Attachments correctly handles Cyrillic when uploading files to a PC.



Diagram Wizard - Diagram Application
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Diagram+Application



Meeting Planner - Meeting Application
image

more pictures
image



image



Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Meeting+Application

The meeting scheduler has a built-in graphical calendar interface, as well as an image from GoogleMaps to the meeting place.



Calendar - Mocca Calendar Application
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/MoccaCalendar

Calendar - diary.



Interface Elements - XWiki Back To Top
Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Back+To+Top

When scrolling text that takes up more than one page, the Up button appears in the lower right corner of the window.



Interface elements - Tabs Macro
image



image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Tabs+Macro

Macro allows you to add tabs to the editable page

Code for example
{{tabs idsToLabels='tabId11=My xwiki-wide tabs, tabId12=My working tabs :)' /}}

(%id="tabId11"%)((({{box cssClass="tabId11div"}}

First tab!

{{/box}}

I can post any content here

)))



(%id="tabId12"%)((({{box cssClass="tabId12div"}}

Second tab!

{{/box}}

And here too

)))







Interface Elements - ShowHide Macro
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Ajax+and+Show+Hide+Macro

Customizable spoiler for text.



Annotations (integrated macro)
image

Description in English is available at the following link:

extensions.xwiki.org/xwiki/bin/view/Extension/Annotations+Application

instead of a thousand words…









Climax

XWiki is a second-generation wiki written in Java, the LGPL distribution license, functionality includes a blog, API tools, comments, LDAP authentication, and page export to PDF. Used by many companies around the world. 25 interface languages, including Russian.



The purpose of the second article is to describe settings for working in field conditions, for example, on a business trip. What does a VET engineer need? A laptop with a 15 "display, an office suite, some system for storing and structuring information and, at least 2-3 hours a day, an Internet access point, for receiving and sending mail. Why Wiki? Because executive documentation is regularly edited and rewritten , i.e., versioning is required, which is easy to organize on a hard OS, but at the same time, comments on versions are sometimes more valuable than files, and you also need an application that allows you to keep a certain diary of events and micro-events, which applications successfully solve trech (Calendar) and tasks (Task'ov).



The result of the work:

Now we have a wiki engine including functionality:

- Blog;

- WYSIWIG editor;

- Image galleries;

- Ability to edit and create new macros;

- Script programming features (Velocity, Groovy, Python, Ruby and PHP) and syntax support for popular Wiki engines (Confluence, JSPWiki, Creole, MediaWiki, and TWik);

- Calendar and meeting planner;

- Task Manager;

- plotting diagrams;

- Integration with Office applications;

- File Manager.



Thanks for attention. :)

Source: https://habr.com/ru/post/279101/



All Articles