How to create ContentPart in orchard cms theme? - c#

I am trying to design an orchard theme in which i need to attach some Content Part to MenuItem to add some extra info for that.I did the process of adding part as i do inside module ,but strangely enough my view didn't get displayed.after hour's of debugging i figured out that my part's editor shape (eg:Parts_MenuItemMetaPart_Edit) is added to ShapeTable of my frontend theme rather than admin theme(TheAdmin) and thus my attached part editor not displayed.so is there any possibility to create a content part from within theme?if yes, how ?

Just found this link : https://github.com/OrchardCMS/OrchardDoc/blob/master/Documentation/Add-Custom-Settings-to-your-Theme.markdown
from the link above :
... You may be wondering why we don’t just use a driver like we usually do for a parts editor template. This is due to the fact that to call the Editor method of your Driver and return a shape, you need to have specified in the Placement.info that you want to do that. Since this theme is not active in the admin section of Orchard, our themes Placement.info file is never run hence a Driver would never display anything...
So the solution is to add ActivatingFilter in ContentPartHandler like this :
Filters.Add(new ActivatingFilter<MyPart>("Site"));
for more info follow the link provided.

Related

VSIX extension that creates a .cs file in the current project when a button is pressed

In short, im creating a Visual Studio extension in c# that enables non-automation testers to create automation scripts for web based solutions (using selenium).
We've created a template already for users that lays out the project file structure (test runners etc) and im using windows forms toolbox controls to create the dialogue windows where they will enter things like URls, Xpaths, page names etc etc
My question is this;
How on earth do i go about creating .CS files dynamically based on their inputs in these toolbox windows?
The simplest (he says) window i have is one that simply allows them to enter a URl and a webpage name. When they click the 'ok' button on this window, it should create a new .CS file with the webpage name as the class name, the url as a string that the webdriver can use to kick off the test and a few other bits and pieces as a template for them to start adding web elements to.
Any guidance would be greatly appreciated, there seems to be precious little around the web about creating VS extensions!
You got a few options here.
Typically, most people would do this by implementing a custom project item template, along with a custom IWizard based wizard associated with your template.
If you are displaying a modal UI from your IWizard.RunStarted, you can simply populate the ReplacementsDictionary with the text gleaned from your custom UI, which would then be swapped for the tokens in your templatized .cs file.
Or you could programmatically add code to the file after it was generated and added to the project (admittedly a much uglier and more difficult to code).
And finally, you could just generate the file in the project directory, and programmatically add it after the fact.
There's a number of old blog articles from the archived VSX Arcana blog that you might also find helpful.

Content of webpage doesn't display in Module in DotnetNuke

I am new in DotnetNuke. So, first of all I don't know all terminology. My problem is content of Webform.aspx doesn't display in Module.
Let me describe the steps so it can be easy to track the missing steps if any.
1- Created a project of DotnetNuke 7 C# Compiled Module. Path:
F:\website\dnndev.me\desktopmodules\DNNModule2
2- Added a WebForm1.aspx and add a line "Hello World"
3- Build project, DNNModule2_00.00.01_Install.zip is generated in
F:\websites\dnndev.me\DesktopModules\DNNModule2\DNNModule2\install
4- Added extension in http://www.dnndev.me/Admin/Extensions. It added
successfully in Modules.
5- Created New Page and added DNNModule2 by drag and drop. But it
doesn't display content "Hello World" of WebForm1.aspx.
Do I need to set any property while I am adding Module in New WebPage?
Also suggest if my flow is wrong. I will be happy to improve.
Thanks
For a DNN module to work properly you need to work with an .ascx user control. Typically these will inherit from the PortalModuleBase class. There are a few options, but that is the most common.
.aspx pages themselves can exist in DNN, however, they are ONLY available if you access them directly, and not through the module process.
Your user control, when setup should be part of the .dnn manifest and referenced with a <controlkey/> value. (As in no control key defined, to be the default view of your module.)
If you are not using a template, this one is a great example.

Windows 10 Cordova/Ionic link makes phone open store link

