Exemplo n.º 1
0
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 &amp; 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  &gt;&gt;');
    ?>
" /></div>
</div>


  <?php 
    echo cg2_footer();
    exit;
}
Exemplo n.º 2
0
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');
    ?>
 &gt;&gt;" /></div>
</div>


  <?php 
    echo cg2_footer();
    exit;
}
Exemplo n.º 3
0
function cg2_rssfeed_getOptions($function, $name, $description, $type)
{
    // error checking
    if (@$_REQUEST['_showCode']) {
        $errorsAndAlerts = '';
        if (!@$_REQUEST['tableName']) {
            alert("Please select a section!<br />\n");
        }
        if (!@$_REQUEST['feedTitle']) {
            alert("Please enter a value for Feed Title!<br />\n");
        }
        if (!@$_REQUEST['feedLink']) {
            alert("Please enter a value for Feed Link!<br />\n");
        }
        if (!@$_REQUEST['feedDescription']) {
            alert("Please enter a value for Feed Description!<br />\n");
        }
        if (!@$_REQUEST['feedLanguage']) {
            alert("Please enter a value for Feed Language!<br />\n");
        }
        if (!@$_REQUEST['titleField']) {
            alert("Please select a title field!<br />\n");
        }
        if (!@$_REQUEST['descriptionField']) {
            alert("Please enter a description 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 (!in_array($_REQUEST['descriptionField'], array_keys($schema))) {
                alert("Invalid field '" . htmlencode($_REQUEST['descriptionField']) . "' 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'] = 25;
    $defaults['feedTitle'] = "Name of your site or RSS feed";
    $defaults['feedLink'] = "http://www.example.com/";
    $defaults['feedDescription'] = 'Your site description goes here';
    $defaults['feedLanguage'] = 'en-us';
    $defaults['titleField'] = '';
    $defaults['descriptionField'] = '';
    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_rssfeed_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 
    eht("Feed 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>

<br/>

  <div class="fieldOption">
    <div class="label"><?php 
    et('Feed Title');
    ?>
</div>
    <?php 
    echo cg2_inputText('feedTitle', 60, true);
    ?>
  </div>

  <div class="fieldOption">
    <div class="label"><?php 
    et('Feed Link');
    ?>
</div>
    <?php 
    echo cg2_inputText('feedLink', 60, true);
    ?>
    <div class="clear"></div>
  </div>

  <div class="fieldOption">
    <div class="label"><?php 
    et('Feed Description');
    ?>
</div>
    <?php 
    echo cg2_inputText('feedDescription', 60, true);
    ?>
    <div class="clear"></div>
  </div>

  <div class="fieldOption">
    <div class="label"><?php 
    et('Feed Language');
    ?>
</div>
    <?php 
    echo cg2_inputText('feedLanguage', 60, true);
    ?>
    <div class="clear"></div>
  </div>

<br/><br/>

    <div class="fieldOption">
      <div class="label"><?php 
    et('Title field');
    ?>
</div>
      <?php 
    echo cg2_inputSchemaField('titleField');
    ?>
      <div class="clear"></div>
    </div>

    <div class="fieldOption">
      <div class="label"><?php 
    et('Description field');
    ?>
</div>
      <?php 
    echo cg2_inputSchemaField('descriptionField');
    ?>
      <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 &gt;&gt;');
    ?>
" /></div>
</div>


  <?php 
    echo cg2_footer();
    exit;
}
Exemplo n.º 4
0
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 &gt;&gt;');
    ?>
 " /></div>
</div>


<?php 
    echo cg2_footer();
    exit;
}
function cg2_option_uploads()
{
    ?>
  <div class="fieldOption">
    <div class="label"><?php 
    et('Show Uploads');
    ?>
</div>
    <div style="float:left; line-height: 1.5">
        <label>
          <?php 
    echo cg2_inputRadio('showUploads', 'all');
    ?>
          <?php 
    et("Show all uploads");
    ?>
        </label><br/>

        <label>
          <?php 
    echo cg2_inputRadio('showUploads', 'limit');
    ?>
          <?php 
    echo sprintf(t('Show %s uploads'), cg2_inputText('showUploadsCount', 3));
    ?>
        </label><br/>

        <label>
          <?php 
    echo cg2_inputRadio('showUploads', 'none');
    ?>
          <?php 
    et("Don't show uploads");
    ?>
        </label><br/><br/>

    </div>
    <div class="clear"></div>
  </div>
<?php 
}