Unable to access button defined in file referenced by #include - vb.net

I created a website (index.aspx) in which I included my navigation using the include comment
<!-- #include virtual ="/include/mainNavigation.aspx" -->
Now I want to access a button defined in the navigation.aspx in my index.aspx.vb file in
<asp:Button ID="PartA" class="navigationPartButton" runat="server" Text="Part A" />
If I want to access this button visual studio tells me that this button is not defined and throws an error.
PartA.CssClass = "someCssClass"
How do I get this element? I know there is a call getElementByID but on which object do I have to call this?

Related

ASP.NET Core 3.0 - Identity UI Manage folder not receiving layout

I have Identity scaffolded out in accordance with the documentation, and everything works properly except for the layout of the /Manage folder.
The directory setup is exactly as it gets scaffolded.
Directory setup with all misc. files removed
For clarity's sake:
/Areas/Identity/Pages/Account/Manage is the problem folder.
/Pages Contains the _ViewStart file which sets the Layout from my Views/Shared folder.
/Pages/Account Receives the layout from _Viewstart and works properly.
/Pages/Account/Manage Everything in here only receives the _ViewStart layout. The _Layout file in here isn't automatically found by the pages inside of it.
Areas/Identity/Pages/Account/Manage/_Layout.cshtml
#{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>Manage your account</h1>
<div>
<h4>Change your account settings</h4>
<hr />
<div class="row">
<div class="col-md-3">
<partial name="_ManageNav" />
</div>
<div class="col-md-9">
#RenderBody()
</div>
</div>
</div>
#section Scripts {
#RenderSection("Scripts", required: false)
}
This is exactly as it gets scaffolded in and the layout only breaks when you change AddDefaultIdentity() to AddIdentity(). I work with a reference I scaffolded and it just leads me to believe I'm not accounting for something when removing the default UI. The only workaround I found was manually setting the layout of each .cshtml file within /Manage
#{
Layout = "_Layout";
}
This fixes everything and causes the layout to work properly for the pages inside of /Manage. I read the documentation and it states that each Razor Page controller should search its own folder for a _Layout file before searching elsewhere. Is there a reason it isn't detecting the file?
"The only workaround I found was manually setting the layout of each .cshtml file within /Manage":
You don't have to do that. Simply create a _ViewStart.cshtml under your Manage/ foler:
#* file: Manage/_ViewStart.cshtml *#
#{
Layout = "_Layout"; // Use a partial layout name instead of absolute name
}
Also be careful that the default Manage/Layout.cshtml uses a parent layout of /Areas/Identity/Pages/_Layout.cshtml which might not exist in your scaffolded files :
#* file: Manage/Layout.cshtml *#
#{
Layout = "/Areas/Identity/Pages/_Layout.cshtml"; // you might want to change this to `/Views/Shared/_Layout.cshtml`
}
"it states that each Razor Page controller should search its own folder for a _Layout file before searching elsewhere"
That's true only when you're using a partial _Layout name. However, if you're using an absolute name that starts with a slash, it will use that layout directly. See official docs :
When a partial name is provided, the Razor view engine searches for the layout file using its standard discovery process. The folder where the handler method (or controller) exists is searched first, followed by the Shared folder. This discovery process is identical to the process used to discover partial views.
In your case, the layout name /Areas/Identity/Pages/_Layout.cshtml, which starts with a /, is not a partial name. That's the reason why your pages cannot discover the layout. In order to fix this issue, using a partial name _Layout instead. (This can be done by a single _ViewStart.cshtml file as I do above, don't add it for every page)
Finally, you might wonder why it renders normally when using AddDefaultIdentity(). As you find out, the AddDefaultIdentity() will add the default UI, which eventually invokes the AddRelatedParts() method. This allows that it fallbacks to the default UI when there's no such a layout or page. e.g., when you scaffold Identity with Visual Studio, it offers a list which you can use to override the default pages. The above /Areas/Identity/Pages/_Layout.cshtml comes from the default UI.

JSF 2.2(Mojarra 2.2.0) Primefaces Issue - While clicking on download button, application is throwing out to sessionExpired page

Here is a snippet of SupportingDocs.xhtml code
<p:commandButton value="Download" ajax="false" icon="ui-icon-arrowthick-1-s" styleClass="blue-button" actionListener="#{entityType.downloadDFile}">
<f:attribute name="selectedFile" value="#{supportingDoc[column['supportingDocument.downloadlink.column']]}" />
</p:commandButton>
When clicking on Download button, it is downloading file perfectly but in the same time it is logging out as well.
Here is some pointers which I have got while debugging the application.
Click "Download" button
It calls loginFilter ->doFilter()
then it calls loginController -> destroySession()
then it calls sessionListener -> sessionDestroyed()
then it creates new session by calling sessionListener ->sessionCreated()
then loginFilter -> doFilter()

VBA: Load custom ribbion at runtime with access

I try to load and display a ribbon out of a textfile in microsoft access via VBA at runtime.
So I call this code:
Dim strGUID As String
strGUID = "RadToolRibbons"
Const RadToolRibbonFile = "c:\Temp\Ribbons.xml"
Dim XMLText As String
With CreateObject("Scripting.FileSystemObject")
XMLText = .OpenTextFile(RadToolRibbonFile, 1).ReadAll
End With
Application.LoadCustomUI strGUID, XMLText
But it does not show the ribbon. When I call the code again I get an error:
#32609 " this customization already loaded..."
The xml looks like this:
<?xml version="1.0"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="tab1" label="MyNew">
<group id="StartHelp" label="Help">
<button id="Test" label="Test" size="large" imageMso="AcceptTask" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
What Im doing wrong?
By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
To show VSTO Add-in user interface errors
Start the application.
Click the File tab.
Click Options.
In the categories pane, click Advanced.
In the details pane, select Show VSTO Add-in user interface errors, and then click OK.
Read more about that in the How to: Show Add-in user interface errors article.

Can we have custom permissions defined for the portal?

Environment: Liferay 6.1 GA3 EE
Can we have custom permissions defined for the portal?
We can create custom permissions in our plugin portlet through creating an XML with <portlet-resource> tag and defining the <action-key> within it.
And when I go to define permissions for a Role in Control Panel my portlet appears in the section Site Applications, now what I want is to create custom permissions (not through EXT) in a portlet or hook that should have a separate category as My Custom and should have custom permissions like <action-key>ACCESS_EMAIL</action-key>, <action-key>ACCESS_TOOLSET<\action-key> etc.
In short my custom category should appear within section Portal as shown in the following figure while I define the permission for a custom Portal (regular) role:
I would like to use this permission not for a specific portlet but need to use it inside jsp-hooks or any other of my custom portlets. Just like we have ADD_SITE, ADD_USER etc permissions in Portal --> General, I want to have these permissions as generic.
Edit
To make the portlet appear in any of the section I created a simple custom-portlet, so the portlet appeared in the Site Application section and if I want I can make it appear in the Control Panel sections as well.
But now the problem is I don't have any view nor any implementation in this portlet so I make it hidden by updating the liferay-display.xml and putting it under category.hidden. This also hides it from the Define Permission drop-down.
And if I don't use the lifeay-display.xml liferay puts it under the Undefined category while accessing it from +Add menu in dockbar. :-(
Thank You
This is how we achieved it:
Create a custom portlet with the permissions file for this portlet like /resource-actions/custompermission.xml to specify the different custom permissions we want. The full steps are identical to this wiki.
Make this portlet a hidden portlet so that it won't appear in the Add menu in dockbar, neither in Control-panel nor in the Define Permissions drop-down.
Now create a JSP hook (you can either create a separate plugin or include the hook in the custom-portlet defined in point no. 1) and modify the /docroot/html/portlet/roles_admin/edit_role_permissions_navigation.jspf to include our custom category:
<aui:form action="<%= currentURL %>" name="resourceSelection">
<aui:fieldset>
<aui:select changesContext="<%= true %>" name="add-permissions" onchange='<%= renderResponse.getNamespace() + "addPermissions(this);" %>'>
<aui:option label="" />
<%-- Our customization starts here --%>
<%--
We have added our very own option group but this is not required just the <aui:option> will do
--%>
<optgroup label="<liferay-ui:message key="custom" />">
<%
if (_isCustomPermissionsPortlet(CUSTOM_PERMISSIONS_PORTLET)) {
editPermissionsURL.setParameter("portletResource", CUSTOM_PERMISSIONS_PORTLET);
editPermissionsURL.setParameter("showModelResources", "0");
%>
<%--
and here we add our own Permission category drop-down option
--%>
<aui:option label="custom-permissions"
selected="<%= _isCurrent(editPermissionsURL.toString(), portletResource, showModelResources) %>"
value="<%= editPermissionsURL.toString() %>" />
<%
}
%>
</optgroup>
<%-- Our customization ends here --%>
<c:choose>
<c:when test="<%= role.getType() == RoleConstants.TYPE_SITE %>">
<optgroup label="<liferay-ui:message key="administration" />">
<% // Other liferay stuff continues ...
and at the end of the JSP we have:
// ... other liferay stuff
private boolean _isOrganizationPortlet(String portletId) {
return ArrayUtil.contains(_ORGANIZATION_PORTLETS, portletId);
}
private boolean _isPortalPortlet(String portletId) {
return ArrayUtil.contains(_PORTAL_PORTLETS, portletId);
}
// Our customization starts here
// portlet's ID
public static final String CUSTOM_PERMISSIONS_PORTLET = "CustomPermissions_WAR_CustomPermissionsportlet";
private static final String[] _CUSTOM_PERMISSIONS_PORTLET = {
CUSTOM_PERMISSIONS_PORTLET,
};
private boolean _isCustomPermissionsPortlet(String portletId) {
return ArrayUtil.contains(_CUSTOM_PERMISSIONS_PORTLET, portletId);
}
// Our customization ends here
This is how it looks in the Control Panel:
We can move the permissions in the Portal section as well by moving our customized code to that place in the JSP.
The advantage of having it above is that it will be displayed when we want to set Define Permissions for Site Role.
Hope this helps somebody.

