@@ -47,8 +47,8 @@ var authRequest = require('./lib/wcm-authenticated-request'),
4747 curSecure = false ,
4848 curPullLibrary = undefined ,
4949 cElementsDir = '-elements' ,
50- cFile = '-file' ,
51- cAuthoringTemplates = 'Authoring Templates' ;
50+ cFile = '-file' ;
51+
5252
5353/**
5454 * progGoal: the number of steps in progress (if more than one operation is being
@@ -134,11 +134,15 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
134134 var libSettings = utils . getSettings ( wcmCwd + libTitle + Path . sep ) ;
135135 options = utils . getMergerdOptions ( options || { } , libSettings ) ;
136136 createFolder ( wcmCwd + libTitle ) ;
137- createFolder ( wcmCwd + libTitle + Path . sep + 'Presentation Templates' ) ;
138- createFolder ( wcmCwd + libTitle + Path . sep + 'Components' ) ;
137+ createFolder ( wcmCwd + libTitle + Path . sep + wcmRequests . cPresentationTemplates ) ;
138+ createFolder ( wcmCwd + libTitle + Path . sep + wcmRequests . cComponents ) ;
139139 // only do content template components if the user turns on trial code
140- if ( options . trial && options . trial == true )
141- createFolder ( wcmCwd + libTitle + Path . sep + cAuthoringTemplates ) ;
140+ if ( options . trial && options . trial == true ) {
141+ createFolder ( wcmCwd + libTitle + Path . sep + wcmRequests . cAuthoringTemplates ) ;
142+ createFolder ( wcmCwd + libTitle + Path . sep + wcmRequests . cWorkflowItems ) ;
143+ createFolder ( wcmCwd + libTitle + Path . sep + wcmRequests . cWorkflowItems + Path . sep + wcmRequests . cWorkflowStages ) ;
144+ createFolder ( wcmCwd + libTitle + Path . sep + wcmRequests . cWorkflowItems + Path . sep + wcmRequests . cWorkflowActions ) ;
145+ }
142146 progGoal ++ ;
143147 eventEmitter . emit ( "pullingLib" , libTitle ) ;
144148 wcmRequests . getFolderMap ( libTitle ) . then ( function ( map ) {
@@ -197,7 +201,13 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
197201 eventEmitter . emit ( "pullingType" , libTitle , wcmRequests . wcmTypes . linkComponent ) ;
198202 pullType ( options , wcmRequests . wcmTypes . linkComponent , libTitle , ".link" , map ) . then ( function ( count ) {
199203 totalCount += count ;
200-
204+ eventEmitter . emit ( "pullingType" , libTitle , wcmRequests . wcmTypes . customWorkflowAction ) ;
205+ pullType ( options , wcmRequests . wcmTypes . customWorkflowAction , libTitle , ".link" , map ) . then ( function ( count ) {
206+ totalCount += count ;
207+ eventEmitter . emit ( "pullingType" , libTitle , wcmRequests . wcmTypes . workflowStage ) ;
208+ pullType ( options , wcmRequests . wcmTypes . workflowStage , libTitle , ".link" , map ) . then ( function ( count ) {
209+ totalCount += count ;
210+
201211 eventEmitter . emit ( "pullingType" , libTitle , wcmRequests . wcmTypes . richTextComponent ) ;
202212 pullType ( options , wcmRequests . wcmTypes . richTextComponent , libTitle , ".rtf" , map ) . then ( function ( count ) {
203213 totalCount += count ;
@@ -222,6 +232,16 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
222232 deferred . reject ( err ) ;
223233 eventEmitter . emit ( "error" , err , "pullLibrary::richTextComponent::err::" + err ) ;
224234 } ) ;
235+ } , function ( err ) {
236+ debugLogger . error ( "pullLibrary::workflowStage::err::" + err ) ;
237+ deferred . reject ( err ) ;
238+ eventEmitter . emit ( "error" , err , "pullLibrary::workflowStage::err::" + err ) ;
239+ } ) ;
240+ } , function ( err ) {
241+ debugLogger . error ( "pullLibrary::customWorkflowAction::err::" + err ) ;
242+ deferred . reject ( err ) ;
243+ eventEmitter . emit ( "error" , err , "pullLibrary::customWorkflowAction::err::" + err ) ;
244+ } ) ;
225245 } , function ( err ) {
226246 debugLogger . error ( "pullLibrary::linkComponent::err::" + err ) ;
227247 deferred . reject ( err ) ;
@@ -384,6 +404,16 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
384404 name = name . substring ( 0 , name . indexOf ( wcmRequests . wcmExts . LibraryNumericComponent . substr ( 0 , wcmRequests . wcmExts . LibraryNumericComponent . indexOf ( '.' ) ) ) ) ;
385405 itemType = wcmRequests . wcmTypes . numericComponent ;
386406 }
407+ else
408+ if ( file . indexOf ( wcmRequests . wcmExts . CustomWorkflowAction ) != - 1 ) {
409+ name = name . substring ( 0 , name . indexOf ( wcmRequests . wcmExts . CustomWorkflowAction . substr ( 0 , wcmRequests . wcmExts . CustomWorkflowAction . indexOf ( '.' ) ) ) ) ;
410+ itemType = wcmRequests . wcmTypes . customWorkflowAction ;
411+ }
412+ else
413+ if ( file . indexOf ( wcmRequests . wcmExts . WorkflowStage ) != - 1 ) {
414+ name = name . substring ( 0 , name . indexOf ( wcmRequests . wcmExts . WorkflowStage . substr ( 0 , wcmRequests . wcmExts . WorkflowStage . indexOf ( '.' ) ) ) ) ;
415+ itemType = wcmRequests . wcmTypes . workflowStage ;
416+ }
387417 else
388418 itemType = wcmRequests . wcmTypes . textComponent ;
389419 } else if ( ext == ".rtf" ) {
@@ -515,6 +545,9 @@ function isTrialComponent(type){
515545 type == wcmRequests . wcmTypes . jspComponent ||
516546 type == wcmRequests . wcmTypes . linkComponent ||
517547 type == wcmRequests . wcmTypes . numericComponent ||
548+ type == wcmRequests . wcmTypes . numericComponent ||
549+ type == wcmRequests . wcmTypes . customWorkflowAction ||
550+ type == wcmRequests . wcmTypes . workflowStage ||
518551 type == wcmRequests . wcmTypes . dateComponent ) ;
519552}
520553
@@ -689,6 +722,12 @@ function updateLocalFile(options, libTitle, data, extension, map){
689722 else if ( wcmRequests . wcmTypes . linkComponent == wtype ) {
690723 fs . writeFileSync ( path + wcmRequests . wcmExts [ wtype ] , JSON . stringify ( cData . linkElement ) ) ;
691724 }
725+ else if ( wcmRequests . wcmTypes . customWorkflowAction == wtype ) {
726+ fs . writeFileSync ( path + wcmRequests . wcmExts [ wtype ] , JSON . stringify ( cData . customAction ) ) ;
727+ }
728+ else if ( wcmRequests . wcmTypes . workflowStage == wtype ) {
729+ fs . writeFileSync ( path + wcmRequests . wcmExts [ wtype ] , JSON . stringify ( cData . workflowStage ) ) ;
730+ }
692731 else if ( cData != undefined ) // check there is data to write
693732 fs . writeFileSync ( path + extension , cData . value ) ;
694733 if ( options == undefined || options . includeMeta == undefined || options . includeMeta == true ) {
0 commit comments