Recent Posts

Pages: 1 ... 8 9 [10]
91
HTML & templates / Re: Simple contact template
« Last post by bmartino1 on August 10, 2018, 03:50:58 AM »
AS Per Leo Request.

Here is the post for the XML code

Key Notes to codes/ help:
//////////////////////////
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=@anonymous.}

^ code will affect the folder the file is loading form, which needs to be the same folder for the path.

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.

*right now it is set for anyone and anythings, might be safer for @any account...
//////////////////

There is no User intervention required, after re-examining the original code and fixing variables, i have a %folder% parse working with data write... I shouldn't have changed the post wirte and file name append...)

SETUP:
I assume you created a real folder named "contact" > Right Mouse Click Properties > Different Template Tab > Pasted in the
code...

*There were changes done that is different to the JavaScript validation code and form html code to make this work a bit smother.
--See comments

XML Final Draft write option:

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()'>
            <div style="text-align: right"><span class='error-message' id='name-error'></span></div>

<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()'>
            <div style="text-align: right"><span class='error-message' id='email-error'></span></div>

<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()'>
            <div style="text-align: right"><span class='error-message' id='subject-error'></span></div>

<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>
            <div style="text-align: right"><span class='error-message' id='message-error'></span></div>
            <br /><br />
<div style="text-align: right"><span class='error-message' id='submit-error'></span></div>
<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 -->
</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('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;

}

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

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

//ON button click action:
var booleanXCHECK = false;
//use to check validation and change boolean value to check before writes ...

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;
    }
}


//Populates the HTML span tag
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 text (XML) -->
<!-- Fix Permission to folder code is curently in for file 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 ... should write either way-->

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

if (booleanXCHECK === true) {
//if statement add to check before running write code... as this code should just run after validation...

//alert("your check is :"+booleanXCHECK );
//check value in code in event of issues that needs resolved fail/pass true

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';
GetMessage=GetMessage.replace(/([^\r])\n/g, "$1\r\n");
//atempt to fix single line text saved to 1 single string...

var FullDataString = Headers+'\n'+GetName+'\n'+GetMail+'\n'+GetSubject+'\n'+GetMessage+'\n'+Headers;
FullDataString = FullDataString.replace(/([^\r])\n/g, "$1\r\n");
//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...

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

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

//var request = new XMLHttpRequest();
//request.open("POST", "/contact"); 
//upload acess must be enabled for write to work... (fixed via in tempalte macro comand...)
//Path Must be same path that %folder% points to (the folder where the code is located! 
//request.send(formData);
// ------------------------------------------

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

var request = new XMLHttpRequest();
request.open("POST", "./");  //enable upload in contact
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);

}
else { return false; }
}
</script>

</body>
</html>

log example:
7:40:41 AM 127.0.0.1:51207 Requested GET /
7:40:41 AM 127.0.0.1:51209 Requested GET /?mode=jquery
7:40:42 AM 127.0.0.1:51207 Requested GET /Contact/
7:41:02 AM 127.0.0.1:51207 Uploading New-Message-2018.08.26-at-07.40.42.txt
7:41:02 AM 127.0.0.1:51207 Fully uploaded New-Message-2018.08.26-at-07.40.42.txt - 150 @ 13.3 KB/s
7:41:06 AM 127.0.0.1:51210 Requested GET /Contact/?name=Brandon+Martino&email=my@test.com&subject=ff&message=i+pass+validation&SubmitMessage=
7:41:06 AM 127.0.0.1:51209 Requested GET /Contact/

file content example:

file name:New-Message-2018.08.26-at-07.40.42

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

Name: Brandon Martino
Email: my@test.com
Subject: ff
Message:

i pass validation


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



attached is the xml template code
92
HFS ~ HTTP File Server / Re: Route HFS through VPN
« Last post by starscue on August 08, 2018, 01:28:49 PM »
bmartino1 is right, the VPN you should choose, needs to let you "open ports" on their service, something called "Port forwarding" (like you would need when you use eMule, torrent, or any other P2P protocol). You could find a comprehensive list here and here (you could also have a tutorial on how to build a private VPN here).

Please report back with the results of your experiments, to leave a future guide for the rest of the users (thanks!). Keep in touch if you need further help. :)

It's working Fine with TorGuard. You can Also Test It By Yourself.
93
HFS ~ HTTP File Server / Re: VFS settings to another PC ?
« Last post by bmartino1 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.
94
HFS ~ HTTP File Server / Re: A macro-level https redirect ?
« Last post by LeoNeeson on August 07, 2018, 04:15:15 PM »
This could be your start point.
95
HFS ~ HTTP File Server / Re: Running the latest version as a service
« Last post by LeoNeeson on August 07, 2018, 02:30:35 PM »
The manual asks me to extract the zip and run the HFS2SERVICE.EXE but this does not exist in the download.
Hi! :) As described here, you can download HFS2SERVICE.EXE from here (more info here). You will find also more alternatives, here (SRVANY-NG and NSSM, both great alternatives to run HFS as a service).

@bmartino1 and anyone interested: I'm sorry, I still didn't have enough time to work on any of those templates (I'll try to make time to do it as soon as I get some free time off, but don't hold your breath).
96
HFS ~ HTTP File Server / Re: VFS settings to another PC ?
« Last post by LeoNeeson on August 07, 2018, 02:18:36 PM »
Let me see if i understand you correctly: you want to copy your ".vfs" file from one PC to another, and when you launch HFS on a new PC, you want that HFS recreate the whole folder structure? To some point this could be feasible to add, but it only could recreate 'empty' folders without content... is that what your are looking for?... ???

If you have a lot of empty folders, it's much easier to make a ZIP of RAR file and unZIP/unRAR the folders on the new PC (just before you start HFS on the new PC). Like bmartino1 said, before you move anything, you need to save all the HFS settings in .ini file (to do this, in Expert mode, go to Menu > Save options > to file). If the whole HFS folder is small in size, it even more easier to compress everything as ZIP/RAR and uncompress everything on the new PC.

Interested option for all folders - "Not Browsable"?
I didn't understand that part... :-\
97
HFS ~ HTTP File Server / Re: Running the latest version as a service
« Last post by bmartino1 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...
98
HFS ~ HTTP File Server / Running the latest version as a service
« Last post by jsavoor on August 06, 2018, 01:18:24 PM »
Hi

New to HFS and see it is a wonderful product. Does everything I need except that I cannot seem to run it as a service.
The manual asks me to extract the zip and run the HFS2SERVICE.EXE but this does not exist in the download.
There is only HFS.EXE.

Could someone please assist in this?

Thanks

Jay
99
HFS ~ HTTP File Server / Re: Pls support Unicode searching, thank you!
« Last post by bmartino1 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.
100
HFS ~ HTTP File Server / Re: Any way to use winzip vs TAR ?
« Last post by dj on August 04, 2018, 11:32:08 AM »
I have written a addon (diff tpl) to archive files in ZIP archive

It uses JSZip javascript library on the client
For instructions look into the source
Tested with Chrome, FF, Edge, IE11
Pages: 1 ... 8 9 [10]