function PostCommentForm() { Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); Requirements::javascript('jsparty/scriptaculous/effects.js'); Requirements::javascript('cms/javascript/PageCommentInterface.js'); $fields = new FieldSet(new HiddenField("ParentID", "ParentID", $this->page->ID), new TextField("Name", _t('PageCommentInterface.YOURNAME', 'Your name'))); if (MathSpamProtection::isEnabled()) { $fields->push(new TextField("Math", sprintf(_t('PageCommentInterface.SPAMQUESTION', "Spam protection question: %s"), MathSpamProtection::getMathQuestion()))); } $fields->push(new TextareaField("Comment", _t('PageCommentInterface.YOURCOMMENT', "Comments"))); $form = new PageCommentInterface_Form($this->controller, $this->methodName . ".PostCommentForm", $fields, new FieldSet(new FormAction("postcomment", _t('PageCommentInterface.POST', 'Post')))); $form->loadDataFrom(array("Name" => Cookie::get("PageCommentInterface_Name"))); return $form; }
function PostCommentForm() { Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); Requirements::javascript(CMS_DIR . '/javascript/PageCommentInterface.js'); $fields = new FieldSet( new HiddenField("ParentID", "ParentID", $this->page->ID) ); $member = Member::currentUser(); if((self::$comments_require_login || self::$comments_require_permission) && $member && $member->FirstName) { // note this was a ReadonlyField - which displayed the name in a span as well as the hidden field but // it was not saving correctly. Have changed it to a hidden field. It passes the data correctly but I // believe the id of the form field is wrong. $fields->push(new ReadonlyField("NameView", _t('PageCommentInterface.YOURNAME', 'Your name'), $member->getName())); $fields->push(new HiddenField("Name", "", $member->getName())); } else { $fields->push(new TextField("Name", _t('PageCommentInterface.YOURNAME', 'Your name'))); } // optional commenter URL $fields->push(new TextField("CommenterURL", _t('PageCommentInterface.COMMENTERURL', "Your website URL"))); if(MathSpamProtection::isEnabled()){ $fields->push(new TextField("Math", sprintf(_t('PageCommentInterface.SPAMQUESTION', "Spam protection question: %s"), MathSpamProtection::getMathQuestion()))); } $fields->push(new TextareaField("Comment", _t('PageCommentInterface.YOURCOMMENT', "Comments"))); $form = new PageCommentInterface_Form($this, "PostCommentForm", $fields, new FieldSet( new FormAction("postcomment", _t('PageCommentInterface.POST', 'Post')) )); $form->loadDataFrom(array( "Name" => Cookie::get("PageCommentInterface_Name"), "Comment" => Cookie::get("PageCommentInterface_Comment"), "URL" => Cookie::get("PageCommentInterface_CommenterURL") )); return $form; }