public PropertyCollection BuildDynamicNavigationTemplates(deliveryInstance context, PropertyCollection data = null)
        {
            if (data == null)
            {
                data = new PropertyCollection();
            }

            string reldir  = context.directoryScope.FullName.removeStartsWith(context.directoryRoot.FullName);
            string selPath = reldir; // context.scope.path;

            IMetaContentNested mc = context.scope as IMetaContentNested;

            if (mc != null)
            {
                selPath = mc.path;
            }

            reportLinkCollection directory = context.linkRegistry.getLinkOneCollection(selPath, data.getProperString(templateFieldBasic.path_folder, templateFieldBasic.document_path, templateFieldBasic.documentset_path));

            string str_localdirectory = "";

            if (directory != null)
            {
                str_localdirectory = directory.makeHtmlInsert();
            }
            data.add(reportOutputDomainEnum.localdirectory, str_localdirectory);

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Compiles the link for elemenet
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <returns></returns>
        public static string CompileLinkForElemenet(this IMetaContentNested element, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels)
        {
            string path    = "";
            var    elLevel = element.getElementLevel();

            switch (elLevel)
            {
            case reportElementLevel.servicepage:
            case reportElementLevel.page:
                path = element.GetOutputPath(context, format, levels, false);
                break;

            case reportElementLevel.document:
                metaDocument doc = element as metaDocument;
                path = doc.index.GetOutputPath(context, format, levels, false);
                break;

            case reportElementLevel.documentSet:
                metaDocumentSet docs = element as metaDocumentSet;
                path = docs.index.GetOutputPath(context, format, levels, false);
                break;
            }

            path = path.getWebPathBackslashFormat().applyToContent(false, context.data);
            return(path);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Compiles the links in the template.
        /// </summary>
        /// <param name="template">The template.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <returns></returns>
        /// <exception cref="aceReportException">null</exception>
        public static string CompileLinksInTemplate(this string template, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels)
        {
            var mc = linkInTemplate.Matches(template);

            try
            {
                foreach (Match m in mc)
                {
                    string elementPath  = m.Groups[1].Value;
                    string elementMatch = m.Groups[0].Value;

                    metaDocumentRootSet root = context.scope.root as metaDocumentRootSet;

                    IMetaContentNested target = root.regPathGet(elementPath); //// as IMetaContentNested; //.resolve(imbSCI.Cores.reporting.style.enums.metaModelTargetEnum.scopeRelativePath, elementPath, null).First();

                    //IMetaContentNested target = context.scope.resolve(imbSCI.Cores.reporting.style.enums.metaModelTargetEnum.scopeRelativePath, elementPath, null).First();

                    string path = target.CompileLinkForElemenet(context, format, levels);
                    template = template.Replace(elementMatch, path);
                }
            }
            catch (Exception ex)
            {
                string msg = "CompileLinksInTemplate failed for [" + context.scope.path + "] : " + ex.Message;
                throw new aceReportException(context, msg, aceReportExceptionType.compileScriptError, null);
            }
            return(template);
        }
Ejemplo n.º 4
0
        public static string GetIndexPath(this IMetaContentNested scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true)
        {
            string filename = ""; // context.data.getProperString("", templateFieldBasic.path_file);

            filename = context.GetDirectoryPath(scoped, levels, makeAppApsolut).add("index", "\\").add(format.getDefaultExtension(), ".");
            //   Console.WriteLine("index: [" + filename + "]");
            return(filename);
        }
        public void scopeInOperation(IRenderExecutionContext context, IMetaContentNested newScope)
        {
            context.directoryScope = Directory.CreateDirectory(context.GetDirectoryPath(newScope, levels));

            setRelPath(context);

            if (context is deliveryInstance)
            {
                deliveryInstance contextDeliveryInstance = (deliveryInstance)context;
                contextDeliveryInstance.unit.blockBuilder.BuildDynamicNavigationTemplates(contextDeliveryInstance, context.data);
            }
        }
        /// <summary>
        /// Builds the include template.
        /// </summary>
        /// <param name="unit">The unit.</param>
        /// <param name="data">The data.</param>
        /// <returns></returns>
        public PropertyCollection BuildIncludeTemplate(deliveryInstance context, PropertyCollection data = null)
        {
            if (data == null)
            {
                data = new PropertyCollection();
            }

            var includeItems = context.unit.includeItems;

            string includePath = "".t(templateFieldBasic.root_relpath);

            //outputRender.SubcontentStart(templateFieldSubcontent.head_includes, false);

            //String relJump = context.directoryScope.getRelativePathToParent(context.directoryRoot);

            outputRender.Clear();

            string url = "";

            foreach (IDeliverySupportFile inc in includeItems[appendLinkType.styleLink])
            {
                url = inc.getRelativeUrl(null, includePath);

                outputRender.AppendLink(url, inc.name, "", appendLinkType.styleLink);
            }

            foreach (IDeliverySupportFile inc in includeItems[appendLinkType.scriptLink])
            {
                url = inc.getRelativeUrl(null, includePath);

                outputRender.AppendLink(url, inc.name, "", appendLinkType.scriptLink);
            }

            data[templateFieldSubcontent.head_includes] = outputRender.ContentToString(true, reportOutputFormatName.textFile);

            outputRender.Clear();

            foreach (IDeliverySupportFile inc in includeItems[appendLinkType.scriptPostLink])
            {
                url = inc.getRelativeUrl(null, includePath);

                outputRender.AppendLink(url, inc.name, "", appendLinkType.scriptLink);
            }

            data[templateFieldSubcontent.bottom_includes] = outputRender.ContentToString(true, reportOutputFormatName.textFile);

            data = BuildNavigationTemplates(context, data);

            return(data);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Compiles the links and template elements in the data table, creates duplicate for output, original is not changed
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <returns></returns>
        public static DataTable CompileTable(this DataTable table, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels)
        {
            DataTable output = table.GetClonedShema <DataTable>();
            int       rc     = table.Rows.Count;
            // IEnumerable<DataRow> rows = table.AsEnumerable().Take(rowsLimit);

            int c = 0;

            for (int i = 0; i < rc; i++)
            {
                DataRow nr = output.NewRow();

                foreach (DataColumn dc in output.Columns)
                {
                    object val = table.Rows[i][dc.ColumnName];
                    if (dc.HasLinks(false))
                    {
                        if (val is string)
                        {
                            if (!val.toStringSafe().Contains("$$$"))
                            {
                                nr[dc] = val;
                            }
                            else
                            {
                                nr[dc] = val.toStringSafe().CompileLinksInTemplate(context, format, levels);
                            }
                        }
                        else
                        {
                            nr[dc] = val;
                        }
                    }
                    else if (dc.HasTemplate(false))
                    {
                        nr[dc] = val.toStringSafe().applyToContent(false, context.data); //.CompileLinksInTemplate(context, format, levels);
                    }
                    else
                    {
                        nr[dc] = val;
                    }
                }

                output.Rows.Add(nr);
            }

            return(output);
        }
        public void Deploy(basicDocumentPageDefinitionSet _context)
        {
            helpContext = _context;

            helpDelivery = new deliveryUnitCompactHelp();
            helpDelivery.setup();
            helpDelivery.SetOutputPath(_context.helpContext.folder);
            //helpDelivery.outputpath = _context.helpContext.folder.path;

            DeliveryInstance = new deliveryInstance(helpDelivery);


            HelpDocumentRootSet helpRoot = new HelpDocumentRootSet();


            DeliveryInstance.executeAndSave(helpRoot, helpContext.helpContext.scopeEntry.name, helpContext.helpContext.scopeEntry.exportPropertyCollection());
        }
        public PropertyCollection BuildNavigationTemplates(deliveryInstance context, PropertyCollection data = null)
        {
            if (data == null)
            {
                data = new PropertyCollection();
            }
            reportLinkCollection logs = context.linkRegistry[reportOutputDomainEnum.logs.ToString()];

            if (logs.Any())
            {
                string str_logs = data.getProperString("", reportOutputDomainEnum.logs);

                if (imbSciStringExtensions.isNullOrEmpty(str_logs))
                {
                    str_logs = logs.makeHtmlInsert();
                    data.add(reportOutputDomainEnum.logs, str_logs);
                }
            }
            return(data);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Gets the link collection
        /// </summary>
        /// <param name="scoped">The scoped.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <param name="makeAppApsolut">if set to <c>true</c> [make application apsolut].</param>
        /// <returns></returns>
        public static reportLinkCollectionSet GetLinkCollection(this IMetaContentNested scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true)
        {
            reportLinkCollectionSet menu  = new reportLinkCollectionSet();
            reportElementLevel      level = scoped.getElementLevel();

            IMetaContentNested linkFrom = scoped;

            switch (level)
            {
            case reportElementLevel.document:

            //metaDocument document = (metaDocument)linkFrom;
            //menu.Add(document.documentTitle, document.GetLinkCollection(context, format));
            //break;
            case reportElementLevel.page:
                linkFrom = scoped.document;

                if (linkFrom != null)
                {
                    metaDocument document2 = (metaDocument)linkFrom;
                    menu.Add(document2.documentTitle, document2.GetLinkCollection(context, format, levels, makeAppApsolut));
                }
                else
                {
                    if (scoped.parent != null)
                    {
                        return(GetLinkCollection(scoped.parent, context, format, levels, makeAppApsolut));
                    }
                }

                break;

            case reportElementLevel.documentSet:

                metaDocumentSet documentSet = (metaDocumentSet)linkFrom;

                menu.AddInGroup(documentSet.documentSetTitle, documentSet.GetServicePageLinkCollection(context, format, levels, makeAppApsolut));

                menu.AddInGroup(documentSet.documentSetTitle, documentSet.GetDocumentSetsLinkCollection(context, format, levels, makeAppApsolut));
                menu.currentItem.GetMainGroup().name = "Report sections";

                foreach (metaDocument docum in linkFrom)
                {
                    menu.Add(docum.documentTitle, docum.GetLinkCollection(context, format, levels, makeAppApsolut));
                }
                break;
            }

            return(menu);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Gets the service page link collection.
        /// </summary>
        /// <param name="scoped">The scoped.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <returns></returns>
        public static reportLinkCollection GetDocumentSetsLinkCollection(this metaDocumentSet scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true)
        {
            reportLinkCollection menu = new reportLinkCollection();

            menu.title       = scoped.documentSetTitle.or(scoped.name);
            menu.description = scoped.documentSetDescription;
            // String parent = context.GetDirectoryPath(scoped, levels);
            foreach (metaDocumentSet pg in scoped.documentSets)
            {
                string path = pg.GetIndexPath(context, format, levels, makeAppApsolut);
                menu.AddLink(pg.documentSetTitle.or(pg.name), pg.documentSetDescription, path.getWebPathBackslashFormat().Trim('/'));
            }
            return(menu);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates collection of links with correct url paths
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <returns></returns>
        /// <exception cref="imbSCI.Reporting.exceptions.aceReportException">CompileLinkCollection - found link with undefined state</exception>
        public static reportLinkCollection CompileLinkCollection(this reportLinkCollection menu, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels)
        {
            if (menu == null)
            {
                return(null);
                //throw new aceReportException(context,"reportLinkCollection sent to metaTools.CompileLinkCollection() was null", aceReportExceptionType.compileScriptError);
            }
            reportLinkCollection output = new reportLinkCollection(menu.GetMainGroup().name, menu.GetMainGroup().description);
            reportInPackageGroup group  = menu.GetMainGroup();

            output.title       = menu.title;
            output.description = menu.description;

            foreach (reportLink link in menu)
            {
                if (link.group != group)
                {
                    var g = output.AddGroup(link.group.name, link.group.description);
                    g.priority = link.group.priority;
                    group      = g;
                }

                reportLink compiledLink = new reportLink(link);

                bool accept = true;

                switch (link.state)
                {
                case reportLinkState.pathIsMetaModelPath:
                    compiledLink.element = context.scope.resolve(metaModelTargetEnum.scopeRelativePath, link.linkPath, null).First();
                    compiledLink.state   = reportLinkState.pathIsUrl;
                    break;

                case reportLinkState.registryQuery:
                    compiledLink.element = ((IHasReportRegistry)context.scope.root).reportRegistry.GetReport(link.registryQuery);
                    if (compiledLink.element == null)
                    {
                        compiledLink.state = reportLinkState.undefined;
                    }
                    else
                    {
                        compiledLink.state = reportLinkState.pathIsUrl;
                    }

                    break;

                case reportLinkState.elementInstance:
                    compiledLink.state = reportLinkState.pathIsUrl;
                    break;

                case reportLinkState.pathIsUrl:
                    // cool
                    break;

                case reportLinkState.undefined:
                    accept = false;
                    throw new aceReportException(context, "CompileLinkCollection - found link with undefined state", aceReportExceptionType.compileScriptError).add(link.linkTitle).add(link.linkDescription);
                    break;
                }
                if (compiledLink.linkPath.isNullOrEmpty() && compiledLink.state == reportLinkState.pathIsUrl)
                {
                    compiledLink.linkPath = link.element.CompileLinkForElemenet(context, format, levels); //path;
                }
                if (compiledLink.state != reportLinkState.pathIsUrl)
                {
                    accept = false;
                }
                if (accept)
                {
                    output.AddLink(compiledLink);
                }
            }

            output.sortup();

            return(output);
        }
Ejemplo n.º 13
0
        public void createNewFile(IRenderExecutionContext context, IMetaContentNested oldScope)
        {
            ITextRender render = sourceRender.outputRender;
            string      ext    = format.getDefaultExtension();

            string filename = (oldScope.name + filenameSufix).getFilename(ext);

            string filepath = context.directoryScope.FullName.add(filename, "\\");

            // String folderPath = context.data.getProperString(oldScope.path, templateFieldBasic.path_folder, templateFieldBasic.document_path, templateFieldBasic.documentset_path);

            PropertyCollection content_blocks = render.getContentBlocks(true, format);
            IMetaContentNested sc             = (IMetaContentNested)oldScope;

            string codeOutput = template;

            try
            {
                IConverterRender cr = (IConverterRender)render;

                reportLinkCollectionSet menu    = new reportLinkCollectionSet();
                reportLinkToolbar       toolbar = new reportLinkToolbar();
                // sc.GetLinkCollection((deliveryInstance)context, format, sourceRender.levelsOfNewDirectory, false);

                // <---------- MENU ----------------------------
                if (oldScope is metaPage)
                {
                    metaPage oldScope_metaPage = (metaPage)oldScope;
                    menu.Add("Document set", oldScope_metaPage.menu_documentSetMenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory));
                    menu.Add("Document", oldScope_metaPage.menu_documentmenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory));
                    menu.Add("Page", oldScope_metaPage.menu_pagemenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory));

                    menu.Add("Root", oldScope_metaPage.menu_rootmenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory));

                    toolbar = oldScope_metaPage.toolbar_pagetools;
                }

                string menuRender = menu.RenderSetAsDropDowns(cr.converter);
                content_blocks.add(templateFieldSubcontent.html_mainnav, menuRender, false);

                // <---------------- TOOL BAR
                if (toolbar != null)
                {
                    if (toolbar.Any())
                    {
                        string toolbarRender = toolbar.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory).RenderAsToolbar(cr.converter);
                        content_blocks.add(templateFieldSubcontent.html_toolbar, toolbarRender, false);
                    }
                }

                // <---------------- LINKS
                // codeOutput = codeOutput.CompileLinksInTemplate(context as deliveryInstance, format, levelsOfNewDirectory);
            }
            catch (Exception ex)
            {
                throw new aceReportException("Auto-menu creation : " + ex.Message + " Automenu creation for " + oldScope.path);
            }

            if (context is deliveryInstance)
            {
                deliveryInstance contextDeliveryInstance = (deliveryInstance)context;
                contextDeliveryInstance.unit.blockBuilder.BuildDynamicNavigationTemplates(contextDeliveryInstance, content_blocks);
            }

            codeOutput = codeOutput.applyToContent(false, content_blocks);// openBase.openFileToString(tempfile.FullName, true, false);

            codeOutput = codeOutput.applyToContent(false, context.data);

            codeOutput = codeOutput.CompileLinksInTemplate(context as deliveryInstance, format, levelsOfNewDirectory);

            codeOutput = codeOutput.Replace("..//", "../");
            codeOutput = codeOutput.Replace(" href=\"/", " href=\"");

            //var savedfile = codeOutput.saveStringToFile(filepath, imbSCI.Cores.enums.getWritableFileMode.overwrite, Encoding.UTF8);

            context.saveFileOutput(codeOutput, filepath, getFolderPathForLinkRegistry(context), description);

            //IDocScriptExecutionContext docContext = context as IDocScriptExecutionContext;

            //docContext.linkRegistry[context.directoryScope.FullName].AddLink(filename, "", filepath);
        }