为什么javascript在我实施ZF2 ACL时停止工作?

时间:2015-08-27 02:51:05

标签: javascript twitter-bootstrap zend-framework2

我在我的Zend Framework 2应用程序中使用Bootstrap。在我实现ACL控件之前,格式看起来很好。现在,按钮格式化的唯一时间是用户的角色是访客时。关于出了什么问题的任何想法?

@Zend Framework2人员:是否需要在ACL列表中包含css和js文件?

config / autoload / acl.global.php中的ACL控件如下所示:

return array(
  'acl' => array(
    'roles' => array(
      'guest'   => null,
      'member'  => 'guest',
      'mentor' => 'member',
      'board' => 'mentor',
      'admin'  => 'board',
    ),
  'resources' => array(
    'allow' => array(
      'Register\Controller\Profile' => array(
        'index' => 'guest',
        'confirm' => 'member',
        'process' => 'guest',
        'edit' => 'member',
        'saveEdit' => 'member',
        'family' => 'member',
        'delete' => 'member',
      ),
      'Register\Controller\Index' => array(
        'index' => 'guest',
        'profile' => 'guest',
        'login' => 'guest',
      ),
      ...and so forth for each controller and action (no other resources are included)

这是页面布局模板,default-layout.phtml显示我使用或引入的唯一javascript:

    <?php echo $this->doctype(); ?>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <?php echo $this->headTitle('TJLA Registration')->setSeparator(' - ')->setAutoEscape(false) ?>

        <?php echo $this->headMeta()
            ->appendName('viewport', 'width=device-width, initial-scale=1.0')
            ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
        ?>

        <!-- Styles -->
        <?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/tjla-tree.png'))
            ->prependStylesheet($this->basePath() . '/css/style.css')
            ->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
            ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css');
         ?>

    </head>
    <body>
            <div class="masthead">
            </div>
            <nav class="navbar navbar-default" role="navigation">
                <div class="container navbar-container">
                    <div class="navbar-header">
                    </div>
                    <div class="collapse navbar-collapse">
                        <?php echo $this->navigation('navigation')->menu()->setUlClass('nav navbar-nav'); ?>
                    </div><!--/.nav-collapse -->
                </div>
            </nav>
            <div class="container">
                <?php echo $this->content; ?>
                <hr>
                <footer>
                    <p>&copy; <?php echo date('Y') ?> by Thomas Jefferson Leadership Academy. All rights reserved.</p>
                </footer>
            </div> <!-- /container -->

            <!-- Scripts -->
            <?php echo $this->inlineScript()
                ->appendFile($this->basePath() . '/js/jquery.min.js')
                ->appendFile($this->basePath() . '/js/bootstrap.min.js')
                ->appendFile($this->basePath() . '/js/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9',))
                ->appendFile($this->basePath() . '/js/html5shiv.js',   'text/javascript', array('conditional' => 'lt IE 9',));
            ?>

            <script>
                $(function () {
                  $('[data-toggle="popover"]').popover()
                })
            </script>
        </body>
    </html>

1 个答案:

答案 0 :(得分:0)

请原谅我浪费你的时间。我发现了这个问题;该页面被先前版本覆盖,并且锚点中缺少正确的类。 (role =&#34; button&#34; class =&#34; btn btn-xs btn-primary&#34;)