Forms814 - A website builder, useful for writing data collection webapps quickly.

forms814

alt text

A website builder, useful for writing data collection webapps quickly.

Project Design

  1. The method in use here is to mix it with complicated forms. This provides the benefits of one installation ( reducing server maintenance works) and also using one authentication system to log on to the system (comfort).

  2. Document Structures (Forms) are not provided with the installation so as to create only what one needs. Also it is impossible to get good forms for every use case for there are differences between similar organizations.

  3. There is a list of document structures which are accessible to the administrator only. To list document structures to the users you would need to write a custom page. Reasons for this design are:

    • It makes the list of page very configurable. One could achieve dropdowns, menus on the top, menus on the side. With these menus pointing to document structure links.

    • Document Structures pages can be grouped with pages not created with this framework.

Projects Used

Setup

Users Table Setup

Note that user creation and updating is not part of this project. You as the administrator is to provide this. This is to ensure that you can use any form of authentication you want eg. social auth (Facebook, google, twitter), passwords, fingerprint, keys etc.

Create a users table with the following properties:

  1. it must also have fields firstname and surname for easy recognition.
  2. it must also have field email for communications.
  3. it must also have field timezone for datetime data. Example value is 'Africa/Lagos'

You must also provide a function that would get the currently logged in users. The function is given the request object to get the cookies for its purpose. Set the forms814.GetCurrentUser to this function. The function has the following declaration func(r *http.Request) (int64, error).

The forms814.GetCurrentUser should return 0 for public.

