cancel
Showing results for 
Search instead for 
Did you mean: 

Hide field on edit site

luiscesarinfo
Confirmed Champ
Confirmed Champ

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

8 REPLIES 8

afaust
Legendary Innovator
Legendary Innovator

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?

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.

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

Sorry for late replay.

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

Regards,

Luis

guisup
Champ in-the-making
Champ in-the-making

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"
                                        } ]
                         }
                    }
               } ];

douglascrp
World-Class Innovator
World-Class Innovator

Hello.

I was trying to perform the same kind of customization, and I got the same result as you described.

The widgetsForCreateSiteDialogOverrides works perfectly, but I could not find a way to use the similar widgetsForEditSiteDialog with the replace option.

So, in order to achieve the desired result, I had to use your solution, which is to complelely replace the widgets definition.

Thank you for sharing the workaround.

douglascrp
World-Class Innovator
World-Class Innovator

After some months, I came back to this issue and finally found the solution for it.

Basically, I had to upgrade aikau for a version containing a fix delivered by @afaust 

The details are available at https://github.com/Acosix/alfresco-site-hierarchy/issues/11#issuecomment-979438745