tag:help-archives.hannonhill.com,2010-02-09:/discussions/web-services/1335-getting-page-file-extension-when-using-read-on-pageCascade CMS: Discussion 2014-04-04T19:15:30Ztag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-22T12:53:55Z2014-03-22T12:55:44ZGetting Page file Extension when using "read" on "Page"<div><p>Hi Brendon,</p>
<p>It's really nice to run into someone who is also enthusiastic
about web services. I would like to invite you to check my tutorial
site: <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/index.php">
http://www.upstate.edu/cascade-admin/projects/web-services/index.php</a>.
Here you can find out what I have already done and what I am doing
right now. I would like to highlight a few things:</p>
<ol>
<li>
<p>I prefer OOP to raw procedural programming. I build classes and
use objects and try to avoid using arrays too often. <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/index.php">
http://www.upstate.edu/cascade-admin/projects/web-services/oop/inde...</a></p>
</li>
<li>
<p>My <code>AssetOperationHandlerService</code> class basically
covers what you have done so far: <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/simple-operations/index.php">
http://www.upstate.edu/cascade-admin/projects/web-services/simple-o...</a></p>
</li>
<li>
<p>I have also built more than a hundred other classes. You may
want to find out what they can do.<br>
<a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/classes/index.php">
http://www.upstate.edu/cascade-admin/projects/web-services/oop/clas...</a></p>
</li>
<li>
<p>I have an <code>AssetTree</code> class that enables a traversal
of a container (Base Folder, metadata set container, and so on) and
the <code>AssetTree::traverse</code> method allows input of
functions (in a plug-and-play manner) to modify every type of
assets. Please check the demo: <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/demo/asset-tree-demo/index.php">
http://www.upstate.edu/cascade-admin/projects/web-services/oop/demo...</a></p>
</li>
<li>
<p>As for file extensions specifically, you need to look at page
configuration sets associated with pages: <a href=
"http://www.upstate.edu/cascade-admin/projects/web-services/oop/classes/asset-classes/page-configuration-set.php">
http://www.upstate.edu/cascade-admin/projects/web-services/oop/clas...</a></p>
</li>
</ol>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-22T15:49:49Z2014-03-24T12:33:25ZGetting Page file Extension when using "read" on "Page"<div><p>Hi Wing,</p>
<p>I really appreciate the reply, and your site looks great. I'll
definitely be bookmarking it!</p>
<p>I'll look into using the page configuration set. Currently I'm
just building onto the examples on Cascade's git website and
expanding a little further. My plan was to create classes and use
them in a more OO manner. I also did this with when working with
the meta data published when doing DB publishing.</p>
<p>I'll shoot you a PM, but thanks for your reply, I'll report back
here with my findings.</p></div>birwintag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T14:00:23Z2014-03-24T14:00:23ZGetting Page file Extension when using "read" on "Page"<div><p>Hi Brendon,</p>
<p>Wing is definitely on the right track there with Configuration
Sets. What you will most likely want to do is read the page and
take a look at <code>pageConfigurations</code> and find the default
configuration by checking the <code>defaultConfiguration</code>
flag. This also includes the output extension.</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/322091672014-03-24T14:55:35Z2014-03-24T15:09:27ZGetting Page file Extension when using "read" on "Page"<div><p>Like the following:</p>
<pre>
$p = Asset::getAsset( $service, Page::TYPE, $page_id );
echo $p->getConfigurationSet()->
getDefaultConfiguration()->getName() . BR; // Desktop
echo $p->getConfigurationSet()->
getDefaultConfiguration()->
getOutputExtension() . BR; // .php
</pre>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T15:45:31Z2014-03-24T15:45:31ZGetting Page file Extension when using "read" on "Page"<div><p>Thanks Ryan, Wing,</p>
<p>I'm looking at this as simply reading a Page by it's ID, so in
my scenario I have:</p>
<p>(The $auth, $client & pageID are all valid and set )</p>
<p>$identifier = array('id' => $pageID, 'type' => 'page' );
//will read the page itself... $readParams = array
('authentication' => $auth, 'identifier' => $identifier);
$page = $client->read($readParams);</p>
<p>When I try to read one of my pages with a given configuration
set here's what I get printing the output of the $page object.</p>
<p>stdClass Object<br>
( [id] => c0a63f800a0a4a86551ffcc285113ace ...
[pageConfigurations] => stdClass Object ( [pageConfiguration]
=> stdClass Object ( [id] => c09d113a0a0a4a86551ffcc230c55592
[name] => Page - Depatrment Page [defaultConfiguration] => 1
[pageRegions] => stdClass Object ( [pageRegion] => Array( ...
) ) [outputExtension] => ) )<br>
)</p>
<p>Now I'd expect to see something within<br>
$page->pageConfigurations->pageConfiguration->outputExtension
but it is blank...</p>
<p>In the administration , the configuration set has the
information</p>
<p>Template: _Templates/Page/Basic<br>
Format: None applied<br>
Publishable: Yes<br>
File Extension: .html<br>
Serialization Type: HTML<br>
Include XML Declaration: No<br>
Default Output: Yes</p>
<p>I'm using Cascade v 7.8.1 and the outputExtension seems empty
for each. Now I am reading this information from the "Page" level,
I don't see why the output Extension would be blank when other
fields are not.</p>
<p>I've attached the Full Output I see. Is it possible there's a
glitch in 7.8.1?</p></div>birwintag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T16:39:58Z2014-03-24T16:39:58ZGetting Page file Extension when using "read" on "Page"<div><p>Brendon,</p>
<p>You cannot read the file extension from the page. You have to
read the page, get the configuration set id, read the configuration
set, and then read the file extension from the configuration set.
If there are more than one configuration in the set, you need to
find the default configuration and read the extension there. If you
look at the code I gave above, you will see why I built my classes
to do this.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T17:01:33Z2014-03-24T17:01:33ZGetting Page file Extension when using "read" on "Page"<div><p>Thanks Wing,</p>
<p>Just the answer I was looking for. I have taken a look at your
documents. They're stellar! I am just trying to do a bit by/for
myself before I borrow too much from you, otherwise I wont learn
quite as much.</p>
<p>Much appreciated for the feedback! I'll try reading the
configuration set and report back.</p>
<p>Cheers,</p>
<p>Bren</p></div>birwintag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T17:26:09Z2014-03-24T17:26:09ZGetting Page file Extension when using "read" on "Page"<div><p>Wing, you were absolutely right. Performing the read on the
Configurationset itself yielded the output I was expecting.</p>
<p>Thanks again!</p></div>birwintag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T18:09:11Z2014-03-24T18:09:11ZGetting Page file Extension when using "read" on "Page"<div><p>Brendon & Wing,</p>
<p>Looking at the code, it appears these properties are not being
set during the Page read operation, but they definitely should be.
I went ahead and logged this as a <a href=
"https://hannonhill.jira.com/browse/CSI-744">known defect</a>. Feel
free to use this link to track the progress of this issue or keep
an eye out for it on our <a href=
"http://www.hannonhill.com/kb/Release-Notes">Release Notes
site</a>.</p>
<p>In the meantime, as Wing pointed out, you would need to read the
actual Configuration Set to obtain this information.</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/322091672014-03-24T18:22:48Z2014-03-24T18:22:48ZGetting Page file Extension when using "read" on "Page"<div><p>Ryan,</p>
<p>I am not sure if this should be treated as a defect. A page can
be associated with a configuration set that has several
configurations. That means a page can have several associated file
extensions. Of course, we can select the default configuration. But
then, if I want other extensions, I still need to read the
configuration set.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T18:38:38Z2014-03-24T18:38:38ZGetting Page file Extension when using "read" on "Page"<div><p>Hi Wing,</p>
<p>I am treating it as a defect because the properties are listed
in the WSDL under Pages, which is misleading because they are never
being populated in the code.</p>
<blockquote>
<p>A page can be associated with a configuration set that has
several configurations. That means a page can have several
associated file extensions.</p>
</blockquote>
<p>You are correct; however, as you mentioned, you would refer to
the default configuration at that point. I don't really see any
potential issues with providing this information and it should be
more efficient than reading the page for the Configuration Set ID
and then reading the Configuration Set.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T18:58:29Z2014-03-24T18:58:29ZGetting Page file Extension when using "read" on "Page"<div><p>Sweet, so you're saying technically when this defect is fixed, I
should be able to simply read the page rather than:</p>
<p>Read Page -> get Content Type<br>
Read Content Type -> Get ConfigurationSet<br>
Read ConfigurationSet -> get Active Configuration-> output
extension</p>
<p>That will make things just a tad bit easier! That said, good
learning experience.</p>
<p>Thanks Ryan!</p></div>birwintag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T19:03:56Z2014-03-24T19:03:56ZGetting Page file Extension when using "read" on "Page"<div><p>Brendon, nicely put! And Ryan, I agree. Right now the properties
are there storing nothing.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-24T20:08:08Z2014-03-24T20:08:08ZGetting Page file Extension when using "read" on "Page"<div><p>You are correct, Brendon, unless there was some specific reason
those properties were being left out, this should help down the
road.</p>
<p>I'm going to go ahead and close this discussion, but please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-26T19:36:06Z2014-03-26T19:36:06ZGetting Page file Extension when using "read" on "Page"<div><p>Just to follow up. If the missing config set ID and path is a
defect, then the missing metadata set ID and path should also be
treated as a defect.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-26T19:46:15Z2014-03-26T19:46:15ZGetting Page file Extension when using "read" on "Page"<div><p>Hi Wing,</p>
<p>Are you referring to these properties missing when doing a Page
read? If so, I believe the reason for this is due to there being a
Content Type applied to the Page. I think those additional
properties are used more for cases where Content Types are not
utilized.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-26T19:49:06Z2014-03-26T19:49:06ZGetting Page file Extension when using "read" on "Page"<div><p>Yes, I are referring to a page read. Last time we talked about
whether this should be treated as a defect. I just think the
missing metadata set ID should be treated in the same way as the
missing config set ID.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-26T20:16:28Z2014-03-26T20:16:28ZGetting Page file Extension when using "read" on "Page"<div><p>Sorry for the confusion there, Wing. I thought we were
discussing the same defect as the missing outputExtension property,
which I believe would be different than the blank Configuration Set
ID.</p>
<p>The difference there would be that both the Configuration Set
and Metadata Set ID and Path properties are intentionally left
blank if the Page is assigned a Content Type, because the Content
Type "bundles" these together and they are required fields for the
Content Type.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-27T12:25:09Z2014-03-27T12:26:49ZGetting Page file Extension when using "read" on "Page"<div><p>Ryan,</p>
<p>My mistake. I thought you were suggesting, beside the four
properties you mentioned in the bug report, that the config set
id/path and metadata set id/path should also be stuck in the page
property. Since you did not mean that, can I suggest that they are
populated as well? They can be read-only. Right now these four
properties always store NULL.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/322091672014-03-27T12:40:25Z2014-03-27T12:40:25ZGetting Page file Extension when using "read" on "Page"<div><p>Not a problem at all, Wing, my apologies for the confusion
there.</p>
<p>In the case of populating those properties, this behavior has
been around for quite some time (most likely since Content Types
were implemented). I would recommend posting this to our <a href=
"http://ideas.hannonhill.com/">Idea Exchange</a> so we can get an
idea of how popular this improvement would be.</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/322091672014-03-27T12:42:48Z2014-03-27T12:42:48ZGetting Page file Extension when using "read" on "Page"<div><p>Actually, Wing, I was already logged into the Idea Exchange and
went ahead and <a href=
"http://ideas.hannonhill.com/forums/52559-ideas-for-cascade-server/suggestions/5687614-web-services-include-configuration-and-metadata-s">
created the suggestion</a> for you. Please feel free to vote it up
and comment if you have any additional information to add.</p>
<p>Thanks!</p></div>Ryan Griffith