18 require_once SQ_PACKAGES_PATH.
'/web_services/api/soap_api/soap_api.inc';
19 require_once SQ_PACKAGES_PATH.
'/web_services/api/soap_api_file_retrieval_service/soap_api_file_retrieval_service.inc';
20 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
45 parent::__construct($assetid);
62 'GetAllStatuses' =>
'1',
64 'GetAssetFromURL' =>
'1',
65 'GetAssetTypeAttribute' =>
'1',
66 'GetAssetTypeDescendants' =>
'1',
67 'GetAssetsInfo' =>
'1',
68 'GetAttributeValuesByName' =>
'1',
69 'GetAssetAvailableKeywords' =>
'1',
70 'GetAssetAvailableStatuses' =>
'1',
71 'GetAssetWebPaths' =>
'1',
72 'GetAssetURLs' =>
'1',
73 'GetPageContents' =>
'1',
74 'SetAttributeValue' =>
'1',
76 'SetAssetStatus' =>
'1',
77 'SetAssetWebPaths' =>
'1',
80 'GetUserIdByUsername' =>
'1',
111 $request_info = (Array) $request;
112 $parentid = array_get_index($request_info,
'ParentID',
'');
113 $type_code = array_get_index($request_info,
'TypeCode',
'');
114 $type_code = strtolower($type_code);
115 $asset_name = array_get_index($request_info,
'Name',
'');
116 $link_type = array_get_index($request_info,
'LinkType',
'1');
117 $link_value = array_get_index($request_info,
'LinkValue',
'');
118 $sort_order = array_get_index($request_info,
'SortOrder', -1);
119 $is_dependant = array_get_index($request_info,
'IsDependant',
'0');
120 $is_exclusive = array_get_index($request_info,
'IsExclusive',
'0');
121 $file_content = array_get_index($request_info,
'FileContentBase64',
'');
122 $file_name = array_get_index($request_info,
'FileName',
'');
123 $attributes = array_get_index($request_info,
'AttributeInfo', Array());
125 $parent_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($parentid);
127 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset($type_code);
128 $object_name = str_replace(
' ',
'_', ucwords(str_replace(
'_',
' ', $type_code)));
129 $asset =
new $object_name();
131 if(isset($attributes->AttributeName)) {
133 $asset->setAttrValue($attributes->AttributeName, $attributes->AttributeValue);
137 foreach ($attributes as $attribute_info) {
138 $attribute_info = (Array) $attribute_info;
139 $asset->setAttrValue($attribute_info[
'AttributeName'], $attribute_info[
'AttributeValue']);
143 $request_info[
'asset'] = $parent_asset;
146 'asset' => $parent_asset,
147 'name' => $asset_name,
148 'link_type' => $link_type,
149 'value' => $link_value,
150 'sort_order' => $sort_order,
151 'is_dependant' => $is_dependant,
152 'is_exclusive' => $is_exclusive,
157 $type_ancestors = $asset->getTypeAncestors(FALSE);
158 if(!empty($file_name) && !empty($file_content) && (in_array(
'file', $type_ancestors) || $type_code ===
'file')) {
161 $destination_file = SQ_DATA_PATH.
'/temp/'.$tmp_file_name;
162 while (file_exists($destination_file)) {
166 file_put_contents($destination_file, base64_decode($file_content));
167 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
168 $file_type = get_file_type($file_name);
170 'name' => $file_name,
171 'type' => $file_type,
172 'tmp_name' => $destination_file,
173 'non_uploaded_file' => TRUE,
175 'size' => filesize($destination_file),
177 $asset->_tmp[
'uploading_file'] = 1;
178 $asset->setAttrValue(
'title', $asset_name);
179 $linkid = $asset->create($link_info, $info);
182 if (file_exists($destination_file)) {
183 unlink($destination_file);
190 if (isset($asset->vars[
'name']) && ($asset_name !=
'')) {
191 $asset->setAttrValue(
'name', $asset_name);
193 $linkid = $asset->create($link_info);
199 'CreateMessage' =>
'Asset was created successfully. Link id #'.$linkid,
200 'NewAssetID' => $asset->id,
205 throw new SoapFault(
'Server',
'Unable to create asset');
225 $request_info = (Array) $request;
226 $assetid = array_get_index($request_info,
'AssetID',
'');
227 if (!empty($assetid)) {
228 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
231 if (!is_null($asset)) {
232 foreach ($asset->vars as $attr_name => $attr_info) {
233 if ($attr_info[
'type'] ==
'password') {
234 unset($asset->vars[$attr_name]);
237 $asset_xml = self::objectToXML($asset);
241 'GetAssetResult' => $asset_xml,
244 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
258 private static function objectToXML($object)
261 foreach ($object as $key => $value) {
263 $key = preg_replace(
'/\s+/',
'', $key);
264 if (empty($key))
continue;
265 if(preg_match(
'/^xml$/i', $key))
continue;
266 if (is_numeric($key)) {
271 $object_xml .=
'<'.$key.
' />';
273 $object_xml .=
'<'.$key.
'>';
274 if (is_array($value) || is_object($value)) {
275 $object_xml .= self::objectToXML($value);
277 $object_xml .=
'<![CDATA['.$value.
']]>';
279 $object_xml .=
'</'.$key.
'>';
282 if (is_object($object)) {
283 $root_element_name = get_class($object);
284 $object_xml =
'<'.$root_element_name.
'>'.$object_xml.
'</'.$root_element_name.
'>';
308 $request_info = (Array) $request;
309 $assetid = array_get_index($request_info,
'AssetID',
'');
310 $root_path_id = array_get_index($request_info,
'RootPathAssetID',
'');
312 if (!empty($assetid)) {
313 if (!empty($root_path_id)) {
314 $root_path_url = $GLOBALS[
'SQ_SYSTEM']->am->getAssetURL($root_path_id);
315 $assetUrls = $GLOBALS[
'SQ_SYSTEM']->am->getAssetURL($assetid, $root_path_url);
317 'GetAssetURLsResult' => Array($assetUrls),
320 $urls_info = $GLOBALS[
'SQ_SYSTEM']->am->getURLs($assetid);
322 foreach ($urls_info as $info) {
324 if ($info[
'http'] ==
'1') {
325 $urls[] =
'http://'.$info[
'url'];
327 if ($info[
'https'] ==
'1') {
328 $urls[] =
'https://'.$info[
'url'];
332 'GetAssetURLsResult' => $urls,
336 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
358 $request_info = (Array) $request;
359 $url = array_get_index($request_info,
'URL',
'');
361 $pattern =
'#(http://|https://|^)#';
362 $url_split = preg_split($pattern, $url, -1, PREG_SPLIT_DELIM_CAPTURE);
363 $protocol = rtrim($url_split[1],
'://');
364 $main_url = $url_split[2];
366 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAssetFromURL($protocol, $main_url, TRUE, TRUE);
368 if (!is_null($asset)) {
369 $asset_xml = self::objectToXML($asset);
372 'GetAssetFromURLResult' => $asset_xml,
375 throw new SoapFault(
'Server',
'The URL must not be empty');
397 $request_info = (Array) $request;
398 $assetid = array_get_index($request_info,
'AssetID',
'');
399 if (!empty($assetid)) {
400 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
401 $statuses = $asset->getAvailableStatii();
402 $return_statuses = Array();
404 foreach ($statuses as $status_val => $description) {
405 $return_statuses[$i][
'StatusValue'] = $status_val;
406 $return_statuses[$i][
'StatusDescription'] = $description;
411 'GetAssetAvailableStatusesResult' => $return_statuses,
414 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
438 $request_info = (Array) $request;
439 $assetid = array_get_index($request_info,
'AssetID',
'');
440 $attr_name = array_get_index($request_info,
'AttributeName',
'');
441 $attr_val = array_get_index($request_info,
'AttributeValue',
'');
442 if (!empty($assetid) && !empty($attr_name) && !empty($attr_val)) {
443 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
444 $GLOBALS[
'SQ_SYSTEM']->am->acquireLock($assetid,
'attributes');
445 $asset->setAttrValue($attr_name, $attr_val);
446 $asset->saveAttributes();
447 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($assetid,
'attributes');
449 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
450 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
451 $new_val = $asset->attr($attr_name);
454 'SetAttributeValueResult' => $new_val,
457 throw new SoapFault(
'Server',
'Please make sure to provide AssetID, AttributeName and AttributeValue');
479 $request_info = (Array) $request;
480 $assetid = array_get_index($request_info,
'AssetID',
'');
481 if (!empty($assetid)) {
482 $already_in_trash = $GLOBALS[
'SQ_SYSTEM']->am->assetInTrash($assetid, TRUE);
484 $GLOBALS[
'SQ_SYSTEM']->am->acquireLock($assetid,
'all');
485 if ($already_in_trash) {
486 throw new SoapFault(
'Server',
'Asset is already in trash');
488 $result = $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($assetid);
490 $del_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
491 $del_asset->updateLookups();
492 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($del_asset);
495 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($assetid,
'all');
498 'TrashAssetResult' => $result,
501 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
530 $request_info = (Array) $request;
531 $assetid = array_get_index($request_info,
'AssetID',
'');
532 $new_parent_id = array_get_index($request_info,
'NewParentID',
'');
533 $clone_num = array_get_index($request_info,
'NumberOfClone', 1);
534 $new_position = array_get_index($request_info,
'PositionUnderNewParent', -1);
535 $link_type = array_get_index($request_info,
'LinkType', 1);
536 if (!empty($assetid) && !empty($new_parent_id)) {
537 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
538 $running_vars = Array (
541 'number_of_clones' => 1,
544 'to_parent_assetid' => $new_parent_id,
545 'to_parent_pos' => $new_position,
546 'link_type' => $link_type,
550 $all_errors = Array();
551 for ($i = 0; $i < $clone_num; $i++) {
553 $running_vars_copy = $running_vars;
554 $errors = $hh->freestyleHipo(
'hipo_job_clone_assets', $running_vars_copy);
556 $all_errors += $errors;
558 if (empty($all_errors)) {
559 $result =
'Asset Cloned';
561 'CloneAssetResult' => $result,
564 throw new SoapFault(
'Server',
'Unable To Clone Asset');
568 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
591 $request_info = (Array) $request;
592 $type_code = array_get_index($request_info,
'TypeCode',
'');
593 $details = array_get_index($request_info,
'AttributeDetail', Array (
'name',
'type'));
595 if (!is_array($details)) $details = Array($details);
597 if (!in_array(
'name', $details)) {
598 array_unshift($details,
'name');
600 if (count($details) == 1){
601 $details = Array (
'name',
'type');
602 }
else if ($details[0] !=
'name'){
603 $details = array_diff($details, Array(
'name'));
604 array_unshift($details,
'name');
608 if (!empty($type_code)) {
609 $attribute_details = $GLOBALS[
'SQ_SYSTEM']->am->getAssetTypeAttributes($type_code, $details);
611 $final_attribute_results = Array();
612 foreach ($attribute_details as $attribute_name => $attribute_type_info) {
613 $final_attribute_results[$i][
'AttributeName'] = $attribute_name;
614 if (isset($attribute_type_info[
'attrid'])) {
615 $final_attribute_results[$i][
'AttributeID'] = $attribute_type_info[
'attrid'];
617 if (isset($attribute_type_info[
'type_code'])) {
618 $final_attribute_results[$i][
'AttributeTypeCode'] = $attribute_type_info[
'type_code'];
620 if (isset($attribute_type_info[
'type'])) {
621 $final_attribute_results[$i][
'AttributeType'] = $attribute_type_info[
'type'];
623 if (isset($attribute_type_info[
'owning_type_code'])) {
624 $final_attribute_results[$i][
'AttributeOwningTypeCode'] = $attribute_type_info[
'owning_type_code'];
626 if (isset($attribute_type_info[
'parameters_type_code'])) {
627 $final_attribute_results[$i][
'AttributeParametersTypeCode'] = $attribute_type_info[
'parameters_type_code'];
629 if (isset($attribute_type_info[
'parameters_val'])) {
630 $final_attribute_results[$i][
'AttributeParametersValue'] = $attribute_type_info[
'parameters_val'];
632 if (isset($attribute_type_info[
'default_type_code'])) {
633 $final_attribute_results[$i][
'AttributeDefaultTypeCode'] = $attribute_type_info[
'default_type_code'];
635 if (isset($attribute_type_info[
'default_val'])) {
636 $final_attribute_results[$i][
'AttributeDefaultValue'] = $attribute_type_info[
'default_val'];
638 if (isset($attribute_type_info[
'description'])) {
639 $final_attribute_results[$i][
'AttributeDescription'] = $attribute_type_info[
'description'];
641 if (isset($attribute_type_info[
'is_admin'])) {
642 $final_attribute_results[$i][
'AttributeIsAdmin'] = $attribute_type_info[
'is_admin'];
644 if (isset($attribute_type_info[
'uniq'])) {
645 $final_attribute_results[$i][
'AttributeUnique'] = $attribute_type_info[
'uniq'];
651 'GetAssetTypeAttributeResult' => $final_attribute_results,
654 throw new SoapFault(
'Server',
'Type code is not valid. Please provide a valid type code');
667 $request_info = (Array) $request;
668 $typecode = array_get_index($request_info,
'TypeCode',
'');
669 if (!empty($typecode)) {
670 $descendantTypes = $GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants($typecode);
673 'GetAssetTypeDescendantsResult' => $descendantTypes,
676 throw new SoapFault(
'Server',
'TypeCode is not valid. Please provide a valid TypeCode');
690 $request_info = (Array) $request;
691 $assetids = array_get_index($request_info,
'AssetIDs',
'');
692 $attr_names = array_get_index($request_info,
'FinderAttributes',
'');
693 $root_assetid = array_get_index($request_info,
'RootNode',
'');
695 if (!is_array($attr_names)) {
696 $attr_names = Array($attr_names);
698 if (!is_array($assetids)) {
699 $assetids = Array($assetids);
702 if (!empty($assetids) && !empty($attr_names)) {
703 $assetsInfo = Array();
704 if (in_array(
'children', $attr_names) === TRUE) {
705 foreach ($assetids as $assetid) {
706 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($assetid, SQ_SC_LINK_BACKEND_NAV,
'', TRUE,
'major', NULL, NULL, NULL,
'sort_order');
707 $assetsInfo[$assetid][
'AssetChildren'] = Array();
708 foreach ($links as $link_info) {
709 $assetsInfo[$assetid][
'AssetChildren'][] = $link_info[
'minorid'];
714 $type_codes_ancestor = array();
716 $info_results = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($assetids);
717 foreach ($info_results as $assetid => $result) {
718 if (in_array(
'lineage', $attr_names) === TRUE) {
720 if (!empty($root_assetid)) {
721 $root_links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($root_assetid, SQ_LINK_TYPE_1,
'', TRUE,
'minor');
722 foreach($root_links as $link) {
723 $treeid_info = $GLOBALS[
'SQ_SYSTEM']->am->getLinkTreeid($link[
'linkid']);
724 $treeid = $treeid_info[$link[
'linkid']][0];
725 $treeids[] = $treeid;
729 $lineages = $GLOBALS[
'SQ_SYSTEM']->am->getLinkLineages($assetid, 0, $treeids);
730 $lineages_result = array();
731 foreach ($lineages as $lineage_info) {
732 $lineage_details = array();
733 $lineage_details[
'LinkID'] = $lineage_info[
'linkid'];
734 $lineage_details[
'LinkType'] = $lineage_info[
'link_type'];
736 foreach ($lineage_info[
'lineage'] as $parentid => $parent_name) {
737 $one_lineage = array();
738 $one_lineage[
'AssetID'] = $parentid;
739 $one_lineage[
'AssetName'] = $parent_name;
740 $one_lineage[
'Order'] = $order;
741 $lineage_details[
'Lineage'][] = $one_lineage;
745 $lineages_result[] = $lineage_details;
747 $assetsInfo[$assetid][
'AssetLineage'] = $lineages_result;
750 if (isset($type_codes_ancestor[$result[
'type_code']]) === TRUE) {
751 $ancestor = $type_codes_ancestor[$result[
'type_code']];
753 $ancestor = array_pop($GLOBALS[
'SQ_SYSTEM']->am->getTypeAncestors($result[
'type_code'], FALSE));
754 $type_codes_ancestor[$result[
'type_code']] = $ancestor;
757 $assetsInfo[$assetid][
'AssetType'] = $result[
'type_code'];
758 $assetsInfo[$assetid][
'AssetTypeAncestor'] = $ancestor;
760 $assetsInfo[$assetid][
'AssetName'] = $result[
'name'];
761 if ($ancestor !==
'file') {
762 if (isset($result[
'short_name']) === TRUE) {
763 $assetsInfo[$assetid][
'AssetName'] = $result[
'short_name'];
767 $assetsInfo[$assetid][
'AssetID'] = $assetid;
771 'GetAssetsInfoResult' => array_values($assetsInfo),
774 throw new SoapFault(
'Server',
'Please provide assetids and finder attributes.');
797 $request_info = (Array) $request;
798 $assetid = array_get_index($request_info,
'AssetID',
'');
799 $type_code = array_get_index($request_info,
'TypeCode',
'');
801 if (!empty($assetid) || !empty($type_code)) {
802 if(!empty($assetid)) {
803 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
804 $keywords = $asset->getAvailableKeywords();
806 else if (!empty($type_code)) {
807 $object_name = str_replace(
' ',
'_', ucwords(str_replace(
'_',
' ', $type_code)));
808 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset($object_name);
809 $dummy_asset =
new $object_name();
810 $keywords = $dummy_asset->getAvailableKeywords();
815 'GetAssetAvailableKeywordsResult' => array_keys($keywords),
818 throw new SoapFault(
'Server',
'Asset ID or Type Code is not valid. Please provide a valid Asset ID or Type Code');
840 $request_info = (Array) $request;
841 $assetid = array_get_index($request_info,
'AssetID',
'');
842 if (!empty($assetid)) {
843 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
844 $web_path = $asset->getWebPaths();
846 'GetAssetWebPathsResult' => $web_path,
849 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
863 $request_info = (Array) $request;
864 $assetid = array_get_index($request_info,
'AssetID',
'');
865 $root_path_id = array_get_index($request_info,
'RootNodeID',
'');
866 if (!empty($assetid)) {
867 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
868 $descendantTypes = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAncestors($asset->type());
869 if (in_array(
'page', $descendantTypes)) {
870 $root_path_url = $GLOBALS[
'SQ_SYSTEM']->am->getAssetURL($root_path_id);
871 $pro_asset_url = $GLOBALS[
'SQ_SYSTEM']->am->getAssetURL($assetid, $root_path_url);
872 $asset_url = preg_replace(
'/http[s]?:\/\//i',
'', $pro_asset_url);
873 $web_paths = $asset->getWebPaths();
874 $final_path = array_pop($web_paths);
875 foreach ($web_paths as $path) {
876 $pattern =
'/\/'.$path.
'$/';
877 preg_match($pattern, $url, $matches);
878 if (!empty($matches)) {
884 $layout_id = $GLOBALS[
'SQ_SYSTEM']->am->getValueFromURL($asset_url,
'paint_layout::system::frontend');
886 $asset->printBodyWithPaintLayout($layout_id);
887 $content = ob_get_contents();
891 $GLOBALS[
'SQ_SYSTEM']->replaceKeyword($content);
893 'PageContent' => $content,
894 'PageURL' => $pro_asset_url,
895 'PageWebPath' => $final_path,
898 throw new SoapFault(
'Server',
'This asset is not of type page');
902 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
926 $request_info = (Array) $request;
927 $assetids = array_get_index($request_info,
'AssetIDs',
'');
928 $attr_name = array_get_index($request_info,
'AttributeName',
'');
929 $type_code = array_get_index($request_info,
'TypeCode',
'');
930 if (!empty($assetids) && !empty($attr_name) && !empty($type_code)) {
931 if (is_string($assetids) === TRUE) $assetids = array($assetids);
932 $attribute_values = $GLOBALS[
'SQ_SYSTEM']->am->getAttributeValuesByName($attr_name, $type_code, $assetids);
933 $final_attribute_values = Array();
935 foreach ($attribute_values as $assetid => $attribute_value) {
936 $final_attribute_values[$i][
'AssetID'] = $assetid;
937 $final_attribute_values[$i][
'AttributeValue'] = $attribute_value;
941 'GetAttributeValuesByNameResult' => $final_attribute_values,
944 throw new SoapFault(
'Server',
'Make sure to provide AssetIDs, Attribute Name, and Asset Type Code');
970 $request_info = (Array) $request;
971 $assetid = array_get_index($request_info,
'AssetID',
'');
972 $thesaurus_id = array_get_index($request_info,
'ThesaurusID',
'');
973 $tag_name = array_get_index($request_info,
'TagName',
'');
974 $weight = array_get_index($request_info,
'Weight',
'1');
975 $cascade = array_get_index($request_info,
'CascadeTagChange', 0);
976 if (!empty($assetid)) {
977 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
978 $tag_manager = $GLOBALS[
'SQ_SYSTEM']->getTagManager();
979 $restrict_tag_source = $tag_manager->attr(
'restrict_tag_source');
980 $tagging_thesaurus = $tag_manager->attr(
'thesaurus');
981 if ($restrict_tag_source) {
982 if ($thesaurus_id != $tagging_thesaurus) {
983 throw new SoapFault(
'Server',
'Tag Source Restriction is enabled. The provided thesaurus can not be used to tag.');
987 $thesaurus = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($thesaurus_id);
988 $tag_id = $thesaurus->getTermIdByName($tag_name);
991 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
993 $tag_vars[] = Array (
994 'tag_id' => $thesaurus_id.
':'.$tag_id,
1000 $asset->id => Array (
1001 'type_code' => $asset->type(),
1004 'tag_changes' => $tag_vars,
1006 $errors = $hh->freestyleHipo(
'hipo_job_edit_tags', $vars);
1008 $errors = $tag_manager->setTag($assetid, $thesaurus_id.
':'.$tag_id, $weight);
1009 if ($errors) $errors = NULL;
1012 if (empty($errors)) {
1014 'SetTagResult' => TRUE,
1017 throw new SoapFault(
'Server',
'Unable to tag asset');
1020 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
1037 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
1038 $status_names = get_status_names();
1039 $return_statuses = Array();
1041 foreach ($status_names as $status_val => $description) {
1042 $return_statuses[$i][
'StatusValue'] = $status_val;
1043 $return_statuses[$i][
'StatusDescription'] = $description;
1047 'GetAllStatusesResult' => $return_statuses,
1063 $request_info = (Array) $request;
1064 $username = array_get_index($request_info,
'Username',
'');
1065 $password = array_get_index($request_info,
'Password',
'');
1067 $auth_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'authentication_folder');
1068 if (is_null($auth_folder)) {
1069 trigger_localised_error(
'SYS0249', E_USER_ERROR);
1072 $auth_systems = $auth_folder->getAuthSystems();
1075 $user_status = NULL;
1076 foreach ($auth_systems as $systemid) {
1077 $system = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($systemid);
1078 if (is_null($system))
continue;
1079 $user = $system->authenticateUser($username, $password);
1080 if (!is_null($user)) $user_status = $user->status;
1083 if (!is_null($user) && $user->canLogin()) {
1084 $GLOBALS[
'SQ_SYSTEM']->loginUser($user);
1090 if ($user === NULL) {
1099 $session_id = session_id();
1100 $session_key = $GLOBALS[
'SQ_SYSTEM']->getUniqueSOAPSessionKey();
1101 $_SESSION[
'activated'] = 0;
1104 'SessionID' => $session_id,
1105 'SessionKey' => $session_key,
1121 $request_info = (Array) $request;
1122 $username = array_get_index($request_info,
'Username',
'');
1124 $auth_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'authentication_folder');
1125 if (is_null($auth_folder)) {
1126 trigger_localised_error(
'SYS0249', E_USER_ERROR);
1129 $auth_systems = $auth_folder->getAuthSystems();
1133 foreach ($auth_systems as $systemid) {
1134 $system = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($systemid);
1135 if (is_null($system))
continue;
1137 $user = $system->locateUser($username);
1138 if (!is_null($user))
break;
1142 if (is_null($user)) {
1145 $assetid = $user->id;
1148 return Array(
'AssetID' => $assetid);
1171 $request_info = (Array) $request;
1172 $assetid = array_get_index($request_info,
'AssetID',
'');
1173 $status = array_get_index($request_info,
'StatusValue',
'');
1174 $dependants_only = array_get_index($request_info,
'DependantsOnly', TRUE);
1176 if (!empty($assetid)) {
1177 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
1178 $statuses = $asset->getAvailableStatii();
1180 if(!isset($statuses[$status])) {
1181 throw new SoapFault(
'Server', $status.
' is not a valid status of the asset');
1184 $running_vars = Array (
1185 'assetid' => $assetid,
1186 'new_status' => $status,
1187 'dependants_only' => $dependants_only,
1190 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
1191 $errors = $hh->freestyleHipo(
'hipo_job_edit_status', $running_vars);
1192 if (empty($errors)) {
1194 'SetAssetStatusResult' => TRUE,
1197 throw new SoapFault(
'Server',
'Unable to set asset status');
1200 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
1222 $request_info = (Array) $request;
1223 $assetid = array_get_index($request_info,
'AssetID',
'');
1224 if (!empty($assetid)) {
1225 $path = array_get_index($request_info,
'Path', Array());
1226 if(!is_array($path)) $path = Array($path);
1227 $addRemaps = array_get_index($request_info,
'AddRemaps', TRUE);
1229 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
1230 $result = $asset->saveWebPaths($path, $addRemaps);
1232 'SetAssetWebPathsResult' => $result,
1235 throw new SoapFault(
'Server',
'Asset ID is not valid. Please provide a valid Asset ID');
1249 $asset_type = self::getArgType(
'AssetType', 1, 1);
1250 $asset_types = self::getArgType(
'AssetType', 0,
'unbounded');
1251 $attribute_info = self::getArgType(
'AttributeInfo', 0,
'unbounded', TRUE);
1252 $attribute_detail = self::getArgType(
'AttributeDetail', 0,
'unbounded', TRUE);
1253 $attribute_properties = self::getArgType(
'AttributeProperty', 0,
'unbounded', TRUE);
1254 $attribute_values_by_name_result = self::getArgType(
'AttributeValueInfo', 0,
'unbounded', TRUE);
1255 $keywords = self::$string_optional_unbounded;
1256 $statuses_des_val = self::getArgType(
'StatusDescription', 0,
'unbounded', TRUE);
1257 $asset_finder_info = self::getArgType(
'AssetFinderInfo', 0,
'unbounded', TRUE);
1258 $urls = self::$string_optional_unbounded;
1259 $link_type = self::getArgType(
'LinkType', 0, 1);
1260 $asset_info = self::getArgType(
'AssetInfo', 0, 1);
1262 $complex_types = Array (
1263 'CreateAsset' => Array (
1264 'CreateAsset' => Array (
1265 'TypeCode' => $asset_type,
1266 'Name' => self::$string_optional,
1267 'ParentID' => self::$string_non_optional,
1268 'LinkType' => $link_type,
1269 'LinkValue' => self::$string_optional,
1270 'SortOrder' => self::$int_optional,
1271 'IsDependant' => self::$string_optional,
1272 'IsExclusive' => self::$string_optional,
1273 'FileName' => self::$string_optional,
1274 'FileContentBase64' => self::$string_optional,
1275 'AttributeInfo' => $attribute_info,
1277 'CreateAssetResponse' => Array (
1278 'NewAssetID' => self::$string_optional,
1279 'CreateMessage' => self::$string_optional,
1282 'GetAsset' => Array (
1283 'GetAsset' => Array (
1284 'AssetID' => self::$string_non_optional,
1286 'GetAssetResponse' => Array (
1287 'GetAssetResult' => self::$string_optional,
1290 'GetAssetURLs' => Array (
1291 'GetAssetURLs' => Array (
1292 'AssetID' => self::$string_non_optional,
1293 'RootPathAssetID' => self::$string_optional,
1295 'GetAssetURLsResponse' => Array (
1296 'GetAssetURLsResult'=> $urls,
1299 'GetAssetFromURL' => Array (
1300 'GetAssetFromURL' => Array (
1301 'URL' => self::$string_non_optional,
1303 'GetAssetFromURLResponse'=> Array (
1304 'GetAssetFromURLResult' => self::$string_optional,
1307 'GetAssetAvailableStatuses' => Array (
1308 'GetAssetAvailableStatuses' => Array (
1309 'AssetID' => self::$string_non_optional,
1311 'GetAssetAvailableStatusesResponse'=> Array (
1312 'GetAssetAvailableStatusesResult' => $statuses_des_val,
1315 'SetAttributeValue' => Array (
1316 'SetAttributeValue' => Array (
1317 'AssetID' => self::$string_non_optional,
1318 'AttributeName' => self::$string_non_optional,
1319 'AttributeValue' => self::$string_non_optional,
1321 'SetAttributeValueResponse'=> Array (
1322 'SetAttributeValueResult' => self::$string_optional,
1325 'TrashAsset' => Array (
1326 'TrashAsset' => Array (
1327 'AssetID' => self::$string_non_optional,
1329 'TrashAssetResponse' => Array (
1330 'TrashAssetResult' => self::$boolean_optional,
1333 'CloneAsset' => Array (
1334 'CloneAsset' => Array (
1335 'AssetID' => self::$string_non_optional,
1336 'NewParentID' => self::$string_non_optional,
1337 'NumberOfClone' => self::$int_optional,
1338 'PositionUnderNewParent'=> self::$int_optional,
1339 'LinkType' => $link_type,
1341 'CloneAssetResponse' => Array (
1342 'CloneAssetResult' => self::$string_optional,
1345 'GetAssetTypeAttribute' => Array (
1346 'GetAssetTypeAttribute' => Array (
1347 'TypeCode' => $asset_type,
1348 'AttributeDetail' => $attribute_detail,
1350 'GetAssetTypeAttributeResponse'=> Array (
1351 'GetAssetTypeAttributeResult' => $attribute_properties,
1354 'GetAssetTypeDescendants' => Array (
1355 'GetAssetTypeDescendants' => Array (
1356 'TypeCode' => $asset_type,
1358 'GetAssetTypeDescendantsResponse'=> Array (
1359 'GetAssetTypeDescendantsResult' => $asset_types,
1362 'GetAssetsInfo' => Array (
1363 'GetAssetsInfo' => Array (
1364 'AssetIDs' => self::$string_optional_unbounded,
1365 'FinderAttributes' => self::$string_optional_unbounded,
1366 'RootNode' => self::$string_optional,
1368 'GetAssetsInfoResponse' => Array (
1369 'GetAssetsInfoResult' => $asset_finder_info,
1372 'GetAssetAvailableKeywords' => Array (
1373 'GetAssetAvailableKeywords' => Array (
1374 'AssetID' => self::$string_optional,
1375 'TypeCode' => self::getArgType(
'AssetType', 0, 1),
1377 'GetAssetAvailableKeywordsResponse'=> Array (
1378 'GetAssetAvailableKeywordsResult' => $keywords,
1381 'GetAttributeValuesByName' => Array (
1382 'GetAttributeValuesByName' => Array (
1383 'AssetIDs' => self::$string_optional_unbounded,
1384 'TypeCode' => $asset_type,
1385 'AttributeName' => self::$string_non_optional,
1387 'GetAttributeValuesByNameResponse'=> Array (
1388 'GetAttributeValuesByNameResult' => $attribute_values_by_name_result,
1392 'GetAssetWebPaths' => Array (
1393 'GetAssetWebPaths' => Array (
1394 'AssetID' => self::$string_non_optional,
1396 'GetAssetWebPathsResponse'=> Array (
1397 'GetAssetWebPathsResult' => self::$string_optional_unbounded,
1402 'AssetID' => self::$string_non_optional,
1403 'ThesaurusID' => self::$string_non_optional,
1404 'TagName' => self::$string_non_optional,
1405 'Weight' => self::$string_optional,
1406 'CascadeTagChange'=> self::$string_optional,
1408 'SetTagResponse' => Array (
1409 'SetTagResult' => self::$boolean_optional,
1412 'GetAllStatuses' => Array (
1413 'GetAllStatuses' => Array (
1416 'GetAllStatusesResponse' => Array (
1417 'GetAllStatusesResult' => $statuses_des_val,
1420 'SetAssetStatus' => Array (
1421 'SetAssetStatus' => Array (
1422 'AssetID' => self::$string_non_optional,
1423 'StatusValue' => self::$string_non_optional,
1424 'DependantsOnly' => self::$boolean_optional,
1426 'SetAssetStatusResponse' => Array (
1427 'SetAssetStatusResult' => self::$boolean_optional,
1430 'GetPageContents' => Array (
1431 'GetPageContents' => Array (
1432 'AssetID' => self::$string_non_optional,
1433 'RootNodeID' => self::$string_optional,
1435 'GetPageContentsResponse'=> Array (
1436 'PageContent' => self::$string_non_optional,
1437 'PageURL' => self::$string_optional,
1438 'PageWebPath' => self::$string_optional,
1441 'LoginUser' => Array (
1442 'LoginUser' => Array (
1443 'Username' => self::$string_non_optional,
1444 'Password' => self::$string_non_optional,
1446 'LoginUserResponse'=> Array (
1447 'SessionID' => self::$string_non_optional,
1448 'SessionKey' => self::$string_non_optional,
1451 'GetUserIdByUsername' => Array (
1452 'GetUserIdByUsername' => Array (
1453 'Username' => self::$string_non_optional,
1455 'GetUserIdByUsernameResponse'=> Array (
1456 'AssetID' => self::$string_non_optional,
1459 'SetAssetWebPaths' => Array (
1460 'SetAssetWebPaths' => Array (
1461 'AssetID' => self::$string_non_optional,
1462 'Path' => self::$string_optional_unbounded,
1463 'AddRemaps' => self::$boolean_optional,
1465 'SetAssetWebPathsResponse'=> Array (
1466 'SetAssetWebPathsResult' => self::$boolean_optional,
1471 $complex_types_available = parent::getComplexElements($complex_types);
1473 return $complex_types_available;
1487 $lineages_details = self::getArgType(
'LineagesDetails', 0,
'unbounded');
1488 $lineage = self::getArgType(
'Lineage', 0,
'unbounded');
1489 $complex_types = Array (
1490 'CreateAsset' => Array (
1491 'AttributeInfo' => Array (
1492 'AttributeName' => self::$string_non_optional,
1493 'AttributeValue' => self::$string_non_optional,
1496 'GetAllStatuses' => Array (
1497 'StatusDescription' => Array (
1498 'StatusValue' => self::$string_optional,
1499 'StatusDescription' => self::$string_optional,
1502 'GetAttributeValuesByName' => Array (
1503 'AttributeValueInfo' => Array (
1504 'AssetID' => self::$string_non_optional,
1505 'AttributeValue' => self::$string_optional,
1508 'GetAssetTypeAttribute' => Array (
1509 'AttributeProperty' => Array (
1510 'AttributeName' => self::$string_non_optional,
1511 'AttributeID' => self::$string_optional,
1512 'AttributeType' => self::$string_optional,
1513 'AttributeOwningTypeCode' => self::$string_optional,
1514 'AttributeParametersTypeCode' => self::$string_optional,
1515 'AttributeParametersValue' => self::$string_optional,
1516 'AttributeDefaultTypeCode' => self::$string_optional,
1517 'AttributeDefaultValue' => self::$string_optional,
1518 'AttributeDescription' => self::$string_optional,
1519 'AttributeIsAdmin' => self::$boolean_optional,
1520 'AttributeUnique' => self::$boolean_optional,
1523 'GetAssetsInfo' => Array (
1524 'AssetFinderInfo' => Array (
1525 'AssetID' => self::$string_non_optional,
1526 'AssetType' => self::$string_optional,
1527 'AssetTypeAncestor' => self::$string_optional,
1528 'AssetName' => self::$string_optional,
1529 'AssetChildren' => self::$string_optional_unbounded,
1530 'AssetLineage' => $lineages_details,
1532 'LineagesDetails' => Array (
1533 'LinkID' => self::$string_non_optional,
1534 'LinkType' => self::$string_non_optional,
1535 'Lineage' => $lineage,
1537 'Lineage' => Array (
1538 'AssetID' => self::$string_non_optional,
1539 'AssetName' => self::$string_non_optional,
1540 'Order' => self::$int_non_optional,
1545 $complex_types_available = parent::getComplexElements($complex_types);
1547 return $complex_types_available;
1560 $asset_types_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetTypes(TRUE, TRUE);
1561 $asset_types = Array();
1562 foreach ($asset_types_info as $asset_type_info) {
1563 $asset_types[] = $asset_type_info[
'type_code'];
1566 $asset_status = Array (
1568 SQ_STATUS_UNDER_CONSTRUCTION,
1569 SQ_STATUS_PENDING_APPROVAL,
1572 SQ_STATUS_LIVE_APPROVAL,
1574 SQ_STATUS_EDITING_APPROVAL,
1575 SQ_STATUS_EDITING_APPROVED,
1578 $attribute_details = Array (
1585 'parameters_type_code',
1587 'default_type_code',
1593 $common_types = Array (
1594 'LinkType' => Array (
1595 'restriction_base' =>
'string',
1596 'enumeration' => Array (
1603 $simple_restricted_types = Array (
1604 'CreateAsset' => Array (
1605 'AssetType' => Array (
1606 'restriction_base' =>
'string',
1607 'enumeration' => $asset_types,
1609 'CreditCardNumber' => Array (
1610 'restriction_base' =>
'string',
1611 'pattern' =>
'\d{3}-\d{2}-\d{4}',
1613 'LinkType' => $common_types[
'LinkType'],
1615 'CreateLink' => Array (
1616 'LinkType' => $common_types[
'LinkType'],
1618 'GetAssetTypeAttribute' => Array (
1619 'AttributeDetail' => Array (
1620 'restriction_base' =>
'string',
1621 'enumeration' => $attribute_details,
1624 'SetAssetStatus' => Array (
1625 'StatusValue' => Array (
1626 'restriction_base' =>
'string',
1627 'enumeration' => $asset_status,
1632 $simple_restricted_types_available = parent::processSimpleRestrictedTypes($simple_restricted_types);
1634 return $simple_restricted_types_available;