Example #1
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_FILES[$this->name])) {
         if (!is_array($_FILES[$this->name]['name'])) {
             throw new Exception("WFBulkUpload expected multiple upload files but only found one.");
         }
         $phpUploadErrors = @array(UPLOAD_ERR_OK => 'Value: 0; There is no error, the file uploaded with success.', UPLOAD_ERR_INI_SIZE => 'Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.', UPLOAD_ERR_FORM_SIZE => 'Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', UPLOAD_ERR_PARTIAL => 'Value: 3; The uploaded file was only partially uploaded.', UPLOAD_ERR_NO_FILE => 'Value: 4; No file was uploaded.', UPLOAD_ERR_NO_TMP_DIR => 'Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.', UPLOAD_ERR_CANT_WRITE => 'Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.', UPLOAD_ERR_EXTENSION => 'Value: 8; File upload stopped by extension. Introduced in PHP 5.2.0.');
         $count = count($_FILES[$this->name]['name']);
         for ($i = 0; $i < $count; $i++) {
             // check for errors
             if ($_FILES[$this->name]['error'][$i] == UPLOAD_ERR_OK) {
                 if (is_uploaded_file($_FILES[$this->name]['tmp_name'][$i])) {
                     $this->uploads[] = new WFUploadedFile_Basic($_FILES[$this->name]['tmp_name'][$i], $_FILES[$this->name]['type'][$i], $_FILES[$this->name]['name'][$i]);
                     $this->hasUpload = true;
                 } else {
                     $this->addError(new WFError("File: '{$_FILES[$this->name]['name'][$i]}' is not a legitimate PHP upload. This is a hack attempt."));
                 }
             } else {
                 if ($_FILES[$this->name]['error'][$i] != UPLOAD_ERR_NO_FILE) {
                     $this->addError(new WFError("File: '{$_FILES[$this->name]['name'][$i]}' reported error: " . $phpUploadErrors[$_FILES[$this->name]['error'][$i]]));
                 }
             }
         }
     }
 }
Example #2
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $myBindings[] = new WFBindingSetup('maxLength', 'The maxLength of the password field (in HTML).');
     $myBindings[] = new WFBindingSetup('size', 'The size of the password field (in HTML).');
     return $myBindings;
 }
Example #3
0
 /**
  * Constructor.
  */
 function __construct($id, $page)
 {
     parent::__construct($id, $page);
     $this->menuItems = array();
     $this->skin = '';
     // check the existence of the www dir and throw and exception if it isn't there as people will need to install it.
     //if (!file_exists($projectRoot . $this->getWidgetWWWDir())) throw( new Exception("You need to install the hmenu files in " . $this->getWidgetWWWDir()) );
 }
Example #4
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $newValBinding = new WFBindingSetup('breadcrumbSetup', 'A WFBreadCrumbSetup object.');
     $newValBinding->setReadOnly(true);
     $myBindings[] = $newValBinding;
     return $myBindings;
 }
Example #5
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $newValBinding = new WFBindingSetup('invocationPath', 'The invocation path of the module to include.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     return $myBindings;
 }
Example #6
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $newValBinding = new WFBindingSetup('value', 'The selected value for non-multiple select boxes.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     return $myBindings;
 }
Example #7
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     // do we need this custom binding setup here? wasn't WFBINDINGTYPE_MULTIPLE_PATTERN moved to WFView?
     $newValBinding = new WFBindingSetup('value', 'The selected value for non-multiple select boxes.', array(WFBinding::OPTION_VALUE_PATTERN => WFBinding::OPTION_VALUE_PATTERN_DEFAULT_PATTERN));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     return $myBindings;
 }
