Extension talk:Page Schemas/Archive 2016 to 2022

Latest comment: 1 year ago by 90.160.205.38 in topic A couple of errors

A couple of errors

Forgive me, I am new to MediaWiki and this extension. This might be blindingly obvious to others, but I am stumped. I'd like a pointer where to look in my configuration to address two issues:

1) Creating or Editing a schema throws the following errors:

Warning: Illegal offset type in isset or empty in /home/eat/wiki/includes/Html.php on line 698
Warning: Illegal offset type in isset or empty in /home/eat/wiki/includes/Html.php on line 706
Warning: Illegal offset type in isset or empty in /home/eat/wiki/includes/Html.php on line 296
Warning: Cannot modify header information - headers already sent by (output started at /home/eat/wiki/includes/Html.php:296) in /home/eat/wiki/includes/WebResponse.php on line 75

Generate Pages throws the following

[58a916bae31fcc06947f7174] /index.php?title=Category:Cheese&action=generatepages Error: Call to undefined method PageSchemas::titleString()

Backtrace:

from /home/eat/wiki/extensions/PageForms/includes/PF_PageSchemas.php(679)
#0 /home/eat/wiki/extensions/PageSchemas/includes/PSSchema.php(96): PFPageSchemas::generatePages(PSSchema, array)
#1 /home/eat/wiki/extensions/PageSchemas/includes/specials/PSGeneratePages.php(121): PSSchema->generateAllPages(array)
#2 /home/eat/wiki/extensions/PageSchemas/includes/specials/PSGeneratePages.php(36): PSGeneratePages->generatePages(string, array)
#3 /home/eat/wiki/extensions/PageSchemas/includes/PSGeneratePagesAction.php(37): PSGeneratePages->execute(string)
#4 /home/eat/wiki/includes/MediaWiki.php(543): PSGeneratePagesAction->show()
#5 /home/eat/wiki/includes/MediaWiki.php(321): MediaWiki->performAction(MediaWiki\Extension\CategoryTree\CategoryTreeCategoryPage, Title)
#6 /home/eat/wiki/includes/MediaWiki.php(912): MediaWiki->performRequest()
#7 /home/eat/wiki/includes/MediaWiki.php(563): MediaWiki->main()
#8 /home/eat/wiki/index.php(53): MediaWiki->run()
#9 /home/eat/wiki/index.php(46): wfIndexMain()
#10 {main}
I'm not sure about the first one, but the second one is a real problem, and it's my fault. I removed the function PageSchemas::titleString() in the recently-released version 0.7 of Page Schemas, not aware that it was being used in the Page Forms extension. I removed this usage from Page Forms last week, but I haven't released a new version of Page Forms yet - so the current versions of Page Schemas and Page Forms are incompatible. The easiest fix for this is to switch to the latest Page Forms code, using Git, if you know how to do that. Once you have this problem fixed, in one way or another, hopefully the rest will work as well. Yaron Koren (talk) 13:40, 28 September 2022 (UTC)Reply
That does indeed fix the second issue. Still no idea why the first issue exists. It only appears if
ini_set( 'display_errors', 1 );
exists in LocalSettings.php, so it can be mostly ignored I suppose 90.160.205.38 20:41, 28 September 2022 (UTC)Reply

Only for editors

Is it possible to use <span class="onlyforeditors">{{{Lorem ipsum|}}}</span> in combination with Page Schemas?

What is "onlyforeditors"? Yaron Koren (talk) 17:22, 15 May 2018 (UTC)Reply

I think I can help here by clarifying things: what we would like to have is something like this in the schema XML:

<Field name="somefieldname" display="nonempty" displayclass="somehtmlclassname">

This should result to this in the generated template:

{#if:{{{somefieldname|}}}|
{{!}}- class="somehtmlclassname"
! somefieldlabel
{{!}} [[somepropertyname::{{{somefieldname|}}}]]}}

Is this possible? Does it need a code change? If yes, any hints where and how complex?

I don't think there's any way to add an HTML class to a generated table row, unfortunately. I don't know how complex it would be to add it. Yaron Koren (talk) 17:23, 23 May 2018 (UTC)Reply

Change allowed values

If I change the names of the allowed values (e.g. to correct a typo) I get the message "[new name] is not in the list of the allowed values of the ... property". Is it possible to change the spelling of the allowed values?

The ReplaceText extension may help with this, if I understand the issue correctly. Yaron Koren (talk) 14:26, 19 March 2018 (UTC)Reply

Customise templates

