Forum Activity for @tig

TiG
@tig
11/16/17 08:26:10AM
184 posts

Using Button Functions


Jamroom Developers

@michael

I already had the structure in place similar to jrAction. What I did was manually configure the buttons for ntTracker as you suggested to inactivate those I inherited. That allows me to continue, but this is of course not the way we would want to handle this situation. The exclude option is exactly what we need.

Thanks for looking into this and for your advice.
updated by @tig: 11/16/17 05:07:58PM
TiG
@tig
11/15/17 10:23:21PM
184 posts

Using Button Functions


Jamroom Developers

Looking for more details than provided by the docs.

Given a custom module (ntTracker) I need to provide a few buttons. The first button would use the hand icon (semantics = cease) and the second button would reuse the trash icon (semantics = discard). So two buttons - no more.

This template code (with, of course, the supporting PHP declarations) ...
{jrCore_item_list_buttons module="ntTracker" item=$item exclude="update"}

... renders the buttons defined in ntTracker but adds update and delete. The exclude does not work. No matter what value (or values) is placed, the extra buttons always appear.

As an alternative, the docs suggest code similar to:
Using {jrCore_item_create_button module="jrAudio" view="create" profile_id=$_profile_id title="Create Audio"}

But this requires that the appropriate function exist in core. There is no 'hand' function (for example).

Likely there is a straightforward (not reinventing the wheel) way to place select icon buttons on a list, but I do not see it. I think I need to buy a vowel from the experts at this point.
updated by @tig: 02/16/18 04:28:07PM
TiG
@tig
11/12/17 11:26:59PM
184 posts

Communicating an array across AJAX boundaries


Jamroom Developers

@michael

That provides the confirmation I need. Thanks again.
TiG
@tig
11/12/17 10:41:08PM
184 posts

Communicating an array across AJAX boundaries


Jamroom Developers

@michael

Thanks for weighing in.

I implemented this by storing a JSON encoded stream in the jrUser datastore. (I have more data than a flag will support.) This was the only sensible option I could think of given the circumstances. I posted the question just to see if there was something that I was not aware of. I dislike the overhead of the db access (and even the JSON) and would have preferred to -in effect- bind an in-memory array to a global variable that is reliable for a given user across sessions. This information (the array) will be routinely regenerated (it is algorithmically invalidated) thus I just need a global mechanism that works most of the time. I could store an index and if that index does not exist I will regenerate.

That is why I mentioned the cache. I could cache the array once generated and allow the 'client' to pull from the cache. Seems slimy (as a purist) but it probably would work.

My defacto solution (using the jrUser datastore) works. Just want to ensure I am not missing something. :)

As always, your advice is highly valued.
TiG
@tig
11/12/17 07:48:19AM
184 posts

Communicating an array across AJAX boundaries


Jamroom Developers

Have a need to retain an associative array generated in response to a user request for use in another (highly related but technically independent) view. (The array in this case holds recent comment ids of interest per discussion.) Albeit only essential information, this is too big for temp vars or cookies.

This array will be regenerated (and re-stored) based on another mechanism so the timeliness is already addressed. Just need a way to store and retrieve.

Note: I could store this in the db (since that is of course global to all sessions) as a JSON stream but I would rather communicate the array in-memory to avoid db activity and further processing (JSON). Caching might be an option but that seems to be a misuse of cache.
updated by @tig: 02/11/18 08:58:28AM
TiG
@tig
10/25/17 06:38:28AM
184 posts

Using a global $_post in a listener


Jamroom Developers

@michael - Thanks for the confirmation and the info on the future plans for search conditions. Perrie's site is replete with comments and discussions so performance is indeed a top-of-the-mind consideration in what we do. One future consideration is to virtualize the comments tables so that stale comments can be stored in archive tables leaving only the most active comments in the standard tables. The monster challenge here is to find a way to encapsulate comments so that archived comments (when demanded) are seamlessly returned to the client. That is, we would seek a facade that preserves the illusion of a single set of comments tables. Not sure all the areas of jamroom that directly access the comments table so this method may prove to be impractical in jamroom. But it would be a major improvement since the vast majority of stored comments are stale.
TiG
@tig
10/24/17 09:35:24PM
184 posts

Using a global $_post in a listener


Jamroom Developers

Implementing Discussion Image functionality akin to the Blog List Image so that discussions and blogs all can uniformly hold a designated descriptive image and thus bring another dimension of consistency to the site.

Was able to make a working proof of concept by making changes directly in jrDiscussion. I then reimplemented this properly using a new module (ntDiscussion) and listeners. Think of the new module as a subclass of jrDiscussion. ( Of course I reset jrDiscussion back to its pristine form. )

One of the listeners in this solution seems ugly (to me). I am running it by you folks to see if the practice is sensible for jamroom. The ugly listener is used to invoke the function that saves the newly uploaded Discussion Image:

function ntDiscussion_get_save_data_listener($_data, $_user, $_conf, $_args, $event)
{ ... jrCore_save_all_media_files('jrDiscussion', 'update', $_user['user_active_profile_id'], $_post['id']); ... }

My only concern is that I was forced to access $_post as a global variable to get the information I needed to limit the functionality to the create and update forms for discussions.

Is this an appropriate solution?
updated by @tig: 01/23/18 12:05:41PM
TiG
@tig
10/17/17 08:25:56PM
184 posts

Atypical Site Builder Widget


Jamroom Developers

@paul - I was able to get around this by passing a sort_limit argument with the same number as the limit argument. So I should be able to put jrSeamless into production. :)
TiG
@tig
10/17/17 02:41:55PM
184 posts

Atypical Site Builder Widget


Jamroom Developers

@paul - the limit is not passed to the DBMS (best I can tell). So the query returns more records than the limit. The limit is applied by the smarty function after the results have been returned during consolidation.
TiG
@tig
10/17/17 01:38:47PM
184 posts

Atypical Site Builder Widget


Jamroom Developers

@michael - My first approach was to try the jrSeamless functionality since that seems to be designed for the kind of task I am facing. The only concern I have is performance. I do not want to process a huge result set only to get the most recent 15 items. And in Perrie's case the Blog and Discussion tables are very large. Ergo my question to paul.

On your point, I am indeed considering my own smarty function per your suggestion. Happily I could use much of what exists in jrSeamless to make a custom module for this. Given I do not want to bring back a large result set only to strip off the top 15 items, I would likely pursue a custom SQL query that enables the optimizer to return a much smaller result set. That is, I would have no concern processing the most recent 15 selected blogs and the most recent 15 selected discussions to deliver the most recent 15 [blog | discussion].

Thanks for the advice.
  13