Dynamically setting the URL in a wicket link - dynamic

I have hard-coded the link destination URL in the below link.
I need to re-factor the code so that the URL is set dynamically (reading it from a property file) Any one has an idea how to achieve that in wicket?
Thank you.

You can use org.apache.wicket.markup.html.link.ExternalLink in your Java code. Its model can read/load it from anywhere you need.

This is possible without the need for any Java code.
Given a properties file with a key for the url and the links label:
url = http://www.stackoverflow.com
label = Help me!
One can simple use Wicket message system:
<a wicket:message="href:url"><wicket:message key="label" /></a>
Tested with Wicket 6.19.0
In the Wicket guide: Reading bundles with tag <wicket:message>

Related

django-cms TemplateDoesNotExist INHERIT

I installed django-cms and configured it according to the documentation.
The site comes up, but when I try to add a page I get an error:
TemplateDoesNotExist: INHERIT
I don't specify INHERIT as a template anywhere. It's finding my template directory ok, but I have no template named INHERIT and I don't know where that request is coming from.
Any help is greatly appreciated.
Can you check your TEMPLATES settings.
Looking through the source code:
By default template for a page set here:
TEMPLATE_DEFAULT = ... get_cms_setting('TEMPLATES')[0][0]
Source:
https://github.com/divio/django-cms/blob/develop/cms/models/pagemodel.py#L41
https://github.com/divio/django-cms/blob/develop/cms/models/pagemodel.py#L77
And looking through source code in utils/conf.py. A template named 'INHERIT' is added to list of available templates. And it looks like you own templates are not registered correctly and therefore the 'INHERIT' template is first item in the list.
https://github.com/divio/django-cms/blob/develop/cms/utils/conf.py#L99
https://github.com/divio/django-cms/blob/develop/cms/utils/conf.py#L136
I had failed to set the CMS_TEMPLATES as directed in the tutorial. (Actually, I had - but gremlins removed it).

dojo internalize html templates

When using filter and pagination plugins for EnhancedGrid, the HTML templates for the same are loaded from dojox\grid\enhanced\templates.
Is there any way by which I can avoid the server requests for these HTML files by making them part of the Enhanced Grid's inline javascript?
You should make a custom dojo build that creates one js file as a result. follow this instructions from a previous QA:
How to build Dojo into a single file, given a list of dependencies?
EDIT:
The build should add those html files inline, but doesn't. I googled a bit and found this link related to your problem:
http://grokbase.com/t/dojo/dojo-interest/121e536t64/enhancedgrid-filter-problem
It suggests a fix using this link
http://dojo-toolkit.33424.n3.nabble.com/Custom-build-including-CSS-and-HTML-files-td3536573.html
Citation:
If you are using the AMD style of module definition, then you can specify a text dependency like so:
define(["dojo/text!some/file.html", "other/module"],
function(template, otherModule){
...
// to use the contents of the html file, treat template as if it were a normal string
someNode.innerHTML = template;
...
});
The build system should automatically convert the text dependency to an inline string literal. Most Dojo files are already formatted to use this feature, but I can't account for dojox modules. I'm not sure whether similar functionality is possible with the dojo.require/dojo.provide system of dependency declaration.
I have got the solution. Those struglling from this issue pls. note that there is bug with Dojo 1.7.1 and we need to use Dojo 1.8.3 and use internStrings option with the build command. You should see HTML files being interned in the build-report.

Is it possible to get the absolute URL of an image that is called by CSS in Selenium IDE?

I am wondering if it is possible (but I have a hunch it's not..) to retrieve the absolute URL of an image that is loaded by a specific CSS class.
For example:
<div class="rabbit">
rabbit in css has a background image... how do I get that background image URL?
The reason why I ask on how to do this in Selenium IDE is because in my company we use it.
I am still googling and since I am not very proficient at JS, I could easily be missing a simple solution!
here's a quick pointer
You'll need to use storeEval to run some js and store the value, so look at the Selenium IDE docs for that
Then the js will be something like this...
getComputedStyle(document.getElementById('hireme'),'').getPropertyValue('background-image');
if you run the snippet above, in the console on this page you should get something like this...
"url(http://careerscdn.sstatic.net/careers/gethired/img/careers2-ad-header-so-crop.png)"
Which will hopefully be good enough for any asserts you want to make
You'll need to replace the document.getElementById('hireme') with document.getElementsByClassName('rabbit')[0];
Hope this helps, use comments if you need any clarification.
You may also need to add this.browserbot.getCurrentWindow(). before the call to document.getElementById

Dojo 1.8: Seems that there's no way to load dojo file into contentpane, is it?

Hi I have tried every ways and means to load dojo page into ContentPane.
It seems That I am not able to do that. Correct me if I am wrong.
Looks like the only solution is through the creation and destroy of any widget while running
Clement
The dojo docs for dojox/layout/ContentPane (which allows references to script files) mentions your issue:
NOTE that dojo.require in script in the fetched file isn't recommended Many widgets need to be required at page load to work properly
#see http://dojotoolkit.org/api/1.8/dojox/layout/ContentPane
It looks like you just need to require these files in the parent widget.

Change default Path on Telerik Upload component

The Objective:
Set a different path by default on my Telerik Upload component.
The Problem:
The path should be like "\\Server\Folder" and the porperty ScriptFilePath requires a path starting with ~/. I was looking telerik tutorials but ther's no help about that.
The Code: View
C# MVC3
#(Html.Telerik().Upload()
.Name("attach")
.Multiple(false)
**.ScriptFilesPath("~/")**
.Async(async => async
.Save(Actions.FileLoader_GetFile, Controllers.FileLoader)
.Remove(Actions.FileLoader_Remove, Controllers.FileLoader)
.AutoUpload(true)
))
According with Teklerik, it is not posible.
Is not possible to set a "default' directory for the <input type='file' /> html element, this is restriction by the browsers and there is no way to workaround it.
I suppose that this restriction makes sense since there is no guarantee that the folder set as default for the upload will exist on the given client.