tag:help-archives.hannonhill.com,2010-02-09:/discussions/web-services/1362-fill-in-placement-folder-with-wsdlCascade CMS: Discussion 2014-07-02T15:32:54Ztag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-05-22T15:43:43Z2014-05-22T15:43:43ZFill in "Placement Folder" with WSDL<div><p>Hi Todd,</p>
<p>Yes, if you are willing to use my library. Here is an example on
how to visit an asset factory with a given name in every site:
<a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/classes/cascade.php">
Cascade</a>.</p>
<p>In the <code>AssetFactory</code> class, there is a
<code>setPlacementFolder( Folder $folder )</code> method that you
can call to set the placement folder. You just need to create a
<code>Folder</code> object and pass it in.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-05-22T15:49:38Z2014-05-22T15:49:38ZFill in "Placement Folder" with WSDL<div><p>This is exactly what I was looking for Wing!</p>
<p>When I get a chance I'll try out library. This is why I love
Cascade, the community is so awesome.</p>
<p>Thanks for you hard work on this and sharing it.</p></div>Todd Ashmoretag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-05-22T16:35:04Z2014-05-23T13:17:03ZFill in "Placement Folder" with WSDL<div><p>I have just posted a complete program on the <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/recipes/asset-factory-recipes.php">
AssetFactory Recipes</a> page. Also see <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/classes/how-to-use-library.php">
How To Use The Library</a>.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-06-03T20:16:54Z2014-06-03T20:17:18ZFill in "Placement Folder" with WSDL<div><p>Hi Wing,</p>
<p>I finally got some time to try this out. We are currently using
PHP 5.5.12 and I think it's causing issues with your library.</p>
<p>Every time I try to run the library it throws back an error that
looks like the following in the logs:</p>
<p><code>PHP Fatal error: Call-time pass-by-reference has been
removed in
/usr/local/apache2/htdocs/phpdocs/cascade_ws/global_functions.php
on line 324, referer: http://cms.unmc.edu:8082/</code></p>
<p>Any ideas? Thanks again for your help on this.<br>
Todd</p></div>Todd Ashmoretag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-06-04T13:01:54Z2014-06-04T13:01:54ZFill in "Placement Folder" with WSDL<div><p>Hi Todd,</p>
<p>I apologize for the confusion caused by my stupid mistake: I had
put the reference <code>&</code> in the actual function calls,
not in the function declarations. Now the problem, I believe, is
fixed.</p>
<p>The file global_functions.php contains old code that predates my
asset classes. The code mostly is what I call client code that
include specific business logic. Now I have removed most of it and
retained only code related to <code>AssetTree</code> for
illustrative purposes and fixed the reference issue. I hope that it
won't cause any more problem. Thank you for trying my code, and
please download and install the newest library: <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/classes/index.php">
Building Class</a>.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-01T15:36:09Z2014-07-01T15:36:09ZFill in "Placement Folder" with WSDL<div><p>Hi Wing,</p>
<p>Thanks for fixing that. I finally got some time to look at this
again. I'm still having problems getting things to work.</p>
<p>I am trying to figure out how to copy a asset factory (by id) to
an asset factory container (by string name). The reason I need to
do this is because we have multiple sites and I'd love to not have
to do them by hand.</p>
<p>Am I missing a recipe on this or would this even be
possible?</p>
<p>I really do appreciate your help and all the hard work you've
put in to this. It will be a life saver when I can get the code
squared away.</p></div>Todd Ashmoretag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-01T15:40:57Z2014-07-01T15:40:57ZFill in "Placement Folder" with WSDL<div><p>Hi Todd,</p>
<p>I wanted to jump in real quick on this.</p>
<p>You mentioned you are copying Asset Factories into an Asset
Factory Container using the path. Are you copying into another
Site? If so, are you providing the destination Site name along with
the Asset Factory Container path? If you are not, Web Services will
assume you are trying to copy into the same Site.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-01T15:56:31Z2014-07-01T15:56:31ZFill in "Placement Folder" with WSDL<div><p>Hey Ryan, thanks for chiming in.</p>
<p>So I'll back up and explain the entire situation. I used the
Hannon Hill provided WSDL php library to do the following in pseudo
code.</p>
<pre>
<code>var newAssetFactory = FetchNewAssetFactory; // This is a block that we've created and need on all sites.
for Site in AllSites {
var assetFactoryContainer = FetchAssetFactoryContainerByName; //This is always the same on all sites. E.G. "Blocks - Right Column"
copyAsset(newAssetFactory, assetFactoryContainer);
}</code>
</pre>
<p>The above (in actual php code) worked like a dream. However, it
removes the placement folder, so I end up having to go through all
of them by hand anyways. This is why I was hoping to figure out
Wing's library since he has this functionality built in.</p></div>Todd Ashmoretag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-01T16:24:37Z2014-07-01T16:57:12ZFill in "Placement Folder" with WSDL<div><p>Hi Todd,</p>
<ol>
<li>
<p>I have been updating my library constantly, so please make sure
that you have the latest version: <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/classes/index.php">
Building Classes</a></p>
</li>
<li>
<p>See <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/recipes/asset-factory-recipes.php">
AssetFactory Recipes</a> for an example on how to copy an asset
factory from one site to another site. You may need to deal with
placement folder and access rights separately. See the same recipe
and <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/recipes/access-rights-information-recipes.php">
AccessRightsInformation Recipes</a>.</p>
</li>
<li>
<p>If you have already created all the asset factories in various
sites, then you may just need to set the placement folders. See the
AssetFactory Recipes on how to do that.</p>
</li>
</ol>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-01T19:08:41Z2014-07-01T19:08:41ZFill in "Placement Folder" with WSDL<div><p>My apologies for the confusion there, Todd.</p>
<p>I wanted to add that copying an Asset Factory with a placement
folder via the Cascade UI does display a notice stating the
placement folder will be dropped, so this is consistent with the
Web Services operation. You will also notice that within the UI,
the chooser for the placement folder is restricted to the current
Site.</p>
<p>I believe the reason being, based on typical copy operations,
the placement folder's path would resolve to the source Site, which
would be a little strange in the case of Asset Factories since they
are specific to the Site.</p>
<p>As Wing mentioned, you would need to copy the Asset Factory
first and then edit the new Asset Factory in order to update the
placement folder.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-02T15:21:29Z2014-07-02T15:21:29ZFill in "Placement Folder" with WSDL<div><p>It looks like I've got it all working with Wing's library.
Thanks so much again for this Wing, you're a life saver. I was
doing this all by hand before and with 50 sites (and growing) I was
going to pull out my hair.</p>
<p>Ryan, thanks for checking in to make sure all is well.</p>
<p>Take care guys!</p></div>Todd Ashmoretag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-02T15:27:12Z2014-07-02T15:27:12ZFill in "Placement Folder" with WSDL<div><p>Todd,</p>
<p>You are the first one brave enough to try my code. Thanks! And
congratulations!</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/330840072014-07-02T15:32:53Z2014-07-02T15:32:53ZFill in "Placement Folder" with WSDL<div><p>Thanks for the updates, guys! Wing, thanks for helping out!</p></div>Tim