Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bmartino1

Pages: [1] 2 3 ... 52
2
HTML & templates / Re: Simple contact template
« on: August 14, 2018, 02:58:38 AM »
Thank you Leo, here are my final drafts for the codes broken down in there basic forms

The hfs different tpl attached:
Code: [Select]

<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact Form using JavaScript</title>   
</head>


<!-- include css file here -->
<!--   <link rel="stylesheet" href="/Contact/form.css"/>   -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
        font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>

<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" onclick='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
<br />       
<span class='error-message' id='submit-error'></span>
</button>
</form>
</div>
</div>

<!-- include JavaScript file here -->
<!-- <script src="/Contact/form.js"></script> -->

<script type="text/javascript">
//Creates box and validate textbox content for a name
function validateName() {

  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and Last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Checks form and contents pass validation (NOT working - atleast not displaying) - use later for alert measge sent
function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 5000);
        return false;
    }
else
{
//Change alert for message sent sucesfuly
        //producePrompt('Sent Sucessfuly', 'Submit-error', 'green');
        jsShow('submit-error');
        producePrompt('Mesage Passed Validation and is Sent.', 'submit-error', 'green');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return true;
    }
}

//??? Secondary Code for JS validation:
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}

//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}
</script>


<!-- How/What we save is added here -->

</body>
</html>

with the code above, you get the css form and javascript validation. the only thing that needs to be added is the actual content to write.

for xml i have this:
*note not working but canbecome working see code comments
Code: [Select]

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{.set item|%folder%|add upload=@any account.}

<script>
//disabled (write xml file fail) as this code should just run after validation...
document.getElementById("SendMe").onclick = function () {
//if enabled (works) will write file regradless of validation. if daisalbed, validation stops before submit...

var Headers = '\n---------------------------\n';
var GetName = '\nName: '+document.getElementById("contact-name").value+'\n';
var GetMail = 'Email: '+document.getElementById("contact-email").value+'\n';
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value+'\n';
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';

var FullDataString = Headers+'\n'+GetName+'\n'+GetMail+'\n'+GetSubject+'\n'+GetMessage+'\n'+Headers;
//atempt to fix single line text saved to 1 single string???...

//disabled as it is now apart of the javascript
//alert("Message sent!");
//can become the a message on the page instead of an alert box...

var formData = new FormData();

// JavaScript file-like object
var content = Headers+GetName+GetMail+GetSubject+GetMessage+Headers; // Message content...
var blob = new Blob([content], { type: "text/plain"});

formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

var request = new XMLHttpRequest();
request.open("POST", "/contact");  //enable (access/delete/uplaod to anyone... FOlder path is corect spelling
request.send(formData);

}
</script>



For Hfs macro saving i have this:
Code: [Select]

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text-->

<script>
//disabled as this code should just run after validation...
//document.getElementById("SendMe").onclick = function () {

//disabled as it is now apart of the javascript
//alert("Message sent!");
//can become the a message on the page instead of an alert box...

//}
</script>

{.if |{.?Message.}|{:
{.set|nombre|{.?name.}.}
{.set|correo|{.?email.}.}
{.set|asunto|{.?subject.}.}
{.set|mensaje|{.?message.}.}

{.save|/%folder%/Private-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt|
{.force ansi|{.!-----[ BEGIN MESSAGE ]-----.}.}

Name: {.^nombre.}
From: {.^correo.}
IP: %ip% (User: %user%)
Date: {.time|yyyy/mm/dd '@' hh:nn:ss.}
Subject: {.^asunto.}

Message:

{.force ansi|{.^mensaje.}.}

{.force ansi|{.!-----[ END MESSAGE ]-----.}.}
.}

{.add to log|You've received a new message!.}

:}
.}
   

Hope this helps :)

