Disabling Tools dropdown button in a Acumatica screen - c#

There are cases when a screen does not need to show Tools button, and i would like to hide it from the users with no administration roles.
I tried reading through the ASPX file, however i haven't found a clue.

The feature you are looking for is not part of the base product and is out of reach of customization. To implement it properly you should make a feature request with Acumatica.
That being said, it is technically possible to edit the page directly on the server at this path:
\Controls\PageTitle.ascx.cs
You can edit page load event to add your condition for tools menu. As an example I have made Tools menu visible only for Administrator role:
if (!Page.IsCallback)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(), "toolbarNum", "var __toolbarID=\"" + this.tlbTools.ClientID + "\";", true);
// >> Add Tools menu condition
if (!PXContext.PXIdentity.User.IsInRole(PXAccess.GetAdministratorRoles().First()))
this.tlbTools.Visible = false;
// << Add Tools menu condition
}
It is technically possible to package this change in customization project by editing exclusion file list on server at this path:
/files.list
And remove the line for excluded file:
Controls\PageTitle.ascx.cs
After this you can add this modified file in customization project Files section.
Be warned that this is not recommended because it replaces base product file instead of customizing it. This means you must update (maintenance) this file in your customization each time it changes in next Acumatica versions.
If you don't need a customization to deploy the change you can skip that part and only manually edit the PageTitle file on server. Note that Acumatica updates might revert that change.

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.

How to import aspx pages across different Visual Studio solutions?

I'm very newer developing .NET web applications. Before read, I'm so sorry if I'm not able to explain correctly or if I'm confusing about something of .NET. Hope all of you can give me some light in .NET environment.
Context: We have two different solutions because the original idea was to develop two different applications with no common pages or content between them. Now, we need to have one of the aspx page that is in the solution1 inside the solution2 (and probably more in the future) because it's common between them.The idea is not to have two different maintenance of the same page. This two solutions have only one project inside them and each project has his own master page.
Solution1:
-Project1
Solution2:
-Project2
Question 1: Is it possible to import or use complete aspx page across the solutions? I mean, I know that is possible to import aspx files from the project1 into the project2, but doing this way, every change into the original aspx file of project1 means that is needed a new import into project2 (or this is what I think) to have the page up to date. What is the best way to share content between different solutions?
Thanks in advance.
You should be able to add the aspx page which exists in one solution (and version controlled hopefully!), to your other solution by adding it as a linked file.
MSDN explains how Visual Studio allows you to add an item as a link rather than directly adding the file to your project.
By linking to a file, you can capture ongoing changes to a source file without having to manually update a copy whenever changes are made. However, if the underlying file is deleted, the link will be broken.
To create a link to an existing item
In Solution Explorer, select the target project.
On the Project menu, select Add Existing Item.
In the Add Existing Item dialog box, locate and select the project
item you want to link.
From the Open button drop-down list, select Add As Link.
https://msdn.microsoft.com/en-us/library/9f4t9t92(v=vs.90).aspx#Anchor_0
Another helpful article by Grant Winney on the topic here:
https://grantwinney.com/visual-studio-add-file-as-link/

How to create ContentPart in orchard cms theme?

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.

Using a context menu to send a file to another application in C#

I'm currently creating an application that will hold multiple images, I've decided that on an image I would like a context menu to appear when right clicking and have an option to send to an image editing application such as Photoshop, Gimp, Paint etc...
I know how to create a context menu, however I am unsure on the code to use in order to send the image to the application itself.
If you want to open the file in the default application then that was already answered. If you want to do the same the Explorer is doing on "Edit" context menu item, then add these two lines in "Original, complicated answer" from the link above:
if (psi.Verbs.Contains("Edit", StringComparer.OrdinalIgnoreCase))
psi.Verb = "edit";
You should check the existence of the verb you want in psi.Verbs as per the MSDN. If there's no "edit" verb then the code calls default app.. by default.
If you want to give the user a list of all image editing apps that the user have installed then you would have to have a hardcoded database of such apps together with their installation GUIDs, check if they are installed, find out where they are installed (maybe not in the default place), and make a list of them, calling each with your file as a command line argument. It's too complicated to give code for that.

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 :)

Categories

Resources