function template_edit_news()
{
    global $context, $txt, $settings, $scripturl, $ultimateportalSettings, $user_info;
    $content = '<br />
			<div style="border: 1px dashed;display:block;" width="100%">
						<strong>' . $context['news-linktree'] . '</strong>	
			</div>	
		<br />';
    $content .= '
			<div><form method="post" action="' . $scripturl . '?action=news;sa=edit-new" accept-charset="' . $context['character_set'] . '">												
								<hr />
							<div style="font-weight:bold;">' . $txt['ultport_edit_news_title'] . ': <input type="text" value="' . $context['title'] . '" name="title" size="65" maxlength="150"/></div>
							<hr />' . $txt['ultport_edit_news_section'] . '			
							<select size="1" name="id_cat">
								' . $context['section-edit'] . '
							</select><br /></div><hr />
						<div align="center"><textarea id="elm1" name="elm1">' . $context['body'] . '</textarea></div>
                      <div><input type="hidden" name="save" value="ok" />						
							<input type="hidden" name="id" value="' . $context['id'] . '" />											
							<input type="hidden" name="id_member_updated" value="' . $user_info['id'] . '" />						
							<input type="hidden" name="username_updated" value="' . $user_info['username'] . '" />	
							<input type="hidden" name="sc" value="' . $context['session_id'] . '" />
							<input type="submit" name="' . $txt['ultport_button_edit'] . '" value="' . $txt['ultport_button_edit'] . '" /></form>';
    $content .= '		
	                 	</div>';
    //The News Module Copyright - PLEASE NOT REMOVE
    $copyright = '<a href="http://www.smfsimple.com">Ultimate Portal - ' . $txt['up_module_title'] . ' ' . $txt['up_module_news_title'] . '</a> &copy; 2011 <a href="http://www.smfsimple.com">SMFSimple.com</a>';
    //Now print the module
    /*
    	This function is from Source/Subs-UltimatePortal-Init-Blocks.php
    	first parameter is left column
    	second parameter is right column
    	and the last parameter is the center column
    	the first and second parameter is "1" if the column is are not collapsed and "0" if the column print collapsed
    */
    up_print_page('1', '1', $content, $copyright, 'news', $txt['up_module_news_edit'] . ' - ' . $context['title-news']);
}
function template_edit()
{
    global $context, $txt, $scripturl, $ultimateportalSettings;
    $content .= '
	<div style="border: 1px dashed" cellpadding="5" cellspacing="1" width="100%"><strong>' . $context['news-linktree'] . '</strong></div>
	<form name="ipageform" method="post" action="' . $scripturl . '?action=internal-page;sa=edit;id=' . $context['id'] . '" accept-charset="' . $context['character_set'] . '">
		<div class="windowbg2">
			<div class="content">
				<dl class="settings">
					<dt>
						<label for="up_ipage_title">' . $txt['up_ipage_title'] . '</label>
					</dt>
					<dd>
						<input type="text" name="title" value="' . $context['title'] . '" size="50" maxlength="100" />
					</dd>
					<dt>
						<label for="ipage_column_left">' . $txt['ipage_column_left'] . '</label>
					</dt>
					<dd>
						<input type="checkbox" ' . (!empty($context['column_left']) ? 'checked="checked"' : '') . ' value="1" name="column_left" />
					</dd>
					<dt>
						<label for="ipage_column_right">' . $txt['ipage_column_right'] . '</label>
					</dt>
					<dd>
						<input type="checkbox" ' . (!empty($context['column_right']) ? 'checked="checked"' : '') . ' value="1" name="column_right" />
					</dd>
				</dl>';
    if ($context['type_ipage'] == 'html') {
        $content .= '
					<div><textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 100%">' . $context['content'] . '</textarea></div>';
    }
    //Internal Page BBC
    if ($context['type_ipage'] == 'bbc') {
        $content .= '
					<div id="' . $context['bbcBox_container'] . '"></div>
					<div id="' . $context['smileyBox_container'] . '"></div>
					' . up_template_control_richedit($context['post_box_name'], $context['smileyBox_container'], $context['bbcBox_container']) . '';
    }
    $content .= '
				<dl class="settings">
					<hr class="hrcolor clear" />
					<dt>
						<label for="up_ipage_perms">' . $txt['up_ipage_perms'] . '</label>
					</dt>
					<dd>';
    if (!empty($context['groups'])) {
        $permissionsGroups = explode(',', $context['perms']);
        foreach ($context['groups'] as $group) {
            $content .= '
							<input type="checkbox" name="perms[]" value="' . $group['id_group'] . '" id="groups_' . $group['id_group'] . '"' . (in_array($group['id_group'], $permissionsGroups) == true ? ' checked="checked" ' : '') . '/>' . $group['group_name'] . '<br />';
        }
        $content .= '
						<input type="checkbox" onclick="invertAll(this, this.form, \'perms[]\');" /> <i>' . $txt['ultport_button_select_all'] . '</i><br />';
    }
    $content .= '
					</dd>
					<hr class="hrcolor clear" />
					<dt>
						<label for="up_ipage_active">' . $txt['up_ipage_active'] . '</label>
					</dt>
					<dd>
						<input type="checkbox" ' . ($context['active'] == 'on' ? 'checked="checked"' : '') . ' value="on" name="active"/>
					</dd>
					<dt>
						<label for="up_ipage_sticky">' . $txt['up_ipage_sticky'] . '</label>
					</dt>
					<dd>
						<input type="checkbox" ' . (!empty($context['sticky']) ? 'checked="checked"' : '') . ' value="1" name="sticky"/>
					</dd>
				</dl>
				<hr class="hrcolor clear" />
				<div class="righttext">
					<input type="hidden" name="save" value="ok" />
						<input type="hidden" name="save" value="ok" />
						<input type="hidden" name="type_ipage" value="' . $context['type_ipage'] . '" />
						<input type="hidden" name="id_ipage" value="' . $context['id'] . '" />
						<input type="hidden" name="sc" value="' . $context['session_id'] . '" />
						<input type="submit" name="' . $txt['ultport_button_edit'] . '" value="' . $txt['ultport_button_edit'] . '" />
				</div>
			</div>
		</div>
	</form>';
    $copyright = '';
    $left = 0;
    $right = 0;
    if (!empty($ultimateportalSettings['ipage_active_columns'])) {
        $left = 1;
        $right = 1;
    }
    //Now Print the PAGE
    up_print_page($left, $right, $content, $copyright, 'internal-page', $txt['up_ipage_edit_title']);
}