Project

General

Profile

« Previous | Next » 

Revision 60297

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

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.component.html
1 1
<div page-content class="admin-pages">
2 2
  <div header>
3
    <admin-tabs tab="entity" [portal]="selectedCommunityPid"></admin-tabs>
3
    <admin-tabs tab="entity" [portal]="portal"></admin-tabs>
4 4
    <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
5 5
      <div class="uk-width-1-1">
6 6
        <ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill">
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.component.ts
34 34
  public keyword = '';
35 35
  
36 36
  public communities: Portal[] = [];
37
  public selectedCommunityPid: string;
37
  public portal: string;
38 38
  
39 39
  @ViewChild('AlertModalRelatedPages') alertModalRelatedPages;
40 40
  
......
75 75
      this.applyStatusFilter();
76 76
    }));
77 77
    this.userManagementService.getUserInfo().subscribe(user => {
78
      this.selectedCommunityPid = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
79
      ConnectHelper.setPortalTypeFromPid(this.selectedCommunityPid );
80
      this.applyCommunityFilter(this.selectedCommunityPid);
81
      this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid;
78
      this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
79
      if(this.portal === 'connect' || this.portal === 'explore') {
80
        ConnectHelper.setPortalTypeFromPid(this.portal);
81
      }
82
      this.applyPortalFilter(this.portal);
83
      this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal;
82 84
    });
83 85
    
84 86
    
......
94 96
    });
95 97
  }
96 98
  
97
  getEntities(community_pid: string) {
99
  getEntities(portal: string) {
98 100
    if (!Session.isLoggedIn()) {
99 101
      this._router.navigate(['/user-info'],
100 102
        {queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
......
102 104
      this.showLoading = true;
103 105
      this.updateErrorMessage = '';
104 106
      this.errorMessage = '';
105
      if (community_pid) {
106
        this._helpContentService.getCommunityEntities(community_pid, this.properties.adminToolsAPIURL).subscribe(
107
      if (portal) {
108
        this._helpContentService.getCommunityEntities(portal, this.properties.adminToolsAPIURL).subscribe(
107 109
          entities => {
108 110
            this.entities = entities;
109 111
            this.checkboxes = [];
......
321 323
    this.showLoading = false;
322 324
  }
323 325
  
324
  public applyCommunityFilter(community_pid: string) {
325
    this.getEntities(community_pid);
326
  public applyPortalFilter(portal: string) {
327
    this.getEntities(portal);
326 328
  }
327 329
  
328 330
  public toggleEntities(status: boolean, ids: string[]) {
......
353 355
    } else {
354 356
      this.updateErrorMessage = '';
355 357
      this._helpContentService.toggleEntities(
356
        this.selectedCommunityPid, this.toggleIds, this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
358
        this.portal, this.toggleIds, this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
357 359
        () => {
358 360
          for (let id of this.toggleIds) {
359 361
            const i = this.checkboxes.findIndex(_ => _.entity._id === id);
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/pages.component.html
1 1
<div page-content class="admin-pages">
2 2
  <div header>
3
    <admin-tabs tab="page" [portal]="selectedCommunityPid"></admin-tabs>
3
    <admin-tabs tab="page" [portal]="portal"></admin-tabs>
4 4
    <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
5 5
      <div class="uk-width-1-1">
6 6
        <ul class="uk-subnav uk-subnav-pill">
......
84 84
                    <div class=" uk-margin-small-bottom"><span class="title">Route: </span> {{check.page.route}}</div>
85 85
                    <div *ngIf="!pagesType" class=" uk-margin-small-bottom"><span
86 86
                        class="title">Type: </span> {{check.page.type}}</div>
87
                    <div *ngIf="!selectedCommunityPid" class=" uk-margin-small-bottom">
87
                    <div *ngIf="!portal" class=" uk-margin-small-bottom">
88 88
                      <span class="title">Portal type: </span>{{check.page.portalType}}
89 89
                    </div>
90 90
                  </div>
......
101 101
                    <div class=" uk-margin-small-bottom">
102 102
                      <a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
103 103
                         class="helpContents"
104
                         [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
104
                         [queryParams]="{communityId: portal, pageId: check.page._id}"
105 105
                         routerLink="../../helptexts">
106 106
                        manage help texts
107 107
                      </a>
108 108
                    </div>
109 109
                    <div>
110 110
                      <a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents"
111
                         [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
111
                         [queryParams]="{communityId: portal, pageId: check.page._id}"
112 112
                         routerLink="../../classContents">manage class contents</a>
113 113
                    </div>
114 114
                  </div>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/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