@@ -30,7 +30,6 @@ define([
3030 entry : null ,
3131 entryId : null ,
3232 entryAttributes : null ,
33- entryAttributeArrays : null ,
3433
3534 previewUrl : "" ,
3635 downloadUrl : "" ,
@@ -52,7 +51,6 @@ define([
5251 bindToEntry : function ( ) {
5352 this . entryId = this . entry . getElementsByTagName ( "id" ) [ 0 ] . firstChild . nodeValue . substring ( 9 ) ;
5453 this . entryAttributes = { } ;
55- this . entryAttributeArrays = { } ;
5654 this . parseProperties ( "propertyId" ,
5755 function ( stringValue ) {
5856 return stringValue ;
@@ -79,10 +77,17 @@ define([
7977 for ( var i = 0 ; i < propertyStrings . length ; i ++ ) {
8078 var propertyString = propertyStrings [ i ] ;
8179 var cmisAttributeName =
82- propertyString . getAttribute ( "propertyDefinitionId" ) . replace ( ":" , "_" ) ;
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 ;
8389 var valueNode = browser . getElementsByTagName ( propertyString , "cmis" , "value" ) ;
8490 if ( valueNode ) {
85- var cmisAttributeValues = [ ] ;
8691 array . forEach ( valueNode , function ( current ) {
8792 var cmisAttributeValue = null ;
8893 try {
@@ -91,22 +96,14 @@ define([
9196 } catch ( e ) {
9297 cmisAttributeValue = null ;
9398 }
94- cmisAttributeValues . push ( cmisAttributeValue ) ;
99+ entryAttribute . values . push ( cmisAttributeValue ) ;
95100 } ) ;
96- this . entryAttributeArrays [ cmisAttributeName ] = cmisAttributeValues ;
97- if ( cmisAttributeValues . length > 0 ) {
98- this . entryAttributes [ cmisAttributeName ] = cmisAttributeValues [ 0 ] ;
99- } else {
100- this . entryAttributes [ cmisAttributeName ] = null ;
101- }
102- } else {
103- this . entryAttributes [ cmisAttributeName ] = null ;
104101 }
105102 }
106103 } ,
107104
108105 composeLines : function ( ) {
109- if ( this . entryAttributes . cmis_baseTypeId === "cmis:document" ) {
106+ if ( this . entryAttributes [ "cmis:baseTypeId" ] . value ( ) === "cmis:document" ) {
110107 this . previewUrl = lang . replace (
111108 "{proxyUri}api/node/workspace/SpacesStore/{entryId}/content/thumbnails/doclib?c=queue&ph=true&lastModified=1" ,
112109 {
@@ -127,36 +124,36 @@ define([
127124 {
128125 proxyUri : Alfresco . constants . PROXY_URI ,
129126 entryId : this . entryId ,
130- filename : encodeURIComponent ( this . entryAttributes . cmis_name )
127+ filename : encodeURIComponent ( this . entryAttributes [ "cmis:name" ] . value ( ) )
131128 }
132129 ) ;
133- this . escapedLine1 = this . encodeHTML ( this . entryAttributes . cmis_name ) ;
130+ this . escapedLine1 = this . encodeHTML ( this . entryAttributes [ "cmis:name" ] . value ( ) ) ;
134131 if ( ! this . escapedLine1 ) {
135132 this . escapedLine1 = "" ;
136133 }
137- this . escapedLine2 = this . encodeHTML ( this . entryAttributes . cm_title ) ;
134+ this . escapedLine2 = this . encodeHTML ( this . entryAttributes [ "cm:title" ] . value ( ) ) ;
138135 if ( ! this . escapedLine2 ) {
139136 this . escapedLine2 = "" ;
140137 }
141138 var line3 = this . message (
142139 "modified.on.by" ,
143140 {
144- date : locale . format ( this . entryAttributes . cmis_lastModificationDate , {
141+ date : locale . format ( this . entryAttributes [ "cmis:lastModificationDate" ] . value ( ) , {
145142 formatLength : "medium" ,
146143 locale : Alfresco . constants . JS_LOCALE . substring ( 0 , 2 )
147144 } ) ,
148- user : this . entryAttributes . cmis_lastModifiedBy
145+ user : this . entryAttributes [ "cmis:lastModifiedBy" ] . value ( )
149146 }
150147 ) ;
151148 this . escapedLine3 = this . encodeHTML ( line3 ) ;
152149 if ( ! this . escapedLine3 ) {
153150 this . escapedLine3 = "" ;
154151 }
155- this . escapedLine4 = this . encodeHTML ( this . entryAttributes . cm_description ) ;
152+ this . escapedLine4 = this . encodeHTML ( this . entryAttributes [ "cm:description" ] . value ( ) ) ;
156153 if ( ! this . escapedLine4 ) {
157154 this . escapedLine4 = "" ;
158155 }
159- var versionLabel = this . entryAttributes . cmis_versionLabel ;
156+ var versionLabel = this . entryAttributes [ "cmis:versionLabel" ] . value ( ) ;
160157 if ( "0.0" === versionLabel ) {
161158 versionLabel = "1.0" ;
162159 }
@@ -168,7 +165,7 @@ define([
168165 this . downloadLabel = this . message (
169166 "download.size" ,
170167 {
171- size : this . getHumanSize ( this . entryAttributes . cmis_contentStreamLength )
168+ size : this . getHumanSize ( this . entryAttributes [ "cmis:contentStreamLength" ] . value ( ) )
172169 }
173170 ) ;
174171 } ,
@@ -188,7 +185,8 @@ define([
188185 "Document approved" ,
189186 "This is just a stub action. " +
190187 "To provide a real implementation you should customize " +
191- "Item.approveAction()"
188+ "Item.approveAction()" ,
189+ true
192190 ) ;
193191 } ,
194192
@@ -197,19 +195,22 @@ define([
197195 "Document rejected" ,
198196 "This is just a stub action. " +
199197 "To provide a real implementation you should customize " +
200- "Item.rejectAction()"
198+ "Item.rejectAction()" ,
199+ true
201200 ) ;
202201 } ,
203202
204- showDialog : function ( title , content ) {
203+ showDialog : function ( title , content , reloadOnHide ) {
205204 var myDialog = new AlfDialog ( {
206205 title : title ,
207206 content : content ,
208207 style : "width: 300px"
209208 } ) ;
210- myDialog . on ( "hide" , function ( ) {
211- location . reload ( false ) ;
212- } ) ;
209+ if ( reloadOnHide ) {
210+ myDialog . on ( "hide" , function ( ) {
211+ location . reload ( false ) ;
212+ } ) ;
213+ }
213214 myDialog . show ( ) ;
214215 } ,
215216
0 commit comments