コード例 #1
0
        public void showHome(bool isClosing)
        {
            // Do we have a valid web server address?
            if (m_ServerDetails.WebClientURL == "")
            {
                // No - show the configuration UI
                PanelMode = PanelModes.Configuration;
            }
            else
            {
                // Yes - navigate to the home template
                string theURI = string.Format(@"{0}{1}myAlfresco?p=&e=xls", m_ServerDetails.WebClientURL, m_TemplateRoot);
                // We don't prompt the user if the document is closing
                string strAuthTicket = m_ServerDetails.getAuthenticationTicket(!isClosing);

                /**
                 * Long ticket fix - the encoded ticket is 2426 characters long, therefore has to be sent
                 * as an HTTP header to avoid the IE6 and IE7 2048 character limit on a GET URL
                 */
                if ((strAuthTicket == "") && !isClosing)
                {
                    PanelMode = PanelModes.Configuration;
                    return;
                }

                string strAuthHeader = "";
                if ((strAuthTicket != "") && (strAuthTicket != "ntlm"))
                {
                    if ((Uri.EscapeDataString(strAuthTicket).Length + theURI.Length) > 1024)
                    {
                        strAuthHeader = "ticket: " + strAuthTicket;
                    }
                    else
                    {
                        theURI += "&ticket=" + strAuthTicket;
                    }
                }

                if ((strAuthTicket == "") && !isClosing)
                {
                    PanelMode = PanelModes.Configuration;
                    return;
                }

                if (m_ClearSession)
                {
                    m_ClearSession = false;
                    InternetSetOption(0, INTERNET_OPTION_END_BROWSER_SESSION, null, 0);
                }

                if (!isClosing || (strAuthTicket != ""))
                {
                    webBrowser.ObjectForScripting = this;
                    UriBuilder uriBuilder = new UriBuilder(theURI);
                    webBrowser.Navigate(uriBuilder.Uri.AbsoluteUri, null, null, strAuthHeader);
                    PanelMode = PanelModes.WebBrowser;
                }
            }
        }