-1

在 html 中,我调用了一个 java 脚本函数:

<span class="lotusBtn lotusBtnAction">
<a dojoType="quickr.widgets.menu.placeActionsMenu" linkText="@@[PLACE.ACTIONS.PLACE_ACTIONS]@@"></a>
</span>

此 java 脚本文件如下所示:

dojo.provide("quickr.widgets.menu.placeActionsMenu");

dojo.require("quickr.widgets.menu.baseMenu");
dojo.require("quickr.widgets.modal.list");
dojo.require("quickr.widgets.misc.connectors");

dojo.declare("quickr.widgets.menu._placeActionsMenu",
[quickr.widgets.menu.baseMenu],
{
    linkText: "",


    // Assumes that the page must reload in order to go between a place and a room
    // TODO: Replace this with an event based system
    isRoom: q_GeneralUtils.isRoom(),
    postMixInProperties: function() {
        this.inherited('postMixInProperties', arguments);

    },

    postCreate: function() {

       // make dropdown menu
       var label = (this.isRoom ? "PLACE.ACTIONS.ROOM_ACTIONS": "PLACE.ACTIONS.PLACE_ACTIONS");
        this.createDropDownMenuOnButton(this.domNode, label, true);
        this._populate();

        if(dojo.isIE < 8) {
            dojo.addOnLoad(function() {
                if(document.body.dir == 'rtl') {
                    var container = dojo.query('#pagePlaceBar .lotusBtnContainer');
                    var actionsNode  = container.query('.lotusBtnAction');
                    actionsNode.removeClass('lotusLeft');
                    actionsNode.addClass('lotusRight');
                    container.addContent(actionsNode[0], "last");
                }
            });
        }
    },

    _item: function(label, action, bDisabled) {
        return {label: q_LocaleUtils.getStringResource(label), action: action, disabled: bDisabled};
    },

    _addItem: function(label, action) {
        this.addItem(q_LocaleUtils.getStringResource(label), action);
    },

    _addItemDisabled: function(label) {
        this.addItemDisabled(q_LocaleUtils.getStringResource(label));
    },

    _createFromForm: function(formUnid, defFolder) {
       if (!defFolder || defFolder == "") {
          defFolder = this._getLibraryOrRoomIndex();
       }
        // TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
        var oEvt = new quickr.widgets.misc.eventlink(
            {
                event: this.ACTION.PAGE.CREATE,
                args: { folderUnid: defFolder, formUnid: formUnid }
            }
        );
        window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());

       oEvt.destroyRecursive();
    },

    _populate: function() {

        if (q_BaseLoader.user.baseAccess > window.q_GeneralUtils.access.level.reader) {

            var aForms = q_BaseLoader.defaultForms;

            var createList = [];

            var aForms = this._getFormsList(true);
            for (var ii = 0; ii < aForms.length; ii++) {
                var oFrm = aForms[ii];
                if (this._isPredefinedForm(oFrm, "CustomLibrary")) 
                {
                     if (true == q_BaseLoader.ecm.enabled) createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_WIDGET", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createLibraryConnectorPage"), undefined),false));
                }
                else
                if (this._isPredefinedForm(oFrm, "SingleUpload")) {
                    createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_UPLOAD", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createUpload"), undefined),false));
                }
                else
                if (this._isPredefinedForm(oFrm, "ImportedFile")) {
                    createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_IMPORTED_PAGE", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createImportedPage"), undefined), false));
                }
                else
                if (this._isPredefinedForm(oFrm, "List")) {
                    if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC(null, false) == null) {
                        createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_LIST", null, true));
                    } else {
                        createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_LIST", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createListFolder"), false), false));
                    }
                }
                else
                if (this._isPredefinedForm(oFrm, "HTMLPage")) {

                }               
                else 
                {
                    createList.push(this._item(oFrm.name, dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createFromForm", oFrm.unid), undefined),false));
                }
            }



            //Comment by haoxiangyu on10/14/2011. for lineitem "Editor can not create folder"
            //Originally, blow code makes editor can not create folder in room, but can do it in place          
            /*
            if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC(null, false) == null) {
                createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", null, true));
            } else {
                createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createFolder"), false)));
            }*/
            if (window.q_FolderUtils.canCreateFolder() ){
                if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC(null, false) == null) {
                    createList.push(new dijit.MenuSeparator());
                    createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", null, true));
                } else {
                    createList.push(new dijit.MenuSeparator());
                    createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createFolder"), false)));
                }
            }else{
                    createList.push(new dijit.MenuSeparator());
                    createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", null, true));
            }

            //if no folders, add a disabled "New" item...
            if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC() == null) {
                this._addItemDisabled("PLACE.PLACE_ACTIONS.NEW_PAGE");
            } else {
                var submenu = this.addSubmenu(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.NEW_PAGE"), createList);
            }
        }

        if (q_BaseLoader.user.baseAccess > window.q_GeneralUtils.access.level.reader && q_BaseLoader.user.canManageTOC == true) {
            //this._addItemDisabled("PLACE.PLACE_ACTIONS.NEW_FORM"); // would use listfolder.htm
            if ((q_BaseLoader.user.canManagePlace) && (q_BaseLoader.environment.createRoom) && (!q_BaseLoader.environment.isOffline)) {
                this._addItem("PLACE.PLACE_ACTIONS.NEW_ROOM", dojo.hitch(this, "_createRoom"));
            }
        }

        this.addSeparator();

        //if(!q_BaseLoader.sametime.enabled85 && q_BaseLoader.sametime.serverLocation != '')
            //  this._addItem("PLACE.PLACE_ACTIONS.CHAT_WITH_MEMBERS", dojo.hitch(this, "_chatwithMembers"));

        if (q_BaseLoader.place.show.sitemap) {
            this._addItem("PLACE.PLACE_ACTIONS.SITE_MAP", dojo.hitch(this, "_goToSiteMap"));
        }
        if (q_BaseLoader.place.show.placeoffline == true && (this.getRoomName().toLowerCase() =="main.nsf") && (this.baseContext.user.DN != "Anonymous")) {
            if (q_BaseLoader.offline.enabled && (dojo.isIE || dojo.isFF)) {
                this._addItem("PLACE.PLACE_ACTIONS.OFFLINE", dojo.hitch(this, "_offline"));
            }
            else if (q_BaseLoader.offline.enabled == false) {
                this._addItemDisabled("PLACE.PLACE_ACTIONS.OFFLINE");
            }
        }

        if (q_BaseLoader.place.show.whatsNew) {     
            this._addItem("WHATS_NEW.TITLE", dojo.hitch(this, "_whatsNew"));
        }
        var showPrefs = window.connectors.showPreferences();
        var showAddToConnectorsUI = window.connectors.showAddToConnectors();
        if (showPrefs || (showAddToConnectorsUI == true )) //AVAILABLE))
        {
            this.addSeparator();
        }
        if (showPrefs) this._addItem(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.PREFERENCES").replace("{0}", window.q_BaseLoader.place.title), dojo.hitch(this, "_showPreferences"));
        if (showAddToConnectorsUI== 1) this._addItem(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.ADD_TO_CONNECTORS").replace("{0}", window.q_BaseLoader.place.title), dojo.hitch(this, "_addToConnectors"));

        this.publishEvent(this.ACTION.MENU.POPCOM.PLACE_ACTIONS, this._menu);
    },

    _publishEvent: function(e, a) {
        if (typeof a == "undefined") a = new Object();
        /* No need to put it in the url
        var oEvt = new quickr.widgets.misc.eventlink(
            {
                event: e,
                args: a
            }
        );

        window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
        oEvt.destroyRecursive();
        */

        //just publish the event directly.  No neeed to put it in the url
        this.publishEvent(e, a);
    },

    _getFolderUnid: function()
    {
        var _LIBRARYFOLDER = 'CD0EF97D625305B90525670800167213';
        var _ROOMINDEX = 'A7986FD2A9CD47090525670800167225';
        return this.isRoom ? _ROOMINDEX : _LIBRARYFOLDER;
    },

    _getLibraryOrRoomIndex: function() {
        var _PLACEINDEX = 'CE6A3D6B1F546C9405256708001671FF';
        var _ROOMINDEX = 'A7986FD2A9CD47090525670800167225';
        return this.isRoom ? _ROOMINDEX : _PLACEINDEX;
    },

    _chatwithMembers: function() {
        openPeopleOnline();     
    },

    _getDefaultCreateFolder: function(callback, bAllowIndex) {
       if (typeof callback == "undefined") callback = null;

       // SPR: #ESEO89JKU9
       var unid = window.q_GeneralUtils.getUnidFromUrl();

       if (unid) {
            var folder = window.q_BaseLoader.allViews[unid];

            if (typeof folder == "undefined") {

                var type = window.q_GeneralUtils.getParameterFromUrl('type');
                if (type == "0") {
                    var document_xml = "";
                    var document_url = window.q_RestUtils.getURI("document",unid) + "/feed?includePropertySheets=true&includeAllFields=true";
                    window.q_AjaxUtils.get ( {  
                        sync: true,
                        url: document_url,
                        //I found out that the response is NOT declared as XML.  
                        handleAs: "text",
                        timeout: 5000, 
                        load: function(response, ioArgs){  
                            document_xml = response;
                        },
                        // The ERROR function will be called in an error case.
                        error: function(response, ioArgs){
                        }
                    });
                    if(document_xml != null && document_xml != "") {
                        var document_xmldoc = window.q_XmlUtils.getXmlDocFromString(document_xml);
                        var document_FolderUNID = window.q_XmlUtils.getDocSnxValue(document_xmldoc, "h_FolderUNID");
                        if (document_FolderUNID) {
                            folder = window.q_BaseLoader.allViews[document_FolderUNID];
                        }                           
                    }
                    if (typeof folder == "undefined") {
                        return window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
                    }
                } else {
                    return window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
                }
            }

            // filter out Index, Forums, Calendar, Tasks, Customize and Trash in TOC
            // also filter out Lists
            if ((folder.systemName && (folder.systemName == "h_Index"
                                || folder.systemName == "h_49B9AB68350FB355482576890021FE8D"
                                || folder.systemName == "h_Calendar"
                                || folder.systemName == "h_TaskList"
                                || folder.systemName == "h_Tailor"
                                || folder.systemName == "h_TrashList")) ||
                 (folder.folderSubStyle && (folder.folderSubStyle == "h_List"))) {
                return window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
            }

            if (folder && folder.proxyUnid && folder.proxyUnid.length > 0) {
                unid = folder.proxyUnid;
                if (callback && typeof callback == "function") {
                    callback(unid);
                }
                return unid;
            }
        } else {
            window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
        }
    },

    _allowPageNav: function() {
        return q_DocUtils.state.allowPageNav();
    },

    _createFolder: function(defFolder) {
       if (!defFolder || defFolder == "") {
          if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager) {//if not a manager need to alert the user they can't do this
             window.q_GeneralUtils.qkrWarning(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.NO_FOLDERS"));
             return;
          }
          defFolder = "toc";
       }
       if (this._allowPageNav()) {
        this.publishEvent(this.ACTION.FOLDER.CREATE, {folderUnid: defFolder});
       }
    },

    _createRoom: function() {
        if (this._allowPageNav()) {
            this.publishEvent(this.ACTION.ROOM.CREATE, {});
        }
    },

    _createImportedPage: function(defFolder) {
       if (!defFolder || defFolder == "") {
          defFolder = this._getLibraryOrRoomIndex();
       }
       if (this._allowPageNav()) {
        this.publishEvent(
            this.ACTION.MODALPAGE.CREATE,
            {
                folderUnid: defFolder, 
                modal: true, 
                formUnid: q_BaseLoader.defaultForms["ImportedFile"].unid,
                createParms: {
                    xsl: "importedPage_create.xsl",
                    formName: "CreateModalPage",
                    title: "FOLDER.NEW_MENU.IMPORTED_PAGE"
                }
            }
        );
       }

    },

    _createPage: function(defFolder) {
       if (!defFolder || defFolder == "") {
          defFolder = this._getLibraryOrRoomIndex();
       }
        // TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
        var oEvt = new quickr.widgets.misc.eventlink(
            {
                event: this.ACTION.PAGE.CREATE,
                args: {folderUnid: defFolder, formUnid: q_BaseLoader.defaultForms["BasicPage"].unid}
            }
        );
        window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
        oEvt.destroyRecursive();
    },

    _createLinkPage: function(defFolder) {
       if (!defFolder || defFolder == "") {
          defFolder = this._getLibraryOrRoomIndex();
       }
        // TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
        var oEvt = new quickr.widgets.misc.eventlink(
            {
                event: this.ACTION.PAGE.CREATE,
                args: { folderUnid: defFolder, formUnid: q_BaseLoader.defaultForms["URLLinkPage"].unid }
            }
        );
        window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
        oEvt.destroyRecursive();
    },

    _createUpload: function(defFolder) {
        // TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
       if (!defFolder || defFolder == "") {
          defFolder = this._getLibraryOrRoomIndex();
       }
       if (this._allowPageNav()) {
        this.publishEvent(this.ACTION.UPLOAD.CREATE,
            {folderUnid: defFolder, modal: true, formUnid: q_BaseLoader.defaultForms["SingleUpload"].unid });
        }
    },

    _createLibraryConnectorPage: function(defFolder) {
        // TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
       if (!defFolder || defFolder == "") {
          defFolder = this._getLibraryOrRoomIndex();
       }
       if (this._allowPageNav()) {
        this.publishEvent(this.ACTION.CUSTOMLIBRARY.CREATE,
            { folderUnid: defFolder, modal: true, unid: q_BaseLoader.defaultForms["CustomLibrary"].unid });
        }
    },

    _addToConnectors: function() {
        window.location.href = window.connectors.getAddPlaceURL();
    },  

    _showPreferences: function() {
        window.connectors.showPreferencesDialog("");
    },

    _goToCreatePage: function() {
        q_GeneralUtils.goToCreatePage();
    },

    _createListFolder: function (defFolder) {   
       if (this._allowPageNav()) {
       if (!defFolder || defFolder == "") {
          if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager) {//if not a manager need to alert the user they can't do this
             window.q_GeneralUtils.qkrWarning(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.NO_FOLDERS"));
             return;
          }
          defFolder = "toc";
       }
        this.publishEvent(this.ACTION.LIST.CREATE, {folderUnid: defFolder});
        }
    },

    _whatsNew: function () {

        var oEvt = new quickr.widgets.misc.eventlink(
            {
                event: this.ACTION.PAGE.OPEN,
                args: {systemName: "h_WhatsNew", period: "day" }
            }
        );  
        document.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());  
        oEvt.destroyRecursive();
    }, 


    _offline: function() {
        this.publishEvent(
            this.ACTION.DIALOG.OPEN,
            {
            fullScreen: true,
            title: 'PLACE.PLACE_ACTIONS.OFFLINE_TITLE',
            href: this.getRootUrl() + this.getBaseUrl() + '/$defaultview/A22C4328A85E9873052568B0005C0C98/?OpenDocument'
            }
            );
    },

    _goToSiteMap: function () {
        var windowWidth=275;
        var windowHeight=300;
        window.currentRoom = { roomNsf: window.q_GeneralUtils.getRoomNSF() };
        var remoteUrl = window.q_GeneralUtils.getPlaceUrl() + "/" + "Main.nsf" + "/?OpenDatabase&Form=h_SiteMapUI&NoWebCaching";
        var remoteWindow = window.open( remoteUrl, "Remote", "resizable=yes,width=" + windowWidth + ",height=" + windowHeight + ",top=20,left=20,toolbar=no,scrollbars=yes,menubar=no,status=no");
        if (remoteWindow != null) {
            remoteWindow.focus();
        }
    }
});


dojo.declare("quickr.widgets.menu.placeActionsMenu",
[quickr.widgets.menu._placeActionsMenu],
{
}
);

我将在哪里更改此按钮的宽度?

4

1 回答 1

2

使用 CSS 更改宽度。

你可以像...一样内联 <span class="lotusBtn lotusBtnAction" style="width:300px">

或在 CSS 文件中,如..

.lotusBtn{width:300px}

于 2013-05-24T17:51:15.630 回答