diff options
author | Steve Beaver <sbeaver@netgate.com> | 2017-08-14 13:12:36 -0400 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2017-08-14 13:13:06 -0400 |
commit | 439ae979dad68682c42b263c624335e25cb0cf41 (patch) | |
tree | 6fe74271b84db7c584c86a84b5e816056ee81137 /src/usr/local | |
parent | 60d2ae474bc2b74965627ed146783dfd5f896ce1 (diff) | |
download | pfsense-439ae979dad68682c42b263c624335e25cb0cf41.zip pfsense-439ae979dad68682c42b263c624335e25cb0cf41.tar.gz |
Adding widget and login css files
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/css/login.css | 189 | ||||
-rw-r--r-- | src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php | 163 |
2 files changed, 352 insertions, 0 deletions
diff --git a/src/usr/local/www/css/login.css b/src/usr/local/www/css/login.css new file mode 100644 index 0000000..22b4f2c --- /dev/null +++ b/src/usr/local/www/css/login.css @@ -0,0 +1,189 @@ +body, html { + height: 100%; + padding: 0; + margin: 0; +} + +body { + width: 100%; +} + +header { +} + +#headerrow { + position: fixed; + height: 90px; + top: 0; + width: 100%; + background-color: white; +} + +.pagebody { + position: absolute; + top:90px; + bottom:25px; + width: 100%; + color: white; +} + +.pagebodywarn { + position: absolute; + top:140px; + bottom:25px; + width: 100%; + color: white; +} + +.nowarning { + height: 80px; + padding-top: 10px; +} + +#hostspan { + text-align: right; +} + +.msgbox { + padding-right: 60px; + padding-top: 25px; +} + +@media only screen and (max-width : 768px) { + /* only size 'xs' and below */ + #headerrow { + height: 100px; + } + + .pagebody { + top: 100px; + } + + .pagebody2 { + top: 250px; + } + + .nowarning { + height: 60px; + } + + .msgbox { + padding-right: 0px; + padding-top: 0px; + } + + #hostspan { + text-align: center; + } +} + +#footertext { + position: fixed; + height: 25px; + bottom: 0; + width: 100%; + background-color: #212121; + color: white; + text-align: center; +} + +.loginCont { + position: absolute; + top: 50%; left: 50%; + transform: translate(-50%,-50%); + height: 55%; + width: 80%; +} + +.error-panel a { + color: white; +} +p.form-title +{ + font-family: 'Open Sans' , sans-serif; + font-size: 20px; + font-weight: 500; + text-align: center; + color: #FFFFFF; + margin-top: 5%; + text-transform: uppercase; + letter-spacing: 4px; +} + +form.login +{ + width: 270px; + margin: 0 auto; +} + +form.login input[type="text"], form.login input[type="password"] +{ + width: 100%; + margin: 0; + padding: 10px 10px; + background: 0; + border: 0; + border-bottom: 1px solid #FFFFFF; + outline: 0; + font-style: italic; + font-size: 18px; + font-weight: 600; + letter-spacing: 1px; + margin-bottom: 5px; + color: #FFFFFF; + outline: 0; +} + +form.login input[type="submit"] +{ + width: 60%; + font-size: 14px; + text-transform: uppercase; + font-weight: 500; + margin-top: 36px; + outline: 0; + cursor: pointer; + letter-spacing: 1px; + display: block; + margin : 0 auto; + margin-top: 36px; +} + +form.login input[type="submit"]:hover +{ + transition: background-color 0.5s ease; +} + +form.login label, form.login a +{ + font-size: 12px; + font-weight: 400; + color: #FFFFFF; +} + +form.login a +{ + transition: color 0.5s ease; +} + +form.login a:hover +{ + color: #2ecc71; +} + +.logoCol { + height: 100%; +} + +/** Re-style web-kit broswer autocomplete boxes (Fixes Chrome's ugly yellow background) **/ +@-webkit-keyframes autofill { + to { + color: white; + background: transparent; + } +} + +input:-webkit-autofill { + -webkit-animation-name: autofill; + -webkit-animation-fill-mode: both; +} diff --git a/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php b/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php new file mode 100644 index 0000000..0d8b28b --- /dev/null +++ b/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php @@ -0,0 +1,163 @@ +<?php +/* + * netgate_services_and_support.widget.php + * + * part of pfSense (https://www.pfsense.org) + * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + This widget transmits the Netgate Device ID to Netgate's REST API, and retrieves the support information. + The connection is made using HTTPS/TLS. No other data is transmitted. If the widget + is not enabled, then no transmission is made + + If the file containing the support data exists on the file system and is less than 24 hours old + the file contents are displayed immediately. If not, an AJAX call is made to retrieve fresh information +*/ + +require_once("guiconfig.inc"); + +$nocsrf = true; +$supportfile = "/var/db/support.json"; +$idfile = "/var/db/uniqueid"; +$FQDN = "https://ews.netgate.com/support"; +$refreshinterval = (24 * 3600); // 24 hours + + +if ($_REQUEST['ajax']) { + + // Retrieve the support data from Netgate.com if the support data file does not exist, + // or if it is more than a day old + if (!file_exists($supportfile) || ( time()-filemtime($supportfile) > $refreshinterval)) { + if (file_exists($supportfile)) { + unlink($supportfile); + } + + updateSupport(); + } + + if (file_exists($supportfile)) { + print(file_get_contents($supportfile)); + } + + exit; +} + +// If the widget is called with act=refresh, delete the JSON file and reload the page, thereby forcing the +// widget to get a fresh copy of the support information +if ($_REQUEST['act'] == "refresh") { + + if (file_exists($supportfile)) { + unlink($supportfile); + } + + header("Location: /"); + exit; +} + +// Poll the Netgate server to obtain the JSON/HTML formatted support information +// and write it to the JSON file +function updateSupport() { + global $g, $supportfile, $idfile, $FQDN; + + if (file_exists($idfile)) { + if (function_exists('curl_version')) { + $post = ['uid' => file_get_contents($idfile), 'language' => '0']; + $url = $FQDN; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_VERBOSE, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version']); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,4); + $response = curl_exec($ch); + $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($status == 200) { + file_put_contents($supportfile, $response); + } + } + } +} + + +$doajax = "yes"; + +print("<div>"); + +if (file_exists($supportfile) && ( time()-filemtime($supportfile) < $refreshinterval)) { + // Print the support data from the file + $str = file_get_contents($supportfile); + $json = json_decode($str, true); + print($json['summary']); + print($json['htmltext']); + $doajax = "no"; +} else { + //Print empty <div>s and request the data by AJAX + print(sprintf(gettext("%sRetrieving support information %s %s"), + "<div id=\"summary\" class=\"alert alert-warning\">", "<i class=\"fa fa-cog fa-spin\"></i>", "</div><div id=\"htmltxt\"></div>")); +} + +// Print a low-key refresh link +print('<div style="text-align:right;padding-right:15px;"><a href="/widgets/widgets/netgate_services_and_support.widget.php?act=refresh" usepost><i class="fa fa-refresh"></i></a></div>'); + +print("</div>"); + +?> + +<script type="text/javascript"> +//<![CDATA[ + events.push(function(){ + function fetch_spt_data() { + + $.ajax({ + type: 'POST', + url: "/widgets/widgets/netgate_services_and_support.widget.php", + data: { + ajax: "ajax" + }, + + success: function(data){ + if (data.length > 0) { + var obj = JSON.parse(data); + + $('#summary').removeClass("alert"); + $('#summary').removeClass("alert-warning"); + $('#summary').html(obj.summary); + $('#htmltxt').html(obj.htmltext); + } + }, + + error: function(e){ + // alert("Error: " + e); + + } + }); + } + + if ("<?=$doajax?>" === "yes") { + fetch_spt_data(); + } + }); + + +//]]> +</script> |