Sample User Table Template (please only add to the fields, don't delete any of the fields in the template)

table: users
fields:
  firstname string required
  surname string required
  email email required unique
  timezone string
::

Begin

Get the framework through the following command go get -u github.com/bankole7782/forms814

There is a sample application which details how to complete the setup. Take a look at it here

Copy the folder f8_files from the main repo into the same path as your main.go.

Make sure you look at main.go in the sample app, copy and edit it to your own preferences.

Go to /f8/setup to create some tables that the project would need.

Then go to /f8/page to start using this project.

Files Setup

Read this for how to setup a service account to use in communicating with google cloud storage.

You would need to create a bucket on google cloud storage for all your files in a forms814 installation. Then set the name of the bucket to forms814.BucketName.

Setting up Role Permissions for a Document Structure.

Go to /roles-view/ to create some roles for the project.

Go to /users-to-roles-list/ to update the users' roles.

To set up permissions for a document structure, go to /view-document-structure/{document-structure-full-name}/ you would see the links to do so in this page.

Listing of Document Structure Links in your Web App

You would need to call forms814.DoesCurrentUserHavePerm to check if the current user have read permission to the document structure before listing it. This would ensure a clean interface with the user seeing only what he uses.

forms814.DoesCurrentUserHavePerm has the following definition: func(r *http.Request, documentStructure string, permission string) (bool, error)

The permissions to test for is read.

The link to display to the user is of the form /list/{documentStructure}/. Replace {documentStructure} with the name of the document structure.

Creating Inspectors

Inspectors are users who have read access to all the documents in an installation.

To add a user as inspector add his/her id to forms814.Inspectors

Theming Your Project

The sample project has no design. To make it beautiful make a template from this template :f8_files/bad-base.html . Save it to your project and then point your version to forms814.BaseTemplate.

Also if you want to add dynamic contents to any forms814 page, please use JavaScript. First check the address of the page window.location before adding it.

Adding Extra Code to Your Project

Extra code does things like document validation, after save actions like sending emails, updating read only values.

Steps:

  • Go to /view-document-structure/{document-structure}/ where document-structure is changed to the name of a document structure that you created.

  • You would see the ID of the document structure.

  • forms814.ExtraCode has the following definitions:

    type ExtraCode struct {
      ValidationFn func(postForm url.Values) string
      AfterCreateFn func(id int64)
      AfterUpdateFn func(id int64)
      BeforeDeleteFn func(id int64)
      CanCreateFn func() string
    }

    For ValidationFn take a look at url.Values description

  • Create a type forms814.ExtraCode and add it to the forms814.ExtraCodeMap in your main function with the ID of the document structure as the key. Example is :

    validateProfile := func(postForm url.Values) string{
      if postForm.Get("email") == "[email protected]" {
        return "not valid."
      }
      return ""
    }
    
    forms814.ExtraCodeMap[1] = forms814.ExtraCode{ValidationFn: validateProfile}
  • For ValidationFn and CanCreateFn whenever it returns a string it would be taken as an error and printed to the user. If it doesn't then there is no error.

  • Other functions under ExtraCode do not print to screen.

  • For AfterCreateFn, AfterUpdateFn and BeforeDeleteFn you would need to do an SQL query to get the document data.

FAQs

How do I send mail after saving a document in Forms814.

Use ExtraCode.

There is no inbuilt mail function so as to give a lot of choices in terms of email provider and the design of the email itself.

When is X Database Support Coming

I don't intend to support more than one database so has to make the work cheaper.

When is X Cloud Support Comming

I don't intend to support more than one cloud.

License

Released with the MIT License

Owner
Bankole Ojo
a programmer.
Bankole Ojo
Similar Resources

WebsiteChecker - A GoLang program that verifies if a website is available or not

Website Checker 💻 This is my first program in Go! The purpose of this applicati

Apr 30, 2022

Turning a folder into a gallery website to share your videos, songs and images in the local netwrok.

What Carp Web Gallery Turning a folder into a gallery website to share your videos, songs and images in the local netwrok. Browser videos and audios i

Mar 14, 2022

serve a static website as a .onion hidden service

hidden service server A CLI that will host a static website as a .onion hidden service. Comes with an additional binary that can be used to generate v

Sep 4, 2022

Code for the website / Código para o site

Site crdpa.net Code for the new website This is the frontend and backend code for my new website. It is for my use only. If you want to use it, you ar

May 11, 2022

llb - It's a very simple but quick backend for proxy servers. Can be useful for fast redirection to predefined domain with zero memory allocation and fast response.

llb What the f--k it is? It's a very simple but quick backend for proxy servers. You can setup redirect to your main domain or just show HTTP/1.1 404

Sep 27, 2022

Subfinder is a subdomain discovery tool that discovers valid subdomains for websites. Designed as a passive framework to be useful for bug bounties and safe for penetration testing.

Subfinder is a subdomain discovery tool that discovers valid subdomains for websites. Designed as a passive framework to be useful for bug bounties and safe for penetration testing.

Fast passive subdomain enumeration tool. Features • Install • Usage • API Setup • License • Join Discord Subfinder is a subdomain discovery tool that

Jan 4, 2023

Multiplexer over TCP. Useful if target server only allows you to create limited tcp connections concurrently.

tcp-multiplexer Use it in front of target server and let your client programs connect it, if target server only allows you to create limited tcp conne

May 27, 2021

golang useful http client

gequest 简体中文 | English 一个轻量级的、语义化的、链式操作的 golang http 客户端封装 用法 要求: golang = 1.14 安装 go get -u "github.com/smallcatx0/gequest" import ( request "g

Sep 18, 2021

GBPool-- a simple but useful golang free proxy pool

GBPool-- a simple but useful golang free proxy pool Intro(English) (中文) GBPool, golang baipiao proxy pool, a free & simple golang proxy pool module, g

May 30, 2022
Back end of e-books and papers collection website. Only for internal use.

Back end of e-books and papers collection website. Only for internal use.

Nov 1, 2022
Collection of useful golang code snippets, mainly for learning purposes

Go-Things Collection of go code snippets, tools, etc. mainly for learning purpos

Dec 31, 2021
Useful collection functions for golang, based on generic types

go-collection English | 简体中文 go-collection provides developers with a convenient set of functions for working with common slices, maps, and arrays dat

Jul 21, 2022
Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.

raw Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed. For more information about using ra

Dec 28, 2022
An autoclaimer for the website We Heart It

weheartit-claimer An autoclaimer for the website We Heart It Table of contents Setting up the claimer Understanding the configuration files Setup Firs

May 26, 2021
CDN for the Tech With Tim website using Go
CDN for the Tech With Tim website using Go

Tech With Tim - CDN CDN for the Tech With Tim website using Go ?? Table of Contents ?? Getting Started Environment variables Running ?? Running with D

Apr 29, 2022
Access my website from the terminal with SSH!
Access my website from the terminal with SSH!

daniel.is-a.dev (ssh version) What is this? I built a SSH server written in Golang that lets you basically view my website all from the terminal. You

Nov 11, 2022
Simple website fingerprinting tool

onefinger 一个简单的指纹识别工具,规则提取自goby并稍作修改,某个知识星球的作业 Usage Usage: onefinger [-v] | (-t=<target>... | --tf=<targetFile>) [--threads=<threads>] [--timeout=<ti

Mar 16, 2022
A simple project which enables you to check wheather the website is up
A simple project which enables you to check wheather the website is up

Website Status Checker A simple project which enables you to check wheather the website is up and working fine or is the website has been crashed. Abo

Nov 8, 2021
Podcast RSS feed sharing website

Yarr A website for storing, sharing and viewing podcasts in RSS format. Powering yarr.ps Building go build --tags "fts5" TODO Add ability to add pods

Nov 6, 2021