Exemple #1
0
 public function templates()
 {
     $path = Config::get('view.paths');
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles($path[0] . DIRECTORY_SEPARATOR . Theme::getTheme() . DIRECTORY_SEPARATOR . 'site' . DIRECTORY_SEPARATOR . 'layouts');
     return $files;
 }
 public static function widgets()
 {
     $path = Config::get('view.paths');
     $fileSystem = new Filesystem();
     $theme = Theme::getTheme();
     $files = $fileSystem->allFiles($path[0] . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "admin" . DIRECTORY_SEPARATOR . "widgets");
     return $files;
 }
Exemple #3
0
 public function testGetAvailable()
 {
     $themeName = 'seasons';
     $themes = Theme::getAllThemes();
     $this->assertTrue(is_array($themes));
     $theme = Theme::getTheme($themeName);
     $this->assertTrue($theme instanceof Theme);
     $this->assertEquals($themeName, $theme->directory);
 }
 public function testDisplayConfigForm()
 {
     set_option(Theme::PUBLIC_THEME_OPTION, self::THEME);
     $theme = Theme::getTheme(self::THEME);
     $name = $theme->title;
     $this->request->setParam('name', self::THEME);
     $this->dispatch('themes/config');
     $this->assertController('themes');
     $this->assertAction('config');
     $this->assertQueryContentContains('h2', $name);
     $this->assertQuery('input#logo');
 }
 public function postEdit()
 {
     $themeId = \Input::get('theme');
     $fileName = \Input::get('file');
     $type = \Input::get('type', 'template');
     $content = \Input::get('content');
     $theme = \Theme::getTheme($themeId);
     $files = $theme->getEditFiles();
     $filePath = $files[$type][$fileName];
     try {
         file_put_contents($filePath, $content);
     } catch (\Exception $e) {
         throw new FileAccessDeniedHttpException();
     }
     return \Redirect::back()->with('alert', ['type' => 'success', 'message' => '저장되었습니다.']);
 }
 /**
  * Load the configuration form for a specific theme.  
  * That configuration form will be POSTed back to this URL.
  *
  * @return void
  */
 public function configAction()
 {
     // get the theme name and theme object
     $themeName = $this->_getParam('name');
     $theme = Theme::getTheme($themeName);
     $themeOptions = Theme::getOptions($themeName);
     // get the configuration form
     $form = new Omeka_Form_ThemeConfiguration(array('themeName' => $themeName));
     $form->removeDecorator('Form');
     // process the form if posted
     if ($this->getRequest()->isPost()) {
         $configHelper = new Omeka_Controller_Action_Helper_ThemeConfiguration();
         if ($newOptions = $configHelper->processForm($form, $_POST, $themeOptions)) {
             Theme::setOptions($themeName, $newOptions);
             $this->_helper->flashMessenger(__('The theme settings were successfully saved!'), 'success');
             $this->_helper->redirector('browse');
         } else {
             $this->_helper->_flashMessenger(__('There was an error on the form. Please try again.'), 'error');
         }
     }
     $this->view->configForm = $form;
     $this->view->theme = $theme;
 }
 public function init()
 {
     parent::init();
     $themeName = $this->getThemeName();
     $theme = Theme::getTheme($themeName);
     $themeConfigIni = $theme->path . '/config.ini';
     if (file_exists($themeConfigIni) && is_readable($themeConfigIni)) {
         // get the theme configuration form specification
         $formIni = new Zend_Config_Ini($themeConfigIni);
         $configSource = array('elements' => $formIni->config);
         if (isset($formIni->groups)) {
             $configSource['displayGroups'] = $formIni->groups;
         }
         $configIni = new Zend_Config($configSource);
         // create an omeka form from the configuration file
         $this->setConfig($configIni);
         if (!($themeConfigValues = $this->getThemeOptions())) {
             $themeConfigValues = Theme::getOptions($themeName);
             $this->setThemeOptions($themeConfigValues);
         }
         // configure all of the form elements
         $elements = $this->getElements();
         foreach ($elements as $element) {
             if ($element instanceof Zend_Form_Element_File) {
                 $this->_processFileElement($element);
             }
         }
         // set all of the form element values
         foreach ($themeConfigValues as $key => $value) {
             if ($this->getElement($key)) {
                 $this->{$key}->setValue($value);
             }
         }
     }
     $this->addElement('hash', 'theme_config_csrf', array('timeout' => 3600));
 }
 /**
  * Theme configuration page for an exhibit.
  */
 public function themeConfigAction()
 {
     $exhibit = $this->_helper->db->findById();
     $themeName = (string) $exhibit->theme;
     // Abort if no specific theme is selected.
     if ($themeName == '') {
         $this->_helper->flashMessenger(__('You must specifically select a theme in order to configure it.'), 'error');
         $this->_helper->redirector->gotoRoute(array('action' => 'edit', 'id' => $exhibit->id), 'exhibitStandard');
         return;
     }
     $theme = Theme::getTheme($themeName);
     $previousOptions = $exhibit->getThemeOptions();
     $form = new Omeka_Form_ThemeConfiguration(array('themeName' => $themeName, 'themeOptions' => $previousOptions));
     $form->removeDecorator('Form');
     $themeConfigIni = $theme->path . DIRECTORY_SEPARATOR . 'config.ini';
     if (file_exists($themeConfigIni) && is_readable($themeConfigIni)) {
         try {
             $pluginsIni = new Zend_Config_Ini($themeConfigIni, 'plugins');
             $excludeFields = $pluginsIni->exclude_fields;
             $excludeFields = explode(',', $excludeFields);
         } catch (Exception $e) {
             $excludeFields = array();
         }
         foreach ($excludeFields as $excludeField) {
             trim($excludeField);
             $form->removeElement($excludeField);
         }
     }
     // process the form if posted
     if ($this->getRequest()->isPost()) {
         $configHelper = new Omeka_Controller_Action_Helper_ThemeConfiguration();
         if ($newOptions = $configHelper->processForm($form, $_POST, $previousOptions)) {
             $exhibit->setThemeOptions($newOptions);
             $exhibit->save();
             $this->_helper->_flashMessenger(__('The theme settings were successfully saved!'), 'success');
             $this->_helper->redirector->gotoRoute(array('action' => 'edit', 'id' => $exhibit->id), 'exhibitStandard');
         } else {
             $this->_helper->_flashMessenger(__('There was an error on the form. Please try again.'), 'error');
         }
     }
     $this->view->assign(compact('exhibit', 'form', 'theme'));
 }
