Code Monkey home page Code Monkey logo

semanticformsselect's Introduction

Semantic MediaWiki

CI Latest Stable Version Total Download Count

Semantic MediaWiki (a.k.a. SMW) is a free, open-source extension to MediaWiki – the wiki software that powers Wikipedia – that lets you store and query data within the wiki's pages.

Semantic MediaWiki is also a full-fledged framework, in conjunction with many spinoff extensions, that can turn a wiki into a powerful and flexible knowledge management system. All data created within SMW can easily be published via the Semantic Web, allowing other systems to use this data seamlessly.

For a better understanding of how Semantic MediaWiki works, have a look at deployed in 5 min and the Sesame, Fuseki triplestore video, or browse the wiki for a more comprehensive introduction.

Requirements

Semantic MediaWiki requires MediaWiki and its dependencies, such as PHP.

Supported MediaWiki, PHP and database versions depend on the version of Semantic MediaWiki. See the compatibility matrix for details.

Installation

The recommended way to install Semantic MediaWiki is by using Composer. See the detailed installation guide as well as the information on compatibility.

Documentation

Most of the documentation can be found on the Semantic MediaWiki wiki. A small core of documentation also comes bundled with the software itself. This documentation is minimalistic and less explanatory than what can be found on the SMW wiki. However, It is always kept up to date and applies to the version of the code it bundles with. The most critical files are linked below.

Support

Chatroom Twitter Facebook LinkedIn YouTube Mailing lists

Primary support channels:

Contributing

Many people have contributed to SMW. A list of people who have made contributions in the past can be found here or on the wiki for Semantic MediaWiki. The overview on how to contribute provides information on the different ways available to do so.

If you want to contribute work to the project, please subscribe to the developer's mailing list and have a look at the contribution guidelines.

Tests

This extension is tested using GitHub Actions for Continuous Integration (CI). Each time changes are pushed to the repository, GitHub Actions automatically runs a series of tests to ensure the code remains reliable and functional.

INFO: This repository contains submodules. Make sure to clone with --recursive option in Git.

git clone --recursive <REPO>

If not done when cloning, it can be done by

git submodule init
git submodule update

Step 1: Clone the Repository

Step 2: Ensure test container is running

This repository supports "docker-compose-ci" based CI and testing for MediaWiki extensions.

The "docker-compose-ci" repository has already been integrated into the Semantic MediaWiki repository as a Git submodule. It uses "Make" as main entry point and command line interface.

Ensure, you have Make and Docker installed:

make --version
docker --version

Step 3: Run lint, phpcs and tests

make ci

For more information about

License

GNU General Public License, version 2 or later. The COPYING file explains SMW's copyright and license.

semanticformsselect's People

Contributors

cscott avatar dependabot[bot] avatar gesinn-it-evl avatar gesinn-it-gea avatar gesinn-it-ilm avatar gesinn-it-wam avatar janboehme avatar jeroendedauw avatar kghbln avatar krabina avatar mwjames avatar nikerabbit avatar paladox avatar rudloff avatar seb35 avatar siebrand avatar toniher avatar translatewiki avatar vedmaka avatar wouterrademaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

semanticformsselect's Issues

Feature request: separate option label & value

Setup

  • MW version: 1.28.1
  • DB (MySQL etc.): MySQL 5.5.55
  • PHP version: 5.6.30-0+deb8u1
  • SMW version: 2.5.2
  • SFS version: 2.1.0
  • PF version: 4.1

Issue

Currently the value of a SFS select option is what is displayed to the user:

<option>foo</option>

But it would be nice to have a way to use a different semantic property as label:

<option value="foo">bar</option>

(Typically we would need this because some of our pages have a Full name property that is different from the actual name of the article.)

Some general comments

After a quick (really) look the following could be improved to ease maintainability:

  • DIR structure (src, tests, res, i18n etc.)
  • Use a PHP namespace such as SFS
  • Methods should be non static (if you could make this happen then I might spend 5 min to write one or two rudimentary tests)
  • Objects should be injected (Parser, ParserOptions etc.) to improve testability and make the dependency visible
  • Having JS script elements here [0] may cause issues with MW when doing an arbitrary $wgOut->addInlineScript("$script\n");
  • SemanticFormsSelect::SF_Select should go into its own class
  • SemanticFormsSelect::QueryExecution, SemanticFormsSelect::FunctionExecution as it is used only by the API
global $wgParser, $wgSF_Select_debug;
$semanticFormsSelectAPIHandler = new SemanticFormsSelectAPIHandler( $wgParser)
$semanticFormsSelectAPIHandler->setDebugState( $wgSF_Select_debug )
$semanticFormsSelectAPIHandler->doExecuteQueryFor( ... )

