if (array_get($value, 'required', false) === TRUE) {
        $wrapper_classes[] = 'required';
        $wrapper_attributes[] = 'required';
    }
    if ($fieldtype === 'password') {
        $wrapper_classes[] = 'input-text';
        $wrapper_attributes[] = "data-bind='visible: showChangePassword, css: {required: showChangePassword}'";
    }
    if ($fieldtype === 'show_password') {
        $wrapper_attributes[] = "data-bind='visible: showChangePassword() !== true'";
        if (!array_get($value, 'display')) {
            $value['display'] = Localization::fetch('password');
        }
    }
    // If no display label is set, we'll prettify the fieldname itself
    $value['display'] = array_get($value, 'display', Slug::prettify($key));
    ?>

        <div class="<?php 
    echo implode($wrapper_classes, ' ');
    ?>
" <?php 
    echo implode($wrapper_attributes, ' ');
    ?>
>
          <?php 
    print Fieldtype::render_fieldtype($fieldtype, $key, $value, $val, tabindex(), $input_key, null, $error);
    ?>
        </div>

      <?php 
Ejemplo n.º 2
0
function display_folder($app, $folder, $base = "")
{
    ?>
  <ul class="subpages">
  <?php 
    foreach ($folder as $page) {
        ?>
  <?php 
        if (CP_Helper::is_page_visible($page)) {
            ?>
  <li class="page">
    <div class="page-wrapper">
      <div class="page-primary">

      <!-- PAGE TITLE -->
        <?php 
            if ($page['type'] == 'file') {
                ?>
          <a href="<?php 
                print $app->urlFor('publish') . "?path={$base}/{$page['slug']}";
                ?>
"><span class="page-title"><?php 
                print isset($page['title']) ? $page['title'] : Slug::prettify($page['slug']);
                ?>
</span></a>
        <?php 
            } else {
                ?>
          <a href="<?php 
                print $app->urlFor('publish') . "?path={$page['file_path']}";
                ?>
"><span class="page-title"><?php 
                print isset($page['title']) ? $page['title'] : Slug::prettify($page['slug']);
                ?>
</span></a>

        <?php 
            }
            ?>

      <!-- ENTRIES -->
      <?php 
            if (isset($page['has_entries']) && $page['has_entries']) {
                ?>
        <div class="control-entries">
          <span class="ss-icon">textfile</span>
          <span class="muted"><?php 
                echo $page['entries_label'];
                ?>
:</span>
          <a href="<?php 
                print $app->urlFor('entries') . "?path={$base}/{$page['slug']}";
                ?>
">
            <?php 
                echo Localization::fetch('list');
                ?>
          </a>
          <span class="muted"><?php 
                echo Localization::fetch('or');
                ?>
</span>
          <a href="<?php 
                print $app->urlFor('publish') . "?path={$base}/{$page['slug']}&new=true";
                ?>
">
            <?php 
                echo Localization::fetch('create');
                ?>
          </a>
        </div>
      <?php 
            }
            ?>
      </div>

      <!-- SLUG & VIEW PAGE LINK -->
      <div class="page-extras">

        <div class="page-view">
          <a href="<?php 
            print Path::tidy(Config::getSiteRoot() . '/' . $page['url']);
            ?>
" class="tip" title="View Page">
            <span class="ss-icon">link</span>
          </a>
        </div>

        <?php 
            if ($page['type'] != 'file' && Config::get('_enable_add_child_page', true)) {
                ?>
          <div class="page-add"><a href="#" data-path="<?php 
                print $page['raw_url'];
                ?>
" data-title="<?php 
                print $page['title'];
                ?>
" class="tip add-page-btn add-page-modal-trigger" title="<?php 
                echo Localization::fetch('new_child_page');
                ?>
"><span class="ss-icon">addfile</span></a></div>
        <?php 
            }
            ?>

        <?php 
            if (Config::get('_enable_delete_page', true)) {
                ?>
          <div class="page-delete">
            <?php 
                if (array_get($page, '_admin:protected', false)) {
                    ?>
              <a alt="This page is protected" class="tip"><span class="ss-icon protected">lock</span></a>
            <?php 
                } else {
                    ?>
              <a class="confirm tip" href="<?php 
                    print $app->urlFor('delete_page') . '?path=' . $page['raw_url'] . '&type=' . $page['type'];
                    ?>
" title="<?php 
                    echo Localization::fetch('delete_page');
                    ?>
" data-confirm-message="<?php 
                    echo Localization::fetch('pagedelete_confirm');
                    ?>
">
                <span class="ss-icon">delete</span>
              </a>
            <?php 
                }
                ?>
          </div>
        <?php 
            }
            ?>

        <div class="slug-preview">
          <?php 
            print isset($page['url']) ? $page['url'] : $base . ' /' . $page['slug'];
            ?>
        </div>

      </div>

    </div>
    <?php 
            if (isset($page['children']) && sizeof($page['children']) > 0) {
                display_folder($app, $page['children'], $base . "/" . $page['slug']);
            }
            ?>

  </li>
  <?php 
        }
        ?>
  <?php 
    }
    ?>
  </ul>
  <?php 
}
<div class="container">
  <form action="<?php 
