The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UserSpice 5.0 Roadmap as of 9/11/2016
#5
As you move more Config items to the DB, you may have already thought of these items, but they were churning in my brain this am and I thought I'd throw 'em down somewhere:
  • Having a multi-row config table rather than a single-row table with multi-columns allows adding new config items much more easily. And if they don't exist then code can provide an appropriate default.
    Code:
    $myValue = Config::get('myValue') : ? 'something';
    (Note in my pseudo-code below I just allowed an optional 2nd arg to Config::get() for the source-supplied default.)
  • It would be nice if the primary/system config table drove the HTML form as a dynamically created form. Perhaps storing HTML snippets in the DB, perhaps having a separate config_choices table, perhaps a few columns which designate how to present this to the user, etc.
  • One of those columns in the primary/system config would include whether users can override that pair. Then those overridable items could be presented (dynamically) in the profile editing section.

config
------
id
key varchar(100) # Life will be a lot easier for the developer if this replaces the usual id, but it's kind of non-standard to do it that way. Renaming the key in the future also becomes a bear. Probably better to keep with the standards
value varchar(500)
html_input_type defined(checkbox,radio,select,text,number,etc) # dynamically create the form from this (plus config_choices)
html_snippet varchar(2048) # This overrides html_input_type and config_choices
allow_user_override boolean

config_user
-------
id
user_id
config_id
key # proper db normalizing says no - probably stick with just config_id
value

config_choices
-------
id
config_id
sequence
value
label

Config::get($key, $final_default=false)
-----
Check in config_user if config.allow_user_override
Check in config
Check in Init.php $Config # if this still exists (probably makes sense to keep it for developer options rather than admin options)
return $final_default

Config::make_input_snippet(config_id)
-------
if config.html_snippet exists
return it
case config.html_input_type
'text': return "<input type='text' name='$key' value='$value' />"
'radio': query config_choices and loop through appending options
'select': query config_choices and loop through appending options
'checkbox': get the label from a single row in config_choices
etc
  Reply


Messages In This Thread
UserSpice 5.0 Roadmap as of 9/11/2016 - by mudmin - 09-11-2016, 06:47 PM
UserSpice 5.0 Roadmap as of 9/11/2016 - by mudmin - 09-11-2016, 08:37 PM
UserSpice 5.0 Roadmap as of 9/11/2016 - by mudmin - 09-11-2016, 08:39 PM
UserSpice 5.0 Roadmap as of 9/11/2016 - by plb - 09-20-2016, 04:18 AM
UserSpice 5.0 Roadmap as of 9/11/2016 - by brian - 09-20-2016, 12:12 PM
UserSpice 5.0 Roadmap as of 9/11/2016 - by plb - 10-05-2016, 11:17 AM
UserSpice 5.0 Roadmap as of 9/11/2016 - by brian - 10-05-2016, 11:21 AM
UserSpice 5.0 Roadmap as of 9/11/2016 - by plb - 10-06-2016, 04:17 AM
UserSpice 5.0 Roadmap as of 9/11/2016 - by brian - 10-06-2016, 01:22 PM
UserSpice 5.0 Roadmap as of 9/11/2016 - by mudmin - 10-06-2016, 01:45 PM
UserSpice 5.0 Roadmap as of 9/11/2016 - by plb - 10-06-2016, 06:34 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)