$view->group_instruction('Name of the website.');
$view->group_contents($title_content);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Image');
$view->group_instruction('Image that readers will see.');
$view->group_contents($widescreen_content);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Destination');
$view->group_instruction('Where the ad, when tapped, will take readers.');
$view->group_contents($destination_content);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Code');
$view->group_instruction('Optional JS or HTML to use in lieu of images and destination. <strong>Entering code will override the image and link above.</strong>');
$view->group_contents($code_content);
$content_output .= $view->format_group();
$view->page_title('Ad editor');
$view->tooltype('ad');
$view->headline('Promo <span>' . $promo_info['title'] . '</span>');
print $view->open_view();
print $view->view_header();
?>

<div id="edit_modal" class="reveal-modal" data-reveal></div>

<?php 
echo $alert_output;
?>
			<form accept-charset="UTF-8" action="ad.promo-edit.php" method="post" enctype="multipart/form-data">
				<input type="hidden" name="grlx_xss_token" value="<?php 
echo $_SESSION['admin'];
?>
        $form->label('Username');
        $form->required(true);
        $form->value($val['username']);
        $form->maxlength(16);
        $form->size(16);
        $details_output .= $form->paint();
        $form->input_email("email[{$val['id']}]");
        $form->size(16);
        $form->value($val['email']);
        $details_output .= $form->paint();
        $details_output .= $form->form_buttons();
        $password_output = $form->new_password("password[{$val['id']}]");
        $password_output .= $form->form_buttons();
    }
}
$view->page_title('User info');
$view->tooltype('user');
$view->headline('User info');
$form->send_to($_SERVER['SCRIPT_NAME']);
$view->group_css('user');
$view->group_h2('Details');
$view->group_contents($details_output);
$content_output = $view->format_group() . '<hr />';
$view->group_h2('Password');
$view->group_css('user');
$view->group_contents($password_output);
$content_output .= $view->format_group();
/*****
 * Display
 */
