Skip to content

Commit

Permalink
SAK-30808 - Update Delegated Access to Wicket 6 (sakaiproject#3139)
Browse files Browse the repository at this point in the history
* SAK-30808 - Update Delegated Access to Wicket 6

* Updating wicket to 6.26.0
  • Loading branch information
jonespm authored and ern committed Feb 20, 2017
1 parent ebe6b8c commit 8644d3d
Show file tree
Hide file tree
Showing 23 changed files with 296 additions and 207 deletions.
7 changes: 4 additions & 3 deletions delegatedaccess/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
<version>1.4.23</version>
<version>6.26.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>1.4.23</version>
<version>6.26.0</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>1.4.23</version>
<version>6.26.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
1 change: 1 addition & 0 deletions delegatedaccess/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
package org.sakaiproject.delegatedaccess.tool;

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.Response;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebRequest;
import org.apache.wicket.protocol.http.WebRequestCycle;
import org.apache.wicket.protocol.http.WebResponse;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.sakaiproject.delegatedaccess.tool.pages.UserPage;
import org.sakaiproject.delegatedaccess.tool.pages.UserPageSiteSearch;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.cycle.IRequestCycleListener;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.Url;


/**
Expand All @@ -44,7 +42,7 @@ public class DelegatedAccessApplication extends WebApplication {
protected void init() {

//Configure for Spring injection
addComponentInstantiationListener(new SpringComponentInjector(this));
getComponentInstantiationListeners().add(new SpringComponentInjector(this));

//Don't throw an exception if we are missing a property, just fallback
getResourceSettings().setThrowExceptionOnMissingResource(false);
Expand All @@ -61,22 +59,82 @@ protected void init() {
getApplicationSettings().setAccessDeniedPage(UserPage.class);

//to put this app into deployment mode, see web.xml
mountBookmarkablePage("shopping", UserPageSiteSearch.class);
}
mountPage("shopping", UserPageSiteSearch.class);
getRequestCycleListeners().add(new IRequestCycleListener() {

public void onBeginRequest()
{
// optionally do something at the beginning of the request
}

public void onEndRequest()
{
// optionally do something at the end of the request
}

public IRequestHandler onException(RequestCycle cycle, Exception ex)
{
// optionally do something here when there's an exception

// then, return the appropriate IRequestHandler, or "null"
// to let another listener handle the exception
ex.printStackTrace();
return null;
}

/**
* Throw RuntimeExceptions so they are caught by the Sakai ErrorReportHandler(non-Javadoc)
*
* @see org.apache.wicket.protocol.http.WebApplication#newRequestCycle(org.apache.wicket.Request, org.apache.wicket.Response)
*/
@Override
public RequestCycle newRequestCycle(Request request, Response response) {
return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response) {
@Override
public Page onRuntimeException(Page page, RuntimeException e) {
throw e;
public void onBeginRequest(RequestCycle arg0) {
// TODO Auto-generated method stub

}

@Override
public void onDetach(RequestCycle arg0) {
// TODO Auto-generated method stub

}

@Override
public void onEndRequest(RequestCycle arg0) {
// TODO Auto-generated method stub

}

@Override
public void onExceptionRequestHandlerResolved(
RequestCycle arg0, IRequestHandler arg1, Exception arg2) {
// TODO Auto-generated method stub

}

@Override
public void onRequestHandlerExecuted(RequestCycle arg0,
IRequestHandler arg1) {
// TODO Auto-generated method stub

}

@Override
public void onRequestHandlerResolved(RequestCycle arg0,
IRequestHandler arg1) {
// TODO Auto-generated method stub

}

@Override
public void onRequestHandlerScheduled(RequestCycle arg0,
IRequestHandler arg1) {
// TODO Auto-generated method stub

}

@Override
public void onUrlMapped(RequestCycle arg0,
IRequestHandler arg1, Url arg2) {
// TODO Auto-generated method stub

}
};
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ protected void onSubmit(AjaxRequestTarget target, Form<?> arg1) {
//display a "saved" message
formFeedback.setDefaultModel(new ResourceModel("success.addDaMyworkspace"));
formFeedback.add(new AttributeModifier("class", true, new Model("success")));
target.addComponent(formFeedback);
target.add(formFeedback);

target.appendJavascript("hideFeedbackTimer('" + formFeedbackId + "');");
target.appendJavaScript("hideFeedbackTimer('" + formFeedbackId + "');");

target.addComponent(addDaMyworkspaceStatusLabel,addDaMyworkspaceStatusLabelId);
target.add(addDaMyworkspaceStatusLabel,addDaMyworkspaceStatusLabelId);
}
};
addDaMyworkspaceForm.add(addDaMyworkspaceButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.head.StringHeaderItem;
import org.apache.wicket.markup.html.IHeaderContributor;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
Expand Down Expand Up @@ -193,9 +196,9 @@ protected Component newMessageDisplayComponent(final String id, final FeedbackMe
message.getLevel() == FeedbackMessage.DEBUG ||
message.getLevel() == FeedbackMessage.FATAL ||
message.getLevel() == FeedbackMessage.WARNING){
add(new SimpleAttributeModifier("class", "alertMessage"));
add(new AttributeModifier("class", "alertMessage"));
} else if(message.getLevel() == FeedbackMessage.INFO){
add(new SimpleAttributeModifier("class", "success"));
add(new AttributeModifier("class", "success"));
}

return newMessageDisplayComponent;
Expand Down Expand Up @@ -224,7 +227,7 @@ protected Component newMessageDisplayComponent(final String id, final FeedbackMe
*/
public void clearFeedback(FeedbackPanel f) {
if(!f.hasFeedbackMessage()) {
f.add(new SimpleAttributeModifier("class", ""));
f.add(new AttributeModifier("class", ""));
}
}

Expand All @@ -242,25 +245,25 @@ public void renderHead(IHeaderResponse response) {
String toolBaseCSS = skinRepo + "/tool_base.css";

//Sakai additions
response.renderJavascriptReference("/library/js/headscripts.js");
response.renderCSSReference(toolBaseCSS);
response.renderCSSReference(toolCSS);
response.renderOnLoadJavascript("setMainFrameHeight( window.name )");
response.render(JavaScriptHeaderItem.forUrl("/library/js/headscripts.js"));
response.render(CssHeaderItem.forUrl(toolBaseCSS));
response.render(CssHeaderItem.forUrl(toolCSS));
response.render(OnDomReadyHeaderItem.forScript("setMainFrameHeight( window.name )"));

//Tool additions (at end so we can override if required)
response.renderString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");
response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
//response.renderCSSReference("css/my_tool_styles.css");
//response.renderJavascriptReference("js/my_tool_javascript.js");

//for jQuery
response.renderJavascriptReference("/library/webjars/jquery/1.11.3/jquery.min.js");
response.renderJavascriptReference("/library/webjars/jquery-ui/1.11.3/jquery-ui.min.js");
response.render(JavaScriptHeaderItem.forUrl("/library/webjars/jquery/1.11.3/jquery.min.js"));
response.render(JavaScriptHeaderItem.forUrl("/library/webjars/jquery-ui/1.11.3/jquery-ui.min.js"));

//for datepicker
response.renderCSSReference("/library/webjars/jquery-ui/1.11.3/jquery-ui.css");
response.renderJavascriptReference("javascript/delegated-access.js");
response.renderJavascriptReference("javascript/jquery.asmselect.js");
response.renderCSSReference("css/jquery.asmselect.css");
response.render(CssHeaderItem.forUrl("/library/webjars/jquery-ui/1.11.3/jquery-ui.css"));
response.render(JavaScriptHeaderItem.forUrl("javascript/delegated-access.js"));
response.render(JavaScriptHeaderItem.forUrl("javascript/jquery.asmselect.js"));
response.render(CssHeaderItem.forUrl("css/jquery.asmselect.css"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.tree.AbstractTree;
import org.apache.wicket.extensions.markup.html.tree.AbstractTree;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
Expand Down Expand Up @@ -165,7 +165,7 @@ public void onClick(AjaxRequestTarget target)
getTree().getTreeState().collapseAll();
expandCollapse.setDefaultModel(new StringResourceModel("exapndNodes", null));
}
target.addComponent(expandCollapse);
target.add(expandCollapse);
getTree().updateTree(target);
expand = !expand;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public EditablePanelAdvancedOptions(String id, IModel inputModel, final NodeMode
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='none';");
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='none';");
//In order for the models to refresh, you have to call "expand" or "collapse" then "updateTree",
//since I don't want to expand or collapse, I just call whichever one the node is already
//Refreshing the tree will update all the models and information (like role) will be generated onClick
Expand All @@ -74,7 +74,7 @@ public void onClick(AjaxRequestTarget target) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='';");
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='';");
}
};
add(restrictToolsLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public EditablePanelAdvancedOptionsText(String id, IModel inputModel, final Node
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + inheritedSpanId + "').style.display='';");
target.appendJavaScript("document.getElementById('" + inheritedSpanId + "').style.display='';");
}
};

Expand All @@ -54,7 +54,7 @@ public void onClick(AjaxRequestTarget target) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + inheritedSpanId + "').style.display='none';");
target.appendJavaScript("document.getElementById('" + inheritedSpanId + "').style.display='none';");
}
};
inheritedSpan.add(closeInheritedSpanLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public EditablePanelAdvancedUserOptions(String id, IModel inputModel, final Node
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='none';");
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='none';");
//In order for the models to refresh, you have to call "expand" or "collapse" then "updateTree",
//since I don't want to expand or collapse, I just call whichever one the node is already
//Refreshing the tree will update all the models and information (like role) will be generated onClick
Expand All @@ -78,7 +78,7 @@ public void onClick(AjaxRequestTarget target) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='';");
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='';");
}
};
add(restrictToolsLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public EditablePanelAdvancedUserOptionsText(String id, IModel inputModel, final
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + inheritedSpanId + "').style.display='';");
target.appendJavaScript("document.getElementById('" + inheritedSpanId + "').style.display='';");
}
};

