Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390941 )

Change subject: Added "uploadable" support for tokens, combobox inputs
......................................................................

Added "uploadable" support for tokens, combobox inputs

Change-Id: I6f02c0e35760403c92c44a7d83cc81b275cfdc1f
---
M includes/forminputs/PF_ComboBoxInput.php
M includes/forminputs/PF_TokensInput.php
2 files changed, 46 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms 
refs/changes/41/390941/2

diff --git a/includes/forminputs/PF_ComboBoxInput.php 
b/includes/forminputs/PF_ComboBoxInput.php
index 81843bc..0a2fc7e 100644
--- a/includes/forminputs/PF_ComboBoxInput.php
+++ b/includes/forminputs/PF_ComboBoxInput.php
@@ -83,9 +83,11 @@
                        list( $autocompleteSettings, $remoteDataType ) = 
self::setAutocompleteValues( $other_args );
                }
 
+               $input_id = 'input_' . $wgPageFormsFieldNum;
+
                $inputAttrs = array(
                        'type' => 'text',
-                       'id' => "input_$wgPageFormsFieldNum",
+                       'id' => $input_id,
                        'name' => $input_name,
                        'class' => $className,
                        'tabindex' => $wgPageFormsTabIndex,
@@ -111,6 +113,16 @@
                }
 
                $inputText = Html::rawElement( 'input', $inputAttrs);
+
+               if ( array_key_exists( 'uploadable', $other_args ) && 
$other_args['uploadable'] == true ) {
+                       if ( array_key_exists( 'default filename', $other_args 
) ) {
+                               $default_filename = $other_args['default 
filename'];
+                       } else {
+                               $default_filename = '';
+                       }
+
+                       $inputText .= PFTextInput::uploadableHTML( $input_id, 
$delimiter = null, $default_filename, $cur_value, $other_args );
+               }
 
                $divClass = 'ui-widget';
                if ( $is_mandatory ) {
@@ -165,6 +177,16 @@
                        'type' => 'boolean',
                        'description' => wfMessage( 
'pf_forminputs_existingvaluesonly' )->text()
                );
+               $params[] = array(
+                       'name' => 'uploadable',
+                       'type' => 'boolean',
+                       'description' => wfMessage( 'pf_forminputs_uploadable' 
)->text()
+               );
+               $params[] = array(
+                       'name' => 'default filename',
+                       'type' => 'string',
+                       'description' => wfMessage( 
'pf_forminputs_defaultfilename' )->text()
+               );
                return $params;
        }
 
diff --git a/includes/forminputs/PF_TokensInput.php 
b/includes/forminputs/PF_TokensInput.php
index 2e860b8..e9db579 100644
--- a/includes/forminputs/PF_TokensInput.php
+++ b/includes/forminputs/PF_TokensInput.php
@@ -150,11 +150,21 @@
                if ( array_key_exists( 'max values', $other_args ) ) {
                        $inputAttrs['maxvalues'] = $other_args['max values'];
                }
-               if ( array_key_exists( 'namespace', $other_args ) ) {
-                       $inputAttrs['data-namespace'] = 
$other_args['namespace'];
-               }
+               if ( array_key_exists( 'namespace', $other_args ) ) {
+                       $inputAttrs['data-namespace'] = 
$other_args['namespace'];
+               }
 
                $text = "\n\t" . Html::input( $input_name, $cur_value, 'text', 
$inputAttrs ) . "\n";
+
+               if ( array_key_exists( 'uploadable', $other_args ) && 
$other_args['uploadable'] == true ) {
+                       if ( array_key_exists( 'default filename', $other_args 
) ) {
+                               $default_filename = $other_args['default 
filename'];
+                       } else {
+                               $default_filename = '';
+                       }
+
+                       $text .= PFTextInput::uploadableHTML( $input_id, 
$delimiter, $default_filename, $cur_value, $other_args );
+               }
 
                $spanClass = 'inputSpan';
                if ( $is_mandatory ) {
@@ -189,6 +199,16 @@
                        'description' => wfMessage( 'pf_forminputs_maxvalues' 
)->text()
                );
                $params = array_merge( $params, 
PFTextWithAutocompleteInput::getAutocompletionParameters() );
+               $params[] = array(
+                       'name' => 'uploadable',
+                       'type' => 'boolean',
+                       'description' => wfMessage( 'pf_forminputs_uploadable' 
)->text()
+               );
+               $params[] = array(
+                       'name' => 'default filename',
+                       'type' => 'string',
+                       'description' => wfMessage( 
'pf_forminputs_defaultfilename' )->text()
+               );
 
                return $params;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/390941
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f02c0e35760403c92c44a7d83cc81b275cfdc1f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to