예제 #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;
}
예제 #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;
}
예제 #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;
}
예제 #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_categorypage_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 (for future use)
    $defaults = array();
    $defaults['defaultCategory'] = 'first';
    foreach ($defaults as $key => $value) {
        if (!array_key_exists($key, $_REQUEST)) {
            $_REQUEST[$key] = $value;
        }
    }
    // show header
    echo cg2_header($function, $name);
    cg2_categorypage_ajaxJsCode();
    print "<input type='hidden' name='_showCode' value='1' />\n";
    ?>

  <div class="code-generator" style="display: block; ">

    <?php 
    cg2_option_selectSection(array('category'));
    ?>

    <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" style="padding-top: 6px"><?php 
    et('Category Format');
    ?>
</div>
      
      <?php 
    $valuesToLabels = array('showall' => t('Show All'), 'onelevel' => t('One Level'), 'twolevel' => t('Two Level'), 'breadcrumb' => t('Breadcrumb'));
    $optionsHTML = getSelectOptions(@$_REQUEST['categoryFormat'], array_keys($valuesToLabels), array_values($valuesToLabels));
    ?>
      <select name="categoryFormat">
        <?php 
    echo $optionsHTML;
    ?>
      </select>
      <div class="clear"></div>
    </div>
    
    <div class="fieldOption">
      <div class="label" style="padding-top: 6px"><?php 
    et('Output HTML Style');
    ?>
</div>
      <?php 
    $valuesToLabels = array('list' => t('Unordered List (UL, LI tags)'), 'indent' => t('Indented Text'));
    $optionsHTML = getSelectOptions(@$_REQUEST['outputHtmlStyle'], array_keys($valuesToLabels), array_values($valuesToLabels));
    ?>
      <select name="outputHtmlStyle">
        <?php 
    echo $optionsHTML;
    ?>
      </select>
      <div class="clear"></div>
    </div>


    <div class="fieldOption">
      <div class="label" style="padding-top: 6px"><?php 
    et('Default Category');
    ?>
</div>
      <div style="float:left; line-height: 1.5em">
          <label>
            <?php 
    echo cg2_inputRadio('defaultCategory', '');
    ?>
            <?php 
    et("None - No category will be selected");
    ?>
          </label><br/>
          <label>
            <?php 
    echo cg2_inputRadio('defaultCategory', 'first');
    ?>
            <?php 
    et('First - The first category will be selected');
    ?>
          </label><br/>
  
          <label>
            <?php 
    echo cg2_inputRadio('defaultCategory', 'num');
    ?>
            <?php 
    et('Category - The following category will be selected');
    ?>
&nbsp;
          </label>  
            <select name="defaultCategoryNum" style="padding: 2px; margin: -2px; ">
              <?php 
    echo __getCategoryNames_asSelectOptions('defaultCategoryNum');
    ?>
            </select>
          <br/>
      </div>

      <div class="clear"></div>
    </div>



    <div class='content-box content-box-divider'>
      <div class='content-box-header'><h3><?php 
    echo t('Advanced Options');
    ?>
</h3></div>
    </div>
    
    <div class="fieldOption">
      <div class="label" style="padding-top: 6px"><?php 
    et('Category Root');
    ?>
</div>
      <select name="rootCategoryNum">
        <?php 
    echo __getCategoryNames_asSelectOptions('rootCategoryNum');
    ?>
      </select>
      <?php 
    et("For menu branches - only categories below this one will be displayed");
    ?>
      <div class="clear"></div>
    </div>
    
    <br/>
    <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;
}