当前位置: 首页>>代码示例>>PHP>>正文


PHP SFUtils::titleURLString方法代码示例

本文整理汇总了PHP中SFUtils::titleURLString方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::titleURLString方法的具体用法?PHP SFUtils::titleURLString怎么用?PHP SFUtils::titleURLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFUtils的用法示例。


在下文中一共展示了SFUtils::titleURLString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createMarkup

    function createMarkup()
    {
        $title = Title::makeTitle(SF_NS_FORM, $this->mFormName);
        $fs = SFUtils::getSpecialPage('FormStart');
        $form_start_url = SFUtils::titleURLString($fs->getTitle()) . "/" . $title->getPartialURL();
        $form_description = wfMsgForContent('sf_form_docu', $this->mFormName, $form_start_url);
        $form_input = "{{#forminput:form=" . $this->mFormName;
        if (!is_null($this->mAssociatedCategory)) {
            $form_input .= "|autocomplete on category=" . $this->mAssociatedCategory;
        }
        $form_input .= "}}\n";
        $text = <<<END
<noinclude>
{$form_description}


{$form_input}
</noinclude><includeonly>

END;
        if (!empty($this->mPageNameFormula) || !empty($this->mCreateTitle) || !empty($this->mEditTitle)) {
            $text .= "{{{info";
            if (!empty($this->mPageNameFormula)) {
                $text .= "|page name=" . $this->mPageNameFormula;
            }
            if (!empty($this->mCreateTitle)) {
                $text .= "|create title=" . $this->mCreateTitle;
            }
            if (!empty($this->mEditTitle)) {
                $text .= "|edit title=" . $this->mEditTitle;
            }
            $text .= "}}}\n";
        }
        $text .= <<<END
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>

END;
        foreach ($this->mTemplates as $template) {
            $text .= $template->createMarkup() . "\n";
        }
        $free_text_label = wfMsgForContent('sf_form_freetextlabel');
        $text .= <<<END
'''{$free_text_label}:'''

{{{standard input|free text|rows=10}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>

END;
        return $text;
    }
开发者ID:yusufchang,项目名称:app,代码行数:57,代码来源:SF_Form.php

示例2: execute


//.........这里部分代码省略.........

		$datatype_labels = $smwgContLang->getDatatypeLabels();

		// make links to all the other 'Create...' pages, in order to
		// link to them at the top of the page
		$sk = $wgUser->getSkin();
		$creation_links = array();
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateProperty' );
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateTemplate' );
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateForm' );
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateCategory' );
		$create_class_docu = wfMsg( 'sf_createclass_docu', $wgLang->listToText( $creation_links ) );
		$leave_field_blank = wfMsg( 'sf_createclass_leavefieldblank' );
		$form_name_label = wfMsg( 'sf_createclass_nameinput' );
		$template_name_label = wfMsg( 'sf_createtemplate_namelabel' );
		$category_name_label = wfMsg( 'sf_createcategory_name' );
		$property_name_label = wfMsg( 'sf_createproperty_propname' );
		$field_name_label = wfMsg( 'sf_createtemplate_fieldname' );
		$type_label = wfMsg( 'sf_createproperty_proptype' );
		$allowed_values_label = wfMsg( 'sf_createclass_allowedvalues' );
		$list_of_values_label = wfMsg( 'sf_createclass_listofvalues' );

		$text = <<<END
<form action="" method="post">
	<p>$create_class_docu</p>
	<p>$leave_field_blank</p>
	<p>$template_name_label <input type="text" size="30" name="template_name"></p>
	<p>$form_name_label <input type="text" size="30" name="form_name"></p>
	<p>$category_name_label <input type="text" size="30" name="category_name"></p>
	<div>
		<table id="mainTable">
		<tr>
			<th colspan="2">$property_name_label</th>
			<th>$field_name_label</th>
			<th>$type_label</th>
			<th>$allowed_values_label</th>
			<th>$list_of_values_label</th>
		</tr>

END;
		// Make one more row than what we're displaying - use the
		// last row as a "starter row", to be cloned when the
		// "Add another" button is pressed.
		for ( $i = 1; $i <= $numStartingRows + 1; $i++ ) {
			if ( $i == $numStartingRows + 1 ) {
				$rowString = 'id="starterRow" style="display: none"';
				$n = 'starter';
			} else {
				$rowString = '';
				$n = $i;
			}
			$text .= <<<END
		<tr $rowString>
			<td>$n.</td>
			<td><input type="text" size="25" name="property_name_$n" /></td>
			<td><input type="text" size="25" name="field_name_$n" /></td>
			<td>
			<select name="property_type_$n">

END;
			$optionsStr ="";
			foreach ( $datatype_labels as $label ) {
				$text .= "				<option>$label</option>\n";
				$optionsStr .= $label . ",";
			}
			$text .= <<<END
			</select>
			</td>
			<td><input type="text" size="25" name="allowed_values_$n" /></td>
			<td><input type="checkbox" name="is_list_$n" /></td>

END;
		}
		$text .= <<<END
		</tr>
		</table>
	</div>

END;
		$add_another_button = Html::element( 'input',
			array(
				'type' => 'button',
				'value' => wfMsg( 'sf_formedit_addanother' ),
				'onclick' => "createClassAddRow()"
			)
		);
		$text .= Html::rawElement( 'p', null, $add_another_button ) . "\n";
		// Set 'title' as hidden field, in case there's no URL niceness
		$cc = $this->getTitle();
		$text .= SFFormUtils::hiddenFieldHTML( 'title', SFUtils::titleURLString( $cc ) );
		$text .= Html::element( 'input',
			array(
				'type' => 'submit',
				'name' => 'save',
				'value' => wfMsg( 'sf_createclass_create' )
			)
		);
		$text .= "</form>\n";
		$wgOut->addHTML( $text );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SF_CreateClass.php

示例3: getFormEditLinkForPage

 /**
  * Helper function for formEditLink() - gets the 'default form' and
  * 'alternate form' properties for a page, and creates the
  * corresponding Special:FormEdit link, if any such properties are
  * defined
  */
 static function getFormEditLinkForPage($target_page_title, $page_name, $page_namespace)
 {
     $default_forms = self::getFormsThatPagePointsTo($page_name, $page_namespace, self::DEFAULT_FORM);
     $alt_forms = self::getFormsThatPagePointsTo($page_name, $page_namespace, self::ALTERNATE_FORM);
     if (count($default_forms) == 0 && count($alt_forms) == 0) {
         return null;
     }
     $fe = SpecialPageFactory::getPage('FormEdit');
     $fe_url = $fe->getTitle()->getLocalURL();
     if (count($default_forms) > 0) {
         $form_edit_url = $fe_url . "/" . $default_forms[0] . "/" . SFUtils::titleURLString($target_page_title);
     } else {
         $form_edit_url = $fe_url;
         $form_edit_url .= strpos($form_edit_url, "?") ? "&" : "?";
         $form_edit_url .= 'target=' . urlencode(SFUtils::titleString($target_page_title));
     }
     foreach ($alt_forms as $i => $alt_form) {
         $form_edit_url .= strpos($form_edit_url, "?") ? "&" : "?";
         $form_edit_url .= "alt_form[{$i}]={$alt_form}";
     }
     // Add "redlink=1" to the query string, so that the user will
     // go to the actual page if it now exists.
     $form_edit_url .= strpos($form_edit_url, "?") ? "&" : "?";
     $form_edit_url .= "redlink=1";
     return $form_edit_url;
 }
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:32,代码来源:SF_FormLinker.php

示例4: getFormEditLinkForPage

	/**
	 * Helper function for formEditLink() - gets the 'default form' and
	 * 'alternate form' properties for a page, and creates the
	 * corresponding Special:FormEdit link, if any such properties are
	 * defined
	 */
	static function getFormEditLinkForPage( $target_page_title, $page_name, $page_namespace ) {
		$default_forms = self::getFormsThatPagePointsTo( $page_name, $page_namespace, self::DEFAULT_FORM );
		$alt_forms = self::getFormsThatPagePointsTo( $page_name, $page_namespace, self::ALTERNATE_FORM );

		if ( ( count( $default_forms ) == 0 ) && ( count( $alt_forms ) == 0 ) ) {
			return null;
		}

		$fe = SFUtils::getSpecialPage( 'FormEdit' );

		$fe_url = $fe->getTitle()->getLocalURL();
		if ( count( $default_forms ) > 0 ) {
			$form_edit_url = $fe_url . "/" . $default_forms[0] . "/" . SFUtils::titleURLString( $target_page_title );
		} else {
			$form_edit_url = $fe_url . "/" . SFUtils::titleURLString( $target_page_title );
		}
		foreach ( $alt_forms as $i => $alt_form ) {
			$form_edit_url .= ( strpos( $form_edit_url, "?" ) ) ? "&" : "?";
			$form_edit_url .= "alt_form[$i]=$alt_form";
		}
		return $form_edit_url;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:28,代码来源:SF_FormLinker.php

示例5: doRedirect

    function doRedirect($form_name, $page_name, $params)
    {
        global $wgOut;
        $page_title = Title::newFromText($page_name);
        if ($page_title->exists()) {
            // It exists - see if page is a redirect; if
            // it is, edit the target page instead.
            $article = new Article($page_title, 0);
            $article->loadContent();
            $redirect_title = Title::newFromRedirect($article->fetchContent());
            if ($redirect_title != null) {
                $page_title = $redirect_title;
                $page_name = SFUtils::titleURLString($redirect_title);
            }
            // HACK - if this is the default form for
            // this page, send to the regular 'formedit'
            // tab page; otherwise, send to the 'Special:FormEdit'
            // page, with the form name hardcoded.
            // Is this logic necessary? Or should we just
            // out-guess the user and always send to the
            // standard form-edit page, with the 'correct' form?
            $default_forms = SFFormLinker::getDefaultFormsForPage($page_title);
            if (count($default_forms) > 0) {
                $default_form_name = $default_forms[0];
            } else {
                $default_form_name = null;
            }
            if ($form_name == $default_form_name) {
                $redirect_url = $page_title->getLocalURL('action=formedit');
            } else {
                $redirect_url = self::getFormEditURL($form_name, $page_name);
            }
        } else {
            $redirect_url = self::getFormEditURL($form_name, $page_name);
            // Of all the request values, send on to 'FormEdit'
            // only 'preload' and specific form fields - we can
            // identify the latter because they show up as arrays.
            foreach ($_REQUEST as $key => $val) {
                if (is_array($val)) {
                    $template_name = urlencode($key);
                    foreach ($val as $field_name => $value) {
                        $field_name = urlencode($field_name);
                        $value = urlencode($value);
                        $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                        $redirect_url .= $template_name . '[' . $field_name . ']=' . $value;
                    }
                } elseif ($key == 'preload') {
                    $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                    $redirect_url .= "{$key}={$val}";
                }
            }
        }
        if (!is_null($params) && $params !== '') {
            $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
            $redirect_url .= $params;
        }
        $wgOut->setArticleBodyOnly(true);
        // Show "loading" animated image while people wait for the
        // redirect.
        global $sfgScriptPath;
        $text = "<p style=\"position: absolute; left: 45%; top: 45%;\"><img src=\"{$sfgScriptPath}/skins/loading.gif\" /></p>\n";
        $text .= <<<END
\t\t<script type="text/javascript">
\t\twindow.onload = function() {
\t\t\twindow.location="{$redirect_url}";
\t\t}
\t\t</script>

END;
        $wgOut->addHTML($text);
        return;
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:72,代码来源:SF_FormStart.php

示例6: execute


//.........这里部分代码省略.........
        $category_name_label = wfMessage('sf_createcategory_name')->text();
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'category_name'), $category_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'category_name', 'id' => 'category_name'), null)) . "\n";
        if (defined('CARGO_VERSION') && !defined('SMW_VERSION')) {
            $cargo_table_label = wfMessage('sf_createtemplate_cargotablelabel')->escaped();
            $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'cargo_table'), $cargo_table_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'cargo_table', 'id' => 'cargo_table'), null)) . "\n";
        }
        $text .= "\t" . Html::element('br', null, null) . "\n";
        $text .= <<<END