echo $app->urlFor('globes') . '/update';
?>
" method="post" class="primary-form">
    <div class="section content">
      <?php 
foreach ($globals as $key => $field) {
    ?>
      <?php 
    $input_key = 'globals';
    $label = array_key_exists('display', $field) ? $field['display'] : Slug::prettify($field['name']);
    $type = array_key_exists('type', $field) ? $field['type'] : 'text';
    $value = array_key_exists('value', $field) ? $field['value'] : null;
    ?>
			<?php 
    if ($key === 'error') {
        ?>
				<p><b><?php 
        echo $setting;
        ?>
</b></p>
				<pre>
				global:
  			  variable: default value
  				- or -
  				variable_name:
				</pre>
			<?php 
    } else {
        ?>
Ejemplo n.º 4
0
 /**
  * Renders the grid field
  *
  * @return void
  */
 public function render()
 {
     // determine boundaries
     $max_rows = array_get($this->field_config, 'max_rows', false);
     $min_rows = array_get($this->field_config, 'min_rows', false);
     $max_rows_attr = $max_rows ? " data-max-rows='{$max_rows}'" : '';
     $min_rows_attr = $min_rows ? " data-min-rows='{$min_rows}'" : '';
     $starting_rows = array_get($this->field_config, 'starting_rows', 1);
     // create header row
     // -------------------------------------------------------------------------
     $html = "<thead>\n<tr>\n";
     $html .= "<th class='row-count'></th>";
     // Set Width
     foreach ($this->field_config['fields'] as $key => $cell_field_config) {
         $width = array_get($cell_field_config, 'width', 'auto');
         $html .= "<th style='width:{$width}'>" . array_get($cell_field_config, 'display', Slug::prettify($key)) . "</th>\n";
     }
     $html .= "</tr>\n</thead>\n";
     // create grid rows
     // -------------------------------------------------------------------------
     $html .= "<tbody>\n";
     # rows to render, in order will prefer: starting_rows, min_rows, 1
     if (isset($this->field_config['min_rows']) && is_numeric($this->field_config['min_rows'])) {
         $rows_to_render = $this->field_config['min_rows'];
     } else {
         $rows_to_render = $starting_rows;
     }
     # render the rows
     $i = 1;
     if (isset($this->field_data) && is_array($this->field_data) && count($this->field_data) > 0) {
         foreach ($this->field_data as $key => $row) {
             $html_row = "<tr>";
             $html_row .= "<th class='row-count drag-indicator'><div class='count'>{$i}</div>";
             $html_row .= "<a href='#' class='grid-delete-row confirm'><span class='ss-icon'>delete</span></a>";
             $html_row .= "</td></th>";
             foreach ($this->field_config['fields'] as $cell_field_name => $cell_field_config) {
                 $column = key($row);
                 $column_data = isset($row[$cell_field_name]) ? $row[$cell_field_name] : '';
                 $default = isset($cell_field_config['default']) ? $cell_field_config['default'] : '';
                 $celltype = array_get($cell_field_config, 'type', 'text');
                 $html_row .= "<td class='cell-{$celltype}' data-default='{$default}'>";
                 $name = $this->field . '][' . $key . '][' . $cell_field_name;
                 $html_row .= Fieldtype::render_fieldtype($celltype, $name, $cell_field_config, $column_data);
                 $html_row .= "</td>";
             }
             $html_row .= "</tr>\n";
             $html .= $html_row;
             $i++;
         }
     } else {
         # no rows, set a blank one
         for ($i; $i <= $rows_to_render; $i++) {
             $html .= $this->render_empty_row($i - 1);
         }
     }
     $html .= "</tbody>\n</table>\n";
     // If max_rows is 1, we shouldn't have an "add row" at all.
     if (array_get($this->field_config, 'max_rows', 9999) > $starting_rows) {
         $html .= "<a href='#' class='grid-add-row btn btn-small btn-icon'><span class='ss-icon'>add</span></a>";
     }
     $empty_row = ' data-empty-row="' . htmlspecialchars($this->render_empty_row(0)) . '"';
     $html = "<table class='grid table-list' tabindex='{$this->tabindex}'" . $max_rows_attr . $min_rows_attr . $empty_row . ">" . $html;
     return $html;
 }
Ejemplo n.º 5
0
Archivo: publish.php Proyecto: nob/joi
    // The default fieldtype is Text.
    $fieldtype = isset($value['type']) ? $value['type'] : 'text';
    // Value
    $val = "";
    if (isset(${$key})) {
        $val = ${$key};
    } elseif (isset($value['default'])) {
        $val = $value['default'];
    }
    # Status is a special system fieldtype
    if ($fieldtype == 'status' && isset($status)) {
        $val = $status;
    }
    // If no display label is set, we'll prettify the fieldname itself
    if (!isset($value['display'])) {
        $value['display'] = Slug::prettify($key);
    }
    // By default all fields are part of the 'yaml' key. They may need to be overridden
    // to set a meta/system field, like Content.
    $input_key = array_get($value, 'input_key', '[yaml]');
    ?>

        <div class="input-block input-<?php 
    print $fieldtype;
    ?>
 <?php 
    if (isset($value['required']) && $value['required'] === TRUE) {
        print ' required';
    }
    ?>
">
Ejemplo n.º 6
0
    /*
    |--------------------------------------------------------------------------
    | Fieldsets
    |--------------------------------------------------------------------------
    |
    | Get all the available fieldsets, removing any hidden ones as necessary
    |
    */
    $fieldsets = Statamic_Fieldset::get_list();
    foreach ($fieldsets as $key => $fieldset) {
        // Remove hidden fieldsets
        if (isset($fieldset['hide']) && $fieldset['hide'] === true) {
            unset($fieldsets[$key]);
            // set a fallback name
        } elseif (!isset($fieldset['title'])) {
            $fieldsets[$key]['title'] = Slug::prettify($key);
        }
    }
    // Sort fieldsets by title
    uasort($fieldsets, function ($a, $b) {
        return strcmp($a['title'], $b['title']);
    });
    #######################################################################
    Statamic_View::set_templates(array_reverse($template_list));
    $admin_app->render(null, array('route' => 'pages', 'app' => $admin_app, 'errors' => $errors, 'path' => $path, 'pages' => $pages, 'fieldsets' => $fieldsets, 'are_fieldsets' => count($fieldsets) > 0 ? true : false, 'listings' => Statamic::get_listings()));
})->name('pages');
$admin_app->get('/entries', function () use($admin_app) {
    authenticateForRole('admin');
    doStatamicVersionCheck($admin_app);
    $template_list = array("entries");
    $path = $admin_app->request()->get('path');
Ejemplo n.º 7
0
" data-bind="checked: selectedEntries" >
            <?php 
    }
    ?>
            </td>

            <td class="title">
              <a href="<?php 
    print $app->urlFor('publish');
    ?>
?path=<?php 
    echo Path::tidy($path . '/');
    echo $slug;
    ?>
"><?php 
    print isset($entry['title']) && $entry['title'] != '' ? $entry['title'] : Slug::prettify($entry['slug']);
    ?>
</a>
            </td>

            <?php 
    if ($type == 'date') {
        ?>
              <td data-fulldate="<?php 
        echo $entry['datestamp'];
        ?>
">
                  <?php 
        echo Date::format(Config::getDateFormat('Y/m/d'), $entry['datestamp']);
        ?>
              </td>
Ejemplo n.º 8
0
Archivo: pages.php Proyecto: nob/joi
            <a href="<?php 
        print $app->urlFor('publish') . "?path={$page['url']}";
        ?>
"><span class="page-title"><?php 
        print $page['title'];
        ?>
</span></a>
          <?php 
    } else {
        $folder = dirname($page['file_path']);
        ?>
            <a href="<?php 
        print $app->urlFor('publish') . "?path={$page['file_path']}";
        ?>
"><span class="page-title"><?php 
        print isset($page['title']) && $page['title'] != '' ? $page['title'] : Slug::prettify($page['slug']);
        ?>
</span></a>
          <?php 
    }
    ?>

          <?php 
    if (array_get($page, 'has_entries', false)) {
        ?>
            <div class="control-entries">
              <span class="ss-icon">textfile</span>
              <span class="muted"><?php 
        echo Localization::fetch('entries');
        ?>
:</span>
 /**
  * Build fieldtypes with data from front matter
  * 
  * @param  int    $i     The index of the field in the set
  * @param  array  $set The set's field config
  * @param  array  $data  This set's front matter data
  * @return array
  */
 private function fieldtypes($i, $set, $data)
 {
     $set_fields = array_get($set, 'fields', array());
     $fieldtypes = array();
     foreach ($set_fields as $field_name => $field) {
         $key = "[yaml][{$this->field}][{$i}]";
         $id = $field_name . '_' . $i;
         $field_data = array_get($data, $field_name);
         $field_type = array_get($field, 'type', 'text');
         $field_config = $set['fields'][$field_name];
         $field_config['display'] = array_get($field_config, 'display', Slug::prettify($field_name));
         if ($field_type == 'grid') {
             $field_name = "{$this->field}][{$i}][{$field_name}";
         }
         $fieldtypes[] = array('type' => $field_type, 'field_name' => $key, 'fieldtype' => Fieldtype::render_fieldtype($field_type, $field_name, $field_config, $field_data, null, $key, $id));
     }
     return $fieldtypes;
 }
 ><?php 
    echo Slug::prettify($name);
    ?>
</a></li>
    <?php 
}
?>
  </ul>
</div>

<div class="container">

  <div id="status-bar" class="web">
    <div class="status-block">
      <strong><?php 
echo Slug::prettify($formset['name']);
?>
</strong> <span class="muted"><?php 
echo Localization::fetch('form', null, true);
?>
 <?php 
echo Localization::fetch('submissions', null, true);
?>
    </div>
    <ul>
      <li>
        <a href="<?php 
echo $app->urlFor("raven") . '/' . $name;
?>
/export">
          <span class="ss-icon">downloadfile</span>
Ejemplo n.º 11
0
    <li><a href="<?php 
echo $app->urlFor("raven");
?>
" class="active"><?php 
echo Localization::fetch('Overview');
?>
</a></li>
    <li class="separator">&nbsp;</li>
    <?php 
foreach ($formsets as $name => $values) {
    ?>
      <li><a href="<?php 
    echo $app->urlFor("raven") . '/' . $name;
    ?>
"><?php 
    echo Slug::prettify($name);
    ?>
</a></li>
    <?php 
}
?>
  </ul>
</div>

<div class="container">

  <div id="status-bar" class="web">
    <div class="status-block">
      <span class="muted"><?php 
echo Localization::fetch('raven_forms');
?>
Ejemplo n.º 12
0
Archivo: helper.php Proyecto: nob/joi
 /**
  * prettify
  * Converts a string from underscore-slug-format to normal-format
  *
  * @deprecated  Use Slug::prettify() instead
  *
  * @param string  $string  String to convert
  * @return string
  */
 public static function prettify($string)
 {
     Log::warn("Use of Statamic_Helper::prettify() is deprecated. Use Slug::prettify() instead.", "core", "Statamic_Helper");
     return Slug::prettify($string);
 }