function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
     $request = $this->getRequest();
     $propname = $request->getVal('propname', $par);
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page_props', 'pp_propname', '', __METHOD__, array('DISTINCT', 'ORDER BY' => 'pp_propname'));
     $propnames = array();
     foreach ($res as $row) {
         $propnames[$row->pp_propname] = $row->pp_propname;
     }
     $form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
     $form->setMethod('get');
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegendMsg('pageswithprop-legend');
     $form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
     $form->setSubmitTextMsg('pageswithprop-submit');
     $form->prepareForm();
     $form->displayForm(false);
     if ($propname !== '' && $propname !== null) {
         $form->trySubmit();
     }
 }
 /**
  * Main execution point
  *
  * @param string $par title fragment
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $lang = $this->getLanguage();
     $out->setPageTitle($this->msg('ipblocklist'));
     $out->addModuleStyles('mediawiki.special');
     $request = $this->getRequest();
     $par = $request->getVal('ip', $par);
     $this->target = trim($request->getVal('wpTarget', $par));
     $this->options = $request->getArray('wpOptions', array());
     $action = $request->getText('action');
     if ($action == 'unblock' || $action == 'submit' && $request->wasPosted()) {
         # B/C @since 1.18: Unblock interface is now at Special:Unblock
         $title = SpecialPage::getTitleFor('Unblock', $this->target);
         $out->redirect($title->getFullUrl());
         return;
     }
     # Just show the block list
     $fields = array('Target' => array('type' => 'text', 'label-message' => 'ipadressorusername', 'tabindex' => '1', 'size' => '45', 'default' => $this->target), 'Options' => array('type' => 'multiselect', 'options' => array($this->msg('blocklist-userblocks')->text() => 'userblocks', $this->msg('blocklist-tempblocks')->text() => 'tempblocks', $this->msg('blocklist-addressblocks')->text() => 'addressblocks', $this->msg('blocklist-rangeblocks')->text() => 'rangeblocks'), 'flatlist' => true), 'Limit' => array('class' => 'HTMLBlockedUsersItemSelect', 'label-message' => 'table_pager_limit_label', 'options' => array($lang->formatNum(20) => 20, $lang->formatNum(50) => 50, $lang->formatNum(100) => 100, $lang->formatNum(250) => 250, $lang->formatNum(500) => 500), 'name' => 'limit', 'default' => 50));
     $form = new HTMLForm($fields, $this->getContext());
     $form->setMethod('get');
     $form->setWrapperLegendMsg('ipblocklist-legend');
     $form->setSubmitTextMsg('ipblocklist-submit');
     $form->prepareForm();
     $form->displayForm('');
     $this->showList();
 }
Exemplo n.º 3
0
 public function testGetHTML_empty()
 {
     $form = new HTMLForm([]);
     $form->setTitle(Title::newFromText('Foo'));
     $form->prepareForm();
     $html = $form->getHTML(false);
     $this->assertRegExp('/<form\\b/', $html);
 }
	public function execute( $par ) {
		$out = $this->getOutput();
		$request = $this->getRequest();

		$this->setHeaders();
		$this->outputHeader();
		$out->setPageTitle( $this->msg( 'ss-assessment-log' ) );

	$fields = array(
		'Project' => array(
		'type' => 'text',
		'label-message' => 'ss-project',
		'tabindex' => '1'
		)
	);

	$project = $request->getText( 'wpProject' );
		
		$filters = array_filter( array(
			'l_project' => $project
		) );

		$form = new HTMLForm( $fields, $this->getContext() );
		$form->setMethod( 'get' );
		$form->prepareForm();

		$form->displayForm( '' );

		$pager = new AssessmentLogPager( $this, $filters );
		if( $pager->getNumRows() ) {
			$out->addHTML( 
			$pager->getNavigationBar() . 
			'<table>' . 
				Html::rawElement( 'tr', array(), 
					Html::element( 'td', array(), wfMessage( 'ss-action' ) ) .
					Html::element( 'td', array(), wfMessage( 'ss-old' ) ) .
					Html::element( 'td', array(), wfMessage( 'ss-new' ) ) .
					Html::element( 'td', array(), wfMessage( 'ss-article' ) ) .
					Html::element( 'td', array(), wfMessage( 'ss-project' ) ) .
					Html::element( 'td', array(), wfMessage( 'ss-timestamp' ) )
				) .
				$pager->getBody() .
				'</table>' .
				$pager->getNavigationBar()
			);
		} else {
			$out->addWikiMsg( 'ss-assessment-log-empty' );
		}
	}
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
     $request = $this->getRequest();
     $propname = $request->getVal('propname', $par);
     $propnames = $this->getExistingPropNames();
     $form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
     $form->setMethod('get');
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegendMsg('pageswithprop-legend');
     $form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
     $form->setSubmitTextMsg('pageswithprop-submit');
     $form->prepareForm();
     $form->displayForm(false);
     if ($propname !== '' && $propname !== null) {
         $form->trySubmit();
     }
 }
Exemplo n.º 6
0
 /**
  * Default action when we don't have a subpage -- just show links to the uploads we have,
  * Also show a button to clear stashed files
  * @param Status : $status - the result of processRequest
  */
 private function showUploads($status = null)
 {
     global $wgOut;
     if ($status === null) {
         $status = Status::newGood();
     }
     // sets the title, etc.
     $this->setHeaders();
     $this->outputHeader();
     // create the form, which will also be used to execute a callback to process incoming form data
     // this design is extremely dubious, but supposedly HTMLForm is our standard now?
     $form = new HTMLForm(array('Clear' => array('type' => 'hidden', 'default' => true, 'name' => 'clear')), 'clearStashedUploads');
     $form->setSubmitCallback(array(__CLASS__, 'tryClearStashedUploads'));
     $form->setTitle($this->getTitle());
     $form->setSubmitText(wfMsg('uploadstash-clear'));
     $form->prepareForm();
     $formResult = $form->tryAuthorizedSubmit();
     // show the files + form, if there are any, or just say there are none
     $refreshHtml = Html::element('a', array('href' => $this->getTitle()->getLocalURL()), wfMsg('uploadstash-refresh'));
     $files = $this->stash->listFiles();
     if (count($files)) {
         sort($files);
         $fileListItemsHtml = '';
         foreach ($files as $file) {
             // TODO: Use Linker::link or even construct the list in plain wikitext
             $fileListItemsHtml .= Html::rawElement('li', array(), Html::element('a', array('href' => $this->getTitle("file/{$file}")->getLocalURL()), $file));
         }
         $wgOut->addHtml(Html::rawElement('ul', array(), $fileListItemsHtml));
         $form->displayForm($formResult);
         $wgOut->addHtml(Html::rawElement('p', array(), $refreshHtml));
     } else {
         $wgOut->addHtml(Html::rawElement('p', array(), Html::element('span', array(), wfMsg('uploadstash-nofiles')) . ' ' . $refreshHtml));
     }
     return true;
 }
