r93265 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93264‎ | r93265 | r93266 >
Date:13:28, 27 July 2011
Author:ialex
Status:ok
Tags:
Comment:
svn:eol-style native
Modified paths:
  • /trunk/extensions/Narayam/ext.narayam.rules.ne-inscript.js (modified) (history)
  • /trunk/extensions/Narayam/ext.narayam.rules.ne.js (modified) (history)
  • /trunk/extensions/PageSchemas/specials/PS_EditSchema.php (modified) (history)
  • /trunk/extensions/PageSchemas/specials/PS_GeneratePages.php (modified) (history)
  • /trunk/phase3/tests/phpunit/skins/SideBarTest.php (modified) (history)

Diff [purge]

Property changes on: trunk/phase3/tests/phpunit/skins/SideBarTest.php
___________________________________________________________________
Added: svn:eol-style
11 + native
Property changes on: trunk/extensions/Narayam/ext.narayam.rules.ne-inscript.js
___________________________________________________________________
Added: svn:eol-style
22 + native
Property changes on: trunk/extensions/Narayam/ext.narayam.rules.ne.js
___________________________________________________________________
Added: svn:eol-style
33 + native
Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php
@@ -1,84 +1,84 @@
2 -<?php
3 -/**
4 - * Displays an interface to let users create all pages based on xml
5 - *
6 - * @author Ankit Garg
7 - */
8 -
9 -class GeneratePages extends IncludableSpecialPage {
10 - function __construct() {
11 - parent::__construct( 'GeneratePages' );
12 - wfLoadExtensionMessages('GeneratePages');
13 - }
14 -
15 - function execute( $category ) {
16 - global $wgRequest, $wgOut;
17 - global $wgSkin;
18 - $this->setHeaders();
19 - $generate_page_text = wfMsg( 'ps-generatepages' );
20 - $generate_page_desc = wfMsg( 'ps-generatepages-desc' );
21 - $param = $wgRequest->getText('param');
22 - $text_1 = '<p>All pages will be generated! </p>';
23 - if ( $param != "" && $category != "" ) {
24 - $this->generate_pages( $param, $_POST['page'] );
25 - $wgOut->addHTML($text_1);
26 - }else {
27 - if( $category == ""){
28 - $cat_titles = array();
29 - $count_title = 0;
30 - $text = "";
31 - $dbr = wfGetDB( DB_SLAVE );
32 - //get the result set, query : slect page_props
33 - $res = $dbr->select( 'page_props',
34 - array(
35 - 'pp_page',
36 - 'pp_propname',
37 - 'pp_value'
38 - ),
39 - array(
40 - 'pp_propname' => 'PageSchema'
41 - )
42 - );
43 - while ( $row = $dbr->fetchRow( $res ) ) {
44 - if( $row[2] != null ){
45 - $page_id_cat = $row[0];
46 - if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
47 - $cat_text = Title::newFromId($page_id_cat)->getText();
48 - $generatePagesPage = SpecialPage::getTitleFor( 'GeneratePages' );
49 - $url = $generatePagesPage ->getFullURL() . '/' . $cat_text;
50 - $text .= '<a href='.$url.'>'.$cat_text.' </a> <br /> ';
51 - }
52 - }
53 - }
54 - $dbr->freeResult( $res );
55 - $wgOut->addHTML( $text );
56 - }else {
57 - //this is when Special:GeneratePages/Category is accessed first time
58 - //Here check for the valid Category name and allow for generating pages
59 - $pageSchemaObj = new PSSchema( $category );
60 - if(!$pageSchemaObj->isPSDefined()){
61 - $text = "<p>Error: there is no psssage schema defined for that category in the wiki. </p>";
62 - $wgOut->addHTML( $text );
63 - }else{
64 - $text_2 = '<p>'.$generate_page_desc.'</p> <form method="post"> <input type="hidden" name="param" value="'.$category.'" /><br /> ';
65 - //add code to generate a list of check-box for pages to be generated.
66 - $pageList = array();
67 - wfRunHooks( 'PageSchemasGetPageList', array( $pageSchemaObj, &$pageList )); //will return an array of string, with each value as a title of the page to be created.
68 - foreach( $pageList as $page ){
69 - //$page_link = $wgSkin->link( $page );
70 - $page_link = $page->getFullUrl();
71 - $page_val = PageSchemas::titleString( $page );
72 - $text_2 .= '<input type="checkbox" name="page[]" value="'.$page_val.'" /> '.$page_link.' <br />';
73 - }
74 - $text_2 .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> <br /> <br /></form>';
75 - $wgOut->addHTML($text_2);
76 - }
77 - }
78 - }
79 - }
80 - function generate_pages ( $categoryName, $toGenPageList ) {
81 - global $wgRequest, $wgOut;
82 - $pageSchema = new PSSchema( $categoryName );
83 - $pageSchema->generateAllPages( $toGenPageList );
84 - }
85 -}
 2+<?php
 3+/**
 4+ * Displays an interface to let users create all pages based on xml
 5+ *
 6+ * @author Ankit Garg
 7+ */
 8+
 9+class GeneratePages extends IncludableSpecialPage {
 10+ function __construct() {
 11+ parent::__construct( 'GeneratePages' );
 12+ wfLoadExtensionMessages('GeneratePages');
 13+ }
 14+
 15+ function execute( $category ) {
 16+ global $wgRequest, $wgOut;
 17+ global $wgSkin;
 18+ $this->setHeaders();
 19+ $generate_page_text = wfMsg( 'ps-generatepages' );
 20+ $generate_page_desc = wfMsg( 'ps-generatepages-desc' );
 21+ $param = $wgRequest->getText('param');
 22+ $text_1 = '<p>All pages will be generated! </p>';
 23+ if ( $param != "" && $category != "" ) {
 24+ $this->generate_pages( $param, $_POST['page'] );
 25+ $wgOut->addHTML($text_1);
 26+ }else {
 27+ if( $category == ""){
 28+ $cat_titles = array();
 29+ $count_title = 0;
 30+ $text = "";
 31+ $dbr = wfGetDB( DB_SLAVE );
 32+ //get the result set, query : slect page_props
 33+ $res = $dbr->select( 'page_props',
 34+ array(
 35+ 'pp_page',
 36+ 'pp_propname',
 37+ 'pp_value'
 38+ ),
 39+ array(
 40+ 'pp_propname' => 'PageSchema'
 41+ )
 42+ );
 43+ while ( $row = $dbr->fetchRow( $res ) ) {
 44+ if( $row[2] != null ){
 45+ $page_id_cat = $row[0];
 46+ if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
 47+ $cat_text = Title::newFromId($page_id_cat)->getText();
 48+ $generatePagesPage = SpecialPage::getTitleFor( 'GeneratePages' );
 49+ $url = $generatePagesPage ->getFullURL() . '/' . $cat_text;
 50+ $text .= '<a href='.$url.'>'.$cat_text.' </a> <br /> ';
 51+ }
 52+ }
 53+ }
 54+ $dbr->freeResult( $res );
 55+ $wgOut->addHTML( $text );
 56+ }else {
 57+ //this is when Special:GeneratePages/Category is accessed first time
 58+ //Here check for the valid Category name and allow for generating pages
 59+ $pageSchemaObj = new PSSchema( $category );
 60+ if(!$pageSchemaObj->isPSDefined()){
 61+ $text = "<p>Error: there is no psssage schema defined for that category in the wiki. </p>";
 62+ $wgOut->addHTML( $text );
 63+ }else{
 64+ $text_2 = '<p>'.$generate_page_desc.'</p> <form method="post"> <input type="hidden" name="param" value="'.$category.'" /><br /> ';
 65+ //add code to generate a list of check-box for pages to be generated.
 66+ $pageList = array();
 67+ wfRunHooks( 'PageSchemasGetPageList', array( $pageSchemaObj, &$pageList )); //will return an array of string, with each value as a title of the page to be created.
 68+ foreach( $pageList as $page ){
 69+ //$page_link = $wgSkin->link( $page );
 70+ $page_link = $page->getFullUrl();
 71+ $page_val = PageSchemas::titleString( $page );
 72+ $text_2 .= '<input type="checkbox" name="page[]" value="'.$page_val.'" /> '.$page_link.' <br />';
 73+ }
 74+ $text_2 .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> <br /> <br /></form>';
 75+ $wgOut->addHTML($text_2);
 76+ }
 77+ }
 78+ }
 79+ }
 80+ function generate_pages ( $categoryName, $toGenPageList ) {
 81+ global $wgRequest, $wgOut;
 82+ $pageSchema = new PSSchema( $categoryName );
 83+ $pageSchema->generateAllPages( $toGenPageList );
 84+ }
 85+}
