public static string GetOutputPath(this IMetaContentNested scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true)
        {
            string filename = ""; // context.data.getProperString("", templateFieldBasic.path_file);

            if (scoped == null)
            {
            }
            string filename_withExtension = scoped.name.add(format.getDefaultExtension(), ".");

            filename = context.GetDirectoryPath(scoped, levels, makeAppApsolut).add(filename_withExtension, "\\");
            //   Console.WriteLine("file: [" + filename + "]");
            return(filename);
        }
Beispiel #2
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);
        }