WordPress.org

Plugin Directory

Changeset 688191


Ignore:
Timestamp:
03/27/13 23:56:45 (13 months ago)
Author:
liedekef
Message:

no more need for own eme_datepicker_format function, let jquery and datepicker themselved do it

Location:
events-made-easy/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • events-made-easy/trunk/eme_events.php

    r688161 r688191  
    20972097         $event['event_end_24h_time'] = date('H:i',time()+3600); 
    20982098    
    2099    $localised_start_date = eme_datepicker_localised_date($event['event_start_date']); 
    2100    $localised_end_date = eme_datepicker_localised_date($event['event_end_date']); 
    21012099   if (!isset($event['recurrence_start_date'])) $event['recurrence_start_date']=""; 
    2102    $localised_rec_start_date = eme_datepicker_localised_date($event['recurrence_start_date']); 
    21032100   if (!isset($event['recurrence_end_date'])) $event['recurrence_end_date']=""; 
    2104    $localised_rec_end_date = eme_datepicker_localised_date($event['recurrence_end_date']); 
    21052101 
    21062102   $freq_options = array ("daily" => __ ( 'Daily', 'eme' ), "weekly" => __ ( 'Weekly', 'eme' ), "monthly" => __ ( 'Monthly', 'eme' ) ); 
     
    21332129    
    21342130   ob_start(); 
     2131// the next javascript will fill in the values for localised-start-date, ... form fields and jquery datepicker will fill in also to "to_submit" form fields 
    21352132   ?> 
     2133 
     2134<script type="text/javascript"> 
     2135 $j_eme_event(document).ready( function() { 
     2136   var dateFormat = $j_eme_event("#localised-start-date").datepicker( "option", "dateFormat" ); 
     2137   $j_eme_event("#localised-start-date").datepicker("option", "dateFormat", "yy-mm-dd" ); 
     2138   $j_eme_event("#localised-end-date").datepicker("option", "dateFormat", "yy-mm-dd" ); 
     2139   $j_eme_event("#localised-rec-start-date").datepicker("option", "dateFormat", "yy-mm-dd" ); 
     2140   $j_eme_event("#localised-rec-end-date").datepicker("option", "dateFormat", "yy-mm-dd" ); 
     2141   $j_eme_event("#localised-start-date").datepicker("setDate", "<?php echo $event['event_start_date']; ?>"); 
     2142   $j_eme_event("#localised-end-date").datepicker("setDate", "<?php echo $event['event_end_date']; ?>"); 
     2143   $j_eme_event("#localised-rec-start-date").datepicker("setDate", "<?php echo $event['recurrence_start_date']; ?>"); 
     2144   $j_eme_event("#localised-rec-end-date").datepicker("setDate", "<?php echo $event['recurrence_end_date']; ?>"); 
     2145   $j_eme_event("#localised-start-date").datepicker("option", "dateFormat", dateFormat ); 
     2146   $j_eme_event("#localised-end-date").datepicker("option", "dateFormat", dateFormat ); 
     2147   $j_eme_event("#localised-rec-start-date").datepicker("option", "dateFormat",dateFormat ); 
     2148   $j_eme_event("#localised-rec-end-date").datepicker("option", "dateFormat", dateFormat ); 
     2149 }); 
     2150</script> 
     2151 
    21362152   <form id="eventForm" name="eventForm" method="post" enctype="multipart/form-data" action="<?php echo $form_destination; ?>"> 
    21372153      <div class="wrap"> 
     
    24062422                     </h3> 
    24072423                     <div class="inside"> 
    2408                         <input id="localised-start-date" type="text" name="localised_event_start_date" value="<?php echo $localised_start_date?>" style="display: none;" readonly="readonly" /> 
    2409                         <input id="start-date-to-submit" type="text" name="event_start_date" value="<?php echo $event['event_start_date']?>" style="background: #FCFFAA" /> 
    2410                         <input id="localised-end-date" type="text" name="localised_event_end_date" value="<?php echo $localised_end_date?>" style="display: none;" readonly="readonly" /> 
    2411                         <input id="end-date-to-submit" type="text" name="event_end_date" value="<?php echo $event['event_end_date']?>" style="background: #FCFFAA" /> 
     2424                        <input id="localised-start-date" type="text" name="localised_event_start_date" value="" style="display: none;" readonly="readonly" /> 
     2425                        <input id="start-date-to-submit" type="text" name="event_start_date" value="" style="background: #FCFFAA" /> 
     2426                        <input id="localised-end-date" type="text" name="localised_event_end_date" value="" style="display: none;" readonly="readonly" /> 
     2427                        <input id="end-date-to-submit" type="text" name="event_end_date" value="" style="background: #FCFFAA" /> 
    24122428                        <br /> 
    24132429                        <span id='event-date-explanation'> 
     
    24212437                     </h3> 
    24222438                     <div class="inside"> 
    2423                         <input id="localised-rec-start-date" type="text" name="localised_recurrence_date" value="<?php echo $localised_rec_start_date?>" readonly="readonly" /> 
    2424                         <input id="rec-start-date-to-submit" type="text" name="recurrence_start_date" value="<?php echo $event['recurrence_start_date']?>" style="background: #FCFFAA" /> 
    2425                         <input id="localised-rec-end-date" type="text" name="localised_recurrence_end_date" value="<?php echo $localised_rec_end_date?>" readonly="readonly" /> 
    2426                         <input id="rec-end-date-to-submit" type="text" name="recurrence_end_date" value="<?php echo $event['recurrence_end_date']?>" style="background: #FCFFAA" /> 
     2439                        <input id="localised-rec-start-date" type="text" name="localised_recurrence_date" value="" readonly="readonly" /> 
     2440                        <input id="rec-start-date-to-submit" type="text" name="recurrence_start_date" value="" style="background: #FCFFAA" /> 
     2441                        <input id="localised-rec-end-date" type="text" name="localised_recurrence_end_date" value="" readonly="readonly" /> 
     2442                        <input id="rec-end-date-to-submit" type="text" name="recurrence_end_date" value="" style="background: #FCFFAA" /> 
    24272443                        <br /> 
    24282444                        <span id='recurrence-dates-explanation'> 
  • events-made-easy/trunk/eme_functions.php

    r687808 r688191  
    282282   $event_status_array[STATUS_DRAFT] = __ ( 'Draft', 'eme' ); 
    283283   return $event_status_array; 
    284 } 
    285  
    286 function eme_datepicker_localised_date($mydate) { 
    287    global $localised_date_formats; 
    288  
    289    // $mydate should be in yyyy-mm-dd format 
    290    $locale_code = get_locale(); 
    291    if (isset($localised_date_formats [$locale_code])) { 
    292       $localised_date_format = $localised_date_formats [$locale_code]; 
    293    } else { 
    294       $localised_date_format = $localised_date_formats ["en"]; 
    295    } 
    296  
    297    if ($mydate != "") { 
    298       preg_match ( "/(\d{4})-(\d\d?)-(\d\d?)/", $mydate, $matches ); 
    299       $year = $matches [1]; 
    300       $month = sprintf("%02d",$matches [2]); 
    301       $day = sprintf("%02d",$matches [3]); 
    302       return str_replace ( "yy", $year, str_replace ( "mm", $month, str_replace ( "dd", $day, $localised_date_format ) ) ); 
    303    } else { 
    304       return ""; 
    305    } 
    306284} 
    307285 
  • events-made-easy/trunk/events-manager.php

    r688176 r688191  
    209209define('DEBUG', false); 
    210210 
    211 // Localised date formats as in the jquery UI datepicker plugin 
    212 $localised_date_formats = array("am" => "dd.mm.yy","ar" => "dd/mm/yy", "bg" => "dd.mm.yy", "ca" => "mm/dd/yy", "cs" => "dd.mm.yy", "da" => "dd-mm-yy", "de" =>"dd.mm.yy", "es" => "dd/mm/yy", "en" => "mm/dd/yy", "en_GB" => "dd/mm/yy", "fi" => "dd.mm.yy", "fr" => "dd/mm/yy", "he" => "dd/mm/yy", "hu" => "yy-mm-dd", "hy" => "dd.mm.yy", "id" => "dd/mm/yy", "is" => "dd/mm/yy", "it" => "dd/mm/yy", "ja" => "yy/mm/dd", "ko" => "yy-mm-dd", "lt" => "yy-mm-dd", "lv" => "dd-mm-yy", "nb" => "yy-mm-dd", "nl" => "dd/mm/yy", "nn" => "yy-mm-dd", "no" => "yy-mm-dd", "pl" => "yy-mm-dd", "pt" => "dd/mm/yy", "ro" => "mm/dd/yy", "ru" => "dd.mm.yy", "sk" => "dd.mm.yy", "sv" => "yy-mm-dd", "th" => "dd/mm/yy", "tr" => "dd.mm.yy", "ua" => "dd.mm.yy", "uk" => "dd.mm.yy", "us" => "mm/dd/yy", "CN" => "yy-mm-dd", "TW" => "yy/mm/dd"); 
    213  
    214211add_action('init', 'nocache_headers'); 
    215212add_action('init', 'eme_load_textdomain'); 
Note: See TracChangeset for help on using the changeset viewer.