6

I have a GUI Extension that loads an external javascript file and then integrates with the Tridion MessageCenter. My problem is that the MessageCenter message is shown 2 times. I believe my extension is enabled for 2 'views' and I need to somehow change the config to only load the JS files for the main dashboard view.

How could I do that?

Configuration:

<?xml version="1.0" ?> 
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge" xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions" xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
  <resources cache="true">
    <cfg:filters/>
    <cfg:groups>
      <cfg:group name="MessageCenterSignalrGroup" >
          <cfg:domainmodel name="MessageCenterSignalrDomain">
            <cfg:fileset>
                <cfg:file type="script" id="rcJq">/js/jquery-1.6.4.js</cfg:file>
                <cfg:file type="script" id="rcSig">/js/jquery.signalR-1.1.1.js</cfg:file>
                <cfg:file type="script" id="rcNot">/js/notification.js</cfg:file>
            </cfg:fileset>
            <cfg:services />
          </cfg:domainmodel>
         <cfg:dependencies>
            <cfg:dependency/>
<!--            
            <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
                <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
    -->         
        </cfg:dependencies>
      </cfg:group>
    </cfg:groups>
  </resources>
  <definitionfiles/>
  <extensions>
    <ext:editorextensions>
      <ext:editorextension target="CME">
        <ext:editurls/>
        <ext:listdefinitions/>
        <ext:taskbars/>
        <ext:commands/>
        <ext:commandextensions/>
        <ext:contextmenus />
        <ext:lists/>
        <ext:tabpages/>
        <ext:toolbars/>
        <ext:ribbontoolbars/>
      </ext:editorextension>
    </ext:editorextensions>
    <ext:dataextenders/>
  </extensions>
  <commands/>
  <contextmenus/>
  <localization/>
  <settings>
    <defaultpage/><!--/Views/Default.aspx</defaultpage>-->
    <navigatorurl/><!--/Views/Default.aspx</navigatorurl>-->
    <editurls/>
    <listdefinitions/>
    <itemicons/>
    <theme>
      <path/><!--/CSS/</path>-->
    </theme>
    <customconfiguration/>
  </settings>
</Configuration>

Javascript:

var connection = $j.connection('http://localhost/Signalr4TridionMC/messageCenter');

connection.received(function (data) {
    $messages.registerNotification(data);
});

connection.start(); 

1 Answer 1

7

Having worked on this together, I know I have shared this with you before, but I have a different type of config to specify the view - here is a snippet from the config - its the bit with the <cfg:extension target="Tridion.Web.UI.Editors.CME.Views.Dashboard"> that specifies the view

<resources cache="true">
  <cfg:extensiongroups>
    <cfg:extensiongroup name="Message.Group">
      <cfg:extension target="Tridion.Web.UI.Editors.CME.Views.Dashboard">
        <cfg:insertafter>Message.Resources</cfg:insertafter>
      </cfg:extension>
    </cfg:extensiongroup>
  </cfg:extensiongroups>
  <cfg:groups>
    <cfg:group name="Message.Resources">
      <cfg:fileset>
        <cfg:file type="script">js/jquery.js</cfg:file>
        <cfg:file type="script">js/jquery.signalR-0.5.3.js</cfg:file>
        <cfg:file type="script">js/notification.js</cfg:file>
      </cfg:fileset>
    </cfg:group>
  </cfg:groups>
</resources>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.