Hide field on edit site

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member II

Hide field on edit site

I'm trying to hide some fields on create and edit site and I got success in my modification for create-site dialog, however for edit-site dialog, nothing happened and I don't know why.

In the below code, I'm removing the options "Public" and "Moderated" of visibility field.
 

I'm using alfresco community 201704.

 

Following my share-header.get.js

 

var siteService = widgetUtils.findObject(model.jsonModel, "id", "SITE_SERVICE");
if (siteService && siteService.config) {
   siteService.config.widgetsForCreateSiteDialogOverrides = [{
      id: "CREATE_SITE_FIELD_PRESET",
      replace: true,
      name: "alfresco/forms/controls/Select",
      config: {
         fieldId: "PRESET",
         label: "create-site.dialog.type.label",
         name: "sitePreset",
         optionsConfig: {
            fixed: "{sitePresets}"
         },
         visibilityConfig: {
            initialValue: false
         }
      }
   },{
      id: "CREATE_SITE_FIELD_VISIBILITY",
      replace: true,
      name: "alfresco/forms/controls/RadioButtons",
      config: {
         fieldId: "VISIBILITY",
         label: "create-site.dialog.visibility.label",
         name: "visibility",
         optionsConfig: {
            fixed: [{
               label: "create-site.dialog.visibility.private",
               description: "create-site.dialog.visibility.private.description",
               value: "PRIVATE"
            }]
         },
         visibilityConfig: {
            initialValue: false
         }
      }
   }];

   siteService.config.widgetsForEditSiteDialogOverrides = [{
      id: "EDIT_SITE_FIELD_VISIBILITY",
      replace: true,
      name: "alfresco/forms/controls/RadioButtons",
      config: {
         fieldId: "VISIBILITY",
         label: "VISIBIITY",
         name: "visibility",
         optionsConfig: {
            fixed: [{
               label: "create-site.dialog.visibility.private",
               description: "create-site.dialog.visibility.private.description",
               value: "PRIVATE"
            }]
         }
      }
   }];
}

Regards,

Luís Camargo

5 Replies
Master

Re: Hide field on edit site

How did you apply your customisation? Does the Surf extension module have some evaluator to determine when it should be applied? Did you apply the Surf extension module to both regular Share pages as well as Aikau-based pages? Which version of Aikau are you using?

Active Member II

Re: Hide field on edit site

Thanks for answer Axel Faust‌.

We are upgrading the Alfresco from 5.0.d to 5.2 201704 and for a while, we will use an old solution and configure the legacyMode.
I'm sure there a lot of configs missing and I have to learn and check everything.

Thank you very much for help.

Member II

Re: Hide field on edit site

HI,

I'm facing the same issue and even after upgraded from 5.0 to 5.2.

I have done the configs changes also but no success. Nothing got display for Edit site dialog.

Can you please let me know if you get the solution of the above issue?

Thanks a ton,
Simant

Active Member II

Re: Hide field on edit site

Sorry for late replay.

I'm still using the legacyMode. So far it has been enough for me.

Regards,

Luis

Member II

Re: Hide field on edit site

Hi, I have the same issue.

My solution : reset complelely the widgetsForEditSiteDialog and remove the elements you want (I have removed the Moderate option):

 

     siteService.config.widgetsForEditSiteDialog = [
               {
                    id : "EDIT_SITE_FIELD_TITLE",
                    name : "alfresco/forms/controls/TextBox",
                    config : {
                         fieldId : "TITLE",
                         label : "create-site.dialog.name.label",
                         name : "title",
                         requirementConfig : {
                              initialValue : true
                         },
                         validationConfig : [ {
                              validation : "maxLength",
                              length : 256,
                              errorMessage : "create-site.dialog.name.maxLength"
                         }, {
                              scopeValidation : true,
                              warnOnly : true,
                              validation : "validationTopic",
                              validationTopic : "ALF_VALIDATE_SITE_IDENTIFIER",
                              validationValueProperty : "title",
                              negate : true,
                              validateInitialValue : false,
                              validationResultProperty : "response.used",
                              errorMessage : "create-site-dialog.title.already.used"
                         } ]
                    }
               },
               {
                    id : "EDIT_SITE_FIELD_DESCRIPTION",
                    name : "alfresco/forms/controls/TextArea",
                    config : {
                         fieldId : "DESCRIPTION",
                         label : "create-site.dialog.description.label",
                         name : "description",
                         validationConfig : [ {
                              validation : "maxLength",
                              length : 512,
                              errorMessage : "create-site.dialog.description.maxLength"
                         } ]
                    }
               },
               {
                    id : "EDIT_SITE_FIELD_VISIBILITY",
                    name : "alfresco/forms/controls/RadioButtons",
                    config : {
                         fieldId : "VISIBILITY",
                         label : "create-site.dialog.visibility.label",
                         name : "visibility",
                         optionsConfig : {
                              fixed : [
                                        {
                                             label : "create-site.dialog.visibility.public",
                                             description : "create-site.dialog.visibility.public.description",
                                             value : "PUBLIC"
                                        },
                                        {
                                             label : "create-site.dialog.visibility.private",
                                             description : "create-site.dialog.visibility.private.description",
                                             value : "PRIVATE"
                                        } ]
                         }
                    }
               } ];