2 ProjectSpecificPrefs
Vitalii Koshura edited this page 2023-04-02 04:59:24 +02:00

Project-specific preferences

You can provide users with a set of project-specific preferences, controlled via a web interface. These preferences are stored in XML, in a field of the user table. The code related to project-specific preferences is in html/project/project_specific_prefs.inc. When you create your project, this is initialized to sample code.

The sample code contains a number of preferences that you can enable by setting the corresponding constant to true in your html/project/project.inc:

  • APP_SELECT_PREFS: Application selection: users can select which of your applications they will be sent work for.
  • MAX_JOBS_PREFS: users can limit the number of this project's jobs in progress
  • MAX_CPUS_PREFS: users can limit the number of CPUs used by this project.
  • NON_GRAPHICAL_PREF: users can choose to run non-graphical versions of apps if available.
  • COLOR_PREFS: let the user select a color scheme for your application graphics. (On the client, the XML is passed to your applications in the APP_INIT_DATA structure; your graphics app can parse this and changes it colors accordingly).
  • GFX_CPU_PREFS: the user can limit the % of CPU used by the graphics app.

To create your own project-specific preferences, edit this file (and keep it under version control somewhere). The functions you must supply are:

  • project_specific_prefs_default()
  • project_specific_prefs_edit()
  • project_specific_prefs_parse_form()
  • project_specific_prefs_show()
  • project_specific_prefs_parse()

The sample code provides a working example.