Changeset 764318
- Timestamp:
- 08/29/2013 04:49:04 PM (12 years ago)
- Location:
- farm-calculators/trunk
- Files:
-
- 2 edited
-
farm-calculators.php (modified) (7 diffs)
-
js/calculators.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
farm-calculators/trunk/farm-calculators.php
r759708 r764318 7 7 Description: Add farm calculators to your website to help users determine various farming and crop related information. 8 8 9 Version: 0. 39 Version: 0.4 10 10 Author: Bryce Johnston 11 11 Author URI: http://www.wingdspur.com … … 28 28 *******************************************************************************************/ 29 29 30 $fc_version = '0. 3';30 $fc_version = '0.4'; 31 31 $fc_dirname = plugin_basename(dirname(__FILE__)); 32 32 … … 176 176 } 177 177 178 function farming_calc_wheat_harvest_yield_loss_shortcode() { 179 extract( shortcode_atts( array( 180 'class' => 'farmCalculator', 181 ), $atts ) ); 182 183 $class = esc_attr($class); 184 185 $code = '<div class="'.$class.'"> 186 <form> 187 <div class="errors"></div>'; 188 $code .=' 189 <h4>Wheat Harvest Loss</h4> 190 <p><i>Also recommended to check standing crop for pre-harvest losses.</i></p> 191 <p> 192 <label for="kernals_count">Kernals Counted on Ground:</label><br /> 193 <input name="kernals_count" id="kernals_count" type="number" step="any" class="input-medium" /> 194 </p> 195 <p> 196 <label for="kernals_area">Area Kernals were Counted (ft<sup>2</sup>):</label><br /> 197 <input name="kernals_area" id="kernals_area" type="number" step="any" class="input-medium" /> 198 </p> 199 <p> 200 <button type="submit" class="btn" name="calculateWheatHarvestYieldLoss" id="calculateWheatHarvestYieldLoss">Calculate</button> 201 </p> 202 <p> 203 <label>Estimated Yield Loss (bu/ac):</label><br /> 204 <input name="yield_loss" type="text" class="input-medium" readonly="readonly" /> 205 </p> 206 </form>'; 207 $code .= ' 208 </div>'; 209 210 return $code; 211 } 212 213 function farming_calc_wheat_harvest_yield_loss_bs_shortcode() { 214 extract( shortcode_atts( array( 215 'class' => 'farmCalculator span3', 216 ), $atts ) ); 217 218 $class = esc_attr($class); 219 220 $code = '<div class="'.$class.'"> 221 <form> 222 <div class="errors"></div>'; 223 $code .='<fieldset> 224 <legend>Wheat Harvest Loss</legend>'; 225 $code .=' 226 <label for="kernals_count">Kernals Counted on Ground:</label> 227 <input name="kernals_count" id="kernals_count" type="number" step="any" class="input-medium" /> 228 <label for="kernals_area">Area Kernals were Counted (ft<sup>2</sup>):</label> 229 <input name="kernals_area" id="kernals_area" type="number" step="any" class="input-medium" /><br /> 230 <button type="submit" class="btn" name="calculateWheatHarvestYieldLoss" id="calculateWheatHarvestYieldLoss">Calculate</button> 231 </fieldset>'; 232 $code .= '<br /> 233 <label>Estimated Yield Loss (bu/ac):</label> 234 <input name="yield_loss" type="text" class="input-medium" readonly="readonly" /> 235 </form>'; 236 $code .= ' 237 </div>'; 238 239 return $code; 240 } 241 178 242 function farming_calc_sorghum_harvest_yield_loss_shortcode() { 179 243 extract( shortcode_atts( array( … … 213 277 function farming_calc_sorghum_harvest_yield_loss_bs_shortcode() { 214 278 extract( shortcode_atts( array( 215 'class' => 'farmCalculator ',279 'class' => 'farmCalculator span3', 216 280 ), $atts ) ); 217 281 … … 277 341 function farming_calc_soybean_harvest_yield_loss_bs_shortcode() { 278 342 extract( shortcode_atts( array( 279 'class' => 'farmCalculator ',343 'class' => 'farmCalculator span3', 280 344 ), $atts ) ); 281 345 … … 341 405 function farming_calc_sunflower_harvest_yield_loss_bs_shortcode() { 342 406 extract( shortcode_atts( array( 343 'class' => 'farmCalculator ',407 'class' => 'farmCalculator span3', 344 408 ), $atts ) ); 345 409 … … 372 436 add_shortcode('farming_calc_crop_population_hoop', 'farming_calc_crop_population_hoop_shortcode'); 373 437 add_shortcode('farming_calc_crop_population_hoop_bs', 'farming_calc_crop_population_hoop_bs_shortcode'); 438 add_shortcode('farming_calc_wheat_harvest_yield_loss', 'farming_calc_wheat_harvest_yield_loss_shortcode'); 439 add_shortcode('farming_calc_wheat_harvest_yield_loss_bs', 'farming_calc_wheat_harvest_yield_loss_bs_shortcode'); 374 440 add_shortcode('farming_calc_sorghum_harvest_yield_loss', 'farming_calc_sorghum_harvest_yield_loss_shortcode'); 375 441 add_shortcode('farming_calc_sorghum_harvest_yield_loss_bs', 'farming_calc_sorghum_harvest_yield_loss_bs_shortcode'); -
farm-calculators/trunk/js/calculators.js
r759708 r764318 8 8 $("#calculateCropPopulationHoop").bind('click submit', function() { 9 9 calculateCropPopulationHoop(this.form); 10 return false; 11 }); 12 13 $("#calculateWheatHarvestYieldLoss").bind('click submit', function() { 14 calculateWheatHarvestYieldLoss(this.form); 10 15 return false; 11 16 }); … … 80 85 } 81 86 87 function calculateWheatHarvestYieldLoss(form) { 88 if (!isValid(form.kernals_count, 0, 1000)) { 89 return false; 90 } else if (!isValid(form.kernals_area, 0, 1000)) { 91 return false; 92 } 93 var kernals_count = form.kernals_count.value; 94 var kernals_area = form.kernals_area.value; 95 var yield_loss = 0; 96 yield_loss = kernals_count/kernals_area/20; 97 form.yield_loss.value = roundTenth(yield_loss); 98 } 99 82 100 function calculateSorghumHarvestYieldLoss(form) { 83 101 if (!isValid(form.kernals_count, 0, 1000)) {
Note: See TracChangeset
for help on using the changeset viewer.