We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11975
    • 2,542 Posts
    Hi,

    A really handy class to create dummy content for testing modx performance.
    I wanted to report that I couldn’t extract the attached zip file.
    I’m using OSX and had to unzip the file with parallels(windows virtualisation) and clean the text from invisible character.

    Perhaps am I the only one to get this issue.
    If needed, I can provide the modified file (I didn’t find how to attach a file to my post)



    :-)
      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
      • 32241
      • 1,495 Posts
      I;m very2 interested in this type of library. Can I know the difference between this API and the docAPI? If this prove to be much better and faster, then why do we need 2 library? We can just remove the ld docAPI from the community wink
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 32241
        • 1,495 Posts
        Btw I just read the code, and it seems this is more suitable as an alternative solution to docAPI that is quite bloated and full of bell and whistle.
        The current docAPI, support plugin calling, auto generated form fields for editing, and fetching documents based on certain filter. I don’t know about the performance, but if you guys can out your hands on the docAPI, it will be great, coz I don’t have time to maintain the code any longer, and it seems to me that v.1.0 is approaching, which is a good news smiley

        Thanks for the this great code that have a GTD (Getting Things Done) concept from my opinion that might prove to ebe useful for most of us in this community. wink
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 22815
          • 1,097 Posts
          I’ve installed this API on a site today and it seemed to work OK.

          I refered to the guidance above, but discovered there were two flaws with it. As I am a mod, I have taken the liberty of amending the instructions to save anyone else the same confusion. (It included document.class.inc.php when the file in the zip is actually called docmanager.class.inc.php, and the submited check had an extra closing bracket.)

          Caution!
          This API appears not to check for ’ marks in text. These will need to be made safe by the snippet before being passed in, otherwise an error occurs.

          DocManager vs docAPI
          Looking at the code, this is much much simpler than docAPI; I need now to see whether docAPI is better for me. If it makes input safe and lets me have TV input the same as the backend, then I think it will be.
            No, I don't know what OpenGeek's saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 32241
            • 1,495 Posts
            The docAPI itself is trying to mimic the document processor on the backend. So it invoke certain events, just like the backend, to ensure that every plugins will be called appropriately, when the API being used on the frontend.

            The only thing that cause the file to be so large is because I duplicate the TV functionality provided by the core code, and improve it a little bit, so it will make this code independent from the current core code, with the hope that later this can be used to improve MODx core code. I can’t provide any example ot support, but I used this on one of my production site, and it works like a charm, and I have a snippet called plainEditor, which I will release it when I have time cleaning up the code and put some instruction on how to use it.

            Sincerely,

            EDIT: I don’t want to hijack this thread, if there is any other question, feel free to post it on the current support thread for docAPI. I believe there are a lot of things that can be improved on the API, which I might over see it.
              Wendy Novianto
              [font=Verdana]PT DJAMOER Technology Media
              [font=Verdana]Xituz Media
              • 31113
              • 45 Posts
              Djamoer: When I wrote this class I have named it "Alternative to DocAPI". I don’t know as to name it. May be "Docmanager"? This name - the invention of Yentsun (big thanks to translation). If my English would be better I has translated the class by myself. I started to write my API because DocAPI wosn’t any documentation had the duplicate of code MODx. Duplication of code MODx can lead to to incompatibility with following versions MODx.

              PaulGregory: "This API appears not to check for ’ marks in text"
              It is made to increase speed. I do not plan to check input. For these purposes it is better to use $modx->db->escape.

              I would like to remove mess with names but I can not edit the first post. If this class is necessary for somebody, can to put of it in a repository with normal name?
                • 32241
                • 1,495 Posts
                lol, I have no problem in using the name and etc. I’m a very open minded person. So don’t worry about it. I would suggest creating this is the new repository system, so everyone can start making use of this lib. wink

                I like the the idea of simplicity of your code. To be honest, your argument about code duplication is true. It’s just my way of doing things, which is not always the best practice. Maybe you can learn a few things from my code and implement it further for your code, such as invoking events on your library, so all the plugin will affect your lib as well.

                Sincerely,
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 32963
                  • 1,732 Posts
                  Very nice library smiley

                  Congrats on making it so easy to add and duplicate documents

                  Question:

                  1) Why did you use $doc->Set() as oppose to $doc->set() camel-case?

                  2) Will this version also duplicate documents on a MySQL 3.23 database?




                    xWisdom
                    www.xwisdomhtml.com
                    The fear of the Lord is the beginning of wisdom:
                    MODx Co-Founder - Create and do more with less.
                    • 27226
                    • 186 Posts
                    Maybe I haven’t understood the purpose of that lib huh
                    I thought it could be a useful helper when writing plugins/snippets etc. to create a kind of "console" or log.
                    So, in a plugin, listening to "OnDocPublished" and "OnDocUnPublished", I tried to use it like that:
                    require_once('assets/libs/docapi/docmanager.class.inc.php');
                    global $content;
                    $e = &$modx->Event;
                    $logpage = new Document();
                    $logpage->Set('content', 'logging started');
                    $log = $logpage->Get('content');
                    $uid = $modx->getLoginUserID();
                    
                    switch($e->name) 
                    {
                      case 'OnDocPublished':
                        $uid = $modx->getLoginUserID();
                        $log .= "a document was published by ".$uid;
                        $logpage->Set('content',$log); $logpage->Save();
                        break;
                    
                     case 'OnDocUnPublished':
                       $uid = $modx->getLoginUserID();
                        $log .= "a document was unpublished by ".$uid;
                        $logpage->Set('content',$log); $logpage->Save();
                        break;
                    
                    case 'OnManagerLogin':
                       $log .= "manager logged in.";
                       $logpage->Set('content',$log); $logpage->Save();
                    break;
                    
                      default:
                       $log .= "nothing happened at all";
                        $logpage->Set('content',$log); $logpage->Save();
                        return;
                        break;
                    }


                    But, it doesn’t work. I know, my Plugin is executing, but it is not creating a "logging"-doc.
                    (I tried it initially with an existing doc and called it like $logpage = new Document(54)
                    - 54 was the id of the doc to store the log in - didn’t work either.)

                    Seems I’m on the wrong fork here? But if it’s not for automated doc-manipulation from the backend I really have no clue how it can be used anyway...
                      • 32963
                      • 1,732 Posts

                      Did you try setting the parent property of those document?
                        xWisdom
                        www.xwisdomhtml.com
                        The fear of the Lord is the beginning of wisdom:
                        MODx Co-Founder - Create and do more with less.