Examples of SiteConfig


Examples of com.tubeonfire.entity.SiteConfig

public class ReportErrorServlet extends HttpServlet {

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    try {
      SiteConfig siteConfig = SiteConfigModel.get();
      String id = req.getParameter("id");
      StringBuilder mailContent = new StringBuilder();
      mailContent.append("User has reported video error <br/>");
      mailContent.append("Please visit <a href=\"http://"
          + req.getServerName() + "/video/" + id
          + "/error_page.html\">this link</a> to check again !");
      Properties props = new Properties();
      Session sessions = Session.getDefaultInstance(props, null);

      String msgBody = mailContent.toString();
      try {
        Message msg = new MimeMessage(sessions);
        msg.setSubject("Tubeonfire - Video Error Report");
        msg.setFrom(new InternetAddress(siteConfig.getAdminEmail(),
            "Tubeonfire Assistant"));
        msg.addRecipient(Message.RecipientType.TO, new InternetAddress(
            siteConfig.getAdminEmail(), siteConfig.getAdminEmail()));
        msg.setContent(msgBody, "text/html");
        Transport.send(msg);

      } catch (AddressException e) {
        e.printStackTrace();
View Full Code Here

Examples of com.tubeonfire.entity.SiteConfig

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    try {
      String obj = req.getParameter("obj");
      SiteConfig siteConfig = SiteConfigModel.get();
      if (siteConfig == null) {
        siteConfig = new SiteConfig();
        siteConfig.setId(IdUniqueHelper.getId());
        SiteConfigModel.insert(siteConfig);
      }
      req.setAttribute("siteConfig", siteConfig);
      if (obj != null && obj.equals("seo")) {
        req.getRequestDispatcher("/admin/form_seo.jsp").forward(req,
View Full Code Here

Examples of com.tubeonfire.entity.SiteConfig

  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      HttpSession session = req.getSession();
      String obj = req.getParameter("obj");
      SiteConfig siteConfig = SiteConfigModel.get();
      if (obj != null && obj.equals("seo")) {
        String siteName = req.getParameter("siteName");
        String siteTitle = req.getParameter("siteTitle");
        String siteDescription = req.getParameter("siteDescription");
        String siteKeyword = req.getParameter("siteKeyword");
        String analyticCode = req.getParameter("analyticCode");
        if (siteName != null && !siteName.isEmpty()) {
          siteConfig.setSiteName(siteName);
        }
        if (siteTitle != null && !siteTitle.isEmpty()) {
          siteConfig.setSiteTitle(siteTitle);
        }
        if (siteKeyword != null && !siteKeyword.isEmpty()) {
          siteConfig.setSiteKeyword(siteKeyword);
        }
        if (siteDescription != null && !siteDescription.isEmpty()) {
          siteConfig.setSiteDescription(siteDescription);
        }
        if (analyticCode != null && !analyticCode.isEmpty()) {
          siteConfig.setAnalyticCode(analyticCode);
        }
        SiteConfigModel.insert(siteConfig);
        session.setAttribute("success", "Action success !");
        req.setAttribute("siteConfig", siteConfig);
        req.getRequestDispatcher("/admin/form_seo.jsp").forward(req,
            resp);
      } else if (obj != null && obj.equals("logo")) {
        String slogan = (String) req.getParameter("slogan");
        String imgKey = BlobKeyProcess.getBlobKey(req, "image");
        if (slogan != null && !slogan.isEmpty()) {
          siteConfig.setLogoSlogan(slogan);
        }
        if (imgKey == null || imgKey.isEmpty()) {
          siteConfig.setLogoKey("/images/logo.png");
        } else {
          siteConfig.setLogoKey(imgKey);
        }
        SiteConfigModel.insert(siteConfig);
        session.setAttribute("success", "Action success !");
        resp.sendRedirect("/admin/config?obj=logo");
      } else if (obj != null && obj.equals("social")) {
        String twiterLink = (String) req.getParameter("twiterLink");
        String twiterName = (String) req.getParameter("twiterName");
        String facebookLink = (String) req.getParameter("facebookLink");
        String facebookAdminId = (String) req
            .getParameter("facebookAdminId");
        if (twiterLink != null && !twiterLink.isEmpty()) {
          siteConfig.setTwiterLink(twiterLink);
        }
        if (twiterName != null && !twiterName.isEmpty()) {
          siteConfig.setTwiterName(twiterName);
        }
        if (facebookLink != null && !facebookLink.isEmpty()) {
          siteConfig.setFacebookLink(facebookLink);
        }
        if (facebookAdminId != null && !facebookAdminId.isEmpty()) {
          siteConfig.setFacebookAdminId(facebookAdminId);
        }
        SiteConfigModel.insert(siteConfig);
        session.setAttribute("success", "Action success !");
        req.setAttribute("siteConfig", siteConfig);
        req.getRequestDispatcher("/admin/form_social.jsp").forward(req,
            resp);
      } else if (obj != null && obj.equals("slideshow")) {
        String slideOption = (String) req.getParameter("slideOption");
        if (slideOption != null && !slideOption.isEmpty()) {
          siteConfig.setSlideStyle(slideOption);
        }
        SiteConfigModel.insert(siteConfig);
        session.setAttribute("success", "Action success !");
        req.setAttribute("siteConfig", siteConfig);
        req.getRequestDispatcher("/admin/form_slideshow.jsp").forward(
            req, resp);
      } else if (obj != null && obj.equals("system")) {
        String strAdminEmail = (String) req.getParameter("adminEmail");
        String strDisplayObject = (String) req
            .getParameter("displayObject");
        String strPlaylistQuantity = (String) req
            .getParameter("homePagePlaylistQuantity");
        String strChannelQuantity = (String) req
            .getParameter("homePageChannelQuantity");
        String strTubeQuantity = (String) req
            .getParameter("homePageTubeQuantity");
        if (strAdminEmail != null && strAdminEmail.length() > 0) {
          siteConfig.setAdminEmail(strAdminEmail);
        }
        try {
          siteConfig.setHomePageDisplayObject(Integer
              .parseInt(strDisplayObject));
        } catch (Exception e) {
          siteConfig.setHomePageBlockQuantity(2);
        }
        try {
          siteConfig
              .setHomePageBlockQuantity(Integer.parseInt(siteConfig
                  .getHomePageDisplayObject() == 1 ? strPlaylistQuantity
                  : strChannelQuantity));
        } catch (Exception e) {
          siteConfig.setHomePageBlockQuantity(4);
        }
        try {
          siteConfig.setHomePageTubePerBlockQuantity(Integer
              .parseInt(strTubeQuantity));
        } catch (Exception e) {
          siteConfig.setHomePageTubePerBlockQuantity(6);
        }
        SiteConfigModel.insert(siteConfig);
        session.setAttribute("success", "Action success !");
        req.setAttribute("siteConfig", siteConfig);
        req.getRequestDispatcher("/admin/form_system.jsp").forward(req,
View Full Code Here

Examples of com.tubeonfire.entity.SiteConfig

  @SuppressWarnings("unchecked")
  public static SiteConfig get() {
    init();
    try {
      boolean cached = false;
      SiteConfig obj = new SiteConfig();
      if (cache != null) {
        try {
          obj = (SiteConfig) cache.get(cachePrefix);
          if (obj != null)
            cached = true;
        } catch (Exception e) {
          cached = false;
        }
      }
      if (!cached) {
        try {
          obj = (SiteConfig) ofy.query(SiteConfig.class).get();
          if (obj == null) {
            obj = new SiteConfig();
            obj.setId(IdUniqueHelper.getId());
            insert(obj);
          }
          cache.put(cachePrefix, obj);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      return obj;
    } catch (Exception e) {
      e.printStackTrace();
      return new SiteConfig();
    }
  }
View Full Code Here

Examples of org.opoo.press.SiteConfig

    throw new UnsupportedOperationException("deploy(File, Repository)");
  }
 
  @SuppressWarnings("unchecked")
  private Repository getRepository(Site site) throws MojoExecutionException, MojoFailureException{
    SiteConfig config = site.getConfig();
   
    Object server = config.get("deploy_server");
    if(server == null){
      throw new MojoFailureException("Deploy server not found in config.yml");
    }
   
    String serverId = null;
    Map<String,String> repo = null;
    if(server instanceof Map){
      repo = (Map<String, String>) server;
    }else if(server instanceof String){
      serverId = (String) server;
      repo = (Map<String, String>) config.get(serverId);
      if(repo == null){
        throw new MojoFailureException("Deploy server not found: " + server);
      }
    }else{
      throw new MojoFailureException("Deploy server not found in config.yml");
View Full Code Here

Examples of org.opoo.press.SiteConfig

  }
 
 
  private boolean titlecase;
  public TitleCaseModel(Site site){
    SiteConfig config = site.getConfig();
    titlecase = config.get("titlecase", false);
  }
View Full Code Here

Examples of org.opoo.press.SiteConfig

    }
   
    //Add import i18n messages template.
    configuration.addAutoImport("i18n", "i18n/messages.ftl");
   
    SiteConfig config = site.getConfig();
    List<String> autoIncludeTemplates = (List<String>) config.get("auto_include_templates");
    if(autoIncludeTemplates != null && !autoIncludeTemplates.isEmpty()){
      for(String template: autoIncludeTemplates){
        configuration.addAutoInclude(template);
        log.info("Add auto include: " + template);
      }
    }
   
    Map<String,String> autoImportTemplates = (Map<String, String>) config.get("auto_import_templates");
    if(autoImportTemplates != null && !autoImportTemplates.isEmpty()){
      for(Map.Entry<String, String> en: autoImportTemplates.entrySet()){
        configuration.addAutoImport(en.getKey(), en.getValue());
        log.info("Add auto import: " + en.getKey() + " -> " + en.getValue());
      }
View Full Code Here

Examples of org.opoo.press.SiteConfig

  /* (non-Javadoc)
   * @see org.opoo.press.Initializable#initialize(org.opoo.press.Site)
   */
  @Override
  public void initialize(Site site) {
    SiteConfig map = site.getConfig();
    String highlighterClassName = (String) map.get("highlighter");
    if(highlighterClassName == null){
      log.warn("This converter might be need a Highlighter.");
    }else{
      highlighter = (Highlighter) ClassUtils.newInstance(highlighterClassName, site);
      config = Configuration.builder()
View Full Code Here

Examples of org.opoo.press.SiteConfig

   */
  @SuppressWarnings("unchecked")
  @Override
  public void initialize(Registry registry) {
    Site site = registry.getSite();
    SiteConfig config = site.getConfig();
    List<String> converterNames = (List<String>) config.get("converters");
    List<String> generatorNames = (List<String>) config.get("generators");
    List<String> siteFilters = (List<String>) config.get("siteFilters");
   
    if(converterNames != null && !converterNames.isEmpty()){
      for(String converterName: converterNames){
        Converter c = (Converter) ClassUtils.newInstance(converterName, site);
        registry.registerConverter(c);
View Full Code Here

Examples of org.opoo.press.SiteConfig

    if(lastBuildTime <= 0L){
      log.info("No last generate time, regenerate site.");
      return true;
    }
   
    SiteConfig config = site.getConfig();
    File configFile = config.getConfigFile();
   
    //config file
    if(configFile.lastModified() > lastBuildTime){
      if(log.isInfoEnabled()){
        log.info("Config file has been changed after time '" + format(lastBuildTime) + "', regenerate site.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.