def user_settings(self):
    "Displays the user settings dialog"
    settings = context.user.settings
    taskbar_pos = settings.value.setdefault('TASK_BAR_POS', 'bottom')

    params = {'TASK_BAR_POS': taskbar_pos}

    if taskbar_pos == 'bottom':
        params['CHECKED_TOP'] = 'false'
        params['CHECKED_BOTTOM'] = 'true'
    else:
        params['CHECKED_TOP'] = 'true'
        params['CHECKED_BOTTOM'] = 'false'

    autoRun = settings.value.get('AUTO_RUN', '')

    if settings.value.get('RUN_MAXIMIZED', False):
        params['RUN_MAXIMIZED_VALUE'] = 'true'
    else:
        params['RUN_MAXIMIZED_VALUE'] = 'false'

    # get applications
    sOql = ("select displayName, launchUrl, icon," +
            "(if launchUrl = $L then 'true' else '') as selected " +
            "from 'apps' order by displayName asc")
    params['APPS'] = command.execute(sOql, {'L': autoRun})

    params['AUTO_RUN_NONE'] = ''
    if autoRun == '':
        params['AUTO_RUN_NONE'] = 'true'

    return params
def __blank__(self):
    "Displays the desktop"
    oUser = context.user
    params = {
        'USER': oUser.displayName.value,
        'ROOT_NAME': self.displayName.value,
        'AUTO_RUN': '',
        'RUN_MAXIMIZED': 0,
        'SETTINGS_DISABLED': '',
        'LOGOFF_DISABLED': ''}
    if hasattr(oUser, 'authenticate'):
        settings = oUser.settings
        params['AUTO_RUN'] = \
            settings.value.setdefault('AUTO_RUN', '')
        params['RUN_MAXIMIZED'] = \
            int(settings.value.setdefault('RUN_MAXIMIZED', False))
        taskbar_position = \
            settings.value.get('TASK_BAR_POS', 'bottom')
    else:
        taskbar_position = 'bottom'
        params['SETTINGS_DISABLED'] = 'true'
        params['LOGOFF_DISABLED'] = 'true'

    params['REPOSITORY_DISABLED'] = 'true'
    params['PERSONAL_FOLDER'] = ''
    if hasattr(oUser, 'personalFolder'):
        params['REPOSITORY_DISABLED'] = 'false'
        params['PERSONAL_FOLDER'] = oUser.personalFolder.value

    # has the user access to recycle bin?
    rb = db.get_item('rb')
    if rb:
        params['RB_NAME'] = rb.displayName.value
    else:
        params['RB_NAME'] = None

    params['BOTTOM'] = taskbar_position == 'bottom'

    # get applications
    sOql = "select launchUrl, displayName, icon from 'apps' " + \
           "order by displayName asc"
    params['APPS'] = command.execute(sOql)

    return params
def selectobjects(self):
    "Displays the select objects dialog"
    sCC = context.request.queryString['cc'][0]
    params = {'ID': self.id or '/',
              'IMG': self.__image__,
              'DN': self.displayName.value,
              'HAS_SUBFOLDERS': str(self.has_subfolders()).lower(),
              'MULTIPLE': context.request.queryString['multiple'][0],
              'CC': sCC}

    sOql = "select * from $SCOPE"
    if sCC != '*':
        ccs = sCC.split('|')
        ccs = ["instanceof('%s')" % x for x in ccs]
        sConditions = " or ".join(ccs)
        sOql += " where %s" % sConditions
    oRes = command.execute(sOql, {'SCOPE': self.id})

    sOptions = ''
    for obj in oRes:
        sOptions += '<option img="%s" value="%s" caption="%s"/>' % (
                    obj.__image__, obj.id, obj.displayName.value)
    params['OPTIONS'] = sOptions
    return params
def executeOqlCommand(self, cmd, vars={}):
    return command.execute(cmd, vars)
Esempio n. 5
0
def executeOqlCommand(self, cmd, vars={}, range=None):
    res = command.execute(cmd, vars)
    if range is None:
        return res
    else:
        return [res[range[0]:range[1]], len(res)]