I'm using the default template and generated code from the template (Cordova Multiplatform Template 1.0.2). However when I tap a list item this messagebox shows up instead of navigating:
Found the answer here
Partial pages don't load?
When you are using the AngularJS routing module (Ionic starter templates often use this module), you may need to include a call to aHrefSanitizationWhitelist.
If you see the dialog box shown here, you have likely run into this
issue.
Typically, you include the code fix in app.js or wherever you are
calling your module configuration code:
.config(function ($stateProvider, $urlRouterProvider, $compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|ghttps?|ms-appx|ms-appx-web|x-wmapp0):/);
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|ms-appx|ms-appx-web|x-wmapp0):|data:image\//);

How to add new tab in CMS desk in kentico cms

How can I add new tab in CMSDesk -> content -> Page
position is showing in below image in red section.
I was trying to add this by adding new element in Development -> Modules -> user interface section.
but not getting module name for this section.
Any help is appreciate.
Thanks
I will presume you are using Kentico CMS v7. (The situation is different in v6.)
If I understand it correctly you want to add one more level of tabs UNDER Page tab. It is possible although I strongly don't recommend it. I would rather add a tab NEXT to Page, Design etc. by simply adding UI element CMSSitemanager->Development->Modules->Content->User Interface->Content->View mode->Edit. But if you want answer to you question I will provide you with it :) You will need to customize logic in
CMSDeskPage.GetDocumentPageUrlInternal(...)
The code file is located at CMSSolution\UIControls\Pages\CMSDesk\CMSDeskPage.cs
There is a switch with case "edit" - this is the place determining which page will be displayed under the Page tab. You will have to create one more layer of pages (frameset with tabs and content). You will also have to create JavaScript layer to ensure proper communication between frames. (Scripts I'm talking about are: tree.js, contenteditframeset.js, content.js, splitview.js).
Once again - use the UI Elements version mentioned above :)

How to change Asp.net Theme via Web.Config on the fly

Summary
I have a web-application with more than 5 themes. Each themes covers a completely different style for different customers. whenever we publish a new version of our application we send it for all of customers.
The problem.
We specify theme in web.config file in <Page> tag. like
<page theme="Theme1" /> // or Theme2 for second customer.
with this approach we easily change the style of application from each other without writing codes which needs a new publish for each one.
With changing the theme="Theme1". nothing change and we didn't write a code in application , so why changing theme don't change the theme and we need a new publish?
we want to change it in web.config or somewhere else and with changing it the theme change without needing a new publish for each one.
Update :
I Publish Once and then copy the published version for each customer (5 times) then in each web.config file I change the theme="CustomerTheme". but only the theme which was active in publish process is usable in all of 5 versions and other 4 themes are un-usable
--
Actually the main question is that why changes in Web.Config need a different publish while it is XML and do not need a complie. I should Add this note that, App_Theme include all of 5 themes so that all of them Compiles and are ready to use
--
This is the way I publish the application
Photo Link
Update 2
here IFound the exact problem reported by someone else. he resolve the problem but I can't underestand how he resolved this Issue. can anybody tell me how he resolved the issue?
he used aspnet_compiler command and told that automatically ADDS the 'theme' on the Page directive
(first post is the question and the last post is the answer)
http://bytes.com/topic/asp-net/answers/495850-themes-web-config
If I understood you correctly, you have one theme for each customer and that will not change?
Still, I do not understand your publishing scenario? Why do you want to change the Theme if each customer has its own web application?
Nevertheless, how about you check the request url in the codebehind and set the Theme Name programatically?
Pseudo-code: (you need to have this piece of code executed on every request. You could write an HTTPHandler for this, or use the BeginRequest Event in the global.asax. You also need to find which property provides the necessary URL information)
switch(Request.URL)
{
case "www.customer1.com":
Theme = "Customer1";
break;
case "www.customer2.com":
Theme = "Customer2":
break;
}
Did you publish the app as precompiled? If so this could be the cause.
Why not store the theme to use in a database table and access it there rather than the web.config? This should then be truly 'on the fly'.
Even though this is a really old post, I don't think the accepted answer is the best one. On this link, https://bytes.com/topic/asp-net/answers/495850-themes-web-config is a correct answer, but not as clear as it should.
He mentioned that the compiler is adding the theme to every page, so then it can't be changed by web.config file on the server. But he didn't say what to do to avoid this and it is pretty simple. You just have to remove the theme='Theme1' from web.config before compiling the web site. If it is not there, then the compiler would not set the theme to every page and you can change the theme just by web.config on every server you like with the same exact code.

Categories

Resources