Change request application not working with pages created through AWM? And Review Button not working at all

Hello, most of my Wiki was created through AWM, with fields for Code, Department, Records produced (if Operational Procedures or Work Instructions), and content.

When using Change Request, the user who has no right to edit the page still can edit it as the edit button changes to “edit through change request”.

But when doing it on pages creates by AWM, the edit button makes the Change Request blue button appear on the bottom of the page, but effectively, it doesn´t open the editor.

I will show below the difference between normal pages and AWM pages with a user without editing rights

clicked on edit of a normal page
image

and here is an AWM page AFTER I clicked edit. The editor doesn´t appear…
image


independently of that, normal or awm page sent to change request, the REVIEW button is not working.

here is the change request page, in a Change Request to change a simple page
image

Clicking the review button takes me to this “editor” page, without any content and without a save button, nothing. I can´t write or anything. The editor buttons also do not work.
image

1 Like

Hi,

I just noticed that you already opened Jira tickets for those, so I’ll answer directly on the tickets:

Thanks Surli. Just to summarize to people that may look the forum if they have the same problems.

REVIEW button not working:

  • it’s a real bug, but only works if the user has TEXT EDITOR as his preference. Changing personal user preference to WYSIWYG editor solves the issue. Or the standard editor. Point is: it works if it opens in WYSIWYG mode.

AWM created pages not working with Change Request (can´t edit the pages if you don´t have editing right)

  • it’s an issue Surli was already aware and is still not sure how to fix. It’s important to notice that it apparently works if you have editing rights, because you edit the page normally and just use the different SAVE button.

Hi, here’s something interesting to note :

Let’s say I have an app created with AWM called procedures and this app has a property called EQUIPE which is a Static List with Display Type ‘select’.
If you edit the class procedures.Code.proceduresClass, under the EQUIPE settings, you’ll find a field “Custom Display”. The usual way to use this field is by adding something like this

{{velocity}}
#if ($type == 'view')
  $value
#elseif ($type == 'edit')
  [...]
#end
{{/velocity}}

i tried to put something in it without any condition (some code I found here. Here’s what I put in the field first :

#set($MyClass=$object.getxWikiClass())
  #set($list=$MyClass.get($name).getListValues())
  #set ($MySelectList="<select id='" + "${prefix}${name}" + "' size='1' name='" + $prefix + ${name} + "'>")
  #set ($Selected="")
  #if ($!value=='')
    #set ($Selected=" selected='selected'")
  #end
  #set ($MySelectList=$MySelectList + "<option value=''" + $!Selected + " label='" + $services.localization.render('Space.DocWith_XWiki.TranslationDocumentClass_Object.Empty') + "'>" + $services.localization.render('Space.DocWith_XWiki.TranslationDocumentClass_Object.Empty') + "</option>")
  #foreach($listitem in $list)
    #if ($listitem==$value)
      #set ($Selected=" selected='selected'")
    #else
      #set ($Selected="")
    #end
    #set ($MySelectList=$MySelectList + "<option value='" + $listitem + "'" + $!Selected + " label='" + $listitem + "'>" + $listitem + "</option>")
  #end
  #set ($MySelectList=$MySelectList  + "</select>")
  #set ($MySelectList=$MySelectList  + "<input type='hidden' value='' name='" + ${prefix} + ${name} +"'>")
  {{html clean=false}}
  $MySelectList
#end

As a result, every document in my app now has a drop-down list displayed all the time, even in view mode. here’s what it looks like :

Now I can click the “Edit” button, chose something in the drop-down list, save it as a change request, approve the request and it will effectively modify the page.

The thing is, if i add a condition to my “Custom Display” field, like this :

{{velocity}}
#if ($type == 'view')
  $value
#else
  #set($MyClass=$object.getxWikiClass())
  #set($list=$MyClass.get($name).getListValues())
  #set ($MySelectList="<select id='" + "${prefix}${name}" + "' size='1' name='" + $prefix + ${name} + "'>")
  #set ($Selected="")
  #if ($!value=='')
    #set ($Selected=" selected='selected'")
  #end
  #set ($MySelectList=$MySelectList + "<option value=''" + $!Selected + " label='" + $services.localization.render('Space.DocWith_XWiki.TranslationDocumentClass_Object.Empty') + "'>" + $services.localization.render('Space.DocWith_XWiki.TranslationDocumentClass_Object.Empty') + "</option>")
  #foreach($listitem in $list)
    #if ($listitem==$value)
      #set ($Selected=" selected='selected'")
    #else
      #set ($Selected="")
    #end
    #set ($MySelectList=$MySelectList + "<option value='" + $listitem + "'" + $!Selected + " label='" + $listitem + "'>" + $listitem + "</option>")
  #end
  #set ($MySelectList=$MySelectList  + "</select>")
  #set ($MySelectList=$MySelectList  + "<input type='hidden' value='' name='" + ${prefix} + ${name} +"'>")
  {{html clean=false}}
  $MySelectList
#end
{{/velocity}}

Then the behavior becomes the same as if I had left the field empty → I can never edit the property, because I am considered to be in “view” mode even after clicking the “Edit” button. With an admin account though, I get the drop-down list as expected.

So :

  • As an admin, I enter edit mode after clicking “Edit”. This can be seen is a URL showing “…/xwiki/bin/edit/…”
  • As a user, I stay in view mode after clicking “Edit”, but the URL show “…/xwiki/bin/editcr/…”

I don’t know if it helps, but I thought it was worth sharing.

1 Like

It does. The problem is indeed most probably related to the fact that I’m mimicking in Change request an edit but not all the variables are properly set. Now I need to check how much I can just override those or not, since there might be some security implication.

2 Likes

As we are officially launching our Wiki, I bumped into this issue again with AWM created pages.

I was going to open a thread until I remembered "haven´t I already opened a thread about this before? I searched for and voilá

It seems we will need to work through policies right now, since I will have to give editing rights to everyone.

“It’s strictly prohibited to edit a page and save it. You MUST save it as a Change Request”.


Either that I should find another method to allow everyone to edit pages but only save them as Change Requests. Anyone has any idea?
Again, almost all my Wiki is made of AWM pages. So Change Request not working with AWM pages is a big problem for me.


Maybe I should research more into the Publication Workflow App. It seems a little complicated to me. Like if I need to edit every page’s Workflow…