function cg2_combopage_getOptions($function, $name, $description, $type) { // error checking if (@$_REQUEST['_showCode']) { $errorsAndAlerts = ''; if (!@$_REQUEST['tableName']) { alert("Please select a section!<br />\n"); } if (!@$_REQUEST['howMany']) { alert("Please select 'How Many'!<br />\n"); } if (!@$_REQUEST['titleField']) { alert("Please select a Title field!<br />\n"); } if (!alert()) { // if no other errors, check fields exist in schema $schema = loadSchema($_REQUEST['tableName']); if (!in_array($_REQUEST['titleField'], array_keys($schema))) { alert("Invalid field '" . htmlencode($_REQUEST['titleField']) . "' selected!<br/>\n"); } } if (!alert()) { return; } // if form submitted and no errors than return and generate code } // set form defaults $defaults['howMany'] = 'all'; $defaults['limit'] = '5'; $defaults['showUploads'] = 'all'; $defaults['showUploadsCount'] = '1'; $defaults['titleField'] = 'title'; foreach ($defaults as $key => $value) { if (!array_key_exists($key, $_REQUEST)) { $_REQUEST[$key] = $value; } } // show header echo cg2_header($function, $name); print "<input type='hidden' name='_showCode' value='1' />\n"; cg2_combopage_ajaxJsCode(); // show ajax js code ?> <div class="code-generator" style="display: block; "> <?php cg2_option_selectSection(); ?> <div class='content-box content-box-divider'> <div class='content-box-header'><h3><?php echo t('List Viewer Options'); ?> </h3></div> </div> <div class="fieldOption"> <div class="label"><?php et('How Many'); ?> </div> <div style="float:left; line-height: 1.5em"> <label> <?php echo cg2_inputRadio('howMany', 'all'); ?> <?php et('Show all records'); ?> </label><br/> <label> <?php echo cg2_inputRadio('howMany', 'firstN'); ?> <?php echo sprintf(t('Show the first %s records only'), cg2_inputText('limit', 3)); ?> </label><br/><br/> </div> <div class="clear"></div> </div> <div class="fieldOption"> <div class="label"><?php et('Title/Name field'); ?> </div> <?php echo cg2_inputSchemaField('titleField'); ?> <div class="clear"></div> </div> <div class='content-box content-box-divider'> <div class='content-box-header'><h3><?php echo t('Detail Viewer Options'); ?> </h3></div> </div><br/> <?php cg2_option_uploads(); ?> <div align="center" style="padding-right: 5px" class="fieldOption"><input class="button" type="submit" name="_null_" value="<?php echo t('Show Code'); ?> >>" /></div> </div> <?php echo cg2_footer(); exit; }
function cg2_listpage_getOptions($function, $name, $description, $type) { // error checking if (@$_REQUEST['_showCode']) { $errorsAndAlerts = ''; if (!@$_REQUEST['tableName']) { alert("Please select a section!<br />\n"); } if (!alert()) { return; } // if form submitted and no errors than return and generate code } // set form defaults $defaults['howMany'] = 'all'; $defaults['orderBy'] = 'default'; $defaults['showUploads'] = 'all'; $defaults['showUploadsCount'] = '1'; $defaults['allowSearching'] = 0; $defaults['limit'] = 5; $defaults['perPage'] = 10; foreach ($defaults as $key => $value) { if (!array_key_exists($key, $_REQUEST)) { $_REQUEST[$key] = $value; } } // show header echo cg2_header($function, $name); print "<input type='hidden' name='_showCode' value='1' />\n"; ?> <div class="code-generator" style="display: block; "> <?php cg2_option_selectSection(); ?> <div class='content-box content-box-divider'> <div class='content-box-header'><h3><?php echo t('Viewer Options'); ?> </h3></div> </div> <div class="fieldOption"> <div class="label"><?php et('How Many'); ?> </div> <div style="float:left; line-height: 1.5em"> <label> <?php echo cg2_inputRadio('howMany', 'all'); ?> <?php et('Show all records'); ?> </label><br/> <label> <?php echo cg2_inputRadio('howMany', 'firstN'); ?> <?php echo sprintf(t('Show the first %s records only'), cg2_inputText('limit', 3)); ?> </label><br/> <label> <?php echo cg2_inputRadio('howMany', 'paged'); ?> <?php echo sprintf(t('Show %s records per page with prev & next page links'), cg2_inputText('perPage', 3)); ?> </label><br/><br/> </div> <div class="clear"></div> </div> <?php cg2_option_sorting(); cg2_option_uploads(); ?> <div class="fieldOption"> <div class="label"><?php et('Allow Searching'); ?> </div> <div style="float:left"> <?php echo cg2_inputCheckbox('allowSearching'); ?> <label for="allowSearching"> <?php et('Filter results based on search form input (disable for multiple viewers on one page)'); ?> </label><br/><br/> </div> <div class="clear"></div> </div> <div align="center" style="padding-right: 5px" class="fieldOption"><input class="button" type="submit" name="_null_" value="<?php echo t('Show Code >>'); ?> " /></div> </div> <?php echo cg2_footer(); exit; }
function cg2_detailpage_getOptions($function, $name, $description, $type) { // error checking if (@$_REQUEST['_showCode']) { $errorsAndAlerts = ''; if (!@$_REQUEST['tableName']) { alert(t("Please select a section!") . "<br />\n"); } if (!@$_REQUEST['whichRecord']) { alert(t("Please select a value for 'which record'") . "!<br />\n"); } if (!alert()) { return; } // if form submitted and no errors than return and generate code } // set form defaults $defaults['whichRecord'] = ''; $defaults['recordNumCustom'] = '1'; $defaults['showUploads'] = 'all'; $defaults['showUploadsCount'] = '1'; foreach ($defaults as $key => $value) { if (!array_key_exists($key, $_REQUEST)) { $_REQUEST[$key] = $value; } } // show header echo cg2_header($function, $name); print "<input type='hidden' name='_showCode' value='1' />\n"; ?> <div class="code-generator" style="display: block; "> <?php cg2_option_selectSection(); ?> <div class='content-box content-box-divider'> <div class='content-box-header'><h3><?php eht("Viewer Options"); ?> </h3></div> </div> <div class="fieldOption"> <div class="label"><?php et('Which Record'); ?> </div> <div style="float:left; line-height: 1.5em"> <label> <?php echo cg2_inputRadio('whichRecord', 'first'); ?> <?php et("Single record sections: Load first record in database"); ?> </label><br/> <label> <?php echo cg2_inputRadio('whichRecord', 'url'); ?> <?php et("Multi record sections: Get record # from end of url. eg: viewer.php?record_title-3"); ?> </label><br/> <label> <?php echo cg2_inputRadio('whichRecord', 'custom'); ?> <?php echo sprintf(t('Custom: Load record # %s'), cg2_inputText('recordNumCustom', 6)); ?> </label><br/><br/> </div> <div class="clear"></div> </div> <?php cg2_option_uploads(); ?> <div align="center" style="padding-right: 5px" class="fieldOption"><input class="button" type="submit" name="_null_" value="<?php echo t('Show Code >>'); ?> " /></div> </div> <?php echo cg2_footer(); exit; }