code/superant.com.rwdcalendar/gh9calendar.rb in rwdschedule-0.92 vs code/superant.com.rwdcalendar/gh9calendar.rb in rwdschedule-0.93
- old
+ new
@@ -1,16 +1,40 @@
- require 'fileutils'
-
- def showmonth
-
- begin # begin rescue monitored block
-
- command_file_path = File.join( $extras_directory, 'cal.rb' )
-
- @showmonthresult = `ruby #{command_file_path} -c #{$lang} #{@a_month.to_i} #{@a_year.to_i} `
-
- rescue # process exeption
- @showmonthresult = "\n" + "error in eval"
- end # end of rescue process # of rescure monitored block
-
- end
-
+ require 'fileutils'
+
+ def showmonth
+ require 'date'
+ begin # begin rescue monitored block
+ cal_path = File.join( $extras_directory, 'cal' )
+ require cal_path
+ to = Date.today
+ tempyear ||= to.year
+ tempmonth ||= to.mon
+ if @a_year.to_i > 0 and @a_month.to_i > 1
+ tempyear = @a_year.to_i
+ tempmonth = @a_month.to_i
+
+ end
+ tempweekdaystring = " "
+
+ cal = Cal.new
+ calendardata = cal.print(tempyear,tempmonth)
+ @showcalendartitle = calendardata[0]
+ @showcalendarweektitles = calendardata[1]
+ tempweekdaystring = calendardata[2].tr(' ', '.')
+ @showmonthresult1 = tempweekdaystring
+
+ tempweekdaystring = calendardata[3].tr(' ', '.')
+ @showmonthresult2 = tempweekdaystring
+ tempweekdaystring = calendardata[4].tr(' ', '.')
+ @showmonthresult3 = tempweekdaystring
+ tempweekdaystring = calendardata[5].tr(' ', '.')
+ @showmonthresult4 = tempweekdaystring
+ tempweekdaystring = calendardata[6].tr(' ', '.')
+ @showmonthresult5 = tempweekdaystring
+ tempweekdaystring = calendardata[7].tr(' ', '.')
+ @showmonthresult6 = tempweekdaystring
+ rescue # process exeption
+ @showmonthresult = "\n" + "error in eval"
+ end # end of rescue process # of rescue monitored block
+
+ end
+