Dear Steve,

I think it is just a matter of finding the right hook here. It should 
not be related to a new type of edit action, but simply some hook that 
is triggered whenever MediaWiki parses a page. For a list of hooks that 
run during parsing, see:

http://www.mediawiki.org/wiki/Category:MediaWiki_hooks_included_in_Parser.php

You could use many of these, since you do not need to look at the text 
(so it does not matter for you at which stage of processing the parser 
is). SMW processes [[property::value]] annotations during 
InternalParseBeforeLinks.

Cheers,

Markus



On 24/02/13 07:51, Lists wrote:
> Hallo Markus,
>
> If I use a custom MW-parser function hook like this:
>
> [...]
>
> $action = MediaWiki::getAction();
>
>          if($action == 'formedit'):
>
>    $dataItem = new SMWDIBlob('Das ist ein zweiter Test');
>    $property = new SMWDIProperty('___SDWTEST');
>    if(!is_null($dataItem)):
>       SMWParseData::getSMWData($parser)->addPropertyObjectValue($property,
> $dataItem);
>    endif;
>
>       endif;
>
> ...it's set the property but it is still only visible in the browse mode of
> the factbox.
> If I then trigger SMW_refreshData.php it erases the complete property for
> the page even
> I use a commandline exception like this:
>
> if($wgCommandLineMode==true):
>              return true;
>          endif;
>
> So this means there is no way to inject an edit-action with automated
> property data unless you use
> special properties and 'SMWStore::updateDataBefore'. Is this right? We have
> tried hidden fields in SF too.
> But the hidden field-implementation of Semantic Forms is some kind buggy. We
> also modified the markup at runtime which
> results in ugly tagging code for the user.
>
> Are there any functional alternatives to inject an edit-action to provide
> automated semantic data values, which will stay after
> triggering SMW_refreshData.php?
>
> c u steve
>
>
> -----Ursprüngliche Nachricht-----
> Von: Markus Krötzsch [mailto:mar...@semantic-mediawiki.org]
> Gesendet: Samstag, 23. Februar 2013 19:14
> An: Lists
> Cc: semediawiki-devel@lists.sourceforge.net
> Betreff: Re: [SMW-devel] Any chance to get special properties to the
> factbox?
>
> On 23/02/13 17:36, Lists wrote:
>> Hello Markus and the others,
>>
>>
>> we are doing this in a "SMWStore::updateDataBefore" - handler. The
>> property shows up in the browse function not in the "normal" article
>> view. If this isn't functional how can we alter an existing property
>> value with this handler?
>> Let's say we have a property called "Edited by". This property should
>> have the value (string) "Hans Bot" which would be set programatically
>> in an "SMWStore::updateDataBefore - handler" while saving an article.
>> How to archieve this?
>
> Properties that should appear in the Factbox need to be added during
> parsing, so you would have to use another MediaWiki hook that is triggered
> during parsing. The SMWStore hook is called only when the page is saved, so
> it does not happen at all on preview, so it cannot have any effect on the
> Factbox. There are many MW hooks that run during parsing, but we do not have
> a standard pattern or example code for hacking into the system at this
> point, I think. You can have a look at the SMW code if you like
> (SMWParseData implements the main methods used to store data during parsing;
> most importantly, you can get the SMWSemanticData object during parsing by
> calling SMWParseData::getSMWData( $parser ); if you store data in there
> during parsing then it should appear in the Factbox).
>
> Cheers,
>
> Markus
>
>>
>> For now we have this for a special/meta property which doesn't fits:
>>
>>     //Edited by
>>           $revision = Revision::newFromTitle($title);
>>           $user     = User::newFromId($revision->getUser());
>>
>> if(($user->isAnon()==false)&&($wgCommandLineMode==false))://bug es wird
> trotzdem geadded bei SMW_refreshData.php
>>               $dataItem =
> SMWDIWikiPage::newFromTitle($user->getUserPage());
>>               $property = new SMWDIProperty('___SDWED');
>>               if(!is_null($dataItem)):
>>                   $data->addPropertyObjectValue($property, $dataItem);
>>               endif;
>>           endif;
>>
>>
>>> The Factbox is populated while parsing the page. Every meta property
>>> that
>> is added at this time will appear in the Factbox. As a matter of
>>> principle, meta properties that are not known yet when building the
>> page cannot be shown in the Factbox (simple way to judge this: is the
>>> property already known when creating an edit preview?).
>>
>>> If a property is added in time and still does not appear in the
>>> Factbox, it
>> might be that its display is disabled. This is defined when
>>> registering new properties. One can also check if the property is
>> shown in Special:Browse (if not, then it may be invisible; maybe it
>> does >not even have a user-readable label).
>>
>>> Cheers
>>
>>> Markus
>>
>> ----------------------------------------------------------------------
>> ------
>> --------------------------------------------------------
>> Hello SMW community,
>>
>>
>> I know it is sometimes a little bit hard to get response from this
>> list. But I will try it again with a longer description.
>> We are working with SMW and MW, contributed extensions to MW since
>> several years now and want to develope some special SMW-based
>> MW-extensions. We are not able to visit SMW-Conferences- so we only
>> can reach the currently published mailinglists, documentations and videos.
>>
>> Thanks to the extension "Semantic Extra Special Properties" it is now
>> transparent how to create properties with PHP for the first time by a
>> simple and god to use example code. We also managed to read, delete
>> properties and add cumulative values to a property (maybe the wrong
>> way). To get a little bit progress in this CRUD-related cases I want
>> to aks the following questions in the hope someone can provide
>> anwers/resources. I post no code here because my last mail was truncated
> and trashed ;-).
>>
>> 1. Unfortunately we did not succeed in using the SMWWriter extension.
>> Is this project still maintained. Did someone used it with MW 1.20.x
>> and SMW 1.8.x?
>>
>> 2. When we are dealing with PHP-driven properties, we always produce
>> special properties. How can we create and manipulate properties
>> related to userland in PHP?
>>
>> 2.1 How can we avoid doubling of values in a string typed property?
>>
>> 2.2 How can we influence the display of PHP-generated properties in
>> the factbox?
>>
>> 3. Instead of the SF-API we want to use our already established MW-API
>> interface and poor PHP. Are there any additional resources how to
>> manage this CRUD-things...create, read, update, delete semantic
>> properties on an "official standard way" so that we can maintain our
>> developments along this official standards in the long term?
>>
>> best regards and thank you for your help
>>
>> Steve
>>
>>
>> ----------------------------------------------------------------------
>> -------- Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics Download AppDynamics Lite
>> for free today:
>> http://p.sf.net/sfu/appdyn_d2d_feb
>> _______________________________________________
>> Semediawiki-devel mailing list
>> Semediawiki-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>>
>
>


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to