Property changes on: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php
___________________________________________________________________
Added: svn:eol-style
8686 + native
Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
@@ -1,233 +1,233 @@
2 -<?php
3 -/**
4 - * Displays an interface to let users create all pages based on xml
5 - *
6 - * @author Ankit Garg
7 - */
8 -
9 -class EditSchema extends IncludableSpecialPage {
10 - function __construct() {
11 - parent::__construct( 'EditSchema' );
12 - wfLoadExtensionMessages('EditSchema');
13 - }
14 - public static function addJavascript() {
15 - global $wgOut;
16 -
17 - PageSchemas::addJavascriptAndCSS();
18 -
19 - // TODO - this should be in a JS file
20 - $template_name_error_str = wfMsg( 'sf_blank_error' );
21 - $jsText =<<<END
22 -<script type="text/javascript">
23 -var fieldNum = 1;
24 -var templateNum = 1;
25 -function createTemplateAddField(template_num) {
26 - fieldNum++;
27 - newField = jQuery('#starterField').clone().css('display', '').removeAttr('id');
28 - newHTML = newField.html().replace(/starter/g, fieldNum);
29 - newField.html(newHTML);
30 - newField.find(".deleteField").click( function() {
31 - // Remove the encompassing div for this instance.
32 - jQuery(this).closest(".fieldBox")
33 - .fadeOut('fast', function() { jQuery(this).remove(); });
34 - });
35 - jQuery('#fieldsList_'+template_num).append(newField);
36 -}
37 -function createAddTemplate() {
38 - templateNum++;
39 - newField = jQuery('#starterTemplate').clone().css('display', '').removeAttr('id');
40 - newHTML = newField.html().replace(/starter/g, templateNum);
41 - newField.html(newHTML);
42 - newField.find(".deleteTemplate").click( function() {
43 - // Remove the encompassing div for this instance.
44 - jQuery(this).closest(".templateBox")
45 - .fadeOut('fast', function() { jQuery(this).remove(); });
46 - });
47 - jQuery('#templatesList').append(newField);
48 -}
49 -function clickcheckbox(form){
50 -alert('Handler for .change() uncalled.');
51 -}
52 -
53 -jQuery(document).ready(function() {
54 - jQuery(".deleteField").click( function() {
55 - // Remove the encompassing div for this instance.
56 - jQuery(this).closest(".fieldBox")
57 - .fadeOut('fast', function() { jQuery(this).remove(); });
58 - });
59 - jQuery(".deleteTemplate").click( function() {
60 - // Remove the encompassing div for this instance.
61 - jQuery(this).closest(".templateBox")
62 - .fadeOut('fast', function() { jQuery(this).remove(); });
63 - });
64 -});
65 -
66 -</script>
67 -
68 -END;
69 - $wgOut->addScript( $jsText );
70 - }
71 -/*
72 -@TODO :Code which can be useful
73 -jQuery("#is_list_1").click(function() {
74 - if (jQuery("#is_list_1").is(":checked"))
75 - {
76 - alert('Handler for .change() called.');
77 - }else{
78 - alert('Handler for .change() uncalled.');
79 - }
80 - });
81 -*/
82 - function execute( $category ) {
83 - global $wgRequest, $wgOut;
84 - global $wgSkin;
85 - $this->setHeaders();
86 - $text_1 = '<p>This category does not exist yet. Create this category and its page schema: </p>';
87 - $text_2 = '<p>This category exists, but does not have a page schema. Create schema:" </p>';
88 - if ( $category != "" ) {
89 - $title = Title::newFromText( $category, NS_CATEGORY );
90 - $pageId = $title->getArticleID();
91 - $dbr = wfGetDB( DB_SLAVE );
92 - //get the result set, query : slect page_props
93 - $res = $dbr->select( 'page_props',
94 - array(
95 - 'pp_page',
96 - 'pp_propname',
97 - 'pp_value'
98 - ),
99 - array(
100 - 'pp_page' => $pageId,
101 - )
102 - );
103 - //first row of the result set
104 - $row = $dbr->fetchRow( $res );
105 - if( $row == null ){
106 - //Create form here
107 - self::addJavascript();
108 - $text = "";
109 - $text .= '<p>This category does not exist yet. Create this category and its page schema: </p>';
110 - $text .= ' <form id="createPageSchemaForm" action="" method="post">' . "\n";
111 - $text .= '<p>Name of schema: <input type="text" /> </p> ';
112 - $text .= '<p>Additional XML:
113 - <textarea rows=4 style="width: 100%" name="ps_add_xml"></textarea>
114 - </p> ';
115 - $text .= '<div id="templatesList">';
116 - $text .= '<div class="templateBox" >';
117 - $text .= '<fieldset style="background: #ddd;"><legend>Template</legend> ';
118 - $text .= '<p>Name: <input type="text" name="t_name_1"/></p> ';
119 - $text .= '<p><input type="checkbox" name="is_multiple_1"/> Allow multiple instances of this template</p> ';
120 - $text .= '<div id="fieldsList_1">';
121 - $text .= '<div class="fieldBox" >';
122 - $text .= '<fieldset style="background: #bbb;"><legend>Field</legend>
123 - <p>Field name: <input size="15" name="name_1">
124 - Display label: <input size="15" name="label_1">
125 - </p>
126 - <p><input type="checkbox" name="is_list_1" onclick="clickcheckbox(this)" />
127 - This field can hold a list of values
128 - </p>
129 - <p>Delimiter for values (default is ","): <input type="text" name="delimiter_1" /> </p>
130 - <p>Additional XML:
131 - <textarea rows=4 style="width: 100%" name="add_xml_1"></textarea>
132 - </p>
133 - <input type="button" value="Remove field" class="deleteField" /> </div>
134 -
135 -</div>
136 - </fieldset> ';
137 - $add_field_button = Xml::element( 'input',
138 - array(
139 - 'type' => 'button',
140 - 'value' => 'Add Field',
141 - 'onclick' => "createTemplateAddField(1)"
142 - )
143 - );
144 - $text .= Xml::tags( 'p', null, $add_field_button ) . "\n";
145 - $text .= '<hr />
146 - <p>Additional XML:
147 - <textarea rows=4 style="width: 100%" name="t_add_xml_1"></textarea>
148 - </p>
149 - <p><input type="button" value="Remove template" class="deleteTemplate" /></p>
150 - </fieldset> </div>';
151 - $text .= '<div class="templateBox" id="starterTemplate" style="display: none">
152 -<fieldset style="background: #ddd;">
153 -<legend>Template</legend>
154 -<p>Name: <input type="text" name="t_name_starter"/></p>
155 -<p><input type="checkbox" name="is_multiple_starter"/> Allow multiple instances of this template</p>
156 -<div id="fieldsList_starter">
157 -</div>
158 - <p><input type="button" value="Add Field" onclick="createTemplateAddField(starter)" /></p>
159 -
160 -<hr />
161 - <p>Additional XML:
162 - <textarea rows=4 style="width: 100%" name="t_add_xml_starter"></textarea>
163 - </p>
164 - <p><input type="button" value="Remove template" class="deleteTemplate" /></p>
165 - </fieldset>
166 - </div>
167 - </div>
168 - <hr /> ';
169 - $text .= '<div class="fieldBox" id="starterField" style="display: none">
170 - <fieldset style="background: #bbb;"><legend>Field</legend>
171 - <input size="15" name="name_starter">
172 - Display label: <input size="15" name="label_starter">
173 - </p>
174 - <p><input type="checkbox" name="is_list_starter" /> This field can hold a list of values, separated by commas
175 - &#160;&#160;
176 - <p>Delimiter for values (default is ","): <input type="text" name="delimiter_starter" /> </p>
177 - <p>Additional XML:
178 - <textarea rows=4 style="width: 100%" name="add_xml_starter"></textarea>
179 - </p>
180 - <input type="button" value="Remove field" class="deleteField" />
181 -</p>
182 -</fieldset>
183 -</div>';
184 - $add_template_button = Xml::element( 'input',
185 - array(
186 - 'type' => 'button',
187 - 'value' => 'Add Template',
188 - 'onclick' => "createAddTemplate()"
189 - )
190 - );
191 - $text .= Xml::tags( 'p', null, $add_template_button ) . "\n";
192 - $text .= ' <hr />
193 - <p><input type="submit" value="Save" /></p> ';
194 - $text .= ' </form>';
195 - $wgOut->addHTML( $text );
196 - }else{
197 - if( ($row[1] == 'PageSchema') && ($row[2] != null )){
198 -
199 - }else{
200 - $wgOut->addHTML($text_2);
201 - }
202 - }
203 - }else {
204 - $cat_titles = array();
205 - $count_title = 0;
206 - $text = "";
207 - $dbr = wfGetDB( DB_SLAVE );
208 - //get the result set, query : slect page_props
209 - $res = $dbr->select( 'page_props',
210 - array(
211 - 'pp_page',
212 - 'pp_propname',
213 - 'pp_value'
214 - ),
215 - array(
216 - 'pp_propname' => 'PageSchema'
217 - )
218 - );
219 - while ( $row = $dbr->fetchRow( $res ) ) {
220 - if( $row[2] != null ){
221 - $page_id_cat = $row[0];
222 - if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
223 - $cat_text = Title::newFromId($page_id_cat)->getText();
224 - $generatePagesPage = SpecialPage::getTitleFor( 'EditSchema' );
225 - $url = $generatePagesPage ->getFullURL() . '/' . $cat_text;
226 - $text .= '<a href='.$url.'>'.$cat_text.' </a> <br /> ';
227 - }
228 - }
229 - }
230 - $dbr->freeResult( $res );
231 - $wgOut->addHTML( $text );
232 - }
233 - }
234 -}
 2+<?php
 3+/**
 4+ * Displays an interface to let users create all pages based on xml
 5+ *
 6+ * @author Ankit Garg
 7+ */
 8+
 9+class EditSchema extends IncludableSpecialPage {
 10+ function __construct() {
 11+ parent::__construct( 'EditSchema' );
 12+ wfLoadExtensionMessages('EditSchema');
 13+ }
 14+ public static function addJavascript() {
 15+ global $wgOut;
 16+
 17+ PageSchemas::addJavascriptAndCSS();
 18+
 19+ // TODO - this should be in a JS file
 20+ $template_name_error_str = wfMsg( 'sf_blank_error' );
 21+ $jsText =<<<END
 22+<script type="text/javascript">
 23+var fieldNum = 1;
 24+var templateNum = 1;
 25+function createTemplateAddField(template_num) {
 26+ fieldNum++;
 27+ newField = jQuery('#starterField').clone().css('display', '').removeAttr('id');
 28+ newHTML = newField.html().replace(/starter/g, fieldNum);
 29+ newField.html(newHTML);
 30+ newField.find(".deleteField").click( function() {
 31+ // Remove the encompassing div for this instance.
 32+ jQuery(this).closest(".fieldBox")
 33+ .fadeOut('fast', function() { jQuery(this).remove(); });
 34+ });
 35+ jQuery('#fieldsList_'+template_num).append(newField);
 36+}
 37+function createAddTemplate() {
 38+ templateNum++;
 39+ newField = jQuery('#starterTemplate').clone().css('display', '').removeAttr('id');
 40+ newHTML = newField.html().replace(/starter/g, templateNum);
 41+ newField.html(newHTML);
 42+ newField.find(".deleteTemplate").click( function() {
 43+ // Remove the encompassing div for this instance.
 44+ jQuery(this).closest(".templateBox")
 45+ .fadeOut('fast', function() { jQuery(this).remove(); });
 46+ });
 47+ jQuery('#templatesList').append(newField);
 48+}
 49+function clickcheckbox(form){
 50+alert('Handler for .change() uncalled.');
 51+}
 52+
 53+jQuery(document).ready(function() {
 54+ jQuery(".deleteField").click( function() {
 55+ // Remove the encompassing div for this instance.
 56+ jQuery(this).closest(".fieldBox")
 57+ .fadeOut('fast', function() { jQuery(this).remove(); });
 58+ });
 59+ jQuery(".deleteTemplate").click( function() {
 60+ // Remove the encompassing div for this instance.
 61+ jQuery(this).closest(".templateBox")
 62+ .fadeOut('fast', function() { jQuery(this).remove(); });
 63+ });
 64+});
 65+
 66+</script>
 67+
 68+END;
 69+ $wgOut->addScript( $jsText );
 70+ }
 71+/*
 72+@TODO :Code which can be useful
 73+jQuery("#is_list_1").click(function() {
 74+ if (jQuery("#is_list_1").is(":checked"))
 75+ {
 76+ alert('Handler for .change() called.');
 77+ }else{
 78+ alert('Handler for .change() uncalled.');
 79+ }
 80+ });
 81+*/
 82+ function execute( $category ) {
 83+ global $wgRequest, $wgOut;
 84+ global $wgSkin;
 85+ $this->setHeaders();
 86+ $text_1 = '<p>This category does not exist yet. Create this category and its page schema: </p>';
 87+ $text_2 = '<p>This category exists, but does not have a page schema. Create schema:" </p>';
 88+ if ( $category != "" ) {
 89+ $title = Title::newFromText( $category, NS_CATEGORY );
 90+ $pageId = $title->getArticleID();
 91+ $dbr = wfGetDB( DB_SLAVE );
 92+ //get the result set, query : slect page_props
 93+ $res = $dbr->select( 'page_props',
 94+ array(
 95+ 'pp_page',
 96+ 'pp_propname',
 97+ 'pp_value'
 98+ ),
 99+ array(
 100+ 'pp_page' => $pageId,
 101+ )
 102+ );
 103+ //first row of the result set
 104+ $row = $dbr->fetchRow( $res );
 105+ if( $row == null ){
 106+ //Create form here
 107+ self::addJavascript();
 108+ $text = "";
 109+ $text .= '<p>This category does not exist yet. Create this category and its page schema: </p>';
 110+ $text .= ' <form id="createPageSchemaForm" action="" method="post">' . "\n";
 111+ $text .= '<p>Name of schema: <input type="text" /> </p> ';
 112+ $text .= '<p>Additional XML:
 113+ <textarea rows=4 style="width: 100%" name="ps_add_xml"></textarea>
 114+ </p> ';
 115+ $text .= '<div id="templatesList">';
 116+ $text .= '<div class="templateBox" >';
 117+ $text .= '<fieldset style="background: #ddd;"><legend>Template</legend> ';
 118+ $text .= '<p>Name: <input type="text" name="t_name_1"/></p> ';
 119+ $text .= '<p><input type="checkbox" name="is_multiple_1"/> Allow multiple instances of this template</p> ';
 120+ $text .= '<div id="fieldsList_1">';
 121+ $text .= '<div class="fieldBox" >';
 122+ $text .= '<fieldset style="background: #bbb;"><legend>Field</legend>
 123+ <p>Field name: <input size="15" name="name_1">
 124+ Display label: <input size="15" name="label_1">
 125+ </p>
 126+ <p><input type="checkbox" name="is_list_1" onclick="clickcheckbox(this)" />
 127+ This field can hold a list of values
 128+ </p>
 129+ <p>Delimiter for values (default is ","): <input type="text" name="delimiter_1" /> </p>
 130+ <p>Additional XML:
 131+ <textarea rows=4 style="width: 100%" name="add_xml_1"></textarea>
 132+ </p>
 133+ <input type="button" value="Remove field" class="deleteField" /> </div>
 134+
 135+</div>
 136+ </fieldset> ';
 137+ $add_field_button = Xml::element( 'input',
 138+ array(
 139+ 'type' => 'button',
 140+ 'value' => 'Add Field',
 141+ 'onclick' => "createTemplateAddField(1)"
 142+ )
 143+ );
 144+ $text .= Xml::tags( 'p', null, $add_field_button ) . "\n";
 145+ $text .= '<hr />
 146+ <p>Additional XML:
 147+ <textarea rows=4 style="width: 100%" name="t_add_xml_1"></textarea>
 148+ </p>
 149+ <p><input type="button" value="Remove template" class="deleteTemplate" /></p>
 150+ </fieldset> </div>';
 151+ $text .= '<div class="templateBox" id="starterTemplate" style="display: none">
 152+<fieldset style="background: #ddd;">
 153+<legend>Template</legend>
 154+<p>Name: <input type="text" name="t_name_starter"/></p>
 155+<p><input type="checkbox" name="is_multiple_starter"/> Allow multiple instances of this template</p>
 156+<div id="fieldsList_starter">
 157+</div>
 158+ <p><input type="button" value="Add Field" onclick="createTemplateAddField(starter)" /></p>
 159+
 160+<hr />
 161+ <p>Additional XML:
 162+ <textarea rows=4 style="width: 100%" name="t_add_xml_starter"></textarea>
 163+ </p>
 164+ <p><input type="button" value="Remove template" class="deleteTemplate" /></p>
 165+ </fieldset>
 166+ </div>
 167+ </div>
 168+ <hr /> ';
 169+ $text .= '<div class="fieldBox" id="starterField" style="display: none">
 170+ <fieldset style="background: #bbb;"><legend>Field</legend>
 171+ <input size="15" name="name_starter">
 172+ Display label: <input size="15" name="label_starter">
 173+ </p>
 174+ <p><input type="checkbox" name="is_list_starter" /> This field can hold a list of values, separated by commas
 175+ &#160;&#160;
 176+ <p>Delimiter for values (default is ","): <input type="text" name="delimiter_starter" /> </p>
 177+ <p>Additional XML:
 178+ <textarea rows=4 style="width: 100%" name="add_xml_starter"></textarea>
 179+ </p>
 180+ <input type="button" value="Remove field" class="deleteField" />
 181+</p>
 182+</fieldset>
 183+</div>';
 184+ $add_template_button = Xml::element( 'input',
 185+ array(
 186+ 'type' => 'button',
 187+ 'value' => 'Add Template',
 188+ 'onclick' => "createAddTemplate()"
 189+ )
 190+ );
 191+ $text .= Xml::tags( 'p', null, $add_template_button ) . "\n";
 192+ $text .= ' <hr />
 193+ <p><input type="submit" value="Save" /></p> ';
 194+ $text .= ' </form>';
 195+ $wgOut->addHTML( $text );
 196+ }else{
 197+ if( ($row[1] == 'PageSchema') && ($row[2] != null )){
 198+
 199+ }else{
 200+ $wgOut->addHTML($text_2);
 201+ }
 202+ }
 203+ }else {
 204+ $cat_titles = array();
 205+ $count_title = 0;
 206+ $text = "";
 207+ $dbr = wfGetDB( DB_SLAVE );
 208+ //get the result set, query : slect page_props
 209+ $res = $dbr->select( 'page_props',
 210+ array(
 211+ 'pp_page',
 212+ 'pp_propname',
 213+ 'pp_value'
 214+ ),
 215+ array(
 216+ 'pp_propname' => 'PageSchema'
 217+ )
 218+ );
 219+ while ( $row = $dbr->fetchRow( $res ) ) {
 220+ if( $row[2] != null ){
 221+ $page_id_cat = $row[0];
 222+ if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
 223+ $cat_text = Title::newFromId($page_id_cat)->getText();
 224+ $generatePagesPage = SpecialPage::getTitleFor( 'EditSchema' );
 225+ $url = $generatePagesPage ->getFullURL() . '/' . $cat_text;
 226+ $text .= '<a href='.$url.'>'.$cat_text.' </a> <br /> ';
 227+ }
 228+ }
 229+ }
 230+ $dbr->freeResult( $res );
 231+ $wgOut->addHTML( $text );
 232+ }
 233+ }
 234+}
Property changes on: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
___________________________________________________________________
Added: svn:eol-style
235235 + native

Status & tagging log