@@ -10,11 +10,8 @@ define([
1010    "dojo/date/locale" , 
1111    "alfresco/dialogs/AlfDialog" , 
1212    "alfresco/core/Core" , 
13-     "dojo/_base/lang" , 
14-     "dojo/_base/array" , 
15-     "softwareloop/util/browser" , 
16-     "softwareloop/util/cmis" 
17- ] ,  function  ( TemplatedMixin ,  WidgetBase ,  declare ,  template ,  locale ,  AlfDialog ,  Core ,  lang ,  array ,  browser ,  cmis )  { 
13+     "dojo/_base/lang" 
14+ ] ,  function  ( TemplatedMixin ,  WidgetBase ,  declare ,  template ,  locale ,  AlfDialog ,  Core ,  lang )  { 
1815    return  declare ( [ WidgetBase ,  TemplatedMixin ,  Core ] ,  { 
1916        templateString : template , 
2017
@@ -28,8 +25,6 @@ define([
2825
2926
3027        entry : null , 
31-         entryId : null , 
32-         entryAttributes : null , 
3328
3429        previewUrl : "" , 
3530        downloadUrl : "" , 
@@ -44,71 +39,16 @@ define([
4439        downloadLabel : "download" , 
4540
4641        postMixInProperties : function  ( )  { 
47-             this . bindToEntry ( ) ; 
4842            this . composeLines ( ) ; 
4943        } , 
5044
51-         bindToEntry : function  ( )  { 
52-             this . entryId  =  this . entry . getElementsByTagName ( "id" ) [ 0 ] . firstChild . nodeValue . substring ( 9 ) ; 
53-             this . entryAttributes  =  { } ; 
54-             this . parseProperties ( "propertyId" , 
55-                 function  ( stringValue )  { 
56-                     return  stringValue ; 
57-                 } 
58-             ) ; 
59-             this . parseProperties ( "propertyString" , 
60-                 function  ( stringValue )  { 
61-                     return  stringValue ; 
62-                 } 
63-             ) ; 
64-             this . parseProperties ( "propertyInteger" ,  parseInt ) ; 
65- 
66-             this . parseProperties ( "propertyBoolean" , 
67-                 function  ( stringValue )  { 
68-                     return  stringValue  ===  'true' ; 
69-                 } 
70-             ) ; 
71-             this . parseProperties ( "propertyDateTime" ,  cmis . parseDate ) ; 
72-         } , 
73- 
74-         parseProperties : function  ( tagName ,  converter )  { 
75-             var  propertyStrings  = 
76-                 browser . getElementsByTagName ( this . entry ,  "cmis" ,  tagName ) ; 
77-             for  ( var  i  =  0 ;  i  <  propertyStrings . length ;  i ++ )  { 
78-                 var  propertyString  =  propertyStrings [ i ] ; 
79-                 var  cmisAttributeName  = 
80-                     propertyString . getAttribute ( "propertyDefinitionId" ) ; 
81-                 var  entryAttribute  =  { 
82-                     tagName : tagName , 
83-                     values : [ ] , 
84-                     value : function  ( )  { 
85-                         return  ( this . values . length  >  0 )  ? this . values [ 0 ]  : null 
86-                     } 
87-                 } ; 
88-                 this . entryAttributes [ cmisAttributeName ]  =  entryAttribute ; 
89-                 var  valueNode  =  browser . getElementsByTagName ( propertyString ,  "cmis" ,  "value" ) ; 
90-                 if  ( valueNode )  { 
91-                     array . forEach ( valueNode ,  function  ( current )  { 
92-                         var  cmisAttributeValue  =  null ; 
93-                         try  { 
94-                             var  nodeValue  =  current . firstChild . nodeValue ; 
95-                             cmisAttributeValue  =  converter ( nodeValue ) ; 
96-                         }  catch  ( e )  { 
97-                             cmisAttributeValue  =  null ; 
98-                         } 
99-                         entryAttribute . values . push ( cmisAttributeValue ) ; 
100-                     } ) ; 
101-                 } 
102-             } 
103-         } , 
104- 
10545        composeLines : function  ( )  { 
106-             if  ( this . entryAttributes [ "cmis:baseTypeId" ] . value ( )  ===  "cmis:document" )  { 
46+             if  ( this . entry . getAttributeValue ( "cmis:baseTypeId" )  ===  "cmis:document" )  { 
10747                this . previewUrl  =  lang . replace ( 
10848                    "{proxyUri}api/node/workspace/SpacesStore/{entryId}/content/thumbnails/doclib?c=queue&ph=true&lastModified=1" , 
10949                    { 
11050                        proxyUri : Alfresco . constants . PROXY_URI , 
111-                         entryId : this . entryId 
51+                         entryId : this . entry . id 
11252                    } 
11353                ) ; 
11454            }  else  { 
@@ -123,37 +63,37 @@ define([
12363                "{proxyUri}api/node/content/workspace/SpacesStore/{entryId}/{filename}?a=true" , 
12464                { 
12565                    proxyUri : Alfresco . constants . PROXY_URI , 
126-                     entryId : this . entryId , 
127-                     filename : encodeURIComponent ( this . entryAttributes [ "cmis:name" ] . value ( ) ) 
66+                     entryId : this . entry . id , 
67+                     filename : encodeURIComponent ( this . entry . getAttributeValue ( "cmis:name" ) ) 
12868                } 
12969            ) ; 
130-             this . escapedLine1  =  this . encodeHTML ( this . entryAttributes [ "cmis:name" ] . value ( ) ) ; 
70+             this . escapedLine1  =  this . encodeHTML ( this . entry . getAttributeValue ( "cmis:name" ) ) ; 
13171            if  ( ! this . escapedLine1 )  { 
13272                this . escapedLine1  =  "" ; 
13373            } 
134-             this . escapedLine2  =  this . encodeHTML ( this . entryAttributes [ "cm:title" ] . value ( ) ) ; 
74+             this . escapedLine2  =  this . encodeHTML ( this . entry . getAttributeValue ( "cm:title" ) ) ; 
13575            if  ( ! this . escapedLine2 )  { 
13676                this . escapedLine2  =  "" ; 
13777            } 
13878            var  line3  =  this . message ( 
13979                "modified.on.by" , 
14080                { 
141-                     date : locale . format ( this . entryAttributes [ "cmis:lastModificationDate" ] . value ( ) ,  { 
81+                     date : locale . format ( this . entry . getAttributeValue ( "cmis:lastModificationDate" ) ,  { 
14282                        formatLength : "medium" , 
14383                        locale : Alfresco . constants . JS_LOCALE . substring ( 0 ,  2 ) 
14484                    } ) , 
145-                     user : this . entryAttributes [ "cmis:lastModifiedBy" ] . value ( ) 
85+                     user : this . entry . getAttributeValue ( "cmis:lastModifiedBy" ) 
14686                } 
14787            ) ; 
14888            this . escapedLine3  =  this . encodeHTML ( line3 ) ; 
14989            if  ( ! this . escapedLine3 )  { 
15090                this . escapedLine3  =  "" ; 
15191            } 
152-             this . escapedLine4  =  this . encodeHTML ( this . entryAttributes [ "cm:description" ] . value ( ) ) ; 
92+             this . escapedLine4  =  this . encodeHTML ( this . entry . getAttributeValue ( "cm:description" ) ) ; 
15393            if  ( ! this . escapedLine4 )  { 
15494                this . escapedLine4  =  "" ; 
15595            } 
156-             var  versionLabel  =  this . entryAttributes [ "cmis:versionLabel" ] . value ( ) ; 
96+             var  versionLabel  =  this . entry . getAttributeValue ( "cmis:versionLabel" ) ; 
15797            if  ( "0.0"  ===  versionLabel )  { 
15898                versionLabel  =  "1.0" ; 
15999            } 
@@ -165,7 +105,7 @@ define([
165105            this . downloadLabel  =  this . message ( 
166106                "download.size" , 
167107                { 
168-                     size : this . getHumanSize ( this . entryAttributes [ "cmis:contentStreamLength" ] . value ( ) ) 
108+                     size : this . getHumanSize ( this . entry . getAttributeValue ( "cmis:contentStreamLength" ) ) 
169109                } 
170110            ) ; 
171111        } , 
@@ -185,7 +125,7 @@ define([
185125                "Document approved" , 
186126                    "This is just a stub action. "  + 
187127                    "To provide a real implementation you should customize "  + 
188-                          "Item.approveAction()" , 
128+                     "Item.approveAction()" , 
189129                true 
190130            ) ; 
191131        } , 
@@ -195,7 +135,7 @@ define([
195135                "Document rejected" , 
196136                    "This is just a stub action. "  + 
197137                    "To provide a real implementation you should customize "  + 
198-                          "Item.rejectAction()" , 
138+                     "Item.rejectAction()" , 
199139                true 
200140            ) ; 
201141        } , 
0 commit comments