This is similar to a query back in 2014 (#Adding additional information to generated templates) but I wondered if anything had changed. I would like to add some custom information to the template, but each time I edit the Schema and generate pages, this is lost. (In my case I'd like to add a Cargo query which displays a location on a map.) Is this possible, without having to manually cut and paste each time? Thanks. Jonathan3 (talk) 23:41, 21 November 2016 (UTC)Reply

Still no. There's a lot that could be improved in Page Schemas - it's not that popular an extension, I don't think, so it hasn't gotten a lot of attention. Yaron Koren (talk) 03:30, 22 November 2016 (UTC)Reply
That's a shame, as the ability easily to change the data structure and the associated template/form pages seems invaluable. I found it very useful at the start when working things out. Jonathan3 (talk) 00:37, 3 December 2016 (UTC)Reply
Regarding "popularity", I've tried both the manual and the schema way, and this extension has the potential to make really smooth the use of of Forms. And this little feature is the stumbling block. Untill it's fixed, you have to edit + generate forms in 2-steps, to redo customizations.
Thanks anyways Ankostis (talk) 02:41, 20 September 2018 (UTC)Reply


tooltips in page forms using Cargo

--138.232.124.69 12:42, 28 March 2018 (UTC)Reply

Since switching to Cargo from SMW the tooltips I have on my forms don't display as tooltips. They're just text on the page, even though the schema generator has this notation in it "Show description as pop-up tooltip"

I'm guessing that the template is calling #info. That's no longer working because #info is defined by SMW (strangely, SMW includes its own tooltip functionality). I would recommend installing the SimpleTooltip extension - then, if you recreate the template from the schema, the #info calls will hopefully get changed to #tip-text calls. Yaron Koren (talk) 14:01, 2 June 2017 (UTC)Reply
that does it! The new class is actually: #tip-info cheers --Anrake (talk) 14:53, 2 June 2017 (UTC)Reply

Jobs not running

I've had several Page Schemas jobs in the queue for over 3 days. I'm adding a new category and want to use it to scaffold the template, form and new semantic properties. I've tried all the tricks I can find to force them to run including changing job_attempts to 0, various combinations of $wgJobRunRate and $wgRunJobsAsync but nothing seems to work. Tonight I tried to delete the jobs and run Generate Pages again, but they still got stuck. I even ran update.php and rebuilt the Semantic index. The last time I used Page Schemas was probably last July. Are there any ideas to force these to run?

MediaWiki 1.28.0 PHP 5.6.33 (cgi-fcgi) MySQL 5.6.38-83.0 Semantic MediaWiki 2.5.5 Page Schemas 0.4.6

--Anrake (talk) 11:39, 22 January 2018 (UTC)Reply

Have you tried calling runJobs.php? Yaron Koren (talk) 14:08, 22 January 2018 (UTC)Reply
yeah, many times. --Anrake (talk) 14:43, 22 January 2018 (UTC)Reply
And what happens? Yaron Koren (talk) 17:35, 22 January 2018 (UTC)Reply
nothing, there's no output, as though the jobs don't exist. Other jobs run, if they exist, but not anything from "pageSchemasCreatePage". showJobs.php outputs 0. --Anrake (talk) 21:19, 22 January 2018 (UTC)Reply

Unregistered users may see only certain fields

Is it possible to configure Page Schemas/MediaWiki so that unregistered users are able to see only certain fields?

No. Yaron Koren (talk) 00:41, 26 March 2018 (UTC)Reply
To bad. Is a woraround possible? --138.232.124.69 12:42, 28 March 2018 (UTC)Reply
Could you explain what the need is? Yaron Koren (talk) 19:15, 28 March 2018 (UTC)Reply
I'm using Mediawiki in combination with PageSchemas to create a DB. Until now the DB is only a working tool, but we plan to go online in a few weeks.

Since it is for the moment a private DB there are some fields in our schemas containing notes that are supposed to be only private notes for the contributors.

Is it possible to cofigure MediaWiki/PageSchemas in such a way, that certain fields may not bee seen by unregistered users? --93.70.101.215 07:45, 1 April 2018 (UTC)Reply

Oh, I see - you mean actual data fields; I thought you meant fields within the Special:EditSchema form. In either case, the answer is no. If there's data that you don't want certain users to see, the best solution is to keep it out of the wiki altogether - and it may make sense to create a separate, more restricted wiki to contain just that data. Yaron Koren (talk) 18:00, 2 April 2018 (UTC)Reply

Issue Installing to MW 1.31

Should this extension work with 1.31?

I Downloaded the version of this extension marked for MW 1.31.

Trying to run update.php.

Getting the following error:

/home/gunsywtx/public_html/maintenance$ php update.php

Fatal error: Uncaught Exception: /home/gunsywtx/public_html/extensions/PageSchemas/extension.json does not exist! in /home/gunsywtx/public_html/includes/registration/ExtensionRegistry.php:107
Stack trace:
#0 /home/gunsywtx/public_html/includes/GlobalFunctions.php(50): ExtensionRegistry->queue('/home/gunsywtx/...')
#1 /home/gunsywtx/public_html/LocalSettings.php(230): wfLoadExtension('PageSchemas')
#2 /home/gunsywtx/public_html/includes/Setup.php(94): require_once('/home/gunsywtx/...')
#3 /home/gunsywtx/public_html/maintenance/doMaintenance.php(81): require_once('/home/gunsywtx/...')
#4 /home/gunsywtx/public_html/maintenance/update.php(245): require_once('/home/gunsywtx/...')
#5 {main}
  thrown in /home/gunsywtx/public_html/includes/registration/ExtensionRegistry.php on line 107
Yes, using the "ExtensionDistributor" with any of my extensions is generally not a good idea, because it just represents a random, and usually outdated, snapshot. I would try using the latest Page Schemas code instead. Yaron Koren (talk) 15:13, 25 June 2018 (UTC)Reply

More Documentation?

Besides the video and the landing page for this extension, is there any other source of documentation? Ankostis (talk) 14:06, 19 September 2018 (UTC)Reply

There's also this, though it's not much. Yaron Koren (talk) 01:05, 20 September 2018 (UTC)Reply

Page Schema Infobox Templates

Can you set a template created by Page Schemas to output an Infobox or that can only be done by editing the source code after Page Schemas creates the template?

What do you mean by an "infobox"? Yaron Koren (talk) 16:13, 15 November 2018 (UTC)Reply

Schema Not Saving

I have two issues, really.

1) I've found a scenario where the "Save Page" function in the "Edit Schema" tab no longer actually saves the schema.

