Project

General

Profile

« Previous | Next » 

Revision 60297

[Library | Trunk]: Rename community to portal in pages and entities

View differences:

pages.component.ts
40 40
  private searchText: RegExp = new RegExp('');
41 41
  public keyword: string = '';
42 42

  
43
  public communities: Portal[] = [];
43
  public portal: string;
44 44

  
45
  public selectedCommunityPid: string;
46

  
47 45
  public pagesType: string;
48 46
  public properties: EnvProperties = null;
49 47

  
......
106 104
        // this.pagesType = params['type'];
107 105
        this.filterForm.get('type').setValue(params['type']);
108 106
      }
109
      this.selectedCommunityPid = (this.route.snapshot.data.portal)?this.route.snapshot.data.portal:this.route.snapshot.params[this.route.snapshot.data.param];
110
      ConnectHelper.setPortalTypeFromPid(this.selectedCommunityPid);
107
      this.portal = (this.route.snapshot.data.portal)?this.route.snapshot.data.portal:this.route.snapshot.params[this.route.snapshot.data.param];
108
      if(this.portal === 'connect' || this.portal === 'explore') {
109
        ConnectHelper.setPortalTypeFromPid(this.portal);
110
      }
111 111
      this.keyword = '';
112 112
      this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
113
        this.applyCommunityFilter(this.selectedCommunityPid);
114
        this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid;
113
        this.applyPortalFilter(this.portal);
114
        this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal;
115 115
      }));
116 116
    }));
117 117

  
......
135 135
    });
136 136
  }
137 137

  
138
  getPages(community_pid: string) {
138
  getPages(portal: string) {
139 139
    if (!Session.isLoggedIn()) {
140 140
      this._router.navigate(['/user-info'], {
141 141
        queryParams: {
......
154 154
      if (this.pagesType) {
155 155
        parameters = '?page_type=' + this.pagesType;
156 156
      }
157
      if (community_pid) {
158
        this.subscriptions.push(this._helpContentService.getCommunityPagesByType(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe(
157
      if (portal) {
158
        this.subscriptions.push(this._helpContentService.getCommunityPagesByType(portal, parameters, this.properties.adminToolsAPIURL).subscribe(
159 159
          pages => {
160 160
            this.pagesReturned(pages);
161 161
            //if(!this.pagesType || this.pagesType == "link") {
162
            this.getPagesWithDivIds(community_pid);
162
            this.getPagesWithDivIds(portal);
163 163
            //} else {
164 164
            //this.showLoading = false;
165 165
            //}
......
178 178
    }
179 179
  }
180 180

  
181
  getPagesWithDivIds(community_pid: string) {
181
  getPagesWithDivIds(portal: string) {
182 182
    if (!Session.isLoggedIn()) {
183 183
      this._router.navigate(['/user-info'], {
184 184
        queryParams: {
......
187 187
        }
188 188
      });
189 189
    } else {
190
      this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
190
      this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(portal, this.properties.adminToolsAPIURL).subscribe(
191 191
        pages => {
192 192
          this.pageWithDivIds = pages;
193 193
          this.showLoading = false;
......
208 208
  }
209 209

  
210 210
  /*
211
      getCommunities() {
211
      getPortals() {
212 212
          this._helpContentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
213 213
              communities => {
214 214
                  this.communities = communities;
215
                  this.selectedCommunityPid = this.communities[0].pid;
216
                  this.getPages(this.selectedCommunityPid);
217
                  this.getPagesWithDivIds(this.selectedCommunityPid);
215
                  this.portal = this.communities[0].pid;
216
                  this.getPages(this.portal);
217
                  this.getPagesWithDivIds(this.portal);
218 218
          },
219 219
          error => this.handleError('System error retrieving communities', error));
220 220
      }
......
492 492
    this.showLoading = false;
493 493
  }
494 494

  
495
  // public filterByCommunity(event: any) {
496
  //     this.selectedCommunityPid = event.target.value;
497
  //     this.applyCommunityFilter(this.selectedCommunityPid);
495
  // public filterByPortal(event: any) {
496
  //     this.portal = event.target.value;
497
  //     this.applyPortalFilter(this.portal);
498 498
  // }
499 499

  
500
  public applyCommunityFilter(community_pid: string) {
501
    this.getPages(community_pid);
500
  public applyPortalFilter(portal: string) {
501
    this.getPages(portal);
502 502
  }
503 503

  
504 504
  public togglePages(status: boolean, ids: string[]) {
......
512 512
    } else {
513 513
      this.updateErrorMessage = '';
514 514

  
515
      this.subscriptions.push(this._helpContentService.togglePages(this.selectedCommunityPid, ids, status, this.properties.adminToolsAPIURL).subscribe(
515
      this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status, this.properties.adminToolsAPIURL).subscribe(
516 516
        () => {
517 517
          for (let id of ids) {
518 518
            let i = this.checkboxes.findIndex(_ => _.page._id == id);

Also available in: Unified diff