$output = $view->open_view();
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();
        $list_items[$item['id']] = array($icon . ' ' . $item['title'], $item['url'], $action_output);
    }
}
$alert_output .= $fileops->check_or_make_dir('..' . $image_path);
$view->page_title('Link list');
$view->tooltype('link');
$view->headline('Link list');
if ($list_items) {
    $list->headings(array('Title', 'URL', 'Actions'));
    $list->content($list_items);
    $links_output = $list->format_headings();
    $links_output .= $list->format_content();
}
if (!$links_output) {
    $links_output = '<b>You have no links to other sites.</b>';
}
$view->group_css('link');
$view->group_h2('Your links');
$view->group_contents($links_output);
$content_output = $view->format_group() . '<hr />';
            $action_output = $edit_link->icon_link();
        } else {
            $row_css = $val['active'];
            $userinfo = $val['value'];
            $form->id("widget-{$val['id']}");
            $action_output = $form->checkbox_switch($val['active']) . $edit_link->icon_link();
        }
        $widget_list[$val['id'] . '||' . $row_css] = array($val['title'], $val['widget'], $action_output);
    }
    $list->content($widget_list);
    $widget_output .= $list->format_content();
    $view->group_contents($widget_output);
    $content_output .= $view->format_group();
    unset($heading_list);
}
$view->page_title('Social media');
$view->tooltype('social');
$view->headline('Social media');
/*****
 * Display
 */
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
$output .= $modal->modal_container();
$output .= $content_output;
print $output;
$js_call = <<<EOL
\t\$( "a.edit" ).hover( // highlight the editable item
\t\tfunction() {
\t\t\t\$( this ).parent().parent().addClass("editme");
	<li>Green: Pretty good</li>
	<li>Blue: Suspiciously <em>under</em>weight</li>
	<li>Yellow: Kinda <em>over</em>weight</li>
	<li>Red: Dangerously heavy</li>
	<li>Blood red: You’re kidding, right?</li>
</ul>
');
$view->group_contents($report[0]);
$content_output .= $view->format_group();
// Display
/*
$output  = $view->open_view();
$output .= $view->view_header();
$output .= $content_output;
$output .= $view->close_view();
*/
/*****
 * Display
 */
$view->page_title('Site health check');
$view->tooltype('health');
$view->headline('Site health check');
$output = $view->open_view();
$output .= $view->view_header();
print $output;
?>
<p>OK, I’ve scanned your site for technical problems. Here’s the report:</p>
<?php 
echo $content_output;
$output = $view->close_view();
print $output;
/*****
 * Updates
 */
if ($marker_type_id && $new_title) {
    $success = $marker_type->saveMarkerType($marker_type_id, $new_title);
    $marker_type = new GrlxMarkerType($marker_type_id);
}
if ($success) {
    $link->url('marker-type.list.php');
    $link->tap('Return to the type list');
    $alert_output = $message->success_dialog('Marker type saved. ' . $link->paint() . '.');
}
/*****
 * Display logic
 */
$view->page_title('Marker type: ' . $marker_type->markerTypeInfo['title']);
$view->tooltype('chap');
$view->headline('Marker type <span>' . $marker_type->markerTypeInfo['title'] . '</span>');
$content_output .= '<form accept-charset="UTF-8" action="marker-type.edit.php" method="post">' . "\n";
$content_output .= '<input type="hidden" name="marker_type_id" value="' . $marker_type_id . '"/>' . "\n";
$content_output .= '<label for="marker_type_id">This marker type is called:</label>' . "\n";
$content_output .= '<input type="text" name="new_title" size="12" style="width:12rem" value="' . $marker_type->markerTypeInfo['title'] . '"/>' . "\n";
$content_output .= '<button class="btn primary save" name="submit" type="submit" value="save"><i></i>Save</button>' . "\n";
$content_output .= '<input type="hidden" name="marker_type_id" value="' . $marker_type_id . '"/>' . "\n";
$content_output .= '</form>' . "\n";
/*****
 * Display
 */
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
    $ad_list_output = '<h2>No ad images fit into this slot.</h2>' . "\n";
}
$label_output = '<input type="text" name="label" id="label" value="' . $slot_info['label'] . '"/>';
$code_output = '<input type="text" id="template-code" value="&lt;?=show_ad(\'' . $slot_info['label'] . '\') ?&gt;"';
// Group
$view->group_h2('Ad list');
$view->group_instruction($ad_list_instructions);
$view->group_contents($ad_list_output);
$content_output .= $view->format_group() . '<hr />';
// Group
$view->group_h2('Template code');
$view->group_instruction('Every slot in your site — the places where ads go — needs a unique ID. <strong>Change this only if you’re willing to edit your site’s theme.</strong>');
$view->group_contents($label_output . $code_output);
$content_output .= $view->format_group();
// Setup
$view->page_title('Ad slot');
$view->headline('Ad slot <span>' . $slot_info['title'] . '</span>');
$view->tooltype('ad');
$view->group_css('ad');
/*****
 * Display
 */
print $view->open_view();
print $view->view_header();
?>

<div id="edit_modal" class="reveal-modal" data-reveal></div>

<?php 
echo $alert_output;
?>
    $heading_list[] = array('value' => 'Actions', 'class' => null);
    $list->headings($heading_list);
    $list->row_class('ad');
    $link->url('ad.slot-edit.php');
    $link->title('Control which ads appear in different places on your site.');
    $link->action('edit');
    foreach ($slot_list as $key => $val) {
        $link->query('slot_id=' . $key);
        $slot_list_content[$key] = array($val['title'], $val['max_width'] . ' &times; ' . $val['max_height'], $val['ad_count'], $link->icon_link());
    }
}
$list->content($slot_list_content);
$slot_list_output = $list->format_headings();
$slot_list_output .= $list->format_content();
///////// Assemble the overall page view.
$view->page_title('Advertisements');
$view->tooltype('ad');
$view->headline("Advertisements");
$view->group_css('ad');
$view->group_h2('Ad slots');
$view->group_instruction('Slots are locations on your site’s pages that contain ads.');
$view->group_contents($slot_list_output);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('House ads');
$view->group_instruction('A.k.a. promos, these are custom graphics and links you upload yourself.');
$view->group_contents($ad_list_output);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Project Wonderful');
$view->group_instruction('Ads served by this wonderful third-party service.');
$view->group_contents($wonderful_ad_list_output . $wonderful_info_output . $wonderful_refresh_output);
$content_output .= $view->format_group() . '<hr />';
    	$select_options .= '</select>';
    */
}
$new_title_field .= '<label for="new_name">New marker title</label>' . "\n";
$new_title_field .= '<input autofocus style="width:20rem" size="20" type="text" id="new_name" name="new_name" maxlength="64" placeholder="Title" value="">' . "\n";
$new_upload_field = '<input name="file[]" id="file" type="file" multiple /><br/>';
$new_upload_field .= 'Max size per image: ' . number_format($fileops->up_get_max_size()) . ' bytes. But recommend nothing larger than 100,000.<br/>';
//$new_upload_field .= 'Uploading more than '.$fileops-> up_get_max_file_uploads().' images? Try the <a href="book.import.php">bulk importer</a>.';
$result = $db->get('book_page', 1, 'MAX(sort_order) AS endpage');
if ($result) {
    $end_page = number_format($result[0]['endpage']) + 1;
} else {
    $end_page = 1;
}
$new_order_field = '<input name="new_order" id="new_order" size="3" style="width:3rem" type="text" value="' . $end_page . '" />';
$view->page_title('New pages');
$view->tooltype('chap');
$view->headline('New pages');
$view->action($action_output);
if (count($this_type) > 1) {
    $view->group_h2('Type');
    $view->group_instruction('What kind of marker is this?');
    $view->group_contents($select_options);
    $content_output .= $view->format_group() . '<hr />';
} else {
    $id = reset($marker_type_list);
    $id = $id['id'];
    $content_output .= '<input type="hidden" name="add-marker-type" value="' . $id . '"/>';
}
$quick_upload_field = <<<EOL
<form action="uploadtome.php" class="dropzone" method="post" enctype="multipart/form-data">
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="small-9 columns">
\t\t\t\t\t\t\t\t<a href="sttc.xml-new.php?id={$id}"><strong>{$info[label]}</strong></a><br/>
\t\t\t\t\t\t\t\t{$info[description]}
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div><br/>
EOL;
    return $output;
}
/*****
 * Display logic
 */
