Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

json - Zend_Navigation, Zend_ACL + Roles not filtering correctly through an Ajax request -


i have been using zend_acl , zend_navigation on project , seems work correctly. how ever using lot of ajax in site , have made login jqmodal , jquery logs in users without reloading current page , have need reload navigation well. have far got working navigation being return links visible field true incorrect. example when logged in user login link should not visible.

any appreciated. code below action, javascript function , json returned.

======================================================= current role = admins

// controller action

public function getnavigationjsonaction() { //$view->navigation($container)->setacl($this->_acl)->setrole(zend_registry::get('role')); // echo $this->navigation()->menu(); $navigation = $this->getview()->navigation()->setacl($this->_acl)->setrole(zend_registry::get('role')); //die(zend_registry::get('role')); //die($this->_acl); $this->_helper->json($navigation->toarray()); }

// javascript function

function reloadnavigationmenu() { //alert('reloading navigation'); $.ajax( { url : "/default/ajax/getnavigationjson", type : "post", cache : false, async : false, data : "format=json", success : function(data) { var html=''; console.log(data);

$.each(data, function(i) { if(data[i].visible === true) { //console.log(data[i]); html+='

  • '; html+=''+data[i].label+''; html+='
  • '; } }); html+=''; $('#zend_navigation_container').html(html); } });

    }

    // return json data controller

    [ { "action" : "index", "active" : false, "class" : null, "controller" : "admin", "id" : null, "label" : "admin section", "module" : "admin", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "index", "rel" : [ ], "reset_params" : true, "resource" : "admin:admin", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "index", "active" : false, "class" : null, "controller" : "index", "id" : null, "label" : "home", "module" : "default", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : null, "rel" : [ ], "reset_params" : true, "resource" : null, "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "index", "active" : false, "class" : null, "controller" : "index", "id" : null, "label" : "news", "module" : "news", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "index", "rel" : [ ], "reset_params" : true, "resource" : "news:index", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "index", "active" : false, "class" : null, "controller" : "index", "id" : null, "label" : "tutorials", "module" : "tutorials", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "index", "rel" : [ ], "reset_params" : true, "resource" : "tutorials:index", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "about", "active" : false, "class" : null, "controller" : "index", "id" : null, "label" : "about", "module" : "default", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "about", "rel" : [ ], "reset_params" : true, "resource" : "default:index", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "comments", "active" : false, "class" : null, "controller" : "index", "id" : null, "label" : "comments", "module" : "default", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "comments", "rel" : [ ], "reset_params" : true, "resource" : "default:index", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "index", "active" : false, "class" : null, "controller" : "contact", "id" : null, "label" : "contact", "module" : "default", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "index", "rel" : [ ], "reset_params" : true, "resource" : "default:contact", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "login", "active" : false, "class" : null, "controller" : "auth", "id" : null, "label" : "login", "module" : "default", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "login", "rel" : [ ], "reset_params" : true, "resource" : "default:auth", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true }, { "action" : "logout", "active" : false, "class" : null, "controller" : "auth", "id" : null, "label" : "logout", "module" : "default", "order" : null, "pages" : [ ], "params" : [ ], "privilege" : "logout", "rel" : [ ], "reset_params" : true, "resource" : "default:auth", "rev" : [ ], "route" : null, "target" : null, "title" : null, "type" : "zend_navigation_page_mvc", "visible" : true } ]

    this when logged in admin , links login should hidden not. looks acl not being assigned navigation.

    i think zend_navigation uses acl determine if page should visible during render time. doesn't alter navigation objects when pass acl object it.

    you need different approach if want create custom navigation container reduced acl - maybe extending zend navigation classes , add appropriate methods.


    Comments

    Popular posts from this blog

    c# - Usage of Server Side Controls in MVC Frame work -

    cocoa - Nesting arrays into NSDictionary object (Objective-C) -

    ios - Very simple iPhone App crashes on UILabel settext -