Extension talk:Page Schemas

From mediawiki.org
Jump to navigation Jump to search

Only for editors[edit]

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)[]

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:

{{!}}- 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)[]

Change allowed values[edit]

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)[]

Customise templates[edit]

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)[]

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)[]
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)[]
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)[]

tooltips in page forms using Cargo[edit]

-- 12:42, 28 March 2018 (UTC)[]

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)[]
that does it! The new class is actually: #tip-info cheers --Anrake (talk) 14:53, 2 June 2017 (UTC)[]

Jobs not running[edit]

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)[]

Have you tried calling runJobs.php? Yaron Koren (talk) 14:08, 22 January 2018 (UTC)[]
yeah, many times. --Anrake (talk) 14:43, 22 January 2018 (UTC)[]
And what happens? Yaron Koren (talk) 17:35, 22 January 2018 (UTC)[]
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)[]

Unregistered users may see only certain fields[edit]

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)[]
To bad. Is a woraround possible? -- 12:42, 28 March 2018 (UTC)[]
Could you explain what the need is? Yaron Koren (talk) 19:15, 28 March 2018 (UTC)[]
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? -- 07:45, 1 April 2018 (UTC)[]

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)[]

Issue Installing to MW 1.31[edit]

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)[]

More Documentation?[edit]

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)[]

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

Page Schema Infobox Templates[edit]

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)[]

Schema Not Saving[edit]

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)[]

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)[]

Values parameter + Documentation[edit]

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)[]

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)[]

Mysterious error[edit]

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)[]

Link to schema value?[edit]

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)[]

Template from Schema with display="nonempty"[edit]

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

This is the schema:

  <pageforms_Form name="Test (Form Name)">
    <standardInputs freeTextLabel="Free text" inputFreeText="1" inputWatch="1" inputSave="1" inputPreview="1" inputChanges="1" inputCancel="1"/>
  <Template name="Test">
    <Field name="has property1 (Name)" display="nonempty">
      <Label>Property1 (Display label)</Label>
      <semanticmediawiki_Property name="">

This is the template generated:

This is the "Test" template.
It should be called in the following format:
|has property1 (Name)=
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)|}}}]]


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)[]

No permission on Create Schema[edit]

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.


What version of Page Schemas and MediaWiki are you running? Yaron Koren (talk) 02:41, 3 March 2020 (UTC)[]
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)[]

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


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)[]

'Generate pages' action leads to Internal Error[edit]

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


#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)[]
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)[]

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

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


#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


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)[]

How to use Start date, End date data type?[edit]

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

Error when creating a schema[edit]

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)[]
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)[]
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[edit]

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