/************
 * Display
 */
$view->page_title('New static page');
$view->tooltype('chap');
$view->headline('New static page');
$view->action($action_output);
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
print $output;
?>

			<div id="sttc-pg-edit">
				<form accept-charset="UTF-8" action="sttc.xml-new.php" method="post" data-abide enctype="multipart/form-data">
<?php 
if (!$_POST) {
    ?>
            $vis_link->action('delete');
            $vis_link->id("delete-{$item['id']}");
            $vis_link->title('Delete this link from your site’s menu.');
            $vis_output = $vis_link->icon_link();
        } else {
            $form->id("id-{$item['id']}");
            $vis_output = $form->checkbox_switch($item['in_menu']);
        }
        //		$action_output = $edit_link->icon_link();
        if (isset($dupes) && in_array($item['url'], $dupes)) {
            $item['url'] = '<span class="fixme">' . $item['url'] . '</span>';
        }
        $list_items[$item['id'] . '||' . $item['in_menu']] = array($item['title'], $item['url'], $vis_output, $edit_link->icon_link());
    }
}
$view->page_title('Main menu');
$view->tooltype('menu');
$view->headline('Main menu');
$link->url('sttc.xml-new.php');
$link->tap('New page');
$action_output = $link->text_link('static');
$link->url('site.nav-edit.ajax.php');
$link->reveal(true);
$link->query('edit_id=new');
$link->title = 'External links go to other websites — like those you enjoy reading soooo much you just have to share it with your readers.';
$link->tap('New external link');
$action_output .= $link->button_secondary('new');
$view->action($action_output);
$heading_list[] = array('value' => 'Title', 'class' => null);
$heading_list[] = array('value' => 'URL', 'class' => null);
$heading_list[] = array('value' => 'In menu', 'class' => null);
EOL;
/*
$delete_marker_output = <<<EOL
<button class="btn secondary delete" name="delete-marker" type="submit" value="delete-marker"><i></i>Remove marker(s)</button>

EOL;
*/
$link->url('book.pages-create.php');
$link->tap('bulk importer');
$new_upload_field = '<input name="file[]" id="file" type="file" multiple /><br/>';
$new_upload_field .= '<button class="btn primary new" name="new-pages" type="submit" value="new-pages"><i></i>Add pages</button>';
$new_upload_field .= '<br/>&nbsp;<p>' . number_format($fileops->up_get_max_size()) . ' bytes max file size. (Recommended max: 100,000 bytes per image.) The server can accept up to ' . $fileops->up_get_max_file_uploads() . ' images at a time.</p>' . "\n";
$new_upload_field .= '<p>Uploading more than ' . $fileops->up_get_max_file_uploads() . ' images? Try the ' . $link->paint() . '.</p>';
$type = $marker_type_list[$marker->markerInfo['marker_type_id']]['title'];
$type ? $type : ($type = 'Marker');
$view->page_title($type . ': ' . $marker->markerInfo['title']);
$view->tooltype('page');
$view->headline($type . ' <span>' . $marker->markerInfo['title'] . '</span>');
$link->url('marker.edit.php?marker_id=' . $marker->markerID);
$link->tap('Edit ' . $marker_type_list[$marker->markerInfo['marker_type_id']]['title'] . ' info');
$link->reveal(true);
$action_output = $link->text_link('editmeta');
/////// Add later
/*
$link->url('marker.create.php?at_page='.$first_page_id);
$link->tap('Insert marker');
$link->reveal(false);
$action_output .= $link->button_secondary('new');
*/
$view->action($action_output);
/*
$link1->url('http://daringfireball.net/projects/markdown');
$link1->tap('Markdown');
$view->group_css('page');
$view->group_h2('Blog');
$view->group_instruction('Write your thoughts for the day on this comic page. The post accepts HTML and ' . $link1->external_link() . '.');
$view->group_contents($blog_output);
$content_output .= $view->format_group() . '<hr />';
$link1->url('http://www.getgrawlix.com/docs/' . DOCS_VERSION . '/seo');
$link1->tap('SEO');
$view->group_css('page');
$view->group_h2('Transcript');
$view->group_instruction('Transcript is a record of the the dialog, events and scenes in a comic page. In short, a script. Use this to improve accessibility and ' . $link1->external_link() . '.');
$view->group_contents($transcript_output);
$content_output .= $view->format_group();
/////// ! Display
$view->page_title("Comic page: {$heading_output}");
$view->tooltype('chap');
$view->headline("Comic page <span>{$heading_output}</span>");
$view->action($action_output);
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
//$output .= $modal->modal_container();
//$output .= $content_output;
print $output;
?>


<form accept-charset="UTF-8" action="book.page-edit.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="page_id" value="<?php 
echo $page_id;
$view->group_h3('Transcript');
$view->group_instruction('Dialogue, scene descriptions, etc — great ' . $link->external_link() . ' stuff.');
$view->group_contents($transcript_output);
$content_output .= $view->format_group();
$content_output .= '<input type="hidden" name="book_id" value="' . $book_id . '"/>' . "\n";
$content_output .= '</form>' . "\n";
//$content_output .= '<hr/><h1 id="multiple">Multiple new pages</h1><br/>'."\n";
/*
$view->group_css('page');
$view->group_h2('Quick add');
$view->group_instruction('Just add page(s) to the end of your book. No frills, just pics.');
$view->group_contents($quick_upload_field);
$content_output .= $view->format_group()."\n";
*/
// ! Display
$view->page_title('Comic page creator');
$view->tooltype('page');
$view->headline('Create a new page');
$view->action($action_output);
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
//$output .= $modal->modal_container();
//$output .= $content_output;
print $output;
?>



