public function testSuperUserProductTemplateDefaultControllerActions() { $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); //Default Controller actions requiring some sort of parameter via POST or GET //Load Product Modules Menu. $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/modulesMenu'); //Load AttributesList for ProductTemplate module. $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/attributesList'); //Load ModuleLayoutsList for ProductTemplate module. $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleLayoutsList'); //Now confirm everything did in fact save correctly. $this->assertEquals('Catalog Item', ProductTemplatesModule::getModuleLabelByTypeAndLanguage('Singular')); $this->assertEquals('Catalog Items', ProductTemplatesModule::getModuleLabelByTypeAndLanguage('Plural')); $this->assertEquals('catalog item', ProductTemplatesModule::getModuleLabelByTypeAndLanguage('SingularLowerCase')); $this->assertEquals('catalog items', ProductTemplatesModule::getModuleLabelByTypeAndLanguage('PluralLowerCase')); //Load LayoutEdit for each applicable module and applicable layout $this->resetPostArray(); $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule', 'viewClassName' => 'ProductTemplatesListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule', 'viewClassName' => 'ProductTemplatesModalListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule', 'viewClassName' => 'ProductTemplatesModalSearchView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductTemplatesModule', 'viewClassName' => 'ProductTemplateEditAndDetailsView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); }
/** * @return null or string containing create link */ public function getMenuItems() { $items = array(); if (RightsUtil::doesUserHaveAllowByRightName('ProductTemplatesModule', ProductTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create ProductTemplatesModuleSingularLabel', LabelUtil::getTranslationParamsForAllModules()), 'url' => Yii::app()->createUrl('productTemplates/default/create')); } if (!empty($items)) { return $items; } return null; }
/** * @return null or string containing create link */ public function getMenuItems() { $items = array(); if (RightsUtil::doesUserHaveAllowByRightName('ProductTemplatesModule', ProductTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create Category'), 'url' => Yii::app()->createUrl('productTemplates/category/create')); } if (!empty($items)) { return $items; } return null; }
public function testRegularUserProductPortletAccess() { $benny = $this->logoutCurrentUserLoginNewUserAndGetByUsername('nobody'); $account = AccountTestHelper::createAccountByNameForOwner('superAccount', Yii::app()->user->userModel); $superAccountId = $account->id; $benny->setRight('ProductTemplatesModule', ProductTemplatesModule::getAccessRight(), Right::DENY); $this->assertTrue($benny->save()); $this->assertFalse(RightsUtil::canUserAccessModule('ProductTemplatesModule', $benny)); $portlet = new Portlet(); $portlet->column = 1; $portlet->position = 1; $portlet->layoutId = 'Test'; $portlet->collapsed = true; $portlet->viewType = 'RssReader'; $portlet->user = $benny; $this->assertTrue($portlet->save()); $this->setGetArray(array('uniqueLayoutId' => 'AccountDetailsAndRelationsView_' . $portlet->id, 'portletId' => $portlet->id, 'relationAttributeName' => 'account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'relationModelClassName' => 'Account')); $this->runControllerWithNoExceptionsAndGetContent('productTemplates/default/selectFromRelatedList'); }
/** * @return null or string containing create link */ public function render() { $items = array(); if (RightsUtil::doesUserHaveAllowByRightName('ProductsModule', ProductsModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductsModule', 'Create Product'), 'url' => Yii::app()->createUrl('products/default/create')); } if (RightsUtil::doesUserHaveAllowByRightName('ProductTemplatesModule', ProductTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create Catalog Item'), 'url' => Yii::app()->createUrl('productTemplates/default/create')); $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create Category'), 'url' => Yii::app()->createUrl('productTemplates/category/create')); } if (!empty($items)) { $menuItems = array('label' => $this->getLabel(), 'url' => null, 'items' => $items); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("ActionMenu"); $cClipWidget->widget('application.core.widgets.MbMenu', array('htmlOptions' => array('id' => 'MashableInboxCreateDropdown'), 'items' => array($menuItems))); $cClipWidget->endClip(); return $cClipWidget->getController()->clips['ActionMenu']; } return null; }
/** * Action called in the event that the mass delete quantity is larger than the pageSize. * This action is called after the pageSize quantity has been delted and continues to be * called until the mass delete action is complete. For example, if there are 20 records to delete * and the pageSize is 5, then this action will be called 3 times. The first 5 are updated when * the actionMassDelete is called upon the initial form submission. */ public function actionMassDeleteProgress() { $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize'); $productTemplate = new ProductTemplate(false); $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new ProductTemplatesSearchForm($productTemplate), $pageSize, Yii::app()->user->userModel->id, null, 'ProductTemplatesSearchView'); $this->processMassDeleteProgress('ProductTemplate', $pageSize, ProductTemplatesModule::getModuleLabelByTypeAndLanguage('Plural'), $dataProvider); }
/** * Resolve the alert display in html options * @param array $htmlOptions * @return array */ protected function resolveConfirmAlertInHtmlOptions($htmlOptions) { $htmlOptions['confirm'] = Zurmo::t('Core', 'Are you sure you want to delete this {modelLabel}?', array('{modelLabel}' => ProductTemplatesModule::getModuleLabelByTypeAndLanguage('SingularLowerCase'))); return $htmlOptions; }