Example #8
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $newValBinding = new WFBindingSetup('value', 'The href value for the link.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('label', 'The label for the link. The label is what the viewer sees as the link text.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('title', 'The title for the link. The title is often rendered as a "tooltip" by browsers.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     return $myBindings;
 }
Example #9
0
 function render($blockContent = NULL)
 {
     if (!$this->paginator instanceof WFPaginator) {
         throw new WFException("No paginator assigned to WFPaginatorState " . $this->id);
     }
     if ($this->paginator->mode() == WFPaginator::MODE_FORM) {
         //$this->importJS(self::yuiPath() . "/yahoo-dom-event/yahoo-dom-event.js", 'YAHOO');
     }
     $html = parent::render($blockContent);
     // When restoring the value, only put back the SORT KEYS and PAGE SIZE; the page num should be RESET.
     $button = '<input type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->paginator->paginatorState() . '" />';
     $js = NULL;
     if ($this->paginator->mode() == WFPaginator::MODE_FORM) {
         // js function to set paginator to go to first page when the MODE_FORM submit button is pressed.
         $paginatorResetJSFunctionName = "__WFPaginatorState_gotoFirstPage_{$this->id}";
         // do not go to first page if the submit button was pressed by paginator MODE_FORM
         $paginatorModeFormSubmissionVarName = $this->paginator->jsPaginatorStateModeFormSubmissionVarName();
         $js = $this->jsStartHTML() . '
         var ' . $paginatorModeFormSubmissionVarName . ' = false;
         function ' . $this->paginator->jsPaginatorStateModeFormGoToStateFunctionName() . '(state)
         {
             ' . $this->paginator->jsPaginatorStateModeFormSubmissionVarName() . ' = true;
             document.getElementById("' . $this->id . '").value = state;
             document.getElementById("' . $this->paginator->submitID() . '").click();
         }
         function ' . $paginatorResetJSFunctionName . '()
         {
             if (' . $paginatorModeFormSubmissionVarName . ' == true) return;
             var submitID = \'' . $this->paginator->submitID() . '\';
             document.getElementById("' . $this->paginator->paginatorStateParameterID() . '").value = "' . $this->paginator->paginatorState(WFPaginator::PAGINATOR_FIRST_PAGE) . '";
         }';
         $loader = WFYAHOO_yuiloader::sharedYuiLoader();
         $loader->yuiRequire('event');
         $callback = 'function() { YAHOO.util.Event.addListener("' . $this->paginator->submitID() . '", "click", ' . $paginatorResetJSFunctionName . '); }';
         $js .= $loader->jsLoaderCode($callback);
         $js .= $this->jsEndHTML();
     }
     return $html . $js . $button;
 }
Example #10
0
 public static function exposedProperties()
 {
     $items = parent::exposedProperties();
     return array_merge($items, array('facetStyle' => array('list', 'menu', 'tree'), 'treeRoot', 'defaultTreePosition', 'attributeID', 'dieselSearchHelper', 'rangeCount', 'fakeOpenEndedRange' => array('list', 'menu', 'tree'), 'showItemCounts', 'maxHits', 'maxRows', 'label', 'sortByFrequency' => array('list', 'menu', 'tree'), 'ellipsisAfterChars', 'width', 'height'));
 }
Example #11
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if ($this->multiple()) {
         if (isset($_REQUEST[$this->name])) {
             $this->setValues($_REQUEST[$this->name]);
         }
     } else {
         if (isset($_REQUEST[$this->name])) {
             $this->setValue($_REQUEST[$this->name]);
         }
     }
 }
Example #12
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_FILES[$this->name])) {
         if (is_array($_FILES[$this->name]['name'])) {
             throw new Exception("WFUpload expected a single upload files but multiple found.");
         }
         // use @ so that pre-php-5.2 users don't see warnings b/c some of these didn't exist
         $phpUploadErrors = @array(UPLOAD_ERR_OK => 'Value: 0; There is no error, the file uploaded with success.', UPLOAD_ERR_INI_SIZE => 'Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.', UPLOAD_ERR_FORM_SIZE => 'Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', UPLOAD_ERR_PARTIAL => 'Value: 3; The uploaded file was only partially uploaded.', UPLOAD_ERR_NO_FILE => 'Value: 4; No file was uploaded.', UPLOAD_ERR_NO_TMP_DIR => 'Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.', UPLOAD_ERR_CANT_WRITE => 'Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.', UPLOAD_ERR_EXTENSION => 'Value: 8; File upload stopped by extension. Introduced in PHP 5.2.0.');
         if ($_FILES[$this->name]['error'] == UPLOAD_ERR_OK) {
             if (is_uploaded_file($_FILES[$this->name]['tmp_name'])) {
                 $this->hasUpload = true;
                 $this->tmpFileName = $_FILES[$this->name]['tmp_name'];
                 $this->originalFileName = $_FILES[$this->name]['name'];
                 $this->mimeType = $_FILES[$this->name]['type'];
             } else {
                 $this->addError(new WFError("File: '{$_FILES[$this->name]['name']}' is not a legitimate PHP upload. This is a hack attempt."));
             }
         } else {
             if ($_FILES[$this->name]['error'] != UPLOAD_ERR_NO_FILE) {
                 $this->addError(new WFError("File: '{$_FILES[$this->name]['name']}' reported error: " . $phpUploadErrors[$_FILES[$this->name]['error']]));
             }
         }
     }
 }
Example #13
0
 /**
  *  To implement our prototype functionality, we need to detect when a child object named "<id>Prototype" has been added.
  *
  *  If a prototype object is detected, we set up the prototype for the WFDynamic.
  *
  *  @param object WFView The object being added.
  */
 function addChild(WFView $view)
 {
     if ($view->id() == "{$this->id}Prototype") {
         $this->setPrototype($view);
     } else {
         // add new view to the "parentView" object
         $parentView = $this->calculateParent();
         if ($parentView) {
             $parentView->addChild($view);
         } else {
             parent::addChild($view);
         }
     }
 }
Example #14
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $myBindings[] = new WFBindingSetup('label', 'The text of the submit button.');
     return $myBindings;
 }
Example #15
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_REQUEST[$this->parent()->name()])) {
         if ($_REQUEST[$this->parent()->name()] == $this->selectedValue()) {
             $this->parent()->setSelectedRadio($this);
         }
     }
 }
Example #16
0
 function addChild(WFView $view)
 {
     parent::addChild($view);
     if ($view instanceof WFSubmit) {
         $this->numberOfSubmitButtons++;
         // if if the FIRST one, save it; otherwise,
         if ($this->calculatedDefaultSubmitID === WFForm::CALCULATED_DEFAULT_SUBMIT_ID_NONE) {
             $this->calculatedDefaultSubmitID = $view->id();
         } else {
             if (!$this->defaultSubmitID) {
                 $this->calculatedDefaultSubmitID = WFForm::CALCULATED_DEFAULT_SUBMIT_ID_CANNOT_DETERMINE;
                 WFLog::log("Form id: '{$this->id}' is unable to determine the default button for the form. You should set one via defaultSubmitID to avoid errors in some browsers.", WFLog::WARN_LOG);
             }
         }
     }
 }
 public static function exposedProperties()
 {
     $items = parent::exposedProperties();
     return array_merge($items, array('paginator', 'maxJumpPagesToShow'));
 }
Example #18
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $myBindings[] = new WFBindingSetup('width', 'The width of the text area (as 100% or 250 for pixels).');
     $myBindings[] = new WFBindingSetup('height', 'The height of the text area (as 100% or 250 for pixels).');
     return $myBindings;
 }
Example #19
0
 function restoreState()
 {
     parent::restoreState();
     WFLog::log("WFCheckboxGroup restoreState()<bR>");
     // restore state of all children
     foreach ($this->children() as $checkbox) {
         $checkbox->restoreState();
     }
     // rebuild our meta-value
     $this->updateGroupValues();
     WFLog::log("WFCheckboxGroup restoreState() done, value now:" . $this->values);
 }
Example #20
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $myBindings[] = new WFBindingSetup('value', 'The value of the checkbox -- this will be either checkedValue or uncheckedValue depending on the checked status.');
     $label = new WFBindingSetup('label', 'The label for the checkbox -- Text to label the checkbox with, or empty.', array(WFBinding::OPTION_VALUE_PATTERN => WFBinding::OPTION_VALUE_PATTERN_DEFAULT_PATTERN));
     $label->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $label->setReadOnly(true);
     $myBindings[] = $label;
     $myBindings[] = new WFBindingSetup('checkedValue', 'The value of the checkbox to use if it is checked.');
     $myBindings[] = new WFBindingSetup('uncheckedValue', 'The value of the checkbox to use if it is not checked.');
     return $myBindings;
 }
Example #21
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $myBindings[] = new WFBindingSetup('rows', 'The # of rows in the text area (in HTML).');
     $myBindings[] = new WFBindingSetup('columns', 'The # of columns in the text area (in HTML).');
     return $myBindings;
 }
Example #22
0
 function restoreState()
 {
     parent::restoreState();
     // restore state of all children
     foreach ($this->children() as $radio) {
         if ($radio instanceof WFDynamic) {
             continue;
         }
         // special sauce to skip the WFDynamic that created the WFRadio's
         $radio->restoreState();
     }
 }
Example #23
0
 /**
  * IMPORTANT: The subclasses should get the base class's html, then add the needed code.
  * All subclasses need a DOM element of the ID of the widget so that the loading bootstrapping works correctly.
  */
 function render($blockContent = NULL)
 {
     if ($this->hidden) {
         return NULL;
     } else {
         // set up basic HTML
         $html = parent::render($blockContent);
         $initJSCode = $this->initJS($blockContent);
         if ($initJSCode) {
             $html .= $this->jsStartHTML() . $this->yuiloader()->jsLoaderCode("function() {\n    // alert('YUI deps loaded callback for \\'{$this->id}\\' widget');\n    PHOCOA.namespace('widgets.{$this->id}.yuiDelegate');\n    // let widget inject JS that depends on YUI libs, and define the init function\n    {$initJSCode}\n\n    YAHOO.util.Event.onContentReady('{$this->initializeWaitsForID}', function() {\n        if (PHOCOA.widgets.{$this->id}.yuiDelegate.widgetWillLoad)\n        {\n            PHOCOA.widgets.{$this->id}.yuiDelegate.widgetWillLoad();\n        }\n        PHOCOA.widgets.{$this->id}.init();\n        if (PHOCOA.widgets.{$this->id}.yuiDelegate.widgetDidLoad)\n        {\n            PHOCOA.widgets.{$this->id}.yuiDelegate.widgetDidLoad(PHOCOA.runtime.getObject('{$this->id}'));\n        }\n    });\n};\n") . $this->jsEndHTML();
         }
     }
     return $html;
 }
Example #24
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $newValBinding = new WFBindingSetup('value', 'The path to the image. Will be concatenated on baseDir.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('dataSrc', 'The path to the image, but loaded into data-src attribute. Will be concatenated on baseDir.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('filesystemPath', 'The path to the image on the filesystem. Will be concatenated on filesystemBasePath.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('baseDir', 'The base path to the image. Blank by default.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $myBindings[] = new WFBindingSetup('filesystemBasePath', 'The base path to the image. Blank by default.');
     $myBindings[] = new WFBindingSetup('width', 'The width in pixels of the image, or blank.');
     $myBindings[] = new WFBindingSetup('height', 'The height in pixels of the image, or blank.');
     $myBindings[] = new WFBindingSetup('alt', 'The alt tag.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding = new WFBindingSetup('link', 'The url that the image should link to.', array(WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME => WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_VALUE));
     $newValBinding->setReadOnly(true);
     $newValBinding->setBindingType(WFBindingSetup::WFBINDINGTYPE_MULTIPLE_PATTERN);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('srcWidth', 'Source image width.');
     $newValBinding->setReadOnly(true);
     $myBindings[] = $newValBinding;
     $newValBinding = new WFBindingSetup('srcHeight', 'Source image height.');
     $newValBinding->setReadOnly(true);
     $myBindings[] = $newValBinding;
     return $myBindings;
 }
Example #25
0
 public static function exposedProperties()
 {
     $items = parent::exposedProperties();
     return array_merge($items, array('dieselSearchHelper', 'facetNavOrder', 'maxFacetsToShow', 'facetNavHeight', 'showLoadingMessage' => array('true', 'false'), 'searchAction'));
 }
Example #26
0
 public static function exposedProperties()
 {
     $items = parent::exposedProperties();
     return array_merge($items, array('defaultTabID', 'onePageMode', 'debugShowAllTabs'));
 }
Example #27
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     return $myBindings;
 }
 function restoreState()
 {
     parent::restoreState();
 }
Example #29
0
 function setupExposedBindings()
 {
     $myBindings = parent::setupExposedBindings();
     $myBindings[] = new WFBindingSetup('value', 'The value of the hidden field.');
     return $myBindings;
 }