/*global-block-begin*/


//dojo.require("dojo.date.common");

document.write(getHtmlFeedHeader(main));

var previousEntries = {
    currentIndex: 0,
    estimatedHits: responseAttributes.estimatedHits,
    hitsPerPage: 5,
    documents: responseAttributes.documents,
    onLoaded: function(recentlyModifiedForm) {
        this.documents = dojo.map(recentlyModifiedForm.getArtifacts(), barrique.base.targetFunctor);
        this.estimatedHits = recentlyModifiedForm.getEstimatedHits();
        updatePreviousEntries();
    },
    loadNewer: function() {
        this.currentIndex -= this.hitsPerPage;
        this.load();
    },
    loadOlder: function() {
        this.currentIndex += this.documents.length;
        this.load();
    },
    load: function() {
        serverManager.asyncRequest('search/RecentlyModified', null, new AsyncRequestCallback(dojo.hitch(this, 'onLoaded'), 
                function() { document.getElementById('PreviousEntries').innerHTML = 'Error while loading documents'; }), 
                {javaClass:'barrique.module.docs.Document', startIndex:previousEntries.currentIndex, 
                maxHitCount:previousEntries.hitsPerPage, compound:'barrique.base.artifact.compound.EmptyCompound',
                parentArtifactId:main.getArtifactId()});
    }
}