<?php 
echo $images_output;
    $list->content($list_items);
    $folder_output = $list->format_headings();
    $folder_output .= $list->format_content();
}
// Group
if ($folder_output) {
    $link->url('http://www.getgrawlix.com/docs/' . DOCS_VERSION . '/ftp');
    $link->tap('via FTP');
    $link1->url('http://www.getgrawlix.com/docs/' . DOCS_VERSION . '/importing');
    $link1->tap('Learn more.');
    $view->group_h2('Folders');
    $view->group_instruction('This tool lets you copy images from the “/import” folder (' . $link->external_link() . ') into ' . $marker_type_list[1]['title'] . 's. ' . $link1->external_link());
    $view->group_contents($folder_output . $submit_output);
    $content_output .= $view->format_group() . "\n";
}
$view->page_title('Create pages from FTP');
$view->tooltype('Chapter');
$view->headline('Create pages from FTP');
$link->url('./book.page-create.php');
$link->tap('Create one comic page');
$link->reveal(false);
$action_output = $link->button_secondary('new');
$view->action($action_output);
$output = $view->open_view();
$output .= $view->view_header();
print $output;
?>

<form accept-charset="UTF-8" action="book.import.php" method="post">
<?php 
echo $alert_output;
        in_array($info, $xml->meta['page']) ? $check = ' checked="checked"' : ($check = null);
        $meta_output .= '<label><input type="checkbox" name="page[option][]"' . $check . ' value="' . $info . '"/>&emsp;' . $title . '</label>';
    }
    $meta_output .= '</div>';
    $meta_output = $form->row_wrap($meta_output);
}
if ($xml->saveResult == 'success') {
    $message = new GrlxAlert();
    $alert_output = $message->success_dialog('Changes saved.');
}
if ($xml->saveResult == 'error') {
    $message = new GrlxAlert();
    $alert_output = $message->alert_dialog('Changes failed to save.');
}
/* ! Display * * * * * * * */
$view->page_title('Archives');
$view->tooltype('arcv');
$view->headline('Comic archive editor');
$form->input_hidden('book_id');
$form->value($book_id);
$book_info = $form->paint();
$view->group_css('arcv');
$view->group_h2('Behavior');
$view->group_instruction('Select how you want readers to navigate through your archives.');
$view->group_contents($behavior_output);
$content_output .= $view->format_group() . '<hr/>';
$view->group_h2('Layout');
$view->group_instruction('Select how you want to arrange information.');
$view->group_contents($layout_output);
$content_output .= $view->format_group() . '<hr/>';
$view->group_h2('Metadata');
    $sl->setList($home_list);
    $sl->setCurrent($current_home);
    $sl->setValueID('id');
    $sl->setValueTitle('title');
    $home_options = $sl->buildSelect();
    $home_output = '<div class="row form config">';
    $home_output .= '<div><label for="home-id">Homepage</label></div>';
    $home_output .= '<div>' . $home_options . '</div>';
    $home_output .= '</div>';
    $home_output .= $form->form_buttons($edit_home);
}
$link->url('http://www.getgrawlix.com/docs/' . DOCS_VERSION . '/settings');
$link->tap('Read the docs');
$instruction = 'Use this panel to customize your overall site. ' . $link->external_link() . ' for details.';
$content_output = $form->open_form();
$view->page_title('Site settings');
$view->tooltype('config');
$view->headline('Site settings');
$view->group_css('config');
$view->group_h2('Basics');
$view->group_instruction($instruction);
$view->group_contents($form_output);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Homepage');
$view->group_instruction($home_instruction);
$view->group_contents($home_output);
$content_output .= $view->format_group();
$content_output .= $form->close_form();
/*****
 * Display
 */
