public override void prepareOperation(IRenderExecutionContext context) { string output_path = outputpath.toPath(context.directoryRoot.FullName, context.data); var pc = context.theme.AppendDataFields(context.data); base.prepareOperation(context); string output = template.applyToContent(false, context.data); output_fileinfo = output_path.getWritableFile(getWritableFileMode.overwrite); //output.saveStringToFile(output_fileinfo.FullName, getWritableFileMode.overwrite); // = output.saveStringToFile(output_path, imbSCI.Cores.enums.getWritableFileMode.overwrite); context.saveFileOutput(output, output_fileinfo.FullName, "css", description); }
public override void reportFinishedOperation(IRenderExecutionContext context) { // setRelPath(context); string filepath = outputpath.toPath(context.directoryRoot.FullName, context.data); string dirpath = Path.GetDirectoryName(filepath); DirectoryInfo dirinfo = new DirectoryInfo(dirpath); string rootrel = dirinfo.getRelativePathToParent(context.directoryRoot).getWebPathBackslashFormat(); if (rootrel == "/") { rootrel = ""; } context.data.add(templateFieldBasic.root_relpath, rootrel); string spath = outputpath.toPath(context.directoryRoot.FullName); string scontent = ""; if (hasRender) { scontent = logRender.ContentToString(false, reportOutputFormatName.textMdFile); } else if (log != null) { scontent = log.logContent; } else { scontent = logStatic; } context.saveFileOutput(scontent, spath, reportOutputDomainEnum.logs, description); // scontent.saveStringToFile(spath, getWritableFileMode.overwrite, Encoding.Unicode); if (templateOutput != null) { string tpath = outputpath.toPathWithExtension(context.directoryRoot.FullName, templateOutput.format.getDefaultExtension()); FileInfo tfile = templateOutput.saveOutput(context, scontent, context.data, tpath); context.regFileOutput(tfile.FullName, reportOutputDomainEnum.logs, description); } }
/// <summary> /// Prepares the operation. /// </summary> /// <param name="context">The context.</param> public override void prepareOperation(IRenderExecutionContext context) { base.prepareOperation(context); context.data.add(templateFieldBasic.root_relpath, ""); if (isDataFieldMode) { context.data.add(output_datafield, ""); } if (!isDataFieldMode) { PropertyCollection pc = new PropertyCollection(); pc.AppendData(context.data, existingDataMode.overwriteExisting); // pc.add(templateFieldBasic.root_relpath, //pc.AppendData(dict[composer.path], existingDataMode.overwriteExisting); pc.add(templateFieldBasic.page_title, name); pc.add(templateFieldBasic.page_desc, description); pc.add(reportOutputDomainEnum.includes, ""); pc.add(reportOutputDomainEnum.localdirectory, ""); pc.add(reportOutputDomainEnum.logs, ""); string filepath = outputpath.toPath(context.directoryRoot.FullName, context.data); string dirpath = Path.GetDirectoryName(filepath); DirectoryInfo dirinfo = new DirectoryInfo(dirpath); string rootrel = dirinfo.getRelativePathToParent(context.directoryRoot).getWebPathBackslashFormat(); if (rootrel == "/") { rootrel = ""; } pc.add(templateFieldBasic.root_relpath, rootrel); string output = template.applyToContent(false, pc); if (templateOutput == null) { context.saveFileOutput(output, filepath, context.scope.path, description, name); } else { pc.add(templateFieldSubcontent.main, output); output = templateOutput.template.applyToContent(false, pc); filepath = outputpath.toPathWithExtension(context.directoryRoot.FullName, templateOutput.format.getDefaultExtension()); context.saveFileOutput(output, filepath, context.scope.path, description, name); //FileInfo fi = templateOutput.saveOutput(output, context.data, filepath); //context.regFileOutput(fi.FullName, context.scope.path, description, name); } } else { context.log(name + " :: data field application the item: " + GetType().Name); } }
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); }