16 require_once SQ_CORE_PACKAGE_PATH.
'/page/page_edit_fns.inc';
38 parent::__construct();
55 $current_rss_links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($asset->id, SQ_LINK_NOTICE,
'listing_engine', FALSE,
'major',
'generate_rss');
57 foreach ($current_rss_links as $i => $link) {
58 $rss_links[$link[
'minorid']] = $link[
'minor_type_code'];
60 $wa = $asset->writeAccess(
'attributes');
62 multiple_asset_finder($prefix.
'_listing_engines', array_keys($rss_links), Array(
'listing_engine' =>
'D'));
65 $infos = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo(array_keys($rss_links));
67 <table
class=
"sq-backend-table">
69 <td
class=
"sq-backend-table-header"><?php echo translate(
'asset') ?></td>
70 <td
class=
"sq-backend-table-header"><?php echo translate(
'type') ?></td>
73 foreach ($infos as $assetid => $info) {
76 <td
class=
"sq-backend-table-cell"><?php echo get_asset_tag_line($assetid) ?></td>
77 <td
class=
"sq-backend-table-cell"><?php echo $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($info[
'type_code'],
'name') ?></td>
102 if (isset($_POST[$prefix.
'_listing_engines'])) {
103 $listings = $_POST[$prefix.
'_listing_engines'];
104 $listing_ids = Array();
105 foreach ($listings as $listing) {
106 if (!empty($listing[
'assetid'])) {
107 $listing_ids[] = $listing[
'assetid'];
110 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($asset->id, SQ_LINK_NOTICE,
'listing_engine', FALSE,
'major',
'generate_rss');
111 $existing_list_ids = Array();
112 foreach ($links as $link) {
113 if (!in_array($link[
'minorid'], $listing_ids)) {
114 $asset->deleteLink($link[
'linkid']);
116 $existing_list_ids[] = $link[
'minorid'];
119 foreach ($listing_ids as $listing_id) {
120 if (!in_array($listing_id, $existing_list_ids)) {
121 $listing_engine = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($listing_id);
122 $id = $asset->createLink($listing_engine, SQ_LINK_NOTICE,
'generate_rss');
143 $rss_source_links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($asset->id, SQ_LINK_NOTICE,
'listing_engine', FALSE,
'major',
'generate_rss');
144 if (!empty($rss_source_links)) {
146 foreach ($rss_source_links as $links) {
147 $listing_engine = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($links[
'minorid']);
148 $attribute_types = array_keys($listing_engine->attr(
'types'));
149 if (!empty($attribute_types)) {
150 foreach ($attribute_types as $type) {
151 if (!isset($keywords[$type])) {
152 $keywords[$type] = $asset->_getAvailableKeywordsOfType($type);
154 $types[$type] = $type;
158 $types[
'select'] = translate(
'select_asset_type');
159 $wa = $asset->writeAccess(
'attributes');
163 if (isset($_POST[
'asset_type']) && ($_POST[
'asset_type'] !=
'select')) {
164 $type = $_POST[
'asset_type'];
166 if (isset($_POST[$prefix.
'_tag']) && !empty($_POST[$prefix.
'_tag'])) {
167 $tag = $_POST[$prefix.
'_tag'];
172 <table
class=
"sq-backend-table">
174 <td> <?php echo translate(
'choose_asset_type');?></td>
177 combo_box(
'asset_type', $types, FALSE, !empty($type)? $type:
'select');
184 $keywords[
'select'] = translate(
'select_keyword');
187 if (isset($_POST[$prefix.
'_keyword']) && ($_POST[$prefix.
'_keyword'] !=
'select')) {
188 $keyword = $_POST[$prefix.
'_keyword'];
193 <td><?php echo translate(
'choose_or_enter_keyword');?></td>
196 combo_box($prefix.
'_keyword', $keywords[$type], FALSE, !empty($keyword)? $keyword:
'select');
201 text_box($prefix.
'_keyword_text',
'');
206 $type = $asset->attr(
'rss_types');
208 if ($type ==
'rss_1.0') {
209 $tags = Array(
'title',
'description',
'link',
'rdf:about');
210 }
else if ($type ==
'rss_2.0') {
211 $tags = Array(
'title',
'description',
'link',
'pubDate',
'category',
'author',
'comments',
'guid',
'enclosure.url',
'enclosure.length',
'enclosure.type');
215 $tags = Array(
'id',
'title',
'updated',
'author_name',
'author_email',
'author_uri',
'content',
'link.rel',
'link.href',
'summary',
'category.term',
'contributor_name',
'contributor_email',
'contributor_uri',
'source_id',
'source_title',
'source_updated',
'source_rights',
'rights');
217 foreach ($tags as $key => $val) {
218 $tags[$val] = strpos($val,
'_') !== FALSE? str_replace(
'_',
' ', $val): (strpos($val,
'.') !== FALSE? str_replace(
'.',
' ', $val).
' = ':$val);
223 <td><?php echo translate(
'choose_tag');?></td>
226 combo_box($prefix.
'_tag', $tags, FALSE, !empty($tag)? $tag:
'');
240 echo
'No Listing Engine Assets Have Been Selected To Generate The RSS';
259 if (isset($_POST[$prefix.
'_tag']) && !empty($_POST[$prefix.
'_tag'])) {
260 $type = $_POST[
'asset_type'];
261 if ($type !=
'select') {
262 $tag = $_POST[$prefix.
'_tag'];
264 if (empty($_POST[$prefix.
'_keyword_text'])) {
265 $keyword = $_POST[$prefix.
'_keyword'];
267 $keyword = $_POST[$prefix.
'_keyword_text'];
269 $items = $asset->attr(
'items');
270 $items[$type][$tag] = $keyword;
271 $asset->setAttrValue(
'items', $items);
292 $items = $asset->attr(
'items');
293 $wa = $asset->writeAccess(
'attributes');
294 if (!empty($items)) {
296 <table
class=
"sq-backend-table">
298 <th><?php echo translate(
'asset_type');?></th>
299 <th><?php echo translate(
'keyword');?></th>
300 <th><?php echo translate(
'tag_represented');?></th>
304 <th><?php echo translate(
'delete_question');?></th>
310 foreach ($items as $type => $info) {
311 foreach ($info as $tag => $keyword) {
314 <td><?php echo $type;?></td>
315 <td><?php echo $keyword; ?></td>
316 <td><?php echo $tag; ?></td>
320 <td><?php check_box(
'delete_tag['.$type.
']['.$tag.
']', $keyword);?></td>
332 if ($wa)
return TRUE;
350 if (isset($_POST[
'delete_tag'])) {
351 $selected_items = $asset->attr(
'items');
352 $deleted = $_POST[
'delete_tag'];
353 foreach ($deleted as $type => $info) {
354 foreach ($info as $tag => $keyword) {
355 unset($selected_items[$type][$tag]);
360 foreach ($selected_items as $key => $value) {
361 if (empty($value)) unset($selected_items[$key]);
363 $asset->setAttrValue(
'items', $selected_items);
383 $modes = Array(
'add_channel',
'add_image');
384 foreach ($modes as $mode) {
387 $type = $asset->attr(
'rss_types');
390 if ($type ==
'rss_1.0') {
391 $tags = Array(
'title',
'link',
'description',
'rdf:about');
393 }
else if ($type ==
'rss_2.0') {
394 $required = Array(
'title',
'link',
'description');
395 $tags = Array(
'title',
'link',
'description',
'pubDate',
'lastBuildDate',
'language',
'copyright',
'webMaster',
'managingEditor',
'category',
'generator',
'ttl');
399 $required = Array(
'id',
'title',
'updated');
400 $recommended = Array(
'author_name',
'author_email',
'author_uri',
'link.rel',
'link.href');
401 $optional = Array(
'category.term',
'contributor_name',
'icon',
'logo',
'rights',
'subtitle');
402 $tags = array_merge($required, $recommended, $optional);
406 if ($type ==
'rss_1.0') {
407 $tags = Array(
'title',
'url',
'link');
408 $required = Array(
'title',
'url',
'link');
409 }
else if ($type ==
'rss_2.0') {
410 $tags = Array(
'title',
'description',
'url',
'width',
'height',
'link');
411 $required = Array(
'title',
'url',
'link');
414 $tags = Array(
'icon');
415 $required = Array(
'icon');
419 $attr = substr($mode, strlen(
'add_'));
420 $attr_val = $asset->attr($attr);
421 $wa = $asset->writeAccess(
'attributes');
423 if (!empty($attr_val) || ($wa)) {
424 echo
'<br /><b>'.translate($attr.
'_info').
'</b>';
426 <table
class=
"sq-backend-table" width=
"100%">
428 <th><?php echo translate(
'tag');?></th>
429 <th><?php echo translate(
'value');?></th>
431 if (($wa) && (in_array(
'link', $tags) || in_array(
'link.href', $tags))) {
433 <th><?php echo translate(
'link_text_value');?></th>
437 <th><?php echo translate(
'required');?></th>
440 foreach ($tags as $tag) {
443 <td><?php echo $tag; ?></td>
450 if (($tag !=
'link') && ($tag !==
'link.href')) {
451 text_box($attr.
'['.$tag.
']', isset($attr_val[$tag])? $attr_val[$tag]:
'', 30);
452 if (($wa) && (in_array(
'link', $tags) || in_array(
'link.href', $tags))) {
461 if (isset($attr_val[$tag])) {
462 if (assert_valid_assetid($attr_val[$tag],
'', TRUE, FALSE)) {
463 $id = $attr_val[$tag];
465 $url = $attr_val[$tag];
468 asset_finder($attr.
'['.$tag.
']', $id);
471 <td><?php text_box($attr.
'['.$tag.
'_text]', $url);
477 if (($tag !=
'link') && ($tag !==
'link.href')) {
478 echo isset($attr_val[$tag])? $attr_val[$tag]:
' ';
479 }
else if (isset($attr_val[$tag])) {
480 if (assert_valid_assetid($attr_val[$tag],
'', TRUE, FALSE)) {
481 $value = $GLOBALS[
'SQ_SYSTEM']->am->getAssetURL($attr_val[$tag]);
484 echo $attr_val[$tag];
495 if (!empty($required)) {
496 if (in_array($tag, $required)) {
527 $modes = Array(
'add_channel',
'add_image');
528 foreach ($modes as $mode) {
529 $attr = substr($mode, strlen(
'add_'));
530 if (isset($_POST[$attr])) {
531 $attr_val = $_POST[$attr];
533 foreach ($attr_val as $tag => $value) {
534 if ($tag ==
'link_text')
continue;
535 if (!empty($value)) {
536 if (in_array($tag, Array(
'link',
'link.href'))) {
539 if (!empty($attr_val[
'link_text'])) {
540 $value = $attr_val[
'link_text'];
542 if (empty($value[
'assetid']))
continue;
543 $value = $value[
'assetid'];
546 $new_val[$tag] = $value;
549 $asset->setAttrValue($attr, $new_val);
568 $wa = $asset->writeAccess(
'attributes');
569 if ($wa)
return TRUE;
586 $items = $asset->attr(
'items');
587 if (!empty($items))
return TRUE;