If I create a schema from a blank category, and use the form in "Edit Schema" to do so, everything is great.

If, however, I edit the schema using the "Edit" tab, then I'm no longer able to save changes made to the schema using the "Edit Schema" form. The schema is locked to the revision created during the manual "Edit".

I first noticed this when I was attempting to manually fix another issue...

2) When adding a Semantic property of type "Telephone Number", the "Edit Schema" form would show it in the dropdown as "Telephone 2ber" if it was the 2nd field, or "Telephone 3ber" if it was the third, and so on. That strange "2ber" or "3ber" or "7ber" would show up in the raw schema XML. I changed it manually in the "Edit" tab, but then realized that I was locked to that revision.

I thought I was losing my mind for a bit, but I was able to determine the above.

Any thoughts?

I enabled debug in LocalSettings.php, but no messages show up.

MediaWiki 1.31.1
PHP 7.0.33-0+deb9u1 (apache2handler)
MariaDB 10.1.37-MariaDB-0+deb9u1
Semantic Forms Select 3.0.0
Semantic MediaWiki 3.0.0
Semantic Result Formats 3.0.0
Page Forms 4.4.2
Page Schemas 0.4.8
WYSIWYG editor Wysiwyg 1.5.6_0

--dvicci (talk) 02:23, 29 December 2018 (UTC)Reply

Sorry about that! No, you're not losing your mind. I actually had a fix for this right after you reported it, but forgot to check it in until now. I just checked it in. Yaron Koren (talk) 19:22, 14 January 2019 (UTC)Reply

Values parameter + Documentation

How do I enter multiple values for a dropdown input type? I can easily get this working with Page Forms but can't figure out what to put in the field to make this happen in Page Schemas. It would be very helpful to have some documentation for this plugin that outlines how to write parameters and values for each input type as well as providing direct examples. Thx. TiltedCerebellum (talk) 05:13, 5 June 2019 (UTC)Reply

Sorry for the long delay. I think you're using neither Cargo nor SMW, so the set the values has to be defined for the form input itself. If you add into the big "Enter parameter names ..." input something like "values=A\,B\,C", that should hopefully work. Yaron Koren (talk) 16:26, 12 August 2019 (UTC)Reply

Mysterious error

When I try to create a schema, I get this error after trying to save:

[468c584a827a82492f74bb3f] 2019-08-11 00:20:09: Fatal exception of type "Error"

I've turned on PHP debugging and nothing shows up. I don't know how to debug this.

If you add "$wgShowExceptionDetails = true;" to LocalSettings.php, it may produce a more useful error message. Yaron Koren (talk) 15:53, 12 August 2019 (UTC)Reply

Link to schema value?

If I were to include a field in the schema that provided a unique ID for the page could I link to the page using the value of the field?

If you're using Cargo or SMW, you can do it by querying on the ID field... if I understand your question correctly. Yaron Koren (talk) 18:35, 3 October 2019 (UTC)Reply

Template from Schema with display="nonempty"

The template code seems to be missing two brackets closing the #if statement.

This is the schema:

<PageSchema>
  <pageforms_Form name="Test (Form Name)">
    <standardInputs freeTextLabel="Free text" inputFreeText="1" inputWatch="1" inputSave="1" inputPreview="1" inputChanges="1" inputCancel="1"/>
  </pageforms_Form>
  <Template name="Test">
    <Field name="has property1 (Name)" display="nonempty">
      <Label>Property1 (Display label)</Label>
      <pageforms_FormInput>
        <InputType>checkboxes</InputType>
      </pageforms_FormInput>
      <semanticmediawiki_Property name="">
        <Type>Page</Type>
        <AllowedValue>Value1</AllowedValue>
        <AllowedValue>Value2</AllowedValue>
        <AllowedValue>Value3</AllowedValue>
      </semanticmediawiki_Property>
    </Field>
  </Template>
</PageSchema>

This is the template generated:

