File: awfDialog/examples/GradientBuilder/steps.php

Recommend this page to a friend!
  Classes of AW Ford  >  awfDialog Wizard  >  awfDialog/examples/GradientBuilder/steps.php  >  Download  
File: awfDialog/examples/GradientBuilder/steps.php
Role: Example script
Content type: text/plain
Description: server-side ajax callback for this example
Class: awfDialog Wizard
Generate wizard-like Web user interface using AJAX
Author: By
Last change: v 1.2 update
Date: 12 years ago
Size: 6,540 bytes
 

Contents

Class file image Download
<?php
   
//Version 1.2 (final)
   
include("../../lib/awfDialog.php");
   
  
$wizstep=$_GET['step'];
  
$hex1=$_GET['Hex1'];
  
$hex2=$_GET['Hex2'];
  
$width=$_GET['Width'];
  
$height=$_GET['Height'];
  
$nextstep=$wizstep;
  
$nextstep++;
  
$prevstep=$wizstep;
  
$prevstep--;
  
$img='';
  
$disclaim="";
  
$str1='';
  
$strHelp='';
  
   switch(
$wizstep){
    case
1:
     
$str1="<b>Click the button to initialize a color picker, or type in a Hexidecimal color code to use for the top color of your vertical gradient:</b><br><br>";
     
$strHelp="<b>What is a hexacedimal color code?</b> Hex codes are specially designed, 6-character codes that can be interpretted to any one of millions of colors.<br><br>You don't have to memorize millions of hex codes in order to use them. Click the color-picker button below, then on the text box, and you'll be able to dynamically explore hexadecimal color codes for yourself. <br><br>You can learn more about hex colors at <A href='http://www.w3schools.com/html/html_colors.asp'>W3Schools</a>.";
     
$title="Step 1: Top Color";
     
$icon = ICON_WIZARD;
     
$hideHex1 = false;
     
$hideHex2 = true;
     
$hideSize = true;
     
$prev = false;
     
$cancel = false;
     
$next = true;
      break;
    case
2:
     
$str1="<b>Click the button to initialize a color picker, or type in a Hexidecimal color code to use for the bottom color of your vertical gradient:</b><br><br>";
     
$strHelp="<b>What is a hexacedimal color code?</b> Hex codes are specially designed, 6-character codes that can be interpretted to any one of millions of colors.<br><br>You don't have to memorize millions of hex codes in order to use them. Click the color-picker button below, then on the text box, and you'll be able to dynamically explore hexadecimal color codes for yourself. <br><br>You can learn more about hex colors at <A href='http://www.w3schools.com/html/html_colors.asp'>W3Schools</a>.";
     
$title="Step 2: Bottom Color";
     
$icon = ICON_WIZARD;
     
$hideHex1 = true;
     
$hideHex2 = false;
     
$hideSize = true;
     
$prev = true;
     
$cancel = false;
     
$next = true;
      break;
    case
3:
     
$str1="<b>Set the width and height values to use for the image. Note, maximum size for this demo is 100x100:</b><br><br>";
     
$title="Step 3: Dimensions";
     
$icon = ICON_WIZARD;
     
$hideHex1 = true;
     
$hideHex2 = true;
     
$hideSize = false;
     
$prev = true;
     
$cancel = false;
     
$next = true;
      break;
    case
4:
     
$str1="<b>The settings below will be used to generate your image. If they are correct, click the Next button to see the results, else go Back to modify parameters as needed:</b><br><br>";
     
$title="Step 4: Confirm Settings";
     
$icon = ICON_WIZARD;
     
$hideHex1 = true;
     
$hideHex2 = true;
     
$hideSize = true;
     
$prev = true;
     
$cancel = false;
     
$next = true;
      break;
    case
5:
     
$str1="<b>Alakhazam-Viola!!!<br><br>Below is the image you built using this wizard. Right-click and save it using any filename you like.</b><br><br>";
     
$title="Wizard Complete!";
     
$icon = ICON_DOWNLOAD;
     
$hideHex1 = true;
     
$hideHex2 = true;
     
$hideSize = true;
     
$prev = true;
     
$cancel = false;
     
$next = false;
     
$img="../../lib/image2.php";
     
$img=$img."?from=".$hex1;
     
$img=$img."&to=".$hex2;
     
$img=$img."&w=".$width;
     
$img=$img."&h=".$height;
     
$disclaim="<small>Note: if you are not seeing changes you made to the above image you probably need to clear your browser cache, especially if you did NOT change image dimensions.</small>";
      break;
    default:
     
$str1="<b>Click the button to initialize a color picker, or type in a Hexidecimal color code to use for the top color of your vertical gradient:</b><br>".$wizstep."<br>";
     
$title="Step 1: Top Color";
     
$icon = ICON_WIZARD;
     
$hideHex1 = false;
     
$hideHex2 = true;
     
$hideSize = true;
     
$prev = false;
     
$cancel = false;
     
$next = true;
      break;
   }
     
   
$m1 = new awfDialog('D1',$title,$str1, $icon,false,575);
   
$m1->SetVAlign(BODY_MIDDLE);
   
$m1->SetHAlign(BODY_CENTER);
   
$m1->SetIconSize(ICON_SIZE_LG);
   
$m1->SetGradient('224e15','c3f60a');
   
$m1->SetImagePath("../../lib/images/");
   
$m1->SetImagePHPURL('../../lib/image2.php');
   
$m1->SetWizMode(true);
   
$m1->EnableWizImage();
   
$m1->SetBodyBGColor('#efffca');
    if (
strlen($strHelp)>0){
       
$m1->UseHelp(true);
       
$m1->AddHelp($strHelp);
       
$m1->SetCSS("HelpPane", "padding:5px;background:url(\"../../lib/image2.php?from=E0F7FF&to=FFFFFF&w=400&h=200&d=true\");border-bottom:3px double #295D73;text-align:left;margin-bottom:5px;");
       
$m1->SetCSS("HelpPane a", "color:#5D7321;");
    }
   
$m1->SetCSS("WizButtons", "margin:10px;");
   
$m1->SetCSS("WizardPane", "background:#000");
   
$m1->SetCSS("BodyPane", "padding:3px 5px;");
   
   
   
//If the gradient image output string has been properly set up add the results to the dialog output
   
if (strlen($img)>0) {
     
$m1->AddOutput("<img src='".$img."'><br>");
    } else {
      if (
strlen($hex1)>0) $m1->AddOutput("<div style='width:".$width.";background:#".$hex1."'>#".$hex1."</div>");
      if (
strlen($hex2)>0) $m1->AddOutput("<div style='width:".$width.";background:#".$hex2."'>#".$hex2."</div><br>");
      if (
strlen($width)>0) $m1->AddOutput("Size: ".$width." x ".$height."<br>");
    }
   
    if (
$hideHex1) {
     
$m1->AddOutput("<input type='hidden' id='Hex1' value='".$hex1."'>\n");
    } else{
     
$m1->AddOutput("#<input type='text' id='Hex1' value='".$hex1."' class='color'><img src='".$m1->dImagePath."wizColorPicker.gif' style='cursor:pointer;' onClick=\"jscolor_init()\" align=bottom>\n");
    }
    if (
$hideHex2) {
     
$m1->AddOutput("<input type='hidden' id='Hex2' value='".$hex2."'>\n");
    } else {
     
$m1->AddOutput("#<input type='text' id='Hex2' value='".$hex2."' class='color'><img src='".$m1->dImagePath."wizColorPicker.gif' style='cursor:pointer;' onClick=\"jscolor_init()\" align=bottom>\n");
    }
    if (
$hideSize){
     
$m1->AddOutput("<input type='hidden' id='Width' value='".$width."'>\n");
     
$m1->AddOutput("<input type='hidden' id='Height' value='".$height."'>\n");
    } else {
     
$m1->AddOutput("<input type='text' size=4 id='Width' value='".$width."'> x \n");
     
$m1->AddOutput("<input type='text' size=4 id='Height' value='".$height."'>\n");
    }
   
$m1->AddOutput($disclaim."\n");
    if (
$prev) $m1->SetAjaxPrev("doStep(".$prevstep.")");
    if (
$cancel) $m1->SetAjaxCancel("doCancel()");
    if (
$next) $m1->SetAjaxNext("doStep(".$nextstep.")");
   
   
$m1->Render();
   
?>


For more information send a message to info at phpclasses dot org.