raw_id_fields with pages field does not work - django

There are several issues if we add "pages" field to raw_id_fields.
When I click on search button, pages dialog opens, and if I select any page, nothing happens (I think that context variable is_popup from render_page_row method in cms/utils/admin.py should additionally check if IS_POPUP_VAR is present in request.META['HTTP_REFERER'])
If problem 1. is fixed, click on page adds page id but also all parent ids all the way to the tree root (I think that propagation of onclick event should be stopped)
It is not possible to open child nodes without selecting parent. When parent node arrow is clicked in order to see and add child node, parent is selected and dialog is closed. Result of adding onclick event handler on cms-tree-node.
Is it possible to add onclick event only for page link and not on the whole element with class cms-tree-node, so we can open node children without selecting page?
Environment
Python version: 2.7
Django version: 1.8
django CMS version: 3.4.4

Related

Can I dynamically change the label of a Siebel button?

In our Siebel 7.8 (high interactivity) application, we have a form applet with a Pause / Resume custom button which does the following, depending on the current record's status:
If the status is "queued" or "active", it switches it to "paused".
If the status is "paused", it switches it back to whatever it was before.
If the status is another one ("completed", "error", etc), the button is disabled.
Is it possible to change the label dynamically? So that it would read Pause in the first case, and Resume in the second.
Off the top of my head the only way I can think of doing this would be with a browser script placed both in the Applet_Load and Applet_ChangeRecord events, something like:
var button = this.FindActiveXControl("Name Of My Button Control");
var status = this.BusComp().GetFieldValue("Status");
if (status == "paused") {
button.innerHTML = "Resume";
} else if ((status == "queued") || (status == "active")) {
button.innerHTML = "Pause";
} else {
// the button will be disabled via PreCanInvokeMethod, but we hide it too
button.style.visibility = "hidden";
}
Even if that worked (it should, but I haven't tried it)... I really hate browser scripts in Siebel, they always bring more trouble than solutions. Besides, I still would have to deal with changing the label when the button is clicked too... maybe checking the Applet_InvokeMethod browser event as well.
Is there any way of changing a button's label, based on the current record data, without coding1? All I have found searching online is this trick to change the applet label based on a calculated field, but nothing for buttons.
1: By without coding, I mean not coding the label change myself. It would be perfectly fine if I have to write a business service method to be invoked by Siebel somehow.
There are a few options potentially available:
We did something similar, but we are in a later Siebel version with Open UI. So instead of Browser Script we added code to custom Presentation Model and Physical Renderer JavaScript files. Even though you don't wish to, if you had to resort to something similar using Browser Scripts, you might prefer this over manipulating the text of one button.
I created two button controls: One that displayed Tag and the other Untag. They both call the same method. I added a flag field to the BC. (You might could do the same with a calculated field that is based on certain [Status] values.) In the JS files I put code to check that flag field and then, based on the flag field value, display one button and hide the other.
I did not start with Siebel until 8.1, so I cannot recall if this would be available in 7.8. And this only works on Order Management Applets with a class of CSSSWEFrameListHC (which is why I said "potentially available" options):
There exists an Applet User Property called Hide Control n [See Siebel Developer's Reference v7.8 -> Ch 4: User Properties -> Setting Numbered Instances of a User Property for the use of n in User Properties.]
First, create two separate controls - one that displays Pause and the other Resume. The User Property could be used something like this:
Applet User Properties
Name Value
Hide Control 'Name Of My Pause Button Control', '[Status] = "paused"'
Hide Control 1 'Name Of My Resume Button Control', '[Status] = "queued" OR [Status] = "active"'
You could possibly OR all the other [Status] values into these if you wanted to hide it and not just disable it.
Use Toggle Applets. [See Configuring Siebel eBusiness Applications v7.7 -> Ch 13: Configuring Screens and Views -> Example of Configuring Applet Toggles.]
Copy your existing Applet that has Resume, and modify that button Control in the copy to display Pause. Name the new Applet something like My Form Applet - Pause Button.
Then in Tools drill into your existing Applet, click the Applet Toggle child object, add a New Record, and make it something like this:
If you want this to toggle immediately when the [Status] changes, you'll need to set Immediate Post Changes to TRUE on the [Status] field on the BC. (This could cause performance issues, so be mindful.) Otherwise the Applet won't toggle until the record is saved.
Or you could possibly create a calculated flag field on the BC based on [Status] values, set it's Immediate Post Changes to TRUE, and base the Applet Toggle on that field.
DISCLAIMER: Other than our version of #1, I have not attempted any of these.

how to add desired propertypages to propertysheet when next button is clicked

I Want to add propertypages to my propertysheet .I will let you know my intention i.e,Initially I created a propertysheet and added 4 propertypages . Now in wizard mode as we have Next,Back,Cancel which are used for switching between pages. I want to add different pages when I click on Next button.Moreover I had first propertypage which consists of three buttons where if click first button I must add a page and again if go for second page I must be able to add a page which is different from the previous one.Similarly,when I click on the third button I must add one more different page.I will show the sequence of pages,
FirstPage:
Button1:
Button2:
Button3:
Back Next Cancel
if "Button1" is clicked then Next will be enabled and then click Next then Page2 should be added and again rollback and click button2.
if "Button2" is clicked then Next will be enabled and then click Next then Page3 should be added and again rollback and click button3.
if "Button3" is clicked then Next will be enabled and then click Next then Page4 should be added.
I tried handling it in "virtual LRESULT OnWizardNext()" method ,which returns CPropertyPage::OnWizardNext(). But it is not working fine ,can anyone please let me know where to handle the event such that i must be able to add differnt pages when go for the three different buttons.
At any time you can call RemovePage in OnWizardNext and you can call AddPage in on Wizard next.
But you should never remove the page that is currently active (causing the OnWizadNext call).
This code will remove all pages following the current one and you are free to add others. returning 0 lets the wizard to continue to the next page:
// Delete all following pages
CMySheet *pSheet = static_cast<CMySheet*>(GetParent());
while (pSheet->GetActiveIndex()<pSheet->GetPageCount()-1)
pSheet->RemovePage(pSheet->GetPageCount()-1);
if (case1)
pSheet->AddPagesForCase1();
else if (case2)
pSheet->AddPagesForCase2();
...
// Do the default and advance to the next page
return 0;

Making a menu item appear when a certain view is displayed rails

Windows 8.1
Rails 4.1
Ruby 2.0
I have the menus for my application defined in views/layout, and one of those is the header where I have the menu items. There are some additional partials rendered form _header.html.erb as well.
I would like to have an additional menu appear ONLY when I render views/pages/index. How do I go about doing this?
I would look in Javascript. Have you tried listening for the specific body class of that page? Each body gets a dynamically generated attribute of class="controller action". If you listen for body.controller.action, you'll have the event that can trigger you to show (or hide) your menu item.
Pseudo code might look like:
I want a new menu to appear for controller1, action1
when any action fires in any controller
if the class of the body element has both class "controller1" and class "action1"
menu.show()
else
menu.hide()

create a GUI for task scheduler using python script

I have a script developed to create a task scheduler where it has 3 GUI buttons 'Add', 'Edit' and 'Remove' in the scheduler window. Clicking on 'Add' will open a task scheduler window where user can set the task,date,time and task name,etc.,after applying the settings and when clicked on 'ok', the GUI returns back to scheduler window updated with the set task name details of it in the list.Whereas 'Edit' window is used to edit the task scheduler selected from the list.I have class called 'class AddTask' which is the event created when clicked on 'Add' button.Similarly when clicked on 'Edit' i am calling the same AddTask class by creating a object of it from which i call edit function.I want these 'AddTask' and 'EditTask' should be independent class and function as they are expected to.
I want the GUI for both Add and Edit button must be same but the functionality's should be different,for ADD it has to add the task and update it in the list in the scheduler whereas for EDIT it has to edit the task scheduler which is selected from the list.
I personally would use an ObjectListView widget rather than a ListCtrl as I find ObjectListView to be easier to update. Either way, for the Add/Edit frame, you can just add an argument called "fields" or some such and set it to None.
class AddTask(wx.Frame):
#------------------------------------------------------------
def __init__(self, parent, id, title, fields=None):
Then you can call it the normal way for Adding data. However, when you go to call it for Editing, you will pass a list (or a dict) of the values from the ListCtrl to fill in the fields in this frame. You'll need to add something like
if fields:
# set the values of the widgets as necessary
self.field.SetValue("Task Name")
This is what i tried
def UpdateList(self,task):
run="Disabled"
status="Not Scheduled"
date=datetime.now().strftime("%d-%m-%Y")
self.List=[{"taskname":"%s"%(task),"run":"%s"(run),"date":"%s"(date),"status":"%s"%(status)}]
list1=self.listOlv.SetObjects(self.List)

AngularJS Master Detail example [ASP.NET application with WEBAPI,AngularJS]

The requirements is like master detail grid, on load the master gets displayed as a table, on every detail row edit button click , need to open the detail edit form in a Modal window. There could be different templates based on detail/productTypes . For example productType1 will display few set of fields(template 1) , so on.
Have WEBAPI with REST support and understand how to build the initial Master table But not sure on how the details part.
Any direction would be helpful.
Does your HTML/CSS Framework provide mechanism for a dialog? If so you would have to create a directive to wrap it around the script to open the dialog.
On the master grid row ng-click will set a flag on the controller. When this flag is set to true, the code in directive will open the dialog. Within that dialog div you can use ng-include that will be bound to the url of the template (controller variable will store that url).
The template is bound to a child object in the controller scope and has the fields for the details. Setting the flag to false will close the dialog and you will have changes your main controller.