<noinclude>
This is the "Test" template.
It should be called in the following format:
<pre>
{{Test
|has property1 (Name)=
}}
</pre>
Edit the page to see the template text.
</noinclude><includeonly>{| class="wikitable"
{{#if:{{{has property1 (Name)|}}}|! Property1 (Display label)
{{!}} [[has property1 (Name)::{{{has property1 (Name)|}}}]]
|}

[[Category:Test]]
</includeonly>

Installed versions are: MW 1.33.1 , PHP 7.3.10 (cgi-fcgi) , SMW 3.1.1 , Page Forms 4.6 , Page Schemas 0.4.9 , ParserFunctions 1.6.0

Maybe it is related to the other problem i am having?

Thanx for your great work! Any suggestions? Andi 3ö (talk) 16:03, 6 December 2019 (UTC)Reply

No permission on Create Schema

Hi, I haven't used SMW since 2008 so forgive me if this is something obvious.

After installing the extension the Create Schema button is showing up in a Category page, but on clicking it I only get:

Permission error

You do not have permission to edit this page, for the following reason: The action you have requested is limited to users in the group: Users.


This is as admin, staff, etc. across multiple users. I edited LocalSettings.php with:

$wgGroupPermissions['user']['generatepages'] = true;

and added:

$wgGroupPermissions['user']['editschema'] = true;

$wgGroupPermissions['user']['createschema'] = true;

for safe measure. Also tried with 'staff' and 'admin' but the message never changes.

Thanks!

What version of Page Schemas and MediaWiki are you running? Yaron Koren (talk) 02:41, 3 March 2020 (UTC)Reply
MediaWiki 	1.31.6

PHP 	7.2.24-0ubuntu0.18.04.3 (apache2handler)

MySQL 	5.7.29-0ubuntu0.18.04.1

Page Schemas	0.5 (d493e62) 08:25, 26 February 2020

Thank you, sorry for not noticing your response earlier.

Sorry about that! It turns out that I accidentally inserted a major bug into Page Schemas a few weeks ago - permissions for "action=createschema" were reversed for those using MediaWiki 1.32 or lower. I just checked in a fix for it - hopefully it works correctly now.
By the way, there is a 'generatepages' permission, but there's no 'editschema' or 'createschema' permission - the simple 'edit' permission is used for those. Also, there's no 'admin' user group, at least by default - you're probably thinking of 'sysop'. Not really related to this problem; I just figured I should mention it. Yaron Koren (talk) 00:29, 11 March 2020 (UTC)Reply

Possible conflict on using Page Schemas with both Cargo and Semantic Mediawiki

Hello,

I'm currently working on a project that utilizes both Cargo and Semantic Mediawiki extensions. The problem I have is that when I define the XML schema and generate the Model and Category pages, the Cargo table declaration is removed from the Model page. This happens when I load the SM extension below the Cargo extension and be resolved if I reverse the order.

My question is: is this behavior work as expected? Do we have side effects regarding the order of the two extensions?

Thank you so much,

Yes, when both Cargo and SMW are installed, Page Schemas just goes with SMW. I could change it to just go with Cargo, but having it support both at the same time would take a good amount of work, unfortunately. Yaron Koren (talk) 13:07, 27 August 2020 (UTC)Reply

'Generate pages' action leads to Internal Error

PageSchemas generates an error when attempting to create new schemas: After defining the schema parameters, clicking the Generate pages button generates a MediaWiki error page describing an internal error (PageSchemas, not Apache). Here's the error I get:

[e87dbf557df5020d7d144c03] /mediawiki/index.php?title=Category:MyCategoryName&action=generatepages Error from line 124 of /var/lib/mediawiki/extensions/SemanticInternalObjects/SIO_PageSchemas.php: Call to a member function getDatatypeLabels() on null

Backtrace:

#0 /var/lib/mediawiki/extensions/PageSchemas/includes/PSSchema.php(99): SIOPageSchemas::generatePages(PSSchema, array)
#1 /var/lib/mediawiki/extensions/PageSchemas/includes/specials/PSGeneratePages.php(120): PSSchema->generateAllPages(array)
#2 /var/lib/mediawiki/extensions/PageSchemas/includes/specials/PSGeneratePages.php(34): PSGeneratePages->generatePages(string, array)
#3 /var/lib/mediawiki/extensions/PageSchemas/includes/PSGeneratePagesAction.php(37): PSGeneratePages->execute(string)
#4 /usr/share/mediawiki/includes/MediaWiki.php(511): PSGeneratePagesAction->show()
#5 /usr/share/mediawiki/includes/MediaWiki.php(302): MediaWiki->performAction(CategoryTreeCategoryPage, Title)
#6 /usr/share/mediawiki/includes/MediaWiki.php(900): MediaWiki->performRequest()
#7 /usr/share/mediawiki/includes/MediaWiki.php(527): MediaWiki->main()
#8 /usr/share/mediawiki/index.php(44): MediaWiki->run()
#9 {main}

It's not really clear to me whether the cause of the error is Page Schemas or Semantic Internal Objects, so I re-installed both and re-ran update.php but no change in status. P.S. Existing schemas work just fine as-is, but cannot be modified (same error, if attempted).

The cause is Semantic Internal Objects - it clearly hasn't been updated to work with the latest SMW version. I would just uninstall SIO - you don't need it, since SMW's own #subobject does the same thing. Yaron Koren (talk) 00:17, 24 September 2020 (UTC)Reply
That fixed it! And I appreciate the insight; we weren't using the extension, it had been installed for eval & testing, which never happened of course, and then I'm guessing a recent extension upgrade created an incompatibility that hadn't existed before -- Milliard Gargantubrain (talk) 04:23, 24 September 2020 (UTC)Reply

Error from line 841 of /PATH/extensions/PageForms/includes/PF_PageSchemas.php: Call to a member function setSectionLevel() on null

Hi everyone !

This is my setup:

MediaWiki 1.31.10 PHP 7.3.25 (cgi-fcgi) MySQL 5.6.41-84.1

Page Schemas 0.5.1 Page Forms 4.9.5

Cought an error while creating my first schema:

[X-n7TtcrY-TO@OHod5-r8wAAACE] /index.php?title=Categoria:Refer%C3%AAncias&action=generatepages Error from line 841 of /PATH/extensions/PageForms/includes/PF_PageSchemas.php: Call to a member function setSectionLevel() on null

Backtrace:

#0 /PATH/extensions/PageSchemas/PageSchemas.classes.php(385): PFPageSchemas::generatePages(PSSchema, array)
#1 /PATH/extensions/PageSchemas/specials/PS_GeneratePages.php(87): PSSchema->generateAllPages(array)
#2 /PATH/extensions/PageSchemas/specials/PS_GeneratePages.php(27): PSGeneratePages->generatePages(string, array)
#3 /PATH/extensions/PageSchemas/PS_Tabs.php(70): PSGeneratePages->execute(string)
#4 /PATH/includes/Hooks.php(177): PSTabs::onUnknownAction(string, CategoryTreeCategoryPage)
#5 /PATH/includes/Hooks.php(205): Hooks::callHook(string, array, array, string)
#6 /PATH/includes/MediaWiki.php(510): Hooks::run(string, array, string)
#7 /PATH/includes/MediaWiki.php(294): MediaWiki->performAction(CategoryTreeCategoryPage, Title)
#8 /PATH/includes/MediaWiki.php(818): MediaWiki->performRequest()
#9 /PATH/includes/MediaWiki.php(524): MediaWiki->main()
#10 /PATH/index.php(42): MediaWiki->run()
#11 {main}

Can you please help me solve this out ?

Thanks in advance

UPDATE:

I managed to solve it. Upgraded to the master git version and disabled the HeaderTabs extension. Looks like there's a conflict.

Thank you guys!

Sorry about the problem. I just checked in what I think is better handling for this, to the Page Forms code. Yaron Koren (talk) 15:33, 12 January 2021 (UTC)Reply

How to use Start date, End date data type?

Can Start date, End date be used as data type for a Cargo field? If so, how?

Error when creating a schema

Hi I hope someone can help me with the following: When I click 'Create Schema' in a category, the following error appears:

Internal error [ea03c8f0b07f04ef7fa2be09] /index.php?title=Category:Testcategory&action=editschema Error: Call to a member function getFormattedNamespaces() on null Backtrace: from [my-local-path]\extensions\PageSchemas\includes\specials\PSEditSchema.php(229)

  1. 0 [my-local-path]\extensions\PageSchemas\includes\specials\PSEditSchema.php(334): PSEditSchema::printNamespaceDropdown(string, string)
  2. 1 [my-local-path]\extensions\PageSchemas\includes\specials\PSEditSchema.php(469): PSEditSchema->printFieldSection()
  3. 2 [my-local-path]\extensions\PageSchemas\includes\specials\PSEditSchema.php(618): PSEditSchema->printTemplateSection()
  4. 3 [my-local-path]\extensions\PageSchemas\includes\specials\PSEditSchema.php(795): PSEditSchema->printForm()
  5. 4 [my-local-path]\extensions\PageSchemas\includes\PSEditSchemaAction.php(40): PSEditSchema->execute(string)
  6. 5 [my-local-path]\includes\MediaWiki.php(531): PSEditSchemaAction->show()
  7. 6 [my-local-path]\includes\MediaWiki.php(315): MediaWiki->performAction(CategoryTreeCategoryPage, Title)
  8. 7 [my-local-path]\includes\MediaWiki.php(913): MediaWiki->performRequest()
  9. 8 [my-local-path]\includes\MediaWiki.php(546): MediaWiki->main()
  10. 9 [my-local-path]\index.php(53): MediaWiki->run()
  11. 10 [my-local-path]\index.php(46): wfIndexMain()
  12. 11 {main}

This error occurs in two local setups on my Windows 10 laptop, not in a third online SMW I am testing (so although I am not really good at this I did manage to get it working in one case, which is great!).

One local setup is done with WinNMP 20.11, Mediawiki 1.36.0, with PHP 7.4.13, MariaDB 10.4.17, SMW 3.2.3, Page Schemas 0.5.2, Page Forms 5.2.1
The other failing setup is with XAMPP-portable, Mediawiki 1.36.0, PHP 8.07, MariaDB 10.4.19, SMW 3.2.3, Page Schemas 0.5.1, Page Forms 5.2.1


I guess there's something wrong with my Namespace configuration but I have no idea what.

Thanks in advance for any help!

Sorry about the problem. It has nothing to do with your configuration - this is was a bug with the handling of MW 1.36 and higher that wasn't fixed until about a month ago. There hasn't been a new version released since the fix, so you'll have to use the latest Page Schemas code. Yaron Koren (talk) 20:07, 21 June 2021 (UTC)Reply
thank you for your prompt reply! That fixed it (I didn't notice my online version wasn't using MW 1.36, hence my fix on the local versions) Thanks again for your great work!
I hadn't fully tested until now: creating the schema works fine now but when I try to generate the pages I get this error, in my WinNMP-setup (not when doing the same in the MW 1.35 online version).

[54fc1107f777db0d71ba2a05] /index.php?title=Category:Testcategory&action=generatepages Error: Call to a member function formatNum() on null Backtrace: from [my-local-path]extensions\SemanticMediaWiki\includes\SMW_PageSchemas.php(328)

  1. 0 [my-local-path]extensions\SemanticMediaWiki\includes\SMW_PageSchemas.php(297): SMWPageSchemas::createPropertyText(string, array, NULL)
  2. 1 [my-local-path]extensions\PageSchemas\includes\PSSchema.php(99): SMWPageSchemas::generatePages(PSSchema, array)
  3. 2 [my-local-path]extensions\PageSchemas\includes\specials\PSGeneratePages.php(122): PSSchema->generateAllPages(array)
  4. 3 [my-local-path]extensions\PageSchemas\includes\specials\PSGeneratePages.php(36): PSGeneratePages->generatePages(string, array)
  5. 4 [my-local-path]extensions\PageSchemas\includes\PSGeneratePagesAction.php(37): PSGeneratePages->execute(string)
  6. 5 [my-local-path]includes\MediaWiki.php(531): PSGeneratePagesAction->show()
  7. 6 [my-local-path]includes\MediaWiki.php(315): MediaWiki->performAction(CategoryTreeCategoryPage, Title)
  8. 7 [my-local-path]includes\MediaWiki.php(913): MediaWiki->performRequest()
  9. 8 [my-local-path]includes\MediaWiki.php(546): MediaWiki->main()
  10. 9 [my-local-path]index.php(53): MediaWiki->run()
  11. 10 [my-local-path]index.php(46): wfIndexMain()
  12. 11 {main}

Again, all help is much appreciated

It looks like this is a bug in SMW - specifically, on this line, the code shouldn't be using $wgContLang any longer, since it was removed in MW 1.36. I would let the SMW developers know about the problem. Yaron Koren (talk) 13:53, 27 June 2021 (UTC)Reply
Thanks again. I reported the problem and made another local setup for myself, using MW 1.35, so I can use your great extension.

Cargo query and Page Schemas

Hello, I need to include a Cargo query in my Template. I have a Template called "Project" and one called "Activities". Each Project can have multiple Activities. I do not want to manually select the Activities when editing a Project. I just need to show them on the Project page via a Cargo query.

I could manually insert the query in the Template but it would get deleted if I modified the Page Schema. Am I right?

Is there a way to accomplish this?

Thank you. Carlo

Yes, regenerating the pages would wipe out whatever changes you made. At some point, if the template or anything else can't be created by Page Schemas, then you'll have to switch to just editing these pages manually, unfortunately. Yaron Koren (talk) 14:56, 14 October 2021 (UTC)Reply

Missing #set function in multiple instance templates?

I created a schema with a multiple instance template and observed that hidden fields defined in the multiple instance template are displayed, actually as simple unformatted text. Comparing the template code with one of a common, single instance template, it seems that a call of the #set parser function is missing. At least, adding #set fixes the problem and the fields don't show up anymore as expected.

Template code generated by Page Schemas:

{{#subobject: [...]}}
{| class="wikitable"
[[P-PPN::{{{P-PPN|}}}]]
[[E-PPN::{{{E-PPN|}}}]]
[...]

Fixed template code after inserting the #set-call:

{{#subobject: [...]}}
{{#set:P-PPN={{{P-PPN|}}}|E-PPN={{{E-PPN|}}}|}}
{| class="wikitable"
Regular properties (outside of #subobject) shouldn't be getting set at all in multiple-instance templates - so the real bug is that it included those lines in the first place, it seems to me. I would just delete them; you don't need a #set call in their place either. Yaron Koren (talk) 14:58, 14 October 2021 (UTC)Reply
Thanks for your help! Deleting them solves the problem. MMFSoftwares (talk) 21:12, 14 October 2021 (UTC)Reply

Custom delimiters not applied in generated forms and subobject section of templates.

I defined a custom delimiter (_) in text with autocomplete fields. In the template, the expected #arraymap function is included but in the form definition the parameters list and delimiter= seems to be missing. Also, the sep parameter in #subobject does not contain the customized separator.

TypeError: Illegal offset type in isset or empty

Hello! Having a PHP error, and I can't quite figure my way to debugging it.

When creating or editing a schema I get...

Error

[0f2bde35fd61a6941fcdf737] /index.php?title=Category:Person&action=editschema TypeError: Illegal offset type in isset or empty

Backtrace:

from /var/www/html/includes/Html.php(695)
#0 /var/www/html/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php(194): Html::input()
#1 /var/www/html/extensions/PageSchemas/includes/specials/PSEditSchema.php(436): SMWPageSchemas::getTemplateEditingHTML()
#2 /var/www/html/extensions/PageSchemas/includes/specials/PSEditSchema.php(617): PSEditSchema->printTemplateSection()
#3 /var/www/html/extensions/PageSchemas/includes/specials/PSEditSchema.php(794): PSEditSchema->printForm()
#4 /var/www/html/extensions/PageSchemas/includes/PSEditSchemaAction.php(40): PSEditSchema->execute()
#5 /var/www/html/includes/MediaWiki.php(543): PSEditSchemaAction->show()
#6 /var/www/html/includes/MediaWiki.php(320): MediaWiki->performAction()
#7 /var/www/html/includes/MediaWiki.php(930): MediaWiki->performRequest()
#8 /var/www/html/includes/MediaWiki.php(564): MediaWiki->main()
#9 /var/www/html/index.php(53): MediaWiki->run()
#10 /var/www/html/index.php(46): wfIndexMain()
#11 {main}

Versions

  • PageSchemas version: `REL1_37` branch (26e5cca), though Special:Version shows 0.6 (bda97b1)
  • MediaWiki 1.37.1
  • PHP 8.0.8
  • SMW 4.0.0
  • Page Forms 5.3.4 (16589e0)
That looks like a bug in line 194 of SMW_PageSchemas.php, in Semantic MediaWiki. And it looks like a bug that I introduced, a very long time ago! I wonder how no one noticed it until now. Yaron Koren (talk) 01:18, 8 March 2022 (UTC)Reply
was any fix found for this? Sneeze5555 (talk) 07:50, 28 July 2022 (UTC)Reply
I believe that line I mentioned, line 194 of SMW_PageSchemas.php, which currently looks like:
		$text .= Html::input( 'smw_connecting_property_num', $propName, [ 'size' => 15 ] ) . "\n";
...should instead look like:
		$text .= Html::input( 'smw_connecting_property_num', $propName, 'text', [ 'size' => 15 ] ) . "\n";
And actually, looking at the code now, it looks like two other lines in that same file, 217 and 240, have the same problem. Yaron Koren (talk) 13:04, 28 July 2022 (UTC)Reply

Understanding Sections

Can you explain two things please ?

  1. If the output format is set to Sections - what is that supposed to do ?
  2. What does the Add Section button achieve ? I tried to play with it but simply got this error when saving the changes Warning: count(): Parameter must be an array or an object that implements Countable in xxxxxxx/extensions/PageSchemas/includes/PageSchemas.php on line 247

91.85.121.33 07:22, 31 May 2022 (UTC)Reply

Sorry about that second problem - I just checked in what I think is a fix for it. But the "sections" format is supposed to make every field a separate section of the page, i.e. the field name becomes a section name (with the '==' around it), and then the field value is the contents of that section. Yaron Koren (talk) 14:03, 31 May 2022 (UTC)Reply
Brilliant. Thanks. Makes sense (though not something I can think of a use case ATM). 91.85.121.33 21:03, 31 May 2022 (UTC)Reply

Errors with Page Schema

I have been experimenting with Page Schema for a couple of days and getting to understand it better. I currently cannot get a Form to present itself as expected for a Library application I am building. I start by entering a unique book title, this end up appended to the Page title.

  1. I get no Field for the book Title but get a Field Name and Label,
  2. all field 'names' and field Labels appear concatenated after the field input box, Form input screen says Label will be before the field
  3. One field I have specified as a Dropdown but the dropdown is part of the next field,
  4. there is no label for the last field on the page,
  5. even though I have marked the check box for 'pop-up tooltips' the text appears under the field (and not easy to read)
  6. All dropdowns are empty.

How are dropdowns meant to be populated? I assumed they would be taken from the Cargo specification where you need to enter the allowable values.

I am using Mediawiki 1.36.2, Page Schemas 0.6 and Page Forms 5.3.4

Thank, Robert 119.224.101.52 23:18, 14 July 2022 (UTC)Reply

That's pretty bad. You are using somewhat old versions of Page Schemas and Page Forms, so I encourage you to get the latest versions of these extensions, to make sure that that's not the issue. (Don't worry, they will still work with MW 1.36.) I hope that will fix at least some of these problems... Yaron Koren (talk) 13:55, 15 July 2022 (UTC)Reply
I have had both Extensions updated and it made little to no difference, so I started changing some options. I found the Culprit, is the "Allow multiple instances of this Template" option. If this is checked, the form is unuseable. I have since worked out I did not want that option anyway, not understanding exactly what is was doing. However, there are still two items that do not appear to behave as expected: 1. Pop-up tooltips, they still appear under the Field Name/Label, and 2. I am still intrigued why the Field Name and the Field Label are both displayed, one after the other in front of the Field box. I would have thought if you do not specify a Label, the Field Name will be used, otherwise just the Label, but never both straight after each other. It appears to just be a cosmetic thing so not all that important. Robert
I tried replicating these problems with the current versions of Page Schemas and Page Forms, but I can't replicate any of the these many problems you list. I'm not sure how to go about debugging this - what are the biggest problem(s) you're seeing right now? Yaron Koren (talk) 14:45, 18 July 2022 (UTC)Reply
I now only get the big errors if I have "Allow multiple instances of the Template" checked, that makes the form unuseable. So the two items that remain are, the field Name and Label are both displayed in front of the field. This causes confusion Why does the Field name display? Should that not just be an internal identifier? Secondly the Tooltip text does not seem to be working as a pop-up, it just displays under the Field Name/Label as a single line of text. Some of mine are of reasonable length placing the Field a long way from its Label. Is this the same issue as logged on 28 March 2018? Do I need to install an additional Extension? Thanks, Robert
I don't know why you're seeing both the field name and the label, and I can't replicate that problem. (I also can't replicate the problem with "allow multiple instances".) Could you pastebin the generated form and template? That might be helpful. As for tooltips - yes, you need an extension; the best one to use for that is RegularTooltips. Yaron Koren (talk) 13:17, 19 July 2022 (UTC)Reply
This is the Form
<noinclude>
This is the "Books" form.
To create a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.

{{#forminput:form=Books|autocomplete on category=Books}}

</noinclude><includeonly>
{{{info|create title=Add a  Book or Booklet}}}
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|Books}}}
{| class="formtable"
! Short-name Short-name: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Enter a unique short-name for this book. Differentiate similar titles by adding an Author abreviation.</p>
| {{{field|BOOK_SHORT_NAME|size=50|mandatory}}}
|-
! Full Title Full Title: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">enter the full Title of the Book or Booklet</p>
| {{{field|Book_Full_Title|mandatory}}}
|-
! Author(s) Authour Name(s): <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Enter all Author names, separated by commas, no spaces, eventually selectable from drop-down</p>
| {{{field|AUTHOR_NAME|mandatory}}}
|-
! Publisher Publisher: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Enter the Publishers name, eventually selectable from drop-down</p>
| {{{field|PUBR_NAME|mandatory}}}
|-
! Book Type Book Type: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Select a book type from the list</p>
| {{{field|Book_Type|input type=dropdown}}}
|-
! ISBN No ISBN No: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Enter Book's ISBN number</p>
| {{{field|ISBN}}}
|-
! Book Width in mm Width (mm): <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Enter book width in mm</p>
| {{{field|Width}}}
|-
! Book Height in mm Height: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Enter Book height in mm</p>
| {{{field|Height}}}
|-
! Orientation Orientation: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Select orientation from list</p>
| {{{field|Orientation|input type=dropdown|Portrait=|Landscape=}}}
|-
! Book Format Format: <br><p class="pfFieldDescription" style="font-size:0.7em; color:gray;">Select the format from the list</p>
| {{{field|Format|input type=dropdown}}}
|}
{{{end template}}}

'''Free text:'''

{{{standard input|free text|rows=10}}}
</includeonly>

And this is the Template

<noinclude>
{{#template_params:BOOK_SHORT_NAME (label=Short-name;namespace=User)|Book_Full_Title (label=Full Title;namespace=User)|AUTHOR_NAME (label=Authour Name(s);list;namespace=User)|PUBR_NAME (label=Publisher)|Book_Type (label=Book Type;namespace=User)|ISBN (label=ISBN No;namespace=User)|Width (label=Width (mm);namespace=User)|Height (namespace=User)|Orientation|Format}}
{{#cargo_declare:_table=Books|BOOK_SHORT_NAME=Page|Book_Full_Title=Text|AUTHOR_NAME=List (,) of Text|PUBR_NAME=Text|Book_Type=Text (allowed values=Book,Booklet,Pamphlet,Report)|ISBN=Text|Width=Integer|Height=Integer|Orientation=Page (allowed values=Portrait,Landscape)|Format=Text (allowed values=Hard-cover,Soft-cover,Spiral-bound,Staple-bound,Stapled,Loose-leaf)}}
</noinclude><includeonly>{{#cargo_store:_table=Books}}
{{#template_display:_format=standard}}
[[Category:Books]]
</includeonly>

Thanks for your time on this, I note that the majority of the Form code does not display but it is visible if you look at the Source Code of this page. I will be extending this table today, merging in another table that no longer needs to be separate. A useful feature of Page Schema would be 'Add a field above' just like you have in "Create a Class". Robert

Thanks, that's helpful. Now I see the issue: you filled in that "Text that will be printed before the field:" value for each field. That's the issue - I confess that I don't remember what that is for, but it's not the field label - it's text that's meant to go before it. So if you just blank those values, the problem should go away. And I agree that being able to add fields above would be helpful, as would being able to rearrange them. Yaron Koren (talk) 21:36, 19 July 2022 (UTC)Reply

How to export the category page schema ?

I have created a category with a page schema where I want to export it into another Wiki website but how to export it out ?

Lotusccong (talk) 15:46, 4 August 2022 (UTC)Reply

Just copy the entire category page to the other wiki. Yaron Koren (talk) 16:10, 4 August 2022 (UTC)Reply
Hi Yaron, yes it works. TQVM. 113.52.148.114 06:17, 5 August 2022 (UTC)Reply
Return to "Page Schemas/Archive 2016 to 2022" page.