Changing default categories for WebApp



  • Hi,

    I want to change the default categories for WebApp serverwide and didn’t find the defaults.php, where this should / could be done.
    I’m using Kopano on UCS and wanted to know, if I could just copy the defaults.php from github to /etc/kopano/webapp/ and edit it afterwards for changing the categories or if there is another way to do this.

    Thanks in advanced,
    Christian.


  • Kopano

    Hi @onex-de

    You should add it to your config,

    for example:

            define('DEFAULT_CATEGORIES', json_encode(array(
            array(
                    'name' => _('NumberOne'),
                    'color' => '#e40023',
                    'standardIndex' => 6,
                    'quickAccess' => true,
                    'sortIndex' => 0,
                    'used' => false
            ),
            array(
                    'name' => _('Number2'),
                    'color' => '#f99406',
                    'standardIndex' => 2,
                    'quickAccess' => true,
                    'sortIndex' => 1,
                    'used' => false
            )
            )));
    

    But it probably won’t work if you already wrote categories in the persistent settings, so if you have used them before



  • @marty said in Changing default categories for WebApp:

    But it probably won’t work if you already wrote categories in the persistent settings, so if you have used them before

    Thanks … how can I check if there are some already?
    Is it possible, to delete/reset them?

    Christian.


  • Kopano

    @onex-de Not that trivial, but you could remove it from the persistent settings via python-kopano.
    The property is PR_EC_WEBAPP_PERSISTENT_SETTINGS_JSON



  • @marty cool, do you have an example, because I don’t know, what you mean with the JSON thing, mentioned above.


  • Kopano

    something like this (untested)

    import kopano
    from MAPI.Util import *
    import sys
    
    # Define the persistent setting property
    PR_EC_WEBAPP_PERSISTENT_SETTINGS_JSON = PROP_TAG(PT_STRING8, PR_EC_BASE+0x74)
    
    parser = kopano.parser('skp')
    parser.add_option("-u", dest="user", action="store", help="Username")
    parser.add_option("-d", dest="delete", action='store_true', help="delete persistent setting")
    parser, args = parser.parse_args()
    
    server = kopano.Server(parser)
    
    if parser.user:
        user = server.user(parser.user)
        # Define the prop in users store
        try:
            prop = user.store.prop(PR_EC_WEBAPP_PERSISTENT_SETTINGS_JSON)
        except Exception:
            print "Property does not exist in store"
            sys.exit()
    
    if parser.delete:
        try:
            # Delete the persistent setting property
            user.store.delete(prop)
            print "Property deleted"
        except Exception:
            print "Property does not exist in your store"
            sys.exit()
    

Log in to reply