Esempio n. 1
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);
        }
Esempio n. 2
0
        /// <summary>
        /// Renders the set as drop downs.
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="converter">The converter.</param>
        /// <returns></returns>
        public static string RenderSetAsDropDowns(this reportLinkCollectionSet menu, converterBase converter)
        {
            StringBuilder output = new StringBuilder();

            foreach (var pair in menu)
            {
                if (pair.Value.Count() > 0)
                {
                    output.AppendLine(pair.Value.RenderAsDropdown(converter));
                }
            }
            string outstr = output.ToString();

            return(outstr);
        }
Esempio n. 3
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);
        }