Exemplo n.º 7
0
 function getForm()
 {
     $fields = array();
     $fields['limit'] = array('type' => 'select', 'name' => 'limit', 'label-message' => 'table_pager_limit_label', 'options' => $this->getLimitSelectList(), 'default' => $this->mLimit);
     if (!$this->getConfig()->get('MiserMode')) {
         $fields['ilsearch'] = array('type' => 'text', 'name' => 'ilsearch', 'id' => 'mw-ilsearch', 'label-message' => 'listfiles_search_for', 'default' => $this->mSearch, 'size' => '40', 'maxlength' => '255');
     }
     $this->getOutput()->addModules('mediawiki.userSuggest');
     $fields['user'] = array('type' => 'text', 'name' => 'user', 'id' => 'mw-listfiles-user', 'label-message' => 'username', 'default' => $this->mUserName, 'size' => '40', 'maxlength' => '255', 'cssclass' => 'mw-autocomplete-user');
     $fields['ilshowall'] = array('type' => 'check', 'name' => 'ilshowall', 'id' => 'mw-listfiles-show-all', 'label-message' => 'listfiles-show-all', 'default' => $this->mShowAll);
     $query = $this->getRequest()->getQueryValues();
     unset($query['title']);
     unset($query['limit']);
     unset($query['ilsearch']);
     unset($query['ilshowall']);
     unset($query['user']);
     $form = new HTMLForm($fields, $this->getContext());
     $form->setMethod('get');
     $form->setTitle($this->getTitle());
     $form->setId('mw-listfiles-form');
     $form->setWrapperLegendMsg('listfiles');
     $form->setSubmitTextMsg('table_pager_limit_submit');
     $form->addHiddenFields($query);
     $form->prepareForm();
     $form->displayForm('');
 }
	public function execute( $par ) {

		$out = $this->getOutput();
		$lang = $this->getLanguage();
		$request = $this->getRequest();

		if( $request->wasPosted() ) {
			$out->disable();

			$action = $request->getVal( 'action' );
			$selection_name = $request->getText( 'selection' );

			if( $action == 'addtoselection' )  {
				$success = Selection::addEntries( $selection_name, $entries );
				$sel_page = new SpecialSelection();

				$url = $sel_page->getTitle()->getLinkUrl( array( 'name' => $selection_name ) );
				$return = array(
					'status' => $success,
					'selection_url' => $url
				);
			}
			echo json_encode($return);
			return;
		}

		$fields = array(
			'Project-Name' => array(
				'type' => 'text',
				'label-message' => 'ss-project',
				'tabindex' => '1'
			),
			'Importance' => array(
				'type' => 'text',
				'label-message' => 'ss-importance',
				'tabindex' => '2'
			),
			'Quality' => array(
				'type' => 'text',
				'label-message' => 'ss-quality',
				'tabindex' => '3'
			)
		);

		$project = $request->getText( 'wpProject' );
		$importance = $request->getText( 'wpImportance' );
		$quality = $request->getText( 'wpQuality' ); 

		$filters = array_filter( array(
			'r_project' => $project,
			'r_importance' => $importance,
			'r_quality' => $quality
		) );

		$this->setHeaders();
		$this->outputHeader();
		$out->setPageTitle( $this->msg( 'ss-filter-ratings' ) );

		$form = new HTMLForm( $fields, $this->getContext() );
		$form->setMethod( 'get' );
		$form->prepareForm();

		$form->displayForm( '' );

		$pager = new RatingsPager( $this, $filters );

		if ( $pager->getNumRows() ) {
			$out->addHTML(
				$pager->getNavigationBar() .
				$pager->getBody()
			);
		} else {
			$out->addWikiMsg( 'ss-ratings-empty' );
		}

		return;
	}