final draft to xml code :( works, but not as expected
Code: [Select]

<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact Form using JavaScript</title>   
</head>


<!-- include css file here -->
<!--   <link rel="stylesheet" href="/Contact/form.css"/>   -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
        font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>

<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" OnMouseOver='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
<!-- buton onclick became OnMouseOver / a html embeded javascript function -->
<br />       
<span class='error-message' id='submit-error'></span>
</button>
</form>
</div>
</div>

<!-- include JavaScript file here -->
<!-- <script src="/Contact/form.js"></script> -->

<script type="text/javascript">
//Creates box and validate textbox content for a name
function validateName() {

  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and Last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Checks form and contents pass validation (NOT working - atleast not displaying) - use later for alert measge sent

var booleanXCHECK = false;
//atempt to use a a check value, but can't get validate to change then write boolean works ...

function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 5000);
        return false;

    }
else
{
//Change alert for message sent successfully
        //producePrompt('Sent Successfully', 'Submit-error', 'green');
        jsShow('submit-error');
        producePrompt('Mesage Passed Validation.', 'submit-error', 'green');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return booleanXCHECK = true;
return true;
    }
}

//??? Secondary Code for JS validation:
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}

//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}
</script>


<!-- How/What we save is added here -->

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{.set item|%folder%|add upload=@anyone.}
<!-- @any account or @anyone, in the event they go here while loged in as a user....  writes either way-->

<script>
if (booleanXCHECK = true) {
//if statement (write xml file fail) as this code should just run after validation...
document.getElementById("SendMe").onclick = function () {
//if enabled (works) will write file regradless of validation. if daisalbed, validation works, but no written data to submit...
//FORM CHANGED! validate form via click event.. changed to mouse over: http://www.simplehtmlguide.com/javascript.php

//alert("your check is :"+booleanXCHECK );
//check value in code -- fail - pass true, but writes either way

var Headers = '\n---------------------------\n';
var GetName = 'Name: '+document.getElementById("contact-name").value;
var GetMail = 'Email: '+document.getElementById("contact-email").value;
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value;
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';

var FullDataString = Headers+'\n'+GetName+'\n'+GetMail+'\n'+GetSubject+'\n'+GetMessage+'\n'+Headers;
//atempt to fix single line text saved to 1 single string???...


var content = FullDataString;
//content writes fine issues is with variable passed to blob in witch content loses the "/n" new lines...
//alert("your check is :"+content );
//check content before transfer to blob before data append...
//https://developers.google.com/web/updates/2012/06/Don-t-Build-Blobs-Construct-Them

var blob = new Blob([content], { type: "text/plain"});
var formData = new FormData();

// JavaScript file-like object
formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

var request = new XMLHttpRequest();
request.open("POST", "/contact"); 
//enable (PATH MUST BE CORRECT)
request.send(formData);

//disabled as it is now apart of the javascript
alert("Message sent!");
//can become the a message on the page instead of an alert box...
//jsShow('submit-error');
//producePrompt('Mesage SENT.', 'submit-error', 'green');
//setTimeout(function(){jsHide('submit-error');}, 2000);

}
}
</script>

</body>
</html>

3
@DJ: It looks like the 'forEach' function is not recognized. I've tested several not-so-updated browsers:

In Chrome 31 (old version), the console shows this error:
Code: [Select]
Uncaught TypeError: Object #<NodeList> has no method 'forEach' (index):130
In Firefox 24 ESR (old version), the console shows this error:
Code: [Select]
TypeError: document.querySelectorAll(...).forEach is not a function
In Firefox (another old version), the console shows this error:
Code: [Select]
Error: document.querySelectorAll(".option_button").forEach is not a function
In KMeleon (an old fork of Firefox), the console shows this error:
Code: [Select]
Error: TypeError: document.querySelectorAll(...).forEach is not a function
On QtWeb (an old fork of Chrome), the console shows this error:
Code: [Select]
TypeError: 'undefined' is not a function (evaluating 'document.querySelectorAll(".option_button").forEach(function(o){o.onclick=function(){window.alert(o.value)}})')
Differences:

In Throwback7rev2.tpl there is no modal dialog at all (and the 'Uncaught TypeError' shows up on the console only once, when loading the page).

In Throwback7rev2.2.tpl the modal dialog shows up, but the file doesn't get deleted (it asks: 'Delete filename.xxx?', but when clicking on 'OK' the 'Uncaught TypeError' shows up again on the console (this error also appears when loading the page).

It would be great if we can use another function compatible with those browsers. I'm not expert on these matters, but perhaps using for loop instead of forEach, could solve this problem (or else using another methods). ???

