SlideShare a Scribd company logo
1 of 73
Download to read offline
WEBGUI DEV 101
   WebGUI Developer Workshop
INSTALL WEBGUI
USB Drive



Copy the WebGUI Workshop folder to your hard disk
Pass the USB Drive off to someone else



          (You’re going to need ~6GB of free space.)
Install

Install VMWare Player (or Fusion if on Mac)
 (If you already have VMWare Player 2 or higher you can ignore this.)

Decompress the Zip File

Open VMWare

Browse to the folder where you extracted WebGUI

Open WebGUI
Test The Image


In the VMWare window log in to the command line

It should tell you what IP address to visit

Open your web browser and go to that IP address
File Share

You can access the VM’s filesystem from your computer

  Windows: 192.168.47.131data                 (The IP may be
                                                different on your
  Mac/Linux: cifs://192.168.47.131/data               install.)

  Username: webgui

  Password: 123qwe
CORPORATE PERL
OUR USERS
     And 10000+ more...




                          Fred Rogers Foundation
Figures based upon an actual client intranet project that
                                                            was built in both Oracle Portals® and WebGUI®, and
                                                            estimated for MS Sharepoint®.




     Licensing        Implementation     Hardware                     WebGUI®                  Oracle Portals®
3,000,000
                                                             80



 2,250,000                                                   60



  1,500,000                                                  40



     750,000                                                 20

                                          Oracle Portals®
              0                MS Sharepoint®                  0
                    WebGUI®                                 Site Online           Base Apps              Full Suite

            Physical Cost (Dollars)                                        Time Cost (Months)
WEBGUI DEMO
THE API
Sprawling API

WebGUI’s API is huge, can’t cover it all today.

Your brain will hurt without it anyway.

View the full API at:
http://www.plainblack.com/downloads/builds/7.7.20-stable/api/
- or -
perldoc /data/WebGUI/lib/WebGUI/User.pm

We’ll cover some basics now, and the rest as we go.
Application Framework
                               Plugin Points
Template Processors   Shipping Methods   Payment Methods          Product Types

      Taxes            Form Controls            Cache             Utility Scripts

   Translations       Content Packages   Workflow Activities   Authentication Handlers

     Macros                Assets          URL Handlers          Content Handlers

                                    Core API
   File Storage       Image Processing          Search               Sessions

 Database Access      HTTP Interaction           Mail             LDAP Access

      Users               Groups               Privileges         Other Utilities

                                    Database
WRITING MACROS
WebGUI::Session
$session is the circulatory and nervous system of WebGUI

Here’s how you create or reopen one:
my $session = WebGUI::Session->open($rootPath, $config);

Here’s how you close one:
$session->close;

Here’s how you destroy one:
$session->var->end;
$session->close;
Macros Are Easy

Used to put programmer power into an easy package content
publishers can handle.

Macros reside in /data/WebGUI/lib/WebGUI/Macro

Single subroutine API

Gets a single argument, $session

Start by copying the _macro.skeleton file.
Hello World
package WebGUI::Macro::HelloWorld;

use strict;

sub process {
  my ($session) = @_;
  return ‘Hello World!’;
}

1;
YOU DO IT
Hello World
package WebGUI::Macro::HelloWorld;

use strict;

sub process {
  my ($session) = @_;
  return ‘Hello World!’;
}

1;
How do we know it works?
In your workshop folder find macroRunner.pl

Copy into /data/WebGUI/sbin

Type:
perl macroRunner.pl 
--config=www.example.com.conf 
--macro=HelloWorld

And you should get:
Hello World!
Install It

Edit /data/WebGUI/etc/www.example.com.conf

Find the ‘macros’ section

Add the following to your config file:

“HelloWorld” : “HelloWorld”,
Use It

wreservice.pl --restart modperl

Adding the following to your content:
^HelloWorld;

Should produce:
Hello World!
$session | Current User

A reference to the current user:
my $user = $session->user;

ISA WebGUI::User object.

Get a param:
my $username = $user->username;

Set a param:
$user->username($username);
Username Macro

Create a macro called ‘Username’

Output the current user’s username.

WRITE IT!

Hint: $session->user

Hint 2: $session->user->username
Username
package WebGUI::Macro::Username;

use strict;

sub process {
  my ($session) = @_;
  return $session->user->username;
}

1;
Does it work?


Test it
macroRunner.pl

Use it
^Username;
Macros Can Have Params
^Sum(1,2,3,4,5);

Should produce: 15

Parameters are passed in to process() after $session

WRITE IT!

Hint: my ($session, @args) = @_;

Hint 2: $total += $_ foreach @args;
Sum
package WebGUI::Macro::Sum;

use strict;

sub process {
  my ($session, @args) = @_;
  my $total = 0;
  $total += $_ foreach @args;
  return $total;
}

1;
Does it work?


Test it
macroRunner.pl

Use it
^Sum(1,2,3,4,5);
WRITING CONTENT
   HANDLERS
Content Handlers Are
            Powerful

As easy to write as a macro, but way more powerful.

Can write a full web app with just a content handler.

Used mainly for writing simple round trip services.

Receives a single parameter of $session.
Hello World
package WebGUI::Content::HelloWorld;

use strict;

sub handler {
  my ($session) = @_;
  return ‘Hello World!’;
}

1;
YOU DO IT
Hello World
package WebGUI::Content::HelloWorld;

use strict;

sub handler {
  my ($session) = @_;
  return ‘Hello World!’;
}

1;
Install It

Edit /data/WebGUI/etc/www.example.com.conf

Find the ‘contentHandlers’ section

Add the following to your config file:

“WebGUI::Content::HelloWorld”,

Order is important. If something returns content before your
content handler, then your content handler will never be called.
Use It


Visiting http://localhost:8081/

Should produce:
Hello World!
$session | Forms

A reference to the form processor
my $form = $session->form

Fetch a form parameter
my $value = $form->get(“foo”);

Validate it against a specific field type
my $value = $form->get(“foo”,”integer”);
Conditionality
Content handlers should be conditional

  Based on some setting

  A specific URL

  A parameter in the URL

  A time of day

  Anything else you choose
Conditional Hello World


Modify HelloWorld so that it only displays if a form parameter
called ‘op’ has a value of ‘helloworld’.

WRITE IT!

Hint: my $value = $session->form->get(‘op’);
Hello World
package WebGUI::Content::HelloWorld;

use strict;

sub handler {
  my ($session) = @_;
  if ($session->form->get(‘op’) eq ‘helloworld’) {
     return ‘Hello World!’;
  }
  return undef;
}

1;
Sum
Task:
  Triggered by form variable called ‘op=Sum’
  User enters comma separated list of numbers in form variable
  called ‘values’
  Sum them
  Display the result
  Test: http://localhost:8081/?op=Sum;values=1,2,3,4,5
WRITE IT!
Sum
package WebGUI::Content::Sum;
use strict;

sub handler {
   my ($session) = @_;
   if ($session->form->get(‘op’) eq ‘Sum’) {
      my @values = split(‘,’, $session->form->get(‘values’));
      my $total = 0;
      $total += $_ foreach @values;
      return $total
   }
   return undef;
}
1;
WebGUI::HTMLForm


Draw forms quickly and easily.

Simple OO API

Dozens of form controls already in existence
Making A Form
use WebGUI::HTMLForm;
my $f = WebGUI::HTMLForm->new($session);
$f->hidden( name=>”ip”, value=>$ip );
$f->text( name=>”username”, label=>”Username”);
$f->integer( name=>”guess”, label=>”Pick a number”);
$f->date( name=>”birthday”, label=>”Birth Date”);
$f->submit;
return $f->print;
Sum with Form


Task:
  Now add a form to make it easier for users to use
WRITE IT!
Hint: my $f = WebGUI::HTMLForm->new($session);
Sum
use WebGUI::HTMLForm;

my $f = WebGUI::HTMLForm->new($session);
$f->hidden( name=>’op’, value=>’Sum’ );
$f->text( name=>’values’, defaultValue=>$session->form->get(‘values’),
    label => ‘Values to Sum’, subtext => ‘Separated by commas’);
$f->submit;

return $total . “<br />” . $f->print;
$session | Styles

You can easily wrap output in a style to make it prettier.
You get the style reference from $session.
my $style = $session->style;
Then you just wrap your output in the style using the userStyle()
method.
return $style->userStyle($output);
Sum with Style



Add a style wrapper to Sum
WRITE IT!
Sum
return $session->style->userStyle($total . “<br />” . $f->print);
OTHER PLUGINS
So Far


Macros

Content Handlers

But there are 17 plugin types for WebGUI currently
URL Handler



Like a content handler, but has direct access to the Apache
request cycle
Asset


The main content application object.

Features version control, metadata, direct URLs, and lineage
based relationships
Packages



Bundle asset configurations as a importable package.
Sku



A special type of asset that plugs into WebGUI shop as a sellable
item.
Auth



Customize the authentication / login process.
i18n / Help


i18n allows you to internationalize any other plugins

Help allows you to document your plugins using the i18n
system.
Shipping , Payment, and Tax
          Drivers

Tie in to shippers like UPS, Fedex, USPS, DHL, etc.

Tie in to payment gateways like PayPal, Google Checkout,
Authorize.net, etc.

Tie in to various tax mechanisms set up by regional governments.
Template Engine



Tie your own template parsers to WebGUI.
Workflow Activities



Extend the workflow engine to run your asynchronous tasks
Utility Scripts



Run maintenance and administrative tasks from the command
line.
Form Controls



Add to the more than two dozen form controls with input
validation already in the system.
Cache



Add new ways of speeding up WebGUI by caching complex
items.
QUESTIONS?
APPENDIX
Database

A reference to your WebGUI database:
my $db = $session->db;

ISA WebGUI::SQL object.

Read:
my $sth = $db->read($sql, @params);

Write:
$db->write($sql, @params);
Database CRUD
Create:
my $id = $db->setRow($table, $keyname, %properties);

Read:
my $row = $db->getRow($table, $keyname, $id);

Update:
$db->setRow($table, $keyname, %properties);

Delete:
$db->deleteRow($table, $keyname, $id);
Database Helpers

Get a row
my @array = $db->quickArray($sql, @params);
my %hash = $db->quickHash($sql, @params);

Get a column
my @array = $db->buildArray($sql, @params);
my %hash = $db->buildHash($sql, @params);

Get a single column from a single row
my $scalar = $db->quickScalar($sql, @params);
Log

A reference to the log file
my $log = $session->log;

Write to the log
$log->error($message);
$log->warn($message);
$log->info($message);
$log->debug($message);
HTTP

Interact with HTTP
my $http = $session->http;

Set a redirect
$http->setRedirect($url);

Send header
$http->sendHeader;
HTTP Continued

Set headers
$http->setCacheControl($seconds);
$http->setCookie($name, $value);
$http->setMimeType(‘text/xml’);
$http->setFilename($filename, $mimetype);
$http->setStatus(404,$notFoundMessage);

Get Cookies
my $hashRef = $http->getCookies;
Output
Output back to browser
my $output = $session->output;

Print some content
$output->print($content);

Don’t process macros as printing:
$output->print($content,1);

Set the output handle
$output->setHandle($someFileHandle);

More Related Content

What's hot

Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackIgnacio Martín
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyAlain Hippolyte
 
Filling the flask
Filling the flaskFilling the flask
Filling the flaskJason Myers
 
A Little Backbone For Your App
A Little Backbone For Your AppA Little Backbone For Your App
A Little Backbone For Your AppLuca Mearelli
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricksJavier Eguiluz
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsAndré Tapia
 
Web deploy command line
Web deploy command lineWeb deploy command line
Web deploy command lineLarry Nung
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgnitermirahman
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...Codemotion
 
Dethroning Grunt: Simple and Effective Builds with gulp.js
Dethroning Grunt: Simple and Effective Builds with gulp.jsDethroning Grunt: Simple and Effective Builds with gulp.js
Dethroning Grunt: Simple and Effective Builds with gulp.jsJay Harris
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSMin Ming Lo
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsMichael Peacock
 

What's hot (20)

CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application Symfony
 
Filling the flask
Filling the flaskFilling the flask
Filling the flask
 
A Little Backbone For Your App
A Little Backbone For Your AppA Little Backbone For Your App
A Little Backbone For Your App
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricks
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIs
 
Web deploy command line
Web deploy command lineWeb deploy command line
Web deploy command line
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Web deploy
Web deployWeb deploy
Web deploy
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
AspNetWhitePaper
AspNetWhitePaperAspNetWhitePaper
AspNetWhitePaper
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...
 
Dethroning Grunt: Simple and Effective Builds with gulp.js
Dethroning Grunt: Simple and Effective Builds with gulp.jsDethroning Grunt: Simple and Effective Builds with gulp.js
Dethroning Grunt: Simple and Effective Builds with gulp.js
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
 
Django
DjangoDjango
Django
 

Viewers also liked (8)

Ist Intermational Congress Children In ICT
Ist Intermational Congress Children In ICTIst Intermational Congress Children In ICT
Ist Intermational Congress Children In ICT
 
Comunidad de aprendizaje
Comunidad de aprendizajeComunidad de aprendizaje
Comunidad de aprendizaje
 
The NICAM approach
The NICAM approachThe NICAM approach
The NICAM approach
 
Young People and Internet Literacy and Safety
Young People and Internet Literacy and SafetyYoung People and Internet Literacy and Safety
Young People and Internet Literacy and Safety
 
01. menorestic2010 richardson
01. menorestic2010 richardson01. menorestic2010 richardson
01. menorestic2010 richardson
 
Estudio tecnologias cientificos futuro
Estudio tecnologias cientificos futuroEstudio tecnologias cientificos futuro
Estudio tecnologias cientificos futuro
 
Corresponsabilidad
CorresponsabilidadCorresponsabilidad
Corresponsabilidad
 
Escuela 2.0
Escuela 2.0Escuela 2.0
Escuela 2.0
 

Similar to WebGUI Developers Workshop

Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSGunnar Hillert
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
Java Web Programming on Google Cloud Platform [1/3] : Google App EngineJava Web Programming on Google Cloud Platform [1/3] : Google App Engine
Java Web Programming on Google Cloud Platform [1/3] : Google App EngineIMC Institute
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep DiveGabriel Walt
 
Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsSoós Gábor
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMiguel Araújo
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 Software
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they doDave Stokes
 
Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 3camp
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress DevelopmentAdam Tomat
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 

Similar to WebGUI Developers Workshop (20)

Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
Java Web Programming on Google Cloud Platform [1/3] : Google App EngineJava Web Programming on Google Cloud Platform [1/3] : Google App Engine
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.js
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP Yii
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
 
Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Asp.net
Asp.netAsp.net
Asp.net
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 

Recently uploaded

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

WebGUI Developers Workshop

  • 1. WEBGUI DEV 101 WebGUI Developer Workshop
  • 2.
  • 4. USB Drive Copy the WebGUI Workshop folder to your hard disk Pass the USB Drive off to someone else (You’re going to need ~6GB of free space.)
  • 5. Install Install VMWare Player (or Fusion if on Mac) (If you already have VMWare Player 2 or higher you can ignore this.) Decompress the Zip File Open VMWare Browse to the folder where you extracted WebGUI Open WebGUI
  • 6. Test The Image In the VMWare window log in to the command line It should tell you what IP address to visit Open your web browser and go to that IP address
  • 7. File Share You can access the VM’s filesystem from your computer Windows: 192.168.47.131data (The IP may be different on your Mac/Linux: cifs://192.168.47.131/data install.) Username: webgui Password: 123qwe
  • 9. OUR USERS And 10000+ more... Fred Rogers Foundation
  • 10. Figures based upon an actual client intranet project that was built in both Oracle Portals® and WebGUI®, and estimated for MS Sharepoint®. Licensing Implementation Hardware WebGUI® Oracle Portals® 3,000,000 80 2,250,000 60 1,500,000 40 750,000 20 Oracle Portals® 0 MS Sharepoint® 0 WebGUI® Site Online Base Apps Full Suite Physical Cost (Dollars) Time Cost (Months)
  • 13. Sprawling API WebGUI’s API is huge, can’t cover it all today. Your brain will hurt without it anyway. View the full API at: http://www.plainblack.com/downloads/builds/7.7.20-stable/api/ - or - perldoc /data/WebGUI/lib/WebGUI/User.pm We’ll cover some basics now, and the rest as we go.
  • 14. Application Framework Plugin Points Template Processors Shipping Methods Payment Methods Product Types Taxes Form Controls Cache Utility Scripts Translations Content Packages Workflow Activities Authentication Handlers Macros Assets URL Handlers Content Handlers Core API File Storage Image Processing Search Sessions Database Access HTTP Interaction Mail LDAP Access Users Groups Privileges Other Utilities Database
  • 16. WebGUI::Session $session is the circulatory and nervous system of WebGUI Here’s how you create or reopen one: my $session = WebGUI::Session->open($rootPath, $config); Here’s how you close one: $session->close; Here’s how you destroy one: $session->var->end; $session->close;
  • 17. Macros Are Easy Used to put programmer power into an easy package content publishers can handle. Macros reside in /data/WebGUI/lib/WebGUI/Macro Single subroutine API Gets a single argument, $session Start by copying the _macro.skeleton file.
  • 18. Hello World package WebGUI::Macro::HelloWorld; use strict; sub process { my ($session) = @_; return ‘Hello World!’; } 1;
  • 20. Hello World package WebGUI::Macro::HelloWorld; use strict; sub process { my ($session) = @_; return ‘Hello World!’; } 1;
  • 21. How do we know it works? In your workshop folder find macroRunner.pl Copy into /data/WebGUI/sbin Type: perl macroRunner.pl --config=www.example.com.conf --macro=HelloWorld And you should get: Hello World!
  • 22. Install It Edit /data/WebGUI/etc/www.example.com.conf Find the ‘macros’ section Add the following to your config file: “HelloWorld” : “HelloWorld”,
  • 23. Use It wreservice.pl --restart modperl Adding the following to your content: ^HelloWorld; Should produce: Hello World!
  • 24. $session | Current User A reference to the current user: my $user = $session->user; ISA WebGUI::User object. Get a param: my $username = $user->username; Set a param: $user->username($username);
  • 25. Username Macro Create a macro called ‘Username’ Output the current user’s username. WRITE IT! Hint: $session->user Hint 2: $session->user->username
  • 26. Username package WebGUI::Macro::Username; use strict; sub process { my ($session) = @_; return $session->user->username; } 1;
  • 27. Does it work? Test it macroRunner.pl Use it ^Username;
  • 28. Macros Can Have Params ^Sum(1,2,3,4,5); Should produce: 15 Parameters are passed in to process() after $session WRITE IT! Hint: my ($session, @args) = @_; Hint 2: $total += $_ foreach @args;
  • 29. Sum package WebGUI::Macro::Sum; use strict; sub process { my ($session, @args) = @_; my $total = 0; $total += $_ foreach @args; return $total; } 1;
  • 30. Does it work? Test it macroRunner.pl Use it ^Sum(1,2,3,4,5);
  • 31. WRITING CONTENT HANDLERS
  • 32. Content Handlers Are Powerful As easy to write as a macro, but way more powerful. Can write a full web app with just a content handler. Used mainly for writing simple round trip services. Receives a single parameter of $session.
  • 33. Hello World package WebGUI::Content::HelloWorld; use strict; sub handler { my ($session) = @_; return ‘Hello World!’; } 1;
  • 35. Hello World package WebGUI::Content::HelloWorld; use strict; sub handler { my ($session) = @_; return ‘Hello World!’; } 1;
  • 36. Install It Edit /data/WebGUI/etc/www.example.com.conf Find the ‘contentHandlers’ section Add the following to your config file: “WebGUI::Content::HelloWorld”, Order is important. If something returns content before your content handler, then your content handler will never be called.
  • 38. $session | Forms A reference to the form processor my $form = $session->form Fetch a form parameter my $value = $form->get(“foo”); Validate it against a specific field type my $value = $form->get(“foo”,”integer”);
  • 39. Conditionality Content handlers should be conditional Based on some setting A specific URL A parameter in the URL A time of day Anything else you choose
  • 40. Conditional Hello World Modify HelloWorld so that it only displays if a form parameter called ‘op’ has a value of ‘helloworld’. WRITE IT! Hint: my $value = $session->form->get(‘op’);
  • 41. Hello World package WebGUI::Content::HelloWorld; use strict; sub handler { my ($session) = @_; if ($session->form->get(‘op’) eq ‘helloworld’) { return ‘Hello World!’; } return undef; } 1;
  • 42. Sum Task: Triggered by form variable called ‘op=Sum’ User enters comma separated list of numbers in form variable called ‘values’ Sum them Display the result Test: http://localhost:8081/?op=Sum;values=1,2,3,4,5 WRITE IT!
  • 43. Sum package WebGUI::Content::Sum; use strict; sub handler { my ($session) = @_; if ($session->form->get(‘op’) eq ‘Sum’) { my @values = split(‘,’, $session->form->get(‘values’)); my $total = 0; $total += $_ foreach @values; return $total } return undef; } 1;
  • 44. WebGUI::HTMLForm Draw forms quickly and easily. Simple OO API Dozens of form controls already in existence
  • 45. Making A Form use WebGUI::HTMLForm; my $f = WebGUI::HTMLForm->new($session); $f->hidden( name=>”ip”, value=>$ip ); $f->text( name=>”username”, label=>”Username”); $f->integer( name=>”guess”, label=>”Pick a number”); $f->date( name=>”birthday”, label=>”Birth Date”); $f->submit; return $f->print;
  • 46. Sum with Form Task: Now add a form to make it easier for users to use WRITE IT! Hint: my $f = WebGUI::HTMLForm->new($session);
  • 47. Sum use WebGUI::HTMLForm; my $f = WebGUI::HTMLForm->new($session); $f->hidden( name=>’op’, value=>’Sum’ ); $f->text( name=>’values’, defaultValue=>$session->form->get(‘values’), label => ‘Values to Sum’, subtext => ‘Separated by commas’); $f->submit; return $total . “<br />” . $f->print;
  • 48. $session | Styles You can easily wrap output in a style to make it prettier. You get the style reference from $session. my $style = $session->style; Then you just wrap your output in the style using the userStyle() method. return $style->userStyle($output);
  • 49. Sum with Style Add a style wrapper to Sum WRITE IT!
  • 52. So Far Macros Content Handlers But there are 17 plugin types for WebGUI currently
  • 53. URL Handler Like a content handler, but has direct access to the Apache request cycle
  • 54. Asset The main content application object. Features version control, metadata, direct URLs, and lineage based relationships
  • 55. Packages Bundle asset configurations as a importable package.
  • 56. Sku A special type of asset that plugs into WebGUI shop as a sellable item.
  • 58. i18n / Help i18n allows you to internationalize any other plugins Help allows you to document your plugins using the i18n system.
  • 59. Shipping , Payment, and Tax Drivers Tie in to shippers like UPS, Fedex, USPS, DHL, etc. Tie in to payment gateways like PayPal, Google Checkout, Authorize.net, etc. Tie in to various tax mechanisms set up by regional governments.
  • 60. Template Engine Tie your own template parsers to WebGUI.
  • 61. Workflow Activities Extend the workflow engine to run your asynchronous tasks
  • 62. Utility Scripts Run maintenance and administrative tasks from the command line.
  • 63. Form Controls Add to the more than two dozen form controls with input validation already in the system.
  • 64. Cache Add new ways of speeding up WebGUI by caching complex items.
  • 67. Database A reference to your WebGUI database: my $db = $session->db; ISA WebGUI::SQL object. Read: my $sth = $db->read($sql, @params); Write: $db->write($sql, @params);
  • 68. Database CRUD Create: my $id = $db->setRow($table, $keyname, %properties); Read: my $row = $db->getRow($table, $keyname, $id); Update: $db->setRow($table, $keyname, %properties); Delete: $db->deleteRow($table, $keyname, $id);
  • 69. Database Helpers Get a row my @array = $db->quickArray($sql, @params); my %hash = $db->quickHash($sql, @params); Get a column my @array = $db->buildArray($sql, @params); my %hash = $db->buildHash($sql, @params); Get a single column from a single row my $scalar = $db->quickScalar($sql, @params);
  • 70. Log A reference to the log file my $log = $session->log; Write to the log $log->error($message); $log->warn($message); $log->info($message); $log->debug($message);
  • 71. HTTP Interact with HTTP my $http = $session->http; Set a redirect $http->setRedirect($url); Send header $http->sendHeader;
  • 72. HTTP Continued Set headers $http->setCacheControl($seconds); $http->setCookie($name, $value); $http->setMimeType(‘text/xml’); $http->setFilename($filename, $mimetype); $http->setStatus(404,$notFoundMessage); Get Cookies my $hashRef = $http->getCookies;
  • 73. Output Output back to browser my $output = $session->output; Print some content $output->print($content); Don’t process macros as printing: $output->print($content,1); Set the output handle $output->setHandle($someFileHandle);