Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Website template
Wed, Dec 31 2014 7:47 PMPermanent Link

Jim Gallagher

I hesitated to post this, because I am by no means an expert, or even comfortable with EWB, but I discovered that there are not any simple demos of using Delphi modules.  I was able to get this to work, but it is likely that I used some, um, unconventional methods.  So caveat emptor, there are most likely better ways to do most of what I show here, but it might give someone a starting point.

I've attached an EWB project and a Delphi module project (XE2).  The Delphi program requires DBIsam, though it would be simple enough to change to another database.  I also use DCPCrypt, freeware, for creating a hash, though it is also easily replaceable.

https://bitbucket.org/wpostma/dcpcrypt2010

The EWB project is a simple skeleton of a website.  It has login/registration/timeout/sessions and a few other things.   The "Admin" module does user authentication and session management.

Passwords are stored as hashes, to avoid security issues of storing passwords.  Local client timeout and session timeout are both set to 60 seconds, for testing.

I didn't spend any time to make it pretty, or to bullet-proof the code.  This was basically a proof of concept for me - can I use this software to develop a web application?

I was puzzled by the TPage component, so I tried to create some dynamic HTML in the module (The "Content" menu option).  I  suspect this is not the intended use of this component, but it was fun to code.  It creates an html page on the fly for the client, and the html files are not deleted (I didn't want to start deleting files on other people's computers for this demo).  They will accumulate over time.   I realize that the function I'm demonstrating could be done with a simple dataset, but this was a sandbox for playing...

If you don't want to compile everything, it should be possible to install on a standalone EWB server.  I created a "skeleton" directory under  the Win32 directory of the server and put the contents of the "deploy" directory there.  I wasn't able to get the modules to work with the IDE webserver - probably just me not understanding something.

The user "Skeletor" and password "test" (case sensitive) will get you in, or you can "register" another user.

The forms are created and destroyed on the fly.  In theory, this should reduce memory usage on the client, but since it's Pascal's memory management mapped to Javascript, running within an unpredictable browser in a variable operating system, it's hard to know if it has any real benefit to do this.

If anyone takes a look and sees any security flaws, please let me know.

I was impressed with EWB - I will be buying a 2.0 license when it becomes available.  I really like the responsiveness of having a program running in the browser - a lot can be done without roundtrips to the server. The concern, or perhaps ignorance, I have is that there is not AFAIK a way to bookmark (or post to Facebook Smiley your position - the URL is for the application, not for the location within the application.  It seems to me that this might be an issue for search engine placement, too, but I'm not sure.

I'm looking forward to seeing what 2.0 brings that is new.

-Jim



Attachments: skeleton.zip
Fri, Jan 2 2015 5:18 AMPermanent Link

Matthew Jones

Jim Gallagher wrote:

> The concern, or perhaps ignorance, I have is that there is not AFAIK
> a way to bookmark (or post to Facebook Smiley your position - the URL
> is for the application, not for the location within the application.
> It seems to me that this might be an issue for search engine
> placement, too, but I'm not sure.

I'd have to look up the details, but it was shown in another topic that
you can use:
   SetWindowEventHandler('hashchange', TrapWindowHashChange);
and then use the #mypage type information to navigate your application.
On my shop I use "Window.Location.Hash := szHashTag;" and have #shop
and #account etc, and you can pick these up and act accordingly.
Handles the Back button too.

As for search engines, they are no-go into single page applications,
but that probably makes sense.

Happy to discuss further in /discussion or /general.

--

Matthew Jones
Sat, May 6 2017 7:00 AMPermanent Link

Big Al

Jim Gallagher wrote:


The EWB project is a simple skeleton of a website.  It has login/registration/timeout/sessions and a few other things.   The "Admin" module does user authentication and session management.


I am brand new to EWB and looking for something like the Skeleton project but of course in V2. Something that will be the base for any app I want to create that needs this sort of features.

Can anyone point me to something, or maybe Jim is still around and updated his project to V2?

Thanks
Alan
Image