public function testNodeConfig()
 {
     $user = '******';
     $c = Kwf_Component_Data_Root::getInstance();
     $cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
     $this->assertFalse($cfg['actions']['add']);
     $this->assertFalse($cfg['allowDrop']);
     $this->assertFalse($cfg['actions']['delete']);
     $this->assertFalse($cfg['actions']['makeHome']);
     $this->assertFalse($cfg['allowDrag']);
     $c = Kwf_Component_Data_Root::getInstance()->getComponentById('root-main');
     $cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
     $this->assertFalse($cfg['actions']['delete']);
     $this->assertFalse($cfg['actions']['makeHome']);
     $this->assertTrue($cfg['actions']['add']);
     $this->assertTrue($cfg['allowDrop']);
     $this->assertFalse($cfg['allowDrag']);
     $c = Kwf_Component_Data_Root::getInstance()->getComponentById('1');
     $cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
     $this->assertTrue($cfg['actions']['delete']);
     $this->assertTrue($cfg['actions']['makeHome']);
     $this->assertTrue($cfg['actions']['add']);
     $this->assertTrue($cfg['allowDrop']);
     $this->assertTrue($cfg['allowDrag']);
     $c = Kwf_Component_Data_Root::getInstance()->getComponentById('3');
     $cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
     $this->assertTrue($cfg['actions']['delete']);
     $this->assertTrue($cfg['actions']['makeHome']);
     $this->assertTrue($cfg['actions']['add']);
     $this->assertTrue($cfg['allowDrop']);
     $this->assertTrue($cfg['allowDrag']);
 }
 public function load($row, array $info = array())
 {
     $gen = Kwf_Component_Generator_Abstract::getInstance($this->_componentClass, $this->_generatorKey);
     $edit = Kwf_Component_Abstract_ExtConfig_Abstract::getEditConfigs($this->_getComponentClassByRow($row), $gen, '{componentId}-{0}', '');
     $this->_componentConfigs = array_merge($this->_componentConfigs, $edit['componentConfigs']);
     $ret = $edit['contentEditComponents'];
     $g = Kwc_Abstract::getSetting($this->_componentClass, 'generators');
     if (isset($g['detail']['dbIdShortcut'])) {
         $dbId = $g['detail']['dbIdShortcut'] . $row->id;
     } else {
         $dbId = $row->component_id . $gen->getIdSeparator() . $row->id;
     }
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($dbId, array('ignoreVisible' => true));
     if (isset($components[0])) {
         foreach (Kwf_Controller_Action_Component_PagesController::getSharedComponents($components[0]) as $cls => $cmp) {
             $cfg = Kwc_Admin::getInstance($cls)->getExtConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_SHARED);
             foreach ($cfg as $k => $c) {
                 if (!isset($this->_componentConfigs[$cls . '-' . $k])) {
                     $this->_componentConfigs[$cls . '-' . $k] = $c;
                 }
                 $ret[] = array('componentClass' => $cls, 'type' => $k, 'idTemplate' => '{componentId}-{0}', 'componentIdSuffix' => '');
             }
         }
     }
     return $ret;
 }
Beispiel #3
0
 public function testIt()
 {
     $root = $this->_root;
     $component = $root->getComponentById('root_2-shared');
     $sharedComponents = Kwf_Controller_Action_Component_PagesController::getSharedComponents($root);
     $expected = array($component->componentClass => $root);
     $this->assertEquals($expected, $sharedComponents);
     $row = $component->getComponent()->getRow();
     $this->assertEquals('root', $row->component_id);
     $this->assertEquals('foo', $row->text);
 }
Beispiel #4
0
 public function testSpecialWithoutEditIsHidden()
 {
     $user = '******';
     $c = Kwf_Component_Data_Root::getInstance()->getComponentById('6');
     $cfg = Kwf_Controller_Action_Component_PagesController::getNodeConfig($c, $user, $this->_acl);
     $this->assertNull($cfg);
     $c = Kwf_Component_Data_Root::getInstance()->getComponentById('7');
     $cfg = Kwf_Controller_Action_Component_PagesController::getNodeConfig($c, $user, $this->_acl);
     $this->assertNull($cfg);
 }