# # Collective Knowledge (index of CK modules) # # # # # Developer: # cfg={} # Will be updated by CK (meta description of this module) work={} # Will be updated by CK (temporal data) ck=None # Will be updated by CK (initialized CK kernel) # Local settings ############################################################################## # Initialize module def init(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ return {'return':0} ############################################################################## # add index def add_index(i): """ Input: { dict - index dict meta - original CK entry meta } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ import copy d=i['dict'] m=i['meta'] repo_url1_full=d['misc'].get('repo_url1','') data_uoa=d['misc'].get('data_uoa','') data_uid=d['misc'].get('data_uid','') module_uoa=d['misc'].get('module_uoa','') module_uid=d['misc'].get('module_uid','') xworkflow=m.get('workflow','') workflow=m.get('workflow_type','') if xworkflow=='yes' and workflow=='': workflow='yes' d['misc']['workflow']=workflow d['misc']['actions']={} actions=m.get('actions',{}) if len(actions)>0: for q in sorted(actions): qq=actions[q] d['misc']['actions'][q]={} if repo_url1_full!='': # Get API! l=-1 rx=ck.get_api({'module_uoa':data_uid, 'func':q}) if rx['return']==0: l=rx['line'] if l!=-1: d['misc']['actions'][q]['url_api']=repo_url1_full+'#L'+str(l) return {'return':0} ############################################################################## # generate html def html(i): """ Input: { (skip_cid_predix) - if 'yes', skip "?cid=" prefix when creating URLs } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ d=i.get('dict',{}) scp=i.get('skip_cid_prefix','') bscp=(scp=="yes") llm=d.get('meta',{}) llmisc=llm.get('misc',{}) lldict=llm.get('dict',{}) workflow=llmisc.get('workflow','') repo_url1=llmisc.get('repo_url1','') repo_url2=llmisc.get('repo_url2','') desc=lldict.get('desc','') duoa=llmisc.get('data_uoa','') duid=llmisc.get('data_uid','') ruoa=llmisc.get('repo_uoa','') ruid=llmisc.get('repo_uid','') muoa=llmisc.get('module_uoa','') h='' if desc!='': h+=' - '+desc+'\n' actions1=lldict.get('actions',{}) actions2=llmisc.get('actions',{}) h+='