Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/Application.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/Application.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/Application.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/Application.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.app; + +import org.apache.wicket.Page; +import org.apache.wicket.authroles.authentication.AbstractAuthenticatedWebSession; +import org.apache.wicket.authroles.authentication.AuthenticatedWebApplication; +import org.apache.wicket.markup.MarkupFactory; +import org.apache.wicket.markup.MarkupParser; +import org.apache.wicket.markup.MarkupResourceStream; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.protocol.http.WebApplication; +import org.apache.wicket.settings.IPageSettings; +import org.openmeetings.web.pages.MenuPage; +import org.openmeetings.web.pages.auth.SignInPage; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +public class Application extends AuthenticatedWebApplication { + @Override + protected void init() { + IPageSettings pageSettings = getPageSettings(); + pageSettings.addComponentResolver(new MessageResolver()); + pageSettings.addComponentResolver(new MessageTagHandler()); + getMarkupSettings().setMarkupFactory(new MarkupFactory(){ + @Override + public MarkupParser newMarkupParser(MarkupResourceStream resource) { + MarkupParser mp = super.newMarkupParser(resource); + mp.add(new MessageTagHandler()); + return mp; + } + }); + super.init(); + mountPage("signin", getSignInPageClass()); + } + + @Override + public Class<? extends Page> getHomePage() { + return MenuPage.class; + } + + @Override + protected Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() { + return WebSession.class; + } + + @Override + protected Class<? extends WebPage> getSignInPageClass() { + return SignInPage.class; + } + + public static Application get() { + return (Application) WebApplication.get(); + } + + public static <T> T getBean(Class<T> clazz) { + ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(get().getServletContext()); + return context.getBean(clazz); + } +}
Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageResolver.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageResolver.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageResolver.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageResolver.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.app; + +import org.apache.wicket.Component; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.MarkupStream; +import org.apache.wicket.markup.WicketTag; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.parser.filter.WicketTagIdentifier; +import org.apache.wicket.markup.resolver.WicketMessageResolver; + +public class MessageResolver extends WicketMessageResolver { + private static final long serialVersionUID = -5755259669383826988L; + private final static String TAG_NAME = "ommessage"; + + static { + // register "wicket:ommessage" + WicketTagIdentifier.registerWellKnownTagName(TAG_NAME); + } + + @Override + public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) { + if (tag instanceof WicketTag) { + WicketTag wtag = (WicketTag)tag; + if (TAG_NAME.equals(wtag.getName())) { + Long messageKey = wtag.getAttributes().getAsLong("key"); + if (messageKey != null) { + final String id = "_message_" + container.getPage().getAutoIndex(); + Label label = new Label(id, WebSession.getString(messageKey)); + label.setRenderBodyOnly(container.getApplication() + .getMarkupSettings() + .getStripWicketTags()); + + return label; + } + } + } + return super.resolve(container, markupStream, tag); + } +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageTagHandler.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageTagHandler.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageTagHandler.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/MessageTagHandler.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.app; + +import java.text.ParseException; + +import org.apache.wicket.Component; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.WicketRuntimeException; +import org.apache.wicket.behavior.Behavior; +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.MarkupElement; +import org.apache.wicket.markup.MarkupResourceStream; +import org.apache.wicket.markup.MarkupStream; +import org.apache.wicket.markup.html.TransparentWebMarkupContainer; +import org.apache.wicket.markup.html.WebComponent; +import org.apache.wicket.markup.parser.AbstractMarkupFilter; +import org.apache.wicket.markup.parser.filter.WicketMessageTagHandler; +import org.apache.wicket.markup.resolver.IComponentResolver; +import org.apache.wicket.util.string.Strings; + +public class MessageTagHandler extends AbstractMarkupFilter implements + IComponentResolver { + /** */ + private static final long serialVersionUID = 1L; + + /** + * The id automatically assigned to tags with wicket:message attribute but + * without id + */ + public final static String WICKET_MESSAGE_CONTAINER_ID = "_message_attr_"; + + /** + * Constructor for the IComponentResolver role. + */ + public MessageTagHandler() { + this(null); + } + + /** + * Constructor for the IMarkupFilter role. + */ + public MessageTagHandler(final MarkupResourceStream markupResourceStream) { + super(markupResourceStream); + } + + @Override + protected final MarkupElement onComponentTag(ComponentTag tag) + throws ParseException { + if (tag.isClose()) { + return tag; + } + + final String wicketMessageAttribute = tag.getAttributes().getString( + getWicketMessageAttrName()); + + if (Strings.isEmpty(wicketMessageAttribute) == false) { + // check if this tag is raw markup + if (tag.getId() == null) { + // if this is a raw tag we need to set the id to something so + // that wicket will not merge this as raw markup and instead + // pass it on to a resolver + tag.setId(getWicketMessageIdPrefix()); + tag.setAutoComponentTag(true); + tag.setModified(true); + } + tag.addBehavior(new AttributeLocalizer(getWicketMessageAttrName())); + } + + return tag; + } + + /** + * Attribute localizing behavior. See the javadoc of + * {@link WicketMessageTagHandler} for details. + * + * @author Igor Vaynberg (ivaynberg) + */ + public static class AttributeLocalizer extends Behavior { + private static final long serialVersionUID = 1L; + + private final String wicketMessageAttrName; + + public AttributeLocalizer(String wicketMessageAttrName) { + this.wicketMessageAttrName = wicketMessageAttrName; + } + + @Override + public void onComponentTag(final Component component, + final ComponentTag tag) { + String expr = tag.getAttributes().getString(wicketMessageAttrName); + if (!Strings.isEmpty(expr)) { + expr = expr.trim(); + + String[] attrsAndKeys = Strings.split(expr, ','); + + for (String attrAndKey : attrsAndKeys) { + int colon = attrAndKey.lastIndexOf(":"); + // make sure the attribute-key pair is valid + if (attrAndKey.length() < 3 || colon < 1 + || colon > attrAndKey.length() - 2) { + throw new WicketRuntimeException( + "wicket:message attribute contains an invalid value [[" + + expr + + "]], must be of form (attr:key)+"); + } + + String attr = attrAndKey.substring(0, colon); + String key = attrAndKey.substring(colon + 1); + final String value = WebSession.getString(Long.parseLong(key)); + tag.put(attr, value); + } + } + } + } + + public Component resolve(final MarkupContainer container, final MarkupStream markupStream, + final ComponentTag tag) { + // localize any raw markup that has wicket:message attrs + if ((tag != null) + && (tag.getId().startsWith(getWicketMessageIdPrefix()))) { + Component wc; + int autoIndex = container.getPage().getAutoIndex(); + String id = getWicketMessageIdPrefix() + autoIndex; + + if (tag.isOpenClose()) { + wc = new WebComponent(id); + } else { + wc = new TransparentWebMarkupContainer(id); + } + + return wc; + } + return null; + } + + private String getWicketMessageAttrName() { + String wicketNamespace = getWicketNamespace(); + return wicketNamespace + ':' + "ommessage"; + } + + private String getWicketMessageIdPrefix() { + return getWicketNamespace() + WICKET_MESSAGE_CONTAINER_ID; + } +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/WebSession.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/WebSession.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/WebSession.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/app/WebSession.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.app; + +import org.apache.wicket.authroles.authentication.AbstractAuthenticatedWebSession; +import org.apache.wicket.authroles.authorization.strategies.role.Roles; +import org.apache.wicket.request.Request; +import org.openmeetings.app.data.basic.AuthLevelmanagement; +import org.openmeetings.app.data.basic.Configurationmanagement; +import org.openmeetings.app.data.basic.Fieldmanagment; +import org.openmeetings.app.data.basic.Sessionmanagement; +import org.openmeetings.app.data.user.Usermanagement; +import org.openmeetings.app.data.user.dao.UsersDaoImpl; +import org.openmeetings.app.persistence.beans.basic.Sessiondata; +import org.openmeetings.app.persistence.beans.user.Users; + +public class WebSession extends AbstractAuthenticatedWebSession { + private static final long serialVersionUID = 1123393236459095315L; + private long userId = -1; + private long userLevel = -1; + private String SID = null; + + public WebSession(Request request) { + super(request); + } + + @Override + public Roles getRoles() { + Roles r = null; + if (isSignedIn()) { + userLevel = Application.getBean(Usermanagement.class).getUserLevelByID(userId); + AuthLevelmanagement authLevel = Application.getBean(AuthLevelmanagement.class); + r = new Roles(Roles.USER); + if (authLevel.checkUserLevel(userLevel)) { + r.add(Roles.USER); + } + if (authLevel.checkAdminLevel(userLevel)) { + r.add(Roles.ADMIN); + } + } + return r; + } + + @Override + public boolean isSignedIn() { + return (userId > -1); + } + + public boolean signIn(String login, String password) { + Sessiondata sessData = Application.getBean(Sessionmanagement.class).startsession(); + SID = sessData.getSession_id(); + Object u = Application.getBean(Usermanagement.class).loginUser(SID, login, password, + null, false); + + if (u instanceof Users) { + userId = ((Users)u).getUser_id(); + return true; + } + return false; + } + + public static WebSession get() { + return (WebSession)AbstractAuthenticatedWebSession.get(); + } + + public static String getString(long id) { + Fieldmanagment fieldManagment = Application.getBean(Fieldmanagment.class); + return fieldManagment.getString(id, getLanguage()); + } + + public static long getLanguage() { + WebSession session = get(); + if (session.isSignedIn()) { + return Application.getBean(UsersDaoImpl.class).getUser(session.userId).getLanguage_id(); + } else { + return Application.getBean(Configurationmanagement.class).getConfValue("default_lang_id", Long.class, "1"); + } + } + + public static String getSid() { + return get().SID; + } + + public static long getUserId() { + return get().userId; + } + + public static long getUserLevel() { + return get().userLevel; + } +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.html URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.html?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.html (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.html Wed Aug 29 18:41:42 2012 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.5-strict.dtd" lang="en"> + <head> + <title><span wicket:id="pageTitle">[login]</span></title> + </head> + <body> + <div id="header"> + <span id="logo"></span><span id="appName" wicket:id="appName"></span> + </div> + <wicket:child /> + </body> +</html> \ No newline at end of file Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/BasePage.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.pages; + +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.openmeetings.app.data.basic.Configurationmanagement; +import org.openmeetings.web.app.Application; + +public abstract class BasePage extends WebPage { + private static final long serialVersionUID = -6237917782433412496L; + + public BasePage() { + String appName = Application.getBean(Configurationmanagement.class).getAppName(); + add(new Label("pageTitle", appName).setRenderBodyOnly(true)); + add(new Label("appName", appName)); + } +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.html URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.html?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.html (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.html Wed Aug 29 18:41:42 2012 @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.5-strict.dtd" lang="en"> + <wicket:head> + <link media="screen" type="text/css" rel="stylesheet" href="css/jMenu.jquery.css"/> + <link media="screen" type="text/css" rel="stylesheet" href="css/theme.css"/> + + <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> + <script type="text/javascript" src="js/jquery-ui-1.8.23.custom.min.js"></script> + <script type="text/javascript" src="js/jMenu.jquery.min.js"></script> + <link media="screen" type="text/css" rel="stylesheet" href="css/jquery-ui-1.8.23.custom.css"/> + <script type="text/javascript"> + $(function() { + $("#jMenu").jMenu({ + openClick : false + , ulWidth : 'auto' + , effects : { + effectSpeedOpen : 300 + , effectSpeedClose : 300 + , effectTypeOpen : 'slide' + , effectTypeClose : 'slide' + , effectOpen : 'linear' + , effectClose : 'linear' + } + , TimeBeforeOpening : 100 + , TimeBeforeClosing : 400 + , animatedText : false + , paddingLeft: 1 + }); + }); + </script> + </wicket:head> + <wicket:extend> + <div id="topLinks"><wicket:ommessage key="1188"/>|<wicket:ommessage key="5"/>|<wicket:ommessage key="310"/>|<wicket:ommessage key="284"/></div> + <div id="menu"> + <ul id="jMenu"> + <li wicket:id="mainItem"> + <a class="fNiv" href="#"><span wicket:id="label"></span></a> + <ul wicket:enclosure="childItem"> + <li class="arrow" style="width: 97px; "></li> + <li wicket:id="childItem"> + <a wicket:id="link" href="#"> + <span wicket:id="name"></span><br /> + <span wicket:id="description"></span> + </a> + </li> + </ul> + </li> + </ul> + </div> + <wicket:child /> + </wicket:extend> +</html> \ No newline at end of file Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/MenuPage.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.pages; + +import java.util.List; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.openmeetings.app.data.basic.Navimanagement; +import org.openmeetings.app.persistence.beans.basic.Naviglobal; +import org.openmeetings.app.persistence.beans.basic.Navimain; +import org.openmeetings.web.app.Application; +import org.openmeetings.web.app.WebSession; +import org.openmeetings.web.pages.admin.UsersPage; + +public class MenuPage extends UserPage { + private static final long serialVersionUID = 6421960759218157999L; + private enum MenuActions { + dashboardModuleStartScreen + , dashboardModuleCalendar + , recordModule + , conferenceModuleRoomList + , eventModuleRoomList + , moderatorModuleUser + , moderatorModuleRoom + , adminModuleUser + , adminModuleConnections + , adminModuleOrg + , adminModuleRoom + , adminModuleConfiguration + , adminModuleLanguages + , adminModuleLDAP + , adminModuleBackup + , adminModuleServers + } + + public MenuPage() { + //FIXME all this need to be refactored + List<Naviglobal> menu = Application.getBean(Navimanagement.class) + .getMainMenu(WebSession.getUserLevel(), WebSession.getUserId(), WebSession.getLanguage()); + + RepeatingView repeater = new RepeatingView("mainItem"); + add(repeater); + for (Naviglobal global : menu) { + AbstractItem item = new AbstractItem(repeater.newChildId()); + repeater.add(item); + item.add(new Label("label", global.getLabel().getValue()).setRenderBodyOnly(true)); + + RepeatingView subRepeater = new RepeatingView("childItem"); + item.add(subRepeater); + for (Navimain subMenu : global.getMainnavi()) { + AbstractItem subItem = new AbstractItem(subRepeater.newChildId()); + subRepeater.add(subItem); + + + Link<Void> link = new BookmarkablePageLink<Void>("link", MenuPage.class); + switch(MenuActions.valueOf(subMenu.getAction())) { + case dashboardModuleStartScreen: + break; + case dashboardModuleCalendar: + break; + case recordModule: + break; + case conferenceModuleRoomList: + //requires params + break; + case eventModuleRoomList: + break; + case moderatorModuleUser: + break; + case moderatorModuleRoom: + break; + case adminModuleUser: + link = new BookmarkablePageLink<Void>("link", UsersPage.class); + break; + case adminModuleConnections: + break; + case adminModuleOrg: + break; + case adminModuleRoom: + break; + case adminModuleConfiguration: + break; + case adminModuleLanguages: + break; + case adminModuleLDAP: + break; + case adminModuleBackup: + break; + case adminModuleServers: + break; + } + subItem.add(link); + link.add(new Label("name", subMenu.getLabel().getValue()).setRenderBodyOnly(true)); + link.add(new Label("description", subMenu.getTooltip().getValue()).setRenderBodyOnly(true)); + } + } + } +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/UserPage.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/UserPage.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/UserPage.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/UserPage.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.pages; + +import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; + +@AuthorizeInstantiation("USER") +public abstract class UserPage extends BasePage { + private static final long serialVersionUID = -6237917782433412496L; +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/AdminPage.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/AdminPage.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/AdminPage.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/AdminPage.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.pages.admin; + +import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; +import org.openmeetings.web.pages.MenuPage; + +@AuthorizeInstantiation("ADMIN") +public class AdminPage extends MenuPage { + private static final long serialVersionUID = -3717834731100198593L; + +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.html URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.html?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.html (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.html Wed Aug 29 18:41:42 2012 @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.5-strict.dtd" lang="en"> + <wicket:extend> + Users will goes here + </wicket:extend> +</html> Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/admin/UsersPage.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.pages.admin; + +public class UsersPage extends AdminPage { + private static final long serialVersionUID = -4463107742579790120L; + + public UsersPage() { + } +} Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.html URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.html?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.html (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.html Wed Aug 29 18:41:42 2012 @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--><html xmlns="http://www.w3.org/1999/xhtml" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.5-strict.dtd" lang="en"> + <wicket:head> + <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> + <script type="text/javascript" src="js/jquery-ui-1.8.23.custom.min.js"></script> + <link media="screen" type="text/css" rel="stylesheet" href="css/jquery-ui-1.8.23.custom.css"/> + <style> + #login .ui-dialog .ui-dialog-titlebar-close { + display: none; + } + </style> + <script type="text/javascript"> + $(function(){ + $('#login').dialog({ + closeOnEscape: false + , resizable: false + , open: function(event, ui) { + $(".ui-dialog-titlebar-close").hide(); + } + }); + }); + </script> + </wicket:head> + <wicket:extend> + <div id="login" wicket:ommessage="title:108"> + <form wicket:id="signin"> + <table> + <tr> + <td><wicket:ommessage key="109" /></td> + <td><input wicket:id="login" type="text" value="" /></td> + </tr> + <tr> + <td><wicket:ommessage key="110" /></td> + <td><input wicket:id="pass" type="password" value="" /></td> + </tr> + <tr> + <td align="right" colspan="2"><input type="submit" wicket:ommessage="value:112"/></td> + </tr> + </table> + <span wicket:id="feedback"></span> + </form> + </div> + </wicket:extend> +</html> \ No newline at end of file Added: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.java?rev=1378676&view=auto ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.java (added) +++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/web/pages/auth/SignInPage.java Wed Aug 29 18:41:42 2012 @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.web.pages.auth; + +import org.apache.wicket.markup.html.form.PasswordTextField; +import org.apache.wicket.markup.html.form.RequiredTextField; +import org.apache.wicket.markup.html.form.StatelessForm; +import org.apache.wicket.markup.html.panel.FeedbackPanel; +import org.apache.wicket.model.Model; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.openmeetings.web.app.Application; +import org.openmeetings.web.app.WebSession; +import org.openmeetings.web.pages.BasePage; + +public class SignInPage extends BasePage { + private static final long serialVersionUID = -3843571657066167592L; + + public SignInPage(PageParameters p) { + this(); + } + + public SignInPage() { + add(new SignInForm("signin")); + } + + class SignInForm extends StatelessForm<Void> { + private static final long serialVersionUID = 4079939497154278822L; + private String password; + private String login; + + public SignInForm(String id) { + super(id); + + add(new FeedbackPanel("feedback")); + add(new RequiredTextField<String>("login", new Model<String>(){ + private static final long serialVersionUID = -1335578251793516071L; + + @Override + public String getObject() { + return SignInForm.this.login; + } + + @Override + public void setObject(String object) { + SignInForm.this.login = object; + } + })); + add(new PasswordTextField("pass", new Model<String>(){ + private static final long serialVersionUID = 4751494320421393717L; + + @Override + public String getObject() { + return SignInForm.this.password; + } + + @Override + public void setObject(String object) { + SignInForm.this.password = object; + } + }).setResetPassword(true)); + } + + @Override + protected void onSubmit() { + if (WebSession.get().signIn(login, password)) { + continueToOriginalDestination(); + // if we reach this line there was no intercept page, so go to home page + setResponsePage(Application.get().getHomePage()); + } + } + } +/* + @Override + protected void configureResponse(WebResponse response) { + super.configureResponse(response); + response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store"); + } +*/ +}