Exemple #9
0
}
$body_classes = "items show ";
if ($item_type = $item->getItemType()) {
    $body_classes .= strtolower(str_replace(' ', '-', $item_type->name));
}
if (count($audios) > 0) {
    $body_classes .= " audios";
}
if (count($videos) > 0) {
    $body_classes .= " videos";
}
if (count($images) > 0) {
    $body_classes .= " images";
}
echo head(array('title' => metadata('item', array('Dublin Core', 'Title')), 'bodyclass' => $body_classes));
$theme_path = Theme::getTheme(Theme::getCurrentThemeName())->getAssetPath();
?>


<div id="title-row">
  <div class="title">
    <h2><?php 
echo metadata('item', array('Dublin Core', 'Title'));
?>
</h2>

    <span class="collection">
      <!-- Collections: use CollectionTree or fallback to default -->
      <?php 
if (metadata('item', 'Collection Name')) {
    ?>
 /**
  * fetch email templates
  *
  * @return Response
  */
 private function emailTemplates()
 {
     $path = Config::get('view.paths');
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles($path[0] . DIRECTORY_SEPARATOR . Theme::getTheme() . DIRECTORY_SEPARATOR . "emails");
     return $files;
 }
Exemple #11
0
 /**
  * Editing Widgets
  */
 public function action_edit()
 {
     $id = (int) $this->request->param('id', 0);
     $widget = ORM::factory('widget', $id);
     if (!$widget->loaded()) {
         Log::error('Attempt to access non-existent widget.');
         Message::error(__('Widget doesn\'t exists!'));
         $this->request->redirect(Route::get('admin/widget')->uri());
     }
     $widget_regions = array();
     $adminTheme = Theme::getTheme();
     $frontTheme = Theme::getTheme(Config::get('site.theme', $adminTheme->name));
     if (isset($adminTheme->regions) and !empty($adminTheme->regions)) {
         $widget_regions = Arr::merge($widget_regions, $adminTheme->regions);
     }
     if (isset($frontTheme->regions) and !empty($frontTheme->regions)) {
         $widget_regions = Arr::merge($widget_regions, $frontTheme->regions);
     }
     $handler = Widget::factory($widget->name, $widget);
     $fields = $handler->form();
     // Add a last region for disabled blocks.
     $widget_regions = Arr::merge($widget_regions, array(self::$WIDGET_REGION_NONE => self::$WIDGET_REGION_NONE));
     if (isset($widget_regions[self::$WIDGET_REGION_NONE])) {
         $widget_regions[self::$WIDGET_REGION_NONE] = __('Disabled');
     }
     $all_roles = ORM::factory('role')->find_all()->as_array('id', 'name');
     $this->title = __('Edit %widget widget', array('%widget' => $widget->title));
     $view = View::factory('admin/widget/form')->set('widget', $widget)->set('fields', $fields)->set('roles', $all_roles)->set('regions', $widget_regions);
     if ($this->valid_post('widget')) {
         $widget->values($_POST);
         try {
             $widget->save();
             if (isset($_POST['widget'])) {
                 unset($_POST['widget'], $_POST['_token'], $_POST['_action']);
             }
             $handler->save($_POST);
             Message::success(__('Widget %name updated successful!', array('%name' => $widget->title)));
             Cache::instance('widgets')->delete_all();
             // Redirect to listing
             $this->request->redirect(Route::get('admin/widget')->uri());
         } catch (ORM_Validation_Exception $e) {
             $view->errors = $e->errors('models');
         }
     }
     Assets::select2();
     $this->response->body($view);
 }
queue_js_file(array('vendor/jquery.nestedSortable', 'navigation'));
$title = __('Edit Exhibit "%s"', $exhibit->title);
echo head(array('title' => html_escape($title), 'bodyclass' => 'exhibits'));
?>
    <div id="exhibits-breadcrumb">
        <a href="<?php 
echo html_escape(url('exhibits'));
?>
"><?php 
echo __('Exhibits');
?>
</a> &gt;
        <?php 
echo html_escape($title);
?>
    </div>

<?php 
echo flash();
$theme = $exhibit->theme ? Theme::getTheme($exhibit->theme) : null;
$formArgs = array('exhibit' => $exhibit, 'theme' => $theme);
$formArgs['csrf'] = isset($csrf) ? $csrf : '';
echo common('exhibit-metadata-form', $formArgs, 'exhibits');
?>

<script type="text/javascript">
    Omeka.addReadyCallback(Omeka.ExhibitBuilder.themeConfig);
</script>

<?php 
echo foot();
 function left_block()
 {
     $ret_val = container();
     $hr = html_hr();
     $hr->set_tag_attribute("noshade");
     $hr->set_tag_attribute("size", 2);
     $ret_val->add($hr);
     $div = html_div("ul-big");
     //Mensaje de bienvenida
     $div->add($this->_addFileContent(Theme::getTheme() . Session::getContextValue('texto_ini')));
     $ret_val->add($div);
     return $ret_val;
 }
            ?>
</li>
                <?php 
        }
        ?>
            </ul>
        </td>
        <td><?php 
        echo tag_string($exhibit, 'exhibits');
        ?>
