Example #1
0
function form($param, $message = "", $help = "")
{
    echo_lead_text();
    if ($message != "") {
        ?>
<div class="alert alert-danger alert-dismissable">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <?php 
        echo $message;
        echo $help;
        ?>
</div><!-- .alert -->
<?php 
    }
    $action = $_SERVER["PHP_SELF"];
    $pos = strpos($action, "index.php");
    if ($pos !== false) {
        $action = substr($action, 0, $pos);
    }
    $geo = isset($param["geo"]) ? $param["geo"] : "geoname";
    if ($geo == "geoname" && !isset($param["city-typeahead"]) && isset($param["geonameid"])) {
        list($name, $asciiname, $country, $admin1, $latitude, $longitude, $tzid) = hebcal_get_geoname($param["geonameid"]);
        $param["city-typeahead"] = geoname_city_descr($name, $admin1, $country);
    } elseif ($geo == "zip" && isset($param["zip"])) {
        list($city, $state, $tzid, $latitude, $longitude, $lat_deg, $lat_min, $long_deg, $long_min) = hebcal_get_zipcode_fields($param["zip"]);
        $param["city-typeahead"] = "{$city}, {$state} " . $param["zip"];
    }
    ?>
<div id="email-form">
<form id="f1" action="<?php 
    echo $action;
    ?>
" method="post">
<div class="form-group">
<label for="em">E-mail address</label>
<input type="email" name="em" id="em" class="form-control" placeholder="*****@*****.**"
value="<?php 
    if (isset($param["em"])) {
        echo htmlspecialchars($param["em"]);
    }
    ?>
">
</div>
<div class="form-group">
<label for="city-typeahead">City</label>
<input type="hidden" name="geo" id="geo" value="<?php 
    echo $geo;
    ?>
">
<input type="hidden" name="zip" id="zip" value="<?php 
    if (isset($param["zip"])) {
        echo htmlspecialchars($param["zip"]);
    }
    ?>
">
<input type="hidden" name="geonameid" id="geonameid" value="<?php 
    if (isset($param["geonameid"])) {
        echo htmlspecialchars($param["geonameid"]);
    }
    ?>
">
<div class="city-typeahead" style="margin-bottom:12px">
<input type="text" name="city-typeahead" id="city-typeahead" class="form-control" placeholder="Search for city or ZIP code" value="<?php 
    if (isset($param["city-typeahead"])) {
        echo htmlentities($param["city-typeahead"]);
    }
    ?>
">
</div>
</div>
<div class="form-group">
<label for="m">Havdalah minutes past sundown
<a href="#" id="havdalahInfo" data-toggle="tooltip" data-placement="top" title="Use 42 min for three medium-sized stars, 50 min for three small stars, 72 min for Rabbeinu Tam, or 0 to suppress Havdalah times"><span class="glyphicon glyphicon-info-sign"></span></a>
</label>
<input type="text" name="m" id="m" class="form-control" pattern="\d*" value="<?php 
    echo htmlspecialchars($param["m"]);
    ?>
" maxlength="3">
</div>
<input type="hidden" name="v" value="1">
<?php 
    global $is_update, $default_unsubscribe;
    $modify_class = $default_unsubscribe ? "btn btn-default" : "btn btn-primary";
    $unsub_class = $default_unsubscribe ? "btn btn-primary" : "btn btn-default";
    if ($is_update) {
        ?>
<input type="hidden" name="prev"
value="<?php 
        echo htmlspecialchars($param["em"]);
        ?>
">
<?php 
    }
    ?>
<button type="submit" class="<?php 
    echo $modify_class;
    ?>
" name="modify" value="1">
<?php 
    echo $is_update ? "Update Subscription" : "Subscribe";
    ?>
</button>
<button type="submit" class="<?php 
    echo $unsub_class;
    ?>
" name="unsubscribe" value="1">Unsubscribe</button>
</fieldset>
</form>
</div><!-- #email-form -->

<hr>
<p>You&apos;ll receive a maximum of one message per week, typically on Thursday morning.</p>

<div id="privacy-policy">
<h3>Email Privacy Policy</h3>
<p>We will never sell or give your email address to anyone.
<br>We will never use your email address to send you unsolicited
offers.</p>
<p>To unsubscribe, send an email to <a
href="mailto:shabbat-unsubscribe&#64;hebcal.com">shabbat-unsubscribe&#64;hebcal.com</a>.</p>
</div><!-- #privacy-policy -->
</div><!-- .col-sm-12 -->
</div><!-- .row -->
<?php 
    $js_typeahead_url = hebcal_js_typeahead_bundle_url();
    $js_hebcal_app_url = hebcal_js_app_url();
    $xtra_html = <<<EOD
<script src="{$js_typeahead_url}"></script>
<script src="{$js_hebcal_app_url}"></script>
<script type="text/javascript">
window['hebcal'].createCityTypeahead(false);
\$('#havdalahInfo').click(function(e){
 e.preventDefault();
}).tooltip();
</script>
EOD;
    echo html_footer_bootstrap3(true, $xtra_html);
    exit;
}
Example #2
0
<h2 id="fonts">Customize Fonts</h2>

<p>To change the fonts to match the rest of your site, you can add a
<code>&lt;style type="text/css"&gt;</code> stylesheet like this to the
<code>&lt;head&gt; ... &lt;/head&gt;</code> section at the top of your web
page:</p>

<script src="https://gist.github.com/mjradwin/fc4f38384a6335ab9963.js"></script>

<p>Those fonts and colors are just an example.  <a
href="http://www.w3.org/Style/CSS/">Cascading Style Sheets (CSS)</a> are
very powerful and flexible.</p>
</div><!-- .col-sm-12 -->
</div><!-- .row -->
<?php 
$js_typeahead_url = hebcal_js_typeahead_bundle_url();
$js_hebcal_app_url = hebcal_js_app_url();
$xtra_html = <<<EOD
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<script src="{$js_typeahead_url}"></script>
<script src="{$js_hebcal_app_url}"></script>
<script type="text/javascript">
hljs.initHighlightingOnLoad();
window['hebcal'].createCityTypeahead(false);
\$('#havdalahInfo').click(function(e){
 e.preventDefault();
}).tooltip();
</script>
EOD;
echo html_footer_bootstrap3(true, $xtra_html);
exit;