\t<div>
\t\t<table id="mainTable" style="border-collapse: collapse;">

END;
        if (defined('SMW_VERSION')) {
            $property_label = wfMessage('smw_pp_type')->escaped();
            $text .= <<<END
\t\t<tr>
\t\t\t<th colspan="3" />
\t\t\t<th colspan="3" style="background: #ddeebb; padding: 4px;">{$property_label}</th>
\t\t</tr>

END;
        }
        $field_name_label = wfMessage('sf_createtemplate_fieldname')->escaped();
        $list_of_values_label = wfMessage('sf_createclass_listofvalues')->escaped();
        $text .= <<<END
\t\t<tr>
\t\t\t<th colspan="2">{$field_name_label}</th>
\t\t\t<th style="padding: 4px;">{$list_of_values_label}</th>

END;
        if (defined('SMW_VERSION')) {
            $property_name_label = wfMessage('sf_createproperty_propname')->escaped();
            $text .= <<<END
\t\t\t<th style="background: {$specialBGColor}; padding: 4px;">{$property_name_label}</th>

END;
        }
        $type_label = wfMessage('sf_createproperty_proptype')->escaped();
        $allowed_values_label = wfMessage('sf_createclass_allowedvalues')->escaped();
        $text .= <<<END
\t\t\t<th style="background: {$specialBGColor}; padding: 4px;">{$type_label}</th>
\t\t\t<th style="background: {$specialBGColor}; padding: 4px;">{$allowed_values_label}</th>
\t\t</tr>

