def __call__(self):

        request = current.request
        response = current.response

        view = path.join(request.folder, "modules", "templates",
                         THEME, "views", "index.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP(404, "Unable to open Custom View: %s" % view)

        # Show full width instead of login box if user is logged in
        if current.auth.is_logged_in():
            grid = "grid_12"
        else:
            grid = "grid_8"

        latest_projects = DIV(_id="front-latest-body",
                              _class="%s alpha" % grid)
        lappend = latest_projects.append

        db = current.db
        s3db = current.s3db
        table = s3db.project_project
        table_drrpp = s3db.project_drrpp
        query = (table.deleted != True) & \
                (table.approved_by != None)
        rows = db(query).select(table.id,
                                table.name,
                                table_drrpp.activities,
                                table.organisation_id,
                                table.start_date,
                                left=table_drrpp.on(table.id == table_drrpp.project_id),
                                limitby=(0, 3))
        project_ids = [r.project_project.id for r in rows]
        ltable = s3db.project_location
        gtable = s3db.gis_location
        query = (ltable.deleted != True) & \
                (ltable.project_id == table.id) & \
                (gtable.id == ltable.location_id) & \
                (gtable.level == "L0")
        locations = db(query).select(ltable.project_id,
                                     gtable.L0)
        odd = True
        for row in rows:
            countries = [l.gis_location.L0 for l in locations if l.project_location.project_id == row.project_project.id]
            location = ", ".join(countries)
            if odd:
                _class = "front-latest-item odd %s alpha" % grid
            else:
                _class = "front-latest-item even %s alpha" % grid
            card = DIV(DIV(A(row.project_project.name,
                             _href=URL(c="project", f="project", args=[row.project_project.id])),
                           _class="front-latest-title %s"  % grid,
                           ),

                       DIV("Lead Organization: %s" % s3db.org_organisation_represent(row.project_project.organisation_id),
                                _class="front-latest-desc %s" % grid,
                           ),
                       DIV(SPAN("Start Date: %s" % row.project_project.start_date,
                                _class="front-latest-info-date"),
                           SPAN("Countries: %s" % location,
                                _class="front-latest-info-location"),
                           _class="front-latest-info %s" % grid,
                           ),
                       DIV(row.project_drrpp.activities or "",
                           _class="front-latest-desc %s"  % grid,
                           ),
                       _class=_class,
                       )
            lappend(card)
            odd = False if odd else True

        login = current.auth.login(inline=True)

        appname = request.application
        s3 = response.s3
        if current.session.s3.debug:
            s3.scripts.append("/%s/static/themes/DRRPP/js/slides.jquery.js" % appname)
        else:
            s3.scripts.append("/%s/static/themes/DRRPP/js/slides.min.jquery.js" % appname)
        s3.jquery_ready.append('''
$('#slides').slides({
 play:8000,
 animationStart:function(current){
  $('.caption').animate({
   bottom:-35
  },100);
 },
 animationComplete:function(current){
  $('.caption').animate({
   bottom:0
  },200);
 },
 slidesLoaded:function() {
  $('.caption').animate({
   bottom:0
  },200);
 }
})''')

        return dict(title = "Home",
                    form = login,
                    latest_projects = latest_projects,
                    )

# =============================================================================
dataset/ETHPy150Open sahana/eden/modules/templates/DRRPP/controllers.py/index.__call__/original