Custom Domain Items (SKINS)(LANG)

Version 1.49


Custom Domain Items, similar to the Custom Package Items: Create the optional file to enable the feature: /usr/local/directadmin/data/admin/custom_domain_items.conf The format is the same as custom_package_items.conf for type=checkbox|listbox|text But with two added optional values: 1) api_only=yes|no where if you set this to "yes", it will show the value to the User, but will not be a form items. This prevents the User from changing the value by accident, so you can control it with CMD_DOMAIN or CMD_API_DOMAIN. Keep in mind that it does not mean that the User cannot edit it (they can if they really want to), but it's a little more difficult. It basically just prevents accidental errors by Users if you don't want the value to be changed. 2) hidden=yes|no if hidden=yes, then the CUSTOM_ITEM* tokens will not be filled for that item, but you can still set/read them normally with the API. This would be useful if you're saving particular data that isn't visiably User friendly, or you don't want the User to know. Again, they can edit/set it if they want to using the API, but out of sight, out of mind. For both api_only=yes and/or hidden=yes, you *must* use CMD_API_DOMAIN. DA will ignore the items set to api_only=yes or hidden=yes for CMD_DOMAIN calls, to account for the checkbox item that would get shut off anytime the User made a change. Keep in mind that any skin that is not updated with these changes means that if a User saves a domain setting, the checkbox value would be read as OFF, since it's not passed. For the other values, they would use the default values, so be sure to set the defaults if you want them set. DA will not add the values to the when the domain is created, so treat any missing variables as using your default value. Once you or the User saves a change, all variables will be set. To view your values with the API, use CMD_API_ADDITIONAL_DOMAIN with action=view: To set the variables with the API, use CMD_API_DOMAINS, action=modify. *** Make sure to pass *all* variables, not just the ones you want to set. *** For example, if you don't include php=ON, then you'll end up turning off PHP when you save your custom item. So you'd need to first read the settings with CMD_API_ADDITIONAL_DOMAIN action=view so you know what to return to DA. DA does some very basic User sanitation, but use if you want to make sure the values passed are what you're expecting. Abort with a non-zero exit code and echo some text. And use for any triggers you need, the variables should be passed via environment to both the pre/ scripts. ================================= SKINS user/modify_domain.html user/add_domain.html add extra tokens for custom items. Also changed the table to be 3 columns wide, rather than 2. |*if CUSTOM_ITEM_1| <tr><td class=list2>|CUSTOM_ITEM_1_STR|</td> <td class=list2 align=center>|CUSTOM_ITEM_1|</td><td class=list2>|CUSTOM_ITEM_1_DESC|</td></tr> |*endif| |*if CUSTOM_ITEM_2| <tr><td class=list>|CUSTOM_ITEM_2_STR|</td> <td class=list align=center>|CUSTOM_ITEM_2|</td><td class=list>|CUSTOM_ITEM_2_DESC|</td></tr> |*endif| etc... we included 5 entries, but the custom_domain_items.conf does allow up to 99. If you actually want to do it dynamically, consider using the |$/usr/local/bin/php method to generate each tr on the fly in a loop, rather than having to check for each one manually. ================================= LANG lang/en/internal/domain.txt 37=Enabled 38=Disabled

Interested to try DirectAdmin? Get a 30-day Free Trial!