[MediaWiki-commits] [Gerrit] Disable Persona button in browsers that do not have Javascript - change (mediawiki...Persona)

2014-03-24 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/120502

Change subject: Disable Persona button in browsers that do not have Javascript
..

Disable Persona button in browsers that do not have Javascript

Bug: 57523
Change-Id: I9390897409c5238c84a2f53ce1cb587f54d2efd9
---
M Persona.php
M js/persona_hooks.js
M js/persona_hooks_old.js
3 files changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Persona 
refs/changes/02/120502/1

diff --git a/Persona.php b/Persona.php
index a90cfd4..d041d02 100644
--- a/Persona.php
+++ b/Persona.php
@@ -166,6 +166,7 @@
array(
'id' => 'wpPersona',
'class' => 'mw-ui-button',
+   'style' => 'display:none',
)
);
$template->set( 'header', $personaButton );
@@ -188,7 +189,8 @@
$personal_urls['personalogin'] = array(
'text' => wfMessage( 'persona-login' ),
'href' => '#',
-   'active' => $title->isSpecial( 'Userlogin' )
+   'class' => 'printfooter',
+   'active' => $title->isSpecial( 'Userlogin' ),
);
}
 
diff --git a/js/persona_hooks.js b/js/persona_hooks.js
index 1272c7f..b3b0f19 100644
--- a/js/persona_hooks.js
+++ b/js/persona_hooks.js
@@ -1,3 +1,8 @@
+window.onload = function () {
+   $('#wpPersona').css('display', 'block');
+   $('#pt-personalogin > a').removeClass('printfooter');
+};
+
 ( function( $, mw ) {
'use strict';
 
diff --git a/js/persona_hooks_old.js b/js/persona_hooks_old.js
index b0a09e2..f3cbd5e 100644
--- a/js/persona_hooks_old.js
+++ b/js/persona_hooks_old.js
@@ -5,6 +5,11 @@
  *   * Use of jsMessage rather than the newer mw.notify
  */
 
+window.onload = function () {
+   $('#wpPersona').css('display', 'block');
+   $('#pt-personalogin > a').removeClass('printfooter');
+};
+
 ( function( $, mw ) {
'use strict';
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9390897409c5238c84a2f53ce1cb587f54d2efd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Persona
Gerrit-Branch: master
Gerrit-Owner: Jatin 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Two fields having a common part in the name result in a brea... - change (mediawiki...SemanticForms)

2014-03-26 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/121112

Change subject: Two fields having a common part in the name result in a breakage
..

Two fields having a common part in the name result in a breakage

Bug: 36016
Change-Id: I3607b6654f73163b3c7b76d0c3ef6e7e9084c85d
---
M includes/SF_TemplateInForm.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/12/121112/1

diff --git a/includes/SF_TemplateInForm.php b/includes/SF_TemplateInForm.php
index 195b41e..67f2da8 100644
--- a/includes/SF_TemplateInForm.php
+++ b/includes/SF_TemplateInForm.php
@@ -20,7 +20,7 @@
function handlePropertySettingInTemplate( $fieldName, $propertyName, 
$isList, &$templateFields, $templateText ) {
global $wgContLang;
$templateField = SFTemplateField::create( $fieldName, 
$wgContLang->ucfirst( $fieldName ), $propertyName, $isList );
-   $cur_pos = stripos( $templateText, $fieldName );
+   $cur_pos = stripos( $templateText, $fieldName.'|' );
$templateFields[$cur_pos] = $templateField;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3607b6654f73163b3c7b76d0c3ef6e7e9084c85d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] making js files pass jshint - change (mediawiki...SemanticFormsInputs)

2014-03-28 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/121679

Change subject: making js files pass jshint
..

making js files pass jshint

Bug: 61631
Change-Id: I0c25ff5363aa68f1a6484dad6054d026015fafca
---
M libs/datecheck.js
M libs/datepicker.js
M libs/datetimepicker.js
M libs/jquery.form-validator.js
M libs/jquery.multi-select.js
M libs/jquery.quicksearch.js
M libs/menuselect.js
M libs/regexp.js
M libs/timepicker.js
M libs/twolistboxes.js
10 files changed, 86 insertions(+), 76 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticFormsInputs 
refs/changes/79/121679/1

diff --git a/libs/datecheck.js b/libs/datecheck.js
index 2440c2c..83f1984 100644
--- a/libs/datecheck.js
+++ b/libs/datecheck.js
@@ -5,6 +5,8 @@
  *
  */
 
+var mw;
+
 window.SFI_DateCheck_init = function(input_id, params) {
 $.validate({
borderColorOnError : '', // Border color of elements with 
invalid value; empty string to not change border color as it messes up the 
style of the input box
diff --git a/libs/datepicker.js b/libs/datepicker.js
index 06cc483..e0b9494 100644
--- a/libs/datepicker.js
+++ b/libs/datepicker.js
@@ -30,7 +30,7 @@

var tabindex = inputShow.attr('tabindex');

-   var re = /\d{4}\/\d{2}\/\d{2}/
+   var re = /\d{4}\/\d{2}\/\d{2}/;
 
if ( params.disabled ) {
 
@@ -97,35 +97,37 @@
inputShow.datepicker( 'widget' ).addClass( 
params.userClasses );
jQuery( '#' + input_id + ' + button' ).addClass( 
params.userClasses );
}
-
+   var i;
if ( params.disabledDates ) {

-   var disabledDates = new Array();
-
+   var disabledDates = [];
+   
for (i in params.disabledDates)
-   disabledDates.push([
+   if ( params.disabledDates[i] )
+   disabledDates.push([
new Date(params.disabledDates[i][0], 
params.disabledDates[i][1], params.disabledDates[i][2]),
new Date(params.disabledDates[i][3], 
params.disabledDates[i][4], params.disabledDates[i][5])
-   ]);
+   ]);
 
inputShow.datepicker( 'option', 'disabledDates', 
disabledDates );
 
-   delete disabledDates;
+   disabledDates = null;
}
 
if ( params.highlightedDates ) {
 
-   var highlightedDates = new Array();
+   var highlightedDates = [];
 
for (i in params.highlightedDates)
-   highlightedDates.push([
-   new Date(params.highlightedDates[i][0], 
params.highlightedDates[i][1], params.highlightedDates[i][2]),
-   new Date(params.highlightedDates[i][3], 
params.highlightedDates[i][4], params.highlightedDates[i][5])
-   ]);
+   if ( params.highlightedDates[i])
+  highlightedDates.push([
+new Date(params.highlightedDates[i][0], 
params.highlightedDates[i][1], params.highlightedDates[i][2]),
+new Date(params.highlightedDates[i][3], 
params.highlightedDates[i][4], params.highlightedDates[i][5])
+  ]);
 
inputShow.datepicker( 'option', 'highlightedDates', 
highlightedDates );
 
-   delete highlightedDates;
+   highlightedDates = null;
}
 
if (params.disabledDays) {
@@ -163,7 +165,7 @@
 
inputShow.datepicker( 'widget' ).hide();
}
-}
+};
 
 /**
  * Checks a date if it is to be enabled or highlighted
@@ -179,7 +181,7 @@
 
var jInput = jQuery( input );
 
-   var enable = true
+   var enable = true;
 
var disabledDays = jInput.datepicker( 'option', 'disabledDays' );
 
diff --git a/libs/datetimepicker.js b/libs/datetimepicker.js
index 255c85b..52acce7 100644
--- a/libs/datetimepicker.js
+++ b/libs/datetimepicker.js
@@ -4,7 +4,7 @@
  * @author Stephan Gambke
  *
  */
-
+/*jshint sub:true*/
 
 window.SFI_DTP_init = function( inputId, params ) {
 
@@ -29,14 +29,16 @@

// call initialisation functions for subinputs
for (var subinputId in params.subinputsInitData) {
-   
-   for ( var index in params.subinputsInitData[subinputId] ) {
+   if ( params.subinputsInitDat[subinputId] ) {
+  for ( var index in params.subinputsInitData[subinputId] ) {
+if( params.subinputsInitData[subinputId][index] ) 

[MediaWiki-commits] [Gerrit] default=now for datepicker - change (mediawiki...SemanticFormsInputs)

2014-03-29 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/121979

Change subject: default=now for datepicker
..

default=now for datepicker

Bug: 61363
Change-Id: I297cb76a51ed455fb48c212ec2433cf4bce8a4ae
---
M includes/SFI_DatePicker.php
1 file changed, 28 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticFormsInputs 
refs/changes/79/121979/1

diff --git a/includes/SFI_DatePicker.php b/includes/SFI_DatePicker.php
index e1956eb..7436bd7 100644
--- a/includes/SFI_DatePicker.php
+++ b/includes/SFI_DatePicker.php
@@ -409,6 +409,18 @@
$jsattribs['showWeek'] = false;
}
 
+   //set default date
+   if ( array_key_exists( 'default', $this->mOtherArgs ) ) 
{
+   if ( $this->mOtherArgs['default'] == 'now' ) {
+   if ( array_key_exists( 'dateFormat', 
$jsattribs ) ) {
+   $format = 
$this->jsDateFormatToPHPDateFormat( $jsattribs['dateFormat'] );
+   $jsattribs['currValue'] = date( 
$format );
+   }
+   } else {
+   $jsattribs['currValue'] = '';
+   }
+   }
+
// store min date as JS attrib
if ( $minDate ) {
$jsattribs['minDate'] = $minDate->format( 
'Y/m/d' );
@@ -703,6 +715,22 @@
return $html;
}
 
+   public function jsDateFormatToPHPDateFormat( $jsFormat) {
+   $phpFormat = '';
+
+   for ( $i = 0; $i < strlen( $jsFormat ); $i++) {
+   if ( $jsFormat[$i] == $jsFormat[$i+1]) {
+   $phpFormat .= $jsFormat[$i];
+   $i++; 
+   } else {
+   $phpFormat .= $jsFormat[$i];
+   }
+   }
+   $phpFormat = str_replace( 'y', 'Y', $phpFormat );
+
+   return $phpFormat;
+   }
+
/**
 * Returns the set of SMW property types which this input can
 * handle, but for which it isn't the default input.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I297cb76a51ed455fb48c212ec2433cf4bce8a4ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticFormsInputs
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Standard inputs lose their values on preview Bug: xxxxxx Cha... - change (mediawiki...SemanticForms)

2014-03-21 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/120149

Change subject: Standard inputs lose their values on preview Bug: xx 
Change-Id: If1f51c4fe30da8ad4963a0ba072161906ccc291b
..

Standard inputs lose their values on preview
Bug: xx
Change-Id: If1f51c4fe30da8ad4963a0ba072161906ccc291b
---
M includes/SF_FormPrinter.php
M includes/SF_FormUtils.php
2 files changed, 41 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/49/120149/1

diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index 98e9456..4403df9 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -1357,6 +1357,7 @@
$input_label = null;
$attr = array();
 
+   $values = $wgRequest->getValues();
// if it's a query, ignore all standard 
inputs except run query
if ( ( $is_query && $input_name != 'run 
query' ) || ( !$is_query && $input_name == 'run query' ) ) {
$new_text = "";
@@ -1395,11 +1396,30 @@
}
}
if ( $input_name == 'summary' ) {
-   $new_text = 
SFFormUtils::summaryInputHTML( $form_is_disabled, $input_label, $attr );
+   if ( array_key_exists( 
'wpSummary', $values ) ) {
+   $value = $values[ 
'wpSummary' ];
+   } else {
+   $value = '';
+   }
+   $new_text = 
SFFormUtils::summaryInputHTML( $form_is_disabled, $input_label, $attr, $value );
} elseif ( $input_name == 'minor edit' 
) {
-   $new_text = 
SFFormUtils::minorEditInputHTML( $form_is_disabled, $input_label, $attr );
+   if ( array_key_exists( 
'wpMinoredit', $values ) ) {
+   $value = $values[ 
'wpMinoredit' ];
+   } else {
+   $value = null;
+   }
+   $new_text = 
SFFormUtils::minorEditInputHTML( $form_is_disabled, $input_label, $attr, $value 
);
} elseif ( $input_name == 'watch' ) {
-   $new_text = 
SFFormUtils::watchInputHTML( $form_is_disabled, $is_checked, $input_label, 
$attr );
+   if ( $form_submitted == 
SFAutoeditAPI::ACTION_PREVIEW ) {
+   if ( 
array_key_exists('wpWatchthis', $values ) ) {
+   $value = 
$values[ 'wpWatchthis' ];
+   } else {
+   $value = null;
+   }   
+   } else {
+   $value = 1;
+   }
+   $new_text = 
SFFormUtils::watchInputHTML( $form_is_disabled, $is_checked, $input_label, 
$attr, $value );
} elseif ( $input_name == 'save' ) {
$new_text = 
SFFormUtils::saveButtonHTML( $form_is_disabled, $input_label, $attr );
} elseif ( $input_name == 'save and 
continue' ) {
diff --git a/includes/SF_FormUtils.php b/includes/SF_FormUtils.php
index 0c3c890..df3d758 100644
--- a/includes/SF_FormUtils.php
+++ b/includes/SF_FormUtils.php
@@ -66,7 +66,7 @@
return $additional_template_text;
}
 
-   static function summaryInputHTML( $is_disabled, $label = null, $attr = 
array() ) {
+   static function summaryInputHTML( $is_disabled, $label = null, $attr = 
array(), $value = '' ) {
global $sfgTabIndex;
 
$sfgTabIndex++;
@@ -76,13 +76,13 @@
$attr = Html::expandAttributes( $attr );
$text = <<$label
-   
+   
 
 END;
return $text;
}
 
-   static function minorEditInputHTML( $is_disabled

[MediaWiki-commits] [Gerrit] fixed 'class=' parameter for new Tokens input type - change (mediawiki...SemanticForms)

2014-08-15 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/154266

Change subject: fixed 'class=' parameter for new Tokens input type
..

fixed 'class=' parameter for new Tokens input type

Change-Id: I7bac501f91bc517c19be3c94e642003dc90ef0bb
---
M libs/ext.sf.select2.tokens.js
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/66/154266/1

diff --git a/libs/ext.sf.select2.tokens.js b/libs/ext.sf.select2.tokens.js
index 2fa126a..df1d474 100644
--- a/libs/ext.sf.select2.tokens.js
+++ b/libs/ext.sf.select2.tokens.js
@@ -126,6 +126,8 @@
opts.adaptContainerCssClass = function( clazz ) {
if (clazz == "mandatoryField") {
return "";
+   } else {
+   return clazz;
}
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bac501f91bc517c19be3c94e642003dc90ef0bb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Tokens - searching wiki for full image URL if image name ret... - change (mediawiki...SemanticForms)

2014-08-18 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/154788

Change subject: Tokens - searching wiki for full image URL if image name 
retrieved using ED
..

Tokens - searching wiki for full image URL if image name retrieved using ED

Change-Id: I1cdf8f770778b690a63615b4c7cbba2379d0474b
---
M includes/forminputs/SF_TokensInput.php
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/88/154788/1

diff --git a/includes/forminputs/SF_TokensInput.php 
b/includes/forminputs/SF_TokensInput.php
index 8ac994e..26be470 100644
--- a/includes/forminputs/SF_TokensInput.php
+++ b/includes/forminputs/SF_TokensInput.php
@@ -64,7 +64,21 @@
$sfgEDSettings[$name]['title'] = 
$other_args['values from external data'];
}
if ( array_key_exists( 'image', $other_args ) ) {
-   $sfgEDSettings[$name]['image'] = 
$other_args['image'];
+   $image_param =  $other_args['image'];
+   $sfgEDSettings[$name]['image'] = $image_param;
+   global $edgValues;
+   for ($i = 0; $i < 
count($edgValues[$image_param]); $i++) {
+   $image = $edgValues[$image_param][$i];
+   if ( strpos( $image, "http" ) !== 0 ) {
+   $file = wfFindFile( $image );
+   if ( $file ) {
+   $url = 
$file->getFullUrl();
+   
$edgValues[$image_param][$i] = $url;
+   } else {
+   
$edgValues[$image_param][$i] = "";
+   }
+   }
+   }
}
if ( array_key_exists( 'description', $other_args ) ) {
$sfgEDSettings[$name]['description'] = 
$other_args['description'];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cdf8f770778b690a63615b4c7cbba2379d0474b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Added new input type - tokens - change (mediawiki...SemanticForms)

2014-07-02 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/143598

Change subject: Added new input type - tokens
..

Added new input type - tokens

Added a new input type - tokens into SF. This input type can
be used wherever multiple values are allowed.
Also, changed structure of select2 files by introducing a new base
class that has some basic properties which can be inherited and extended
by combobox and tokens.

Change-Id: I51f2029e0f70f4aa1d99faadb9fd27b334e6ea3d
---
M SemanticForms.php
M i18n/en.json
M includes/SF_FormPrinter.php
M includes/forminputs/SF_TextWithAutocompleteInput.php
A includes/forminputs/SF_TokensInput.php
M libs/SemanticForms.js
A libs/ext.sf.select2.base.js
A libs/ext.sf.select2.combobox.js
A libs/ext.sf.select2.tokens.js
9 files changed, 778 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/98/143598/1

diff --git a/SemanticForms.php b/SemanticForms.php
index 738f2ba..6e999ea 100644
--- a/SemanticForms.php
+++ b/SemanticForms.php
@@ -194,6 +194,7 @@
 $GLOBALS['wgAutoloadClasses']['SFTreeInput'] = __DIR__ . 
'/includes/forminputs/SF_TreeInput.php';
 $GLOBALS['wgAutoloadClasses']['SFCategoryInput'] = __DIR__ . 
'/includes/forminputs/SF_CategoryInput.php';
 $GLOBALS['wgAutoloadClasses']['SFCategoriesInput'] = __DIR__ . 
'/includes/forminputs/SF_CategoriesInput.php';
+$GLOBALS['wgAutoloadClasses']['SFTokensInput'] = __DIR__ . 
'/includes/forminputs/SF_TokensInput.php';
 
 $GLOBALS['wgJobClasses']['createPage'] = 'SFCreatePageJob';
 $GLOBALS['wgAutoloadClasses']['SFCreatePageJob'] = __DIR__ . 
'/includes/SF_CreatePageJob.php';
@@ -316,7 +317,9 @@
'ext.semanticforms.select2' => $sfgResourceTemplate + array(
'scripts' => array(
'libs/select2.js',
-   'libs/ext.sf.select2.js',
+   'libs/ext.sf.select2.base.js',
+   'libs/ext.sf.select2.combobox.js',
+   'libs/ext.sf.select2.tokens.js',
),
'styles' => array(
'skins/select2/select2.css',
diff --git a/i18n/en.json b/i18n/en.json
index e99a926..145274b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -75,6 +75,7 @@
 "sf_forminputs_width": "The width of this input, in pixels",
 "sf_forminputs_checkboxes_select_all": "Select all",
 "sf_forminputs_checkboxes_select_none": "Select none",
+"sf_forminputs_maxtokens": "Maximum number of values that can be tokenized 
for a field",
 "createform": "Create a form",
 "sf-createform-with-name": "Create form: $1",
 "sf_createform_nameinput": "Form name",
@@ -204,6 +205,6 @@
 "sf-select2-searching": "Searching...",
 "sf-select2-input-too-short": "Please enter $1 or more characters",
 "sf-select2-input-too-long": "Search input too long",
-"sf-select2-selection-too-big": "You cannot select any more choices",
+"sf-select2-selection-too-big": "You can select only $1 choices",
 "sf-select2-load-more": "Loading more results..."
 }
\ No newline at end of file
diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index 8618929..3afd029 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -48,6 +48,7 @@
$this->registerInputType( 'SFTreeInput' );
$this->registerInputType( 'SFCategoryInput' );
$this->registerInputType( 'SFCategoriesInput' );
+   $this->registerInputType( 'SFTokensInput' );
 
// All-purpose setup hook.
wfRunHooks( 'sfFormPrinterSetup', array( $this ) );
diff --git a/includes/forminputs/SF_TextWithAutocompleteInput.php 
b/includes/forminputs/SF_TextWithAutocompleteInput.php
index 712a4d7..acfdd29 100644
--- a/includes/forminputs/SF_TextWithAutocompleteInput.php
+++ b/includes/forminputs/SF_TextWithAutocompleteInput.php
@@ -88,7 +88,7 @@
}
 
public static function setAutocompleteValues( $field_args ) {
-   global $sfgAutocompleteValues;
+   global $sfgAutocompleteValues, $sfgMaxLocalAutocompleteValues;
 
// Get all autocomplete-related values, plus delimiter value
// (it's needed also for the 'uploadable' link, if there is 
one).
@@ -122,6 +122,10 @@
} else {
$autocompleteValues = 
SFUtils::getAutocompleteValues( $autocompletionSource, $autocompleteFieldType );
}
+   if( count($autocompleteValues) > 
$sfgMaxLocalAutocompleteValues &&
+   $autocompleteFieldType != 'values' && 
!array_key_exists( 'values dependent on', $field_args ) ) {
+   $remoteDataType = $autocompleteFieldType;
+   

[MediaWiki-commits] [Gerrit] Displaying additional data in Select2 combobox - change (mediawiki...SemanticForms)

2014-07-25 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/149346

Change subject: Displaying additional data in Select2 combobox
..

Displaying additional data in Select2 combobox

Change-Id: I9b65c8b04e1d2a22ef6af9203c62201207416a6c
---
M includes/SF_FormUtils.php
M includes/forminputs/SF_ComboBoxInput.php
M libs/ext.sf.select2.base.js
M libs/ext.sf.select2.combobox.js
M libs/ext.sf.select2.tokens.js
M skins/ext.sf.select2.css
6 files changed, 164 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/46/149346/1

diff --git a/includes/SF_FormUtils.php b/includes/SF_FormUtils.php
index 5876353..c965273 100644
--- a/includes/SF_FormUtils.php
+++ b/includes/SF_FormUtils.php
@@ -15,6 +15,7 @@
global $sfgAutocompleteValues, $sfgAutocompleteOnAllChars;
global $sfgFieldProperties, $sfgDependentFields;
global $sfgShowOnSelect, $sfgScriptPath;
+   global $edgValues, $sfgEDSettings;
 // global $sfgInitJSFunctions, $sfgValidationJSFunctions;
 
$vars['sfgAutocompleteValues'] = $sfgAutocompleteValues;
@@ -23,6 +24,8 @@
$vars['sfgDependentFields'] = $sfgDependentFields;
$vars['sfgShowOnSelect'] = $sfgShowOnSelect;
$vars['sfgScriptPath'] = $sfgScriptPath;
+   $vars['edgValues'] = $edgValues;
+   $vars['sfgEDSettings'] = $sfgEDSettings;
 // $vars['sfgInitJSFunctions'] = $sfgInitJSFunctions;
 // $vars['sfgValidationJSFunctions'] = $sfgValidationJSFunctions;
 
diff --git a/includes/forminputs/SF_ComboBoxInput.php 
b/includes/forminputs/SF_ComboBoxInput.php
index 79b031e..319a9fd 100644
--- a/includes/forminputs/SF_ComboBoxInput.php
+++ b/includes/forminputs/SF_ComboBoxInput.php
@@ -28,7 +28,7 @@
return SFTextInput::getHTML( $cur_value, $input_name, 
$is_mandatory, $is_disabled, $other_args );
}
 
-   global $sfgTabIndex, $sfgFieldNum;
+   global $sfgTabIndex, $sfgFieldNum, $sfgEDSettings;
 
$className = 'sfComboBox';
if ( $is_mandatory ) {
@@ -43,8 +43,27 @@
} else {
$size = '35';
}
-
-   list( $autocompleteSettings, $remoteDataType ) = 
self::setAutocompleteValues( $other_args );
+   if ( array_key_exists( 'values from external data', $other_args 
) ) {
+   $autocompleteSettings = 'external data';
+   $remoteDataType = null;
+   if ( array_key_exists( 'origName', $other_args ) ) {
+   $name = $other_args['origName'];
+   } else {
+   $name = $input_name;
+   }
+   $sfgEDSettings[$name] = array();
+   if ( array_key_exists( 'title', $other_args ) ) {
+   $sfgEDSettings[$name]['title'] = 
$other_args['title'];
+   }
+   if ( array_key_exists( 'image', $other_args ) ) {
+   $sfgEDSettings[$name]['image'] = 
$other_args['image'];
+   }
+   if ( array_key_exists( 'description', $other_args ) ) {
+   $sfgEDSettings[$name]['description'] = 
$other_args['description'];
+   }
+   } else {
+   list( $autocompleteSettings, $remoteDataType ) = 
self::setAutocompleteValues( $other_args );
+   }
 
$inputAttrs = array(
'type' => 'text',
diff --git a/libs/ext.sf.select2.base.js b/libs/ext.sf.select2.base.js
index 4a6cc16..f2143d2 100644
--- a/libs/ext.sf.select2.base.js
+++ b/libs/ext.sf.select2.base.js
@@ -71,23 +71,26 @@
formatResult: function(value, container, query) {
var term = query.term;
var text = value.text;
+   var image = value.image;
+   var description = value.description;
var markup = "";
-   var no_diac_text = 
sf.select2.base.prototype.removeDiacritics( text );
-   var start = 
no_diac_text.toUpperCase().indexOf(term.toUpperCase());
-   if (start != 0 && !mw.config.get( 
'sfgAutocompleteOnAllChars' )) {
-   var start = 
no_diac_text.toUpperCase().indexOf(" " + term.toUpperCase());
-   if ( start != -1 ) {
-   start = start + 1;
-   }
-   }
-   if ( start != -1 ) {
-   markup = text.substr

[MediaWiki-commits] [Gerrit] "tokens" input type not working correctly when "delimiter" v... - change (mediawiki...SemanticForms)

2014-11-17 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173989

Change subject: "tokens" input type not working correctly when "delimiter" 
value is set
..

"tokens" input type not working correctly when "delimiter" value is set

Bug: 73144
Change-Id: I3bffcf99e781aee5e48d6ac6d5d439cd81cc99db
---
M libs/ext.sf.select2.tokens.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/89/173989/1

diff --git a/libs/ext.sf.select2.tokens.js b/libs/ext.sf.select2.tokens.js
index 3be0223..095c349 100644
--- a/libs/ext.sf.select2.tokens.js
+++ b/libs/ext.sf.select2.tokens.js
@@ -289,7 +289,7 @@
tokens_proto.getDelimiter = function ( element ) {
var field_values = element.attr('autocompletesettings').split( 
',' );
var delimiter = ",";
-   if (field_values[1] == 'list' && field_values[2] !== undefined 
)  {
+   if (field_values[1] == 'list' && field_values[2] !== undefined 
&& field_values[2] != "")  {
delimiter = field_values[2];
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3bffcf99e781aee5e48d6ac6d5d439cd81cc99db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Error message punctuation - change (mediawiki...SemanticForms)

2014-07-08 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/144721

Change subject: Error message punctuation
..

Error message punctuation

Change-Id: I24e4a37f70c943fc9b21442860aff2dfc142bf05
---
M i18n/en.json
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/21/144721/1

diff --git a/i18n/en.json b/i18n/en.json
index e99a926..cc9ec27 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -202,8 +202,6 @@
 "action-viewedittab": "view the \"{{int:edit}}\" tab for pages editable by 
form",
 "sf-select2-no-matches": "No matches",
 "sf-select2-searching": "Searching...",
-"sf-select2-input-too-short": "Please enter $1 or more characters",
-"sf-select2-input-too-long": "Search input too long",
-"sf-select2-selection-too-big": "You cannot select any more choices",
-"sf-select2-load-more": "Loading more results..."
+"sf-select2-input-too-short": "Please enter $1 or more characters.",
+"sf-select2-selection-too-big": "This field cannot hold more than $1 
values."
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24e4a37f70c943fc9b21442860aff2dfc142bf05
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed description of unused messages - change (mediawiki...SemanticForms)

2014-07-08 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/144764

Change subject: Removed description of unused messages
..

Removed description of unused messages

Change-Id: I5ad817c4690b06acec9b2adc2b5bee580c86c465
---
M i18n/qqq.json
1 file changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/64/144764/1

diff --git a/i18n/qqq.json b/i18n/qqq.json
index 419e90e..82e4736 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -140,10 +140,8 @@
 "action-createclass": "{{doc-action|createclass}}",
 "action-editrestrictedfields": "{{doc-action|editrestrictedfields}}",
 "action-viewedittab": "{{doc-action|viewedittab}}\nRefers to 
{{msg-mw|Edit}}.",
-"sf-select2-no-matches": "A message that is displayed when nothing is 
matched in Select2 autocompletion",
-"sf-select2-searching": "A message that is displayed while search is in 
progress in Select2 autocompletion",
-"sf-select2-input-too-short": "A message that is displayed when search 
string for Select2 autocompletion is smaller than the defined value",
-"sf-select2-input-too-long": "A message that is displayed when search 
string for Select2 autocompletion is longer than the defined value",
-"sf-select2-selection-too-big": "A message that is displayed when the 
number of selections for a multi-valued input is more than a certain number",
-"sf-select2-load-more": "A message that is displayed while loaading more 
results for autocompletion via Select2"
+"sf-select2-no-matches": "A message that is displayed when nothing is 
matched in Select2 autocompletion.",
+"sf-select2-searching": "A message that is displayed while search is in 
progress in Select2 autocompletion.",
+"sf-select2-input-too-short": "A message that is displayed when search 
string for Select2 autocompletion is smaller than the defined value.",
+"sf-select2-selection-too-big": "A message that is displayed when the 
number of selections for a multi-valued input is more than a certain number."
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ad817c4690b06acec9b2adc2b5bee580c86c465
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Added plural support for a message - change (mediawiki...SemanticForms)

2014-07-10 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/145398

Change subject: Added plural support for a message
..

Added plural support for a message

Change-Id: Ic23eb4d61ee9716ce40030c8bb52f136d9505dd4
---
M SemanticForms.php
M i18n/en.json
2 files changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/98/145398/1

diff --git a/SemanticForms.php b/SemanticForms.php
index 738f2ba..56b2b49 100644
--- a/SemanticForms.php
+++ b/SemanticForms.php
@@ -325,6 +325,7 @@
),
'dependencies' => array(
'ext.semanticforms',
+   'mediawiki.jqueryMsg',
),
'messages' => array(
'sf-select2-no-matches',
diff --git a/i18n/en.json b/i18n/en.json
index cc9ec27..d070efa 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -203,5 +203,5 @@
 "sf-select2-no-matches": "No matches",
 "sf-select2-searching": "Searching...",
 "sf-select2-input-too-short": "Please enter $1 or more characters.",
-"sf-select2-selection-too-big": "This field cannot hold more than $1 
values."
+"sf-select2-selection-too-big": "This field cannot hold more than 
{{PLURAL:$1|$1 value|$1 values}}."
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic23eb4d61ee9716ce40030c8bb52f136d9505dd4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Making SF pass JSHint test - change (mediawiki...SemanticForms)

2014-08-05 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/151970

Change subject: Making SF pass JSHint test
..

Making SF pass JSHint test

Bug: 61630
Change-Id: I40e5d3b7588f176909f152a4602f9423cf63d286
---
A .jshintrc
M libs/SF_autoedit.js
M libs/SF_autogrow.js
M libs/SF_checkboxes.js
M libs/SF_collapsible.js
M libs/SF_imagePreview.js
M libs/SF_popupform.js
M libs/SF_preview.js
M libs/SF_submit.js
M libs/SF_wikieditor.js
M libs/SemanticForms.js
M libs/ext.dynatree.js
M libs/ext.sf.select2.base.js
M libs/ext.sf.select2.combobox.js
M libs/ext.sf.select2.tokens.js
M libs/jquery.browser.js
M libs/jquery.dynatree.js
M libs/jquery.fancybox.js
18 files changed, 231 insertions(+), 211 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/70/151970/1

diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 000..a07cb6f
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,40 @@
+{
+   "predef": [
+   "mediaWiki",
+   "jQuery",
+   "semanticforms"
+   "mw",
+   "$",
+   "sf",
+   "ext"
+   ],
+
+   "bitwise": true,
+   "camelcase": false,
+   "curly": true,
+   "eqeqeq": true,
+   "forin": false,
+   "immed": true,
+   "latedef": true,
+   "newcap": true,
+   "noarg": false,
+   "noempty": true,
+   "nonew": true,
+   "quotmark": false,
+   "regexp": false,
+   "undef": true,
+   "unused": false,
+   "strict": false,
+   "trailing": true,
+
+   "laxbreak": true,
+   "smarttabs": true,
+   "multistr": true,
+
+   "browser": true,
+
+   "nomen": false,
+   "onevar": false,
+
+   "scripturl":false
+}
diff --git a/libs/SF_autoedit.js b/libs/SF_autoedit.js
index a41e50d..904251c 100644
--- a/libs/SF_autoedit.js
+++ b/libs/SF_autoedit.js
@@ -4,7 +4,6 @@
  * @author Stephan Gambke
  */
 
-/*global jQuery, mediaWiki */
 /*global confirm */
 
 ( function ( $, mw ) {
diff --git a/libs/SF_autogrow.js b/libs/SF_autogrow.js
index c566a90..a807764 100644
--- a/libs/SF_autogrow.js
+++ b/libs/SF_autogrow.js
@@ -24,7 +24,7 @@
 function autoGrowBindEvents(textArea) {
textArea.onkeyup = function() {
autoGrow(textArea);
-   }
+   };
 }
 
 function autoGrow(textArea) {
diff --git a/libs/SF_checkboxes.js b/libs/SF_checkboxes.js
index f49f0b8..019e502 100644
--- a/libs/SF_checkboxes.js
+++ b/libs/SF_checkboxes.js
@@ -4,8 +4,6 @@
  * @author Stephan Gambke
  */
 
-/*global jQuery, mediaWiki */
-
 ( function ( $, mw ) {
 
'use strict';
@@ -50,7 +48,7 @@
} );
 
return this;
-   }
+   };
 
$().ready( function ( $ ) {
$( '.checkboxesSpan.select-all' ).appendSelectionSwitches();
diff --git a/libs/SF_collapsible.js b/libs/SF_collapsible.js
index 330f61d..c945f40 100644
--- a/libs/SF_collapsible.js
+++ b/libs/SF_collapsible.js
@@ -26,7 +26,7 @@
this.each(function(){
var fieldset = jQuery(this);
var legend = fieldset.children('legend');
-   if ( setting.collapsed == true ) {
+   if ( setting.collapsed === true ) {
legend.toggle(
function(){
sfShowFieldsetContent(fieldset, 
setting);
@@ -45,7 +45,7 @@
function(){
sfShowFieldsetContent(fieldset, 
setting);
}
-   )
+   );
}
});
 };
diff --git a/libs/SF_imagePreview.js b/libs/SF_imagePreview.js
index 842e5a2..c1f3aff 100644
--- a/libs/SF_imagePreview.js
+++ b/libs/SF_imagePreview.js
@@ -23,9 +23,9 @@
if ( data.query && data.query.pages ) {
var pages = data.query.pages;
 
-   for ( p in pages ) {
+   for ( var p = 0; p < pages.length; p++ 
) {
var info = pages[p].imageinfo;
-   for ( i in info ) {
+   for ( var i = 0; i < 
info.length; i++ ) {
callback( 
info[i].thumburl );
return;
}
diff --git a/libs/SF_popupform.js b/libs/SF_popupform.js
index c7a8222..732ab80 100644
--- a/libs/SF_popupform.js
+++ b/libs/SF_popupform.js
@@ -4,6 +4,7 @@
  * @author Stephan Gambke
  *
  */
+/*global escape*/
 
 // initialise
 jQuery( function() {
@@ -33,7 +34,7 @@
window.ext = {};
 }
 
-window.ext.popupform = new function() {
+

[MediaWiki-commits] [Gerrit] Fixed problem with remote autocompletion in tokens and combo... - change (mediawiki...SemanticForms)

2014-08-23 Thread Jatin (Code Review)
Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/155899

Change subject: Fixed problem with remote autocompletion in tokens and combobox 
for private wikis
..

Fixed problem with remote autocompletion in tokens and combobox for private 
wikis

Change-Id: Ifcee0c0e71e2ce844514388b74607ae4cfa23895
---
M libs/ext.sf.select2.combobox.js
M libs/ext.sf.select2.tokens.js
2 files changed, 20 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/99/155899/1

diff --git a/libs/ext.sf.select2.combobox.js b/libs/ext.sf.select2.combobox.js
index ca6e6ae..cccfab9 100644
--- a/libs/ext.sf.select2.combobox.js
+++ b/libs/ext.sf.select2.combobox.js
@@ -193,7 +193,7 @@
 
var ajaxOpts = {
url: my_server,
-   dataType: 'jsonp',
+   dataType: 'json',
data: function (term) {
return {
substr: term, // search term
@@ -201,11 +201,15 @@
},
results: function (data, page, query) { // parse the 
results into the format expected by Select2.
var id = 0;
-   data.sfautocomplete.forEach( function(item) {
-   item.id = id++;
-   item.text = item.title;
-   });
-   return {results: data.sfautocomplete};
+   if (data.sfautocomplete !== undefined) {
+   data.sfautocomplete.forEach( 
function(item) {
+   item.id = id++;
+   item.text = item.title;
+   });
+   return {results: data.sfautocomplete};
+   } else {
+   return {results: []};
+   }
}
};
 
diff --git a/libs/ext.sf.select2.tokens.js b/libs/ext.sf.select2.tokens.js
index df1d474..3be0223 100644
--- a/libs/ext.sf.select2.tokens.js
+++ b/libs/ext.sf.select2.tokens.js
@@ -237,7 +237,7 @@
 
var ajaxOpts = {
url: my_server,
-   dataType: 'jsonp',
+   dataType: 'json',
data: function (term) {
return {
substr: term, // search term
@@ -245,11 +245,15 @@
},
results: function (data, page, query) { // parse the 
results into the format expected by Select2.
var id = 0;
-   data.sfautocomplete.forEach( function(item) {
-   item.id = id++;
-   item.text = item.title;
-   });
-   return {results: data.sfautocomplete};
+   if (data.sfautocomplete !== undefined) {
+   data.sfautocomplete.forEach( 
function(item) {
+   item.id = id++;
+   item.text = item.title;
+   });
+   return {results: data.sfautocomplete};
+   } else {
+   return {results: []};
+   }
}
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifcee0c0e71e2ce844514388b74607ae4cfa23895
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits