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

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

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