예제 #1
0
파일: myagol.go 프로젝트: keyurva/agoltools
func getMyAGOL(r *agoltools.Request) (err error) {
	r.Data["PageTitle"] = "Get My ArcGIS Online Information"

	f := strings.ToLower(strings.Trim(r.R.FormValue("f"), " "))
	if f == "" {
		return r.RenderUsingBaseTemplate(getOrgUsersTemplate)
	}

	myagol, err := agolclient.GetMyAGOL(r.Transport(), r.Auth)
	if err != nil {
		return err
	}

	r.Data["PageTitle"] = "My ArcGIS Online Information"

	r.Data["MyAGOL"] = myagol

	orgUrlKey := ""
	if myagol.Org != nil {
		orgUrlKey = myagol.Org.UrlKey
	}
	r.Data["PortalHomeUrl"] = config.PortalHomeUrl(orgUrlKey)

	// panel dropdown and ids
	pdropdown := []string{}
	pids := map[string]string{} //[display name]id

	addPanel := func(condition bool, name, id string) {
		if condition {
			pdropdown = append(pdropdown, name)
			pids[name] = id
		}
	}

	addPanel(myagol.User != nil, "User Info", "user-panel")
	addPanel(myagol.Folders != nil, "My Content", "content-panel")
	addPanel(myagol.User != nil && myagol.User.Groups != nil, "My Groups", "groups-panel")
	addPanel(myagol.Org != nil, "Organization Info", "org-panel")
	addPanel(myagol.Subscription != nil, "Subscription Info", "sub-panel")

	if len(pdropdown) > 1 {
		r.Data["PanelDropdown"] = pdropdown
		r.Data["PanelIds"] = pids
	}

	return r.RenderUsingBaseTemplate(orgUsersTemplate)
}
예제 #2
0
func (r *Request) PortalHomeUrl() string {
	return config.PortalHomeUrl(r.OrgUrlKey())
}