END;
        // Make one more row than what we're displaying - use the
        // last row as a "starter row", to be cloned when the
        // "Add another" button is pressed.
        for ($i = 1; $i <= $numStartingRows + 1; $i++) {
            if ($i == $numStartingRows + 1) {
                $rowString = 'id="starterRow" style="display: none"';
                $n = 'starter';
            } else {
                $rowString = '';
                $n = $i;
            }
            $text .= <<<END
\t\t<tr {$rowString} style="margin: 4px;">
\t\t\t<td>{$n}.</td>
\t\t\t<td><input type="text" size="25" name="field_name_{$n}" /></td>
\t\t\t<td style="text-align: center;"><input type="checkbox" name="is_list_{$n}" /></td>

END;
            if (defined('SMW_VERSION')) {
                $text .= <<<END
\t\t\t<td style="background: {$specialBGColor}; padding: 4px;"><input type="text" size="25" name="property_name_{$n}" /></td>

END;
            }
            $text .= <<<END
\t\t\t<td style="background: {$specialBGColor}; padding: 4px;">

END;
            $typeDropdownBody = '';
            foreach ($possibleTypes as $typeName) {
                $typeDropdownBody .= "\t\t\t\t<option>{$typeName}</option>\n";
            }
            $text .= "\t\t\t\t" . Html::rawElement('select', array('name' => "property_type_{$n}"), $typeDropdownBody) . "\n";
            $text .= <<<END
\t\t\t</td>
\t\t\t<td style="background: {$specialBGColor}; padding: 4px;"><input type="text" size="25" name="allowed_values_{$n}" /></td>

END;
        }
        $text .= <<<END
