public void filePropsLoaded(
     final PageParameter pageParameter,
     final Map<String, Object> dataBinding,
     final List<String> visibleToggleSelector,
     final List<String> readonlySelector,
     final List<String> disabledSelector) {
   final ComponentParameter nComponentParameter =
       FilePagerUtils.getComponentParameter(pageParameter);
   final IFilePagerHandle handle = (IFilePagerHandle) nComponentParameter.getComponentHandle();
   final FileBean fileBean = handle.getEntityBeanByRequest(nComponentParameter);
   if (fileBean != null) {
     dataBinding.put("file_topic", fileBean.getTopic());
     dataBinding.put("file_description", fileBean.getDescription());
   }
 }
Exemple #2
0
 public IForward save(final ComponentParameter compParameter) {
   final String app = compParameter.getRequestParameter("app");
   return jsonForward(
       compParameter,
       new JsonCallback() {
         @Override
         public void doAction(final Map<String, Object> json) {
           OAuth oauth = new OAuth();
           oauth.setOauth_consumer_key("801123157");
           oauth.setOauth_consumer_secret("56e0f48a0c0912faae199118fed7dfa8");
           oauth.setOauth_callback(ItSiteUtil.url + AppUtils.deploy + app + ".html");
           // 获取request token
           OAuthClient auth = new OAuthClient();
           oauth.setOauth_verifier(compParameter.getRequestParameter("oauth_verifier"));
           oauth.setOauth_token(compParameter.getRequestParameter("oauth_token"));
           oauth.setOauth_token_secret(
               (String) compParameter.getSession().getAttribute("oauth_token_secret"));
           try {
             oauth = auth.accessToken(oauth);
             if (oauth.getStatus() != 2) {
               AAction action = null;
               if ("a001".equals(app)) {
                 action = new A001Action();
               } else if ("a002".equals(app)) {
                 action = new A002Action();
               } else if ("a003".equals(app)) {
                 action = new A003Action();
               } else if ("a004".equals(app)) {
                 action = new A004Action();
               } else if ("a005".equals(app)) {
                 action = new A005Action();
               } else if ("a006".equals(app)) {
                 action = new A006Action();
               } else if ("a007".equals(app)) {
                 action = new A007Action();
               } else if ("a008".equals(app)) {
                 action = new A008Action();
               } else if ("a009".equals(app)) {
                 action = new A009Action();
               } else if ("a010".equals(app)) {
                 action = new A010Action();
               } else if ("a011".equals(app)) {
                 action = new A011Action();
               } else if ("a012".equals(app)) {
                 action = new A012Action();
               }
               action.app(oauth, auth, compParameter);
             }
           } catch (Exception e1) {
             e1.printStackTrace();
           }
         }
       });
 }
 public static String doProgressBarHandle(
     final HttpServletRequest request, final HttpServletResponse response) {
   final ComponentParameter nComponentParameter = getComponentParameter(request, response);
   if (nComponentParameter.componentBean != null) {
     final IProgressBarHandle handle =
         (IProgressBarHandle) nComponentParameter.getComponentHandle();
     if (handle != null) {
       final HttpSession httpSession = request.getSession();
       ProgressState state;
       final String beanId = nComponentParameter.componentBean.hashId();
       if (ConvertUtils.toBoolean(request.getParameter("starting"), false)) {
         httpSession.setAttribute(beanId, state = new ProgressState());
       } else {
         state = (ProgressState) httpSession.getAttribute(beanId);
       }
       if (state != null) {
         if (ConvertUtils.toBoolean(request.getParameter("messages"), false)) {
           return JSONUtils.toJSON(state.messages);
         }
         state.abort = ConvertUtils.toBoolean(request.getParameter("abort"), false);
         handle.doProgressState(nComponentParameter, state);
         final StringBuilder sb = new StringBuilder();
         sb.append("{");
         sb.append("\"step\" : ").append(state.step).append(",");
         sb.append("\"maxProgressValue\" : ").append(state.maxProgressValue).append(",");
         final int size = state.messages.size();
         if (size > 0) {
           sb.append("\"message\" : \"");
           sb.append(JavascriptUtils.escape(String.valueOf(state.messages.get(size - 1))));
           sb.append("\",");
         }
         sb.append("\"abort\" : ").append(state.abort);
         sb.append("}");
         return sb.toString();
       }
     }
   }
   return "{}";
 }
Exemple #4
0
 public IForward op(final ComponentParameter compParameter) {
   final String app = compParameter.getRequestParameter("app");
   final String url = AppUtils.authorizeQQWeibo(compParameter, app);
   if (StringUtils.hasText(url)) {
     return jsonForward(
         compParameter,
         new JsonCallback() {
           @Override
           public void doAction(final Map<String, Object> json) {
             json.put("url", url);
           }
         });
   } else {
     return null;
   }
 }
Exemple #5
0
 public IForward loadTools(ComponentParameter compParameter) {
   final String portal = compParameter.getRequestParameter("portal");
   final PortalModule portalModule = PortalModuleRegistryFactory.getInstance().getModule(portal);
   final PageletBean pageletBean = new PageletBean();
   pageletBean.setModule(portal);
   AbstractPortalModuleHandle moduleHandle;
   try {
     moduleHandle =
         (AbstractPortalModuleHandle)
             Class.forName(portalModule.getHandleClass())
                 .getConstructor(PageletBean.class)
                 .newInstance(pageletBean);
     return moduleHandle.getPageletContent(compParameter);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return new UrlForward("/tools.html");
 }
 @Override
 public String getJavascriptCode(final ComponentParameter compParameter) {
   final StringBuilder sb = new StringBuilder();
   sb.append(super.getJavascriptCode(compParameter));
   final AbstractComponentBean rComponent =
       (AbstractComponentBean) compParameter.componentBean.getAttribute("__componentBean");
   IComponentJavascriptRender jsRender = null;
   if (rComponent instanceof TreeBean) {
     jsRender =
         (IComponentJavascriptRender)
             AbstractComponentRegistry.getRegistry(TreeRegistry.tree).getComponentRender();
   } else if (rComponent instanceof ListboxBean) {
     jsRender =
         (IComponentJavascriptRender)
             AbstractComponentRegistry.getRegistry(ListboxRegistry.listbox).getComponentRender();
   }
   if (jsRender != null) {
     sb.append(jsRender.getJavascriptCode(ComponentParameter.get(compParameter, rComponent)));
   }
   return sb.toString();
 }
 public static ComponentParameter getComponentParameter(
     final HttpServletRequest request, final HttpServletResponse response) {
   return ComponentParameter.get(request, response, BEAN_ID);
 }
 public static ComponentParameter getComponentParameter(
     final PageRequestResponse requestResponse) {
   return ComponentParameter.get(requestResponse, BEAN_ID);
 }
 @Override
 public IDataObjectQuery<?> createDataObjectQuery(final ComponentParameter compParameter) {
   final String projectId = compParameter.getRequestParameter("projectId");
   return PTUtils.applicationModule.queryPtUserBidBeans(projectId);
 }
 public static ComponentParameter getComponentParameter(
     final HttpServletRequest request, final HttpServletResponse response) {
   return ComponentParameter.get(request, response, messageWindowId);
 }
 public static ComponentParameter getComponentParameter(
     final PageRequestResponse requestResponse) {
   return ComponentParameter.get(requestResponse, messageWindowId);
 }