Ignore:
Timestamp:
Sep 5, 2012, 5:13:49 PM (12 years ago)
Author:
grum
Message:

version 3.5.4
inputDate

. add possibility for time to be optional

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/js/ui.inputDate.js

    r16012 r17759  
    22 * -----------------------------------------------------------------------------
    33 * file: ui.inputDate.js
    4  * file version: 1.0.0
    5  * date: 2012-06-17
     4 * file version: 1.0.1
     5 * date: 2012-09-05
    66 *
    77 * A jQuery plugin provided by the piwigo's plugin "GrumPluginClasses"
     
    2323 * | 1.0.0   | 2012/06/17 | * first release
    2424 * |         |            |
    25  * |         |            |
     25 * | 1.0.1   | 2012/09/05 | * add possibility for time to be optional in datetime mode
    2626 * |         |            |
    2727 * |         |            |
     
    5454                    {
    5555                      dateType:'date', // date, datetime
     56                      timeMandatory:false, // used for datetime type only
    5657                      timepicker:{
    5758                        timeFormat:'hh:mm',  // hh:mm, hh:mm:ss
     
    268269        }, // timeValue
    269270
     271       timeMandatory: function (value)
     272        {
     273          if(value!=null)
     274          {
     275            var options=this.data('options');
     276
     277            // set selected value
     278            return(
     279              this.each(
     280                function()
     281                {
     282                  privateMethods.setTimeMandatory($(this), value, true);
     283                }
     284              )
     285            );
     286          }
     287          else
     288          {
     289            // return the selected tags
     290            var properties=this.data('properties');
     291            return(properties.timeMandatory);
     292          }
     293        }, // timeMandatory
     294
    270295      isValid: function (value)
    271296        {
     
    350375              hms=[];
    351376
     377          if(value=='' && !options.timeMandatory) return(true);
     378
    352379          if(re.test(value))
    353380          {
     
    387414          properties.initialized=false;
    388415
     416          privateMethods.setTimeMandatory(object, (value.timeMandatory!=null)?value.timeMandatory:options.timeMandatory);
    389417          privateMethods.setDateType(object, (value.dateType!=null)?value.dateType:options.dateType);
    390418          privateMethods.setTimePicker(object, (value.timepicker!=null)?value.timepicker:options.timepicker);
     
    494522          return(options.disabled);
    495523        }, //setDateType
     524
     525      setTimeMandatory : function (object, value)
     526        {
     527          var options=object.data('options'),
     528              objects=object.data('objects'),
     529              properties=object.data('properties');
     530
     531          if((!properties.initialized || options.timeMandatory!=value) && (value==true || value==false))
     532          {
     533            options.timeMandatory=value;
     534          }
     535          return(options.timeMandatory);
     536        }, //setTimeMandatory
    496537
    497538      setDatePicker : function (object, value)
Note: See TracChangeset for help on using the changeset viewer.