\t\t</tr>
\t\t</table>
\t</div>

END;
        $add_another_button = Html::element('input', array('type' => 'button', 'value' => wfMessage('sf_formedit_addanother')->text(), 'class' => "createClassAddRow"));
        $text .= Html::rawElement('p', null, $add_another_button) . "\n";
        // Set 'title' as hidden field, in case there's no URL niceness
        $cc = $this->getTitle();
        $text .= Html::hidden('title', SFUtils::titleURLString($cc));
        $text .= "\t" . Html::hidden('csrf', $this->getUser()->getEditToken('CreateClass')) . "\n";
        $text .= Html::element('input', array('type' => 'submit', 'name' => 'createAll', 'value' => wfMessage('sf_createclass_create')->text()));
        $text .= "</form>\n";
        $out->addHTML($text);
    }
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:101,代码来源:SF_CreateClass.php

示例7: createMarkup

    function createMarkup($standardInputs = array(), $freeTextLabel = null)
    {
        $title = Title::makeTitle(SF_NS_FORM, $this->mFormName);
        $fs = SpecialPageFactory::getPage('FormStart');
        $form_start_url = SFUtils::titleURLString($fs->getTitle()) . "/" . $title->getPartialURL();
        $form_description = wfMessage('sf_form_docu', $this->mFormName, $form_start_url)->inContentLanguage()->text();
        $form_input = "{{#forminput:form=" . $this->mFormName;
        if (!is_null($this->mAssociatedCategory)) {
            $form_input .= "|autocomplete on category=" . $this->mAssociatedCategory;
        }
        $form_input .= "}}\n";
        $text = <<<END
<noinclude>
{$form_description}


{$form_input}
</noinclude><includeonly>

END;
        if (!empty($this->mPageNameFormula) || !empty($this->mCreateTitle) || !empty($this->mEditTitle)) {
            $text .= "{{{info";
            if (!empty($this->mPageNameFormula)) {
                $text .= "|page name=" . $this->mPageNameFormula;
            }
            if (!empty($this->mCreateTitle)) {
                $text .= "|create title=" . $this->mCreateTitle;
            }
            if (!empty($this->mEditTitle)) {
                $text .= "|edit title=" . $this->mEditTitle;
            }
            $text .= "}}}\n";
        }
        $text .= <<<END
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>

END;
        foreach ($this->mItems as $item) {
            if ($item['type'] == 'template') {
                $template = $item['item'];
                $text .= $template->createMarkup() . "\n";
            } elseif ($item['type'] == 'section') {
                $section = $item['item'];
                $text .= $section->createMarkup() . "\n";
            }
        }
        if (is_null($freeTextLabel)) {
            $freeTextLabel = wfMessage('sf_form_freetextlabel')->inContentLanguage()->text();
        }
        // Add in standard inputs if they were specified.
        if (count($standardInputs) > 0) {
            if (array_key_exists('free text', $standardInputs)) {
                $text .= "'''{$freeTextLabel}:'''\n\n";
                $text .= $standardInputs['free text'] . "\n\n\n";
            }
            if (array_key_exists('summary', $standardInputs)) {
                $text .= $standardInputs['summary'] . "\n\n";
            }
            if (array_key_exists('minor edit', $standardInputs)) {
                $text .= $standardInputs['minor edit'] . ' ';
            }
            if (array_key_exists('watch', $standardInputs)) {
                $text .= $standardInputs['watch'];
            }
            if (array_key_exists('minor edit', $standardInputs) || array_key_exists('watch', $standardInputs)) {
                $text .= "\n\n";
            }
            if (array_key_exists('save', $standardInputs)) {
                $text .= $standardInputs['save'] . ' ';
            }
            if (array_key_exists('preview', $standardInputs)) {
                $text .= $standardInputs['preview'] . ' ';
            }
            if (array_key_exists('changes', $standardInputs)) {
                $text .= $standardInputs['changes'] . ' ';
            }
            if (array_key_exists('cancel', $standardInputs)) {
                $text .= $standardInputs['cancel'];
            }
        } else {
            $text .= <<<END
'''{$freeTextLabel}:'''

{{{standard input|free text|rows=10}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
END;
        }
        $text .= "\n</includeonly>\n";
        return $text;
    }
开发者ID:whysasse,项目名称:kmwiki,代码行数:96,代码来源:SF_Form.php

示例8: doRedirect

    function doRedirect($form_name, $page_name, $params)
    {
        global $wgOut;
        $page_title = Title::newFromText($page_name);
        if ($page_title->exists()) {
            // It exists - see if page is a redirect; if
            // it is, edit the target page instead.
            $article = new Article($page_title, 0);
            $article->loadContent();
            $redirect_title = Title::newFromRedirect($article->fetchContent());
            if ($redirect_title != null) {
                $page_title = $redirect_title;
                $page_name = SFUtils::titleURLString($redirect_title);
            }
            // HACK - if this is the default form for
            // this page, send to the regular 'formedit'
            // tab page; otherwise, send to the 'Special:FormEdit'
            // page, with the form name hardcoded.
            // Is this logic necessary? Or should we just
            // out-guess the user and always send to the
            // standard form-edit page, with the 'correct' form?
            $default_forms = SFFormLinker::getDefaultFormsForPage($page_title);
            if (count($default_forms) > 0) {
                $default_form_name = $default_forms[0];
            } else {
                $default_form_name = null;
            }
            if ($form_name == $default_form_name) {
                $redirect_url = $page_title->getLocalURL('action=formedit');
            } else {
                $redirect_url = self::getFormEditURL($form_name, $page_name);
            }
        } else {
            $redirect_url = self::getFormEditURL($form_name, $page_name);
            // Of all the request values, send on to 'FormEdit'
            // only 'preload' and specific form fields - we can
            // identify the latter because they show up as arrays.
            foreach ($_REQUEST as $key => $val) {
                if (is_array($val)) {
                    $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                    // Re-add the key (i.e. the template
                    // name), so we can make a nice query
                    // string snippet out of the whole
                    // thing.
                    $wrapperArray = array($key => $val);
                    $redirect_url .= urldecode(http_build_query($wrapperArray));
                } elseif ($key == 'preload') {
                    $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                    $redirect_url .= "{$key}={$val}";
                }
            }
        }
        if (!is_null($params) && $params !== '') {
            $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
            $redirect_url .= $params;
        }
        $wgOut->setArticleBodyOnly(true);
        // Show "loading" animated image while people wait for the
        // redirect.
        global $sfgScriptPath;
        $text = <<<END
\t<p style="position: absolute; left: 45%; top: 45%;">
\t<img src="{$sfgScriptPath}/skins/loading.gif" />
\t</p>
 \t<meta http-equiv="refresh" content="0; url={$redirect_url}" />

END;
        $wgOut->addHTML($text);
        return;
    }
开发者ID:roland2025,项目名称:mediawiki-extensions-SemanticForms,代码行数:70,代码来源:SF_FormStart.php

示例9: execute


//.........这里部分代码省略.........
            return;
        }
        $this->setHeaders();
        $wgOut->addExtensionStyle($sfgScriptPath . "/skins/SemanticForms.css");
        $numStartingRows = 5;
        self::addJavascript($numStartingRows);
        $createAll = $wgRequest->getCheck('createAll');
        if ($createAll) {
            self::createAllPages();
            return;
        }
        $datatypeLabels = $smwgContLang->getDatatypeLabels();
        // Make links to all the other 'Create...' pages, in order to
        // link to them at the top of the page.
        $creation_links = array();
        $creation_links[] = SFUtils::linkForSpecialPage('CreateProperty');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateTemplate');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateForm');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateCategory');
        $form_name_label = wfMessage('sf_createclass_nameinput')->text();
        $category_name_label = wfMessage('sf_createcategory_name')->text();
        $field_name_label = wfMessage('sf_createtemplate_fieldname')->text();
        $list_of_values_label = wfMessage('sf_createclass_listofvalues')->text();
        $property_name_label = wfMessage('sf_createproperty_propname')->text();
        $type_label = wfMessage('sf_createproperty_proptype')->text();
        $allowed_values_label = wfMessage('sf_createclass_allowedvalues')->text();
        $text = '<form action="" method="post">' . "\n";
        $text .= "\t" . Html::rawElement('p', null, wfMessage('sf_createclass_docu', $wgLang->listToText($creation_links))->text()) . "\n";
        $templateNameLabel = wfMessage('sf_createtemplate_namelabel')->text();
        $templateNameInput = Html::input('template_name', null, 'text', array('size' => 30));
        $text .= "\t" . Html::rawElement('p', null, $templateNameLabel . ' ' . $templateNameInput) . "\n";
        $templateInfo = SFCreateTemplate::printTemplateStyleInput('template_format');
        $templateInfo .= Html::rawElement('p', null, Html::element('input', array('type' => 'checkbox', 'name' => 'template_multiple', 'id' => 'template_multiple', 'onclick' => "disableFormAndCategoryInputs()")) . ' ' . wfMessage('sf_createtemplate_multipleinstance')->text()) . "\n";
        $text .= Html::rawElement('blockquote', null, $templateInfo);
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'form_name'), $form_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'form_name', 'id' => 'form_name'), null)) . "\n";
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'category_name'), $category_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'category_name', 'id' => 'category_name'), null)) . "\n";
        $text .= "\t" . Html::element('br', null, null) . "\n";
        $property_label = wfMessage('smw_pp_type')->text();
        $text .= <<<END
