Based on this snippet (http://openntf.org/XSnippets.nsf/snippet.xsp?id=oneui-on-the-fly-theme-changer) I tried to calculate the theme depending on the release of Domino. I'd like to use "oneuiv2.1" on Domino<9 and "oneuiv3.0.2" on a 9 release.
EDIT: To be clear: I already can identify the version, the question is about calculating and setting the theme at the right time as my following approaches seem to do the work too late. The page renders and then the theme is set - however this is my impression.
These were my first approaches:
Calculate the theme name in the "extends" property of the theme - didn't work.
Calculate and set the value of the session property "xsp.theme" in a beforeRenderResponse and beforePageLoad event of my Xpage - this also failed
Set up a bean to calculate the value and set the session property when the bean is initialized - same result
Of cause you can calculate (render) all the needed stylesheets and scripts of OneUIv2.1 and OneUIv3 in the theme file but hey, this is quite a hassle with that amount of resources, isn't it?
So my question is: do you have any other ideas how to achieve this? This would be very handy to use if your applications can use both themes with the same layout, independent where the application runs - whether on a 8.5.x or 9 machine.
Looking forward to the discussion :-)
You can change theme on beforePageLoad event:
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
beforePageLoad='#{javascript:
var theme = session.getNotesVersion().startsWith("Release 8") ? "oneuiv2.1" : "oneuiv3.0.2";
if ( ! theme.equals(context.getSessionProperty("xsp.theme"))) {
context.setSessionProperty("xsp.theme", theme);
context.redirectToPage(context.getUrl().toSiteRelativeString(context));
}
}'>
The trick is to set session property "xsp.theme" and to redirect to same page if theme has to be changed.
redirectToPage() will happen only one time per session as Notes version won't change during session.
If you use Extension Library you can do this to look for the version of Domino:
#Left(com.ibm.xsp.extlib.util.ExtLibUtil.getExtLibVersion(), 3) == "8.5")
Related
I am developing a Xamarin Forms app using App Shell.
I found that I had to handle android hardware back button in AppShell.xaml.cs for a ShellContent Page, instead of ShellContent Page.
protected override bool OnBackButtonPressed()
{
//Get currernt shell content and call its method
//like (Shell.Current.Content as MyContentPage).MyMethod();
}
1) How can I obtain current Shell Content Page reference in AppShell.xaml.cs?
2) How can I change current Shell Content Page programmatically without routing ?
Best regards.
It took quite a bit of digging, but I found a public Shell interface that meets this need. If you cast your ShellSection as an IShellSectionController you can use the PresentedPage property get the current Page object. Below is a code snippet, YMMV.
(Shell.Current?.CurrentItem?.CurrentItem as IShellSectionController)?.PresentedPage
I know this is a bit of a late answer, but I noticed that now there is a simpler solution than the solutions presented at the moment:
Shell.Current?.CurrentPage;
In my case,I had bottom tabs with shell and wanted to get values from a tab when on a different tab, I modified #Nick W answer to achieve that using:
(Shell.Current.CurrentItem.Items[0] as IShellSectionController).PresentedPage
where index 0 refers to the first page in the Tabbar collection.
I need to change the option names in the "Format" menu in CKEditor. For instance, I want to change "Normal" to "Paragraph".
I understand that one way to do it is to edit the language file (en.js). But I don't want to mess up the original sourcecode because it will make the upgrade to a future version much harder.
I tried to change the value CKEDITOR.lang.en.tag_p at runtime before initializing the editor:
CKEDITOR.lang.en.tag_p = "Paragraph";
CKEDITOR.replace(...);
It didn't work because the language file is not loaded at this point (lang.en is undefined).
I also tried to use event handlers (instanceLoaded and loaded) - no success.
Changing the language values on instanceLoaded seems to be too late. It still shows the default values in the menu.
And loaded event never fires for some reason.
I found a solution that involves overriding CKEDITOR.plugins.load, but I think it's too much for such a simple task.
Is there a simple and elegant way to do that?
I found the following solution: load the English language file before creating editor instance, and update it using callback once it is loaded.
CKEDITOR.lang.load("en", "en", function() {
CKEDITOR.lang.en.format.tag_p = "Paragraph";
CKEDITOR.lang.en.format.tag_h2 = "Header";
CKEDITOR.lang.en.format.tag_h3 = "Sub-Header";
});
// Init editor here
I personally don't like it, but it's the best I could do.
I've seen alot of examples of how to include modules on a custom joomla! component using JModuleHelper::getModules, however, when trying to include modules in a custom position, the array come back empty. Here's my code in my component's template:
<?php
jimport('joomla.application.module.helper');
$modules = JModuleHelper::getModules('comwhcustomer');
foreach ($modules as $module){
echo JModuleHelper::renderModule($module);
}
?>
You'll notice the position I'm passing the getModules function is comwhcustomer. This code is returning a blank array. If I pass "footer", I do successfully get the module in the footer position.
I'm using an adapted protostar tempalte and I have added the comwhcustomer position to the xml definition file for the template. I've created the module in module manager and in the position filed, I've selected the "comwhcustomer" position that shows up in the dropdown. On the modules manager page, I see the module listed in the position selected (comwhcustomer). I've confirmed in the database table #__modules that the position is saved correctly.
However, the array is still coming back empty on the getModules call. What am I missing?
Joomla version 3.4.1
Local environment
Windows IIS
PHP 5.4.24
MySQL db
PS - As an alternative, I have sucessfully loaded the module with JModuleHelper::getModule() however, none of the attributes I define in the module manager come over, because they're not supposed to. I'd like to use the method mentioned above so I can control the module behavior from the manager rather than attributes in the code, because this position will be used in multiple views of this component.
This is my first time posting to SO. I do appreciate the support :-)
itoctopus, you were exactly right! The module itself was not assigned to any pages, that's the piece I was not taking into consideration! Thank you so much for your help! I set it to display on all pages and it worked!
Of course, it doesn't show up on all the other pages because they do not contain a position called "comwhcustomer" so it is exactly what I was looking for!
I am trying to set a CMS homepage via a theme's local.xml layout update file in the <cms_index_index> node. I swear I've seen functions to change the store configuration temporarily within a layout node (but maybe I dreamt it), but I'm having trouble finding the layout function in classes like Mage_Core_Block_Abstract and its children classes.
For reference, I've checked in Mage_Cms_IndexController and found the function which renders the homepage:
public function indexAction($coreRoute = null)
{
$pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE);
if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
$this->_forward('defaultIndex');
}
}
Or, am I doing this completely the wrong way? What would be best practice for a problem like this? I do not want to add a store view for the new theme, as the new theme is for mobile platforms and requires the same settings from the store view. Thanks guys!
This is not possible. The layout configuration is not invoked until after checks occur to see if there is a valid page which has been specified; because these checks fail, the Default router will match and (by default) the application will display the 404 page.
I am using DevExpress controls in a winform app I am building for internal use. My app has about 30 forms in total and I am trying to figure out a way to allow my user's to select a theme. I have seen this mentioned here at SO multiple times in answers to other posts.
I understand how the StyleController works, I believe, but what I am wondering is how I can use 1 Style controller for the whole app.
Right now I am trying to create 1 StlyeController at the Shell form and then pass a reference to it to each child form. From there I then have to programatically set the StyleController property for each control. I don't mind I just wonder, especially from those who have done this, if there is a simpler way?
It is very simple. This example is assuming that you are using skins.
In the constructor of your main form calls:
DevExpress.Skins.SkinManager.EnableFormSkins();
This will enable your form to use the current skin. It is also important that each of your forms derived from XtraForm.
After that you need to setup the global look and feel object for your application:
//This set the style to use skin technology
DevExpress.LookAndFeel.UserLookAndFeel.Default.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
//Here we specify the skin to use by its name
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Black");
If you want to set the look and feel of your application like Office 2003, the setup is different. You just have to call the following function:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style();
So, every control of devexpress will use these settings to paint themselves. It is possible to specify a custom LookAndFeel object for some controls but I never used it because I dont see the point to have a custom display for a control or a form.
Exception:
There is one exception in Devexpress framework. The NavBarControl does not use the skin technology automatically from your global LookAndFeel object, you need to specify a setting to enable that:
//To use the current skin
youNavBarControl.PaintStyleName = "SkinNavigationPane";
//To use the current look and feel without the skin
youNavBarControl.PaintStyleName = "NavigationPane";
With version 11.2 I used the information in this article:
http://www.devexpress.com/Support/Center/p/K18013.aspx
In summary :
* Inherit all your forms from XtraForm
* Leave look and feel settings default so that they use the default skin
* Modify the default skin with the following line of code:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "DevExpress Dark Style";