\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>
\t\t\t{$this_action}
\t\t\t<a class="edit" href="sttc.xml-edit.php?page_id={$val['id']}">
\t\t\t\t<i class="edit"></i>
\t\t\t</a>
\t\t</div>
\t\t</li>
EOL;
    }
    $page_list_output .= '</ul>' . "\n";
}
$view->page_title('Static pages');
$view->tooltype('sttc');
$view->headline('Static pages');
$link->url('site.nav.php');
$link->tap('Edit order and URLs');
$action_output = $link->text_link('menu');
$link->url('sttc.xml-new.php');
$link->tap('New page');
$action_output .= $link->button_secondary('new');
$view->action($action_output);
/*****
 * Display
 */
$output = $view->open_view();
$output .= $view->view_header();
$output .= $modal->modal_container();
    $sl->setStyle('width:12rem');
    // <select style="Ed">
    $select_options = $sl->buildSelect() . '<br/>' . "\n";
    // Assemble the select element.
}
// ! Build the edit form
$edit_form_output .= '<form accept-charset="UTF-8" action="marker.edit.php" method="post">' . "\n";
$edit_form_output .= '	<p><label for="new_title">Title</label>' . "\n";
$edit_form_output .= '	<input type="text" id="new_title" name="new_title" size="12" style="width:12rem" value="' . $marker->markerInfo['title'] . '"/></p>' . "\n";
$edit_form_output .= '	<label for="edit_marker_type">Type</label>' . "\n";
$edit_form_output .= $select_options . "\n";
$edit_form_output .= '	<button class="btn primary save" name="submit" type="submit" value="save"><i></i>Save</button>' . "\n";
$edit_form_output .= '	<input type="hidden" name="marker_id" value="' . $marker_id . '"/>' . "\n";
$edit_form_output .= '</form>' . "\n";
// ! Build the overall view
$view->page_title('Marker: ' . $marker->markerInfo['title']);
$view->tooltype('chap');
$view->headline('Marker <span>' . $marker->markerInfo['title'] . '</span>');
$view->group_h2('General info');
$view->group_instruction('Change this marker’s name and type.');
$view->group_contents($edit_form_output);
$content_output .= $view->format_group();
// Let artists jump to the marker type manager
// from here because it’s contextual.
$link1->url('marker-type.list.php');
$link1->tap('Edit marker types');
$link1->id('edit-types');
$action_output = $link1->text_link('editmeta');
$view->action($action_output);
// ! Display
$output = $view->open_view();
        }
        $all_themes_output .= <<<EOL
