Forrest IT Services Technical Blog

Jacaranda Q&A — Building a Moderated Question-and-Answer Module for DNN 10

Over the past several weeks I have been developing a new module for DNN Platform called Jacaranda Q&A.

The module began with a fairly simple need.

Through my ministry website, Forrest Ministries Australia, I receive questions from people wanting to discuss matters of Christian faith, theology, Scripture and life. For some time many of those questions arrived through Facebook Messenger. As the number of messages increased, however, Messenger became increasingly difficult to manage. Questions could easily disappear down the conversation list, replies became difficult to track, and there was no practical way to maintain an organised question-and-answer ministry.

What I needed was not another comments module or discussion forum.

I needed something much more focused.

That became Jacaranda Q&A.

A Different Kind of Q&A Module

Jacaranda Q&A is being developed as a moderated question-and-answer system for DNN 10.

Its purpose is deliberately narrow.

A visitor asks a question. The question can be moderated before publication. An Administrator or Superuser can then provide an answer. Once answered, the original questioner can ask a limited number of related follow-up questions.

It is not intended to become an open discussion board where everybody replies to everybody else.

The basic principle is:

One question. One conversation. One original questioner. A moderated ministry response.

That distinction has influenced almost every design decision in the module.

Public Questions and Moderation

Visitors can submit questions through a simple public interface.

Registered users can participate using their DNN account, while guest participation can also be enabled. Guest email addresses are retained privately and are never displayed publicly.

Guest questions are always moderated.

The module also includes protections intended to prevent the Q&A page from becoming an uncontrolled discussion area. A person cannot simply continue opening new questions while an earlier question is still awaiting moderation or an answer.

The original questioner can ask follow-up questions after an answer has been published, but the number of follow-ups is controlled by a portal-wide setting.

The default is four, although the Administrator can configure the limit from zero through twenty.

A Separate Administration Module

One decision I made fairly early was to separate the public Q&A interface from the administration interface.

The installation therefore provides two separately placeable DNN modules:

Jacaranda Q&A

and

Jacaranda Q&A Administration

The public module can be placed on the normal website Q&A page, while the Administration module can be placed on a secured page available only to the appropriate DNN Administrators or Superusers.

The Administration interface currently provides separate areas for:

  • Dashboard
  • Pending Moderation
  • Awaiting Answer
  • Answered
  • Closed
  • Settings

Server-side pagination is included so the Administration page should remain manageable as the number of questions grows.

One of the More Interesting Problems — Answer Drafts

One of the larger pieces of work in the current development branch has been support for private answer drafts.

Sometimes a theological answer cannot sensibly be written in a few minutes.

An answer may require Scripture to be checked, wording to be reconsidered, or the response simply left overnight before being published.

Beginning with the 01.01.x development series, Jacaranda Q&A therefore gained a proper draft workflow.

An Administrator can now:

Save Draft

Resume Draft

Publish Answer

or

Cancel

There is one private draft for each question.

Saving the draft does not change the public status of the question and does not send an email to the questioner. The question remains in Awaiting Answer until the response is finally published.

The draft can be opened again, edited and saved repeatedly.

When Save Draft is selected, the module returns directly to the Administration page and opens the Awaiting Answer section, where the saved draft can later be resumed.

Integrating DNN's Rich Text Editor

Another major step was replacing the original plain-text ministry answer box with DNN's own rich-text editor.

Visitor questions and visitor follow-ups remain plain text, but ministry answers can use the configured DNN HTML editor.

That sounds fairly straightforward.

It was not.

Anyone who has spent much time developing WebForms modules will probably appreciate that controls with complicated ViewState and postback behaviour can reveal some interesting surprises.

During development I experimented with dynamically loading DNN's TextEditor control. That eventually exposed lifecycle problems, particularly while testing repeated draft saves.

The eventual solution was to stop trying to outsmart the DNN editor and follow the same pattern used by DNN's own HTML module.

The current implementation declares the dnn:textEditor control directly in the ASCX page and reads its Text value through the normal WebForms lifecycle.

That proved to be the much cleaner approach.

Rich Text Editor or Basic Text Box

Another surprisingly small feature required considerably more work than expected.

DNN normally allows an editor to switch between:

Rich Text Editor

and

Basic Text Box

Initially I used the TextEditor control's built-in mode selector.

Unfortunately, depending on the DNN skin and browser, the selector could be extremely difficult to see. I tried increasing the control size, adding borders, stronger contrast and focus indicators, but the result still was not satisfactory.

The better answer was again to look at how DNN itself handles the problem.

