'display_name' => 'Post this news item to a blog / publication', 'display_name_reverse_direction' => 'Manage Posts', 'description_reverse_direction' => 'Posts on this blog / publication')); relationship_find_and_update('publication_type', 'group_type', 'blog_to_authorized_posting_group', array ( 'name' => 'publication_to_authorized_posting_group', 'description' => 'publication to authorized posting group (i.e. who can post)', 'display_name_reverse_direction' => 'Blogs / Publications use this group to determine posting permissions', 'description_reverse_direction' => 'Blogs / Publications use this group to determine posting permissions')); relationship_find_and_update('publication_type', 'group_type', 'blog_to_authorized_commenting_group', array ( 'name' => 'publication_to_authorized_commenting_group', 'description' => 'publication to authorized commenting group (i.e. who can comment)', 'display_name_reverse_direction' => 'Blogs / Publications use this group to determine commenting permissions', 'description_reverse_direction' => 'Blogs / Publications use this group to determine commenting permissions')); relationship_find_and_update('issue_type', 'publication_type', 'issue_to_blog', array('name' => 'issue_to_publication', 'description' => 'Issue to Publication')); relationship_find_and_update('news_section_type', 'publication_type', 'news_section_to_blog', array('name' => 'news_section_to_publication', 'description' => 'News Section to Publication')); relationship_find_and_update('publication_type', 'news', 'blog_to_featured_post', array('name' => 'publication_to_featured_post', 'description' => 'Publication to Featured Post')); $qs = array(); $total_affected = 0; echo '<h3>Updating page types</h3>'; foreach(get_blog_to_publication_page_type_map() as $old=>$new) { $q = 'UPDATE page_node SET custom_page = "'.addslashes($new).'" WHERE page_node.custom_page = "'.addslashes($old).'"'; if($r = db_query($q, 'Problem changing '.$old.' page types to '.$new.' page types')) { $num_updated = mysql_affected_rows(); $total_affected += $num_updated; echo '<p>'.$old.' => '.$new.': '.$num_updated.' pages updated</p>'; } } if($total_affected)
die('valid Reason user required'); } if (!reason_user_has_privs($reason_user_id, 'upgrade')) { die('You must have upgrade privileges to run this script'); } $rel_data = array('connections' => 'many_to_many', 'description' => 'Places a related publication on a page', 'directionality' => 'unidirectional', 'required' => 'no', 'is_sortable' => 'yes', 'display_name' => 'Places a related publication on a page', 'display_name_reverse_direction' => 'Pages where this publication is a related publication', 'description_reverse_direction' => 'Pages where this publication is a related publication'); echo '<h2>Reason Publication Setup</h2>'; if (!isset($_POST['verify'])) { echo '<p>This script creates the page_to_related_publication allowable relationship</p>'; echo_form(); } elseif (isset($_POST['verify']) && $_POST['verify'] == 'Run') { $rel_id = create_allowable_relationship(id_of('minisite_page'), id_of('publication_type'), 'page_to_related_publication', $rel_data); if ($rel_id) { echo '<p>Allowable relationship created</p>'; } else { $test = relationship_find_and_update('minisite_page', 'publication_type', 'page_to_related_publication', $rel_data); if ($test == false) { echo '<p>Allowable relationship did not need updating</p>'; } } } else { echo_form(); } function echo_form() { echo '<form name="doit" method="post" src="' . get_current_url() . '" />'; echo '<p><input type="submit" name="verify" value="Run" /></p>'; echo '</form>'; } function relationship_find_and_update($a_type, $b_type, $name, $updates = array()) {