Tickets component - user pages and comments

    For a long time I did not write anything on Habré - he was busy head over heels. During this time, much has been done, but even more in the plans. But yesterday I released a new component of Tickets , to create a technical support system. Clearly, only in MODX Revolution.

    The principle is normal - the user asks a question and receives answers in the comments.

    In the process, it turned out that the system, in general, can be used for sites with user-generated content, such as the simple LiveStreet ( video demonstrating the work at the end of the post ).

    So what are the options at the moment?

    Own types of resources.


    All tickets are stored in resources, but they have their own classes that inherit modResource . This makes it possible to organize separate rules for creating / modifying / displaying them, and even their own pages in the manager.

    For example, tickets are not shown in the resource tree (and do not slow it down by their quantity), all of them are managed from a special page in the section of tickets. Comments are also displayed there for management.

    If you saw Articles , an extension for blogging from the authors of MODX - then here is done almost the same.

    Creating / editing pages from the frontend


    It’s clear, the main functionality. The wonderful editor MarkItUp is used . The set of buttons and their operation can be set in the system settings.

    Own fast ajax comments, with administration in the admin panel.


    Comments on this matter are half the work. There is exactly one commenting system for MODX Revolution - the terribly inhibitory Quip , which I initially wanted to make friends with. He wrote his classes that extended Quip and made it possible to work through Ajax.
    Everything went well until I put it on my site, and I did not understand that it was terribly slow. A topic with 315 comments opened for 10-12 seconds, without a cache.

    Therefore, I had to strain and add comments to an independent state, without dependencies on Quip.
    So the second commenting system for MODX Revolution appeared. The comments of Habr and LiiveStreet were taken as a sample.

    A page with 315 comments now opens in 0.6 seconds, without a cache. I have not even screwed it yet.

    Security Policy Support


    There is nothing special to tell here - the Revolution rights system is used, which does everything for me. The installation package adds its permissions and policies, which you can then use.

    The rights to work with tickets “in general” are separately given, and to create them in a specific section. There is also permission to create a comment.

    Separate cache engine


    The main gripe of MODX is the constant clearing of the cache for any bunch in the manager. It is clear that caching in Revolution is very cool and it is impossible to otherwise clear all possible connections of the updated resource. But on a site with a couple of thousand resources, this becomes a real headache. Given that users can edit their tickets, the site will simply get a stake with serious numbers.

    Therefore, when updating a ticket in the admin panel or frontend, only the cache of this particular ticket and its parent’s page (ticket sections) are cleared. Everything else can be cleaned by the plugin on the OnDocFormSave event , if necessary.

    Jevix to filter on display


    The extension is primarily intended for user-generated content. And they can cram us all sorts of XSS and other dirty tricks.

    The excellent Jevix , the rules of which are configured by separate sets of parameters, thoughtfully understands this question . Moreover, separately for the ticket and comment.

    If you do not have this extension for filtering and typography, Tickets will automatically download and install it. You can’t work without Jevix yet.

    Well, and the little things:
    • Email notifications about comments to the ticket author, and to those who answered his comment.
    • The output of the latest comments and tickets, with a breakdown by sections and the possibility of caching.
    • Complete snippets for competent trimming and filtering of text, as well as counting the number of ticket comments.
    • All necessary chunks of design, prescribed parameters for snippets, 2 languages ​​- Russian and English.


    In total, this work took me about 40 days. A net time of approximately 140 hours.
    Video installation and settings Tickets on a clean site.



    This is the first public beta, the version is quite early - but quite stable.

    I can not help but mention the good studio Simple Dream , who ordered this extension, paid, and put it free in the repository .

    Source code is available on Github .
    You can see it in real work on my website .

    Also popular now: