public function data() { return WFJSON::json_encode($this->data); }
function initJS($blockContent) { // determine body html $bodyHTML = $blockContent === NULL ? $this->body : $blockContent; // calcualte effects $effects = array(); foreach ($this->effects as $name => $duration) { $effects[] = "{ effect: {$name}, duration: {$duration} }"; } $addEffectsJS = NULL; if (count($effects)) { $addEffectsJS = '[ ' . join(', ', $effects) . ' ]'; } $script = "\nPHOCOA.namespace('widgets.{$this->id}.Module');\nPHOCOA.widgets.{$this->id}.Module.queueProps = function(o) {\n // alert('id={$this->id}: queue Module props');\n // queue Module props here\n};\nPHOCOA.widgets.{$this->id}.Module.init = function() {\n var module = new YAHOO.widget.{$this->containerClass}(\"{$this->id}\");\n module.subscribe('changeBody', function(el) { PHOCOA.widgets.{$this->id}.scriptsEvald = false; } );\n module.showEvent.subscribe(function(el) {\n if (!PHOCOA.widgets.{$this->id}.scriptsEvald)\n {\n PHOCOA.widgets.{$this->id}.scriptsEvald = true;\n this.body.innerHTML.evalScripts();\n }\n }, module);\n module.cfg.queueProperty('visible', " . ($this->visible ? 'true' : 'false') . ");\n module.cfg.queueProperty('monitorresize', " . ($this->monitorresize ? 'true' : 'false') . ");\n PHOCOA.widgets.{$this->id}.{$this->containerClass}.queueProps(module);"; if ($this->buildModuleProgrammatically) { // renderTo is required for buildModuleProgrammatically. should default to document.body if user doesn't specify something more specific $renderTo = $this->renderTo ? $this->renderTo : 'document.body'; $script .= "\n module.setHeader(" . ($this->header === NULL ? '""' : WFJSON::json_encode($this->header)) . ");\n module.setBody(" . ($bodyHTML === NULL ? '""' : WFJSON::json_encode($bodyHTML)) . ");\n module.setFooter(" . ($this->footer === NULL ? '""' : WFJSON::json_encode($this->footer)) . ");\n module.render({$renderTo});\n"; } else { $script .= "\n module.render();\n"; } $script .= ($addEffectsJS ? "\n module.cfg.setProperty('effect', {$addEffectsJS});" : NULL) . (get_class($this) != 'WFYAHOO_widget_Module' ? "\n YAHOO.util.Dom.setStyle('{$this->id}', 'display', 'block')" : NULL) . "\n PHOCOA.runtime.addObject(module, '{$this->id}');\n};\n"; if (get_class($this) == 'WFYAHOO_widget_Module') { $script .= "PHOCOA.widgets.{$this->id}.init = function() { PHOCOA.widgets.{$this->id}.Module.init(); };"; } return $script; }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } // get there reference to the named item // set the name / value // render $html = '<input type="' . ($this->imagePath ? 'image' : 'submit') . '"' . ($this->imagePath ? ' src="' . $this->imagePath . '"' : '') . ($this->class ? ' class="' . $this->class . '"' : '') . ' id="' . $this->id() . '"' . ' name="action|' . $this->id() . '"' . ' value="' . $this->label() . '"' . $this->getJSActions() . "/>\n" . $this->jsStartHTML(); if ($this->duplicateSubmitMessage or $this->postSubmitLabel) { $duplicateSubmitMessage = $this->duplicateSubmitMessage ? $this->duplicateSubmitMessage : ''; $postSubmitLabel = $this->postSubmitLabel ? $this->postSubmitLabel : ''; $html .= "\n PHOCOA.namespace('widgets.{$this->id}');\n PHOCOA.widgets.{$this->id}.isSubmitted = false;\n // define the handleEvent function before the WFAction initializes; it needs it to be defined.\n PHOCOA.namespace('widgets.{$this->id}.events.click');\n PHOCOA.widgets['{$this->id}'].events['click'].handleEvent = function(e) {\n var duplicateSubmitMessage = " . WFJSON::json_encode($duplicateSubmitMessage) . ";\n var postSubmitLabel = " . WFJSON::json_encode($postSubmitLabel) . ";\n if (PHOCOA.widgets.{$this->id}.isSubmitted && duplicateSubmitMessage)\n {\n alert(duplicateSubmitMessage);\n e.stop();\n return false;\n }\n if (postSubmitLabel)\n {\n \$('{$this->id}').setValue(postSubmitLabel);\n }\n PHOCOA.widgets.{$this->id}.isSubmitted = true;\n };\n "; } $html .= $this->getListenerJS() . $this->jsEndHTML(); return $html; }
public function data() { return "/*-secure-\n" . WFJSON::json_encode($this->data) . "\n*/"; }