You are here: Almanac » Weather Records

Weather Records

The rain log has been retired since we setup Middlefork Weather Station.

%TABPANE{select="%URLPARAM{"tab" default="1"}%"}%
%TAB{"Records"}%%JQREQUIRE{"datatables"}%
<div id='weatherSummary' style='float:right;width:45%;padding:1em;'>
<h2>Totals & Averages</h2>
   * *This Month:* %CALC{"$SET(values, %SEARCH{"TopicType = 'WeatherRecord' AND d2n(Date) >= d2n('%SERVERTIME{"01 $month $year"}%') AND d2n(Date) <= d2n('%SERVERTIME{"31 $month $year"}%')"
      type="query" 
      nonoise="on"
      format="$formfield(Precipitation)"
      separator=","
  }%)Total: $FORMAT(NUMBER, 2, $SUM($GET(values))) Daily Average: $FORMAT(NUMBER, 2, $AVERAGE($GET(values)))"}%
   * *Last Month:* %CALC{"$SET(values, %SEARCH{"TopicType = 'WeatherRecord' AND d2n(Date) >= d2n('01 %CALCULATE{"$FORMATTIME($TIMEADD($TIME(), -1, month), $mon $year)"}%') AND d2n(Date) <= d2n('31 %CALCULATE{"$FORMATTIME($TIMEADD($TIME(), -1, month), $mon $year)"}%')"
      type="query" 
      nonoise="on"
      format="$formfield(Precipitation)"
      separator=","
  }%)Total: $FORMAT(NUMBER, 2, $SUM($GET(values))) Daily Average: $FORMAT(NUMBER, 2, $AVERAGE($GET(values)))"}%
   * *This Year:* %CALC{"$SET(values, %SEARCH{"TopicType = 'WeatherRecord' AND d2n(Date) >= d2n('%SERVERTIME{"01 Jan $year"}%') AND d2n(Date) <= d2n('%SERVERTIME{"31 Dec $year"}%')"
      type="query" 
      nonoise="on"
      format="$formfield(Precipitation)"
      separator=","
  }%)Total: $FORMAT(NUMBER, 2, $SUM($GET(values))) Daily Average: $FORMAT(NUMBER, 2, $AVERAGE($GET(values)))"}%

</div>
<div class="jqDataTablesContainer {'aaSorting': [] }" data-paginate="true" data-pagelength="10" data-searching="true" data-info="true" data-lengthmenu="10, 20, 50, 100" style='float:left;width:45%'>
%SEARCH{"TopicType = 'WeatherRecord'"
  type="query"
  nonoise="on"
  header="| *Date* | *Precipitation* | $n"
  format="| [[$web.$topic][$formfield(Date)]] | $formfield(Precipitation)  |"
  separator=" $n"
  order="formfield(Date)"
  reverse="on"
}%
</div>
%CLEAR%
%ENDTAB%
%TAB{"Post New Record" width="50%"}%
#PostWeather
%STARTSECTION{name="new" type="section"}%%INCLUDE{"%SYSTEMWEB%.JSCalendarContribInline"}% 
<form name='addRecord' action='%SCRIPTURL{save}%/%WEB%/' method='post' >
<input type='hidden' name='formtemplate' value='WeatherRecordForm' />
<input type='hidden' name='templatetopic' value='WeatherRecordTemplate' />
<input type='hidden' name='onlynewtopic' value='true' />
<input type='hidden' name='redirectto' class='jqWikiWord' value='%SCRIPTURL{view}%/%WEB%/%TOPIC%?tab=2' data-source="#idDate" data-prefix="%SCRIPTURL{view}%/%WEB%/%TOPIC%?tab=2;date=" data-suffix="#PostWeather"/>
<input type="hidden" id="prjTopic" size="60" name="topic" class="foswikiInputField jqWikiWord" data-source="#idDate" data-prefix="WeatherRec" data-transliterate="true" />
<div class='foswikiFormSteps'>
%RENDERFOREDIT{form="WeatherRecordForm"
  hidden="TopicType"
  Date_value="%IF{"defined date" then="$percntCALCULATE{\"$FORMATTIME($TIMEADD($TIME($SET(t,%URLPARAM{date}%)$SUBSTRING($GET(t), 1, 2) $SUBSTRING($GET(t), 3, 3) $SUBSTRING($GET(t), 6, 4)), 2, day),$day $mon $year)\"}$percnt" else="%SERVERTIME{"$day $mon $year"}%"}%"
  Date_format="<div class='foswikiFormStep'><h3> Date: </h3><input id='idDate' name='$name' value='$value' size='15' class='foswikiInputField' type='text'> <img src='%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif' class='foswikiButton foswikiEditFormCalendarButton'/> <div class='foswikiFormDescription'>$description</div></div>"
  format="<div class='foswikiFormStep'><h3> $title: </h3>$edit<div class='foswikiFormDescription'>$description</div></div>"
  Precipitation_value="0.00"
  header=""
  footer=""
}%
<div class='foswikiFormStep'>%BUTTON{" Save Record " type="submit" id="postBtn"}%</div>
</form>
</div>
%JQREQUIRE{"wikiword"}%%ADDTOZONE{"script" 
  text="<literal><script type='text/javascript'>
  $(document).ready(function(){ 
    $('.foswikiEditFormCalendarButton').click(function(){ 
       var targFld = $(this).prev().attr('id'); 
       return showCalendar(targFld,'%e %b %Y'); 
    }); 
    $('#postBtn').mousedown( function() {
        $('#idDate').trigger('change');
    });
  });
  </script></literal>"
}%
%ENDSECTION{name="new" type="section"}%
 %ENDTAB%
%ENDTABPANE%

See also: %SEARCH{"name ~ '%TOPIC%*'" excludetopic="%TOPIC%" type="query" nonoise="on" format="$web.$topic" separator=", "}%
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Middle Fork Home Wiki? Send feedback
Syndicate this site RSS