Commit c9cb0bf6070999a51e61a554dbbdec9ce5f8cd6d

Authored by Ahmed Owian
1 parent 2198561f3f
Exists in master

Added skype webscript to get the sype user id

prototype/skype.html
... ... @@ -46,19 +46,24 @@
46 46 });
47 47 }
48 48  
  49 + function parsePage()
  50 + {
  51 + $("a[href$=\"/profile\"").each(function(index)
  52 + {
  53 + // Ensures that we are dealing with a user profile link
  54 + var href = $(this).attr("href");
  55 + var regex = /share\/page\/user\/(.+)\/profile/;
  56 + var match = regex.exec(href);
  57 + if (match !== null && match.length > 1)
  58 + {
  59 + processProfileLink($(this), match[1]);
  60 + }
  61 + });
  62 + }
  63 +
49 64 $(document).ready(function()
50 65 {
51   - $("a[href$=\"/profile\"").each(function(index)
52   - {
53   - // Ensures that we are dealing with a user profile link
54   - var href = $(this).attr("href");
55   - var regex = /share\/page\/user\/(.+)\/profile/;
56   - var match = regex.exec(href);
57   - if (match !== null && match.length > 1)
58   - {
59   - processProfileLink($(this), match[1]);
60   - }
61   - });
  66 + parsePage();
62 67 });
63 68 </script>
64 69  
... ...
share-amp/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/skype/skype.get.desc.xml
... ... @@ -0,0 +1,7 @@
  1 +<webscript>
  2 + <shortname>Skype</shortname>
  3 + <description>Skype Integration</description>
  4 + <family>Share</family>
  5 + <format default="json" />
  6 + <url>/skype</url>
  7 +</webscript>
0 8 \ No newline at end of file
... ...
share-amp/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/skype/skype.get.js
... ... @@ -0,0 +1,25 @@
  1 +function main()
  2 +{
  3 + var profileId = page.url.templateArgs["userid"];
  4 + if (profileId != null)
  5 + {
  6 + // load user details for the profile from the repo
  7 + var userObj = user.getUser(profileId);
  8 + if (userObj != null)
  9 + {
  10 + model.profile = userObj;
  11 + }
  12 + else
  13 + {
  14 + // fallback if unable to get user details
  15 + model.profile = user.getUser(user.id);
  16 + }
  17 + }
  18 + else
  19 + {
  20 + // if no profile specified, must be current user
  21 + model.profile = user.getUser(user.id);
  22 + }
  23 +};
  24 +
  25 +main();
0 26 \ No newline at end of file
... ...
share-amp/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/skype/skype.get.json.ftl
... ... @@ -0,0 +1,4 @@
  1 +{
  2 + "userId":"${profile.id}",
  3 + "skypeId":"${profile.skype}"
  4 +}
0 5 \ No newline at end of file
... ...