Open node in Umbraco programmatically - umbraco

I have created a dashboard for an Umbraco site and I want to link from it to various node in the tree.
From what I can tell Umbraco uses editcontent.aspx?id={thenodeid} and javascript:opencontent({nodeid}).
Whenever I try to use these they always fail.
Does anyone know how to open a display a node in the Umbraco back end?

Like Tim Saunders said you really just need to target the correct iframe. The openContent function looks like this:
function openContent(id) {
parent.right.document.location.href = 'editContent.aspx?id=' + id;
}
So you need to target the 'right' iframe.

I've tested editContent.aspx?id=1234 on my Umbraco installation and it seems to work correctly.
I'm assuming you are replacing {thenodeid} with the actual node id you want?
Umbraco uses iFrames in the backend for the content tree and the content areas etc. This means that you do not always have full access to the Javascript libraries from the frame that you are in.
Therefore you may need to either include the library in the page you are working with or try and reference the method calls by walking up the dom.
I can't find any documentation for this so it may be a case of looking at the HTML source and working out what is going on.

Related

How to properly format an image url in a Vue.js single-file-component?

After about a week of tinkering, I have managed to introduce webpack and Vue.js single file components into my existing Orchard (ASP.NET) module.
Now I've unexpectedly hit a snag, and for the life of me, I'm stumped. I have several image resources that are part of my custom Orchard theme, which is a separate module (*.csproj) within my Orchard solution.
So (at the risk of demonstrating my woefully inadequate understanding of URL concatenation in web projects) I innocently add this line to my Vue.js single file component:
<img src="~/Themes/MyOrchardTheme.Theme/Images/AnImage.png">
Now when webpack tries to process this and bundle my component I get this error:
Can't resolve 'Themes/MyOrchardTheme.Theme/Images/AnImage.png' in 'redacted' C:\Projects\Orchard\Modules\redacted\Module not found
This kind of makes sense, because the layout of my projects and resources locally and the layout after deployment to Azure obviously differ.
So what is the right way to specify the url for my image as it will exist at runtime on the server, without specifically testing for it's existence when transpiling with webpack?
I'm not going to accept this as the answer, in case someone can offer something better, but after some tinkering I was able to solve my problem by using this:
<img :src="theimage" />
and adding a computed property like this:
computed: {
theimage: function () {
return '/Themes/MyOrchardTheme.Theme/Images/AnImage.png';
}
This will bypass the Webpack transpiler (or vue-loader or whatever) check to make sure the resource can be located and has the added benefit that I can programmatically control the image displayed, which (although not mentioned) is ultimately what I wanted to do (code not shown). I was expecting to use v-if or v-show with multiple image tags, but using a computed property killed two birds with one stone.
Thanks to everyone who provided feedback. - I have a great deal to learn!

Change help link in the Visual Editor of MediaWiki

Is there a way to change the help link in the toolbar dropdown in the new visual editor of MediaWiki?
I tried setting
"visualeditor-help-link":"mw:Help:VisualEditor/User guide/de"
in
"extentsions/VisualEditor/modules/ve-wmf/i18n/de.json"
as proposed here, but then my MediaWiki could not parse the JSON file. My goal is to link to the MediaWiki help page, that can be found here. The normal version:
"visualeditor-help-link":"[https://www.mediawiki.org/wiki/Help:VisualEditor/User_guide/de]"
did not work, neither did this:
"[[{{MediaWiki:visualeditor-helppagelink}}|Hilfe]]"
You should never ever change the source code of MediaWiki core or any extension. It makes an upgrade process much more hard and complicated. There are other ways to achieve a high customization of the user interface language :)
For your problem, it should be enough to create the following page in your wiki (like any other page, but you need the editinterface user right, which is assigned to sysops by default):
MediaWiki:visualeditor-help-link
Put the link you want to use into the textarea (without any wikitext, e.g. "Help:VisualEditor" (without any ")) and save the page.
After reloading the VisualEditor (maybe you need to clear your browser's cache using Ctrl + F5) the link should point to the new target you specified in the message above. If you use a message cache, it is maybe needed to rebuilt it.

Drupal 7: Dynamic first segment of a path with Panels

I am working to create dynamic landing pages for a site, using panels. The first step in the process is to designate the path. I want the landing pages to have the same path as the nodes, just ending in "home" for the landing page. For example, I have "departments" that will have landing pages, so the path looks like:
department/%department_name/home
That works fine. However, I am also trying to create a series of paths based on a set of vocabularies. They all have different names, but they work essentially the same. I want this:
%vocabulary/%terms/home
But then I get this error:
"The first element in a path may not be dynamic."
Why not? I don't want to have to create variants for each vocabulary. Isn't there some way to by-pass this error?
Thanks!
You cannot by-pass this error. Drupal's menu system simply does not support % as the first placeholder.
See an explanation at a related Drupal.org discussion.
A simple solution here is to use a generic static argument for the whole site (like site, live, new etc) as a starter path. Some developers also use this by default so they can alter it later on upcoming versions or on new functionality (for example they may have path /a/%some_args and a new version will be /b/%some_args).

Automatic Typing Textarea/input/form in JavaScript

I've been searching for a way to make a textarea type inside of itself. Unfortunately, even with some google searching, I still don't have a clue? Do you guys know where to start with this?
http://lmgtfy |dot| com is an example, but I'm not sure if they use some other technique...
The lmgtfy people are simply using javascript to change the value of the input. Here is a simple jsfiddle showing the same thing:
http://jsfiddle.net/Caut6/1/
LMGTFY uses javascript. If you visit the site using chrome or some other browser with a debugger, you should be able to pause javascript execution and check out how they do it, then roll or copy your own version.
In Chrome, the pause button is under the Scripts area. Their bundle.js files appears to host the JS you are looking for, it is around 1000 lines of code, but you should be able to see the few functions you need to borrow their implementation.
Hope this helps.

FireFox 6: implementing nsIProtocolHandler

Has something changed in Firefox 6 so I can no longer add my nsIProtocolHandler (and nsIChannel) implementation from an add-on just by registering it under a contract like #mozilla.org/network/protocol;1?name=myscheme?
I've checked all the interfaces I use if any changed (judging by a new
UUID), but I don't get a call to my getFactoryProc I list in NSModule,
like I did before.
Do I need to add a category (like http-startup or something?) or is
something else wrong?
(the code that worked in firefox 3.6 is still here I haven't committed
the new code yet...)
Update: I've logged this as a bug.
Update: Okay, I figured this out. See https://bugzilla.mozilla.org/show_bug.cgi?id=656331. Basically you need to export the right kVersion value in your module or the library will be unloaded immediately after it is loaded (i.e. the behavior you are observing). This behavior is new as of Firefox 5.
If you haven't updated to Firefox 4 yet then you need to change the way that you register your XPCOM component. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0. The sections on JS components or binary components are relevant depending on whether your component is implemented in JS or C++.

Resources