function input($objectName, $method, $object, $options = array())
{
    $attr = $object->getAttribute($method);
    switch ($attr->type) {
        case 'string':
            $str = text_field($objectName, $method, $object, $options);
            break;
        case 'text':
            $str = text_area($objectName, $method, $object, $options);
            break;
        case 'date':
            $str = date_select($objectName, $method, $object);
            break;
        case 'datetime':
            $str = date_time_select($objectName, $method, $object);
            break;
        case 'integer':
            $str = text_field($objectName, $method, $object, $options);
            break;
        case 'float':
            $str = text_field($objectName, $method, $object, $options);
            break;
        case 'boolean':
            $str = check_box($objectName, $method, $object, $options);
            break;
        default:
            $str = hidden_field($objectName, $method, $object);
            break;
    }
    return error_wrapping($str, isset($object->errors[$method]));
}
 public function testCheckbox()
 {
     $this->assertDomEqual(check_box('post', 'private', $this->post), '<input checked="checked" id="post_private" name="post[private]" type="checkbox" value="1" />
         <input name="post[private]" type="hidden" value="0" />');
     $this->assertDomEqual(check_box('post', 'private', $this->post, array(), 'on', 'off'), '<input checked="checked" id="post_private" name="post[private]" type="checkbox" value="on" />
         <input name="post[private]" type="hidden" value="off" />');
     $this->post->private = false;
     $this->assertDomEqual(check_box('post', 'private', $this->post), '<input id="post_private" name="post[private]" type="checkbox" value="1" />
         <input name="post[private]" type="hidden" value="0" />');
     $this->assertDomEqual(check_box('post', 'private', $this->post, array('checked' => 'checked')), '<input checked="checked" id="post_private" name="post[private]" type="checkbox" value="1" />
         <input name="post[private]" type="hidden" value="0" />');
 }
function field_html($args)
{
    switch ($args[2]) {
        case 'textarea':
            return text_area($args);
        case 'checkbox':
            // Checkbox
            return check_box($args);
        case 'background_variant':
            // Dropmenu
            return background_variant($args);
        case 'image_url':
            // Image URL
            return image_url($args);
        case 'text':
        default:
            return text_field($args);
    }
}
Exemple #4
0
function field_html($args)
{
    switch ($args[2]) {
        case 'textarea':
            return text_area($args);
        case 'checkbox':
            // Checkbox
            return check_box($args);
        case 'dropmenu':
            // Checkbox
            return dropmenu_sidebaropt($args);
        case 'radio':
            // To Do
        // To Do
        case 'text':
        default:
            return text_field($args);
    }
}
            if ($action == HANDLE_ENTRY_FORM_SUBMISSION) {
                $text = $_POST[$id];
            }
        }
        $esc_text = html_safe($text);
        return "" . "<textarea rows='4' cols='67' name='{$id}' id='{$id}' wrap='hard'>{$esc_text}</textarea>" . "<br />" . "<div class='shrinker'>" . "<a onclick='grow_textarea(\"{$id}\")'>+</a>" . "&nbsp;" . "<a onclick='shrink_textarea(\"{$id}\")'>&minus;</a>" . "</div>";
    }
    function is_decimal_digits($s)
    {
        assert(is_string($s));
        return ctype_digit($s) && strlen($s) > 0;
        // the strlen check is necessary before PHP 5.1.0.
    }
    // ---------------------------------
    $ppv_guidelines_url = "{$code_url}/faq/ppv.php";
    $entry_form = "<br />\n          <form action='{$code_url}/tools/post_proofers/ppv_report.php?project={$projectid}&amp;confirm=1' name='ppvform' method='post'>\n          <table border='1' id='report_card' style='width: 95%'>\n" . tr_w_one_cell_centered($theme['color_logobar_bg'], _("Project Information")) . tr_w_two_cells(_("Project ID"), "<input type='hidden' name='projectid' value='{$projectid}'>{$projectid}") . tr_w_two_cells(_("Name of Work"), $nameofwork) . tr_w_two_cells(_("Author's Name"), $authorsname) . tr_w_two_cells(_("Language"), $language) . tr_w_two_cells(_("Difficulty"), $difficulty_level) . tr_w_two_cells(_("Pages"), $pages) . tr_w_two_cells(_("Post-Processed by"), $project->postproofer . "<br>" . sprintf(_("Number of books post-processed by %1\$s (including this one): %2\$d"), $project->postproofer, $number_post_processed)) . tr_w_two_cells(_("Submitted by PP on"), $pp_date) . tr_w_one_cell_centered($theme['color_logobar_bg'], _("General Information")) . tr_w_one_cell_centered("#e0e8dd", _("Difficulty Details")) . tr_w_two_cells("File Information", number_box('kb_size', _("Text File Size in kb (Please do not insert commas. For example, you should input 1450 instead of 1,450 and, if you use commas as decimal marks, 1450.5 instead of 1450,5)"), array('size' => 5))) . tr_w_two_cells(_("Present in the text"), "" . some_sig_combo('some_poetry', _("Some"), 'sig_poetry', _("Significant Amount"), _("Poetry (other than straight poetry)")) . some_sig_combo('some_block', _("Some"), 'sig_block', _("Significant Amount"), _("Blockquotes")) . some_sig_combo('some_foot', _("Some"), 'sig_foot', _("Significant Amount"), _("Footnotes")) . some_sig_combo('some_side', _("Some"), 'sig_side', _("Significant Amount"), _("Sidenotes")) . some_sig_combo('some_ads', _("Some"), 'sig_ads', _("Significant Amount"), _("Advertisements")) . some_sig_combo('some_tables', _("Some"), 'sig_tables', _("Significant Amount"), _("Tables")) . some_sig_combo('some_drama', _("Some"), 'sig_drama', _("Significant Amount"), _("Drama")) . some_sig_combo('some_index', _("Small"), 'sig_index', _("Significant Size"), _("Index")) . some_num_combo('some_illos', _("Illustrations (other than minor decorations or logos)"), 'num_illos') . check_box('sig_illos', _("Illustrations requiring advanced preparation and/or difficult placement")) . check_box('sig_multilang', _("Multiple Languages") . " <a href='{$ppv_guidelines_url}#mult'>*</a>") . check_box('sig_spell', _("Extensive Spellcheck/Gutcheck")) . check_box('sig_englifh', _("Engli&#383;h")) . check_box('sig_music', _("Musical Notation and Files")) . check_box('sig_math', _("Extensive mathematical/chemical notation"))) . tr_w_one_cell_centered("#99ff99", _("ERRORS") . " <a href='{$ppv_guidelines_url}#errors'>**</a>") . tr_w_one_cell_centered("#99ff99", _("LEVEL 1 (Minor Errors)")) . tr_w_one_cell_centered("#e0e8dd", _("All Versions")) . tr_w_two_cells(_("Approximate number of errors <br>(Please enter only numbers)"), "" . number_box('e1_spellcheck_num', _("Spellcheck/Scanno errors")) . number_box('e1_gutcheck_num', _("Gutcheck-type errors, e.g. punctuation, hyphen/emdash, missing/extra space, line length, illegal characters, etc.")) . number_box('e1_jeebies_num', _("Jeebies errors (English only)")) . number_box('e1_para_num', _("Paragraph breaks missing or incorrectly added")) . number_box('e1_hyph_num', _("A few occurrences of hyphenated/non-hyphenated, spelling and punctuation variants and other inconsistencies not addressed (may be addressed by note in the TN)")) . number_box('e1_chap_num', _("Chapter and other headings inconsistently spaced, aligned, capitalized or punctuated")) . number_box('e1_format_num', _("Formatting inconsistencies (e.g., in margins, blank lines, etc.)")) . number_box('e1_xhtml_genother_num', _("Other minor errors (such as a minor rewrap error, misplaced entry in the TN, or minor inconsistency between the text and HTML versions) (Please explain in the Comments Field below)")) . "\n" . comment_box('level1_general_comments')) . tr_w_one_cell_centered("#e0e8dd", _("HTML Version Only")) . tr_w_one_cell_centered("#e0e8dd", _("Images")) . tr_w_two_cells(_("Approximate number of errors <br>(Please enter only numbers)"), "" . number_box('e1_unused_num', _("Unused files in images folder (Thumbs.db is not counted toward rating)")) . number_box('e1_imagesize_num', _("Appropriate image size not used for thumbnail, inline and linked-to images. Image sizes should not normally exceed the limits described <a href='http://www.pgdp.net/wiki/Guide_to_Image_Processing#Image_Display_Dimensions:_Considerations'>here</a>, but exceptions may be made if warranted by the type of image or book (provided the PPer explains the exception).")) . number_box('e1_blemish_num', _("Images with major blemishes, uncorrected rotation/distortion or without appropriate cropping")) . number_box('e1_distort_num', _("Failure to enter image size appropriately via HTML attribute or CSS such that the image is distorted in HTML, epub or mobi")) . number_box('e1_alt_num', _("Failure to use appropriate \"alt\" tags for images that have no caption and to include empty \"alt\" tags if captions exist"))) . tr_w_one_cell_centered("#e0e8dd", _("HTML Code")) . tr_w_two_cells(_("Approximate number of errors <br>(Please enter only numbers)"), "" . number_box('e1_px_num', _("Use of px sizing units for items other than images and borders")) . number_box('e1_title_num', _("&lt;title&gt; missing or incorrectly worded (Should be &lt;title&gt;The Project Gutenberg eBook of Alice's Adventures in Wonderland, by Lewis Carroll&lt;/title&gt; or &lt;title&gt;Alice's Adventures in Wonderland, by Lewis Carroll&mdash;A Project Gutenberg eBook&lt;/title&gt;)")) . number_box('e1_pre_num', _("Use of &lt;pre&gt; tags instead of their CSS equivalents")) . number_box('e1_body_num', _("Failure to place &lt;html&gt;, &lt;body&gt;, &lt;head&gt;, &lt;/head&gt;&lt;/body&gt;, and &lt;/html&gt; tags each on their own line and correctly use them")) . number_box('e1_tabl_num', _("Use of tables for things that are not tables")) . number_box('e1_css_num', _("Used CSS other than CSS 2.1 or below (except for the dropcap \"transparent\" element)")) . number_box('e1_xhtml_num', _("Used HTML version other than XHTML 1.0 Strict or 1.1")) . number_box('e1_chapter_num', _("Failure to add &lt;div class=\"chapter\"&gt; or &lt;div class=\"section\"&gt; at chapter breaks to enable proper page breaks for e-readers")) . number_box('e1_xhtml_genhtml_num', _("Minor HTML errors in code that do not generate an HTML validation alert such as misspelling a language code (Please explain in the Comments Field below)")) . "\n" . comment_box('level1_html_comments')) . tr_w_one_cell_centered("#99ff99", _("LEVEL 2 (Major Errors)")) . tr_w_one_cell_centered("#e0e8dd", _("All Versions")) . tr_w_two_cells(_("Approximate number of errors <br>(Please enter only numbers)"), "" . number_box('e2_markup_num', _("Markup not handled (e.g. blockquotes, poetry indentation, or widespread failure to mark italics)")) . number_box('e2_poetry_num', _("Poetry indentation does not match original")) . number_box('e2_foot_num', _("Footnotes/footnote markers missing or incorrectly placed")) . number_box('e2_printers_num', _("Printers' errors not addressed") . " <a href='{$ppv_guidelines_url}#printers'>***</a>") . number_box('e2_missing_num', _("Missing page(s) or substantial sections of missing text")) . number_box('e2_rewrap_num', _("Substantial rewrapping errors, e.g., poetry has been rewrapped or text version generally not rewrapped to required length (not exceeding 75 characters or falling below 55 characters) except where unavoidable, e.g., some tables though the aim should be 72 characters")) . number_box('e2_hyphen_num', _("Widespread/general occurrences of hyphenated/non-hyphenated, spelling and punctuation variants and other inconsistencies not addressed (may be addressed by note in the TN)")) . number_box('e2_gen_num', _("Other major errors that could seriously impact the readability of the book or that represent major inconsistencies between the text and the HTML versions (Please explain in the Comments Field below)")) . "\n" . comment_box('level2_general_comments')) . tr_w_one_cell_centered("#e0e8dd", _("HTML Version Only")) . tr_w_two_cells(_("Approximate number of errors <br>(Please enter only numbers)"), "" . number_box('e2_tidy_num', _("The W3C Markup Validation Service generates errors or warning messages (Please enter number of errors)")) . number_box('e2_csscheck_num', _("The W3C CSS Validation Service generates errors or warning messages other than for the dropcap \"transparent\" element (Please enter number of errors)")) . number_box('e2_links_num', _("Non-working links within HTML or to images. (Either broken or link to wrong place/file)")) . number_box('e2_file_num', _("File and folder names not in lowercase or contain spaces, images not in \"images\" folder, etc.")) . number_box('e2_cover_num', _("Cover image has not been included and/or has not been coded for e-reader use. (For example, the cover should be 600x800px or at least 500px wide and no more than 800px high and should be called cover.jpg. Also, if the cover is newly created, it must meet <a href='http://www.pgdp.net/wiki/PP_guide_to_cover_pages#DP_policy'>current DP guidelines</a>.)")) . number_box('e2_epub_num', _("Project not presentable/useable when put through epubmaker") . " <a href='{$ppv_guidelines_url}#reader'>****</a>") . number_box('e2_heading_num', _("Heading elements used for things that are not headings and failure to use hierarchical headings for book, chapter and section headings (single h1, appropriate h2s and h3s etc.)"))) . tr_w_one_cell_centered("#99ff99", _("STRONGLY RECOMMENDED<br />(Failure to follow these guidelines will not be tabulated as errors, but the PPer should be counselled to correct any problems)")) . tr_w_two_cells(_("Occurrence"), "" . check_box('s_multi', _("Enclose entire multi-part headings within the related heading tag")) . check_box('s_empty', _("Avoid using empty tags (with &amp;nbsp; entities) or &lt;br /&gt; elements for vertical spacing. e.g. &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; (or with nbsps) -- &lt;td&gt;&amp;nbsp;&lt;/td&gt; is still acceptable though")) . check_box('s_list', _("List Tags should be used for lists (e.g., a normal index)")) . check_box('s_text', _("Include all text as text, not just as images")) . check_box('s_code', _("Keep your code line lengths reasonable")) . check_box('s_tables', _("Tables should display left, right, and center justification and top and bottom align appropriately")) . check_box('s_th', _("Tables contain &lt;th&gt; elements for headings")) . check_box('s_thumbs', _("Remove thumbs.db file from the images folder")) . check_box('s_ereader', _("E-reader version, although without major flaws, should also look as good as possible"))) . tr_w_one_cell_centered("#99ff99", _("MILDLY RECOMMENDED<br />(Failure to follow these guidelines will not be tabulated as errors, and any corrections are solely at the discretion of the PPVer and PPer)")) . tr_w_two_cells(_("Occurrence"), "" . check_box('m_semantic', _("Distinguish between purely decorative italics/bold/gesperrt and semantic uses of them")) . check_box('m_space', _("Include space before the slash in self-closing tags (e.g. &lt;br /&gt;)")) . check_box('m_unusedcss', _("Ensure that there are no unused elements in the CSS (other than the base HTML headings)"))) . tr_w_one_cell_centered("#99ff99", _("GENERAL COMMENTS")) . tr_w_two_cells(_("Did you have to return the project again because the PPer failed to make requested corrections on the second submission? (If so, please explain)"), comment_box('reason_returned')) . tr_w_two_cells(_("General comments on this project or your experience working with this PPer."), comment_box('general_comments')) . tr_w_one_cell_centered($theme['color_logobar_bg'], _("Copies")) . tr_w_two_cells(_("Send to"), "" . check_box('cc_ppv', _("Me")) . check_box('cc_pp', $project->postproofer, TRUE) . "\n                        <p class='single2'><input type='checkbox' name='foo' checked disabled>" . _("PPV Summary (mailing list)") . "</p>") . tr_w_one_cell_centered("#ffffff", "<input type='submit' value='" . attr_safe(_("Submit")) . "'>") . "\n        </table>\n    </form>";
}
if ($action == SHOW_BLANK_ENTRY_FORM) {
    echo $entry_form;
} else {
    if ($action == HANDLE_ENTRY_FORM_SUBMISSION) {
        if ($n_form_problems > 0) {
            if ($n_form_problems == 1) {
                $message = _("There was a problem with a form input, as detailed below. Please fix it and re-submit.");
            } else {
                $message = sprintf(_("There were problems with %d form inputs, as detailed below. Please fix them and re-submit."), $n_form_problems);
            }
            echo "\n<p class='form_problem'>{$message}</p>\n";
            // Show the form as the user filled it in,
            // with embedded problem-reports.
            echo $entry_form;
Exemple #6
0
    echo "<64 cols: ok\n";
}
$im = imagecreate(10, 10);
for ($i = 0; $i < 127; $i++) {
    $c = imagecolorallocate($im, $i, $i, $i);
}
imagefilledrectangle($im, 5, 5, 10, 10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i, $i, $i)) {
    echo "<128 cols: ok\n";
}
$im = imagecreate(10, 10);
for ($i = 0; $i < 255; $i++) {
    $c = imagecolorallocate($im, $i, $i, $i);
}
imagefilledrectangle($im, 5, 5, 10, 10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i, $i, $i)) {
    echo "<256 cols: ok\n";
}
$im = imagecreatefromjpeg($cwd . '/conv_test.jpeg');
imagefilledrectangle($im, 5, 5, 10, 10, 0xffffff);
imagegif($im, $cwd . '/test_gif.gif');
imagegif($im, $cwd . '/test_gif_2.gif');
if (check_box(255, 255, 255, 10)) {
    echo ">256 cols: ok\n";
}
@unlink($cwd . "/test_gif.gif");
@unlink($cwd . "/test_gif_2.gif");
				<tr>
					<td valign="top" width="100%">
						<fieldset>
						<legend><b>General</b></legend>
						<table>
							<tr>
								<td class="label">Anchor Name:</td>
								<td colspan="3"><?php 
text_box('name', $_GET['name'], 40, 0);
?>
								</td>
							</tr>
							<tr>
								<td class="label">Remove:</td>
								<td colspan="3"><?php 
check_box('remove', empty($_GET['name']) ? '0' : '1', FALSE, '', empty($_GET['name']) ? 'disabled=true' : '');
?>
								</td>
							</tr>
						</table>
						</fieldset>
					</td>
				</tr>
			</table>

			<div class="sq-popup-button-wrapper">
			<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
			&nbsp;
			<button type="button" name="ok" onclick="return onOK();" class="sq-btn-green">OK</button>
			</div>
		</form>
Exemple #8
0
				<div class="large-6 columns"><label>Delete other peoples</label></div>
				<?php 
echo check_box($lang, $permissions, 'roles', 'delete');
?>

				<div class="large-6 columns"><label>Assign Guides</label></div>
				<?php 
echo check_box($lang, $permissions, 'roles', 'assignGuide');
?>

				<div class="large-6 columns"><label>Assign Pathways</label></div>
				<?php 
echo check_box($lang, $permissions, 'pathways', 'assignRole');
?>
			</div>

			<h4><i class="aicon-config"></i><?php 
echo $lang->config;
?>
</h4>
			<div class="row">
				<div class="large-6 columns"><label>Dev tools (pagedata/blacklisting):</label></div>
				<?php 
echo check_box($lang, $permissions, 'config', 'read');
?>
			</div>

		</div>
	</div>
</div>
 public function check_box($method, $options = array(), $checkedValue = '1', $uncheckedValue = '0')
 {
     return check_box($this->objectName, $method, $this->object, $options, $checkedValue, $uncheckedValue);
 }
		

																    <span class="label"><?php 
echo translate('Class');
?>
:</span>
																    <?php 
text_box('class_name', $_GET['class_name'], 15);
?>
															
																	<span class="label"><?php 
echo translate('Include Summary');
?>
:</span>
																	<?php 
check_box('show_summary', 1, $_GET['show_summary']);
?>
																</td>	
															</tr>
															<tr>	
																<td class="label"><?php 
echo translate('Title');
?>
:</td>															
																<td colspan="2">																														
																	<?php 
text_box('link_title', $_GET['link_title'], 50);
?>
																</td>															
															</tr>
														</table>