Commit 9c59116e authored by Eric Oulashin's avatar Eric Oulashin
Browse files

DD area choosers: For message sub-board/file directory collapsing, if there's...

DD area choosers: For message sub-board/file directory collapsing, if there's only one sub-group/sub-library, then it won't be collapsed
DD area choosers v1.23: For message sub-board/file directory collapsing, if there's only one
sub-group/sub-library, then it won't be collapsed, as that wouldn't be very useful.
parent 2bf9c6cc
Pipeline #2906 passed with stage
in 9 minutes and 58 seconds
// $Id: $
/* This is a script that lets the user choose a file area,
* with either a lightbar or traditional user interface.
*
......@@ -19,6 +17,9 @@
* Fixed lightbar file directory choosing issue when
* using name collapsing (was using the wrong data
* structure)
* 2022-03-18 Eric Oulashin Version 1.23
* For directory collapsing, if there's only one subdirectory,
* then it won't be collapsed.
*/
/* Command-line arguments:
......@@ -56,8 +57,8 @@ if (system.version_num < 31400)
}
// Version & date variables
var DD_FILE_AREA_CHOOSER_VERSION = "1.22";
var DD_FILE_AREA_CHOOSER_VER_DATE = "2022-02-12";
var DD_FILE_AREA_CHOOSER_VERSION = "1.23";
var DD_FILE_AREA_CHOOSER_VER_DATE = "2022-03-18";
// Keyboard input key codes
var CTRL_H = "\x08";
......@@ -2006,12 +2007,27 @@ function DDFileAreaChooser_SetUpLibListWithCollapsedDirs()
// dirDescs is an object indexed by directory description,
// and the value will be how many times it was seen.
var dirDescs = {};
// First, count the number of directories that have the separator.
// If all of the group's directories have the separator, then we
// won't collapse the directories.
var numDirsWithSeparator = 0;
for (var dirIdx = 0; dirIdx < file_area.lib_list[libIdx].dir_list.length; ++dirIdx)
{
var dirDesc = file_area.lib_list[libIdx].dir_list[dirIdx].description;
if (dirDesc.indexOf(this.dirCollapseSeparator) > -1)
++numDirsWithSeparator;
}
// Whether or not to use sub-board collapsing for this file library
var collapseThisLib = (numDirsWithSeparator > 0 && numDirsWithSeparator < file_area.lib_list[libIdx].dir_list.length);
for (var dirIdx = 0; dirIdx < file_area.lib_list[libIdx].dir_list.length; ++dirIdx)
{
var dirDesc = file_area.lib_list[libIdx].dir_list[dirIdx].description;
var sepIdx = dirDesc.indexOf(this.dirCollapseSeparator);
if (sepIdx > -1)
dirDesc = truncsp(dirDesc.substr(0, sepIdx)); // Remove trailing whitespace
if (collapseThisLib)
{
var sepIdx = dirDesc.indexOf(this.dirCollapseSeparator);
if (sepIdx > -1)
dirDesc = truncsp(dirDesc.substr(0, sepIdx)); // Remove trailing whitespace
}
if (dirDescs.hasOwnProperty(dirDesc))
dirDescs[dirDesc] += 1;
else
......
// $Id: $
/* This is a script that lets the user choose a message area,
* with either a lightbar or traditional user interface.
*
......@@ -22,6 +20,12 @@
* this version.
* 2022-02-12 Eric Oulashin Version 1.22
* Updated the version to match the file area chooser
* 2022-03-18 Eric Oulashin Version 1.23
* For sub-board collapsing, if there's only one sub-group,
* then it won't be collapsed.
* Also fixed an issue: Using Q to quit out of the 2nd level
* (sub-board/sub-group) for lightbar mode no longer quits
* out of the chooser altogether.
*
*/
......@@ -64,8 +68,8 @@ if (system.version_num < 31400)
}
// Version & date variables
var DD_MSG_AREA_CHOOSER_VERSION = "1.22";
var DD_MSG_AREA_CHOOSER_VER_DATE = "2022-02-12";
var DD_MSG_AREA_CHOOSER_VERSION = "1.23";
var DD_MSG_AREA_CHOOSER_VER_DATE = "2022-03-18";
// Keyboard input key codes
var CTRL_H = "\x08";
......@@ -793,23 +797,10 @@ function DDMsgAreaChooser_SelectMsgArea_Lightbar(pLevel, pGrpIdx, pSubIdx)
}
else
{
// If using sub-board name collapsing or the sub-board changed (probably
// at level 3 because sub-board collapsing is enabled), then exit here.
if (this.useSubCollapsing || bbs.cursub_code != subCodeBackup)
continueOn = false;
else
{
// A message sub-board was not chosen, so we'll have to re-draw
// the header and key help line
this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx);
this.WriteKeyHelpLine();
}
// TODO?
/*
// A sub-board was not chosen, so we'll have to re-draw
// the header and list of message groups.
// A message sub-board was not chosen, so we'll have to re-draw
// the header and key help line
this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx);
*/
this.WriteKeyHelpLine();
}
}
else if (level == 2) // Choosing a sub-board
......@@ -2403,12 +2394,28 @@ function DDMsgAreaChooser_SetUpGrpListWithCollapsedSubBoards()
// dirDescs is an object indexed by sub-board description,
// and the value will be how many times it was seen.
var subBoardDescs = {};
// First, count the number of sub-boards that have the separator.
// If all of the group's sub-boards have the separator, then we
// won't collapse the sub-boards.
var numSubBoardsWithSeparator = 0;
for (var subIdx = 0; subIdx < msg_area.grp_list[grpIdx].sub_list.length; ++subIdx)
{
var subBoardDesc = msg_area.grp_list[grpIdx].sub_list[subIdx].description;
if (subBoardDesc.indexOf(this.subCollapseSeparator) > -1)
++numSubBoardsWithSeparator;
}
// Whether or not to use sub-board collapsing for this group
var collapseThisGroup = (numSubBoardsWithSeparator > 0 && numSubBoardsWithSeparator < msg_area.grp_list[grpIdx].sub_list.length);
// Go through and build the group list
for (var subIdx = 0; subIdx < msg_area.grp_list[grpIdx].sub_list.length; ++subIdx)
{
var subBoardDesc = msg_area.grp_list[grpIdx].sub_list[subIdx].description;
var sepIdx = subBoardDesc.indexOf(this.subCollapseSeparator);
if (sepIdx > -1)
subBoardDesc = truncsp(subBoardDesc.substr(0, sepIdx)); // Remove trailing whitespace
if (collapseThisGroup)
{
var sepIdx = subBoardDesc.indexOf(this.subCollapseSeparator);
if (sepIdx > -1)
subBoardDesc = truncsp(subBoardDesc.substr(0, sepIdx)); // Remove trailing whitespace
}
if (subBoardDescs.hasOwnProperty(subBoardDesc))
subBoardDescs[subBoardDesc] += 1;
else
......
Digital Distortion Area Choosers
Version 1.22
Release date: 2022-02-12
Version 1.23
Release date: 2022-03-18
by
......@@ -441,6 +441,10 @@ Name collapsing for message areas can be configured with the useSubCollapsing
and subCollapseSeparator options in DDMsgAreaChooser.cfg, and for files, with
the useDirCollapsing and dirCollapseSeparator options in DDFileAreaChooser.cfg.
If all of the sub-boards in a message group or all directories in a file library
have the same separator, then those will not be collapsed, since that would
result in only a single 2nd-tier selection, which would not be useful.
6. DDMsgAreaChooser class: Properties & methods
===============================================
......
......@@ -5,6 +5,9 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.23 2022-03-18 For message sub-board/file directory collapsing, if there
is only one sub-group/sub-library, then it won't be
collapsed, as that wouldn't be very useful.
1.22 2022-01-12 In the file area chooser, fixed a lightbar file directory
choosing issue when using name collapsing (was using the
wrong data structure)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment