diff --git a/Hierarchy.js b/Hierarchy.js
index fc918f3..58421ef 100644
--- a/Hierarchy.js
+++ b/Hierarchy.js
@@ -7,27 +7,38 @@
* @param {Object} settings - object containing idColumnName, textColumnName, relationshipColumnName, textSeparator
*
*/
-class Hierarchy{
- private var _globals;
- private var _settings;
+class Hierarchy {
+ private var
+ _globals;
+ private var
+ _settings;
- private var _hierarchy = [];
- private var _levels = [];
- private var _flat = [];
- private var _flatObject = {};
+ private var
+ _hierarchy = [];
+ private var
+ _levels = [];
+ private var
+ _flat = [];
+ private var
+ _flatObject = {};
- private var _defaultSettings = {
+ private var
+ _defaultSettings = {
idColumnName: "id",
textColumnName: "__l9",
relationshipColumnName: "parent",
textSeparator: "|"
};
- function Hierarchy(globals, settings) {
+ function
+
+ Hierarchy(globals, settings) {
_globals = globals;
_settings = _mergeOptions(_defaultSettings, settings);
- globals.log.LogDebug(_settings.schemaId);
var dataTable = _getDataTable();
+ if (!dataTable.Columns.Contains(_settings.textColumnName))
+ _settings.textColumnName = "__l9"
+
_generateFlatList(dataTable.Rows)
_setupHierarchy(0, null);
}
@@ -42,7 +53,9 @@ class Hierarchy{
* @param {Object} obj2
* @returns {Object}
*/
- private function _mergeOptions(obj1, obj2) {
+ private function
+
+ _mergeOptions(obj1, obj2) {
var obj3 = {};
for (var attrname in obj1) {
obj3[attrname] = obj1[attrname];
@@ -61,8 +74,12 @@ class Hierarchy{
* @description function to get DataTable from DatabaseDesigner
* @returns {DataTable}
*/
- private function _getDataTable() {
+ private function
+
+ _getDataTable() {
+ _globals.log.LogDebug("scid: "+_settings.schemaId);
var schema = _globals.confirmit.GetDBDesignerSchema(_settings.schemaId);
+ _globals.log.LogDebug("tblnm: "+_settings.tableName);
var table = schema.GetDBDesignerTable(_settings.tableName);
var dataTable = table.GetDataTable();
return dataTable;
@@ -76,8 +93,10 @@ class Hierarchy{
* @description creating list of rows for variable _flat
* @param {Object[]} rows - list of rows from db table
*/
- private function _generateFlatList(rows) {
- for(var i = 0; i < rows.Count; ++i) {
+ private function
+
+ _generateFlatList(rows) {
+ for (var i = 0; i < rows.Count; ++i) {
var flatEntry = _createFlatEntry(rows[i]);
_flat.push(flatEntry);
}
@@ -92,7 +111,9 @@ class Hierarchy{
* @param {Object} row - db table row
* @returns {Object}
*/
- private function _createFlatEntry(row) {
+ private function
+
+ _createFlatEntry(row) {
var name = TAHelper.GetSelfName(row[_settings.textColumnName], _settings.textSeparator, _globals.log);
var flatEntry = {
id: row[_settings.idColumnName].toLowerCase(),
@@ -110,10 +131,13 @@ class Hierarchy{
* @description function to get Array of hierarchical objects
* @returns {Object[]}
*/
- function GetHierarchyArray() {
+ function
+
+ GetHierarchyArray() {
return _hierarchy;
}
+
/**
* @memberof Hierarchy
* @instance
@@ -122,10 +146,12 @@ class Hierarchy{
* @param {Number} level
* @returns {Object[]}
*/
- function GetLevelArray(level) {
- if(_levels.length > level) {
+ function
+
+ GetLevelArray(level) {
+ if (_levels.length > level) {
return _levels[level];
- }else{
+ } else {
throw new Error(201, "Hierarchy level index is out of range");
}
@@ -138,7 +164,9 @@ class Hierarchy{
* @description function to get Count of levels in the hierarchy
* @returns {Number}
*/
- function GetLevelsCount() {
+ function
+
+ GetLevelsCount() {
return _levels.length
}
@@ -149,7 +177,9 @@ class Hierarchy{
* @description function to get Array of rows from db table
* @returns {Number}
*/
- function GetFlatArray() {
+ function
+
+ GetFlatArray() {
return _flat;
}
@@ -161,10 +191,12 @@ class Hierarchy{
* @param {String} id
* @returns {Object}
*/
- function GetObjectById(id) {
- if(_flatObject[id]) {
+ function
+
+ GetObjectById(id) {
+ if (_flatObject[id]) {
return _flatObject[id];
- }else{
+ } else {
throw new Error(201, "Hierarchy object id doesn't exist");
}
}
@@ -178,30 +210,33 @@ class Hierarchy{
* @param {Number} level
* @param {Number} parentObj
*/
- private function _setupHierarchy( level, parentObj ) {
- var parentObjId = parentObj ? parentObj.id : "";
+ private function
+
+ _setupHierarchy(level, parentObj) {
+ var parentObjId = parentObj ? parentObj.id : "";
- for(var i = 0; i < _flat.length; ++i) {
- if( ( !parentObj && !_flat[i].parent ) || parentObjId.CompareTo( _flat[i].parent ? _flat[i].parent : "" ) == 0) {
+ for (var i = 0; i < _flat.length; ++i) {
+ if (( !parentObj && !_flat[i].parent ) || parentObjId.CompareTo(_flat[i].parent ? _flat[i].parent : "") == 0) {
var newObj = {
id: _flat[i].id,
text: _flat[i].text,
name: _flat[i].name,
parent: parentObjId,
- subcells: []
+ subcells: [],
+ level: level
};
- if( _levels.length <= level ) {
- _levels.push( [] );
+ if (_levels.length <= level) {
+ _levels.push([]);
}
- _setupHierarchy( (level+1), newObj );
- if( !parentObj ) {
- _hierarchy.push( newObj );
+ _setupHierarchy((level + 1), newObj);
+ if (!parentObj) {
+ _hierarchy.push(newObj);
}
else {
- parentObj.subcells.push( newObj );
+ parentObj.subcells.push(newObj);
}
- _levels[ level ].push( newObj );
- _flatObject[ newObj.id ] = newObj;
+ _levels[level].push(newObj);
+ _flatObject[newObj.id] = newObj;
}
}
}
diff --git a/Static/FilterPanel.js b/Static/FilterPanel.js
new file mode 100644
index 0000000..a61f650
--- /dev/null
+++ b/Static/FilterPanel.js
@@ -0,0 +1,109 @@
+/**
+ * Created by MariaSo on 20/01/2017.
+ */
+class FilterPanel{
+ private var _filterComponents;
+ private var _current_dictionary;
+
+ function FilterPanel(filterComponents, currentDictionary){
+ _filterComponents = filterComponents;
+ _current_dictionary = currentDictionary;
+ }
+
+ /**
+ * @memberof FilterPanel
+ * @function btnSaveReturn_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function btnSaveReturn_Hide(context){
+ return false
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function btnSaveReturn_Render
+ * @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function btnSaveReturn_Render(context){
+ context.component.Label = new Label(context.report.CurrentLanguage,Translations.dictionary(context.report.CurrentLanguage)["Save and return"]);
+ context.component.TargetPage = context.state.Parameters.GetString("TA_LAST_VISITED_PAGE");
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function btnSave_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function btnSave_Hide(context){
+ return false
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function btnSave_Render
+ * @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function btnSave_Render(context){
+ context.component.Label = new Label(context.report.CurrentLanguage,Translations.dictionary(context.report.CurrentLanguage)["Save"]);
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function btnClearFilters_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function btnClearFilters_Hide(context){
+ return false
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function btnClearFilters_Render
+ * @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function btnClearFilters_Render(context){
+ context.component.Label = new Label(context.report.CurrentLanguage,Translations.dictionary(context.report.CurrentLanguage)["Clear filters"]);
+ context.component.TargetPage = "filters";
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function txtFilterTitle_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ * @returns {Boolean}
+ */
+ function txtFilterTitle_Hide(context, filterNumber){
+ var filterQuestion = _filterComponents.GetFilterQuestion(filterNumber-1);
+ return !filterQuestion
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function txtFilterTitle_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ */
+ function txtFilterTitle_Render(context, filterNumber){
+ var filterTitle = _filterComponents.GetFilterTitle(filterNumber-1);
+ if(filterTitle)
+ context.component.Output.Append(filterTitle);
+}
+
+ /**
+ * @memberof FilterPanel
+ * @function lstFilterList_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ * @returns {Boolean}
+ */
+ function lstFilterList_Hide(context, filterNumber){
+ var filterQuestion = _filterComponents.GetFilterQuestion(filterNumber-1);
+ return !filterQuestion
+}
+
+
+}
\ No newline at end of file
diff --git a/Static/Filters.js b/Static/Filters.js
index 91b4474..05f1cd5 100644
--- a/Static/Filters.js
+++ b/Static/Filters.js
@@ -35,7 +35,7 @@ class Filters {
selectedFolder = null;
}*/
- var fExpr = new TAFilters(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFolderById(selectedFolder)).GetSentimentFilterExpression("TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE","TA_COMMENTS_SENTIMENT")
+ var fExpr = new TAFilters(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFolderById(selectedFolder)).GetSentimentFilterExpression("TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE","TA_COMMENTS_SENTIMENT");
context.component.Expression = fExpr;
}
diff --git a/Static/PageMaster.js b/Static/PageMaster.js
index 899eb14..09b719d 100644
--- a/Static/PageMaster.js
+++ b/Static/PageMaster.js
@@ -5,6 +5,7 @@
class PageMaster{
private static var _filterComponents;
+
/**
* @memberof PageMaster
* @function FiltersButtonHtml_Hide
@@ -64,7 +65,23 @@ class PageMaster{
static function FilterSummary_Render(context){
var filterSummary ;
var summarySegments = [];
+ Config.SetTALibrary();
_filterComponents = new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main);
+ var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
+ var currentLaguage = context.report.CurrentLanguage;
+ var curDictionary = Translations.dictionary(currentLaguage);
+ summarySegments.push(("
"+curDictionary['Selected question']+" = "+(selectedFolder ? selectedFolder : Config.GetTALibrary().GetFolderById(selectedFolder).GetName()) +"
"));
+
+ var startDate = !context.state.Parameters.IsNull("TA_DATE_FROM") && context.state.Parameters.GetDate("TA_DATE_FROM").ToShortDateString();
+
+ if(startDate){
+ summarySegments.push((""+curDictionary['Start date']+" = " + startDate + "
"));
+ }
+ var endDate = !context.state.Parameters.IsNull("TA_DATE_TO") && context.state.Parameters.GetDate("TA_DATE_TO").ToShortDateString();
+
+ if(endDate){
+ summarySegments.push((""+curDictionary['End date']+" = " + endDate + "
"));
+ }
var codes = _filterComponents.GetAllAnsweredFilterCodes();
for( var i = 0 ; i < codes.length; i++){
@@ -73,7 +90,7 @@ class PageMaster{
filterSummary = summarySegments.join("AND");
context.component.Output.Append(filterSummary);
- if( codes.length > 0 )
+ if( codes.length > 0 || startDate || endDate)
context.component.Output.Append("");
}
@@ -88,7 +105,7 @@ class PageMaster{
var hideButton = true;
_filterComponents = new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main);
- hideButton = !_filterComponents.GetAllAnsweredFilterCodes().length > 0;
+ hideButton = !_filterComponents.GetAllAnsweredFilterCodes().length > 0 && context.state.Parameters.IsNull("TA_DATE_FROM") && context.state.Parameters.IsNull("TA_DATE_TO");
return hideButton
}
@@ -102,4 +119,62 @@ class PageMaster{
static function ClearFilters_Render(context){
}
+
+ static function txtQuestion_Hide(context){
+ return false
+
+}
+ static function txtQuestion_Render(context){
+ var label = Translations.dictionary(context.report.CurrentLanguage)['Question'];
+ context.component.Output.Append(label);
+
+}
+
+ static function txtDateFrom_Hide(context){
+ return false
+
+}
+ static function txtDateFrom_Render(context){
+ var label = Translations.dictionary(context.report.CurrentLanguage)['From'];
+ context.component.Output.Append(label);
+
+}
+
+ static function txtDateTo_Hide(context){
+ return false
+
+}
+ static function txtDateTo_Render(context){
+ var label = Translations.dictionary(context.report.CurrentLanguage)['To'];
+ context.component.Output.Append(label);
+
+}
+
+ static function btnApplyFilters_Hide(context){
+ return false
+}
+ static function btnApplyFilters_Render(context){
+ FilterPanel.btnSave_Render(context);
+}
+
+ static function hierarchyComponent_Hide(context) {
+ return !context.report.PersonalizedQuestion
+}
+
+ static function txtHierarchyLabel_Hide(context) {
+ return !context.report.PersonalizedQuestion
+}
+
+ static function txtHierarchyLabel_Render(context) {
+ var label = Translations.dictionary(context.report.CurrentLanguage)["Hierarchy"];
+ context.component.Output.Append(label);
+}
+ static function txtPageTitle_Hide(context){
+ return false
+}
+ static function txtPageTitle_Render(context){
+ var label = Translations.dictionary(context.report.CurrentLanguage)["What people are talking about"];
+ context.component.Output.Append(label);
+}
+
}
\ No newline at end of file
diff --git a/Static/Page_Filters.js b/Static/Page_Filters.js
index 1c0be25..3317933 100644
--- a/Static/Page_Filters.js
+++ b/Static/Page_Filters.js
@@ -6,7 +6,9 @@ class Page_filters{
private static var _filterComponents;
private static var _folder;
private static const _defaultParameters = [];
-
+ private static var _currentLanguage;
+ private static var _curDictionary;
+ private static var _filter_panel;
/**
* @memberof Page_filters
* @function Hide
@@ -25,16 +27,22 @@ class Page_filters{
* @param {Object} context - {component: page, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function Render(context){
+ _currentLanguage = context.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
Config.SetTALibrary(TAHelper.GetGlobals(context));
_filterComponents = new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main);
+ _filter_panel = new FilterPanel(_filterComponents);
if(context.component.SubmitSource == "btnClearFilters"){
_filterComponents.ClearFilters();
+ context.state.Parameters["TA_DATE_FROM"] = null;
+ context.state.Parameters["TA_DATE_TO"] = null;
}
if(context.component.SubmitSource == "btnClearDateFilter"){
context.state.Parameters["TA_DATE_FROM"] = null;
context.state.Parameters["TA_DATE_TO"] = null;
}
if(context.component.SubmitSource == "lstQuestions") {
+ context.state.Parameters["TA_ALL_CATEGORIES"] = null;
context.state.Parameters["TA_ATTRIBUTES_SINGLE"] = null;
context.state.Parameters["TA_LEVEL"] = null;
context.state.Parameters["TA_SUB_CATEGORIES_SINGLE"] = null;
@@ -60,7 +68,7 @@ class Page_filters{
* @returns {Boolean}
*/
static function btnSaveReturn_Hide(context){
- return false
+ return FilterPanel.btnSaveReturn_Hide(context);
}
/**
@@ -69,8 +77,8 @@ class Page_filters{
* @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function btnSaveReturn_Render(context){
- context.component.Label = new Label(context.report.CurrentLanguage,"Save and Return");
- context.component.TargetPage = context.state.Parameters.GetString("TA_LAST_VISITED_PAGE");
+
+ FilterPanel.btnSaveReturn_Render(context)
}
/**
@@ -80,7 +88,7 @@ class Page_filters{
* @returns {Boolean}
*/
static function btnSave_Hide(context){
- return false
+ return FilterPanel.btnSave_Hide(context);
}
/**
@@ -89,8 +97,7 @@ class Page_filters{
* @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function btnSave_Render(context){
- context.component.Label = new Label(context.report.CurrentLanguage,"Save");
- context.component.TargetPage = "filters";
+ FilterPanel.btnSave_Render(context);
}
/**
@@ -100,7 +107,7 @@ class Page_filters{
* @returns {Boolean}
*/
static function btnClearFilters_Hide(context){
- return false
+ return FilterPanel.btnClearFilters_Hide(context);
}
/**
@@ -109,9 +116,9 @@ class Page_filters{
* @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function btnClearFilters_Render(context){
- context.component.Label = new Label(context.report.CurrentLanguage,"Clear Filters");
- context.component.TargetPage = "filters";
-}
+ FilterPanel.btnClearFilters_Render(context);
+ }
+
/**
* @memberof Page_filters
@@ -121,8 +128,7 @@ class Page_filters{
* @returns {Boolean}
*/
static function txtFilterTitle_Hide(context, filterNumber){
- var filterQuestion = _filterComponents.GetFilterQuestion(filterNumber-1);
- return !filterQuestion
+ return _filter_panel.txtFilterTitle_Hide(context, filterNumber);
}
/**
@@ -132,9 +138,7 @@ class Page_filters{
* @param {Number} filterNumber
*/
static function txtFilterTitle_Render(context, filterNumber){
- var filterTitle = _filterComponents.GetFilterTitle(filterNumber-1);
- if(filterTitle)
- context.component.Output.Append(filterTitle);
+ _filter_panel.txtFilterTitle_Render(context, filterNumber)
}
/**
@@ -145,7 +149,36 @@ class Page_filters{
* @returns {Boolean}
*/
static function lstFilterList_Hide(context, filterNumber){
- var filterQuestion = _filterComponents.GetFilterQuestion(filterNumber-1);
- return !filterQuestion
+ return _filter_panel.lstFilterList_Hide(context, filterNumber);
}
+
+ static function txtQuestion_Hide(context){
+ return false
+
+}
+ static function txtQuestion_Render(context){
+ var label = _curDictionary['Question'];
+ context.component.Output.Append(label);
+
+}
+
+ static function txtDateFrom_Hide(context){
+ return false
+
+}
+ static function txtDateFrom_Render(context){
+ var label = _curDictionary['From'];
+ context.component.Output.Append(label);
+
+}
+
+ static function txtDateTo_Hide(context){
+ return false
+
+}
+ static function txtDateTo_Render(context){
+ var label = _curDictionary['To'];
+ context.component.Output.Append(label);
+
+}
}
\ No newline at end of file
diff --git a/Static/Page_comments.js b/Static/Page_comments.js
index 439d002..5c84b86 100644
--- a/Static/Page_comments.js
+++ b/Static/Page_comments.js
@@ -4,8 +4,16 @@
*/
class Page_comments{
private static var _filterComponents;
+ private static var _filter_panel;
private static var _folder;
+ private static var _selectedCategory;
+ private static var _currentLanguage;
+ private static var _curDictionary;
private static const _defaultParameters = [
+ {
+ Id: "TA_ALL_CATEGORIES",
+ Value: "emptyv"
+ },
{
Id: "TA_TOP_CATEGORIES_SINGLE",
Value: "emptyv"
@@ -24,7 +32,7 @@ class Page_comments{
},
{
Id: "TA_FOLDERS",
- Value: Config.TAQuestions[0].TAFolderId
+ Value: (Config.TAQuestions[0].TAQuestionName+Config.TAQuestions[0].TAModelNo)
}
];
@@ -46,16 +54,18 @@ class Page_comments{
* @param {Object} context - {component: page, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function Render(context){
+ _currentLanguage = context.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
Config.SetTALibrary(TAHelper.GetGlobals(context));
+ _filterComponents = new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main);
if(context.component.SubmitSource == "ClearFilters"){
- new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main).ClearFilters()
- }
-
- if(context.component.SubmitSource == "btnClearDateFilter"){
+ _filterComponents.ClearFilters();
context.state.Parameters["TA_DATE_FROM"] = null;
context.state.Parameters["TA_DATE_TO"] = null;
}
+
if(context.component.SubmitSource == "lstQuestions") {
+ context.state.Parameters["TA_ALL_CATEGORIES"] = null;
context.state.Parameters["TA_ATTRIBUTES_SINGLE"] = null;
context.state.Parameters["TA_LEVEL"] = null;
context.state.Parameters["TA_SUB_CATEGORIES_SINGLE"] = null;
@@ -65,6 +75,7 @@ class Page_comments{
TAHelper.SetLastVisitedPage(TAHelper.GetGlobals(context), "comments");
var paramUtils = new ParameterUtilities(TAHelper.GetGlobals(context));
+
paramUtils.SetDefaultParameterValues(_defaultParameters);
var taParams = new TAParameters(TAHelper.GetGlobals(context), Config.GetTALibrary());
@@ -75,9 +86,19 @@ class Page_comments{
} catch(e){
selectedFolder = null;
}*/
- _folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+ _folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+
+ _filter_panel = new FilterPanel(_filterComponents);
taParams.ClearSubcategoriesParameters(selectedFolder, "emptyv", "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
taParams.ClearSubcategoriesParameters(selectedFolder, "emptyv", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
+
+ if(context.component.SubmitSource == "lstCategory" || context.component.SubmitSource == "lstSubCategory" || context.component.SubmitSource == "lstAttribute"){
+ _selectedCategory = TAHelper.GetSelectedCategory(context.state, "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
+ context.state.Parameters['TA_ALL_CATEGORIES'] = new ParameterValueResponse(_selectedCategory);
+ }else {
+ _selectedCategory = context.state.Parameters.GetString('TA_ALL_CATEGORIES');
+ TAHelper.SetSelectedCategory(context.state, _folder.GetHierarchy(), _selectedCategory, "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE",context.log);
+ }
}
/**
@@ -101,31 +122,22 @@ class Page_comments{
if(!Config.GetTALibrary()){
Config.SetTALibrary(TAHelper.GetGlobals(context));
}
- if(!_folder){
- //context.log.LogDebug("htl render: "+context.state.Parameters["TA_FOLDERS"]);
- //var selectedFolder = !context.state.Parameters.IsNull("TA_FOLDERS") ? context.state.Parameters.GetString("TA_FOLDERS") : null;
- //_folder =Config.GetTALibrary().GetFolderById(selectedFolder);
-
+ //if(!_folder){
var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
- /*try {
- selectedFolder = !context.state.Parameters.IsNull("TA_FOLDERS") ? context.state.Parameters.GetString("TA_FOLDERS") : null;
- } catch(e){
- selectedFolder = null;
- }*/
_folder = Config.GetTALibrary().GetFolderById(selectedFolder);
-
-
- }
+ _selectedCategory = context.state.Parameters.GetString('TA_ALL_CATEGORIES');
+ //}
+
var htlComments = new TAHitlistUtils(TAHelper.GetGlobals(context), _folder, context.component);
- var selectedCategory = TAHelper.GetSelectedCategory(context.state, "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
- if( selectedCategory ){
+ var selectedCategory = _selectedCategory;
+ if( selectedCategory && selectedCategory != "emptyv" ){
htlComments.AddTAColumn("categorysentiment", false, selectedCategory);
-
}
htlComments.AddTAColumn("verbatim");
htlComments.AddColumn(_folder.GetTimeVariableId(), true);
htlComments.AddTAColumn("overallsentiment");
- //htlComments.AddTAColumn("categories");
+
+ htlComments.AddTAColumn("categories");
htlComments.AddConfiguredColumns();
}
@@ -158,11 +170,11 @@ class Page_comments{
"";
var hitlistHeaders = {};
- var selectedCategory = TAHelper.GetSelectedCategory(context.state, "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE")
+ var selectedCategory = _selectedCategory;
hitlistHeaders["sentiment"] = []
- if( selectedCategory){
+ if( selectedCategory && selectedCategory != "emptyv"){
hitlistHeaders["sentiment"].push( {
name: _folder.GetQuestionId("categorysentiment")+"_"+selectedCategory
} );
@@ -170,24 +182,22 @@ class Page_comments{
hitlistHeaders["verbatim"] = [{
name: _folder.GetQuestionId(),
- title: "Comments",
+ title: _curDictionary["Comments"],
main: true
}];
hitlistHeaders["date"] = [{
name: _folder.GetTimeVariableId() ? _folder.GetTimeVariableId() : "interview_start",
- title: "Date"
+ title: _curDictionary["Date"]
}];
- /*
hitlistHeaders["categories"] = [{
name: _folder.GetQuestionId("categories")
}];
- */
hitlistHeaders["sentiment"].push( {
name: _folder.GetQuestionId("overallSentiment"),
- title: "Overall Sentiment"
+ title: _curDictionary["Overall Sentiment"]
});
hitlistHeaders["other"] = [];
@@ -271,7 +281,7 @@ class Page_comments{
* @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtCategory_Render(context){
- var label = "Category";
+ var label = _curDictionary["Category"];
context.component.Output.Append(label);
}
@@ -295,7 +305,7 @@ class Page_comments{
* @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtSubCategory_Render(context){
- var label = "Sub category";
+ var label = _curDictionary["Sub category"];
context.component.Output.Append(label);
}
@@ -318,7 +328,7 @@ class Page_comments{
* @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtAttribute_Render(context){
- var label = "Attribute";
+ var label = _curDictionary["Attribute"];
context.component.Output.Append(label);
}
@@ -340,7 +350,32 @@ class Page_comments{
* @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtSentiment_Render(context){
- var label = "Sentiment";
+ var label = _curDictionary["Sentiment"];
context.component.Output.Append(label);
}
+
+ static function txtFilterTitle_Hide(context, filterNumber){
+ return _filter_panel.txtFilterTitle_Hide(context, filterNumber);
+}
+
+ /**
+ * @memberof Page_filters
+ * @function txtFilterTitle_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ */
+ static function txtFilterTitle_Render(context, filterNumber){
+ _filter_panel.txtFilterTitle_Render(context, filterNumber);
+}
+
+ /**
+ * @memberof Page_filters
+ * @function lstFilterList_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ * @returns {Boolean}
+ */
+ static function lstFilterList_Hide(context, filterNumber){
+ return _filter_panel.lstFilterList_Hide(context, filterNumber);
+}
}
\ No newline at end of file
diff --git a/Static/Page_dashboard.js b/Static/Page_dashboard.js
index 72ab851..b22efb3 100644
--- a/Static/Page_dashboard.js
+++ b/Static/Page_dashboard.js
@@ -3,23 +3,34 @@
* @classdesc Static class for Reportal Page dashboard components
*/
class Page_dashboard{
- private static var _folder;
+ private static var _filterComponents;
+ private static var _filter_panel;
+ private static var _currentLanguage;
+ private static var _curDictionary;
private static const _defaultParameters = [
+ {
+ Id: "TA_LEVEL",
+ Value: "0"
+ },
+
+ {
+ Id: "TA_COMPARE_PERIODS",
+ Value: "qoq"
+ },
+
+ {
+ Id: "TA_VIEW_SENTIMENT",
+ Value: "emptyv"
+ },
+ {
+ Id: "TA_ALL_CATEGORIES",
+ Value: "emptyv"
+ },
{
- Id: "TA_LEVEL",
- Value: "0"
- },
-
- {
- Id: "TA_COMPARE_PERIODS",
- Value: "qoq"
- },
-
- {
- Id: "TA_VIEW_SENTIMENT",
- Value: "emptyv"
+ Id: "TA_FOLDERS",
+ Value: (Config.TAQuestions[0].TAQuestionName+Config.TAQuestions[0].TAModelNo)
}
-];
+ ];
/**
* @memberof Page_dashboard
@@ -29,8 +40,8 @@ class Page_dashboard{
* @returns {Boolean}
*/
static function Hide(context){
- return false;
-}
+ return false;
+ }
/**
* @memberof Page_dashboard
@@ -39,15 +50,11 @@ class Page_dashboard{
* @param {Object} context - {component: page, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function Render(context){
+ _currentLanguage = context.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
Config.SetTALibrary(TAHelper.GetGlobals(context));
- if(context.component.SubmitSource == "ClearFilters"){
- new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(),Config.DS_Main).ClearFilters()
- }
- if(context.component.SubmitSource == "btnClearDateFilter"){
- context.state.Parameters["TA_DATE_FROM"] = null;
- context.state.Parameters["TA_DATE_TO"] = null;
- }
if(context.component.SubmitSource == "lstQuestions") {
+ context.state.Parameters["TA_ALL_CATEGORIES"] = null;
context.state.Parameters["TA_ATTRIBUTES_SINGLE"] = null;
context.state.Parameters["TA_LEVEL"] = null;
context.state.Parameters["TA_SUB_CATEGORIES_SINGLE"] = null;
@@ -55,19 +62,25 @@ class Page_dashboard{
context.state.Parameters["TA_VIEW_BY"] = null;
}
+
TAHelper.SetLastVisitedPage(TAHelper.GetGlobals(context), "dashboard");
var paramUtils = new ParameterUtilities(TAHelper.GetGlobals(context));
+
+
paramUtils.SetDefaultParameterValues(_defaultParameters);
var taParams = new TAParameters(TAHelper.GetGlobals(context), Config.GetTALibrary());
var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
- /*try {
- selectedFolder = !context.state.Parameters.IsNull("TA_FOLDERS") ? context.state.Parameters.GetString("TA_FOLDERS") : null;
- }catch(e){
- selectedFolder = null;
- }*/
- _folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+ _filterComponents = new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main);
+
+ _filter_panel = new FilterPanel(_filterComponents,_curDictionary);
+ if(context.component.SubmitSource == "ClearFilters"){
+ _filterComponents.ClearFilters();
+ context.state.Parameters["TA_DATE_FROM"] = null;
+ context.state.Parameters["TA_DATE_TO"] = null;
+ }
taParams.ClearSubcategoriesParameters(selectedFolder, "emptyv", "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
taParams.ClearSubcategoriesParameters(selectedFolder, "emptyv", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
+
}
/**
@@ -78,13 +91,17 @@ class Page_dashboard{
* @param {String} sentiment - "neg" or "pos"
*/
private static function _renderTblMostSentiment(context, sentiment){
- var level = context.state.Parameters.IsNull("TA_LEVEL") ? 0 : context.state.Parameters.GetString("TA_LEVEL");
- var globals = TAHelper.GetGlobals(context);
- var table = context.component;
- var topSentimentTable = new TATopSentimentTable(globals, _folder, table, sentiment, level);
- topSentimentTable.GetTATableUtils().AddClasses(["reportal-table","reportal-categories", "reportal-barchart", "reportal-barchart-header"]);
- topSentimentTable.GetTATableUtils().ClearTableDistributions();
-}
+
+ var level = context.state.Parameters.IsNull("TA_LEVEL") ? 0 : context.state.Parameters.GetString("TA_LEVEL");
+ var globals = TAHelper.GetGlobals(context);
+ var table = context.component;
+ var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
+ var folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+ var topSentimentTable = new TATopSentimentTable(globals, folder, table, sentiment, level);
+ topSentimentTable.GetTATableUtils().AddClasses(["reportal-table","reportal-categories", "reportal-barchart", "reportal-barchart-header"]);
+ topSentimentTable.GetTATableUtils().SetupDrilldown("TA_ALL_CATEGORIES","detailed_analysis, comments");
+ topSentimentTable.GetTATableUtils().ClearTableDistributions();
+ }
/**
* @memberof Page_dashboard
@@ -99,10 +116,13 @@ class Page_dashboard{
var table = context.component;
var period = context.state.Parameters.IsNull("TA_COMPARE_PERIODS") ? "qoq" : context.state.Parameters.GetString("TA_COMPARE_PERIODS");
- var topChangedTable = new TATopChangedTable(globals, _folder, table, sentiment, level, period);
- topChangedTable.GetTATableUtils().AddClasses(["reportal-table","reportal-categories", "reportal-barchart", "reportal-barchart-header"]);
- topChangedTable.GetTATableUtils().ClearTableDistributions();
-}
+ var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
+ var folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+ var topChangedTable = new TATopChangedTable(globals, folder, table, sentiment, level, period);
+ topChangedTable.GetTATableUtils().AddClasses(["reportal-table","reportal-categories", "reportal-barchart", "reportal-barchart-header"]);
+ topChangedTable.GetTATableUtils().ClearTableDistributions();
+ topChangedTable.GetTATableUtils().SetupDrilldown("TA_ALL_CATEGORIES","detailed_analysis, comments");
+ }
/**
* @memberof Page_dashboard
@@ -111,8 +131,8 @@ class Page_dashboard{
* @returns {Boolean}
*/
static function tblMostPositive_Hide(context){
- return false;
-}
+ return false;
+ }
/**
* @memberof Page_dashboard
@@ -120,8 +140,8 @@ class Page_dashboard{
* @param {Object} context - {component: table, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function tblMostPositive_Render(context){
- _renderTblMostSentiment(context, true);
-}
+ _renderTblMostSentiment(context, true);
+ }
/**
* @memberof Page_dashboard
@@ -130,8 +150,8 @@ class Page_dashboard{
* @returns {Boolean}
*/
static function tblMostNegative_Hide(context){
- return false;
-}
+ return false;
+ }
/**
* @memberof Page_dashboard
@@ -139,8 +159,8 @@ class Page_dashboard{
* @param {Object} context - {component: table, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function tblMostNegative_Render(context){
- _renderTblMostSentiment(context, false);
-}
+ _renderTblMostSentiment(context, false);
+ }
/**
* @memberof Page_dashboard
@@ -149,8 +169,8 @@ class Page_dashboard{
* @returns {Boolean}
*/
static function tblMostImproved_Hide(context){
- return false;
-}
+ return false;
+ }
/**
* @memberof Page_dashboard
@@ -158,8 +178,8 @@ class Page_dashboard{
* @param {Object} context - {component: table, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function tblMostImproved_Render(context){
- _renderTblMostChanged(context, true);
-}
+ _renderTblMostChanged(context, true);
+ }
/**
* @memberof Page_dashboard
@@ -168,8 +188,8 @@ class Page_dashboard{
* @returns {Boolean}
*/
static function tblMostDeclined_Hide(context){
- return false;
-}
+ return false;
+ }
/**
* @memberof Page_dashboard
@@ -177,8 +197,8 @@ class Page_dashboard{
* @param {Object} context - {component: table, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function tblMostDeclined_Render(context){
- _renderTblMostChanged(context, false);
-}
+ _renderTblMostChanged(context, false);
+ }
/**
* @memberof Page_dashboard
@@ -187,8 +207,8 @@ class Page_dashboard{
* @returns {Boolean}
*/
static function tblThemeDistribution_Hide(context){
- return false;
-}
+ return false;
+ }
/**
* @memberof Page_dashboard
@@ -196,13 +216,14 @@ class Page_dashboard{
* @param {Object} context - {component: table, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function tblThemeDistribution_Render(context){
- var globals = TAHelper.GetGlobals(context);
- var table = context.component;
- var sentiment = context.state.Parameters.IsNull("TA_VIEW_SENTIMENT") ? "emptyv" : context.state.Parameters.GetString("TA_VIEW_SENTIMENT");
-
- var themeDistributionTable = new TAThemeDistributionTable(globals, _folder, table, sentiment,Config);
+ var globals = TAHelper.GetGlobals(context);
+ var table = context.component;
+ var sentiment = context.state.Parameters.IsNull("TA_VIEW_SENTIMENT") ? "emptyv" : context.state.Parameters.GetString("TA_VIEW_SENTIMENT");
+ var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
+ var folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+ var themeDistributionTable = new TAThemeDistributionTable(globals, folder, table, sentiment,Config);
themeDistributionTable.GetTATableUtils().AddClasses(["reportal-table","reportal-categories", "striped-columns", "reportal-hierarchy-table"]);
- themeDistributionTable.GetTATableUtils().SetupDrilldown("TA_TOP_CATEGORIES_SINGLE", "detailed_analysis");
+ themeDistributionTable.GetTATableUtils().SetupDrilldown("TA_ALL_CATEGORIES", "detailed_analysis, comments");
themeDistributionTable.GetTATableUtils().ClearTableDistributions();
themeDistributionTable.GetTATableUtils().SetupDataSupressing(1);
}
@@ -223,7 +244,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtLevel_Render(context){
- var label = "View by";
+ var label = _curDictionary['View by'];
context.component.Output.Append(label);
}
@@ -243,7 +264,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtMostPositive_Render(context){
- var label = "Top 5 most positive themes";
+ var label = _curDictionary['Top 5 most positive themes'];
context.component.Output.Append(label);
}
@@ -263,7 +284,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtMostNegative_Render(context){
- var label = "Top 5 most negative themes";
+ var label = _curDictionary["Top 5 most negative themes"];
context.component.Output.Append(label);
}
@@ -283,7 +304,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtComparePeriods_Render(context){
- var label = "Compare";
+ var label = _curDictionary["Compare"];
context.component.Output.Append(label);
}
@@ -303,7 +324,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtMostImproved_Render(context){
- var label = "Top 5 most improved themes";
+ var label = _curDictionary["Top 5 most improved themes"];
context.component.Output.Append(label);
}
@@ -343,7 +364,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtMostDeclined_Render(context){
- var label = "Top 5 most declined themes";
+ var label = _curDictionary["Top 5 most declined themes"];
context.component.Output.Append(label);
}
@@ -363,7 +384,7 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtThemeDistribution_Render(context){
- var label = "Theme distribution";
+ var label = _curDictionary["Theme distribution"];
context.component.Output.Append(label);
}
@@ -383,7 +404,67 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtViewSentiment_Render(context){
- var label = "View";
+ var label = _curDictionary["View"];
+ context.component.Output.Append(label);
+}
+
+ /**
+ * @memberof Page_dashboard
+ * @function txtViewSentiment_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function txtPositive_Hide(context){
+ return false;
+}
+
+ /**
+ * @memberof Page_dashboard
+ * @function txtViewSentiment_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtPositive_Render(context){
+ var label = _curDictionary["Positive"];
+ context.component.Output.Append(label);
+}
+
+ /**
+ * @memberof Page_dashboard
+ * @function txtViewSentiment_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function txtNeutral_Hide(context){
+ return false;
+}
+
+ /**
+ * @memberof Page_dashboard
+ * @function txtViewSentiment_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtNeutral_Render(context){
+ var label = _curDictionary["Neutral"];
+ context.component.Output.Append(label);
+}
+
+ /**
+ * @memberof Page_dashboard
+ * @function txtViewSentiment_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function txtNegative_Hide(context){
+ return false;
+}
+
+ /**
+ * @memberof Page_dashboard
+ * @function txtViewSentiment_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtNegative_Render(context){
+ var label = _curDictionary["Negative"];
context.component.Output.Append(label);
}
@@ -403,25 +484,84 @@ class Page_dashboard{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtThemeDistributionScript_Render(context){
+ var categoriesText = "";
var headers;
- var hierarhy = _folder.GetHierarchy().GetHierarchyArray()
+ var selectedFolder = TALibrary.GetTAFoldersParameterValue(context);
+ var folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+ var hierarhy = folder.GetHierarchy().GetHierarchyArray()
headers = new TATableData(TAHelper.GetGlobals(context), "tblThemeDistribution").GetTableRowHeaders();
var upgradeText = "";
+ context.component.Output.Append(categoriesText);
context.component.Output.Append(upgradeText);
context.component.Output.Append(JSON.print(hierarhy,"hierarchy"));
+
+
+
+}
+
+ /**
+ * @memberof Page_dashoboard
+ * @function btnSave_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @returns {Boolean}
+ */
+ static function btnSave_Hide(context){
+ return FilterPanel.btnSave_Hide(context);
+}
+
+ /**
+ * @memberof Page_filters
+ * @function btnSave_Render
+ * @param {Object} context - {component: button, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function btnSave_Render(context){
+ FilterPanel.btnSave_Render(context);
+}
+
+ static function txtFilterTitle_Hide(context, filterNumber){
+ return _filter_panel.txtFilterTitle_Hide(context, filterNumber);
+}
+
+ /**
+ * @memberof Page_filters
+ * @function txtFilterTitle_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ */
+ static function txtFilterTitle_Render(context, filterNumber){
+ _filter_panel.txtFilterTitle_Render(context, filterNumber);
}
+
+ /**
+ * @memberof Page_filters
+ * @function lstFilterList_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ * @returns {Boolean}
+ */
+ static function lstFilterList_Hide(context, filterNumber){
+ return _filter_panel.lstFilterList_Hide(context, filterNumber);
+}
+
+
}
diff --git a/Static/Page_detailed_analysis.js b/Static/Page_detailed_analysis.js
index bef5346..9882666 100644
--- a/Static/Page_detailed_analysis.js
+++ b/Static/Page_detailed_analysis.js
@@ -3,14 +3,30 @@
* @classdesc Static class for Reportal Page detailed_analysis components
*/
class Page_detailed_analysis{
- private static var _selectedCategory;
+
+ private static var _filterComponents;
+ private static var _filter_panel;
private static var _folder;
+ private static var _selectedCategory;
+ private static var _currentLanguage;
+ private static var _curDictionary;
private static const _defaultParameters = [
+ {
+ Id: "TA_ALL_CATEGORIES",
+ Value: "emptyv"
+ },
{
Id: "TA_TOP_CATEGORIES_SINGLE",
Value: "emptyv"
},
-
+ {
+ Id: "TA_SUB_CATEGORIES_SINGLE",
+ Value: "emptyv"
+ },
+ {
+ Id: "TA_ATTRIBUTES_SINGLE",
+ Value: "emptyv"
+ },
{
Id: "TA_DISTRIBUTION_TOGGLE",
Value: "0"
@@ -19,7 +35,11 @@ class Page_detailed_analysis{
{
Id: "TA_VIEW_BY",
Value: "emptyv"
- }
+ },
+ {
+ Id: "TA_FOLDERS",
+ Value: (Config.TAQuestions[0].TAQuestionName+Config.TAQuestions[0].TAModelNo)
+ }
];
/**
@@ -41,17 +61,20 @@ class Page_detailed_analysis{
*/
static function Render(context){
Config.SetTALibrary(TAHelper.GetGlobals(context));
+ _currentLanguage = context.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
+ _filterComponents = new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main);
if(context.component.SubmitSource == "ClearFilters"){
- new FilterComponents(TAHelper.GetGlobals(context), Config.GetTALibrary().GetFilterQuestions(), Config.DS_Main).ClearFilters()
- }
-
- if(context.component.SubmitSource == "btnClearDateFilter"){
+ _filterComponents.ClearFilters();
context.state.Parameters["TA_DATE_FROM"] = null;
context.state.Parameters["TA_DATE_TO"] = null;
}
+
if(context.component.SubmitSource == "lstQuestions") {
+ context.state.Parameters["TA_ALL_CATEGORIES"] = null;
context.state.Parameters["TA_ATTRIBUTES_SINGLE"] = null;
context.state.Parameters["TA_LEVEL"] = null;
+ context.state.Parameters["TA_ALL_CATEGORIES"] = null;
context.state.Parameters["TA_SUB_CATEGORIES_SINGLE"] = null;
context.state.Parameters["TA_TOP_CATEGORIES_SINGLE"] = null;
context.state.Parameters["TA_VIEW_BY"] = null;
@@ -68,10 +91,19 @@ class Page_detailed_analysis{
}catch(e){
selectedFolder = null;
}*/
- _folder =Config.GetTALibrary().GetFolderById(selectedFolder);
+ _folder = Config.GetTALibrary().GetFolderById(selectedFolder);
+
+ _filter_panel = new FilterPanel(_filterComponents);
taParams.ClearSubcategoriesParameters(selectedFolder, "emptyv", "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
taParams.ClearSubcategoriesParameters(selectedFolder, "emptyv", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
- _selectedCategory = context.state.Parameters.GetString("TA_TOP_CATEGORIES_SINGLE");
+
+ if(context.component.SubmitSource == "lstCategory" || context.component.SubmitSource == "lstSubCategory" || context.component.SubmitSource == "lstAttribute"){
+ _selectedCategory = TAHelper.GetSelectedCategory(context.state, "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE");
+ context.state.Parameters['TA_ALL_CATEGORIES'] = new ParameterValueResponse(_selectedCategory);
+ }else {
+ _selectedCategory = context.state.Parameters.GetString('TA_ALL_CATEGORIES');
+ TAHelper.SetSelectedCategory(context.state, _folder.GetHierarchy(), _selectedCategory, "TA_TOP_CATEGORIES_SINGLE", "TA_SUB_CATEGORIES_SINGLE", "TA_ATTRIBUTES_SINGLE",context.log);
+ }
}
/**
@@ -82,7 +114,7 @@ class Page_detailed_analysis{
* @param {String} type - "all", "neg", "neu", "pos"
*/
static private function _buildTATiles(context, type){
- var selectedCategory = context.state.Parameters.GetString("TA_TOP_CATEGORIES_SINGLE");
+ var selectedCategory = _selectedCategory;
var distribution = context.state.Parameters.GetString("TA_DISTRIBUTION_TOGGLE");
new TATiles(TAHelper.GetGlobals(context), _folder, context.component, type, selectedCategory, distribution)
}
@@ -181,7 +213,6 @@ class Page_detailed_analysis{
static function tblDetailedAnalysis_Render(context){
context.component.Caching.Enabled = false;
var globals = TAHelper.GetGlobals(context);
- var selectedCategory = _selectedCategory;
var selectedQuestion = context.state.Parameters.GetString("TA_VIEW_BY");
//var project = globals.report.DataSource.GetProject(Config.DS_Main);
var project = globals.report.DataSource.GetProject(_folder.GetDatasourceId());
@@ -189,10 +220,14 @@ class Page_detailed_analysis{
if(selectedQuestion && selectedQuestion != "emptyv")
selectedQuestionType = project.GetQuestion(selectedQuestion).QuestionType;
var distribution = context.state.Parameters.GetString("TA_DISTRIBUTION_TOGGLE");
- var hideEmptyRows = new ParameterUtilities(globals).GetCheckedValues("TA_HIDE_EMPTY_ROWS");
- var detailedAnalysisTable = new TADetailedAnalysisTable(globals, _folder, context.component, selectedCategory, selectedQuestion, distribution, ( selectedQuestionType == QuestionType.Multi));
+ var parameterUtilities = new ParameterUtilities(globals)
+ var hideEmptyRows = parameterUtilities.GetCheckedValues("TA_HIDE_EMPTY_ROWS");
+ var toggleChartValue = parameterUtilities.GetCheckedValues("TA_TOGGLE_BARCHART");
+ var toggleChart = (toggleChartValue.length > 0)
+ var detailedAnalysisTable = new TADetailedAnalysisTable(globals, _folder, context.component, _selectedCategory, selectedQuestion, distribution, ( selectedQuestionType == QuestionType.Multi), toggleChart);
detailedAnalysisTable.GetTATableUtils().AddClasses(["reportal-table","reportal-categories", "reportal-fixed-header", "reportal-hierarchy-table", "reportal-barchart", "detailed-analysis-table"]);
detailedAnalysisTable.GetTATableUtils().SetupHideEmptyRows((hideEmptyRows.length >0));
+ detailedAnalysisTable.GetTATableUtils().SetupDrilldown("TA_ALL_CATEGORIES", "comments");
}
/**
@@ -212,29 +247,37 @@ class Page_detailed_analysis{
*/
static function txtDetailedAnalysisScript_Render(context){
var headers;
- var hierarhy = _folder.GetHierarchy().GetHierarchyArray();
+ context.log.LogDebug("selectedCat: "+ _selectedCategory)
+ var hierarhy = _selectedCategory == 'emptyv'? _folder.GetHierarchy().GetHierarchyArray() : [_folder.GetHierarchy().GetObjectById(_selectedCategory)];
var taTableData = new TATableData(TAHelper.GetGlobals(context), "tblDetailedAnalysis");
var headers = taTableData.GetTableRowHeaders();
if( headers.length > 0){
var blocks = taTableData.GetBlocks();
var upgradeText = "";
context.component.Output.Append(upgradeText);
@@ -294,7 +337,8 @@ class Page_detailed_analysis{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtViewBy_Render(context){
- context.component.Output.Append("View by:");
+ var label = _curDictionary['View by:'];
+ context.component.Output.Append(label);
}
/**
@@ -313,9 +357,35 @@ class Page_detailed_analysis{
* @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtCategory_Render(context){
- context.component.Output.Append("Category");
+ var label = _curDictionary['Category'];
+ context.component.Output.Append(label);
}
+ static function txtFilterTitle_Hide(context, filterNumber){
+ return _filter_panel.txtFilterTitle_Hide(context, filterNumber);
+}
+
+ /**
+ * @memberof Page_filters
+ * @function txtFilterTitle_Render
+ * @param {Object} context - {component: text, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ */
+ static function txtFilterTitle_Render(context, filterNumber){
+ _filter_panel.txtFilterTitle_Render(context, filterNumber);
+}
+
+ /**
+ * @memberof Page_filters
+ * @function lstFilterList_Hide
+ * @param {Object} context - {pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ * @param {Number} filterNumber
+ * @returns {Boolean}
+ */
+ static function lstFilterList_Hide(context, filterNumber){
+ return _filter_panel.lstFilterList_Hide(context, filterNumber);
+}
+
/**
* @memberof Page_comments
* @function lstSubCategory_Hide
@@ -340,8 +410,6 @@ class Page_detailed_analysis{
return ((! parameterValue) || parameterValue == "emptyv" || _folder.GetHierarchy().GetObjectById(parameterValue).subcells.length == 0)
}
-
-
/**
* @memberof Page_comments
* @function txtSubCategory_Hide
@@ -361,7 +429,8 @@ class Page_detailed_analysis{
* @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtSubCategory_Render(context){
- var label = "Sub category";
+ var label = _curDictionary['Sub category'];
+
context.component.Output.Append(label);
}
@@ -384,7 +453,69 @@ class Page_detailed_analysis{
* @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function txtAttribute_Render(context){
- var label = "Attribute";
+ var label = _curDictionary['Attribute'];
+ context.component.Output.Append(label);
+}
+
+
+ static function txtTotalComments_Hide(context){
+ return false
+}
+
+ /**
+ * @memberof Page_comments
+ * @function txtSubCategory_Render
+ * @description function to render the sub Category selector label
+ * @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtTotalComments_Render(context){
+ var label = _curDictionary['Total comments'];
+ context.component.Output.Append(label);
+}
+
+ static function txtPositive_Hide(context){
+ return false
+}
+
+ /**
+ * @memberof Page_comments
+ * @function txtSubCategory_Render
+ * @description function to render the sub Category selector label
+ * @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtPositive_Render(context){
+ var label = _curDictionary['Positive'];
context.component.Output.Append(label);
}
+
+ static function txtNeutral_Hide(context){
+ return false
}
+
+ /**
+ * @memberof Page_comments
+ * @function txtSubCategory_Render
+ * @description function to render the sub Category selector label
+ * @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtNeutral_Render(context){
+ var label = _curDictionary['Neutral'];
+ context.component.Output.Append(label);
+}
+
+ static function txtNegative_Hide(context){
+ return false
+}
+
+ /**
+ * @memberof Page_comments
+ * @function txtSubCategory_Render
+ * @description function to render the sub Category selector label
+ * @param {Object} context - {component: text, pageContext: this.pageContext,report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function txtNegative_Render(context){
+ var label = _curDictionary['Negative'];
+ context.component.Output.Append(label);
+}
+}
+
diff --git a/Static/Parameters.js b/Static/Parameters.js
index 48cac71..b7e2135 100644
--- a/Static/Parameters.js
+++ b/Static/Parameters.js
@@ -13,6 +13,7 @@ class Parameters{
} finally {}*/
}
+
/**
* @memberof Parameters
* @function TA_FOLDERS_Domain
@@ -37,22 +38,39 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_COMPARE_PERIODS_Domain(context){
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+
var parameterValues = [
- {Code: "wow", Label: "Current vs Last Week"},
- {Code: "mom", Label: "Current vs Last Month"},
- {Code: "qoq", Label: "Current vs Last Quarter"},
- {Code: "yoy", Label: "Current vs Last Year"}
+ {Code: "wow", Label: currentDictionary["Current vs Last Week"]},
+ {Code: "mom", Label: currentDictionary["Current vs Last Month"]},
+ {Code: "qoq", Label: currentDictionary["Current vs Last Quarter"]},
+ {Code: "yoy", Label: currentDictionary["Current vs Last Year"]}
];
new ParameterUtilities(TAHelper.GetGlobals(context)).LoadParameterValues(context.component, parameterValues);
}
+ /**
+ * @memberof Parameters
+ * @function TA_TOP_CATEGORIES_SINGLE_Domain
+ * @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
+ */
+ static function TA_ALL_CATEGORIES_Domain(context){
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+ new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderAllCategoriesParameter(context.component, getSelectedFolder(context),currentDictionary["-select-"])
+}
+
/**
* @memberof Parameters
* @function TA_TOP_CATEGORIES_SINGLE_Domain
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_TOP_CATEGORIES_SINGLE_Domain(context){
- new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderLevelCategoriesParameter(context.component, getSelectedFolder(context), 0, "-select-")
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+
+ new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderLevelCategoriesParameter(context.component, getSelectedFolder(context), 0, currentDictionary["-select-"])
}
/**
@@ -61,7 +79,9 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_SUB_CATEGORIES_SINGLE_Domain(context){
- new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderLevelCategoriesParameter(context.component, getSelectedFolder(context), 1, "-select-")
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+ new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderLevelCategoriesParameter(context.component, getSelectedFolder(context), 1, currentDictionary["-select-"])
}
/**
@@ -70,7 +90,9 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_ATTRIBUTES_SINGLE_Domain(context){
- new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderLevelCategoriesParameter(context.component, getSelectedFolder(context), 2, "-select-")
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+ new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderLevelCategoriesParameter(context.component, getSelectedFolder(context), 2, currentDictionary["-select-"])
}
/**
@@ -101,11 +123,13 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_VIEW_SENTIMENT_Domain(context){
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
var parameterValues = [
- {Code: "emptyv", Label: "All sentiments"},
- {Code: "pos", Label: "Positive"},
- {Code: "neu", Label: "Neutral"},
- {Code: "neg", Label: "Negative"}
+ {Code: "emptyv", Label: currentDictionary["All sentiments"]},
+ {Code: "pos", Label: currentDictionary["Positive"]},
+ {Code: "neu", Label: currentDictionary["Neutral"]},
+ {Code: "neg", Label: currentDictionary["Negative"]}
]
new ParameterUtilities(TAHelper.GetGlobals(context)).LoadParameterValues(context.component, parameterValues);
}
@@ -116,8 +140,10 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_DISTRIBUTION_TOGGLE_Domain(context){
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
var parameterValues = [
- {Code: 0, Label: "Count"},
+ {Code: 0, Label: currentDictionary["Count"]},
{Code: 1, Label: "%"}
]
@@ -130,7 +156,9 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_VIEW_BY_Domain(context){
- new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderViewByParameter(context.component, getSelectedFolder(context), "-select-");
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+ new TAParameters(TAHelper.GetGlobals(context),Config.GetTALibrary()).RenderViewByParameter(context.component, getSelectedFolder(context), currentDictionary["-select-"]);
}
/**
@@ -139,8 +167,10 @@ class Parameters{
* @param {Object} context - {component: parameter, pageContext: this.pageContext, report: report, user: user, state: state, confirmit: confirmit, log: log}
*/
static function TA_HIDE_EMPTY_ROWS_Domain(context){
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
var parameterValues = [
- {Code: "hide", Label: "Hide categories with no hits"}
+ {Code: "hide", Label: currentDictionary["Hide categories with no hits"]}
]
new ParameterUtilities(TAHelper.GetGlobals(context)).LoadParameterValues(context.component, parameterValues);
}
@@ -166,4 +196,13 @@ class Parameters{
new ParameterUtilities(TAHelper.GetGlobals(context)).LoadParameterValues(context.component, parameterValues);
}
}
+
+ static function TA_TOGGLE_CHART_Domain(context){
+ var currentLanguage = context.report.CurrentLanguage;
+ var currentDictionary = Translations.dictionary(currentLanguage);
+ var parameterValues = [
+ {Code: "toggle", Label: currentDictionary["Toggle chart view"]}
+ ]
+ new ParameterUtilities(TAHelper.GetGlobals(context)).LoadParameterValues(context.component, parameterValues);
+ }
}
\ No newline at end of file
diff --git a/Static/ReportMaster.js b/Static/ReportMaster.js
index d6007e5..2d95ab4 100644
--- a/Static/ReportMaster.js
+++ b/Static/ReportMaster.js
@@ -62,4 +62,109 @@ class ReportMaster {
static function btnClearDateFilter_Render(context){
context.component.Label = new Label(9, "Clear Date Filters");
}
+ static function txtFilterPanelScript_Render(context){
+ var script = "";
+ context.component.Output.Append(script)
+
+ if(Config.Design) {
+ var backgroundColor = Config.Design.backgroundColor;
+ var lightPrimaryColor = Config.Design.lightPrimaryColor;
+ var buttonTextColor = Config.Design.buttonTextColor;
+ var buttonHoverColor = Config.Design.buttonHoverColor;
+ var buttonMainColor = Config.Design.buttonMainColor;
+ var tableColumnColor = Config.Design.tableColumnColor;
+ var primaryTextColor = Config.Design.primaryTextColor;
+ var secondaryTextColor = Config.Design.secondaryTextColor;
+ var disabledTextColor = Config.Design.disabledTextColor;
+ var dividerColor = Config.Design.dividerColor;
+ var lightDividerColor = Config.Design.lightDividerColor;
+ var positiveColor = Config.Design.positiveColor;
+ var neutralColor = Config.Design.neutralColor;
+ var negativeColor = Config.Design.negativeColor;
+
+ var str = "";
+ context.component.Output.Append(str);
+ }
+
+}
+
+
}
\ No newline at end of file
diff --git a/TADetailedAnalysisTable.js b/TADetailedAnalysisTable.js
index 0e84ad7..de1424b 100644
--- a/TADetailedAnalysisTable.js
+++ b/TADetailedAnalysisTable.js
@@ -20,9 +20,14 @@ class TADetailedAnalysisTable{
private var _selectedQuestion;
private var _distribution;
private var _multiQuestion;
+ private var _currentLanguage;
+ private var _curDictionary;
+ private var _bar100;
- function TADetailedAnalysisTable(globals, folder, table, selectedCategory, selectedQuestion, distribution, multiQuestion){
+ function TADetailedAnalysisTable(globals, folder, table, selectedCategory, selectedQuestion, distribution, multiQuestion, bar100){
_globals = globals;
+ _currentLanguage = _globals.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
_folder = folder;
_taMasks = new TAMasks(globals, folder);
_table = table;
@@ -31,6 +36,7 @@ class TADetailedAnalysisTable{
_selectedQuestion = selectedQuestion && selectedQuestion != "emptyv" ? selectedQuestion : "all";
_distribution = distribution ? distribution : "0";
_multiQuestion = multiQuestion;
+ _bar100 = bar100 ? bar100 : false;
_render();
}
@@ -131,7 +137,7 @@ class TADetailedAnalysisTable{
*/
private function _getColumnFormulaExpression(){
var countformulaexpression;
- var countformula = '[FORMULA]{decimals:0;label:"Comments";hideheader:true';
+ var countformula = '[FORMULA]{decimals:0;label:"'+_curDictionary['Comments']+'";hideheader:true';
if( _distribution == "1"){
countformula += ";percent:true";
countformulaexpression = '"IF((cellv(1,1)>0),(cellv(col-1,row)/cellv(1,1)),EMPTYV())"';
@@ -171,8 +177,9 @@ class TADetailedAnalysisTable{
* @function _addChartColumn
*/
private function _addChartColumn(){
+ var chartType = _bar100 ? ChartComboType.Bar100 : ChartComboType.Bar
var chartHeader = _taTableUtils.GetChartHeader(
- ChartComboType.Bar100,
+ chartType,
[
{
Formula: "cellv(col-25,row)",
@@ -200,21 +207,19 @@ class TADetailedAnalysisTable{
private function _setupConditionalFormatting(){
_taTableUtils.SetupConditionalFormatting(
[
- [
- {
- expression: 'cellv(col, row)<('+(Config.SentimentRange.Neutral[0] - 6)+') AND cellv(col,row)<>EMPTYV() ',
- style: 'negative'
- },
-
- {
- expression: '(cellv(col, row)>=('+(Config.SentimentRange.Neutral[0] - 6)+')) AND (cellv(col, row)<='+(Config.SentimentRange.Neutral[Config.SentimentRange.Neutral.length - 1] - 6)+') AND cellv(col,row)<>EMPTYV()',
- style: 'neutral'
- },
- {
- expression: 'cellv(col, row)>'+(Config.SentimentRange.Neutral[Config.SentimentRange.Neutral.length - 1] - 6)+' AND cellv(col,row)<>EMPTYV()',
- style: 'positive'
- }
- ]
+ {
+ expression: 'cellv(col, row)<('+(Config.SentimentRange.Neutral[0] - 6)+') AND cellv(col,row)<>EMPTYV() ',
+ style: 'negative'
+ },
+
+ {
+ expression: '(cellv(col, row)>=('+(Config.SentimentRange.Neutral[0] - 6)+')) AND (cellv(col, row)<='+(Config.SentimentRange.Neutral[Config.SentimentRange.Neutral.length - 1] - 6)+') AND cellv(col,row)<>EMPTYV()',
+ style: 'neutral'
+ },
+ {
+ expression: 'cellv(col, row)>'+(Config.SentimentRange.Neutral[Config.SentimentRange.Neutral.length - 1] - 6)+' AND cellv(col,row)<>EMPTYV()',
+ style: 'positive'
+ }
],
"NegNeuPos",
{
@@ -248,7 +253,7 @@ class TADetailedAnalysisTable{
},
],
- "Negative",
+ "Neutral",
{
axis: Area.Columns,
direction: Area.Left,
@@ -264,7 +269,7 @@ class TADetailedAnalysisTable{
},
],
- "Negative",
+ "Positive",
{
axis: Area.Columns,
direction: Area.Left,
diff --git a/TAFilters.js b/TAFilters.js
index 9ed32a8..9ba5f2e 100644
--- a/TAFilters.js
+++ b/TAFilters.js
@@ -29,7 +29,7 @@ class TAFilters{
var fExpr;
var selectedCategory = TAHelper.GetSelectedCategory(_globals.state, categoriesParameter, subCategoriesParameter, attributesParameter);
- fExpr = selectedCategory ?('ANY(' + _folder.GetQuestionId("categories") + ',"'+selectedCategory+'")'):'NOT ISNULL('+_folder.GetQuestionId("overallSentiment")+')';
+ fExpr = (selectedCategory && selectedCategory !="emptyv") ?('ANY(' + _folder.GetQuestionId("categories") + ',"'+selectedCategory+'")'):'NOT ISNULL('+_folder.GetQuestionId("overallSentiment")+')';
return fExpr;
}
@@ -60,7 +60,8 @@ class TAFilters{
sentimentRange ='"' + Config.SentimentRange.Negative.join('","')+'"';
break;
}
- var questionName = selectedCategory ? (_folder.GetQuestionId("categorysentiment")+"_"+selectedCategory) : _folder.GetQuestionId("overallsentiment");
+ var questionName = (selectedCategory && selectedCategory != "emptyv") ? (_folder.GetQuestionId("categorysentiment")+"_"+selectedCategory) : _folder.GetQuestionId("overallsentiment");
+
fExpr = sentimentRange ?('IN(' + questionName + ','+sentimentRange+')') : '';
return fExpr;
}
diff --git a/TAFolder.js b/TAFolder.js
index a497b98..781aab0 100644
--- a/TAFolder.js
+++ b/TAFolder.js
@@ -11,6 +11,7 @@ class TAFolder{
//TA Fields
private var _id: String;
+ private var _folderName;
private var _qName: String;
private var _modelNo: String;
@@ -25,7 +26,8 @@ class TAFolder{
function TAFolder(globals, questionIndex, config){
_globals = globals;
- _id = config.TAQuestions[questionIndex].TAFolderId;
+ _id = config.TAQuestions[questionIndex].TAQuestionName+config.TAQuestions[questionIndex].TAModelNo;
+ _folderName = config.TAQuestions[questionIndex].TAFolderId;
_qName = config.TAQuestions[questionIndex].TAQuestionName;
_modelNo = config.TAQuestions[questionIndex].TAModelNo;
_timeVariableId = TAHelper.GetConfiguredVariables(globals,[config.TAQuestions[questionIndex].TimeVariableId], [config.TimeVariableId], null, ["interview_start"])[0];
@@ -37,11 +39,12 @@ class TAFolder{
var hitlistColumns = TAHelper.GetTagsFromSurvey(globals, _datasourceId, ["ta_hitlist"]);
_hitlistColumns = TAHelper.GetConfiguredVariables(globals, config.TAQuestions[questionIndex].HitlistColumns, config.HitlistColumns, hitlistColumns, []);
-
+ globals.log.LogDebug('before hierarchy'+config.TAQuestions[questionIndex].DatabaseSchemaId);
_hierarchy = new Hierarchy(globals, {
schemaId: config.TAQuestions[questionIndex].DatabaseSchemaId,
tableName: config.TAQuestions[questionIndex].DatabaseTableName,
relationshipColumnName: config.TAQuestions[questionIndex].RelationshipColumnName,
+ textColumnName: "__l"+globals.report.CurrentLanguage,
textSeparator: config.TAQuestions[questionIndex].TextSeparator != "" ? config.TAQuestions[questionIndex].TextSeparator: null
});
}
@@ -113,6 +116,10 @@ class TAFolder{
return _id;
}
+ function GetName(){
+ return _folderName;
+}
+
/**
* @memberof TAFolder
* @instance
diff --git a/TAHelper.js b/TAHelper.js
index e86f19b..d817939 100644
--- a/TAHelper.js
+++ b/TAHelper.js
@@ -28,7 +28,7 @@ class TAHelper{
* @param {ReportState} state
* @param {String} categoriesParameterName
* @param {String} subCategoriesParameterName
- * @param {String} attribtesPararmeterNam
+ * @param {String} attributesParameterName
* @returns {String}
*/
static function GetSelectedCategory(state, categoriesParameterName, subCategoriesParameterName, attribtesPararmeterName){
@@ -39,14 +39,14 @@ class TAHelper{
var subCategoriesParameter;
if(subCategoriesParameterName)
- subCategoriesParameter= state.Parameters.GetString("TA_SUB_CATEGORIES_SINGLE");
+ subCategoriesParameter= state.Parameters.GetString(subCategoriesParameterName);
var attributesParameter;
if(attribtesPararmeterName)
- attributesParameter = state.Parameters.GetString("TA_ATTRIBUTES_SINGLE");
+ attributesParameter = state.Parameters.GetString(attribtesPararmeterName);
- var selectedCategory = false;
+ var selectedCategory = "emptyv";
if(categoriesParameter && categoriesParameter != "emptyv"){
selectedCategory = categoriesParameter;
@@ -63,6 +63,42 @@ class TAHelper{
return selectedCategory;
}
+ static function SetSelectedCategory(state, hierarchy, allCategoriesParameterValue, categoriesParameterName, subCategoriesParameterName, attribtesPararmeterName,log){
+ var defaultParameterValues = [
+ {
+ Id: categoriesParameterName,
+ Value: "emptyv"
+ },
+ {
+ Id: subCategoriesParameterName,
+ Value: "emptyv"
+ },
+ {
+ Id: attribtesPararmeterName,
+ Value: "emptyv"
+ }
+ ];
+ if( allCategoriesParameterValue != "emptyv"){
+ log.LogDebug('not empty');
+ var selectedCategory = hierarchy.GetObjectById(allCategoriesParameterValue);
+ defaultParameterValues[selectedCategory.level].Value = selectedCategory.id;
+ log.LogDebug('level: '+selectedCategory.level+' value: '+selectedCategory.id);
+ if(selectedCategory.level > 0){
+ defaultParameterValues[selectedCategory.level-1].Value = selectedCategory.parent
+ }
+
+ if(selectedCategory.level == 2){
+ defaultParameterValues[0].Value = hierarchy.GetObjectById(selectedCategory.parent).parent
+ }
+
+ }
+
+ for(var i = 0; i < defaultParameterValues.length; i++) {
+ state.Parameters[defaultParameterValues[i].Id] = new ParameterValueResponse(defaultParameterValues[i].Value);
+ }
+
+}
+
/**
* @memberof TAHelper
* @function GetSelfName
diff --git a/TAParameters.js b/TAParameters.js
index 768ce44..cf8649b 100644
--- a/TAParameters.js
+++ b/TAParameters.js
@@ -10,11 +10,15 @@ class TAParameters{
private var _globals;
private var _library: TALibrary;
private var _parameterUtilities: ParameterUtilities;
+ private var _currentLanguage;
+ private var _curDictionary;
function TAParameters(globals, library){
_globals = globals;
_library = library;
_parameterUtilities = new ParameterUtilities(_globals);
+ _currentLanguage = globals.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
}
/**
@@ -47,16 +51,34 @@ class TAParameters{
var folders = _library.GetFolders();
var parameterValues = [];
-
+ var project;
+ var question;
for(var i = 0; i < folders.length; i++){
+ project = _globals.report.DataSource.GetProject(folders[i].GetDatasourceId());
+ question = project.GetQuestion(folders[i].GetQuestionId());
parameterValues.push({
Code: folders[i].GetId(),
- Label: folders[i].GetId()
+ Label: folders[i].GetName() //+ (question.Text ? " - " + question.Text : "")
});
}
_parameterUtilities.LoadParameterValues(parameter, parameterValues);
}
+ function RenderAllCategoriesParameter(parameter,folderId, emptyValueLabel){
+ var categories = _library.
+ GetFolderById(folderId).
+ GetHierarchy().
+ GetFlatArray();
+ var parameterValues = _addEmptyValue(emptyValueLabel);
+ for(var i = 0; i < categories.length; i++){
+ parameterValues.push({
+ Code: categories[i].id,
+ Label: categories[i].name
+ })
+ }
+ _parameterUtilities.LoadParameterValues(parameter, parameterValues);
+ }
+
/**
* @memberof TAParameters
* @instance
@@ -118,15 +140,15 @@ class TAParameters{
var levelValues = [
{
Code: "0",
- Label: "1st level (category)"
+ Label: _curDictionary["1st level (category)"]
},
{
Code: "1",
- Label: "2nd level (sub-category)"
+ Label: _curDictionary["2nd level (sub-category)"]
},
{
Code: "2",
- Label: "3rd level (attributes)"
+ Label: _curDictionary["3rd level (attributes)"]
}
];
var parameterValues = _addEmptyValue(emptyValueLabel);
@@ -176,7 +198,7 @@ class TAParameters{
* @param {String} value - empty value for that parameter "emptyv"
* @param {String} categoriesParameter
* @param {String} subcategoriesParameter
- * @param {String} attributesParamete
+ * @param {String} attributesParameter
*/
function ClearSubcategoriesParameters(folderId, value, categoriesParameter, subcategoriesParameter, attributesParameter){
var folder = _library.GetFolderById(folderId);
diff --git a/TATableUtils.js b/TATableUtils.js
index 9dc2328..c9c6beb 100644
--- a/TATableUtils.js
+++ b/TATableUtils.js
@@ -11,9 +11,13 @@ class TATableUtils{
private var _globals;
private var _folder: TAFolder;
private var _table: Table;
+ private var _currentLanguage;
+ private var _curDictionary;
function TATableUtils(globals, folder, table){
_globals = globals;
+ _currentLanguage = _globals.report.CurrentLanguage;
+ _curDictionary = Translations.dictionary(_currentLanguage);
_folder = folder;
_table = table;
}
@@ -168,19 +172,19 @@ class TATableUtils{
case "neg":
headerCategories.Mask.Codes = configuration.Negative.join(",");
headerFormula.Expression = _getSumOfCells(configuration.Negative.length)+(addMinus?"*(-1)":"");
- categoryTitle = new Label(9, "Negative");
+ categoryTitle = new Label(_currentLanguage, _curDictionary["Negative"]);
break;
case "neu":
headerCategories.Mask.Codes = configuration.Neutral.join(",");
headerFormula.Expression = _getSumOfCells(configuration.Neutral.length);
- categoryTitle = new Label(9, "Neutral");
+ categoryTitle = new Label(_currentLanguage, _curDictionary["Neutral"]);
break;
case "pos":
headerCategories.Mask.Codes = configuration.Positive.join(",");
headerFormula.Expression = _getSumOfCells(configuration.Positive.length);
- categoryTitle = new Label(9, "Positive");
+ categoryTitle = new Label(_currentLanguage, _curDictionary["Positive"]);
break;
}
@@ -237,17 +241,17 @@ class TATableUtils{
switch(groupName.toLowerCase()){
case "neg":
formulaExpression = _getSumOfCells(configuration.Negative.length, (configuration.Positive.length+configuration.Neutral.length))+(addMinus?'*(-1)':'');
- categoryLabel = '"Negative"';
+ categoryLabel = '"'+_curDictionary['Negative']+'"';
break;
case "neu":
formulaExpression = _getSumOfCells(configuration.Neutral.length,(configuration.Positive.length));
- categoryLabel = '"Neutral"';
+ categoryLabel = '"'+_curDictionary['Neutral']+'"';
break;
case "pos":
formulaExpression = _getSumOfCells(configuration.Positive.length,0);
- categoryLabel = '"Positive"';
+ categoryLabel = '"'+_curDictionary['Positive']+'"';
break;
}
@@ -284,7 +288,7 @@ class TATableUtils{
chartHeader.Thickness = "80%";
chartHeader.CssClass = "chart-header";
chartHeader.ShowTitle = true;
- chartHeader.Title = new Label(9, title?title:"Chart");
+ chartHeader.Title = new Label(_currentLanguage, title?title:_curDictionary["Chart"]);
var chartValue: ChartComboValue;
for(var i = 0; i< formulas.length; i++) {
@@ -411,4 +415,4 @@ class TATableUtils{
_table.SuppressData.CellDisplay = BaseDisplayOption.Hide;
_table.SuppressData.CellLimit = 1;
}
-}
+}
\ No newline at end of file
diff --git a/TATiles.js b/TATiles.js
index 6b15327..66b17e3 100644
--- a/TATiles.js
+++ b/TATiles.js
@@ -62,7 +62,7 @@ class TATiles{
}
var rowexpr = _taTableUtils.GetTAQuestionExpression(qType, mask);
- var columnexpr = _taTableUtils.GetCategoriesExpression( _sentiment, false, true, _distribution);
+ var columnexpr = _taTableUtils.GetCategoriesExpression( _sentiment, false, true, _distribution, Config.SentimentRange);
_taTableUtils.CreateTableFromExpression(rowexpr, columnexpr);
_table.Distribution.Enabled = true;
diff --git a/TATopChangedTable.js b/TATopChangedTable.js
index 99b548e..f6eff92 100644
--- a/TATopChangedTable.js
+++ b/TATopChangedTable.js
@@ -22,6 +22,7 @@ class TATopChangedTable{
private var _sentiment;
private var _percents;
private var _period;
+ private var _currentLanguage;
function TATopChangedTable(globals, folder, table, sentiment, level, period, topN){
_globals = globals;
@@ -37,6 +38,7 @@ class TATopChangedTable{
From: -1,
To: 0
};
+ _currentLanguage = globals.report.CurrentLanguage;
_render();
}
@@ -64,6 +66,7 @@ class TATopChangedTable{
_taTableUtils.CreateTableFromExpression(rowexpr);
_addTimeSeriesColumn();
+
_addDifferenceColumn();
_addChartColumn();
_setupSorting();
@@ -76,13 +79,14 @@ class TATopChangedTable{
* @function _addTimeSeriesColumn
*/
private function _addTimeSeriesColumn(){
- var headerTimeSeries = _taTableUtils.GetTimePeriodHeader(_period.Unit, _period.From, _period.To);
- var headerStatistics: HeaderStatistics = new HeaderStatistics();
- headerStatistics.HideHeader = true;
- headerStatistics.Statistics.Avg = true;
- headerStatistics.SubHeaders.Add(headerTimeSeries);
- _table.ColumnHeaders.Add(headerStatistics);
- }
+ var headerTimeSeries = _taTableUtils.GetTimePeriodHeader(_period.Unit, _period.From, _period.To);
+ var headerStatistics: HeaderStatistics = new HeaderStatistics();
+ headerStatistics.HideHeader = true;
+ headerStatistics.Statistics.Avg = true;
+ headerStatistics.SubHeaders.Add(headerTimeSeries);
+ _table.ColumnHeaders.Add(headerStatistics);
+}
+
/**
* @memberof TATopChangedTable
@@ -95,7 +99,8 @@ class TATopChangedTable{
headerFormula.Type = FormulaType.Expression;
headerFormula.HideData = false;
headerFormula.Decimals = 1;
- headerFormula.Expression = "cellv(col-1,row)-cellv(col-2,row)";
+ var sign = _sentiment ? ">" : "<";
+ headerFormula.Expression = "IF((cellv(col-1,row)-cellv(col-2,row))"+sign+"0,(cellv(col-1,row)-cellv(col-2,row)),EMPTYV())";
headerFormula.Title = new Label(9, " ");
headerFormula.HideHeader = true;
@@ -115,7 +120,7 @@ class TATopChangedTable{
Formula: "cellv(col-1,row)",
Color: ( _sentiment ? Config.Colors.NegNeuPosPalette.Positive : Config.Colors.NegNeuPosPalette.Negative )
}],
- "Change in avg. score");
+ Translations.dictionary(_currentLanguage)['Change in avg. score']);
_table.ColumnHeaders.Add(chartHeader);
}
diff --git a/TATopSentimentTable.js b/TATopSentimentTable.js
index 2b295bc..a69b893 100644
--- a/TATopSentimentTable.js
+++ b/TATopSentimentTable.js
@@ -17,6 +17,7 @@ class TATopSentimentTable{
private var _taMasks: TAMasks;
private var _table: Table;
private var _level;
+ private var _currentLanguage;
private var _topN;
private var _sentiment;
private var _distribution;
@@ -31,6 +32,7 @@ class TATopSentimentTable{
_level = parseInt(level);
_topN = topN ? topN : 5;
_distribution = distribution ? distribution : "0";
+ _currentLanguage = globals.report.CurrentLanguage;
_render();
}
@@ -74,7 +76,7 @@ class TATopSentimentTable{
Formula: "cellv(col-1,row)",
Color: ( _sentiment ? Config.Colors.NegNeuPosPalette.Positive : Config.Colors.NegNeuPosPalette.Negative )
}],
- "Count");
+ Translations.dictionary(_currentLanguage)['Count']);
_table.ColumnHeaders.Add(chartHeader);
}
diff --git a/package.json b/package.json
index 472556c..b086f88 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,12 @@
{
- "name": "text-analytics-template-codelibrary",
+ "name": "TextAnalyticsTemplate_CodeLibrary",
"version": "0.0.120",
"description": "Text analytics template Codelibrary",
"main": "index.js",
"scripts": {
"test": "",
"docs": "node_modules/.bin/jsdoc --configure jsdoc.conf --verbose",
- "docs-commit": "git subtree push --prefix docs/text-analytics-template-codelibrary origin gh-pages"
+ "docs-commit": "git subtree push --prefix docs/TextAnalyticsTemplate_CodeLibrary/0.0.120 origin gh-pages"
},
"repository": {
"type": "git",