\t<div>
\t\t<table id="mainTable" style="border-collapse: collapse;">
\t\t<tr>
\t\t\t<th colspan="3" />
\t\t\t<th colspan="3" style="background: #ddeebb; padding: 4px;">{$property_label}</th>
\t\t</tr>
\t\t<tr>
\t\t\t<th colspan="2">{$field_name_label}</th>
\t\t\t<th style="padding: 4px;">{$list_of_values_label}</th>
\t\t\t<th style="background: #eeffcc; padding: 4px;">{$property_name_label}</th>
\t\t\t<th style="background: #eeffcc; padding: 4px;">{$type_label}</th>
\t\t\t<th style="background: #eeffcc; padding: 4px;">{$allowed_values_label}</th>
\t\t</tr>

END;
        // Make one more row than what we're displaying - use the
        // last row as a "starter row", to be cloned when the
        // "Add another" button is pressed.
        for ($i = 1; $i <= $numStartingRows + 1; $i++) {
            if ($i == $numStartingRows + 1) {
                $rowString = 'id="starterRow" style="display: none"';
                $n = 'starter';
            } else {
                $rowString = '';
                $n = $i;
            }
            $text .= <<<END
\t\t<tr {$rowString} style="margin: 4px;">
\t\t\t<td>{$n}.</td>
\t\t\t<td><input type="text" size="25" name="field_name_{$n}" /></td>
\t\t\t<td style="text-align: center;"><input type="checkbox" name="is_list_{$n}" /></td>
\t\t\t<td style="background: #eeffcc; padding: 4px;"><input type="text" size="25" name="property_name_{$n}" /></td>
\t\t\t<td style="background: #eeffcc; padding: 4px;">

END;
            $typeDropdownBody = '';
            foreach ($datatypeLabels as $label) {
                $typeDropdownBody .= "\t\t\t\t<option>{$label}</option>\n";
            }
            $text .= "\t\t\t\t" . Html::rawElement('select', array('name' => "property_type_{$n}"), $typeDropdownBody) . "\n";
            $text .= <<<END
\t\t\t</td>
\t\t\t<td style="background: #eeffcc; padding: 4px;"><input type="text" size="25" name="allowed_values_{$n}" /></td>

END;
        }
        $text .= <<<END
\t\t</tr>
\t\t</table>
\t</div>

END;
        $add_another_button = Html::element('input', array('type' => 'button', 'value' => wfMessage('sf_formedit_addanother')->text(), 'onclick' => "createClassAddRow()"));
        $text .= Html::rawElement('p', null, $add_another_button) . "\n";
        // Set 'title' as hidden field, in case there's no URL niceness
        $cc = $this->getTitle();
        $text .= Html::hidden('title', SFUtils::titleURLString($cc));
        $text .= Html::element('input', array('type' => 'submit', 'name' => 'createAll', 'value' => wfMessage('sf_createclass_create')->text()));
        $text .= "</form>\n";
        $wgOut->addHTML($text);
    }
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:SF_CreateClass.php


注:本文中的SFUtils::titleURLString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。