コード例 #1
0
ファイル: PartChooser.py プロジェクト: manolodd/activae
    def __init__ (self, props={}):
        user_id   = Auth.get_user_id()
        bookmarks = Bookmark.get_user_bookmarks (user_id)
        options   = [('','--')]+[(b,'#%s'%b) for b in bookmarks]
        props['selected'] = ''
        renders = self._render_options (bookmarks)

        ComboTextField.__init__ (self, props, options, renders)
コード例 #2
0
ファイル: PartChooser.py プロジェクト: manolodd/activae
    def __init__(self, props={}):
        user_id = Auth.get_user_id()
        bookmarks = Bookmark.get_user_bookmarks(user_id)
        options = [('', '--')] + [(b, '#%s' % b) for b in bookmarks]
        props['selected'] = ''
        renders = self._render_options(bookmarks)

        ComboTextField.__init__(self, props, options, renders)
コード例 #3
0
 def collect_child(child):
   newPath = getPath(parent) + '/' + Bookmark.getTitle(child)
   child_folder = {
     'depth': getDepth(parent) + 1,
     'path': newPath
   }
   children = collect_list(child_folder, child)
   outlist.extend(children)
コード例 #4
0
ファイル: WidgetConsume.py プロジェクト: manolodd/activae
    def _get_bookmark_link (self, asset_id):
        bookmark = (asset_id, Auth.get_user_id())
        ref   = urllib.unquote_plus(CTK.request.url)
        flag  = Bookmark.bookmark_exists (bookmark)
        table = CTK.Table ()
        table [(1,1)] = CTK.RawHTML('Favorito')
        table [(1,2)] = CTK.Checkbox({'name': 'bookmark', 'checked': flag})

        submit = '/bookmark/%s;%s' % (asset_id, ref)
        form   = CTK.Submitter (submit)
        form  += table
        return form
コード例 #5
0
def collect_list(parent, current):
  # このフォルダのパスと子供一覧をリストに追加
  children = Bookmark.gatherUrlOrHash(current)
  folder = {
    'depth': getDepth(parent),
    'path': getPath(parent),
    'children': children
  }
  outlist = [folder]
  # 子フォルダから再帰的にパスと子供一覧を集める
  child_list = filter(Bookmark.isFolder, Bookmark.getChildren(current))
  def collect_child(child):
    newPath = getPath(parent) + '/' + Bookmark.getTitle(child)
    child_folder = {
      'depth': getDepth(parent) + 1,
      'path': newPath
    }
    children = collect_list(child_folder, child)
    outlist.extend(children)
  map(collect_child, child_list)
  return outlist
コード例 #6
0
def main():
  print 'loading bookmarks'
  sys.stdout.flush()
  bookmarks = Bookmark.loadBookmarks()
  print 'collecting bookmarks'
  sys.stdout.flush()
  folders = Folder.collect(bookmarks)
  print 'found folders: ' + str(len(folders))
  print 'find duplication'
  sys.stdout.flush()
  duplicates = findDuplicator.collect_duplicates(folders, list(folders))
  print
  sys.stdout.flush()
  selectDuplicates.select_duplicate(duplicates)