How to add an action item between Delete and Refresh in DNN - dotnetnuke

I have just created a module and all is good. I add an action to the menu with this code...
Public ReadOnly Property ModuleActions() As DotNetNuke.Entities.Modules.Actions.ModuleActionCollection
Implements DotNetNuke.Entities.Modules.IActionable.ModuleActions
Get
Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
Actions.Add(
GetNextActionID,
"My New Action",
Entities.Modules.Actions.ModuleActionType.EditContent,
"",
"",
EditUrl(),
False,
SecurityAccessLevel.Edit,
True,
False
)
Return Actions
End Get
End Property
This places a third edit option that looks like a pencil and when I mouse over it, my new menu option shows up. How do I get it so that my new menu option appears between the Delete and Refresh action items in the list under the cog icon.
I hope that makes sense.
Thanks for your time.

Related

In Selenium, is it good to reuse same instance of the Page class multiple times in the same test method or should I create new instance?

I need to test the website: https://www.rediff.com using PageFactory pattern.
My test method does the following steps:
Step-1. Goto Rediff home page https://www.rediff.com/
Step-2. Click on Sign-in button
Step-3. Enter the username and password and click on Submit button
Step-4. Click on rediff.com link at the extreme top left which will take the user back to Rediff home page. Now enter the text in the search bar and click on Search button
Below is the test class:
public class RediffLoginTest extends BaseClass
{
#Test
public void loginAndSearch() throws InterruptedException
{
// Step-1
getDriver().navigate().to("https://www.rediff.com");
// Step-2
RediffHomePage rhp = new RediffHomePage();
PageFactory.initElements(getDriver(), rhp);
rhp.signIn().click();
// Step-3
RediffLoginPage rlp = new RediffLoginPage();
PageFactory.initElements(getDriver(), rlp);
rlp.enterEmailID().sendKeys("hello");
rlp.enterPassword().sendKeys("demopass");
rlp.submitLogin().submit();
// Step-4
rlp.goToHomePage().click();
rhp.enterSearchText().sendKeys("demo");
rhp.submitSearch().click();
}
}
As per the Step-4 explained above, it takes me back to Rediff home page. I have already created an object rhp of RediffHomePage in Step-2. So, my question is, for the Step-4, is it good to reuse this same object rhp as shown in the above code or should I create another object of the same page class in the same test method for e.g. say rhp1 of RediffHomePage as shown in the below code ?
RediffHomePage rhp1 = new RediffHomePage();
PageFactory.initElements(getDriver(), rhp1);
rhp1.enterSearchText().sendKeys("demo");
rhp1.submitSearch().click();
If possibly, in such situations you definitely should reuse the existing objects, not to create again and again new redundant objects.

Do XAML objects remain virtually present when leaving a XAML page in Windows 8 App?

I use the MVVM Light Toolkit to define the association between the view-model and the view.
The container is instructed to register a view-model as a singleton instance. Thus, the same instance will always be returned when the GagaViewModel is required:
public GagaViewModel GagaViewModel
{
get
{
var vm = ServiceLocator.Current.GetInstance<GagaViewModel>();
vm.Setup(); //Clear the ObservableCollection
return vm;
}
}
You can click on a thumbnail item on PriorGaga.xml. The self-chosen item is then selected in the GridView "MyGridView" in Gaga.xaml. Code-behind file of Gaga.xaml:
protected override async void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
var itemId = navigationParameter as String;
if (String.IsNullOrEmpty(itemId))
{
throw new ArgumentException("navigationParameter was either null or empty");
}
await ((GagaViewModel)DataContext).Init(itemId); //Busy(-Indicator) while loading data from server, filling the ObservableCollection and writing the selected item down
BringItemIntoView();
}
private void BringItemIntoView()
{
var vm = (GagaViewModel)DataContext;
Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
() => MyGridView.ScrollIntoView(vm.SelectedItem));
}
That works fine. As a sample: Item #45 appears within the viewport immediately (correct viewport position from the beginning).
But when you click the back button and return to Gaga.xaml by selecting an arbitrarily thumbnail item (let's just say #29), you will see item #1 and then the switch to #29 (the viewport is moving over the container). Do someone know what's going on under there? Are there any virtualized items in the container from the preceding Gaga.xaml visit?
My understanding is that the lifespan of the instance of your Gaga page is determined by its NavigationCacheMode property. By default, it is set to Disabled. Assuming that you haven't changed this property, you should be seeing a new instance of your Gaga page every time you navigate to it. You can verify this behavior by setting a breakpoint in its constructor. Consequently, I would think that each time you navigate to Gaga, the behavior of the UI should be identical, because everything is fresh.
(I wanted to add this as a comment, since I haven't actually answered your question, but sadly I do not have enough rep. I apologize in advance; please do not smite me down!)

zk: form combobox is not empty on an event to add new object

I am using zk frameworks mvvm approach to add, edit an object. When I click add button first time, the opening form is empty and it runs smoothly. After editing a record from a list, i am getting combo-box values preselected and the already selected value must not be selected, otherwise, i get null and i can't submit the form. It's mean that I can't choose selected value again for successful crud operation. My edit function for every case are working fine and there is no issue and all textbox and intbox are working normally
i am following this article
http://books.zkoss.org/wiki/Small_Talks/2012/February/MVVM_in_ZK6:_Form_Binding
i have three objects, newObject, selectedObject and editObject
my form snippet from zul file
<grid sizedByContent="true"
form="#id('ds')
#load(vmc.newObject, after='addInvoke') #save(vmc.newObject, before='add')
#load(vmc.editObject, after='editInvoke') #save(vmc.editObject, before='edit')
#validator('com.example.MyValidator')"
>
<combobox model="#load(ds.unitList)"
selectedItem="#bind(ds.abc.unit)" readonly="true" maxlength="50"/>
my method snippet for edit and add functions from SampleViewModel is as follows
#Command("edit")
#NotifyChange({ "objectList", "selectedObject", "editObject" })
#Override
public void edit() {
service.editKpi(editObject);
editObject = null;
}
#Command("addInvoke")
#NotifyChange("newObject")
#Override
public void onClickAddButton(){
enableEditMode(false);
isNewMode = true;
newObject = new AbcDTO();
}
i have fixed it my self.
solution is use value in combo-box too along with selecteditem

Episerver LinkItemCollection not visible to users

We are using PageTypeBuilder to define our PageTypes, on one page we have a property which represents a Link item collection as below:
[PageTypeProperty(Type = typeof(PropertyLinkCollection), HelpText = "Test links.", EditCaption = "Test links", SortOrder = 11)]
public virtual LinkItemCollection PageLinks { get; set; }
We can populate this in CMS editor mode with links, save and publish without any errors. We then have a user control that inherits from EPiServer.UserControlBase and grabs the LinkItemCollection property using the below code and binds it to a repeater:
var links = currentPage.Property["PageLinks"].Value as LinkItemCollection;
if (links != null)
{
linkRepeater.DataSource = links;
linkRepeater.DataBind();
}
If I view the page when logged in as a CMS editor this page works fine and the links parameter is populated correctly, however if I view the page as a normal user and not logged in the links variable is always null (although when I'm debugging I can see the currentPage.Property["PageLinks"] is present, and the type is LinkCollection, its just that the Value is null
Is there something I need to configure here, permissions on a specific page type?
The problem is most likely one of the pages in the LinkItemCollection not being accessible by outside visitors. Try accessing the links in the collection as an outside visitor and remove any of the links that are in fact locked from outside view.

How do I search and delete a specific form in my ArrayList

I am developing a windows form application that acts as a subscriber for my wcf service. Whenever the publisher publishes a post, my winform will capture the information and add an notification form to an arraylist.
public ArrayList notificationList = new ArrayList();
And the arguments for my form is as follows
public notificationForm(String name, String location,
String imageExtension,String alertType,String memberid,
String date,String time,int x,int y,String alertid)
{
//Codes
}
on the notification form, there would be a button called "Clear"
sample code for adding the form to the list is as follows
notificationList.Add(new notificationForm("", "", "", "", "", "","", 1, 1,alertId));
How do I code the event for the "Clear" button such that it searches the arrayList for a particular (for example) alertID and removes it from the list.
If your stuck on using an ArrayList, just walk through it using a ForEach loop till you find the alertID and then call ArrayList.Remove. I would consider using a Dictionary instead and having the alertID as the key, then you can easily remove it without walking the dictionary.

Resources