http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89202
Revision: 89202
Author: yaron
Date: 2011-05-31 04:24:08 +0000 (Tue, 31 May 2011)
Log Message:
-----------
SFUtils::getSMWPropertyValues() now returns values, instead of objects
Modified Paths:
--------------
trunk/extensions/SemanticForms/includes/SF_FormLinker.php
trunk/extensions/SemanticForms/includes/SF_TemplateField.php
Modified: trunk/extensions/SemanticForms/includes/SF_FormLinker.php
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_FormLinker.php 2011-05-31
04:22:48 UTC (rev 89201)
+++ trunk/extensions/SemanticForms/includes/SF_FormLinker.php 2011-05-31
04:24:08 UTC (rev 89202)
@@ -133,27 +133,14 @@
}
$store = smwfGetStore();
- $res = SFUtils::getSMWPropertyValues( $store, $page_name,
$page_namespace, $prop_smw_id );
+ $form_names = SFUtils::getSMWPropertyValues( $store,
$page_name, $page_namespace, $prop_smw_id );
- $form_names = array();
- foreach ( $res as $wiki_page_value ) {
- // SMW 1.6+
- if ( $wiki_page_value instanceof SMWDIWikiPage ) {
- $form_names[] = $wiki_page_value->getDBkey();
- } else {
- $form_title = $wiki_page_value->getTitle();
- if ( ! is_null( $form_title ) ) {
- $form_names[] = $form_title->getText();
- }
- }
- }
- // if we're using a non-English language, check for the English
string as well
+ // If we're using a non-English language, check for the English
+ // string as well.
if ( ! class_exists( 'SF_LanguageEn' ) || ! $sfgContLang
instanceof SF_LanguageEn ) {
- $res = SFUtils::getSMWPropertyValues( $store,
$page_name, $page_namespace, $backup_prop_smw_id );
- foreach ( $res as $wiki_page_value )
- $form_names[] =
$wiki_page_value->getTitle()->getText();
+ $backup_form_names = SFUtils::getSMWPropertyValues(
$store, $page_name, $page_namespace, $backup_prop_smw_id );
+ $form_names = array_merge( $form_names,
$backup_form_names );
}
- $form_names = array_unique( $form_names );
// Add this data to the "cache".
self::$mLinkedForms[$page_key][$form_connection_type] =
$form_names;
return $form_names;
@@ -298,8 +285,9 @@
// See if the page itself has a default form (or forms), and
// return it/them if so.
$default_forms = self::getFormsThatPagePointsTo(
$title->getText(), $title->getNamespace(), self::PAGE_DEFAULT_FORM );
- if ( count( $default_forms ) > 0 )
+ if ( count( $default_forms ) > 0 ) {
return $default_forms;
+ }
// If this is not a category page, look for a default form
// for its parent category or categories.
$namespace = $title->getNamespace();
Modified: trunk/extensions/SemanticForms/includes/SF_TemplateField.php
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_TemplateField.php
2011-05-31 04:22:48 UTC (rev 89201)
+++ trunk/extensions/SemanticForms/includes/SF_TemplateField.php
2011-05-31 04:24:08 UTC (rev 89202)
@@ -72,15 +72,14 @@
}
// TODO - need handling for the case of more than one type.
if ( count( $types ) > 0 ) {
- $this->field_type = $types[0]->getWikiValue();
+ $this->field_type = $types[0];
}
- foreach ( $allowed_values as $value ) {
+ foreach ( $allowed_values as $allowed_value ) {
// HTML-unencode each value
- $wiki_value = html_entity_decode(
$value->getWikiValue() );
- $this->possible_values[] = $wiki_value;
+ $this->possible_values[] = html_entity_decode(
$allowed_value );
if ( count( $label_formats ) > 0 ) {
- $label_format =
$label_formats[0]->getWikiValue();
+ $label_format = $label_formats[0];
$prop_instance =
SMWDataValueFactory::findTypeID( $this->field_type );
$label_value =
SMWDataValueFactory::newTypeIDValue( $prop_instance, $wiki_value );
$label_value->setOutputFormat( $label_format );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs