Signify for view to search for next task url - django-viewflow

I am asking if there is a prefered method of making get_next_task_url() redirect to the next process url. get_next_task_url() looks for _continue in request.POST however the POST object is not able to be modified.
Currently i am adding a hidden field into my form:
<input id="continue" type="hidden" name="_continue" value="true">
Is there a variable that i can set within the views or flow classes to achieve the same thing?

Viewflow is the thin workflow layer on top of usual django views.
As for usual django views, to set redirect url can redefine get_success_url in your code
http://ccbv.co.uk/projects/Django/3.0/django.views.generic.edit/FormMixin/#get_success_url

Related

Multiple conflicting route parameter formats in Razor Pages

I'm making simple crud forms based on the tutorials for Razor Pages MVVM - https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/?view=aspnetcore-2.1
The issue is the elements on the Index page use different formats for the route parameter and I end up with URL's like /StockIndexMonths/2?StockIndexId=1
Where both /2 and StockIndexId=1 are the same parameter
The select list will use ?StockIndexId=1
The Create New link will use /1, when returning to the Index /1 is used
If I use the select list again I get both /1?StockIndexId=2
Can anyone tell me the preferred way to force the same parameter format to be used? I'm trying to keep Razor Pages doing it's 'magic'
Index.cshtml
#page "{StockIndexId?}"
#model Investments.Pages.StockIndexMonths.IndexModel
#{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<form>
<select asp-for="StockIndexId" asp-items="Model.StockIndexNameSelect" onchange="this.form.submit();"></select>
</form>
<a asp-page="Create" asp-route-StockIndexId="#Model.StockIndexId">Create New</a>
<table class="table">
...
Alter the form tag so that it uses the POST method:
<form method="post">
Currently, because the method is not specified, GET is used by default, which appends forms values to the URL as query string values. That's why you see what you are seeing.

SharePoint Redirect after post

My SharePoint input tag is using an XSLT variable for the redirect. I would like to substitute it for a javascript function to determine the value of the users input. Is this possible from within this tag? If not is possible to run a javascript function from within as XSLT variable? The following article show that something like this is possible but I need an example. http://www.nothingbutsharepoint.com/2011/05/05/extending-the-dvwp-passing-xsl-variables-to-javascript-aspx/
Thank you in advance.
<input type="button" id="Submit" value=" Submit " style="width:100px" onclick="javascript: if(!PreSaveItem()) return false;{ddwrt:GenFireServerEvent(concat('__commit;__redirect={',$RedirectLoc,'}'))}"/>
Basically behind GenFireServerEvent is a __doPostBack function.
__doPostBack('elementgeneratedname','__redirect={' + value '}');
Take a look into the browser what code is generated and use it in your function. Most probably first argument is not the id of the button and is the name of the web part container (somthing like 'ctl00$PlaceHolderMain$WebPartId').

Can I render all zones to an HTML string in a controller method

I'm trying to render the HTML for a content item to a string from within a controller action. Technically I just want to get the "body" part of it without any header/footer stuff. I want to do this so I can get a content item rendering the way I want once, and then display it as a normal orchard page OR by requesting the HTML for the content item via ajax to display it in a div in a JavaScript app. I don't want to have to manually render everything in the JavaScript as that would be duplicating the layout logic I already did. I want to re-use the bulk of the server side rendering so any changes are reflected in my normal orchard page and my JavaScript page. I've been digging into the code and searching everywhere and have gotten close but not all the way there.
I found these:
How to render shape to string?
Using FindView in Orchard
In my controller I have:
var shape = _contentManager.BuildDisplay(contentItem);
Using either of the two methods above, I can render that shape to an HTML string in my controller. All was golden. I was getting the body of that page and using it in JS. Then, I changed a placement file:
<Place Parts_Common_Body="Content:1" />
was changed to:
<Place Parts_Common_Body="/AsideFirst:1" />
The body moved where I wanted it (AsideFirst) in my normal Orchard page but disappeared from the HTML retrieved using the two methods above.
If I look at shape.Content.Items after the BuildDisplay call, I can see the item for the body is no longer there... why is it not rendering all the zones? Or, I guess a more specific question is why is the BuildDisplay method not building the complete shape? Is there a way I can make this work?
I tried a million different things and eventually got this working. Not sure I totally get it yet, but I think the problem had to do with the fact that I was using shape.Content and I'd moved stuff out of the Content zone. And maybe when I was looking at what the BuildDisplay method was returning I was just not looking at some newly created zone that actually did had the stuff I thought was missing. Clearly I need to learn more about zones and shapes... Anyway, I have a new zone called "MainInfo" now that I created in a placement file. I get a MainInfo property on the main shape returned form BuildDisplay and pass shape.MainInfo to the view rendering code and all seems to be working well now.

Context path not working in liferay Hook

I am creating a hook in which i want to add my image in custom jsp.
I have added image inside docroot/images/1.jpg
in jsp i am trying to access it using
<img src="<%=request.getContextPath()%>/images/1.jpg" />
but i am not able to get image.
Additionally when i am trying to print <%=request.getContextPath()%> is only prints "/"
Thanks !!!
Instead of taking images from your war (docroot folder), suggest you to place the images in a Web server so that in future you can easily replace them if you want to change images.
You could use below code in your jsp page to retrieve from Web server,
<div class="yourCSSClass">
<liferay-ui:icon src="/yourWebServerPath/1.jpg" label="" message=""/>
</div>
Another flavour of it,
In your JSP page if you have below code,
<nav class="yourCSSClass"><br/><br/></nav>
Then, in the CSS file that you are importing in your JSP page, use this,
.yourCSSClass{
background: url(yourWebServerPath/1.jpg) no-repeat;
}
P.S : In both the above examples, decide properly the value for yourWebServerPath
Very old question, but still worth answering.
Your hook replaces portal’s JSPs with your owns but that doesn’t mean that the context of the new JSPs is your hook’s one.
What actually happens is that JSPs are replaced at the File System level, and called by other Liferay JSPs and configuration as they were the original one.
The request you have access to, therefore, is the main and original one.
As far as I know, there’s no clean way to get the context path of the hook that is providing an overriding JSPs.

CMS made simple, Ctlmodulemaker how to get the url of an image

hi I've made a simple module with CTLModuleMaker in CMS made simple, in the template I call the necessary items like this:
{assign var="item" value=$itemlist[0]}
{$item->name->Label()}: {$item->name}<br/>
{$item->image->Label()}: {$item->image}<br/>
{$item->image_text->Label()}: {$item->image_text}<br/>
{$item->image_desc->Label()}: {$item->image_desc}<br/>
{$item->img_thumb->Label()}: {$item->img_thumb}<br/>
{$item->catagory->Label()}: {$item->catagory}<br/>
as you can see i call an image with {$item->image} but when i try to do something like this {$item->url} it returns the url of the whole page I'm trying to get the url of the image not the whole page.
any suggestions what i can do??
In a news template, it calls
<img src="{$item->file_location}/{$item->image->value}" />
You can also use {debug} to see all the variables being passed to the template in a separate popup window. This is my get out of jail free card when I can't find a field name.

Resources