Exemplo n.º 1
0
        public PathInfo(AssembleInfo assembleInfo)
        {
            _info = assembleInfo;
            if (_info.Data.Rows.Count == 0)
            {
                throw new InvalidOperationException("Empty Assemble Info");
            }

            LivePath  = _info.GetString("LIVE_DIRECTORY");
            StagePath = _info.GetString("STAGE_DIRECTORY");

            if (_info.ForceLive)
            {
                BaseAssemblePath = LivePath;
            }
            else if (!IsLive)
            {
                BaseAssemblePath = StagePath;
            }
            else if (_info.ForceTestDirectory)
            {
                BaseAssemblePath = _info.GetString("TEST_DIRECTORY");
            }
            else
            {
                BaseAssemblePath = LivePath;
            }

            if (_info.Mode == AssembleMode.Preview)
            {
                BaseAssemblePath += "\\temp\\preview\\objects\\";
            }
            else if (_info.Mode == AssembleMode.PreviewAll || _info.Mode == AssembleMode.PreviewById)
            {
                BaseAssemblePath += "\\temp\\preview\\articles\\";
            }
            else if (_info.Mode == AssembleMode.Notification)
            {
                BaseAssemblePath += "\\qp_notifications\\";
            }
            else if (_info.Mode == AssembleMode.GlobalCss)
            {
                BaseAssemblePath += "\\temp\\css\\";
            }

            BaseUploadPath = _info.FirstDataRow["UPLOAD_DIR"].ToString();
            TemplateFolder = _info.FirstDataRow["TEMPLATE_FOLDER"].ToString();
            PageFolder     = _info.Data.Columns["PAGE_FOLDER"] != null ? _info.FirstDataRow["PAGE_FOLDER"].ToString() : "";

            CalculateUrls();
            CalculateFullPath();
        }
Exemplo n.º 2
0
        private void FillControlSet(AssembleInfo info, bool isDbConnected)
        {
            Info = info;
            InitBaseFormatSql();
            if (isDbConnected)
            {
                Data = Info.IsAssembleObjectsMode ? Info.Controller.Cnn.GetDataTable(SiteObjectsSql + Info.Controller.GetFilter()) : Info.Controller.Cnn.GetDataTable(SiteObjectsSql + " and objf.object_format_id = 0");

                if (Info.Mode == AssembleMode.Page || Info.Mode == AssembleMode.AllTemplateObjects || Info.IsAssembleFormatMode)
                {
                    FillTemplateRow();
                }
            }
            RowIndex = 0;
        }
Exemplo n.º 3
0
        public ObjectCall(string call, AssembleInfo info)
        {
            TemplateName = info.TemplateName;
            FormatName   = string.Empty;

            char[] splitParams = { '.' };
            var    callParams  = call.Split(splitParams);

            if (callParams.Length > 3)
            {
                throw new ArgumentException("Invalid object call: " + call);
            }

            switch (callParams.Length)
            {
            case 3:
                TemplateName = callParams[0];
                ObjectName   = callParams[1];
                FormatName   = callParams[2];
                TypeCode     = "TOF";
                break;

            case 2:
                if (info.IsTemplateName(callParams[0]))
                {
                    TypeCode     = "TO";
                    TemplateName = callParams[0];
                    ObjectName   = callParams[1];
                }
                else
                {
                    TypeCode   = "OF";
                    ObjectName = callParams[0];
                    FormatName = callParams[1];
                }
                break;

            case 1:
                TypeCode   = "O";
                ObjectName = callParams[0];
                break;
            }

            TemplateName = TemplateName.ToLowerInvariant();
            ObjectName   = ObjectName.ToLowerInvariant();
            FormatName   = FormatName.ToLowerInvariant();
        }
Exemplo n.º 4
0
        public ControlInfo(DataRow reader, AssembleInfo info)
        {
            Row  = reader;
            Info = info;
            if (CurrentType == ControlType.PublishingContainer)
            {
                Container = new ContainerInfo(this);
            }

            TargetFolder = GetTargetFolder();
            CodeBehind   = CodeTransformer.Preprocess(Row["CODE_BEHIND"].ToString());
            Presentation = CodeTransformer.Preprocess(Row["FORMAT_BODY"].ToString());

            var code = CodeBehind;

            UserNamespaces = CodeTransformer.CutNamespaceDefinitionsFromCode(ref code);
            CodeBehind     = CodeTransformer.AppendIndent(code);
        }
Exemplo n.º 5
0
        internal string GetExternalPath(int templateId)
        {
            string templateFolder = "", controlsFolderName = "";
            var    dv = new DataView(_info.Templates)
            {
                RowFilter = "PAGE_TEMPLATE_ID = " + templateId.ToString(CultureInfo.InvariantCulture)
            };

            if (dv.Count > 0)
            {
                templateFolder     = dv[0]["TEMPLATE_FOLDER"].ToString();
                controlsFolderName = GetTemplateControlsFolderName(AssembleInfo.GetNetName(dv[0]["NET_TEMPLATE_NAME"].ToString(), templateId.ToString(CultureInfo.InvariantCulture), "t"));
            }

            var sb = new StringBuilder(BaseAssemblePath);

            sb.Append(templateFolder);
            sb.Append(Path.DirectorySeparatorChar);
            sb.Append(controlsFolderName);
            sb.Append(Path.DirectorySeparatorChar);
            dv.Dispose();
            return(sb.ToString());
        }
Exemplo n.º 6
0
 public ControlSetInfo(AssembleInfo info)
 {
     FillControlSet(info, true);
 }
Exemplo n.º 7
0
 public ControlSetInfo(AssembleInfo info, bool isDbConnected)
 {
     FillControlSet(info, isDbConnected);
 }