当前位置: 首页>>代码示例>>Python>>正文


Python Project.getAllSorted方法代码示例

本文整理汇总了Python中Project.Project.getAllSorted方法的典型用法代码示例。如果您正苦于以下问题:Python Project.getAllSorted方法的具体用法?Python Project.getAllSorted怎么用?Python Project.getAllSorted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project.Project的用法示例。


在下文中一共展示了Project.getAllSorted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: adminProjects

# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import getAllSorted [as 别名]
def adminProjects(handler):
	handler.title('Project Management')
	requirePriv(handler, 'Admin')

	print "<style type=\"text/css\">"
	print "table.list td.right > * {width: 400px;}"
	print "table.list td.right button {width: 200px;}" # Half of the above value
	print "</style>"

	undelay(handler)

	print "<h3>New Project</h3>"
	print "<form method=\"post\" action=\"/admin/projects\">"
	print "<table class=\"list\">"
	print "<tr><td class=\"left\">Name:</td><td class=\"right\"><input type=\"text\" name=\"name\"></td></tr>"
	print "<tr><td class=\"left\">&nbsp;</td><td class=\"right\">"
	print Button('Save', id = 'save-button', type = 'submit').positive()
	print Button('Cancel', type = 'button', url = '/admin').negative()
	print "</td></tr>"
	print "</table>"
	print "</form>"

	print "<h3>Current Projects</h3>"
	for project in Project.getAllSorted(handler.session['user']):
		print "<a href=\"/admin/projects/%d\">%s</a><br>" % (project.id, project.safe.name)
开发者ID:mrozekma,项目名称:Sprint,代码行数:27,代码来源:admin.py

示例2: newTaskImport

# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import getAllSorted [as 别名]
def newTaskImport(handler, group, source=None, assigned=None):
    # 'assigned' is ignored, it's just in case the user gets here from a filtered backlog
    handler.title("New Tasks")
    requirePriv(handler, "User")
    id = int(group)

    print tabs.format(id).where("import")

    group = Group.load(id)
    if not group or group.sprint.isHidden(handler.session["user"]):
        ErrorBox.die("Invalid Group", "No group with ID <b>%d</b>" % id)

    sprint = group.sprint
    if not (sprint.isActive() or sprint.isPlanning()):
        ErrorBox.die("Sprint Closed", "Unable to modify inactive sprint")
    elif not sprint.canEdit(handler.session["user"]):
        ErrorBox.die("Permission Denied", "You don't have permission to modify this sprint")

    sprints = sprint.project.getSprints()
    sprintIdx = sprints.index(sprint)
    prevSprint = sprints[sprintIdx - 1] if sprintIdx > 0 else None

    if not source:
        print "Select a sprint to import from:<br><br>"
        print '<form method="get" action="/tasks/new/import">'
        print '<input type="hidden" name="group" value="%d">' % group.id
        print '<select name="source" id="import-source">'
        for projectIter in Project.getAllSorted(handler.session["user"], sprint.project):
            print '<optgroup label="%s">' % projectIter.safe.name
            for sprintIter in projectIter.getSprints():
                print '<option value="%d"%s>%s</option>' % (
                    sprintIter.id,
                    " selected" if sprintIter == prevSprint else "",
                    sprintIter.safe.name,
                )
            print "</optgroup>"
        print "</select>"
        print "<br><br>"
        print Button("Next").positive().post()
        print "</form>"
    else:
        id = int(source)
        source = Sprint.load(id)
        if not source:
            ErrorBox.die("Invalid Sprint", "No sprint with ID <b>%d</b>" % id)

        print '<script type="text/javascript">'
        nextURL = "/sprints/%d" % sprint.id
        if assigned:
            nextURL += "?search=assigned:%s" % stripTags(assigned.replace(" ", ","))
        print "next_url = %s;" % toJS(nextURL)
        print 'post_url = "/tasks/new/import?group=%d&source=%d";' % (group.id, source.id)
        print "scrummaster = %s;" % toJS(sprint.owner.username)
        print "TaskTable.init();"
        print "</script>"

        print '<b>Source sprint</b>: <a href="/sprints/%d">%s</a><br>' % (source.id, source.name)
        print '<b>Target sprint</b>: <a href="/sprints/%d">%s</a><br><br>' % (sprint.id, sprint.name)
        print "All incomplete tasks are listed here, with their current values from the source sprint. You can change any of the fields before importing. Only checked tasks will be imported<br><br>"

        assignedList = [sprint.owner] + list(sprint.members - {sprint.owner})
        print TaskTable(
            source,
            editable=True,
            assignedList=assignedList,
            checkbox=True,
            status=True,
            name=True,
            assigned=True,
            hours=True,
            debug=isDevMode(handler),
        )

        print InfoBox("Loading...", id="post-status", close=True)
        print Button("Import", id="save-button", type="button").positive()
        print Button("Cancel", id="cancel-button", type="button").negative()
        print "</form><br><br>"