</td>
        <?php 
        if ($exhibit->theme == null) {
            $themeName = __('Current Public Theme');
        } else {
            $theme = Theme::getTheme($exhibit->theme);
            $themeName = !empty($theme->title) ? $theme->title : $exhibit->theme;
        }
        ?>
        <td><?php 
        echo html_escape($themeName);
        ?>
</td>
        <td><?php 
        echo format_date(metadata($exhibit, 'added'));
        ?>
</td>
    </tr>
<?php 
    }
    ?>
Exemple #15
0
<?php

$pageTitle = __('Dashboard');
echo head(array('bodyclass' => 'index primary-secondary', 'title' => $pageTitle));
?>
    
<?php 
$stats = array(array(link_to('items', null, total_records('Item')), __('items')), array(link_to('collections', null, total_records('Collection')), __('collections')), array(link_to('tags', null, total_records('Tag')), __('tags')));
if (is_allowed('Plugins', 'edit')) {
    $stats[] = array(link_to('plugins', null, total_records('Plugin')), __('plugins'));
}
if (is_allowed('Users', 'edit')) {
    $stats[] = array(link_to('users', null, total_records('User')), __('users'));
}
if (is_allowed('Themes', 'edit')) {
    $themeName = Theme::getTheme(Theme::getCurrentThemeName('public'))->title;
    $stats[] = array(link_to('themes', null, $themeName), __('theme'));
}
$stats = apply_filters('admin_dashboard_stats', $stats, array('view' => $this));
?>

<?php 
// Retrieve the latest version of Omeka by pinging the Omeka server.
$userRole = current_user()->role;
if ($userRole == 'super' || $userRole == 'admin') {
    $latestVersion = latest_omeka_version();
    ?>
      <?php 
    if ($latestVersion and version_compare(OMEKA_VERSION, $latestVersion, '<')) {
        ?>
            <div id="flash">