We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    One small msg to tell you that xFDM is on a good way
    Fantastic, this is great news and sounds exiting. I can hardly wait to get my grimy fingers on it grin grin
      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

      Something is happening here, but you don't know what it is.
      Do you, Mr. Jones? - [bob dylan]
      • 4172
      • 5,888 Posts
      I did some little modifications in ’fdm.class.inc.php’. I’m not a programmer, but it works now fine for me:

      to allow the call to a form on another document i added the GET-Parameter &fdmcallid, now FDM knows where the call cames from and I can redirect to the calling document i.e. a ditto-page.

      The modifications:
      the link-buttons old:
      $this->link['add']=$this->link['editorpageid'].$this->link['uchar'].'fdmaction=add'.'&fdmmodel='.$this->doc['model'].'&fdmparent='.$this->doc['parent'].'&fdmid='.$this->doc['id'];
      $this->link['edit'] =$this->link['editorpageid'].$this->link['uchar'].'fdmaction=edit'.'&fdmid='.$this->doc['id'];
      $this->link['delete'] = str_replace('&','&',$modx->makeUrl($this->config['editorpageid'],'','&fdmaction=delete'.'&fdmid='.$this->doc['id']));
      $this->link['publish'] = str_replace('&','&',$modx->makeUrl($this->config['editorpageid'],'','&fdmaction=publish'.'&fdmid='.$this->doc['id']));
      $this->link['unpublish'] = str_replace('&','&',$modx->makeUrl($this->config['editorpageid'],'','&fdmaction=unpublish'.'&fdmid='.$this->doc['id']));


      the link-buttons new:
      $this->link['add'] =$this->link['editorpageid'].$this->link['uchar'].'fdmaction=add'.'&fdmmodel='.$this->doc['model'].'&fdmparent='.$this->doc['parent'].'&fdmid='.$this->doc['id'].'&fdmcallid='.$modx->documentIdentifier;
      $this->link['edit'] =$this->link['editorpageid'].$this->link['uchar'].'fdmaction=edit'.'&fdmid='.$this->doc['id'].'&fdmcallid='.$modx->documentIdentifier;
      $this->link['delete'] = $modx->makeUrl($modx->documentIdentifier).'&fdmaction=delete'.'&fdmid='.$this->doc['id'];
      $this->link['publish'] = $modx->makeUrl($modx->documentIdentifier).'&fdmaction=publish'.'&fdmid='.$this->doc['id'];
      $this->link['unpublish'] =$modx->makeUrl($modx->documentIdentifier).'&fdmaction=unpublish'.'&fdmid='.$this->doc['id'];


      before

      		if ($this->parameters['id']){
      			$this->doc['id']=$this->parameters['id'];


      i added

      if($_GET['fdmcallid']==$modx->documentIdentifier){
          // von gleicher Seite aufgerufen
      	}else{
      	// von anderer Seite aufgerufen
      	if($_GET['fdmaction']=='edit'){$this->parameters['id']=$_GET['fdmid'];}
      	if($_GET['fdmaction']=='add'){$this->parameters['id']=$_GET['fdmid'];}
      
      	}
      	
      if ($_POST['fdmsubmit']){	
          $this->parameters['id']=$_SESSION [fdmid]; 
      	}


      after
      $_SESSION['fdm']['redirect']=$this->link['redirect'] ;


      i added:
                     if( is_numeric($_GET['fdmcallid']) ){
                      $_SESSION['fdm']['callid']=$_GET['fdmcallid'];				
      		$_SESSION['fdm']['callurl']=$modx->makeUrl($_GET['fdmcallid']);


      in
      function mergeFields(&$fields)


      i added:
      $fields['callid']=$_GET['fdmcallid'];


      to the function allok i added:
      				if(isset($_SESSION['fdm']['callurl'])){
      				$link=str_replace('[+url+]',$_SESSION['fdm']['callurl'],$_lang['doclink']);
      				$link=str_replace('[+pagetitle+]','Zurück zur aufrufenden Seite',$link);
      				echo $link;
      				}

      now i have two links in the ThankYou-Page. To the document and to the FDM-callpage

      in eFormarray:
      'protectSubmit'=>'0',  // else problem, Bruno changed from 1 to 0



      to allow to edit pub_date and unpup_date i added
      	if (isset($fields['unpub_date'])){
      $unpub_date=$fields['unpub_date'];	
      list ($d, $m, $Y, $H, $M, $S) = sscanf($unpub_date, "%2d-%2d-%4d %2d:%2d:%2d");
      $fields['unpub_date'] = strtotime("$m/$d/$Y $H:$M:$S");
      			}

      to the function filldoc.

      It would be fine when it works like this in the new version.

      • Redirect from the Thankyou-Page to the call-Page
      • Have in the form-doc only the call [!FDM!] and all parameters come from the call-page.
      • Format the pub_date and unpub_date.
      sorry for my bad english!

      Bruno
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 27330
        • 884 Posts
        Great snippet! just what I needed.

        2 Question please:
        I’m using FURL and new documents created with FDM getting their alias from the title with case sensitive. Is there any way to lower case the title for the alias like it does when I add document from the manager?

        also is it possible to not have friendly alias path in the link to the new document? (I use FURL without friendly alias path)


          • 27330
          • 884 Posts
          Also noticed that the long_alias_names.html have "_" and in the site settings its creates my alias with "-" between long-alias-names.html

          Anyway I can force FDM to stick to the system FURL settings?
            • 27330
            • 884 Posts
            bump.
            soda any ideas about that^? huh
              • 27330
              • 884 Posts
              I read the 19 pages post twice and can’t find anyone asking about the _ in the alias but me.
              Am I the first to think about it as a problem or am I a jerk so no one answers? smiley
              please people if anyone has an idea direct me there.
                • 27889
                • 415 Posts
                There is no need to ask the same question multiple time nor bump.
                People answer when they have time.

                In fdm.db.class.inc, function SetAlias before return add:
                $alias = preg_replace(’/[_ ]+/’, ’-’, $alias);
                  MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                  MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
                  • 27330
                  • 884 Posts
                  pardon the attitude, I was thinking maybe someone just asked that a few posts before me therefore no one reply... please take no offense.

                  I tried the line you wrote but it didnt affect not the CAPS nor the ’_’
                  is there an additional file maybe I need to edit?

                  my code is:
                  <?php function SetAlias($alias=''){
                  		global $modx;
                  		$charset=$modx->config['modx_charset'];
                  		$alias= mb_strtolower($this->stripAlias(trim($alias)),$charset);
                  		$alias=$alias?$alias:$this->fields['pagetitle'];
                  		$alias = preg_replace('/[ _]+/', '-', $alias);
                    	            return $alias;
                  ?>
                    • 33337
                    • 3,975 Posts
                    I guess the correct one from Soda is:
                    $alias = preg_replace('/[_ ]+/', '-', $alias);
                    


                    1. there is a space after [_
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link
                      • 27330
                      • 884 Posts
                      hmmm... yes my typo, but even with the corrected one it doesn’t work and still sows ’_’ rolleyes