\t\t\t<li id="theme-{$id}">
\t\t\t\t<div class="box{$box_css}">
\t\t\t\t\t{$preview}
\t\t\t\t\t<h4>{$info['title']}</h4>
\t\t\t\t\t<div class="actions">
\t\t\t\t\t\t{$action}
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t</li>
EOL;
    }
    $all_themes_output .= '</ul>';
}
$view->page_title('Themes');
$view->tooltype('theme');
$view->headline('Themes');
$view->action($action_output);
$view->group_css('theme');
$view->group_h2('Assign');
$view->group_instruction($instruction);
$view->group_contents($assign_output);
$content_output .= $view->format_group() . '<hr/>';
$view->group_h3('List');
$view->group_css('theme');
$view->group_instruction('Manage your installed themes here.');
$view->group_contents($all_themes_output);
$content_output .= $view->format_group();
/* ! Display * * * * * * * */
$output = $view->open_view();
        $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 {
    $list_output .= 'I didn’t find any types of marker.';
}
$link->url('marker-type.create.php');
$link->tap('Create');
$create_output = $link->button_primary('new');
$view->group_h2('Organization');
$view->group_instruction('Markers denote the beginnings of sections, like chapters, scenes and supplemental pages. Tap to edit each type.');
$view->group_contents($list_output);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Create');
$view->group_instruction('Make a new marker type.');
$view->group_contents($create_output);
$content_output .= $view->format_group();
$view->page_title('Marker types: ' . $book->info['title']);
$view->tooltype('chapter');
$view->headline('Marker types');
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
$output .= $content_output;
print $output;
print $view->close_view();
            $link->tap('<strong>' . $i . ' &#8211; ' . $last . '</strong>');
            $link->query('start_sort_order=' . $i);
            $pagination[] = $link->paint() . "\n";
        } else {
            $link->tap($i . ' &#8211; ' . $last);
            $link->query('start_sort_order=' . $i);
            $pagination[] = $link->paint();
        }
    }
    $pagination_output = '<br/><p>Jump to ' . implode(', ', $pagination) . '</p>' . "\n";
    $pagination_output .= '<input type="hidden" name="start_sort_order" value="' . $start_sort_order . '"/>';
}
/*****
 * Display
 */
