cancel
Showing results for 
Search instead for 
Did you mean: 

add an aspect for a space

user_alfresco
Champ in-the-making
Champ in-the-making
hello;

i don't speak very match english.

i want to modify the webscript My Space List exactly the javascript myspace.js   wich situated in C:\alfresco\tomcat\webapps\alfresco\scripts\ajax


i want that the space will created with the default aspect ?is it possible?
i think that i must modify this area :


YAHOO.util.Connect.asyncRequest(
            "POST",
            getContextPath() + '/ajax/invoke/MySpacesBean.createSpace',
            {
               success: function(response)
               {
                  if (response.responseText.indexOf("OK:") == 0)
                  {
                     MySpaces.refreshList();
                  }
                  else
                  {
                     alert("Error during creation of new space: " + response.responseText);
                  }
                  MySpaces.closePopupPanel();
               },
               failure: function(response)
               {
                  alert("Error during creation of new space: " + response.responseText);
                  MySpaces.closePopupPanel();
               }
            },
           
            //The third argument â€â€
6 REPLIES 6

mikeh
Star Contributor
Star Contributor
i want that the space will created with the default aspect ?is it possible?
Sorry, I don't understand what you're trying to do. Can you put it another way please?

Thanks,
Mike

user_alfresco
Champ in-the-making
Champ in-the-making
thank you  for yours answers

i have an aspect "cse:client" with proprities "name of client" ……..


i like that when the space is created  it will be created with this aspect (i don't like add the aspect after this creation with the web client of alfresco)


    */
   createSpaceOK: function(actionEl, path)
   {
      // gather the input data
      var panel = $(actionEl).getParent();
      var spaceName = panel.getElementById("space-name").value;
      var spaceTitle = panel.getElementById("space-title").value;
      var spaceDesc = panel.getElementById("space-description").value;
     
      if (spaceName.length != 0)
      {
         // ajax call to create space
        
         YAHOO.util.Connect.asyncRequest(
            "POST",
            getContextPath() + '/ajax/invoke/MySpacesBean.createSpace',
            {
               success: function(response)
               {
                  if (response.responseText.indexOf("OK:") == 0)
                  {
                     MySpaces.refreshList();
                  }
                  else
                  {
                     alert("Error during creation of new space: " + response.responseText);
                  }
                  MySpaces.closePopupPanel();
               },
               failure: function(response)
               {
                  alert("Error during creation of new space: " + response.responseText);
                  MySpaces.closePopupPanel();
               }
            },
           
            //The third argument â€â€

mikeh
Star Contributor
Star Contributor
Ok, yes I see what you're trying to do now.

You will need to override org.alfresco.web.bean.ajax.MySpacesBean in order to parse the extra parameter aspect and call nodeService.addAspect() for your requirement.

See: http://wiki.alfresco.com/wiki/Packaging_And_Deploying_Extensions

Thanks,
Mike

user_alfresco
Champ in-the-making
Champ in-the-making
thank your for this response

user_alfresco
Champ in-the-making
Champ in-the-making
hello MikeH;


can just use the javascript APi for adding an  aspect?

mikeh
Star Contributor
Star Contributor
Yes you can

Please see here for details: http://wiki.alfresco.com/wiki/JavaScript_API

Thanks,
Mike