We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22549
    • 19 Posts
    bug... in fdm.class.inc.php line 121

    				case $this->config['md5'].'add':
    					if ($this->config["user"]["canpost"]){
    					$docObj->Duplicate($this->config['user']['id'],$this->doc['parent']);
    					//$docObj->Set('deleted',1); // for test only !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    					$docObj->Save();
    					$_SESSION['fdmid']=$this->doc['id']=$docObj->Get('id');
    					//$_SESSION['fdmpub']=$this->doc['topublish']; // dans le form en hidden input ? todo
    					// break ou pas break si no edit form	to add		
    				}
    


    is missing break stat..
      • 27889
      • 415 Posts
      bug... in fdm.class.inc.php line 121
      No bug! After adding the doc we’re going to edit it.

      New Version 0.0.52
      This is 2 examples of what can be doing with FDM, edit is disabled because I have not enough bandwith, if someone is interrested to put them on a site with full functionality, pm me.
      http://dp-site.fr/demos.html
      A small wiki howto on making a catalogue system with the Front end Document Manager:
      http://wiki.modxcms.com/index.php/Howto_catalogue
        MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
        MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
        • 22095
        • 30 Posts
        I’m a newbie when it comes to both the modx api and php... but.

        I found I had to change line 105 in fdm.class.inc.php

        From:
        		$this->config['isauthor'] = $this->config['user']['id']==$this->doc['createdby']?1:0;

        To:
        		$this->config['isauthor'] = abs($this->config['user']['id'])==abs($this->doc['createdby'])?1:0;


        I’m not 100% positive that is the most correct way to solve the problem, or that I didn’t create half a million other bugs at the same time, but it seems to fix the problem.

        Great work btw, highly useful snippet.
          • 27889
          • 415 Posts
          You’re welcome, what is the problem you talk about ?
          $this->doc[’createdby’] is negative for web user and positive for manager user, so if you positive the createdby, authorid is ok for a webuser which have the same but negative id of a manager user.
          Tell me more about your problem please.
            MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
            MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
            • 22095
            • 30 Posts
            Ok, I wasn’t aware of that.

            However, even if I use my webuser for creating the content, I’m not forwarded to the edit form, and if I echo the variables, one is positive, and one is negative. Any idea on why this might happen?
              • 27889
              • 415 Posts
              @Ola
              Can you give me your call to FDM and the version you use.
              Have you set any Web user group to edit the document ? About what variables are you talking ?
                MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
                • 22095
                • 30 Posts
                Here’s the call I’m using:
                [!FDM? &model=`33` &canpost=`Blog Admins` &canedit=`Blog Admins` &parent=`[[getUsersFolder]]` &disableedit=`1` &disabledelete=`1` &disableunpublish=`1` &disablepublish=`1` &eform_tpl=`fdmEformBlog`!]

                and here’s fdmEformBlog:
                [+validationmessage+]
                <form method="post" action="[~[*id*]~]"  id="fdmForm">
                <fieldset>
                	<legend>Blog fält</legend>
                	<input type="hidden" name="formid" value="fdmForm" />
                	<p><label for="pagetitle">Rubrik</label><input name="pagetitle" id ="pagetitle" value="[+pagetitle+]" type="text" eform="Product's name:string:1" /></p>
                	<p><label for="longtitle">Utdrag</label><input name="longtitle" id ="longtitle" value="[+longtitle+]" type="text"  /></p>
                	<p><label for="tvblogRating">Betyg</label><input name="tvblogRating" id ="tvblogRating" value="[+tvblogRating+]" type="text"  /></p>
                	<p><label for="tvblogContent">Beskrivning av dagen</label><input name="tvblogContent" id ="tvblogContent" value="[+tvblogContent+]" type="text"  /></p> 
                		<p><label for="description">Description</label><br /><textarea name="description" id="description" rows="5" cols="50"  eform="Description:html:1">[+description+]</textarea></p>
                	</fieldset>
                	<p>
                	<input name="fdmsubmit" value="Spara" type="submit" />  
                	</p>
                </form>


                And here’s the line I used checking the variables (in fdm.class.inc.php):
                echo "<h2>debug:".$this->config['isauthor']."user][id ".$this->config['user']['id']."createdby ".$this->doc['createdby']."</h2>";
                


                Which echoes: debug:0user][id -1createdby1
                  • 27889
                  • 415 Posts
                  @Ola, that’s better wink
                  Is the call placed on the document you want to edit ? If no, you must have the same FDM call in your model, the document with id 33, can you try this and report back ? If you want you can PM me the login pass to your manager, so I can check it more easy.
                    MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                    MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
                    • 22095
                    • 30 Posts
                     [!FDM? &action=`edit` &id=`[*id*]` &disableadd=`1` &canedit=`Blog Admins` &eform_tpl=`fdmEformBlog` !]
                    [*blogRating*][*blogContent*]


                    That’s contained in the chunk placed in the content field of the model page, does it need to be exactly the same as the call on the other page?
                      • 27889
                      • 415 Posts
                      try to remove the &action=`edit` of your call
                      does it need to be exactly the same as the call on the other page?
                      no not exactly, for example:
                      For a list of item I have these calls
                      In the list page for just an add button:
                      [!FDM? &canmoderate=`articleModerateur` &model=`533` &parent=`[*id*]` &disableedit=`1` &disabledelete=`1` &disableunpublish=`1` &disablepublish=`1` &eform_tpl=`fdmEformArticle`!]

                      In the Model page content this:
                      [!FDM? &canmoderate=`articleModerateur` &eform_tpl=`fdmEformArticle`!]

                      Are you sure that space are allowed in Group name ?




                        MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                        MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]