Ejemplo n.º 1
0
        public static string GetViewsPanelStylesheetName(GeneralHelpers.DOC_STATE_NUMBER docState, ContentURI docToCalcURI,
                                                         string stylesheetName)
        {
            string sStylesheetNameForView = stylesheetName;

            if (docState == GeneralHelpers.DOC_STATE_NUMBER.thirddoc &&
                docToCalcURI.URIDataManager.SubActionView != string.Empty &&
                docToCalcURI.URIDataManager.SubActionView != Helpers.GeneralHelpers.NONE &&
                stylesheetName.IndexOf(GeneralHelpers.EXTENSION_XSLT) != 0)
            {
                //v1.1.1 uses multiple views
                GeneralHelpers.SUBACTION_VIEWS eSubActionView
                    = GeneralHelpers.GetSubActionView(docToCalcURI.URIDataManager.SubActionView);
                if (eSubActionView != GeneralHelpers.SUBACTION_VIEWS.none)
                {
                    //pattern is to change the stylesheet's last filename char using enum
                    //Operation1.xslt (mobile) to Operation3.xslt (full)
                    int    iStart            = stylesheetName.IndexOf(GeneralHelpers.EXTENSION_XSLT) - 1;
                    string sSubActionViewInt = stylesheetName.Substring(iStart, 1);
                    if (!string.IsNullOrEmpty(sSubActionViewInt))
                    {
                        int iNewSSEnum = (int)eSubActionView;
                        sStylesheetNameForView = stylesheetName.Replace(
                            string.Concat(sSubActionViewInt, GeneralHelpers.EXTENSION_XSLT),
                            string.Concat(iNewSSEnum.ToString(), GeneralHelpers.EXTENSION_XSLT));
                    }
                }
            }
            return(sStylesheetNameForView);
        }
Ejemplo n.º 2
0
        public static string GetXhtmlDocPath(ContentURI uri,
                                             GeneralHelpers.DOC_STATE_NUMBER displayDocType,
                                             string xmlDocPath, AppHelpers.Resources.FILEEXTENSION_TYPES fileExtType,
                                             string viewEditType)
        {
            string sXhtmlDocPath = string.Empty;

            if (string.IsNullOrEmpty(xmlDocPath))
            {
                uri.ErrorMessage = DevTreks.Exceptions.DevTreksErrors.MakeStandardErrorMsg(
                    string.Empty, "IOHELPER_CANTBUILD");
                return(sXhtmlDocPath);
            }
            //same paths, different file extensions
            sXhtmlDocPath = xmlDocPath;
            GeneralHelpers.ChangeFileExtension(
                fileExtType, ref sXhtmlDocPath);
            //add viewEditType as a filename extension (owners and authorized clubs usually
            //get full html view while others get print view)
            //and use pagination with the html
            //and make sure the pagination doesn't interfere with uripatterns
            string sFileName = Path.GetFileNameWithoutExtension(xmlDocPath);
            string sHtmlFileName
                = string.Concat(sFileName,
                                GeneralHelpers.FILENAME_DELIMITER, viewEditType);

            if (displayDocType == GeneralHelpers.DOC_STATE_NUMBER.thirddoc)
            {
                //stories are the same in all views
                if (!sFileName.Contains(string.Concat(GeneralHelpers.FILENAME_DELIMITER,
                                                      GeneralHelpers.FILENAME_EXTENSIONS.selected)))
                {
                    //v1.1.1 uses multiple html views
                    GeneralHelpers.SUBACTION_VIEWS eSubActionView
                        = GeneralHelpers.GetSubActionView(uri.URIDataManager.SubActionView);
                    //do not include graph subaction view -no stateful html doc used
                    if (eSubActionView == GeneralHelpers.SUBACTION_VIEWS.mobile ||
                        eSubActionView == GeneralHelpers.SUBACTION_VIEWS.full ||
                        eSubActionView == GeneralHelpers.SUBACTION_VIEWS.summary)
                    {
                        //each html view is distinguished by the int representation of enum
                        int iSubActionView = (int)eSubActionView;
                        sHtmlFileName = string.Concat(sFileName,
                                                      GeneralHelpers.FILENAME_DELIMITER, viewEditType,
                                                      iSubActionView.ToString());
                    }
                }
            }
            sXhtmlDocPath
                = sXhtmlDocPath.Replace(sFileName, sHtmlFileName);
            //technically not an issue in 2.0.0 servers but not clear about
            //where this is being deployed so retain for now
            if (sXhtmlDocPath.Length > 260)
            {
                //watch for file length limitation
                int    iShortNameLength = sXhtmlDocPath.Length - 257;
                string sNewName         = sFileName.Substring(iShortNameLength,
                                                              sFileName.Length - iShortNameLength);
                sXhtmlDocPath = sXhtmlDocPath.Replace(sFileName, sNewName);
            }
            return(sXhtmlDocPath);
        }