jenkins-bot has submitted this change and it was merged.
Change subject: Template generated by Special:CreateClass can now use
#set_internal
......................................................................
Template generated by Special:CreateClass can now use #set_internal
Change-Id: I8b6a700e3d0e8e337796e2f2e285fe9064a37977
---
M includes/SF_TemplateField.php
M specials/SF_CreateClass.php
2 files changed, 31 insertions(+), 2 deletions(-)
Approvals:
Yaron Koren: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/SF_TemplateField.php b/includes/SF_TemplateField.php
index b399d59..09f2d47 100644
--- a/includes/SF_TemplateField.php
+++ b/includes/SF_TemplateField.php
@@ -196,7 +196,7 @@
// Only add a call to #set_internal if the Semantic Internal
// Objects extension is also installed.
- if ( $internal_obj_property && class_exists(
'SIOInternalObject' ) ) {
+ if ( $internal_obj_property && defined( 'SIO_VERSION' ) ) {
$setInternalText = '{{#set_internal:' .
$internal_obj_property;
} else {
$setInternalText = null;
diff --git a/specials/SF_CreateClass.php b/specials/SF_CreateClass.php
index d44aab5..ceddf15 100644
--- a/specials/SF_CreateClass.php
+++ b/specials/SF_CreateClass.php
@@ -42,11 +42,13 @@
jQuery('label[for="form_name"]').css('color',
'gray').css('font-style', 'italic');
jQuery('#category_name').attr('disabled', 'disabled');
jQuery('label[for="category_name"]').css('color',
'gray').css('font-style', 'italic');
+ jQuery('#connecting_property_div').show('fast');
} else {
jQuery('#form_name').removeAttr('disabled');
jQuery('label[for="form_name"]').css('color',
'').css('font-style', '');
jQuery('#category_name').removeAttr('disabled');
jQuery('label[for="category_name"]').css('color',
'').css('font-style', '');
+ jQuery('#connecting_property_div').hide('fast');
}
}
@@ -100,10 +102,25 @@
}
}
+ // Also create the "connecting property", if there is one.
+ if ( $wgRequest->getCheck('connecting_property') ) {
+ global $smwgContLang;
+ $datatypeLabels = $smwgContLang->getDatatypeLabels();
+ $property_type = $datatypeLabels['_wpg'];
+ $full_text = SFCreateProperty::createPropertyText(
$property_type, '', $allowed_values );
+ $property_name = trim(
$wgRequest->getVal('connecting_property') );
+ $property_title = Title::makeTitleSafe(
SMW_NS_PROPERTY, $property_name );
+ $params = array();
+ $params['user_id'] = $wgUser->getId();
+ $params['page_text'] = $full_text;
+ $jobs[] = new SFCreatePageJob( $property_title, $params
);
+ }
+
// Create the template, and save it (might as well save
// one page, instead of just creating jobs for all of them).
$template_format = $wgRequest->getVal( "template_format" );
- $full_text = SFTemplateField::createTemplateText(
$template_name, $fields, null, $category_name, null, null, $template_format );
+ $connecting_property = $wgRequest->getVal(
"connecting_property" );
+ $full_text = SFTemplateField::createTemplateText(
$template_name, $fields, $connecting_property, $category_name, null, null,
$template_format );
$template_title = Title::makeTitleSafe( NS_TEMPLATE,
$template_name );
$edit_summary = '';
if ( method_exists( 'WikiPage', 'doEditContent' ) ) {
@@ -199,6 +216,18 @@
'id' => 'template_multiple',
'onclick' => "disableFormAndCategoryInputs()",
) ) . ' ' . wfMessage(
'sf_createtemplate_multipleinstance' )->text() ) . "\n";
+ if ( defined( 'SIO_VERSION' ) ) {
+ $templateInfo .= Html::rawElement( 'div',
+ array (
+ 'id' => 'connecting_property_div',
+ 'style' => 'display: none;',
+ ),
+ wfMessage(
'semanticinternalobjects-mainpropertyname' )->text() . "\n" .
+ Html::element( 'input', array(
+ 'type' => 'text',
+ 'name' => 'connecting_property',
+ ) ) ) . "\n";
+ }
$text .= Html::rawElement( 'blockquote', null, $templateInfo );
$text .= "\t" . Html::rawElement( 'p', null, Html::element(
'label', array( 'for' => 'form_name' ), $form_name_label ) . ' ' .
Html::element( 'input', array( 'size' => '30', 'name' => 'form_name', 'id' =>
'form_name' ), null ) ) . "\n";
--
To view, visit https://gerrit.wikimedia.org/r/91895
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8b6a700e3d0e8e337796e2f2e285fe9064a37977
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits