Dotclear

Changeset 2784


Ignore:
Timestamp:
12/08/10 18:46:53 (13 years ago)
Author:
Oaz
Message:

Added forms in admin area

Location:
plugins/myForms/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plugins/myForms/trunk/TplCore.php

    r2208 r2784  
    8787  public static function OnInit($attr,$content) 
    8888  { 
    89     return 
     89    $functions = 
    9090    self::DefineFunction('Declare', 
    9191      "<?php\n" 
     
    103103    ."\n" 
    104104    .self::DefineFunction('Display',"<form action='<?php print \$core->blog->url; ?>form' method='post' enctype='multipart/form-data'><input type='hidden' name='myforms[formID]' value='".MyForms::$formID."' />".$content."</form>"); 
     105          //print $functions;exit; 
     106          return $functions; 
    105107  } 
    106108   
  • plugins/myForms/trunk/_public.php

    r2216 r2784  
    6262  { 
    6363    self::$formID = $args; 
    64     self::form(); 
     64    self::publicForm(); 
    6565  } 
    6666   
     
    6969    global $_REQUEST; 
    7070    self::$formID = @$_REQUEST["myforms"]["formID"]; 
    71     self::form(); 
    72   } 
    73    
    74   public static function form() 
    75   { 
    76     global $core, $_REQUEST, $_ctx; 
    77      
    78     // add all 'default-templates' folders to form search path 
     71    self::publicForm(); 
     72  } 
     73   
     74  public static function AddAllDefaultTemplatesFoldersToFormSeachPath() 
     75  { 
     76    global $core; 
    7977    $tplPath = $core->tpl->getPath(); 
    8078          $plugins = $core->plugins->getModules(); 
     
    8280               array_push($tplPath, $plugin['root'].'/default-templates'); 
    8381    $core->tpl->setPath($tplPath); 
    84  
    85     self::$passwordProtected = false; 
    86      
    87     self::loadForm(); 
    88      
    89     if(self::$passwordProtected) { 
    90       $_ctx->posts = new PostSimu(); 
    91                self::serveDocument('password-form.html','text/html',false); 
    92                return; 
    93           } 
    94      
    95     // process  form post 
     82  } 
     83   
     84  public static function ProcessFormPost() 
     85  { 
     86    global $_REQUEST; 
    9687    if( isset($_REQUEST["myforms"]) && self::$captchaIsValidated && self::$formIsValid ) { 
    9788      self::$nextFormID = false; 
     
    10697      } 
    10798    } 
    108      
    109     // display current form page 
     99  } 
     100   
     101  public static function publicForm() 
     102  { 
     103    global $_ctx; 
     104     
     105    self::AddAllDefaultTemplatesFoldersToFormSeachPath(); 
     106 
     107    self::$passwordProtected = false; 
     108     
     109    self::loadForm(); 
     110     
     111    if(self::$passwordProtected) { 
     112      $_ctx->posts = new PostSimu(); 
     113               self::serveDocument('password-form.html','text/html',false); 
     114               return; 
     115          } 
     116     
     117    self::ProcessFormPost(); 
    110118    self::serveDocument('myforms.html'); 
     119  } 
     120   
     121  public static function adminForm() 
     122  { 
     123    self::AddAllDefaultTemplatesFoldersToFormSeachPath(); 
     124    self::loadForm(); 
     125    self::ProcessFormPost(); 
     126          print '<html><body>'.self::$htmlOut.'</body></html>'; 
    111127  } 
    112128   
     
    131147    //if($afterGoto) {print $core->tpl->getData($formTpl); exit;} 
    132148    $core->tpl->getData($formTpl); 
    133      
    134     // form is password protected 
     149 
     150          // form is password protected 
    135151    if(self::$passwordProtected) { 
    136152            // Get passwords cookie 
     
    153169               } 
    154170    } 
    155      
     171 
    156172    // field declaration 
    157173    ob_start(); 
  • plugins/myForms/trunk/index.php

    r2108 r2784  
    1818# 
    1919# ***** END LICENSE BLOCK ***** 
     20 
     21//print_r($_SERVER);exit; 
     22//print_r($_REQUEST);exit; 
     23//print_r($core);exit; 
     24 
    2025if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    2126 
    2227dcPage::check('usage,contentadmin'); 
     28 
     29if( isset($_REQUEST['form']) ) { 
     30     //print_r($GLOBALS);exit; 
     31     $core->tpl = new template(DC_TPL_CACHE,'$core->tpl'); 
     32     //$core->tpl->use_cache = false; 
     33     //$core->tpl = new dcTemplate(DC_TPL_CACHE,'$core->tpl',$core); 
     34     require_once(dirname(__FILE__).'/_public.php'); 
     35     MyForms::$formID = $_REQUEST['form']; 
     36     MyForms::adminForm(); 
     37} else { 
    2338 
    2439# Use theme editor 
     
    98113  $core->error->add($e->getMessage()); 
    99114} 
     115 
     116} 
    100117?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map