$view->page_title('Book: ' . $book->info['title']);
$view->tooltype('book');
$view->headline('Book <span>' . $book->info['title'] . '</span>');
$link->url('book.edit.php?book_id=' . $book_id);
$link->tap('Edit comic info');
$link->id('edit-comic-info');
$action_output = $link->text_link('editmeta');
/*
$link->url('marker.create.php');
$link->tap('Add pages');
$link->reveal(false);
$action_output .= $link->button_secondary('new');
*/
$view->action($action_output);
/*
$view->group_h2('New pages');
$view->group_instruction('Graphic for this ad on small screens and tablets.');
$view->group_contents($tablet_form);
$content_output .= $view->format_group().'<hr />';
*/
$view->group_h2('Image');
$view->group_instruction('Graphic that readers will tap.');
$view->group_contents($widescreen_form);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Custom code');
$view->group_instruction('Optional: If you have special HTML or JavaScript instead of graphics and a destination for this ad, paste it here.');
$view->group_contents($code_form);
$content_output .= $view->format_group();
/*****
 * Display
 */
$view->page_title('Create new promo');
$view->tooltype('ad');
$view->headline("Create new promo");
print $view->open_view();
print $view->view_header();
?>
<p>Promos are custom ads you create and upload yourself. All sizes below are optional — but you should upload at least a mobile-optimized graphic. <strong>Grawlix’s ad slots are based on mobile graphics first.</strong></p><hr/>

<?php 
echo $alert_output;
?>
<form accept-charset="UTF-8" action="ad.promo-create.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="grlx_xss_token" value="<?php 
echo $_SESSION['admin'];
?>
"/>
    $new_id = $marker_type->createMarkerType($new_title, $next_rank);
    if ($new_id) {
        header('location:marker-type.list.php');
        die;
    } else {
        $alert_output = $message->alert_dialog('I couldn’t create the new marker.');
    }
} elseif ($_POST && !$new_title) {
    $alert_output = $message->alert_dialog('Hmm, I didn’t see a title. Did you give this new marker type a name?');
}
/*****
 * Display logic
 */
$next_rank = $db->get('marker_type', null, 'MAX(rank)+1 AS next_rank');
$next_rank = $next_rank[0]['next_rank'];
$view->page_title('Create marker type');
$view->tooltype('chap');
$view->headline('Create marker type');
$content_output .= '<form accept-charset="UTF-8" action="marker-type.create.php" method="post">' . "\n";
$content_output .= '<input type="hidden" name="marker_type_id" value="' . $marker_type_id . '"/>' . "\n";
$content_output .= '<label for="marker_type_id">New type title:</label>' . "\n";
$content_output .= '<input type="text" name="new_title" size="12" style="width:12rem" value="' . $marker_type->markerTypeInfo['title'] . '"/>' . "\n";
$content_output .= '<button class="btn primary save" name="submit" type="submit" value="save"><i></i>Save</button>' . "\n";
$content_output .= '<input type="hidden" name="next_rank" value="' . $next_rank . '"/>' . "\n";
$content_output .= '</form>' . "\n";
/*****
 * Display
 */
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
    $book_id = $book->bookID;
}
if ($frequency_list) {
    $publish_frequency_output .= '<select name="publish_frequency" style="width:8rem">' . "\n";
    foreach ($frequency_list as $key => $val) {
        if ($key == $book->info['publish_frequency']) {
            $publish_frequency_output .= '<option selected="selected" value="' . $key . '">- ' . $val . '</option>' . "\n";
        } else {
            $publish_frequency_output .= '<option value="' . $key . '">' . $val . '</option>' . "\n";
        }
    }
    $publish_frequency_output .= '</select>' . "\n";
}
$marker_output = '<p><a href="marker-type.list.php">Edit marker types</a> (chapter, scene, etc)</p>';
$new_title_output = '<input type="text" name="new_title" value="' . $book->info['title'] . '" size="16" style="width:16rem"/>' . "\n";
$view->page_title("Book: {$book_info['title']}");
$view->tooltype('chap');
$view->headline('Book <span>' . $book->info['title'] . '</span>');
// Group
$view->group_h2('Title');
$view->group_instruction('Change the name of your book.');
$view->group_contents($new_title_output);
$content_output .= $view->format_group() . '<hr />';
// Group
$view->group_h2('Frequency');
$view->group_instruction('How often you publish new pages.');
$view->group_contents($publish_frequency_output);
$content_output .= $view->format_group() . '<hr />';
// Group
$link->title('Learn more about markers');
$link->url('http://www.getgrawlix.com/docs/' . DOCS_VERSION . '/markers');
	'title' => ''
);

