$form->id("id-{$val['match_id']}");
         $action_output = $form->checkbox_switch($val['active']);
         $share_list[$val['match_id'] . '||' . $row_css] = array($val['title'], $action_output);
     }
     $list->content($share_list);
     $share_output .= $list->format_content();
     $view->group_contents($share_output);
     $content_output .= $view->format_group() . '<hr />';
     unset($heading_list);
 }
 // ! Comments
 //
 if ($function_id == 3) {
     $comment_link = new GrlxLinkStyle();
     $comment_link->url('xtra.comments.ajax.php');
     $comment_link->reveal(true);
     if (isset($comments_info)) {
         $heading_list[] = array('value' => 'Your chosen service', 'class' => 'nudge');
         $heading_list[] = array('value' => 'Your ' . lcfirst($comments_info['label']), 'class' => 'nudge');
         $heading_list[] = array('value' => 'Actions', 'class' => null);
         $list->row_class('follow');
         $list->headings($heading_list);
         $comment_output = $list->format_headings();
         $vis_link = new GrlxLinkStyle();
         $vis_link->url($comments_info['url']);
         $vis_link->title('Go to ' . $comments_info['title']);
         $vis_link->action('extlink');
         $comment_link->title('Edit your user info.');
         $comment_link->action('edit');
         $comment_link->query("service_id={$comments_info['service_id']}");
         $action_output = $vis_link->icon_link() . $comment_link->icon_link();
///// Display the list
if ($book->pageList) {
    $edit_link = new GrlxLinkStyle();
    $edit_link->url('book.page-edit.php');
    $edit_link->title('Edit page info.');
    $edit_link->reveal(false);
    $edit_link->action('edit');
    $delete_link = new GrlxLinkStyle();
    $delete_link->url('book.view.php');
    $delete_link->title('Delete page.');
    $delete_link->reveal(false);
    $delete_link->action('edit');
    $marker_link = new GrlxLinkStyle();
    $marker_link->url('book.view.php');
    $marker_link->title('Remove this marker.');
    $marker_link->reveal(false);
    $marker_link->action('edit');
    //	$marker_link->tap('Remove marker');
    $heading_list[] = array('value' => 'Select', 'class' => null);
    $heading_list[] = array('value' => 'Title', 'class' => null);
    $heading_list[] = array('value' => 'Order', 'class' => null);
    if ($marker_type_list) {
        $heading_list[] = array('value' => 'Marker', 'class' => null);
    }
    $heading_list[] = array('value' => 'Actions', 'class' => null);
    $list->headings($heading_list);
    $list->draggable(false);
    $list->row_class('chapter');
    $total_shown = 0;
    // Track how many images appear on the page.
    foreach ($book->pageList as $key => $val) {
            }
        }
    }
}
/*****
 * Display logic
 */