/*global-block-end*/
/*function-begin (getHeadHtml1i) */
function getHeadHtml1i() {
    var html = '';
    html += '\n\n\n\n\n\n\n\n\n\n\n\<title\>Category: ';
    var scriptlet = main.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\<\/title\>\n';
    return html;
}
/*function-end (getHeadHtml1i) */
/*function-begin (getBodyHtml1i) */
function getBodyHtml1i() {
    var html = '';
    html += '\n\n';
    var tagargs0 = new Object();
    tagargs0['artifactId'] = main.getArtifactId();
    html += tagCommonHeader(tagargs0, function() {
    var html = '';
    return html;
}
    );
    html += '\n\n';
    var tagargs1 = new Object();
    tagargs1['artifact'] = main;
    html += tagCommonEditPage(tagargs1, function() {
    var html = '';
    html += '\n\n\<h1\>';
    var tagargs2 = new Object();
    tagargs2['artifact'] = main;
    html += tagContextMenu(tagargs2, function() {
    var html = '';
    var tagargs3 = new Object();
    tagargs3['artifact'] = main;
    tagargs3['attribute'] = 'title';
    tagargs3['alt'] = 'Category Title';
    html += tagInPlaceEdit(tagargs3, function() {
    var html = '';
    return html;
}
    );
    return html;
}
    );
    html += '\<\/h1\>\n\n\<h2\>';
    var tagargs4 = new Object();
    tagargs4['artifact'] = main;
    tagargs4['attribute'] = 'description';
    tagargs4['alt'] = 'Category Description';
    html += tagInPlaceEdit(tagargs4, function() {
    var html = '';
    return html;
}
    );
    html += '\<\/h2\>\n\n';
    var tagargs5 = new Object();
    html += tagMultiColumnCtrl(tagargs5, function() {
    var html = '';
    html += '\n    ';
    var tagargs6 = new Object();
    tagargs6['id'] = 'DocumentCategorySideBar';
    tagargs6['position'] = 'right';
    html += tagColumnCtrl(tagargs6, function() {
    var html = '';
    html += '\n        ';
    var tagargs7 = new Object();
    tagargs7['title'] = 'Sub Categories';
    html += tagTitlePaneCtrl(tagargs7, function() {
    var html = '';
    html += '\n            ';
    var tagargs8 = new Object();
    tagargs8['rootArtifact'] = main;
    tagargs8['showRootArtifact'] = 'false';
    tagargs8['alt'] = 'No sub categories';
    html += tagArtifactTree(tagargs8, function() {
    var html = '';
    return html;
}
    );
    html += '\n        ';
    return html;
}
    );
    html += '\n\n        ';
    var tagargs9 = new Object();
    tagargs9['title'] = 'Information';
    html += tagTitlePaneCtrl(tagargs9, function() {
    var html = '';
    html += '\n            \<div class=\"infobox-header\"\>Last Modified\<\/div\>\n            \<div class=\"infobox-value\"\>\n                ';
    var tagargs10 = new Object();
    tagargs10['artifact'] = main;
    tagargs10['attribute'] = 'lastModified';
    tagargs10['editable'] = 'false';
    html += tagInPlaceEdit(tagargs10, function() {
    var html = '';
    return html;
}
    );
    html += '\n            \<\/div\>\n            \n            ';
    if (main.getIcon && (isEditModeEnabled || main.getIcon() != null)) { 
    html += '\n                \<div class=\"infobox-header\"\>Icon\<\/div\>\n                \<div class=\"infobox-value\"\>\n                    ';
    var tagargs11 = new Object();
    tagargs11['artifact'] = main;
    tagargs11['attribute'] = 'icon';
    tagargs11['alt'] = 'Icon';
    tagargs11['type'] = 'content';
    html += tagInPlaceEdit(tagargs11, function() {
    var html = '';
    return html;
}
    );
    html += '\n                \<\/div\>\n            ';
    }
    html += '\n        ';
    return html;
}
    );
    html += '\n        \n        ';
    if (browserContext.isEditable() || main.getParents().length > 1) { 
    html += '\n            ';
    var tagargs12 = new Object();
    tagargs12['artifact'] = main;
    tagargs12['attribute'] = 'parents';
    tagargs12['title'] = 'Categories';
    tagargs12['relationJavaClass'] = 'barrique.base.artifact.HasChildItem';
    tagargs12['sourceJavaClass'] = 'barrique.module.docs.DocumentCategory';
    tagargs12['sourceAttribute'] = 'subCategories';
    html += tagSourceRelationAttributeTitlePane(tagargs12, function() {
    var html = '';
    return html;
}
    );
    html += '\n        ';
    }
    html += '\n            \n        ';
    if (previousEntries.documents) { 
    html += '\n        ';
    var tagargs13 = new Object();
    tagargs13['title'] = 'Documents';
    tagargs13['collapsed'] = 'true';
    html += tagTitlePaneCtrl(tagargs13, function() {
    var html = '';
    html += '\n            ';
    html += '\<div id=\"PreviousEntries\"\>';
    var scriptlet = getHtmlPreviousEntries();; if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>';
    html += '\n        ';
    return html;
}
    );
    html += '\n        ';
    }
    html += '\n        \n        ';
    var tagargs15 = new Object();
    tagargs15['title'] = 'Keywords';
    tagargs15['collapsed'] = 'true';
    html += tagTitlePaneCtrl(tagargs15, function() {
    var html = '';
    html += '\n            ';
    var tagargs16 = new Object();
    tagargs16['artifact'] = main;
    html += tagSearchWordCloudCtrl(tagargs16, function() {
    var html = '';
    return html;
}
    );
    html += '\n        ';
    return html;
}
    );
    html += '\n    ';
    return html;
}
    );
    html += '\n\n    ';
    var tagargs17 = new Object();
    tagargs17['id'] = 'DocumentCategoryMain';
    tagargs17['position'] = 'right-middle';
    html += tagColumnCtrl(tagargs17, function() {
    var html = '';
    html += '\n        ';
    if (responseAttributes.documents == null) { 
    html += '\n            \<i\>No documents found in this category...\<\/i\>\n        ';
    } else { 
    html += '\n            ';
    var list18 = responseAttributes.documents;
    var len18 = list18.length;
    for (var i18 = 0; i18 < len18; i18++) {
        var doc = list18[i18];
    html += '\n                ';
    var scriptlet = getHtmlDocumentTeaser(doc); if (scriptlet != null) html += scriptlet;
    html += '\n            ';
    }
    html += '\n        ';
    }
    html += '\n        \n        ';
    var tagargs19 = new Object();
    html += tagFooterCtrl(tagargs19, function() {
    var html = '';
    html += '\n            ';
    var tagargs20 = new Object();
    tagargs20['artifact'] = main;
    html += tagSubstituteLinkCtrl(tagargs20, function() {
    var html = '';
    return html;
}
    );
    html += '\n            ';
    var tagargs21 = new Object();
    tagargs21['artifact'] = main;
    html += tagFeedCtrl(tagargs21, function() {
    var html = '';
    return html;
}
    );
    html += '\n        ';
    return html;
}
    );
    html += '\n    ';
    return html;
}
    );
    html += '\n';
    return html;
}
    );
    html += '\n\n';
    return html;
}
    );
    html += '\n\n';
    html += '\n\n\n';
    return html;
}
/*function-end (getBodyHtml1i) */
/*function-begin (updatePreviousEntries) */
function updatePreviousEntries() {
    var html = '';
    document.getElementById('PreviousEntries').innerHTML = getHtmlPreviousEntries();
    return html;
}
/*function-end (updatePreviousEntries) */
/*function-begin (getHtmlPreviousEntries) */
function getHtmlPreviousEntries() {
    var html = '';
    html += '\n                ';
    var list14 = previousEntries.documents;
    var len14 = list14.length;
    for (var i14 = 0; i14 < len14; i14++) {
        var doc = list14[i14];
    html += '\n                    \<div style=\"margin:1em 0;\"\>\n                        \<a href=\"';
    var scriptlet = doc.getHref(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    scriptlet = doc.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\<\/a\>\<br\>\n                        \<div style=\"font-style:italic;font-size:small;\"\>';
    scriptlet = doc.getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n                        \<div style=\"font-size:xx-small;\" title=\"';
    scriptlet = barrique.date.toString(barrique.date.getDefaultDate(doc)); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    scriptlet = barrique.date.getDateDiff(barrique.date.getDefaultDate(doc)); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n                    \<\/div\>\n                ';
    }
    html += '\n\n                \<br\>\n                \<table\>\<tr\>\<td\>\n                ';
    if (previousEntries.currentIndex > 0) { 
    html += '\<a href=\"javascript:previousEntries.loadNewer()\"\>&lt;&nbsp;Previous\<\/a\>';
    }
    html += '\n                \<\/td\>\<td width=\"100%\"\>\<\/td\>\<td\>\n                ';
    if (previousEntries.currentIndex < (previousEntries.estimatedHits-previousEntries.hitsPerPage)) { 
    html += '\<a href=\"javascript:previousEntries.loadOlder()\"\>Next&nbsp;&gt;\<\/a\>';
    }
    html += '\n                \<\/td\>\<\/tr\>\<\/table\>\n            ';
    return html;
}
/*function-end (getHtmlPreviousEntries) */
/*function-begin (getHtmlDocumentTeaser) */
function getHtmlDocumentTeaser(doc) {
    var html = '';
    html += '\n    ';
    var tagargs22 = new Object();
    tagargs22['hideCollapse'] = 'true';
    html += tagTitlePaneCtrl(tagargs22, function() {
    var html = '';
    html += '\n        ';
    var tagargs23 = new Object();
    html += tagTitleCtrl(tagargs23, function() {
    var html = '';
    html += '\n            ';
    var tagargs24 = new Object();
    tagargs24['artifact'] = doc;
    html += tagContextMenu(tagargs24, function() {
    var html = '';
    html += '\<a href=\"';
    var scriptlet = doc.getHref(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    scriptlet = doc.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\<\/a\>';
    return html;
}
    );
    html += '\n            ';
    if (!doc.getPublishedDate()) { 
    html += '\n                - \<i\>Draft\<\/i\>\n            ';
    }
    html += '\n        ';
    return html;
}
    );
    html += '\n        ';
html += doc.getHtmlRecentlyModified({documentCategory:main,isDocumentTeaser:true});    html += '\n    ';
    return html;
}
    );
    html += '\n';
    return html;
}
/*function-end (getHtmlDocumentTeaser) */
