public string RenderCustomNavigation(Page page)
        {
            if (CoreContext.Configuration.Personal) return string.Empty;

            var func = "";

            if (!page.AppRelativeTemplateSourceDirectory.Contains(BaseVirtualPath))
                func = @"setTimeout(function () {
                            Teamlab.getMailFolders({}, new Date(0), {});
                        }, 3000);";

            var script = string.Format(@"
                                        var _inbox_folder_id = 1;
                                        var _setUnreadMailMessagesCount = function(params, folders){{
                                          jq.each(folders, function(index, value) {{
                                            if(_inbox_folder_id==value.id) {{
                                              jq(""#TPUnreadMessagesCount"").text(value.unread>100 ? '>100' : value.unread);
                                              jq(""#TPUnreadMessagesCount"").parent().toggleClass(""has-led"", value.unread != 0);
                                              return false;
                                            }};
                                          }});
                                        }};
                                        Teamlab.bind(Teamlab.events.getMailFolders, _setUnreadMailMessagesCount);
                                        {0}", func);

            page.RegisterInlineScript(script);

            return string.Format(@"<li class=""top-item-box mail"">
                                     <a class=""inner-text"" href=""{0}"" title=""{1}"">
                                       <span id=""TPUnreadMessagesCount"" class=""inner-label""></span>
                                     </a>
                                   </li>",
                                 VirtualPathUtility.ToAbsolute(BaseVirtualPath + "/"),
                                 MailResource.MailTitle);
        }
        public void InitViewSwitcherScripts(Page p, List<ViewSwitcherTabItem> tabs)
        {
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/common/viewswitcher/js/viewswitcher.js"));
            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/common/viewswitcher/css/viewswitcher.css"));

            if (tabs != null && tabs.Count > 0)
            {
                try
                {
                    ViewSwitcherTabItem tab = null;
                    try
                    {
                        tab = (from t in tabs
                               where t.IsSelected
                               select t).First<ViewSwitcherTabItem>();
                    }
                    catch
                    {
                        if (tabs.Count > 0)
                        {
                            tab = tabs[0];
                            tab.IsSelected = true;
                        }
                    }

                    var firstBootScript = string.Format("viewSwitcherToggleTabs('{0}_ViewSwitcherTab');", tab.DivID);

                    p.RegisterInlineScript(firstBootScript);
                }
                catch
                {
                }
            }
        }
Exemple #3
0
        public string RenderCustomNavigation(Page page)
        {
            var func = string.Empty;

            if (!page.AppRelativeTemplateSourceDirectory.Contains(BaseVirtualPath) && HubUrl == string.Empty)
            {
                func = string.Format(@"

                     setTimeout(function () {{ Teamlab.getMailFolders(); }}, {0}); 
                     {1}", MailCountGetFirstInMillisecond,
                           MailCountGetEnableInterval ? string.Format(
                           "setInterval(function () {{ Teamlab.getMailFolders(); }}, {0});",
                           MailCountGetIntervalInMillisecond)
                           : string.Empty);
            }

            page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/js/asc/core/asc.mailreader.js"));
            if (func != string.Empty)
            {
                page.RegisterInlineScript(func);
            }
            return string.Format(@"<li class=""top-item-box mail"">
                                     <a class=""inner-text mailActiveBox"" href=""{0}"" title=""{1}"">
                                       <span id=""TPUnreadMessagesCount"" class=""inner-label""></span>
                                     </a>
                                   </li>",
                                 VirtualPathUtility.ToAbsolute(BaseVirtualPath + "/"),
                                 MailResource.MailTitle);
        }