Ejemplo n.º 1
0
        /// <summary>
        /// Processes the specified request for CFD content and returns the alternatePresentation string of HTML to deliver to the client.
        /// </summary>
        /// <param name="siteId">The site id.</param>
        /// <param name="webId">The web id.</param>
        /// <param name="listId">The list id.</param>
        /// <param name="type">The type of request - Open or Save</param>
        /// <param name="location">The location within the web</param>
        /// <param name="url">The URL of the entire request</param>
        /// <param name="largeListThrottled">The parameter is not used.</param>
        /// <param name="lcid">The lcid for the culture of the request</param>
        /// <param name="userAgent">The browser user agent string</param>
        /// <param name="webProperties">The properties for the Web</param>
        /// <param name="defaultPresentation">The default presentation through the OOB page</param>
        /// <param name="alternatePresentation">The alternate presentation which will be delivered to the client</param>
        public void Process(Guid siteId, Guid webId, Guid listId, WffRequestType type, string location, string url, bool largeListThrottled, int lcid, string userAgent, Hashtable webProperties, string defaultPresentation, ref string alternatePresentation)
        {
            if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(defaultPresentation) || string.IsNullOrEmpty(userAgent))
            {
                return;
            }

            NameValueCollection queryString = HttpUtility.ParseQueryString(url.Substring(url.IndexOf("?", StringComparison.OrdinalIgnoreCase)));
            string extensions = string.Empty;
            //identify whether this is a request from outlook or not
            bool outlook = false;

            if (!string.IsNullOrEmpty(queryString["Extensions"]))
            {
                extensions = queryString["Extensions"].ToLowerInvariant();
                outlook    = true;
            }

            if (extensions.Contains("oob"))
            {
                alternatePresentation = defaultPresentation.Replace("</h1>", "</h1>(Custom dialog turned off due to querystring)");
                return;
            }
            else
            {
                try
                {
                    //is the user trying to open a document or save one
                    string action = "Open";
                    if (type == WffRequestType.Save)
                    {
                        action = "Save";
                    }

                    using (SPSite site = new SPSite(siteId))
                    {
                        using (SPWeb web = site.OpenWeb(webId))
                        {
                            List <string> filters = CustomFileDialogPostProcessor.ParseFileFormatFilterString(queryString["filedialogfiltervalue"]);
                            XmlDocument   content = null;
                            Data          data    = new Data();
                            //If we have an id we are currently looking at a list
                            if (listId.CompareTo(Guid.Empty) != 0)
                            {
                                SPDocumentLibrary library = web.Lists[listId] as SPDocumentLibrary;
                                SPFolder          folder  = web.GetFolder(location);
                                //get a data representation for that list
                                content = data.GetListData(library, folder, outlook, action, "Modified", filters);
                                //transform the list into Html for the cfd
                            }
                            else //assume website
                            {
                                content = data.GetSiteData(web, outlook, action, "Modified", filters);
                            }

                            XsltArgumentList args = new XsltArgumentList();
                            foreach (string key in queryString.AllKeys)
                            {
                                if (!string.IsNullOrEmpty(key))
                                {
                                    args.AddParam("qs-" + key.ToLowerInvariant(), string.Empty, queryString[key]);
                                }
                            }

                            string xsltPath = RootSiteFromAny(web.Url) + "/Style%20Library/SingleAndMultiselect.xslt";

                            alternatePresentation = GetTransformedData(content, xsltPath, args);
                        }
                    }



                    // alternatePresentation = XmlHelpers.GetTransformedData(content, Concat(SharePointPathManipulation.RootSiteFromAny(pd.SiteUrl), stylesheet), args);
                }
                catch (Exception ex)
                {
                    alternatePresentation = defaultPresentation.Replace("</h1>", "</h1>(Custom dialog not available due to an error.  You can try to navigate using the standard dialog below.  If you see this message repeatedly, try closing and reopening your editing application (e.g. Word))<!--" + ex.Message + ex.StackTrace + "-->");
                }
            }
        }
Ejemplo n.º 2
0
 public void Process(Guid siteId, Guid webId, Guid listId, WffRequestType type, string location, string url, ref string alternatePresentation)
 {
 }