Ejemplo n.º 1
0
 public void Special__gen(Xoa_app app, Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
   int slash_pos =
       Bry_find_.Find_fwd(ttl.Page_txt_wo_qargs(), Xoa_ttl.Subpage_spr); // check for slash
   byte[] special_name =
       slash_pos == Bry_find_.Not_found
           ? ttl
               .Base_txt_wo_qarg() // no slash found; use base_txt; ignore qry args and just get
                                   // page_names; EX: Search/Earth?fulltext=y;
                                   // Allpages?from=Earth...
           : Bry_.Mid(
               ttl.Page_txt_wo_qargs(),
               0,
               slash_pos); // slash found; use root page; EX: Special:ItemByTitle/enwiki/Earth
   special_name =
       Xoa_ttl.Replace_spaces(special_name); // handle spaces; EX:Spezial:Zufällige_Seite
   Xow_special_page special = (Xow_special_page) hash.Get_by_bry(special_name);
   if (special != null) { // special found; generate it;
     special = special.Special__clone();
     page.Db().Page().Modified_on_(Datetime_now.Get());
     try {
       special.Special__gen(wiki, page, url, ttl);
     } catch (Exception e) {
       Gfo_log_.Instance.Warn(
           "failed to generate special page",
           "url",
           url.To_str(),
           "err",
           Err_.Message_gplx_log(e));
     }
   }
 }
Ejemplo n.º 2
0
  public void Commit(Xoa_page pg) {
    boolean toc_mode_enabled = true,
        toc_mode_is_pgbnr = false; // default to Xoh_toc_data_.Toc_mode__basic
    switch (toc_mode) {
      case Xoh_toc_data.Toc_mode__none:
        toc_mode_enabled = false;
        break;
      case Xoh_toc_data.Toc_mode__pgbnr:
        toc_mode_is_pgbnr = true;
        break;
    }

    // set flags
    pg.Html_data().Toc_mgr().Exists_y_();
    pg.Html_data().Head_mgr().Itm__pgbnr().Enabled_(toc_mode_is_pgbnr);

    // build bfr by add bfr_0, toc, body_bfr
    if (toc_mode_enabled) {
      pg.Html_data()
          .Toc_mgr()
          .To_html(head_bfr, gplx.xowa.htmls.core.htmls.Xoh_wtr_ctx.Basic, toc_mode_is_pgbnr);
      head_bfr.Add_bfr_and_clear(body_bfr);
    }
  }
Ejemplo n.º 3
0
 public void Fsdb_search_by_list(
     List_adp itms, Xow_wiki cur_wiki, Xoa_page page, Xog_js_wkr js_wkr) {
   if (!fsdb_enabled) return;
   int len = itms.Count();
   Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
   Xow_wiki wiki = page.Commons_mgr().Source_wiki_or(cur_wiki);
   Xou_cache_mgr cache_mgr = wiki.App().User().User_db_mgr().Cache_mgr();
   for (int i = 0; i < len; i++) {
     if (usr_dlg.Canceled()) return;
     Xof_fsdb_itm fsdb = (Xof_fsdb_itm) itms.Get_at(i);
     if (fsdb.Hdump_mode() == Xof_fsdb_itm.Hdump_mode__null) {
       Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(fsdb.Lnki_ttl(), i, len);
       if (orig != Xof_orig_itm.Null) { // orig exists;
         gplx.xowa.files.repos.Xof_repo_itm repo =
             wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), fsdb.Lnki_ttl(), Bry_.Empty);
         if (repo == null) continue;
         fsdb.Init_at_orig(
             orig.Repo(),
             repo.Wiki_domain(),
             orig.Ttl(),
             orig.Ext(),
             orig.W(),
             orig.H(),
             orig.Redirect());
       }
     }
     fsdb.Init_at_xfer(i, len);
     Xof_file_wkr.Show_img(
         fsdb,
         usr_dlg,
         wiki.File__bin_mgr(),
         wiki.File__mnt_mgr(),
         cache_mgr,
         wiki.File__repo_mgr(),
         js_wkr,
         img_size,
         url_bldr,
         page);
   }
 }