Beispiel #1
0
    def __load_form_by_sid(cls, form_sid, checksum=''):
        iface = Client.get_interface('FABLIK_BASE')
        inputVar = iface.create_variable('RequestGetForm')

        inputVar.session_id = Config.getSessionID()
        inputVar.form_sid = form_sid
        inputVar.checksum = checksum

        result = iface.call('getForm', inputVar)

        if result.ret_code != 0:
            raise Exception(result.ret_message)

        if result.form_source:
            print 'cache is not found or not valid. Creating...'
            form_source = base64.decodestring(result.form_source)
            f = open(os.path.join(cls.__cache_dir, '%s.ffc'%(form_sid)), 'wb')
            f.write(form_source)
            f.close()

        return result.form_permission
Beispiel #2
0
    def onInit(self, **kparams):
        self.setupForm(Ui_departments)

        self.mgt_interface = Client.get_interface('FABLIK_MGT')

        self.syncTree()

        self._widgets.departmentsTree.setColumnWidth(0, 250)
        self._widgets.departmentsTree.setColumnWidth(1, 150)

        self.disable_edits()

        self._widgets.allRolesList.clear()
        self.all_roles = Query.select('GET_ROLES')
        for role in self.all_roles:
            self._widgets.allRolesList.addItem(role['sid'])

        #connect signals
        self._widgets.newDepBtn.clicked.connect(self.onCreateNewDepartment)
        self._widgets.newSubDepBtn.clicked.connect(self.onCreateSubDepartment)
        self._widgets.remDepBtn.clicked.connect(self.onRemoveDepartment)
        self._widgets.applyBtn.clicked.connect(self.onApplyDepartment)

        self._widgets.departmentsTree.itemSelectionChanged.connect(self.fill_edits)
Beispiel #3
0
            f = open(self.__menu_cache_file, 'rb')
            self.__menu = pickle.load(f)
        except Exception,e:
            LogManager.info('Menu cache %s is not loaded. Details: %s' %(self.__menu_cache_file,e))
        finally:
            if f is not None:
                f.close()

        self.__menu.sort(cmp=my_cmp)
        md5 = hashlib.md5()
        for item in self.__menu:
            item.update_checksum(md5)

        menu_checksum = md5.hexdigest()

        iface = Client.get_interface('FABLIK_BASE')
        inputVar = iface.create_variable('RequestGetMainMenu')

        inputVar.session_id = Config.getSessionID()
        inputVar.checksum = menu_checksum
        inputVar.lang_sid = Config.getLangSid()

        result = iface.call('getMainMenu', inputVar)

        if result.ret_code != 0:
            raise Exception(result.ret_message)

        if len(result.menu_list) == 0:
            LogManager.info('Menu cache is valid. Use it')
            return