如何为所有 Cognos 10 报表创建全局样式?
我的团队一直致力于创建仪表板和钻取报告。我们已经过了概念验证阶段,现在正在努力构建“生产就绪”报告。在我们的会议中,有人提出应该更改 Cognos 默认设置的报告整体样式。
我们开始了解 Cognos 的皮肤系统。我们看到报表显示和门户中使用的门户和 UI 元素有皮肤。这不一定是我们想要的。我们理想地希望能够更改公司品牌的门户并更改列表和交叉表的外观(以及实际报告的其他元素)。
我能够查看为报告生成的页面源,发现它包含来自以下位置的样式:
cognos\c10_64\webcontent\schemas
在浏览 webcontent 目录时,我还发现了此路径:
cognos\c10_64\webcontent\reportstyles
这两个路径都包含具有相似名称的 css 文件。报告 HTML 包含的样式指向“schemas”目录,但是我的逻辑思维自己愿意相信“reportstyles”目录在 Cognos 报告显示中的某个位置使用,即使我没有看到它包含在任何页面源中我看过。
我已经开始使用包含的 css 文件的系统对“模式”路径中的 css 进行修改,将其中的 css 复制出来并将其放入“xxx_system.css”文件中,然后将该文件包含在原始CSS文件。
这个过程有效,我们能够看到变化,但我们仍然想知道是否有更好或“更正确”的方法来做到这一点。任何人都可以详细说明对实际报告进行皮肤/样式设置的最佳方法吗?
My team has been working with creating dashboards and drill-through reports. We've moved past our proof-of-concept phase and are now working to build the "production ready" reports. In our meetings it has been brought up that the overall styles for the reports should be changed from the Cognos defaults.
We became aware of Cognos's skin system. We saw that there was skinning for the portal and UI elements that are used within the report display and portal. This is not necessarily what we wanted. We ideally wanted to be able to change the portal to company branding AND change the way lists and crosstabs looked (as well as other elements of the actual report).
I was able to look at the page source generated for a report and saw that it is including styles from:
cognos\c10_64\webcontent\schemas
While poking around the webcontent directory I also found this path:
cognos\c10_64\webcontent\reportstyles
Both of these paths contain css files with similar names. The included styles for the report HTML point to the "schemas" directory, however my logical thinking self would like to believe that the "reportstyles" directory is used somewhere within the Cognos report display even though I have not seen it included in any page source I have viewed.
I have begun making my modifications to the css in the "schemas" path using a system of taking the included css file, copying the css out of it and placing it into a "xxx_system.css" file, and then including that file in the original css file.
This process works and we are able to see the changes, but we are still wondering if there is a better or "more correct" way of doing this. Can anyone elaborate on the best way to skin/style the actual reports?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我定制 UI 的方法明显不同 - 想象一下我进入一家公司,他们已经做了同样的事情 6 年多了,我想开始改变周围的一切。但遇到了一些阻力,所以我希望我的经验可以帮助您入门。
我拥有强大的基于 UI 的背景,并且立即想将我的知识贡献给我们正在设计的报告。这需要机智,因为我想展示精心设计的 UI 的价值,而不会让每个使用它的人感到震惊/害怕(改变逆境等)。我通过在报告中工作来处理这个问题,而不是在 Cognos 文件本身上。
当你开始使用核心文件的那一刻,无论它们是 CSS、Javascript 还是 CGI 本身,都会立即面临明显的风险,即升级时会完全崩溃。我通过在报告中创建 HTML 项目并从那里调用资源来解决这个问题。例如,这个 HTML 项目几乎存在于我的报告的每个标题中:
所以现在我可以访问 jQuery、UI 框架和其他所有内容。我在
custom.css
中指定覆盖并从那里构建我的外观。这可能看起来很麻烦,但 IBM 有升级主要版本并完全消除命名约定和功能的诀窍,因此如果您的 CSS 选择器关闭,它会“默认”为 IBM 的原始样式。这就是我必须解决的方法,但我不确定这是否是最好的方法。我一直在使用我所拥有的东西,即无法访问服务器文件或类似的东西。只是认为这是一种超级安全的方法。
My approach to customizing the UI is significantly different - imagine me coming into a company where they've been doing the same thing for 6+ years and I want to start changing everything around. It was met with some resistance, so I hope my experience can help you get started.
I come from a strong UI-based background and immediately wanted to contribute my knowledge to the reports we were designing. That required tact, as I wanted to show the value of a well-designed UI without shocking/scaring everyone that uses it (change adversity and the like). I handled this by working within the reports, not on the Cognos files themselves.
The minute you start working with the core files, whether they be CSS, Javascript, or CGI itself, there's an immediate and glaring risk that it will entirely break on upgrade. I got around this by creating HTML items in my reports and calling resources from there. For example, this HTML item is in virtually every header of my reports:
So now I've got access to jQuery, the UI Framework, and everything else. I specify overrides in my
custom.css
and build my look from there. This might seem cumbersome, but IBM has a knack for upgrading major versions and completely wiping out naming conventions and functions, so if your CSS selector is off, it "defaults" to IBM's original style.This is just how I've had to get around it and I'm not sure entirely that it's the best way. I've been working with what I have, which is no access to the server files or anything like that. Just consider this a super-safe approach.
我现在正在使用 Cognos 10.1,并准备发布。我处理安装、配置和任何调整的方式是自动构建/配置过程,从版本控制系统中提取数据。这样,即使在升级时,我也不会丢失任何自定义,并且可以轻松合并升级中的更改。
I'm working with Cognos 10.1 now and getting ready for launch. The way I'm handling the installation, configuration and any tweaks is the an auto build/configure process that pulls data from a revision control system. This way even when upgrading I don't loose any customization and can easily merge in changes from the upgrade.
您完全可以使用支持的 Cognos 皮肤系统来更改交叉表和列表的外观和风格。我为前任雇主对 Cognos 进行了全面的外观和感觉检修,其中包括更改动态元素的外观。
如果您查看 GlobalReportStyles.css 中的默认样式,您会发现所有这些样式都可以在皮肤中的自定义 CSS 文件中覆盖。该方法比直接修改 GlobalReportStyles.css 更安全,因为升级不会修改自定义皮肤目录,但全局样式表肯定会修改。
不幸的是,您无法确定通过皮肤工具创建的任何修改在不同版本中都会以完全相同的方式呈现。 Cognos 可以重新排列 UI 或调整总体外观,足以破坏您的更改。然而,这是我所知道的对默认 Cognos 对象有效创建通用、自动外观和感觉修改的唯一方法。
You can absolutely change the look and feel of crosstabs and lists using the support Cognos skinning system. I've done a complete look-and-feel overhaul of Cognos for a previous employer which including changing the way dynamic elements looked.
If you look at the default styles in the GlobalReportStyles.css, all of these styles can be over-ridden in custom CSS files in your skin. That method would be safer than modifying the GlobalReportStyles.css directly as a custom skin directory will not be modified by an upgrade but the global stylesheet surely will be.
Unfortunately, you can't be certain that any modifications you create via the skin facility will render exactly the same way from version to version. Cognos could rearrange the UI or tweak the general appearance enough to break your changes. However, this is the only way I know of to effectively create universal, automatic look and feel modifications to the default Cognos objects.