$list->row_class('link');
$list->sort_by('link');
$list->draggable(true);
$delete_link = new GrlxLinkStyle();
$delete_link->i_only(true);
$delete_link->action('delete');
$edit_link = new GrlxLinkStyle();
$edit_link->url('site.link-edit.ajax.php');
$edit_link->reveal(true);
$edit_link->action('edit');
// Fetch the link list
$cols = array('title', 'url', 'sort_order', 'img_path', 'id');
$result = $db->orderBy('sort_order', 'ASC')->get('link_list', NULL, $cols);
if ($db->count > 0) {
    foreach ($result as $item) {
        if ($item['img_path']) {
            $icon = '<img src="' . $item['img_path'] . '" alt="icon" />';
        } else {
            $icon = '';
        }
        $delete_link->id("id-{$item['id']}");
        $action_output = $delete_link->icon_link();
        $edit_link->query("edit_id={$item['id']}");
        $action_output .= $edit_link->icon_link();
                    $page_list[$key]['preview'] .= '&hellip;';
                }
                $i++;
            }
        }
    }
}
if ($page_list) {
    $page_list_output = '<ul class="small-block-grid-2 medium-block-grid-3 large-block-grid-4">' . "\n";
    foreach ($page_list as $key => $val) {
        if ($val['edit_path'] == 1) {
            $title = urlencode($val['title']);
            $delete_link = new GrlxLinkStyle();
            $delete_link->url('sttc.page-delete.ajax.php');
            $delete_link->title('Delete this page.');
            $delete_link->reveal(true);
            $delete_link->query("id={$val['id']}&amp;title={$title}");
            $this_action = $delete_link->icon_link('delete');
        } else {
            $delete_link = new GrlxLinkStyle();
            $delete_link->i_only(true);
            $delete_link->id();
            $this_action = $delete_link->icon_link('locked');
        }
        $page_list_output .= <<<EOL
\t\t<li id="page-{$val['id']}">
\t\t<div class="page sttc">
\t\t\t<a href="sttc.xml-edit.php?page_id={$val['id']}">
\t\t\t\t<h3>{$val['title']}</h3>
\t\t\t\t<p>{$val['preview']}</p>
\t\t\t</a>
$blog_output = <<<EOL
<label for="blog_headline">Headline</label>
<input type="text" name="blog_headline" id="blog_headline" value="{$headline_output}"/>
<label for="blog_post">Post</label>
<textarea name="blog_post" id="blog_post" rows="7">{$page_info['blog_post']}</textarea>

EOL;
$transcript_output = <<<EOL
<label for="transcript">Transcript</label>
<textarea name="transcript" id="transcript" rows="7">{$page_info['transcript']}</textarea>
<button class="btn primary new" name="submit" type="submit" value="save"/><i></i>Create</button>

EOL;
$link->url('book.import.php');
$link->tap('Create multiple comic pages');
$link->reveal(false);
$action_output = $link->button_secondary('new');
//$action_output .= '<a href="#multiple">Upload multiple pics</a>'."\n";
$view->action($action_output);
$new_image = <<<EOL
<label for="file_change">Comic page image</label>
<input type="file" id="file_change" name="file_change[]" value="" multiple/>


EOL;
$content_output .= '<form accept-charset="UTF-8" action="book.page-create.php" method="post" enctype="multipart/form-data">' . "\n";
$view->group_css('page');
$view->group_h2('Image');
$view->group_instruction('Upload the graphic(s) that readers will see on this page.');
$view->group_contents($new_image);
$content_output .= $view->format_group() . "<hr/>\n";
    if (substr($theme_info['url'], 0, 7) != 'http://') {
        $theme_info['url'] = 'http://' . $theme_info['url'];
    }
    $theme_info['url'] = '<a href="' . $theme_info['url'] . '">' . $theme_info['url'] . '</a>';
}
// Output for theme meta
$meta_list = array('Description' => $theme_info['description'], 'Author' => $theme_info['author'], 'URL' => $theme_info['url'], 'Version' => $theme_info['version'], 'Installed' => $theme_info['date']);
// Add actions for this tone
if ($theme_info['user_made'] == 1) {
    $link->url($_SERVER['SCRIPT_NAME']);
    $link->query("theme_id={$theme_id}&delete_id={$tone_id}");
    $link->tap('Delete');
    $tone_action_output .= $link->button_tertiary('delete');
}
$link->url('site.theme-dupetone.ajax.php');
$link->reveal(true);
$link->query("theme_id={$theme_id}&tone_id={$tone_id}");
$link->tap('Create new');
$tone_action_output .= $link->button_secondary('new');
// Build a list of all tones for this theme
$cols = array('id', 'title');
$result = $db->where('theme_id', $theme_id)->orderBy('title', 'ASC')->get('theme_tone', NULL, $cols);
if ($result) {
    foreach ($result as $item) {
        $tone_list[$item['id']] = ucfirst($item['title']);
    }
}
if (count($tone_list) > 1) {
    $tone_menu_output = '<a title="Choose another tone." class="btn secondary tone" data-options="align:right" data-dropdown="drop-items"><i></i></a>';
    $tone_menu_output .= '<ul id="drop-items" data-dropdown-content>';
    foreach ($tone_list as $key => $val) {
 */
$marker_type_list = $marker_type->getMarkerTypeList();
if ($marker_type_list) {
    $heading_list[] = array('value' => 'Level', 'class' => null);
    $heading_list[] = array('value' => 'Title', 'class' => null);
    $heading_list[] = array('value' => 'Total markers', 'class' => null);
    $heading_list[] = array('value' => 'Actions', 'class' => null);
    $edit_link = new GrlxLinkStyle();
    $edit_link->url('marker-type.edit.php');
    $edit_link->title('Edit marker type meta.');
    $edit_link->reveal(false);
    $edit_link->action('edit');
    $delete_link = new GrlxLinkStyle();
    $delete_link->url('marker-type.list.php');
    $delete_link->title('Delete this marker type.');
    $delete_link->reveal(false);
    $delete_link->action('delete');
    foreach ($marker_type_list as $key => $val) {
        $edit_link->query("marker_type_id={$val['id']}");
        $delete_link->query("delete_id={$val['id']}");
        $action_output = $delete_link->icon_link();
        $action_output .= $edit_link->icon_link();
        $list_items[$key] = array('select' => $val['rank'], 'title' => $val['title'], 'tally' => $val['tally'], 'action' => $action_output);
    }
    $list->draggable(false);
    $list->row_class('chapter');
    $list->headings($heading_list);
    $list->content($list_items);
    $list_output = $list->format_headings();
    $list_output .= $list->format_content();
} else {
 * Display logic
 */
if (!is_writable('../' . DIR_COMICS_IMG)) {
    $alert_output .= $message->alert_dialog('The comics images folder is not writable.');
}
// Reset the marker info after making updates.
if ($_POST) {
    $marker = new GrlxMarker($marker_id);
}
$marker_type_list = $db->get('marker_type', null, 'id,title');
$marker_type_list = rekey_array($marker_type_list, 'id');
if ($marker->pageList) {
    $edit_link = new GrlxLinkStyle();
    $edit_link->url('book.page-edit.php');
    $edit_link->title('Edit page meta.');
    $edit_link->reveal(false);
    $edit_link->action('edit');
    $delete_link = new GrlxLinkStyle();
    $delete_link->i_only(true);
    $list->draggable(false);
    $list->row_class('chapter');
    /*
    	$heading_list[] = array(
    		'value' => 'Select',
    		'class' => null
    	);
    */
    $heading_list[] = array('value' => ' ', 'class' => null);
    $heading_list[] = array('value' => 'Title', 'class' => null);
    $heading_list[] = array('value' => 'Page number', 'class' => null);
    $heading_list[] = array('value' => 'Date', 'class' => null);