Expand All @@ -56,7 +56,7 @@ public void onClick(AjaxRequestTarget target) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + inheritedSpanId + "').style.display='none';");
target.appendJavaScript("document.getElementById('" + inheritedSpanId + "').style.display='none';");
}
};
inheritedSpan.add(closeInheritedSpanLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public EditablePanelList(String id, IModel inputModel, final NodeModel nodeModel
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='none';");
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='none';");
//In order for the models to refresh, you have to call "expand" or "collapse" then "updateTree",
//since I don't want to expand or collapse, I just call whichever one the node is already
//Refreshing the tree will update all the models and information (like role) will be generated onClick
Expand Down Expand Up @@ -174,7 +174,7 @@ protected void onUpdate(AjaxRequestTarget target){
}else{
checkBox.setEnabled(true);
}
target.addComponent(checkBox, checkBoxId);
target.add(checkBox, checkBoxId);
}

private boolean isPublicChecked(){
Expand Down Expand Up @@ -210,9 +210,9 @@ public void onClick(AjaxRequestTarget target) {
listOptions = getNodeModelToolsList(nodeModel);
}
listView.setDefaultModelObject(listOptions);
target.addComponent(editableSpan);
target.add(editableSpan);
}
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='';");
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='';");
}
};
add(restrictToolsLink);
Expand Down Expand Up @@ -279,8 +279,8 @@ protected void onUpdate(AjaxRequestTarget target){
}
}

target.addComponent(editableSpan);
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='';");
target.add(editableSpan);
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='';");
}
});
editableSpan.add(toggleAllPublicCheckbox);
Expand All @@ -301,8 +301,8 @@ protected void onUpdate(AjaxRequestTarget target){
}
}

target.addComponent(editableSpan);
target.appendJavascript("document.getElementById('" + editableSpanId + "').style.display='';");
target.add(editableSpan);
target.appendJavaScript("document.getElementById('" + editableSpanId + "').style.display='';");
}
});
editableSpan.add(toggleAllAuthCheckboxes);
Expand Down
Loading

0 comments on commit 8644d3d

Please sign in to comment.