Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-20-2011, 12:45 AM
Special Member
 
Posts: 117
Default [SOLVED] [Admin Extension] UI doesn't displayed.

Hello Guys,

I am developing an Admin Extension. Which adds a new tab to "Accounts" and also add a textbox to configure GID number. I've wrote following javascript code. With the code the tab is displayed under account edit form. But I cannot see any textbox or anything. Please help.

Code:
function GIdExtension() {}

ZaAccount.A_GId = "zimbraAccountGId";


// Add my new LDAP attrributes to ZaAccount.myXModel
if(ZaAccount.myXModel && ZaAccount.myXModel.items) {
    ZaAccount.myXModel.items.push(
        {id:ZaAccount.A_GId, 
         type:_STRING_, 
         ref:"attrs/"+ZaAccount.A_GId
         }
    );
}



if(ZaTabView.XFormModifiers["ZaAccountXFormView"]) {

  GIdExtension.AccountXFormModifier = function (xFormObject) {
        try{

    /* find the SWITCH element which is the parent element for all tabs */

    var cnt = xFormObject.items.length;

    var i = 0;

    for (i = 0; i <cnt; i++) {

      if(xFormObject.items[i].type=="switch")

        break; //index i now points to the SWITCH element

           }

      //find the index of the next tab

      var posixTabIx = ++this.TAB_INDEX;

      //tab bar is the element with index 1

      var tabBar = xFormObject.items[1];

      //add the new tab button to the tab bar

      tabBar.choices.push({value:posixTabIx, label:"GID"});

      //define meta data for new form elements

      var posixAccountTab = {

        type:_ZATABCASE_, numCols:1,

        relevant:("instance[ZaModel.currentTab] == " + posixTabIx),

        items: [
         {type:_ZAGROUP_,
            items:[

             {ref:ZaAccount.A_GId, 

               type:_TEXTFIELD_, 

               msgName:ZaAccount.A_GId,

               label:ZaAccount.A_GId, 

               labelLocation:_LEFT_, 

               onChange:ZaTabView.onFormFieldChanged
                }

              ]  
            }
          ]
        };

            //add the new tab to the list of tabs

           xFormObject.items[i].items.push(posixAccountTab);
        }catch(e){
                alert(e);
        }

      };


  ZaTabView.XFormModifiers["ZaAccountXFormView"].push(GIdExtension.AccountXFormModifier);

}


GIdExtension.AccountXFormModifier = function (xFormObject){
        alert("I am here");
        ZaTabView.XFormModifiers["ZaAccountXFormView"].push(GIdExtension.AccountXFormModifier);
}
Thank You.
Reply With Quote
  #2 (permalink)  
Old 06-21-2011, 05:31 AM
Special Member
 
Posts: 117
Default

Hello Guys,

Now I am able to get textbox and tab with following code. But the textbox got display in every tab. What is wrong. Please help me. Just a hint would be good for me.

Code:
function GIdExtension() {}

ZaAccount.A_GId = "zimbraAccountGId";


// Add my new LDAP attrributes to ZaAccount.myXModel
if(ZaAccount.myXModel && ZaAccount.myXModel.items) {
    ZaAccount.myXModel.items.push(
        {id:ZaAccount.A_GId, 
         type:_STRING_, 
         ref:"attrs/"+ZaAccount.A_GId
         }
    );
}



if(ZaTabView.XFormModifiers["ZaAccountXFormView"]) {

  GIdExtension.AccountXFormModifier = function (xFormObject) {

      //find the index of the next tab

      var posixTabIx = ++this.TAB_INDEX;

      //tab bar is the element with index 1

      var tabBar = xFormObject.items[1];

      //add the new tab button to the tab bar
      tabBar.choices.push({value:posixTabIx, label:GId.Tab_GId});

      //define meta data for new form elements
      
      var posixAccountTab = {
        type:_ZAGROUP_, relevant:("instance[ZaModel.currentTab] == " + posixTabIx), 
        items: [
             {ref:ZaAccount.A_GId, 

               type:_TEXTFIELD_, 

               msgName:ZaAccount.A_GId,

               label:GId.GId_label, 

               labelLocation:_LEFT_,
               relevant:("instance[ZaModel.currentTab] == " + posixTabIx) 

                }
              ]  
            };


    /* find the SWITCH element which is the parent element for all tabs */

        for (var i = 0; i <xFormObject.items.length; i++) {
                if(xFormObject.items[i].type=="switch"){
                        xFormObject.items[i].items.push(posixAccountTab);
                        break; //index i now points to the SWITCH element
                }
        }

      }


  ZaTabView.XFormModifiers["ZaAccountXFormView"].push(GIdExtension.AccountXFormModifier);

}