or setup if statement to check if it can run then run if it can
https://www.w3.org/community/webed/wiki/Optimizing_content_for_different_browsers:_the_RIGHT_way

Why feature detection is better
Feature detection is a much better way to do things — instead of seeing what browser is accessing the content and serving appropriate code, the idea here is to query the browser to detect whether it supports the features our content relies on, and then serve content as appropriate. Let's take HTML5 video as an example. You could detect support using some simple code such as this:

javascript code:
Code: [Select]
if(!!document.createElement('video').canPlayType === true) {
  // run some code that relies on HTML5 video
} else {
  // do something else
}

This is much more future proof, because existing browsers that support HTML5 video will run the correct code, and future browsers that support HTML5 video will do as well. You don't have to keep updating your code each time a new browser is released.

4
HTML & templates / Re: Simple contact template
« on: August 10, 2018, 02:03:58 PM »
jsut to get a working eml verion i did some editing and used a macro version to write the data to a file.

Code: [Select]
<!DOCTYPE html>
<html>

<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Message to the server</title>
</head>

<!-- Fix Permission to folder upload access (hfs macro)? May not need this-->
<!-- {. set item|%folder%|add upload=@anonymous .} -->

<!-- included css here -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>




<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" onclick='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
<br />       
<span class='error-message' id='submit-error'></span>
</button>
</form>
</div>
</div>


<!-- include form validate JavaScript code here -->
<script>
//Creates box and validate textbox content for a name
function validateName() {

  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Checks form and contents pass validation (NOT working - atleast not displaying) - use later for alert measge sent
function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return false;
    }
else
{
//producePrompt('Sent Sucessfuly', 'Submit-error', 'green');
        return true;
    }
}

//??? Secondary Code for JS validation:
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}



//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}

</script>

<!-- Rejeto HFS Macro code and Commands via LEO sends to hfs via eml-->
<!-- JS that should just run... eml email thing to populate data later -->
<script type="text/javascript">
var LoggedInUser = '[%user%]';
var LoggedUserIP = '%ip%';

var Today = new Date(); 
var OwnTZ = -(Today.getTimezoneOffset()/60);
var Offset = new Date().getTimezoneOffset();
var MyDate = new Date((new Date).getTime()+3600*OwnTZ*1e3).toUTCString().replace(/ GMT$/,"");
Offset = (Offset<0?"+":"-")+Pad(parseInt(Math.abs(Offset/60)),2)+""+Pad(Math.abs(Offset%60),2);
function Pad(number,length){for(var tz=""+number;tz.length<length;)tz="0"+tz;return tz};
MyFullLocalTime = MyDate+' '+Offset;

</script>



<script type="text/javascript">
//Should just be there to call from - no longer ned buton click to get data
//document.getElementById("SendMe").onclick = function () {

//can view below data vial html web console
var GetName = '\nName: '+document.getElementById("contact-name").value+'\n';
var GetMail = 'Email: '+document.getElementById("contact-email").value+'\n';
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value+'\n';
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';
var TextCurrentLength = document.getElementById("MessageB").value.length;

var Header0 = 'Received: from '+LoggedInUser+' ('+LoggedUserIP+')'+'\n';
var Header1 = 'From: "'+GetName+'" <'+GetMail+'>'+'\n';
var Header2 = 'To: "HFS Server Administrator"'+'\n';
var Header3 = 'Subject: '+GetSubject+'\n';
var Header4 = 'Date: '+MyFullLocalTime+'\n';
var Header5 = 'MIME-Version: 1.0'+'\n';
var Header6 = 'Content-Type: text/plain; charset=UTF-8'+'\n';
var Header7 = 'Content-Length: '+TextCurrentLength+'\n';
var Header8 = 'Content-Transfer-Encoding: 8bit'+'\n';
var Header9 = 'X-Originating-IP: '+LoggedUserIP+'\n';
var Header10 = 'X-Mailer: HFS Custom template'+'\n';
var FullHeaders = Header0+'\n'+Header1+'\n'+Header2+'\n'+Header3+'\n'+Header4+'\n'+Header5+'\n'+Header6+'\n'+Header7+'\n'+Header8+'\n'+Header9+'\n'+Header10+'\n';
var FullDataString = FullHeaders+GetMessage; // Message content...