Jacaranda Q&A now uses a clear external Editor mode dropdown similar to the standard DNN HTML module.

The Administrator can simply choose:

Rich Text Editor

or

Basic Text Box

Rich Text Editor remains the default.

Sometimes the best development solution is not another CSS rule. It is recognising that the platform already has a better pattern.

An Interesting DNN 10 Discovery

While testing draft saving, I encountered another behaviour that initially looked like a Jacaranda Q&A fault.

Text changes were being saved correctly, but italic formatting appeared to disappear.

Testing the same thing in DNN's standard HTML module produced the same result on both DNN 10.3.2 and DNN 10.3.3.

Further investigation showed that this is associated with a known DNN Platform CSS problem rather than the Q&A module.

The DNN GitHub project has an issue concerning the DNN 10 default CSS reset being too aggressive. In particular, normal browser styling for elements such as <em> and <i> can be overridden.

That means the markup may actually be saved correctly while the page does not visually display the text as italic.

It was a useful reminder of an important development principle:

Always reproduce a suspected module problem in the underlying platform before assuming your own code is responsible.

That lesson probably saved me from introducing several unnecessary workarounds into the Q&A module.

Notifications

Email notifications are intentionally kept fairly simple.

When a visitor submits a question requiring moderation, the questioner can receive an acknowledgement.

Administrators can be notified of new visitor questions and follow-ups.

When a ministry answer is finally published, the original questioner receives a notification containing the answer and a direct link back to the relevant Q&A conversation.

Saving a draft never sends an email.

All Q&A notification emails are deliberately sent as plain text.

Guest Participation and Privacy

Guest participation required considerably more thought than simply asking for a name and email address.

The module includes a guest conversation identity mechanism so that the original guest questioner can later return and participate in the same conversation without relying merely on their display name or email address.

Guest email addresses are protected and are not displayed in the public Q&A.

Guests also receive a short correction opportunity immediately after submitting a question. During that period they can correct the title or wording of their question, but they cannot change the identity information attached to it.

That correction opportunity is deliberately one-shot.

Once the correction is saved, it cannot simply be repeated over and over.

Security Has Been Part of the Development

Because the module accepts public input, security has been part of the design rather than something intended to be bolted on later.

Among the protections included during development are:

  • server-side authorisation checks;
  • request verification;
  • portal, tab and module scoping;
  • guest ownership validation;
  • rate limiting;
  • moderation;
  • transaction-safe question and follow-up checks;
  • protected guest email storage;
  • HTML sanitisation for rich ministry answers;
  • protection against unsafe scripting and dangerous URL schemes;
  • plain-text email output.

There will undoubtedly be more hardening as testing continues, but the intention is that the public release should begin from a reasonably conservative security position.

Accessibility Matters Too

A recurring consideration during development has been readability.

The module uses an eye-relief background of #F5F5DC and I have deliberately increased the size and visibility of a number of controls.

That is not simply cosmetic.

As somebody who appreciates how tiring poor contrast and small controls can become, I want Jacaranda modules to remain usable by people who may not have perfect eyesight.

The editor selector work described earlier grew directly out of that principle.

If I find a control difficult to see, I assume somebody else will as well.

Where Development Stands

At the time of writing, the current development version is Jacaranda Q&A 01.01.09.

The module has now progressed well beyond the original proof of concept.

The major pieces are functioning:

  • public question submission;
  • moderation;
  • separate Administration module;
  • answer workflow;
  • private drafts;
  • repeated draft saving;
  • rich ministry answers;
  • Rich Text / Basic Text editor selection;
  • questioner follow-ups;
  • configurable follow-up limits;
  • guest participation;
  • email notifications;
  • answer and conversation management;
  • accessibility refinements.

It is still undergoing testing, particularly around the rich-editor workflow and behaviour across different DNN installations.

I would rather spend more time testing now than discover avoidable problems after release.

Coming Soon

My intention is to make Jacaranda Q&A available publicly once I am satisfied that the current development branch is ready for broader testing.

Like my other Jacaranda DNN work, the module is being developed as a practical solution to a real need rather than as an academic programming exercise.

It began because I needed a better way to answer genuine questions from people visiting my ministry website.

Along the way it has also become another exploration of what can still be built on DNN 10 using good old-fashioned WebForms, SQL, careful testing and a willingness to keep revisiting a design until it behaves properly.

There have been a few detours.

There will probably be a few more.

But Jacaranda Q&A is getting close.

More information, installation packages and source code will be made available when the first public testing release is ready.