/** * Get an UploadForm instance with title and text properly set. * * @param $message String: HTML string to add to the form * @param $sessionKey String: session key in case this is a stashed upload * @param $hideIgnoreWarning Boolean: whether to hide "ignore warning" check box * @return UploadForm */ protected function getUploadForm($message = '', $sessionKey = '', $hideIgnoreWarning = false) { # Initialize form $form = new UploadForm(array('watch' => $this->getWatchCheck(), 'forreupload' => $this->mForReUpload, 'sessionkey' => $sessionKey, 'hideignorewarning' => $hideIgnoreWarning, 'destwarningack' => (bool) $this->mDestWarningAck, 'description' => $this->mComment, 'texttop' => $this->uploadFormTextTop, 'textaftersummary' => $this->uploadFormTextAfterSummary, 'destfile' => $this->mDesiredDestName), $this->getContext()); $form->setTitle($this->getTitle()); # Check the token, but only if necessary if (!$this->mTokenOk && !$this->mCancelUpload && ($this->mUpload && $this->mUploadClicked)) { $form->addPreText($this->msg('session_fail_preview')->parse()); } # Give a notice if the user is uploading a file that has been deleted or moved # Note that this is independent from the message 'filewasdeleted' that requires JS $desiredTitleObj = Title::makeTitleSafe(NS_FILE, $this->mDesiredDestName); $delNotice = ''; // empty by default if ($desiredTitleObj instanceof Title && !$desiredTitleObj->exists()) { LogEventsList::showLogExtract($delNotice, array('delete', 'move'), $desiredTitleObj, '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('upload-recreate-warning'))); } $form->addPreText($delNotice); # Add text to form $form->addPreText('<div id="uploadtext">' . $this->msg('uploadtext', array($this->mDesiredDestName))->parseAsBlock() . '</div>'); # Add upload error message $form->addPreText($message); # Add footer to form $uploadFooter = $this->msg('uploadfooter'); if (!$uploadFooter->isDisabled()) { $form->addPostText('<div id="mw-upload-footer-message">' . $uploadFooter->parseAsBlock() . "</div>\n"); } return $form; }
/** * Get an UploadForm instance with title and text properly set. * * @param string $message HTML string to add to the form * @param string $sessionKey Session key in case this is a stashed upload * @return UploadForm */ protected function getUploadForm($message = '', $sessionKey = '', $hideIgnoreWarning = false) { global $wgOut; # Initialize form $form = new UploadForm(array('watch' => $this->getWatchCheck(), 'forreupload' => $this->mForReUpload, 'sessionkey' => $sessionKey, 'hideignorewarning' => $hideIgnoreWarning, 'destwarningack' => (bool) $this->mDestWarningAck, 'texttop' => $this->uploadFormTextTop, 'textaftersummary' => $this->uploadFormTextAfterSummary, 'destfile' => $this->mDesiredDestName)); $form->setTitle($this->getTitle()); # Check the token, but only if necessary if (!$this->mTokenOk && !$this->mCancelUpload && ($this->mUpload && $this->mUploadClicked)) { $form->addPreText(wfMsgExt('session_fail_preview', 'parseinline')); } # Add text to form $form->addPreText('<div id="uploadtext">' . wfMsgExt('uploadtext', 'parse', array($this->mDesiredDestName)) . '</div>'); # Add upload error message $form->addPreText($message); # Add footer to form $uploadFooter = wfMsgNoTrans('uploadfooter'); if ($uploadFooter != '-' && !wfEmptyMsg('uploadfooter', $uploadFooter)) { $form->addPostText('<div id="mw-upload-footer-message">' . $wgOut->parse($uploadFooter) . "</div>\n"); } return $form; }