//alert("Message sent!");
//alert disabled for testing

//Disabled below code
//var formData = new FormData();

// JavaScript file-like object
//var content = FullDataString // Message content...
//var blob = new Blob([content], { type: "text/plain"});

//formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

//var request = new XMLHttpRequest();
//request.open("POST", "./contact");  //enable (access/delete/upload to anyone... Folder path is correct spelling
// is not uploading- writing correctly...
//request.send(formData);
}
</script>

<!-- macro send data code for eml -->
{.if |{.?Message.}|{:
{.set|nombre|{.?name.}.}
{.set|correo|{.?email.}.}
{.set|asunto|{.?subject.}.}
{.set|mensaje|{.?message.}.}
{.set|menLENGHT|{.?TextCurrentLength.}.}

{.save|/%folder%/Private-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.eml|

Received: From (User: %user%) %ip%
From: "{.^nombre.}" < {.^correo.} >
To: "HFS Server Administrator"
Subject: {.^asunto.}
Date: {.time|yyyy/mm/dd '@' hh:nn:ss.}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Length: {.^menLENGHT.} //
Content-Transfer-Encoding: 8bit
X-Originating-IP: %ip%
X-Mailer: HFS Custom template

Message:

{.force ansi|{.^mensaje.}.}
.}

{.add to log|You've received a new message!.}

:}
.}

</body>
</html>

this web code uses macro to generate and upload teh content via a eml file (which Microsoft office outlook was able to open and read.

log:
8:59:43 AM 127.0.0.1:57818 Requested GET /
8:59:43 AM 127.0.0.1:57819 Requested GET /?mode=jquery
8:59:46 AM 127.0.0.1:57819 Requested GET /Contact/
9:00:10 AM 127.0.0.1:57819 You've received a new message!
9:00:10 AM 127.0.0.1:57819 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=aa&message=test+test+test&SubmitMessage=

Best i can do
(also was able to fix java validation of form (all fields require to pass validaiton or submit button doen't work.

i leae the rest to more advance users / leo to tweak the code and fix  issues taht arise.

eml that uplaoded:

Private-Message-2018.08.10-at-09.00.10

Received: From (User: ) 127.0.0.1
From: "Brandon Martino" < myemail@gmail.com >
To: "HFS Server Administrator"
Subject: aa
Date: 2018/08/10 @ 09:00:10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Length:  //
Content-Transfer-Encoding: 8bit
X-Originating-IP: 127.0.0.1
X-Mailer: HFS Custom template

Message:

test test test

5
HTML & templates / Re: Simple contact template
« on: August 10, 2018, 04:33:23 AM »
*issues with post and hitting max characters (even when its not maxed... --ther is an issues witht eh XML veriosn on hos javascript apends the data to text and finds/saves fiel to folder acess.

isues is with this line:
var request = new XMLHttpRequest();
request.open("POST", "/contact");  //enable (access/delete/upload to anyone... Folder path is correct spelling
request.send(formData);

in which
request.open("POST", "/contact");  //enable (access/delete/upload to anyone... Folder path is correct spelling

shoudl become:
request.open("POST", "/%folder%");  //enable (access/delete/upload to anyone... Folder path is correct spelling

But breaks teh save funston of the code.
in the above post i ahve actaced the working end xml verison

it has file permison corect to aynomus to uplad (with out user intervention to HFS.. It has validation via javascript, and can save the file to the folder like the macro verion.

ONLY User Intervetion that is required si the coret folder path is set to the line
request.open("POST", "/contact");  //enable (access/delete/upload to anyone... Folder path is correct spelling
****************************

Probaly the same issue with the eml version
eml verison:

same issues with xml verions i assume:

no folder permsion were set. but the file seem to have completed, but was not in the expected folder path... (the form created the file, but didn't save to the location

eml with validaiton code:
Code: [Select]
<!DOCTYPE html>
<html>

<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Message to the server</title>
</head>

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
<!-- not working hfs macro: set item|%folder%|upload=@anonymous -->


<!-- included css here -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>


<!-- JS of some kind??? - eml email thing? -->
<script type="text/javascript">
var LoggedInUser = '[%user%]';
var LoggedUserIP = '%ip%';
</script>

<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" onclick='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
        <span class='error-message' id='submit-error'></span>
</button>
</form>

</div>
</div>



<!-- include form validate JavaScript code here -->
<!-- <script src="/Contact/form.js"> </script> -->

<script>

function validateName() {

//Creates box and validate textbox content for a name
  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Later acess to save to file https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript
//Checks form and contents pass validation
function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return false;
    }
else
{
        return true;
    }
}

//??? Secondary Code for JS:
//https://stackoverflow.com/questions/24128659/contact-form-validation-javascript
//https://www.formget.com/javascript-contact-form/
//https://www.w3schools.com/js/js_validation.asp
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}



//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}

</script>

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via eml-->

<script>
document.getElementById("SendMe").onclick = function () {

var Today = new Date(); 
var OwnTZ = -(Today.getTimezoneOffset()/60);
var Offset = new Date().getTimezoneOffset();
var MyDate = new Date((new Date).getTime()+3600*OwnTZ*1e3).toUTCString().replace(/ GMT$/,"");
Offset = (Offset<0?"+":"-")+Pad(parseInt(Math.abs(Offset/60)),2)+""+Pad(Math.abs(Offset%60),2);
function Pad(number,length){for(var tz=""+number;tz.length<length;)tz="0"+tz;return tz};
MyFullLocalTime = MyDate+' '+Offset;

var GetName = '\nName: '+document.getElementById("contact-name").value+'\n';
var GetMail = 'Email: '+document.getElementById("contact-email").value+'\n';
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value+'\n';
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';
var TextCurrentLength = document.getElementById("MessageB").value.length;

var Header0 = 'Received: from '+LoggedInUser+' ('+LoggedUserIP+')'+'\n';
var Header1 = 'From: "'+GetName+'" <'+GetMail+'>'+'\n';
var Header2 = 'To: "HFS Server Administrator"'+'\n';
var Header3 = 'Subject: '+GetSubject+'\n';
var Header4 = 'Date: '+MyFullLocalTime+'\n';
var Header5 = 'MIME-Version: 1.0'+'\n';
var Header6 = 'Content-Type: text/plain; charset=UTF-8'+'\n';
var Header7 = 'Content-Length: '+TextCurrentLength+'\n';
var Header8 = 'Content-Transfer-Encoding: 8bit'+'\n';
var Header9 = 'X-Originating-IP: '+LoggedUserIP+'\n';
var Header10 = 'X-Mailer: HFS Custom template'+'\n';
var FullHeaders = Header0+Header1+Header2+Header3+Header4+Header5+Header6+Header7+Header8+Header9+Header10;

alert("Message sent!");

var formData = new FormData();

// JavaScript file-like object
var content = FullHeaders+GetMessage; // Message content...
var blob = new Blob([content], { type: "text/plain"});

formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.eml");

var request = new XMLHttpRequest();
request.open("POST", "/contact");  //enable (access/delete/uplaod to anyone... FOlder path is corect spelling
request.send(formData);

}
</script>

</body>
</html>

will be doing some more testing with both versions.

log:
11:31:09 PM 127.0.0.1:55915 Requested GET /
11:31:09 PM 127.0.0.1:55915 Requested GET /?mode=jquery
11:31:11 PM 127.0.0.1:55916 Requested GET /Contact/
11:31:23 PM 127.0.0.1:55916 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=testing&message=hello+world&SubmitMessage=

https://www.wikihow.com/Open-EML-Files
was wondering why it wsa being save to .txt file when it should apend the finlname and extention..
-i assume testing and data string content


===========

and there is definetly somethign goin on witht he EML code in whcih it doent save/apend the data and uplad it to hfs.

8:21:48 AM 127.0.0.1:57574 Requested GET /
8:21:48 AM 127.0.0.1:57575 Requested GET /?mode=jquery
8:21:50 AM 127.0.0.1:57581 Requested GET /Contact/
8:21:58 AM 127.0.0.1:57581 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=aa&message=test&SubmitMessage=
8:25:04 AM 127.0.0.1:57631 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=aa&message=test&SubmitMessage=
8:25:13 AM 127.0.0.1:57631 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=aa&message=test+test+test&SubmitMessage=

might use teh Macro verion to apend that data.
*couldn't get eml veriosn to work.

6
HTML & templates / Re: Simple contact template
« on: August 10, 2018, 03:50:58 AM »
here is the xml version of the code with validation

Eml will be about the same after xml is done...

to fix file permison issue i tried hfs macor comand

Code: [Select]
<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
set item|%folder%|upload=@anonymous

(still had to set anyone with acess/delete/uplaod to make work / test...)

had to fix code wirte path of file name:
Code: [Select]
formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");
and fodler acess path:
Code: [Select]
request.open("POST", "/contact");  //enable (access/delete/uplaod to anyone... FOlder path is corect spelling
xml code with javascript validation:
**this one worked to save a file to the folder after etc...
Code: [Select]
<!DOCTYPE html>
<html>

<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Message to the server</title>
</head>

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
<!-- not working hfs macro: set item|%folder%|upload=@anonymous -->

<!-- included css here -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>
<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" onclick='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
        <span class='error-message' id='submit-error'></span>
</button>
</form>

</div>
</div>

<!-- include form validate JavaScript code here -->
<!-- <script src="/Contact/form.js"> </script> -->

<script>

function validateName() {

//Creates box and validate textbox content for a name
  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Later acess to save to file https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript
//Checks form and contents pass validation
function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return false;
    }
else
{
        return true;
    }
}

//??? Secondary Code for JS:
//https://stackoverflow.com/questions/24128659/contact-form-validation-javascript
//https://www.formget.com/javascript-contact-form/
//https://www.w3schools.com/js/js_validation.asp
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}



//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}

</script>


<!-- Script that uplads conten to hfs -->
<script>
document.getElementById("SendMe").onclick = function () {

var Headers = '\n---------------------------\n';
var GetName = '\nName: '+document.getElementById("contact-name").value+'\n';
var GetMail = 'Email: '+document.getElementById("contact-email").value+'\n';
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value+'\n';
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';

alert("Message sent!");

var formData = new FormData();

// JavaScript file-like object
var content = Headers+GetName+GetMail+GetSubject+GetMessage+Headers; // Message content...
var blob = new Blob([content], { type: "text/plain"});

formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

var request = new XMLHttpRequest();
request.open("POST", "/contact");  //enable (access/delete/uplaod to anyone... FOlder path is corect spelling
request.send(formData);

}
</script>

</body>
</html>

hfs log:

11:14:49 PM 127.0.0.1:55736 Requested GET /Contact/
11:15:00 PM 127.0.0.1:55736 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=testing&message=hello+world&SubmitMessage=
11:18:59 PM 127.0.0.1:55792 Requested GET /Contact/
11:19:14 PM 127.0.0.1:55792 Uploading New-Message-2018.08.09-at-23.18.59.txt
11:19:14 PM 127.0.0.1:55792 Fully uploaded New-Message-2018.08.09-at-23.18.59.txt - 150 @ 11.3 KB/s
11:19:14 PM 127.0.0.1:55798 Requested GET /Contact/
11:19:14 PM 127.0.0.1:55795 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=testing&message=test+hello+world&SubmitMessage=

...XML not taking the /n (new line

so everyoting is writen to the text document as a single line string


---------------------------

Name: Brandon Martino
Email: myemail@gmail.com
Subject: testing
Message:

test hello world

---------------------------

otehr wise is working...

XML requires folder user acount with acess/delete/upload
and requires  a define path set to the folder with that users acess...

-- poteanil fixabel vai hfs macro....
http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands

Example: {.set item|private files|hide=0|comment=you should never see this!.}
access / delete / upload
you can set permissions on the item, by specifying a list of usernames.
Example: set item|videos|upload=robert will give account robert the ability to upload files in /videos.
Moreover, you can prefix permission by add or remove. In the previous example you set the upload permission. If mike already had upload permission, it is now lost. To add robert instead of just overwriting, you should {.set item|videos|add upload=robert.}. Now mike is happy too. As well, if you change your mind, and want to revoke your grant, just set item|videos|remove upload=robert.
You can specify more than one username this way: robert;mike;rupert.
Special usernames are @anonymous @any account @anyone.

===================
FOr some reason, hfs wasn't seeig the macro and it became displayed as a < p > tage aand text on the webpage...

:p lolz aparently i dind't have the brackets set right for hfs macro parsing, i was able to get the uplad macro permsion working..
fix upload permision

*this one is what i curetnl;y have, but still haveing full data apend to file issues...
Code: [Select]
<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{. set item|videos|add upload=@anonymous .}

but (with chages back for testing, it didnt save the file to the pc like the eml verion did
Code: [Select]
<!DOCTYPE html>
<html>

<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Message to the server</title>
</head>

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{. set item|videos|add upload=@anonymous .}

<!-- included css here -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>
<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" onclick='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
        <span class='error-message' id='submit-error'></span>
</button>
</form>

</div>
</div>

<!-- include form validate JavaScript code here -->
<!-- <script src="/Contact/form.js"> </script> -->

<script>

function validateName() {

//Creates box and validate textbox content for a name
  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Later acess to save to file https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript
//Checks form and contents pass validation
function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return false;
    }
else
{
        return true;
    }
}

//??? Secondary Code for JS:
//https://stackoverflow.com/questions/24128659/contact-form-validation-javascript
//https://www.formget.com/javascript-contact-form/
//https://www.w3schools.com/js/js_validation.asp
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}



//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}

</script>


<!-- Script that uplads conten to hfs -->
<script>
document.getElementById("SendMe").onclick = function () {

var Headers = '\n---------------------------\n';
var GetName = '\nName: '+document.getElementById("contact-name").value+'\n';
var GetMail = 'Email: '+document.getElementById("contact-email").value+'\n';
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value+'\n';
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';
var FullDataString = Headers+'\n'+GetName+'\n'+GetMail+'\n'+GetSubject+'\n'+GetMessage+'\n'+Headers;


alert("Message sent!");

var formData = new FormData();

// JavaScript file-like object
var content = Headers+GetName+GetMail+GetSubject+GetMessage+Headers; // Message content...
var blob = new Blob([content], { type: "text/plain"});

formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

var request = new XMLHttpRequest();
request.open("POST", "/%folder%");  //enable (access/delete/uplaod to anyone... Folder path is correct spelling
request.send(formData);

}
</script>

</body>
</html>

log to test:
7:31:14 AM 127.0.0.1:56911 Requested GET /
7:31:14 AM 127.0.0.1:56912 Requested GET /?mode=jquery
7:31:14 AM 127.0.0.1:56915 Requested GET /
7:31:24 AM 127.0.0.1:56914 Requested GET /Contact/
7:32:20 AM 127.0.0.1:56914 Requested GET /Contact/
7:32:34 AM 127.0.0.1:56914 Requested GET /Contact/?name=Brandon+Martino&email=myemail@gmail.com&subject=testing&message=helo+world&SubmitMessage=

7
HFS ~ HTTP File Server / Re: VFS settings to another PC ?
« on: August 07, 2018, 11:54:26 PM »
http://rejetto.com/forum/index.php?topic=4393.0

when moving the vfs and folder/file directoirs do appear, you have to fix there file locaiotn.

FORM THE FAQ!

Quote:

What does the "hand" icon represent in the file system tree? 
If you see an icon that looks like a hand, it means that HFS could not find/access the original source file. HFS hides the file from the web interface until it can successfully access this file.

8
HFS ~ HTTP File Server / Re: Running the latest version as a service
« on: August 06, 2018, 05:28:40 PM »
http://rejetto.com/forum/index.php?topic=4713.msg1059193#msg1059193

I detaulted the best I could. It's not natively support...

You have to use other apps/tools to make it a service.

And have hfs pre setup(no changes) to run from it's vfs/ini

.... Not familiar with that exe. Look I. The post above...

9
HFS ~ HTTP File Server / Re: Pls support Unicode searching, thank you!
« on: August 04, 2018, 04:18:56 PM »
It's on the Todo lost. There some unicorr Pascal and other edits to get this working fully.

http://www.rejetto.com/hfs/?f=todo

Unicode wiri and super is fine ATM.

10
HFS ~ HTTP File Server / Re: VFS settings to another PC ?
« on: August 03, 2018, 10:55:58 PM »
Even if you copy the vfs and floder/hfs file, the vfs is setup to point to the path and direct assigned to it.

----------
Example 1 PC username bmm has a folder shared under user profile.

Moves hfs with that folder to another PC who is logged in as user Brandon. (*We already have a path broken)
_-----------

You will have to right click each item in the vfs and re find that item.

The save to registry is about the same as the vfs and hfs in file, by moving it, you break folder and file path. What you save is the website structure and different template tabs of folder and it's items.

I recommend moving the items and recreate your tree from scratch (therefore no loss of files are made)

11
HTML & templates / Re: Responsive small screen template
« on: August 03, 2018, 10:50:50 PM »
http://rejetto.com/forum/index.php?topic=6855.0

Will have to run some test for other browser

add a logout button [➔

works currently only in IE, Edge
this addon works also with the standard-template

12
HFS ~ HTTP File Server / Re: A macro-level https redirect ?
« on: August 03, 2018, 02:35:58 AM »
it would have to be a event, code that would be put into the house diferent temate tab

i normaly use the html meta refresh to redirect the page.
(not macro, stnadara html code)

-- which is floating on the forum somewhere :p

more info here:
https://www.w3.org/TR/WCAG20-TECHS/H76.html

Code: [Select]
<html xmlns="http://www.w3.org/1999/xhtml">   
  <head>     
    <title>The Tudors</title>     
    <meta http-equiv="refresh" content="0;URL='[b]http://thetudors.example.com/[/b]'" />   
  </head>   
  <body>
    <p>This page has moved to a <a href="[b]http://thetudors.example.com/[/b]">
      theTudors.example.com</a>.</p>
  </body> 
</html> 

Bold - is what the redirect page would be.
i did a test where id had people hit my home page and get redirected to another site/ folder on my hfs

is there a macro version of this, probaly...

13
this thread alone, has me so far confused...

I'm kinda just looking for user input atm.

@danny
Any progress with your last needs danny?

Last i checed you were doing a contex menu for the webpage

You were needing a logn web form page(wokring on it-- slow)

@Leo, sorry, haveint had time to downloaad and tewst your revision? maybee already in post, but what addon/change template wise

Thanks for your help DJ, to me, you are a far more advance code / hfs macro person. I appreaciate your input and skills to further this renevation of dannys code.

--I see it has inspired you on other previous code templates of your :)

MAINLY - just wanted to to be in the resecnt on the form home page.

Generaly check up on this thread

14
HFS ~ HTTP File Server / Re: Unlimited Speed Hang
« on: August 01, 2018, 12:52:10 PM »
Any progress on this topic? I am currently running with a rate limited wget command "wget -r -nH -l1 --no-verbose --no-parent --limit-rate=8000k" to avoid the hang. Using FileZilla I get much better performance without the hang but using HFS would be my preference.


I will probably use a fresh download VM of them :
https://developers.redhat.com/blog/2016/03/31/no-cost-rhel-developer-subscription-now-available/

And do what test via the vitural to my personal PC.

Will be using :
Red Hat Enterprise Linux 7.5.0

And will share the where version and test at a later time/date

--- have the VMready, and hit my issues last tie when testing(i don't have that high of content to download and test i have done are working curenlty. id still susupect a update issues

maybee update your wget:
https://www.ibm.com/support/knowledgecenter/en/SSUFR9_2.1.1/com.ibm.swg.ba.cognos.zcap_sol.2.1.1.doc/t_zcap_sol_redhat_utilities.html

Code: [Select]
sudo yum whatprovides /usr/bin/wget

15
HTML & templates / Re: URL Forwarding Question
« on: July 31, 2018, 04:47:37 AM »
It's in thunder chicken of glore code, look for IP.

What rejeto is saying In Regards to security/ IP being displayed... is that if i visit the site, and get to your webpage, I can get the IP address regardless if it is displayed via the template or not.

Pages: [1] 2 3 ... 52