Component Tickets — custom pages and comments

for a Long time did not write anything on habré — was up to his ears busy. During this time much has been done but even more in the plans. But yesterday released a new component Tickets, to create a system of support. Of course, only in MODX Revolution.

The principle common — user asks a question and receives answers in the comments.

In the process, it appeared that the system, in General, can be used for sites with user-generated content, like a simple LiveStreet (video from the demonstration at the end of the post).

So, what features at the moment?

custom resource types.


All tickets are stored in resources but they have their own classes that inherit from modResource. This gives you the opportunity to provide them a separate rule create\change\output and even their own page in Manager.

For example, tickets are not showing in the resource tree (and not hinder it, by their number), all management is from a special section page tickets. There are comments to management.

If you have seen Articles, the expansion for blogging of the authors of MODX here made almost the same.

Create / edit pages from the frontend


Here it is clear that the main functionality. I use the excellent editor MarkItUp. A set of buttons and their work can be set in the system settings.

rapid ajax comments with the management in the admin panel.


Comments this case is half the work. For MODX Revolution got exactly one comment — terribly brake Quip, with whom I initially wanted to make friends. Have written their own classes that extended Quip and gave me the opportunity to work through Ajax.
All went well until I put on your site, and do not understand — that it is terribly slow. Theme with 315 reviews opened 10 -12 seconds without cache.

So, I had to strain and add comments to an independent state, without dependencies on Quip.
So there was a second commenting system for MODX Revolution. A sample was taken and comments Habra LiiveStreet.

Page 315 comments now opens at 0.6 sec. without cache. I don't even screwed.

Support security policies


There's not much to tell — use system rights Revolution, which makes it for me. The installation package adds your permissions and policies that can be used.

Separately are given the right to work with tickets and to create them in a certain section. Also have permission to create comments.

Separate mechanism to operate the cache


The main gripe for ALL this constant cleaning of the cache with any bunch in the Manager. It is clear that the caching in the Revolution is very steep and it is impossible to clear all the possible links of the updated resource. But on the website a couple of thousands resources, it becomes a real headache. Given that users can edit their tickets — the site just got up a stake in a big number.

Therefore, when you update a ticket in the admin or frontend only clears the cache of this ticket, and the pages of his parent (section tickets). Everything else can be cleaned with plugin event OnDocFormSave if necessary.

Jevix for filtering the if output to screen


Primarily intended for the expansion of user-generated content. And they can cram us all sorts of XSS and other dirty tricks.

With this issue in a thoughtful excellent versed Jevix, the rules which are configured by separate sets of parameters. And separately for the ticket and comment.

If you do not have this extension for filtering and printing — Tickets will automatically download and install it. Without Jevix to work as of yet.

Well, even the little things:
the
    the
  • email notifications about comments to the author of the ticket, and those who responded to his comment.
  • the
  • Complete code snippets for proper trimming and filtering of text and counting the number of comments the ticket.
  • the
  • All the chunks of the design, defines the parameters have snippets, 2 languages — Russian and English.


In total, this job took me about 40 days. Clean time is approximately 140 hours.
Video install and set the Tickets on the net site.



This is the first public beta version is quite early — but it is quite stable.

Not to mention a good Studio Simple Dream who ordered this extension, paid, and put it for free repository.

Source code available on Github.
To see the real work you have my website.
Article based on information from habrahabr.ru

Популярные сообщения из этого блога

Approval of WSUS updates: import, export, copy

The Hilbert curve vs. Z-order

Configuring a C++ project in Eclipse for example SFML application