<% /** * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ %> <% PortletURL portletURL = renderResponse.createRenderURL(); portletURL.setWindowState(WindowState.MAXIMIZED); portletURL.setParameter("struts_action", "/shopping/view"); portletURL.setParameter("tabs1", tabs1); %>
<% CouponSearch searchContainer = new CouponSearch(renderRequest, portletURL); List headerNames = searchContainer.getHeaderNames(); headerNames.add(StringPool.BLANK); searchContainer.setRowChecker(new RowChecker(renderResponse)); %> <% CouponSearchTerms searchTerms = (CouponSearchTerms)searchContainer.getSearchTerms(); int total = ShoppingCouponLocalServiceUtil.searchCount(scopeGroupId, company.getCompanyId(), searchTerms.getCode(), searchTerms.isActive(), searchTerms.getDiscountType(), searchTerms.isAndOperator()); searchContainer.setTotal(total); List results = ShoppingCouponServiceUtil.search(scopeGroupId, company.getCompanyId(), searchTerms.getCode(), searchTerms.isActive(), searchTerms.getDiscountType(), searchTerms.isAndOperator(), searchContainer.getStart(), searchContainer.getEnd()); searchContainer.setResults(results); %>
" onClick="deleteCoupons();" />

<% List resultRows = searchContainer.getResultRows(); for (int i = 0; i < results.size(); i++) { ShoppingCoupon coupon = (ShoppingCoupon)results.get(i); coupon = coupon.toEscapedModel(); ResultRow row = new ResultRow(coupon, coupon.getCouponId(), i); PortletURL rowURL = renderResponse.createRenderURL(); rowURL.setWindowState(WindowState.MAXIMIZED); rowURL.setParameter("struts_action", "/shopping/edit_coupon"); rowURL.setParameter("redirect", currentURL); rowURL.setParameter("couponId", String.valueOf(coupon.getCouponId())); // Code row.addText(coupon.getCode(), rowURL); // Name and description StringBuilder sb = new StringBuilder(); sb.append(coupon.getName()); if (Validator.isNotNull(coupon.getDescription())) { sb.append("
"); sb.append(coupon.getDescription()); } row.addText(sb.toString(), rowURL); // Start date row.addText(dateFormatDateTime.format(coupon.getStartDate()), rowURL); // End date if (coupon.getEndDate() == null) { row.addText(LanguageUtil.get(pageContext, "never"), rowURL); } else { row.addText(dateFormatDateTime.format(coupon.getEndDate()), rowURL); } // Discount type row.addText(LanguageUtil.get(pageContext, coupon.getDiscountType()), rowURL); // Action row.addJSP("right", SearchEntry.DEFAULT_VALIGN, "/html/portlet/shopping/coupon_action.jsp"); // Add result row resultRows.add(row); } %>