X-Git-Url: https://harishankar.org/repos/?p=biaweb2.git;a=blobdiff_plain;f=biawebdocumenttree.hpp;fp=biawebdocumenttree.hpp;h=7c44634f4ac4233748017920bc497a6144970cc7;hp=608b70242179dc0056c8ada7318983891bd40812;hb=b6425f960a30045333fb2ef531832a0b5858200d;hpb=1d1f04629b04c7e7efd14d8f281e17f5e491c888 diff --git a/biawebdocumenttree.hpp b/biawebdocumenttree.hpp index 608b702..7c44634 100644 --- a/biawebdocumenttree.hpp +++ b/biawebdocumenttree.hpp @@ -8,8 +8,9 @@ #include "biawebdocument.hpp" #include "biawebstrings.hpp" #include "biawebutil.hpp" +#include "biawebdoclist.hpp" -// to implement a document tree - both with or without subtrees +// class to implement a document tree - both with or without subtrees namespace biaweb { class DocumentTree { protected: @@ -208,29 +209,27 @@ namespace biaweb { std::filesystem::create_directories (filepath); // Create the list of documents in this tree with links - // Reuse the sidebar class and sidebaritem class which is - // basically a list of links but instead of adding a sidebar - // add it to the content portion - SideBar article_list; - article_list.set_title (this->title + ": " + ART_LIST); + std::unique_ptr article_list (new DocList ()); + article_list.get()->set_title (this->title + ": " + ART_LIST); // sort the documents as per creation time and then add the document // links - newest documents should appear above older ones. sort_documents_creation_time (); for (Document doc : this->docs) { - SideBarItem item; - item.set_sidebar_text (doc.get_title()); - item.set_sidebar_url (urlpath + doc.get_filename() + ".html"); - article_list.add_sidebar_item (item); + DocListItem item (doc.get_title(), + urlpath + doc.get_filename() + ".html", + doc.get_creation_date(), doc.get_modified_date ()); + article_list.get()->add_document_item (item); // output the document also, add the side bars doc.add_side_bar (*bar1.get()); doc.add_side_bar (*bar2.get()); doc.output_to_html (templatedir, filepath); } - index.get()->set_content (this->summary + article_list.to_html(templatedir)); + // index should contain the summary followed by the article list + index.get()->set_content (this->summary + article_list.get()->to_html(templatedir)); index.get()->output_to_html (templatedir, filepath); - // create index for children + // recursively create index for children for (DocumentTree tree : this->children) tree.create_tree_html (templatedir, destdir); }