From 0bb21082861803b7a9d29c89e6fdaf1aa062e7d3 Mon Sep 17 00:00:00 2001 From: pb Date: Fri, 15 Apr 2011 05:22:09 +0000 Subject: [PATCH] =?UTF-8?q?Einige=20kleinere=20Anpassungen=20bei=20docmgr.?= =?UTF-8?q?=20Noch=20nicht=20funktionsf=C3=A4hig.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@853 8810af33-2d31-482b-a856-94f89814c4df --- ccm-docmgr/application.xml | 7 +- .../cms/docmgr/ui/query-ItemsInFolder.ora.pdl | 2 +- .../cms/docmgr/ui/query-ItemsInFolder.pg.pdl | 139 ++++++++++++++++++ .../docmgr/ui/query-RecentUpdatedDocs.pg.pdl | 37 +++++ .../arsdigita/cms/docmgr/DocMgrConfig.java | 2 +- .../docmgr/ui/FolderContentsTableForm.java | 6 +- 6 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.pg.pdl create mode 100644 ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-RecentUpdatedDocs.pg.pdl diff --git a/ccm-docmgr/application.xml b/ccm-docmgr/application.xml index 66aeda027..7feedbeec 100755 --- a/ccm-docmgr/application.xml +++ b/ccm-docmgr/application.xml @@ -1,23 +1,26 @@ - + + - + + Document Manager application for Aplaws. + diff --git a/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.ora.pdl b/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.ora.pdl index 0d288a190..0883a54b0 100755 --- a/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.ora.pdl +++ b/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.ora.pdl @@ -65,7 +65,7 @@ query ItemsInFolder { and i.item_id = d.doc_id(+) and i.item_id = l.link_id(+) ), - (select description from cms_doc_folders where doc_id = iif.item_id) + (select description from cms_doc_folders where doc_id = iif.item_id) ) as description, (select dbms_lob.getLength(f.content) from cms_documents d, cms_files f diff --git a/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.pg.pdl b/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.pg.pdl new file mode 100644 index 000000000..0883a54b0 --- /dev/null +++ b/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-ItemsInFolder.pg.pdl @@ -0,0 +1,139 @@ +model com.arsdigita.cms.docmgr.ui; + +import com.arsdigita.cms.ContentItem; + +query ItemsInFolder { + + ContentItem item; + Boolean isFolder; + Boolean hasLiveVersion; + BigDecimal primaryInstID; + BigDecimal typeId; + String title; + BigDecimal targetDocId; + String url; + Integer foldersCount; + Integer itemsCount; + String description; + Long length; + String mimeType; + Date modified; + BigDecimal creatorID; + + do { + select + iif.object_type, iif.display_name, iif.default_domain_class, iif.master_id, iif.item_id, iif.parent_id, + iif.version, iif.name, iif.has_live_version, iif.is_folder, pi.item_id as pi_item_id, pi.type_id, + case when is_folder = 1 then iif.label else pi.title end as title, + pi.target_doc_id, pi.url, pi.creator_id, + ( + select + count(*) + from + cms_items i, + cms_folders f + where + i.item_id = f.folder_id + and i.parent_id = iif.item_id + and i.version = :version + and (exists (select 1 from cms_folders f where f.folder_id = i.item_id) + or + exists (select 1 from cms_bundles b where b.bundle_id = i.item_id) + ) + ) as cntf, + ( + select + count(*) + from + cms_items i, + cms_folders f + where + i.item_id = f.folder_id(+) + and i.parent_id = iif.item_id + and i.version = :version + and (exists (select 1 from cms_folders f where f.folder_id = i.item_id) + or + exists (select 1 from cms_bundles b where b.bundle_id = i.item_id) + ) + and f.folder_id is null + ) as cnti, + nvl2(pi.type_id, ( + select nvl(d.description, l.description) + from cms_items i, cms_documents d, cms_doc_links l + where + i.item_id = pi.item_id + and i.item_id = d.doc_id(+) + and i.item_id = l.link_id(+) + ), + (select description from cms_doc_folders where doc_id = iif.item_id) + ) as description, + (select dbms_lob.getLength(f.content) + from cms_documents d, cms_files f + where pi.item_id = d.doc_id(+) and f.file_id = d.asset_id) as length, + (select m.label + from cms_documents d, cms_assets a, cms_mime_types m + where pi.item_id = d.doc_id(+) and a.asset_id = d.asset_id and m.mime_type = a.mime_type + ) as mime_type, + (select d.last_modified_cached from cms_documents d where pi.item_id = d.doc_id(+)) as modified + from ( + select + a.object_type, a.display_name, a.default_domain_class, + i.master_id, i.item_id, i.parent_id, i.version, i.name, + case when exists (select 1 from cms_items where master_id = i.item_id) + then 1 else 0 end as has_live_version, + case when 0 = nvl(f.folder_id, 0) then 0 else 1 end as is_folder, + f.label + from + cms_items i, + acs_objects a, + cms_folders f + where + i.item_id = a.object_id + and + i.item_id = f.folder_id(+) + and + i.parent_id = :parent + and + i.version = :version + and (exists (select 1 from cms_folders f where f.folder_id = i.item_id) + or + exists (select 1 from cms_bundles b where b.bundle_id = i.item_id) + ) + ) iif, + (select + b.bundle_id, i.item_id, i.type_id, p.title, d.creator_id, l.target_doc_id, l.url + from + cms_bundles b, cms_items i, cms_pages p, cms_documents d, cms_doc_links l + where + i.parent_id = b.bundle_id + and i.language = b.default_language + and p.item_id = i.item_id + and i.item_id = d.doc_id(+) + and i.item_id = l.link_id(+) + ) pi + where + iif.item_id = pi.bundle_id(+) + } map { + item.id = iif.item_id; + item.objectType = iif.object_type; + item.displayName = iif.display_name; + item.defaultDomainClass = iif.default_domain_class; + item.master.id = iif.master_id; + item.version = iif.version; + item.name = iif.name; + isFolder = iif.is_folder; + hasLiveVersion = iif.has_live_version; + primaryInstID = pi_item_id; + typeId = pi.type_id; + title = title; + targetDocId = pi.target_doc_id; + url = pi.url; + foldersCount = cntf; + itemsCount = cnti; + description = description; + length = length; + mimeType = mime_type; + modified = modified; + creatorID = pi.creator_id; + } +} diff --git a/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-RecentUpdatedDocs.pg.pdl b/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-RecentUpdatedDocs.pg.pdl new file mode 100644 index 000000000..6850a1471 --- /dev/null +++ b/ccm-docmgr/pdl/com/arsdigita/cms/docmgr/ui/query-RecentUpdatedDocs.pg.pdl @@ -0,0 +1,37 @@ + +// the query returns the first(:maxRows) rows of Document & DocLink ordered by last_modified_cached date +// docID, objectType - OID attributes +// input parameters: :ancestors, :maxRows + +model com.arsdigita.cms.docmgr.ui; + +query RecentUpdatedDocs { + + BigDecimal docID; + String objectType; + + do { + select id, object_type from ( + select * from ( + select * from ( + select d.doc_id as id, d.last_modified_cached, ao.object_type + from cms_documents d inner join acs_objects ao on (d.doc_id = ao.object_id) inner join cms_items i on (d.doc_id = i.item_id) + where d.last_modified_cached is not null + and i.ancestors like :ancestors + order by d.last_modified_cached desc + ) where rownum <= :maxRows + union + select * from ( + select d.link_id as id, d.last_modified_cached, ao.object_type + from cms_doc_links d inner join acs_objects ao on (d.link_id = ao.object_id) inner join cms_items i on (d.link_id = i.item_id) + where d.last_modified_cached is not null + and i.ancestors like :ancestors + order by d.last_modified_cached desc + ) where rownum <= :maxRows + ) order by last_modified_cached desc + ) where rownum <= :maxRows + } map { + docID = id; + objectType = object_type; + } +} diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocMgrConfig.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocMgrConfig.java index 56730fd1a..524768bbd 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocMgrConfig.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocMgrConfig.java @@ -42,7 +42,7 @@ public final class DocMgrConfig extends AbstractConfig { m_contentSection = new StringParameter ("com.arsdigita.cms.docmgr.content_section", Parameter.REQUIRED, - "documents"); + "content"); m_legacyFolderName = new StringParameter ("com.arsdigita.cms.docmgr.legacy_folder_name", diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FolderContentsTableForm.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FolderContentsTableForm.java index 73b925820..92346f1f2 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FolderContentsTableForm.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FolderContentsTableForm.java @@ -94,14 +94,16 @@ class FolderContentsTableForm extends Form Folder parentFolder = new Folder(fid); - DataQuery m_collection = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.docmgr.ui.ItemsInFolder"); + DataQuery m_collection = SessionManager.getSession() + .retrieveQuery("com.arsdigita.cms.docmgr.ui.ItemsInFolder"); m_collection.setParameter(Folder.PARENT, fid); m_collection.setParameter(Folder.VERSION, parentFolder.getVersion()); long size = m_collection.size(); m_collection.close(); int rowsPerPage = DocMgr.getConfig().getRowsPerPage(); - int maxPages = (int) ((size / rowsPerPage) + (size % rowsPerPage > 0 ? 1 : 0)); + int maxPages = (int) ((size / rowsPerPage) + + (size % rowsPerPage > 0 ? 1 : 0)); return new Integer(maxPages); } };