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