Migrating code from OpenLaszlo 3.3 to 5.0: TypeError #1007 Instantiation attempted on a non-constructor.

I ported some parts of the code from OL 3.3 to OL 5.0 recently. I thought that everything will work but when i try to run it using the ant script i have I am getting this error.
[echo] C:\Program Files\OpenLaszlo Server 5.0.x\Server\lps-5.0.x/WEB-INF/lps/server/bin/lzc.bat
[exec] Compiling: C:\Workspace\application\client\src\TestClient.lzx to TestClient.swf10.swf
[exec] compiler output is Loading configuration file C:\Program Files\OpenLaszlo Server 5.0.x\Server\lps-5.0.x\WEB-INF\frameworks\flex-config.xml
[exec] C:\Documents and Settings\310773\Local Settings\Temp\lzswf9\Workspace\application\client\src\build\TestClient\app.swf (289808 bytes)
So, I took the folder and i compiled it directly in Laszlo. It's not showing any error but when the swf is about to load the main page I am getting this error. Any idea why?
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at $lzc$class__mvz/$mvx()
at LzNode/__LZresolveReferences()
at LzNode/__LZcallInit()
at LzCanvas/__LZcallInit()
at LzCanvas/__LZinstantiationDone()
at LzInstantiatorService/makeSomeViews()
at LzInstantiatorService/checkQ()
at Function/http://adobe.com/AS3/2006/builtin::call()
at LzEvent/sendEvent()
at LzIdleKernel$/__update()
That's the error message you get when you try to instantiate a class which is not defined. Here is an example:
<canvas>
<class name="myclass">
<handler name="oninit">
// Instantiate a class which is not defined
var x = new lz.missingclass();
</handler>
</class>
<myclass />
</canvas>
Check for missing <includes> of classes which are being instantiated through scripts. You can always check the list of Adoboe Flash Run-Time Errors as well, sometimes there is useful information contained here.
Edit: Solution to problem added
This commment pointed to the problem:
I found that this line is causing the problem. <attribute name="dp"
value="$once{new lz.Datapointer()}" />. Any idea why?
If you check the OpenLaszlo reference for 5.0, you will see that the class names (on the left side in the class browser) use different case; some classes use camel case (lz.Browser, lz.DataElement), others use all lowercase (lz.view, lz.datapointer). In your case, you should have used lz.datapointer instead of lz.Datapointer.
Therefore this code will compile and run without any problems:
<canvas>
<class name="my_class" extends="node">
<attribute name="dp" value="$once{new lz.datapointer()}" />
</class>
<my_class oninit="Debug.inspect(this.dp)" />
</canvas>
A good way to test for the correct name of a class is to use the JavaScript in console in DHTML runtime, where you have auto-completion for lz.??? classnames:
Debugging SWF #1007 errors in OpenLaszlo
If you run into a #1007 error in the SWF runtime, I would compile the application for DHTML with the debugger disabled and the JavaScript error console open. Try this:
Change the line of with the $once{} constraint to
<attribute name="dp" value="$once{new lz.Datapointer()}" />
Compile the app in Chrome using DHTML runtime and debug=false. You should see the following error in the JavaScript console:
Click on the right side on error-1007.lzx:3, and you'll see the generated JavaScript code with the line causing the error
This line fails:
this.setAttribute("dp",new (lz.Datapointer)())
and you can even reproduce the error by typing new (lz.Datapointer) into the console.
Just as a point of info: The case of class names was "regularized" in 4.0 so that the case of a class that implements a tag is the same as that tag. See Mapping Class and Tag Names.
Here is an example of the problem and a workaround:
1) PROBLEM:
Here is the code of a short OpenLaszlo application demonstrating the problem:
<canvas width="1000" height="584">
<view name="myContainer" width="500" height="500">
<handler name="oninit">
var objCB = new lz.combobox(this);
</handler>
</view>
</canvas>
In this example there is no <combobox> tag in the application so the compiler does not think it needs to include the OpenLaszlo <combobox> class code in the application. Hence, when we try to instantiate a combobox with the line "var objCB = new lz.combobox(this);" the compiler throws the following error:
ERROR #test1007error.lzx≈5: TypeError: Error #1007: Instantiation
attempted on a non-constructor.
2) WORKAROUND:
The solution for the problem is to add an include in your application for <combobox>:
<canvas width="1000" height="584">
<include href="lz/combobox.lzx" />
<view name="myContainer" width="500" height="500">
<handler name="oninit">
var objCB = new lz.combobox(this);
</handler>
</view>
</canvas>
This time the error is not thrown and we see the combobox appear at the top left of the application when we run it.