开发者ID:nolandda,项目名称:Sprint,代码行数:79,代码来源:tasks.py

示例3: projectsList

# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import getAllSorted [as 别名]
def projectsList(handler):
    undelay(handler)

    print '<div class="project-list">'
    print '<div class="buttons">'
    print Button("Calendar", "/projects/calendar")
    print "</div>"
    for project in Project.getAllSorted(handler.session["user"]):
        sprints = filter(lambda sprint: not sprint.isHidden(handler.session["user"]), project.getSprints())
        active, inactive = partition(lambda sprint: sprint.isActive() or sprint.isPlanning(), reversed(sprints))
        activeMembers = set()
        for sprint in active:
            activeMembers |= sprint.members
        isTest = project.id < 0

        classes = ["project-summary"]
        if len(active) > 0:
            classes.append("active")
        if isTest:
            classes.append("test")
        print '<div id="project-summary-%d" class="%s">' % (project.id, " ".join(classes))
        print '<div class="project-name">%s</div>' % project.name
        print '<div class="buttons">'
        print Button("new sprint", "/sprints/new?project=%d" % project.id).mini()
        print Button("export", "/sprints/export?project=%d" % project.id).mini()
        print Button("active", "/sprints/active?project=%d" % project.id).mini()
        if handler.session["user"] and handler.session["user"].hasPrivilege("Admin"):
            print Button("manage", "/admin/projects/%d" % project.id).mini().negative()
        print "</div>"

        print '<div class="project-members %s">' % ("short" if len(inactive) <= 6 or len(active) == 0 else "long")
        members = set(project.getMembers())
        scrummasters = set(sprint.owner for sprint in active)
        for member in sorted(scrummasters):
            print '<div class="member scrummaster">%s</div>' % member.str("scrummaster")
        for member in sorted(activeMembers - scrummasters):
            print '<div class="member active">%s</div>' % member.str("member")
        for member in sorted(members - activeMembers - scrummasters):
            print '<div class="member inactive">%s</div>' % member.str("member")
        print "</div>"

        if sprints:

            def printSprint(sprint):
                if sprint.isActive() or sprint.isPlanning():
                    print '<div class="sprint-active">'
                    print '<div class="sprint-name">%s</div>' % sprint.link(handler.session["user"], "sprint-large")
                    print '<div class="sprint-time">'
                    if sprint.isPlanning():
                        print '<span class="label danger">Planning</span>'
                    elif sprint.isReview():
                        print '<span class="label success">Review</span>'
                    else:
                        day = Weekday.today().date()
                        sprintDays = [i.date() for i in sprint.getDays()]
                        print '<span class="label primary">Day %d of %d</span>' % (
                            sprintDays.index(day) + 1,
                            len(sprintDays),
                        )
                    print "</div><br>"
                    for tab in sprintTabs().group("").values():
                        print '<a href="%s">%s</a>' % (tab.getPath(sprint.id), tab.getDisplayName().lower())
                    if handler.session["user"] in sprint.members:
                        print '<a href="/sprints/%d?search=assigned:me">your tasks</a>' % sprint.id
                    print "</div>"
                else:
                    print '<div class="sprint-summary">%s <span class="sprint-time">(%s - %s)</span></div>' % (
                        sprint.link(handler.session["user"]),
                        sprint.getStartStr(),
                        sprint.getEndStr(),
                    )

            print '<div class="sprint-summaries">'
            map(printSprint, active)
            if len(inactive) <= 6:
                map(printSprint, inactive)
            else:
                map(printSprint, inactive[:5])
                print '<div class="show-old-sprints">(%d more)</div>' % (len(inactive) - 5)
                print '<div class="old-sprints">'
                map(printSprint, inactive[5:])
                print "</div>"
            print "</div>"
        else:
            print "&nbsp;"

        print '<div class="clear"></div>'
        print "</div>"
    print "</div>"
开发者ID:nolandda,项目名称:Sprint,代码行数:91,代码来源:projects.py


注:本文中的Project.Project.getAllSorted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。