Thanks in advance.
Reply With Quote
  #3 (permalink)  
Old 06-21-2011, 10:42 PM
Special Member
 
Posts: 117
Default

Bump.. Anybody?
Reply With Quote
  #4 (permalink)  
Old 07-13-2011, 02:02 AM
Junior Member
 
Posts: 5
Default Please share code

Can you please share the procedure add this in zimbra admin ui with source code
Reply With Quote
  #5 (permalink)  
Old 07-13-2011, 02:04 AM
Special Member
 
Posts: 117
Default

Well, I cannot share more code. But can I help you with any other thing?

Quote:
Originally Posted by mbhanage View Post
Can you please share the procedure add this in zimbra admin ui with source code
Reply With Quote
  #6 (permalink)  
Old 07-13-2011, 02:12 AM
Special Member
 
Posts: 117
Default

Quote:
Originally Posted by mbhanage View Post
Hi,

I want add tab mailbox quota under domains so selected domain user mailbox quota will be displayed.
You like to know the admin extension zimlet code or adding an attribute to LDAP?
Reply With Quote
  #7 (permalink)  
Old 07-13-2011, 02:12 AM
Junior Member
 
Posts: 5
Default I want to add one tab such as Mailbox Quota Under Domains

Hi,

I want add tab mailbox quota under domains so selected domain user mailbox quota will be displayed.
Reply With Quote
  #8 (permalink)  
Old 07-13-2011, 02:53 AM
Junior Member
 
Posts: 5
Default

Hi stalker,

I want zimbra admin extension zimlet code.
Reply With Quote
  #9 (permalink)  
Old 07-13-2011, 03:03 AM
Special Member
 
Posts: 117
Default

Here is the final working code but it will add a new tab into Account and not in domain. You'll have to change it to add it to domain. I hope you can do it.

Code:
function GIdExtension() {}

ZaAccount.A_GId = "zimbraAccountGId";
ZaAccount.A_GIdTitle = "This is Title";


// Add my new LDAP attrributes to ZaAccount.myXModel
if(ZaAccount.myXModel && ZaAccount.myXModel.items) {
    ZaAccount.myXModel.items.push(
        {id:ZaAccount.A_GId, 
         type:_STRING_, 
         ref:"attrs/"+ZaAccount.A_GId
         }
    );
}

if(ZaTabView.XFormModifiers["ZaAccountXFormView"]) {

  GIdExtension.AccountXFormModifier = function (xFormObject) {

      //find the index of the next tab

      var posixTabIx = ++this.TAB_INDEX;

      //tab bar is the element with index 1

      var tabBar = xFormObject.items[1];

      //add the new tab button to the tab bar
      tabBar.choices.push({value:posixTabIx, label:GId.Tab_GId});

      //define meta data for new form elements
      
	var posixAccountTab = {

        type:_ZATABCASE_,id:"account_form_GId",numCols:1, colSizes:["800px"],
            caseKey:  posixTabIx,

        items: [

               {type:_ZAGROUP_,

            items:[

             {ref:ZaAccount.A_GId, 

               type:_TEXTFIELD_, editable:true,

               msgName:"GId group",

               label:GId.GId_label, 

               labelLocation:_LEFT_, 

               onChange:ZaTabView.onFormFieldChanged} ]  

            }

          ]

        };
    /* find the SWITCH element which is the parent element for all tabs */

	for (var i = 0; i <xFormObject.items.length; i++) {
		if(xFormObject.items[i].type=="switch"){
			break; //index i now points to the SWITCH element
		}
	}
	xFormObject.items[i].items.push(posixAccountTab);

      }
  ZaTabView.XFormModifiers["ZaAccountXFormView"].push(GIdExtension.AccountXFormModifier);
}
Reply With Quote
  #10 (permalink)  
Old 07-13-2011, 03:35 AM
Junior Member
 
Posts: 5
Default Thanks

Hi stalker,

Thanks for giving the code, I am new for zimbra development Please tell me how deploy this or I have to write zimlet for this or if you have any zimlet example for admin ui please share with me. I make Hello World zimlet and properly updated in Zimbra Webmail but I have issue in admin UI.

Thanks & Regards

Mangesh Bhanage
India
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.