$semanticFormsSelectAPIHandler->doExecuteFunctionFor( ... )
  • scriptSelect.jsseems to do several things, its hard to make sense of what it is doing
  • JS function styling, [1,2,3]
jQuery(function()
{

vs

( function ( $, mw ) {

    'use strict';

    $( function ( $ ) {

    } );
}( jQuery, mediaWiki ) );

[0] https://github.com/SemanticMediaWiki/SemanticFormsSelect/blob/master/SemanticFormsSelect.classes.php#L133-L155
[1] https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Structure
[2] http://addyosmani.com/blog/essential-js-namespacing/
[3] https://github.com/SemanticMediaWiki/SemanticCite/blob/master/res/scite.cache.js#L22-L23

Make 3.0.0 release

Release date: 2018-10-04

  • Finalize release notes
  • Update "README"
  • Update "composer.json" (remove SMW 3.0 dev)
  • Update "SemanticFormsSelect.php" (version 3.0.0)
  • Update "extension.json" (version 3.0.0)
  • Create tag
  • Add release to Wikidata
  • Update hompage
  • Start development of new version
    • Update "composer.json" (update dev alias)
    • Update "RELEASE NOTES" (start new section)
    • Update "extension.json" (new alpha version)
  • Announce via mail
  • Do a release tweet on Twitter

Support "mapping property" / "mapping template" in value field

 {{{field|P2Protocols3|input type=SF_Select|query=((Category:Protocol))((Protocol Belongs to Project::@@@@));?Has Name;format~list;sep~,;link~none;headers~hide;limit~
200|sametemplate|field=Project1|label}}}

...will fail, if field Project1 uses mapping property or mapping template (e.g. to support Display Title).

Any ideas / suggestions?

Dependent options not always loaded on first change

Setup

  • MW version: 1.35.5
  • SMW version: 4.0.0
  • SFS version: 4.0.0-beta
  • PF version: 5.3.4

Issue

After selecting a PF element from input type combobox the options for a dependent SFS element are not always loaded on first change; instead you have to select a different element first and another change will fill the options

Error with latest version of Page Forms

Setup

  • MW version: 1.35.2
  • DB (MySQL etc.): 10.5.10
  • PHP version: 7.4.20
  • SMW version: 3.2.3
  • SFS version: Latest 3.0 (66f2cf2)
  • PF version: Latest 5.2.1 (d421edf5edd6a439074e8c619927e53d5c1d3710)
  • Browsers and versions (if applicable):

Issue

PHP Fatal error: Declaration of SFS\SemanticFormsSelectInput::getName() must be compatible with PFFormInput::getName(): string in /var/www/html/extensions/SemanticFormsSelect/src/SemanticFormsSelectInput.php on line 37

Fatal error: Declaration of SFS\SemanticFormsSelectInput::getName() must be compatible with PFFormInput::getName(): string in /var/www/html/extensions/SemanticFormsSelect/src/SemanticFormsSelectInput.php on line 37

Steps to reproduce the observation (recommendation is to use the sandbox):

To reproduce use the latest version of Page Forms.

make SFS compliant with recent PF versions

The way SFS implements the custom input type requires updates to be compliant with recent versions of PF. At least the following things needs to be done:

  • class SemanticFormsSelect should extend PFFormInput
  • update constructor like:
    public function __construct( $inputNumber, $curValue, $inputName, $disabled, $otherArgs )
  • provide public static function getName()
  • provide public function getHtmlText()
  • provide public static function getParameters()

php error call_user_func_array() expects parameter 1 to be a valid callback

Reported on mw.o

I'm trying to implement a SF_Select field. The field definition does not appear to get parsed; when I open the form with the field definition the field definition is shown instead of the field itself.

I have found an apache error message which is likely to be relevant. It's an error pointing to a SemanticForms php file, but this error is only triggered when I open a form which has the SF_Select field on it. The full error is as follows:

[Mon Jan 11 15:30:06.897122 2016] [:error] [pid 21078] [client 176.20.101.243:64678] FastCGI: server "/usr/lib/cgi-bin/php5-fcgi" stderr: PHP message: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, class '\SFS\SemanticFormsSelect' not found in /var/www/wiki/extensions/SemanticForms/includes/SF_FormPrinter.php on line 1955

My versions are as follows:

  • MW: 1.24.4
  • SMW: 2.3
  • SF: 3.2
  • SFS: 1.3 (assuming)

Upgrade compatibility with JS library select2

Setup

  • MW version: 1.33.0 - 1.35.0
  • DB (MySQL etc.): MariaDB 10.1 - 10.2 (not relevant here)
  • PHP version: 7.2.24 - 7.3.23 (probably not relevant here)
  • SMW version: 3.1.3
  • SFS version: 3.0.0
  • PF version: 5.1
  • Browsers and versions (if applicable): all - confirmed at least with Firefox 84 and Chromium 88

Issue

With the update of the JS library select2 in April 2020, the forms using SFS are not displayed and there is a message The select2('data') method was called on an element that is not using Select2. in the debug console.

According to my preliminary researches, it should now be checked beforehand if select2 is initialised on a particular node, see this and this.

Steps to reproduce the observation (recommendation is to use the sandbox):

  • Open https://sandbox.semantic-mediawiki.org/wiki/Special:FormEdit/DemoStatic
  • Open the console (Ctrl+Shift+K on Firefox, Ctrl+Shift+I on Chrome/Chromium then tab 'Console') and be sure the level 'Error' is activated
  • Change one value in the form
  • There the red error message The select2('data') method was called on an element that is not using Select2.
  • PS: on more complicated forms with parametrised fields like DemoAjax1, I guess it is the reason the parametrised field is not displayed

SFS broken on RunQuery results page

Hello,

I am using SFS 2.1.0, PF 4.1 and MW 1.28.1.

When displaying the results from a Special:RunQuery page, SFS does not seem to work at all on the form that is displayed after the results.

Get I18n rolling

This extension currently does not support I18n. I believe this is a nice to have feature.

  • Add I18n // done with 0c7c3e4
  • Fluff message documentation // done with #37
  • Ping tw.n

2.0.0 release

  • Update release notes - #48
  • Update readme - #49
  • Update version number (2.0.0) - #50
    • SemanticFormsSelect.php
  • Finalize release notes (add #51, release date, one unaccounted improvement )
  • Create tag
  • Announce via mail
  • Do a release tweet on Twitter
  • Add extension to code documentation generation (s-mw.o - issue 8)

No longer checks properly for SF version

sandbox.smw.o is down now after the recent automatic update of composer extensions. There have been changes to SF today which may have caused this still I do not know why SFS fails to get version 3.4.1 properly.

HTML IDs are not incremented

Setup

  • MW version: 1.33.0 (probably not relevant here)
  • DB (MySQL etc.): MariaDB 10.3 (not relevant here)
  • PHP version: 7.3.27 (probably not relevant here)
  • SMW version: 3.1.3 (probably not relevant here)
  • SFS version: 3.0.0 and 3.1.0-alpha (current master)
  • PF version: 4.6 to 5.1
  • Browsers and versions (if applicable): Firefox (not relevant here)

Issue

In the HTML, the attributes id are always id="input_" instead of id="input_NN" with NN an incrementing number.

It has seemingly-unrelated side effects like: when there are multiple multi-choice selects activated with the select2 library, only the last one is correctly displayed with the select2 library, the other ones stay as standard HTML selects. (This is a custom instruction on my client’s wiki, perhaps it could be interesting it becomes standard in SFS.)

Steps to reproduce the observation:

  • Open DemoStatic
  • Open the HTML in the browser
  • Search « id='input_' » ; there are multiple such occurences

SFS does not respect sort parameter

Hello,

SFS seems to always sort by name, even if I use sort= in the query. Example created here.

The same query with {{#ask}} uses the correct order: see here.

Setup

  • MediaWiki 1.28.1 (819c0d2) 00:51, 7 April 2017
  • PHP 5.6.30-0+deb8u1 (apache2handler)
  • MariaDB 10.0.30-MariaDB-1~jessie
  • Semantic MediaWiki 3.0.0-alpha (e75da6c) 15:01, 21 May 2017
  • Semantic Forms Select 2.1.0 (eb4a38c) 08:48, 11 May 2017
  • Page Forms 4.1.1 (d732e00) 17:44, 23 May 2017

Interaction with packagist.org broken

Probably the webhook providing the syncing between GitHub and Packagist is broken for some reason (#45 (comment)). Master is no longer immediately pulled since 483f370 I tried to send a test payload but nothing happens except for the note that it is was done with no concluding message etc. Probably another indicator that it is not working. Since you @mwjames set up packagist for this extension I'd rather not fiddle here ...

parametrised query only fires on newly created pages

I'm sitting looking at a bit of an odd phenomenon. I have a couple of fields in a form, the second one populates a combobox based on the value of the first. Fairly standard.

It works fine when I create a new page using this form, and I can see the queries fire in the apache log.

when I use the "edit with form" tab on an existing page, the queries do not fire and the dependent field doesn't get populated.

Any clues? Happy to provide any and all debug info.

Versions:

MW: 1.24.4
SMW: 2.3
SF: 3.4.1
SFS: 1.3.0

Select field not updated when editing existing pages

Initial Situation

  • Create a new page with a form that has a Value and dependent Select field
  • Set the Value field
  • Set the Select field
  • Save the page
  • Edit with form again

Expected Result

  • Clicking on the Select field provides the user with a list of options dependent on the already defined Value field

Current Result

  • The Select field has only the one fixed value set before (not populated with any additional option)
  • Note: Re-selecting the Value field's value manually will trigger the refresh the Select field

If we have a sandbox somewhere, I'd be more than happy to create a test case.

Travis ci errors for config sfgFormPrinter

Hi in https://travis-ci.org/SemanticMediaWiki/SemanticFormsSelect/jobs/104727726 I am getting these errors

Notice: Undefined index: sfgFormPrinter in /home/travis/build/SemanticMediaWiki/mw/extensions/SemanticFormsSelect/SemanticFormsSelect.php on line 87

PHP Fatal error: Call to a member function setInputTypeHook() on a non-object in /home/travis/build/SemanticMediaWiki/mw/extensions/SemanticFormsSelect/SemanticFormsSelect.php on line 87

Fatal error: Call to a member function setInputTypeHook() on a non-object in /home/travis/build/SemanticMediaWiki/mw/extensions/SemanticFormsSelect/SemanticFormsSelect.php on line 87

The reason why you never spotted this is because the test stops at you need to use semantic forms 2.8 or higher.

Please fix that config.

Wrong values in subfields when value is switched too quickly

Soemone reported a very specific issue on one of my wikis.

You can test that here: https://archi-mediawiki.netlib.re/Sp%C3%A9cial:RunQuery/Recherche_avanc%C3%A9e?uselang=fr

  1. Select France in the Pays field.
  2. With the keyboard, use the tab key to select the Ville field.
  3. Quickly type str on your keyboard.

What happens then is that Strasbourg is selected but the Sous-quartier and Rue fields are populated with values from Stosswihr (the value before Strasbourg in the Ville list).
This is probably some kind of race condition because the queries are asynchronous.

I had a hard time reproducing on sandbox because you don't have so many values there, but I think I found a similar issue here: https://sandbox.semantic-mediawiki.org/wiki/Sp%C3%A9cial:RunQuery/Test_keyboard

  1. With the keyboard, use the tab key to select the first field.
  2. Quickly press down then up on your keyboard.

The second field should be empty but it is populated with values from Europe. (Probably because the query for Europe ends after the query for null.)

JS error with latest master

With Page Forms 4.0.2 and SFS 483f370, nothing happens when I select something in a select input.

I have a series of select inputs like this:
image
The second one is populated based on what has been selected in the first one, and so on...
It works correctly with SFS 1.3 and SF 3.3.2 but with the latest master nothing happens.

I get nothing in the browser console when I select something (no AJAX query and no JS error) but I get this JS error during page load:

23:59:08,454 Error: Syntax error, unrecognized expression: input[name=Recherche avancée\[pays\]] 1 load.php:1496:8
	Sizzle</Sizzle.error http://localhost/archi-mediawiki/load.php:1496:8
	Sizzle</Sizzle.tokenize http://localhost/archi-mediawiki/load.php:2113:4
	Sizzle</Sizzle.select http://localhost/archi-mediawiki/load.php:2517:20
	Sizzle http://localhost/archi-mediawiki/load.php:893:9
	.find http://localhost/archi-mediawiki/load.php:2733:4
	jQuery.fn.init http://localhost/archi-mediawiki/load.php:2850:14
	jQuery http://localhost/archi-mediawiki/load.php:73:10
	<anonyme> http://localhost/archi-mediawiki/extensions/SemanticFormsSelect/res/scriptSelect.js:308:7
	<anonyme> http://localhost/archi-mediawiki/extensions/SemanticFormsSelect/res/scriptSelect.js:183:3

(However, I get a similar error with the old version and the form works so I'm not sure it is relevant.)

Breaks with PageForms 4.1.1

Hello,

I'm not sure if it is a PF bug or a SFS bug.
I'm using SFS 2.1.0. When I update PF to 4.1.1, the Special:FormEdit page crashes with this error on forms that use SFS:

Fatal error: Class '\SFS\SemanticFormsSelect::init' not found in /home/pierre/www/archi-mediawiki/extensions/PageForms/includes/PF_FormPrinter.php on line 1615

If I revert back to 4.1, I don't get this error anymore.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.