$link_set[] = array(
	'url' => 'user.config.php',
	'tap' => 'Change my login/password',
	'title' => ''
);
*/
/* ! Build * * * * * * * */
$view = new GrlxView();
$fileops = new GrlxFileOps();
$link = new GrlxLink();
$fileops->db = $db;
$view->yah = 15;
$view->page_title('Grawlix panel');
$view->tooltype('panl');
$view->headline('Grawlix panel');
$db->where('date_publish >= NOW()');
$db->orderBy('sort_order', 'ASC');
$id_info = $db->getOne('book_page', 'id');
if ($id_info) {
    $comic_page = new GrlxComicPage($id_info['id']);
}
if ($comic_page) {
    $image = reset($comic_page->imageList);
    $link->url('book.page-edit.php?page_id=' . $comic_page->pageID);
    $link->tap($comic_page->pageInfo['title']);
    $next_output = '<p>' . $link->paint() . '</p>' . "\n";
    $link->tap('<img src="' . $image['url'] . '" alt="" />');
    $next_output .= '<p>' . $link->paint() . '</p>' . "\n";
    $form->input_hidden('tone_id');
    $form->value($tone_id);
    $form_output .= $form->paint();
    $form_output .= $palette_output;
    $form_output .= $styles_output;
    $form_output .= $slot_output;
    $form_output .= $form->close_form();
} else {
    $form_output = <<<EOL
\t<div class="panel">
\t\t<h3>No tone options</h3>
\t\t<p>This theme does not contain panel-editable options. You’ll have to edit the CSS directly.</p>
\t</div>
EOL;
}
$view->page_title("Theme: {$theme_info['title']}");
$view->tooltype('tone');
$view->prepend_stylesheet('spectrum.css');
$view->headline("Theme <span>{$theme_info['title']}</span>");
$link->url('site.theme-manager.php');
$link->tap('Back to list');
$action_output = $link->text_link('back');
$view->action($action_output);
$view->meta_css('theme');
$view->meta_preview('<img src="http://placehold.it/500x100/ccc/000.png&text=preview_image" />');
$view->meta_info_list($meta_list);
$meta_output = $view->format_meta() . '<hr />';
/*****
 * Display
 */
$output = $view->open_view();
    $instruction_output = 'Edit your AdSense code, ' . $link->paint() . ', below.';
}
if ($ad_info) {
    $ad_output = <<<EOL
<label for="title">Title (for your reference)</label>
<input type="text" style="width:10rem" name="title" id="title" value="{$ad_info['title']}"/>

<label for="code">AdSense Code</label>
<textarea name="code" id="code" rows="10">{$ad_info['code']}</textarea>

EOL;
}
/*****
 * Display
 */
$view->page_title('Adsense editor');
$view->headline('AdSense <span>' . $ad_info['title'] . '</span>');
$view->tooltype('ad');
$view->group_css('ad');
print $view->open_view();
print $view->view_header();
?>

<div id="edit_modal" class="reveal-modal" data-reveal></div>

<?php 
echo $alert_output;
?>
<p><?php 
echo $instruction_output;
?>
    $page_title = $static->info['title'];
} else {
    $page_title = 'Untitled';
    $static->info['title'] = 'Untitled';
}
$link->url('site.nav.php');
$link->tap($static->info['url']);
$path_link = $link->paint();
$path_link_output = <<<EOL
<div class="row form widelabel">
\t<div>
\t\t<label>URL</label>
\t</div>
\t<div class="plaintext">{$path_link}</div></div>
EOL;
$view->page_title('Edit static page: ' . $page_title);
$view->tooltype('sttc');
$view->headline('Static page <span>' . $page_title . '</span>');
$link->url('sttc.page-list.php');
$link->tap('Back to list');
$action_output = $link->text_link('back');
$link->url('..' . $static->info['url']);
$link->tap('View live page');
$action_output .= $link->button_secondary('view');
$view->action($action_output);
$form->multipart(true);
$form->send_to('sttc.xml-edit.php');
$form->input_hidden('page_id');
$form->value($page_id);
$hidden_fields = $form->paint();
$form->input_hidden('function');