ちょっと考慮不足で「非公開」ボタンをクリックしても公開日の処理で無効になっていました。こんなんでいいんかな?非公開のドキュメントを編集後に保存する場合には別の条件が必要かも
fdm.db.class.inc.php に次のコードを追加してください
if ($this->fields[’published’]==1) {
}
/***************************************************
Saving/Updating FdmDocument (escape fields added)
****************************************************/
function Save(){ //escape added
global $modx;
$this->fields['editedon']=time();
if ($this->fields['published']==1) { // ここに追加
list($d, $m, $Y, $H, $M, $S) = sscanf($this->fields['pub_date'], "%2d-%2d-%4d %2d:%2d:%2d");
$this->fields['pub_date'] = strtotime("$m/$d/$Y $H:$M:$S");
if($this->fields['pub_date'] <= $this->fields['editedon']) {
$this->fields['published'] = 1;
} else {
$this->fields['published'] = 0;
}
} // ここも追加
fdm.db.class.inc.php の 399行目くらいに
$this->Set(’pub_date’,0); を追加
function UnPublish($user=''){
global $modx;
$this->Set('published',0);
$this->Set('pub_date',0); // ここに追加
$this->Save();
$pid=$this->Get('parent');
$id=$this->Get('id');
return ($pid);
}