Skip to content

Commit

Permalink
UP-3645
Browse files Browse the repository at this point in the history
Add a feature to filter the Portlet Registry by status
  • Loading branch information
waymirec authored and edalquist committed Jan 31, 2013
1 parent 0f4f48b commit 7a686c1
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ set.new.account.password=Set new account password
setting=Setting
show=Show
show.me=Show me
show.portlet.state=In State
show.portlet.window.chrome=Show portlet window chrome
sign.in=Sign In
sign.in.to.portal=Sign in to uPortal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ PORTLET DEVELOPMENT STANDARDS AND GUIDELINES
<select id="${n}categorySelectMenu">
<option value=""><spring:message code="all"/></option>
</select>
<label for="${n}stateSelectMenu"><spring:message code="show.portlet.state"/></label>
<select id="${n}stateSelectMenu">
<option value=""><spring:message code="all"/></option>
</select>
</div>
<div class="fl-col flc-pager-top view-pager">
<ul id="pager-top" class="fl-pager-ui">
Expand Down Expand Up @@ -165,7 +169,63 @@ PORTLET DEVELOPMENT STANDARDS AND GUIDELINES
var portletTypes = { };
<c:forEach items="${portletTypes}" var="type">portletTypes[${type.id}] = '${type.name}';</c:forEach>
up.PortletAdministrationStateListView = function(container, overallThat, options) {
// construct the new component
var that = fluid.initView("up.PortletAdministrationStateListView", container, options);
// initialize a state map for this component
that.state = {};
var states = [];
states.push({
id: "",
name: "<spring:message code="all"/>"
});
<c:forEach items="${ lifecycleStates }" var="lifecycleState">
states.push({ id: "${lifecycleState}", name: "${lifecycleState}" })
</c:forEach>
var tree = { children: [] };
var s = overallThat.state.currentState || "";
var selection = {
ID: "stateSelect",
selection: s,
optionlist: [],
optionnames: [],
decorators: [
{ type: "jQuery", func: "change",
args: function(){
var state = null;
if($(this).val()) {
state = { id: $(this).val(), name: $(this).val() }
} else {
state = { id: "", name: $(this).val() }
}
overallThat.events.onStateSelect.fire(overallThat, state);
}
}
]
};
$(states).each(function(idx, state){
selection.optionlist.push(state.id);
selection.optionnames.push(state.name.charAt(0).toUpperCase() + state.name.slice(1).toLowerCase());
});
tree.children.push(selection);
var cutpoints = [ { id: "stateSelect", selector: "#${n}stateSelectMenu" } ];
// render the component
that.state.templates = fluid.selfRender($(container).find(".view-filter"), tree, { cutpoints: cutpoints });
that.refresh = function() { };
return that;
};
up.PortletAdministrationCategoryListView = function(container, overallThat, options) {
// construct the new component
Expand Down Expand Up @@ -256,7 +316,9 @@ PORTLET DEVELOPMENT STANDARDS AND GUIDELINES
var members = (overallThat.state.currentCategory && overallThat.state.currentCategory != "" ) ? overallThat.registry.getMemberPortlets(overallThat.state.currentCategory, true) : overallThat.registry.getAllPortlets();
$(members).each(function(idx, portlet){
if (!overallThat.state.portletRegex || overallThat.state.portletRegex.test(portlet.title) || overallThat.state.portletRegex.test(portlet.description)) {
portlets.push(portlet);
if((overallThat.state.currentState == null) || ((overallThat.state.currentState.id === "") || (portlet.state.toUpperCase() === overallThat.state.currentState.id.toUpperCase()))) {
portlets.push(portlet);
}
}
});
portlets.sort(up.getStringPropertySortFunction("name"));
Expand Down Expand Up @@ -314,7 +376,9 @@ PORTLET DEVELOPMENT STANDARDS AND GUIDELINES
var members = overallThat.state.currentCategory ? overallThat.registry.getMemberPortlets(overallThat.state.currentCategory, true) : overallThat.registry.getAllPortlets();
$(members).each(function(idx, portlet){
if (!overallThat.state.portletRegex || overallThat.state.portletRegex.test(portlet.name) || overallThat.state.portletRegex.test(portlet.description)) {
portlets.push(portlet);
if((overallThat.state.currentState == null) || ((overallThat.state.currentState.id === "") || (portlet.state.toUpperCase() === overallThat.state.currentState.id.toUpperCase()))) {
portlets.push(portlet);
}
}
});
portlets.sort(up.getStringPropertySortFunction("name"));
Expand All @@ -331,6 +395,9 @@ PORTLET DEVELOPMENT STANDARDS AND GUIDELINES
type: "up.PortletRegistry",
options: { portletListUrl: "<c:url value="/api/portletList"><c:param name="type" value="manage"/></c:url>" }
},
stateListView: {
type: "up.PortletAdministrationStateListView"
},
categoryListView: {
type: "up.PortletAdministrationCategoryListView"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
| create a new portlet
+-->
<view-state id="listChannels">
<on-entry>
<set name="viewScope.lifecycleStates" value="portletAdministrationHelper.getLifecycleStates()"/>
</on-entry>

<!-- If we're editing an already-existing portlet, create a form and
populate it with the selected portlet's data -->
<transition on="editPortlet" to="edit-portlet">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ var up = up || {};

// initialize the view subcomponents
that.categoryListView = fluid.initSubcomponent(that, "categoryListView", [container, that, fluid.COMPONENT_OPTIONS]);
that.stateListView = fluid.initSubcomponent(that, "stateListView", [container, that, fluid.COMPONENT_OPTIONS]);
that.searchView = fluid.initSubcomponent(that, "searchView", [container, that, fluid.COMPONENT_OPTIONS]);
that.portletListView = fluid.initSubcomponent(that, "portletListView", [container, that, fluid.COMPONENT_OPTIONS]);

Expand All @@ -220,6 +221,7 @@ var up = up || {};
events: {
onLoad: null,
onCategorySelect: null,
onStateSelect: null,
onPortletSearch: null,
onPortletSelect: null,
onPortletDrag: null
Expand All @@ -231,6 +233,10 @@ var up = up || {};
that.categoryListView.refresh();
that.portletListView.refresh();
},
onStateSelect: function (that, state) {
that.state.currentState = state;
that.portletListView.refresh();
},
onPortletSearch: function (that, searchTerm, submitted) {
searchTerm = $.trim(searchTerm);
that.state.portletRegex = searchTerm.length > 0 ? new RegExp(up.escapeSpecialChars(searchTerm), "i") : undefined;
Expand Down

0 comments on commit 7a686c1

Please sign in to comment.