public function testDeclarativeUseShouldCreateTextareaWithSimpleTextareaDojoType() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(true); $html = $this->helper->simpleTextarea('foo', 'seeded text'); $this->assertContains('id="foo"', $html); $this->assertContains('<textarea', $html); $this->assertContains('dojoType="dijit.form.SimpleTextarea"', $html); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Zend_Registry::_unsetInstance(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view = $this->getView(); $this->helper = new Zend_Dojo_View_Helper_FilteringSelect(); $this->helper->setView($this->view); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Zend_Registry::_unsetInstance(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view = $this->getView(); $this->helper = new Zend_Dojo_View_Helper_AccordionContainer(); $this->helper->setView($this->view); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Zend_Registry::_unsetInstance(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view = $this->getView(); $this->element = $this->getElement(); $this->element->setView($this->view); }
public function changepasswordAction() { Zend_Layout::getMvcInstance()->disableLayout(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $form = new Application_Form_ChangePasswordForm(); $form->change->setAttrib('onclick', 'changePassword();'); $this->view->changePasswordForm = $form; }
public function testDeclarativeUseShouldRenderTextareaWithSimpleTextareaDojoType() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(true); $html = $this->element->render(); $this->assertContains('id="foo"', $html); $this->assertContains('<textarea', $html); $this->assertContains('dojoType="dijit.form.SimpleTextarea"', $html); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Zend_Registry::_unsetInstance(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view = $this->getView(); $this->helper = new Zend_Dojo_View_Helper_ValidationTextBox(); $this->helper->setView($this->view); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Zend_Registry::_unsetInstance(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view = $this->getView(); $this->decorator = new Zend_Dojo_Form_Decorator_SplitContainer(); $this->element = $this->getElement(); $this->element->setView($this->view); $this->decorator->setElement($this->element); }
/** * Pre-Dispatch: set up dojo and context switching * * @return void */ public function preDispatch() { $request = $this->getRequest(); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $contextSwitch = $this->_helper->contextSwitch; if (!$contextSwitch->hasContext('ajax')) { $contextSwitch->addContext('ajax', array('suffix' => 'ajax'))->addActionContext('new', 'ajax')->addActionContext('followup', 'ajax')->addActionContext('display', 'ajax')->addActionContext('active', 'ajax')->addActionContext('active-data', 'ajax')->addActionContext('active-data-count', 'ajax')->initContext(); } $message = array('Current request information', array(array('Module', 'Controller', 'Action'), array($request->getModuleName(), $request->getControllerName(), $request->getActionName()))); Zend_Registry::get('log')->table($message); }
public function init() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); $session = $this->getRequest()->getCookie('sessionid'); $this->lib = new MetaNAS_Lib_MiniDLNA(); /* * We need to make sure the user viewing this is logged in the MetaNAS GUI * Pass the sessionid via JSON-RPC and make sure it has access */ $this->lib->isAuthorized($session); }
public function init() { $this->view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $layout = $this->_helper->layout; $root = realpath(dirname(__FILE__) . '/../../../'); $layout->setLayoutPath(ZUPAL_LAYOUT_PATH); $layout->setLayout('default'); $this->view->placeholder('base_path')->set($this->getFrontController()->getBaseUrl()); // note -- deprecated, using ZUPAL_BASEURL constant. // $this->view->dojo() // ->setLocalPath(ZUPAL_BASEURL . DS . 'scripts/Dojo/dojo/dojo.js') //->requireModule('dijit.form.Form') // ->setDjConfigOption('dojoBlankHtmUrl', '/blank.html'); }
/** * dispatchLoopStartup * * @param Zend_Controller_Request_Abstract $oRequest * @return void */ public function dispatchLoopStartup(Zend_Controller_Request_Abstract $oRequest) { // Hack DOJO Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $contextSwitch = Zend_Controller_Action_HelperBroker::getStaticHelper('ContextSwitch'); $contextParam = $contextSwitch->getContextParam(); $format = $oRequest->getParam($contextParam); // Inject javascript vars if (!$format or $format == "html" or $format == "html-json" or $format == "html-xml") { $this->_view->dojo()->setDjConfigOption('ZlBaseUrl', $this->_view->baseUrl()); $this->_view->dojo()->setDjConfigOption('ZlBaseThemeUrl', $this->_view->baseThemeUrl()); $this->_view->dojo()->setDjConfigOption('ZlModule', $oRequest->getModuleName()); $this->_view->dojo()->setDjConfigOption('ZlController', $oRequest->getControllerName()); $this->_view->dojo()->setDjConfigOption('ZlAction', $oRequest->getActionName()); } }
public static function getForm() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $form = new Zend_Form(); $form->setDecorators(array(array('ViewScript', array('viewScript' => 'editor/changesForm.phtml')))); $zdate = new Zend_Date(); $e = new Zend_Dojo_Form_Element_DateTextBox('fromDate', array('label' => 'From', 'required' => true)); $e->setAttrib('onchange', 'admin.currentManObj.refresh()'); $form->addElement($e); $e = new Zend_Dojo_Form_Element_DateTextBox('toDate', array('label' => 'To', 'required' => true)); $e->setAttrib('onchange', 'admin.currentManObj.refresh()'); $form->addElement($e); // $e = new Zend_Dojo_Form_Element_Button( 'refresh', array ('label' => 'Refresh' ) ); // $e->setAttrib('onchange', 'admin.currentManObj.refresh()'); // $form->addElement($e); Zend_Dojo::enableForm($form); $form->setDefaults(array('toDate' => $zdate->getIso(), 'fromDate' => $zdate->getIso())); return $form; }
public function editAction() { $request = $this->getRequest(); $id = $request->getParam('NODEID', -1); $ntid = $request->getParam('NODETYPEID'); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->view->addHelperPath('Uman/Dojo/View/Helper/', 'Uman_Dojo_View_Helper'); $form = new Uman_Admin_Form(); $form->setName('nodeEditorForm'); $form->setAttrib('jsId', 'nodeEditorForm'); $form->setAction('/admin/editor/save'); $form->setMethod('post'); $form->setEnctype('multipart/form-data'); $dbModel = new Admin_Model_Admin(); $nodeeditorInfo = $dbModel->getNodeEditorInfo($ntid); $fields = $dbModel->getEditorFields($nodeeditorInfo['DEFAULT_EDITOR_NODEID']); $parentidExists = false; $nodetypeidExists = false; $js_oncreate = ''; $js_beforesubmit = ''; foreach ($fields as $field) { if (!$field['VISIBLE']) { continue; } if ($field['FIELDNAME'] == 'PARENTID') { $parentidExists = true; } else { if ($field['FIELDNAME'] == 'NODETYPEID') { $nodetypeidExists = true; } } $class = $field['ELEMENT_CLASS']; $e = new $class($field['FIELDNAME']); // $e->setName($fieldName); if (!empty($field['ELEMENT_CONFIG'])) { /* * In php.ini must be: * allow_url_include = on; * allow_url_fopen = on; */ $elem_cfg = new Zend_Config_Ini('data://,' . $field['ELEMENT_CONFIG']); $elem_cfg = $elem_cfg->toArray(); $e->setOptions($elem_cfg); } $e->setLabel($field['TITLE']); // if (@$field['REQUIRED']) $e->setRequired($field['REQUIRED']); switch ($class) { case 'Zend_Form_Element_Hidden': $decor = array('ViewHelper'); break; case 'Zend_Form_Element_File': // $e->setMaxFileSize(1024); $decor = $form->elementFileDecorators; break; default: $decor = $form->elementDecorators; } $e->setDecorators($decor); $form->addElement($e); $js_oncreate .= isset($field['JS_ONCREATE']) ? $field['JS_ONCREATE'] . "\n" : ''; $js_beforesubmit .= isset($field['JS_BEFORESUBMIT']) ? $field['JS_BEFORESUBMIT'] . "\n" : ''; } $e = new Zend_Dojo_Form_Element_SubmitButton('save', array('label' => 'Сохранить')); $e->setDecorators($form->buttonDecorators); $form->addElement($e); /* $e = new Zend_Dojo_Form_Element_Button('cancel', array('label' => 'Отмена', 'onClick' => "dijit.byId('editorDialog').onCancel()")); $e->setDecorators($form->buttonDecorators); $form->addElement($e);*/ $form->addElements(array($form->createElement('hidden', 'NODEID')->setDecorators(array('ViewHelper')), $form->createElement('hidden', 'MODE')->setDecorators(array('ViewHelper')))); if (!$nodetypeidExists) { $form->addElement($form->createElement('hidden', 'NODETYPEID')->setDecorators(array('ViewHelper'))); } if (!$parentidExists) { $form->addElement($form->createElement('hidden', 'PARENTID')->setDecorators(array('ViewHelper'))); } if ($request->isPost()) { $res = $form->processAjax($request->getPost()); if ($res != 'true') { echo $res; exit; } else { // if($form->isValid ( $request->getPost () )) { $dbModel->saveFieldsValues($fields, $request->getPost(), $nodeeditorInfo); // $dbModel->copyResources ( $id, false ); echo $res; // "<textarea>$res</textarea"; //OK for AJAX request exit; } } else { if ($id == -1) { // New page $pid = $request->getParam('PARENTID'); $dbModel->checkRight($pid); $id = $dbModel->getNextId('GEN_TEMP_UID'); $values = array_merge($dbModel->getNewValues($fields, $nodeeditorInfo), array('NODEID' => $id, 'PARENTID' => $pid, 'NODETYPEID' => $ntid, 'MODE' => 'ADD', 'SORTORDER' => $dbModel->getNextSortOrder($pid))); // mkdir($this->_cfg['temp']['path'] . $id); } else { $dbModel->checkRight($id); $values = array_merge($dbModel->getFieldsValues($fields, $id, $nodeeditorInfo), array('MODE' => 'EDIT')); $dbModel->copyResources($id, $id, true); } $form->populate($values); $this->view->assign('form', $form); $this->view->assign('title', $nodeeditorInfo['TITLE']); if (!empty($js_oncreate)) { $this->view->assign('js_oncreate', $js_oncreate); $this->view->assign('id', $id); $this->view->assign('baseUrl', $request->getBaseUrl()); } if (!empty($js_beforesubmit)) { $this->view->assign('js_beforesubmit', $js_beforesubmit); } } }
mb_internal_encoding('UTF-8'); function require_func($func, $folder = '') { if (function_exists($func)) { return; } require_once PATH_TO_FUNCS . $folder . '/' . $func . '.php'; } error_reporting(E_ALL | E_STRICT); ini_set('display_startup_errors', 1); ini_set('display_errors', 1); $view = new Zend_View(); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); class AuthModel { //регулярное выражение, описывающее разрешенные строки для имени пользователя (логина) const LOGIN_PARTIAL_REGEX = '^[a-zA-Z0-9_-]{3,32}$'; const LOGIN_PARTIAL2_REGEX = '[a-zA-Z0-9_-]{3,32}'; const LOGIN_REGEX = '/^[a-z0-9_-]{3,32}$/i'; const LOGIN_MAX_LEN = 32; const EMAIL_PARTIAL_REGEX = '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$'; const EMAIL_MAX_LEN = 128; const PWD_MIN_LEN = 6; const PWD_MAX_LEN = 64; const PWD_PARTIAL_REGEX = '^.{6,64}$'; const VAR_FIELD_MAX_LEN = 64; const NAME_MAX_LEN = 48; const ICQNUM_MAX_CHARS = 16;
public function testShouldAllowSpecifyingDeclarativeUsage() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->assertTrue(Zend_Dojo_View_Helper_Dojo::useDeclarative()); }
public function testOnlyIdShouldBeNecessary() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $html = $this->view->form('foo'); $this->assertRegexp('/<form[^>]*(dojoType="dijit.form.Form")/', $html, $html); $this->assertRegexp('/<form[^>]*(id="foo")/', $html, $html); }
/** * Initialize view and layouts * * @param bool $doLayout * @return My_Plugin_Initialize */ public function initView($doLayout = true) { $view = new Zend_View(); $view->addHelperPath('My/View/Helper/', 'My_View_Helper'); $view->addHelperPath(APPLICATION_PATH . '/views/helpers', 'Zend_View_Helper'); $view->addHelperPath(APPLICATION_PATH . '/modules/spindle/views/helpers', 'Spindle_View_Helper'); Zend_Dojo::enableView($view); Zend_Dojo_View_Helper_Dojo::setUseDeclarative(true); $view->baseUrl = rtrim($this->getRequest()->getBaseUrl(), '/'); $view->doctype('XHTML1_STRICT'); $view->headTitle()->setSeparator(' - ')->append('Spindle'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8'); $view->dojo()->setDjConfigOption('isDebug', $this->config->view->dojo->isDebug)->setLocalPath('/js/dojo/dojo.js')->registerModulePath('../spindle', 'spindle')->addStylesheetModule('spindle.themes.spindle')->requireModule('spindle.main')->disable(); Zend_Registry::set('view', $view); if ($doLayout) { $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); $layout = Zend_Layout::startMvc(array('layoutPath' => $this->config->appPath . '/layouts/scripts')); } return $this; }
/** * @group ZF-3962 */ public function testHelperShouldAllowDisablingParseOnLoadWithDeclarativeStyle() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->helper->requireModule('dijit.layout.ContentPane')->setDjConfigOption('parseOnLoad', 'false')->enable(); $html = $this->helper->__toString(); if (!preg_match('/(var djConfig = .*?(?:};))/s', $html, $matches)) { $this->fail('Failed to find djConfig settings: ' . $html); } $this->assertNotContains('"parseOnLoad":true', $matches[1]); }