Index: data/TWiki/TWikiPreferences.txt
===================================================================
RCS file: /d/www/CVS/twiki-cairo-beta/data/TWiki/TWikiPreferences.txt,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** data/TWiki/TWikiPreferences.txt	5 Jun 2004 02:32:34 -0000	1.1.1.1
--- data/TWiki/TWikiPreferences.txt	6 Jun 2004 02:35:09 -0000	1.1.1.1.2.1
***************
*** 248,253 ****
--- 248,263 ----
  	* %TWIKIWEB%.PreviewBackground image:
  		* Set PREVIEWBGIMAGE = %PUBURLPATH%/%TWIKIWEB%/PreviewBackground/preview2bg.gif
  
+ ---++ Calendar preferences of [[http://dynarch.com/mishoo/calendar.epl][Mishoo DHTML calendar]]
+ 
+ 	* Date format 
+ 		* Set JSCALENDARDATEFORMAT = %d %b %Y
+ 
+ 	* Language of DHTML calendar, pointing to attached =calendar-&lt;code&gt;.js= language file: =en=, =af=, =br=, =ca=, =cs-win=, =da=, =de=, =du=, =el=, =es=, =fr=, =hr=, =hr-utf8=, =hu=, =it=, =jp=, =nl=, =no=, =pl=, =pt=, =ro=, =ru=, =sk=, =sp=, =sv=, =tr=, =zh=
+ 		* Set JSCALENDARLANGUAGE = en
+ 
+ 	* Additional options of DHTML calendar:
+ 		* Set JSCALENDAROPTIONS = 
  
  ---++ Access Control Settings
  
Index: lib/TWiki/Form.pm
===================================================================
RCS file: /d/www/CVS/twiki-cairo-beta/lib/TWiki/Form.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1 -r1.1.1.1.2.2
*** lib/TWiki/Form.pm	5 Jun 2004 02:32:39 -0000	1.1.1.1
--- lib/TWiki/Form.pm	6 Jun 2004 02:33:53 -0000	1.1.1.1.2.2
***************
*** 334,339 ****
--- 334,346 ----
              $value =~ s/</&lt\;/go;
              $value =~ s/>/&gt\;/go;
              $value = "<input type=\"text\" name=\"$name\" size=\"$size\" value=\"$value\" />";
+ 	} elsif ( $type eq "date" ) { # calendar.ep
+ 	  $value =~ s/"/"/go; # Make sure double quote don't kill us
+ 	  $value =~ s/&/&\;/go;
+ 	  $value =~ s/</<\;/go;
+ 	  $value =~ s/>/>\;/go;
+ 	  $value = "<input type=\"text\" name=\"$name\" id=\"id$name\"size=\"$size\" value=\"$value\" /><button type=\"reset\" id=\"trigger$name\">...</button><script type=\"text/javascript\">Calendar.setup({inputField : \"id$name\", ifFormat : \"%JSCALENDARDATEFORMAT%\", button : \"trigger$name\", singleClick  : true  %JSCALENDAROPTIONS%}); </script>";
+ 	  $query->{'jscalendar'} = 1;
          } elsif( $type eq "label" ) {
              my $escaped = $value;
              $escaped =~ s/&/&amp\;/go;
Index: lib/TWiki/Plugins/EditTablePlugin.pm
===================================================================
RCS file: /d/www/CVS/twiki-cairo-beta/lib/TWiki/Plugins/EditTablePlugin.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1 -r1.1.1.1.2.2
*** lib/TWiki/Plugins/EditTablePlugin.pm	5 Jun 2004 02:32:39 -0000	1.1.1.1
--- lib/TWiki/Plugins/EditTablePlugin.pm	6 Jun 2004 02:33:54 -0000	1.1.1.1.2.2
***************
*** 126,147 ****
  
      &TWiki::Func::writeDebug( "- EditTablePlugin::commonTagsHandler( $_[2].$_[1] )" ) if $debug;
  
-     # Add style sheet for date calendar to skin if needed.
-     # Handling of the common tags is done separately for the topic text and view skin
-     # The following if statement must be done before the early escape.
-     #
-     # NOTE:
-     # When adding a new button to the table that needs the table to be in the edit mode,
-     # be sure to add it below.
-     if( ( $_[0] =~ m/^[<][!]DOCTYPE/ ) &&
-         ( $query->param( 'etedit' ) || $query->param( 'etaddrow' ) || $query->param( 'etdelrow') ) &&
-         (!($_[0] =~ m/calendar-system/) ) ) {
- 
-         my $string = " <link type=\"text/css\" rel=\"stylesheet\""
-                    . " href=\"%PUBURL%/$installWeb/EditTablePlugin/calendar-system.css\" />\n";
-         $_[0] =~ s/([<]\/head[>])/$string$1/i;
-     }
- 
      return unless $_[0] =~ /%EDIT(TABLE|CELL){(.*)}%/os;
  
      unless( $prefsInitialized ) {
--- 126,131 ----
***************
*** 152,158 ****
          $prefEDITBUTTON           = &TWiki::Func::getPreferencesValue("EDITBUTTON") ||
                      &TWiki::Func::getPreferencesValue("EDITTABLEPLUGIN_EDITBUTTON") || "Edit table";
          $prefJSCALENDARDATEFORMAT = &TWiki::Func::getPreferencesValue("JSCALENDARDATEFORMAT") ||
!                     &TWiki::Func::getPreferencesValue("EDITTABLEPLUGIN_JSCALENDARDATEFORMAT") || "%Y/%m/%d";
          $prefJSCALENDARLANGUAGE   = &TWiki::Func::getPreferencesValue("JSCALENDARLANGUAGE") ||
                      &TWiki::Func::getPreferencesValue("EDITTABLEPLUGIN_JSCALENDARLANGUAGE") || "en";
          $prefJSCALENDAROPTIONS    = &TWiki::Func::getPreferencesValue("JSCALENDAROPTIONS") ||
--- 136,142 ----
          $prefEDITBUTTON           = &TWiki::Func::getPreferencesValue("EDITBUTTON") ||
                      &TWiki::Func::getPreferencesValue("EDITTABLEPLUGIN_EDITBUTTON") || "Edit table";
          $prefJSCALENDARDATEFORMAT = &TWiki::Func::getPreferencesValue("JSCALENDARDATEFORMAT") ||
!                     &TWiki::Func::getPreferencesValue("EDITTABLEPLUGIN_JSCALENDARDATEFORMAT") || "%d %b %Y";
          $prefJSCALENDARLANGUAGE   = &TWiki::Func::getPreferencesValue("JSCALENDARLANGUAGE") ||
                      &TWiki::Func::getPreferencesValue("EDITTABLEPLUGIN_JSCALENDARLANGUAGE") || "en";
          $prefJSCALENDAROPTIONS    = &TWiki::Func::getPreferencesValue("JSCALENDAROPTIONS") ||
***************
*** 396,410 ****
  {
      my( $theWeb, $theTopic, $theTableNr, $doEdit ) = @_;
  
!     my $viewUrl = &TWiki::Func::getScriptUrl( $theWeb, $theTopic, "viewauth" ) . "\#edittable$theTableNr";
      my $text = "";
-     if( $doEdit ) {
-         my $dir = "%PUBURL%/$installWeb/EditTablePlugin";
-         $text .= "$preSp<script type=\"text/javascript\" src=\"$dir/calendar.js\"></script>\n";
-         $text .= "$preSp<script type=\"text/javascript\" src=\"$dir/calendar-"
-                . "$prefJSCALENDARLANGUAGE.js\"></script>\n";
-         $text .= "$preSp<script type=\"text/javascript\" src=\"$dir/calendar-setup.js\"></script>\n";
-     }
      $text .= "$preSp<noautolink>\n" if $doEdit;
      $text .= "$preSp<a name=\"edittable$theTableNr\"></a>\n";
      $text .= "$preSp<form name=\"edittable$theTableNr\" action=\"$viewUrl\" method=\"post\">\n";
--- 380,387 ----
  {
      my( $theWeb, $theTopic, $theTableNr, $doEdit ) = @_;
  
!     my $viewUrl = &TWiki::Func::getScriptUrl( $theWeb, $theTopic, "view" ) . "\#edittable$theTableNr";
      my $text = "";
      $text .= "$preSp<noautolink>\n" if $doEdit;
      $text .= "$preSp<a name=\"edittable$theTableNr\"></a>\n";
      $text .= "$preSp<form name=\"edittable$theTableNr\" action=\"$viewUrl\" method=\"post\">\n";
Index: lib/TWiki/UI/Edit.pm
===================================================================
RCS file: /d/www/CVS/twiki-cairo-beta/lib/TWiki/UI/Edit.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1 -r1.1.1.1.2.2
*** lib/TWiki/UI/Edit.pm	5 Jun 2004 02:32:39 -0000	1.1.1.1
--- lib/TWiki/UI/Edit.pm	6 Jun 2004 02:33:54 -0000	1.1.1.1.2.2
***************
*** 33,38 ****
--- 33,42 ----
  use TWiki::Store;
  use TWiki::UI;
  
+ use vars qw(
+       $prefJSCALENDARDATEFORMAT $prefJSCALENDARLANGUAGE $prefJSCALENDAROPTIONS
+ );
+ 
  =pod
  
  ---++ edit( $webName, $topic, $userName, $query )
***************
*** 69,74 ****
--- 73,84 ----
    my $text = "";
    my $meta = "";
    my $extra = "";
+ 
+   $prefJSCALENDARDATEFORMAT = &TWiki::Func::getPreferencesValue("JSCALENDARDATEFORMAT");
+   $prefJSCALENDARLANGUAGE   = &TWiki::Func::getPreferencesValue("JSCALENDARLANGUAGE");
+   $prefJSCALENDAROPTIONS    = &TWiki::Func::getPreferencesValue("JSCALENDAROPTIONS");
+   $query->{'jscalendar'} = 0;
+ 
    my $topicExists  = &TWiki::Store::topicExists( $webName, $topic );
  
    # Prevent editing existing topic?
***************
*** 254,259 ****
--- 264,279 ----
    $tmpl =~ s/%FORMTEMPLATE%//go; # Clear if not being used
    $tmpl =~ s/%TEXT%/$text/go;
    $tmpl =~ s/( ?) *<\/?(nop|noautolink)\/?>\n?/$1/gois;   # remove <nop> and <noautolink> tags
+ 
+   if ($query->{'jscalendar'}) {
+     # add header data for jscalendar if used. Use header in jscalendar.tmpl
+     my $jstmpl = &TWiki::Store::readTemplate( "jscalendar", $skin );
+     $jstmpl =~ s/%JSCALENDARLANGUAGE%/$prefJSCALENDARLANGUAGE/go;
+     $jstmpl = &TWiki::handleCommonTags( $jstmpl, $topic );
+     $tmpl =~ s/%JSCALENDAROPTIONS%/$prefJSCALENDAROPTIONS/go;
+     $tmpl =~ s/%JSCALENDARDATEFORMAT%/$prefJSCALENDARDATEFORMAT/go;
+     $tmpl =~ s/<\/head>/$jstmpl<\/head>/o;
+   }
  
    TWiki::writeHeaderFull ( $query, 'edit', 'text/html', length($tmpl) );
  
Index: lib/TWiki/UI/View.pm
===================================================================
RCS file: /d/www/CVS/twiki-cairo-beta/lib/TWiki/UI/View.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1 -r1.1.1.1.2.2
*** lib/TWiki/UI/View.pm	5 Jun 2004 02:32:40 -0000	1.1.1.1
--- lib/TWiki/UI/View.pm	6 Jun 2004 02:33:54 -0000	1.1.1.1.2.2
***************
*** 31,36 ****
--- 31,40 ----
  use TWiki;
  use TWiki::UI;
  
+ use vars qw(
+       $prefJSCALENDARDATEFORMAT $prefJSCALENDARLANGUAGE $prefJSCALENDAROPTIONS
+ );
+ 
  =pod
  
  ---++ view( $web, $topic, $scruptUrl, $query )
***************
*** 53,58 ****
--- 57,67 ----
    my $skin    = $query->param( "skin" );
    my $contentType = $query->param( "contenttype" );
  
+   $prefJSCALENDARDATEFORMAT = &TWiki::Func::getPreferencesValue("JSCALENDARDATEFORMAT");
+   $prefJSCALENDARLANGUAGE   = &TWiki::Func::getPreferencesValue("JSCALENDARLANGUAGE");
+   $prefJSCALENDAROPTIONS    = &TWiki::Func::getPreferencesValue("JSCALENDAROPTIONS");
+   $query->{'jscalendar'} = 0;
+ 
    TWiki::UI::writeDebugTimes( "view - initialized" );
  
    my $tmpl = "";
***************
*** 272,277 ****
--- 281,296 ----
    }
    if( ! $viewAccessOK ) {
      TWiki::UI::oops( $webName, $topic, "accessview" );
+   }
+ 
+   if ($query->{'jscalendar'}) {
+     # add header data for jscalendar if used. Use header in jscalendar.tmpl
+     my $jstmpl = &TWiki::Store::readTemplate( "jscalendar", $skin );
+     $jstmpl =~ s/%JSCALENDARLANGUAGE%/$prefJSCALENDARLANGUAGE/go;
+     $jstmpl = &TWiki::handleCommonTags( $jstmpl, $topic );
+     $tmpl =~ s/%JSCALENDAROPTIONS%/$prefJSCALENDAROPTIONS/go;
+     $tmpl =~ s/%JSCALENDARDATEFORMAT%/$prefJSCALENDARDATEFORMAT/go;
+     $tmpl =~ s/<\/head>/$jstmpl<\/head>/o;
    }
  
    TWiki::UI::writeDebugTimes( "view - checked access permissions" );
