Revision 1dc9554f
Added by Andreas Kohlbecker over 10 years ago
7.x/themes/zen_dataportal/css/navigation.css | ||
---|---|---|
59 | 59 |
/* Menu block links */ |
60 | 60 |
margin: 0; |
61 | 61 |
padding: 0; |
62 |
margin-left: -20px; |
|
62 | 63 |
text-align: left; |
63 | 64 |
/* LTR */ |
65 |
display: block; |
|
64 | 66 |
} |
65 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000366}}
|
|
67 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000368}}
|
|
66 | 68 |
#navigation ul.links li, |
67 | 69 |
#navigation ul.menu li { |
68 | 70 |
/* A simple method to get navigation links to appear in one line. */ |
... | ... | |
77 | 79 |
margin-left: -1px; |
78 | 80 |
/* collapse borders */ |
79 | 81 |
} |
80 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000376}}
|
|
82 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000378}}
|
|
81 | 83 |
#navigation ul.links li.first, |
82 | 84 |
#navigation ul.menu li.first { |
83 | 85 |
border-left: 0; |
84 | 86 |
} |
85 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000380}}
|
|
87 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000382}}
|
|
86 | 88 |
#navigation ul.links li.last, |
87 | 89 |
#navigation ul.menu li.last { |
88 | 90 |
border-right: 0; |
... | ... | |
91 | 93 |
/* |
92 | 94 |
* Main menu and Secondary menu links |
93 | 95 |
*/ |
94 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000393}}
|
|
96 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\0000395}}
|
|
95 | 97 |
#main-menu { |
96 |
padding-top: 5px; |
|
97 |
height: 20px; |
|
98 |
padding: 2.5px 0; |
|
98 | 99 |
padding-left: 73px; |
99 | 100 |
background-color: #dedede; |
101 |
display: block; |
|
100 | 102 |
font-size: 14.4px; |
101 | 103 |
} |
102 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\00003100}}
|
|
104 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\00003102}}
|
|
103 | 105 |
#main-menu a:link, |
104 | 106 |
#main-menu a:visited { |
105 | 107 |
color: black; |
106 | 108 |
text-decoration: none; |
107 | 109 |
} |
108 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\00003106}}
|
|
110 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\00003108}}
|
|
109 | 111 |
#main-menu a:hover, |
110 | 112 |
#main-menu a:focus { |
111 | 113 |
text-decoration: underline; |
112 | 114 |
} |
113 | 115 |
|
114 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\00003111}}
|
|
116 |
@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/andreas\/workspaces\/www\/drupal-7\.16\/sites\/all\/themes\/zen_dataportal\/sass\/navigation\.scss}line{font-family:\00003113}}
|
|
115 | 117 |
#secondary-menu { |
116 | 118 |
float: right; |
117 | 119 |
/* LTR */ |
7.x/themes/zen_dataportal/sass/navigation.scss | ||
---|---|---|
61 | 61 |
ul.menu { /* Menu block links */ |
62 | 62 |
margin: 0; |
63 | 63 |
padding: 0; |
64 |
margin-left: -$zen-gutter-width; |
|
64 | 65 |
text-align: left; /* LTR */ |
66 |
display: block; |
|
65 | 67 |
|
66 | 68 |
li { /* A simple method to get navigation links to appear in one line. */ |
67 | 69 |
float: left; /* LTR */ |
... | ... | |
91 | 93 |
*/ |
92 | 94 |
|
93 | 95 |
#main-menu { |
94 |
padding-top: $zen-gutter-width / 4; |
|
95 |
height: $menu-bar-line-height; |
|
96 |
padding: ($zen-gutter-width / 8) 0; |
|
96 | 97 |
padding-left: 93px - $zen-gutter-width; // width of logo image |
97 | 98 |
background-color: $menu-bar-background-color; |
99 |
display: block; |
|
98 | 100 |
font-size: $menu-bar-font-size; |
99 | 101 |
a:link, |
100 | 102 |
a:visited { |
7.x/themes/zen_dataportal/template.php | ||
---|---|---|
106 | 106 |
* name of the image, see _zen_dataportal_imagenames() for possible values |
107 | 107 |
* @param $variables |
108 | 108 |
* An array of variables to pass to the theme template. |
109 |
* @param $attributes_key
|
|
110 |
* |
|
109 |
* @param $css_selector
|
|
110 |
* The dom element to apply the image as background image
|
|
111 | 111 |
* @param $background_style |
112 |
* Addtional css setting for the background css attribute, default is 'scroll repeat' |
|
112 | 113 |
* |
113 | 114 |
* @see _zen_dataportal_imagenames() for possible values |
114 | 115 |
*/ |
115 |
function _set_image_url($which_image, &$variables, $attributes_key = NULL, $background_style = 'scroll repeat') {
|
|
116 |
function _set_image_url($which_image, &$variables, $css_selector = NULL, $background_style = 'scroll repeat') {
|
|
116 | 117 |
|
117 |
if($attributes_key) { |
|
118 |
$variables[$attributes_key] = ''; |
|
119 |
} |
|
120 | 118 |
|
121 | 119 |
if (!theme_get_setting('default_' . $which_image)) { |
122 | 120 |
$path = theme_get_setting($which_image . '_path'); |
... | ... | |
126 | 124 |
} |
127 | 125 |
if(isset($url)) { |
128 | 126 |
$variables[$which_image . '_url'] = $url; |
129 |
if($attributes_key) { |
|
127 |
|
|
128 |
if($css_selector) { |
|
129 |
if(!isset($variables['inline_styles'])) { |
|
130 |
$variables['inline_styles'] = array(); |
|
131 |
} |
|
130 | 132 |
// FIXME is not save only works if no other style given e.g. html.php $attributes |
131 |
$variables[$attributes_key] = ' style="background: white url(' . $url .') ' . $background_style . ';"';
|
|
133 |
$variables['inline_styles'][] = $css_selector . ' {background: white url(' . $url .') ' . $background_style . ';}';
|
|
132 | 134 |
} |
133 | 135 |
} |
134 | 136 |
|
... | ... | |
141 | 143 |
function _add_inline_styles(&$variables) { |
142 | 144 |
|
143 | 145 |
$css = array(); |
144 |
$variables['inline_styles'] = ''; |
|
146 |
if(!isset($variables['inline_styles'])) { |
|
147 |
$variables['inline_styles'] = array(); |
|
148 |
} |
|
145 | 149 |
|
146 | 150 |
// site_name |
147 | 151 |
if(theme_get_setting('site_name_color')) { |
148 |
$css[] = "#site-name a span {color:" . theme_get_setting('site_name_color') . ';}'; |
|
152 |
$variables['inline_styles'][] = "#site-name a span {color:" . theme_get_setting('site_name_color') . ';}'; |
|
153 |
} |
|
154 |
if(theme_get_setting('logo_size')) { |
|
155 |
$logo_size = theme_get_setting('logo_size'); |
|
156 |
$variables['inline_styles'][] = '#header {background-position:' . $logo_size['width'] . 'px 0;}'; |
|
157 |
$variables['inline_styles'][] = '#main-menu {padding-left:' . $logo_size['width'] . 'px;}'; |
|
149 | 158 |
} |
150 |
|
|
151 |
$variables['inline_styles'] = '<style type="text/css">'. "\n" . implode("\n", $css) . '</style>'; |
|
152 | 159 |
} |
153 | 160 |
|
154 | 161 |
|
... | ... | |
179 | 186 |
* The name of the template being rendered ("html" in this case.) |
180 | 187 |
*/ |
181 | 188 |
function zen_dataportal_preprocess_html(&$variables, $hook) { |
182 |
_set_image_url('body_background', $variables, 'attributes'); |
|
189 |
_set_image_url('body_background', $variables, 'body'); |
|
190 |
_set_image_url('page_background', $variables, '#page'); |
|
191 |
_set_image_url('banner', $variables, '#header', 'scroll no-repeat content-box'); |
|
183 | 192 |
_add_inline_styles($variables); |
184 | 193 |
} |
185 | 194 |
|
... | ... | |
192 | 201 |
* The name of the template being rendered ("page" in this case.) |
193 | 202 |
*/ |
194 | 203 |
function zen_dataportal_preprocess_page(&$variables, $hook) { |
195 |
_set_image_url('banner', $variables, 'banner_attributes', 'scroll no-repeat content-box'); |
|
196 |
_set_image_url('page_background', $variables, 'page_attributes'); |
|
197 | 204 |
} |
198 | 205 |
|
199 | 206 |
/** |
7.x/themes/zen_dataportal/templates/html.tpl.php | ||
---|---|---|
63 | 63 |
* - one-sidebar and sidebar-first or sidebar-second: A combination of the |
64 | 64 |
* two classes when only one of the two sidebars have content. |
65 | 65 |
* - $body_background_url: from zen_dataportal theme-settings.php |
66 |
* - $inline_styles: custom styles for specific elements from zen_dataportal |
|
66 |
* - $inline_styles: an array of custom styles for specific elements from zen_dataportal
|
|
67 | 67 |
* theme-settings.php |
68 | 68 |
* |
69 | 69 |
* @see template_preprocess() |
... | ... | |
90 | 90 |
<meta http-equiv="cleartype" content="on"> |
91 | 91 |
|
92 | 92 |
<?php print $styles; ?> |
93 |
<?php print $inline_styles; ?>
|
|
93 |
<?php print '<style type="text/css">'. "\n" . implode("\n", $inline_styles) . "\n</style>;" ?>
|
|
94 | 94 |
<?php print $scripts; ?> |
95 | 95 |
<?php if ($add_respond_js): ?> |
96 | 96 |
<!--[if lt IE 9]> |
... | ... | |
102 | 102 |
<![endif]--> |
103 | 103 |
<?php endif; ?> |
104 | 104 |
</head> |
105 |
<?php |
|
106 |
// FIXME is not save only works if no other style given |
|
107 |
// if (isset($body_background_url)){ |
|
108 |
// $attributes .= ' style="background: white url(' . $body_background_url .') fixed repeat;"'; |
|
109 |
// } |
|
110 |
?> |
|
111 | 105 |
<body class="<?php print $classes; ?>" <?php print $attributes;?>> |
112 | 106 |
<?php if ($skip_link_text && $skip_link_anchor): ?> |
113 | 107 |
<p id="skip-link"> |
7.x/themes/zen_dataportal/templates/page.tpl.php | ||
---|---|---|
53 | 53 |
* comment/reply/12345). |
54 | 54 |
* - $banner_url: from zen_dataportal theme-settings.php |
55 | 55 |
* - $page_background_url: from zen_dataportal theme-settings.php |
56 |
* - $page_attributes: will contain style with $page_background_url |
|
57 |
* - $header_attributes: will contain style with $page_background_url |
|
58 | 56 |
* |
59 | 57 |
* Regions: |
60 | 58 |
* - $page['header']: Items for the header region. |
... | ... | |
74 | 72 |
*/ |
75 | 73 |
?> |
76 | 74 |
|
77 |
<div id="page" <?php print $page_attributes; ?> >
|
|
75 |
<div id="page"> |
|
78 | 76 |
|
79 |
<header id="header" role="banner" <?php print $banner_attributes; ?>>
|
|
77 |
<header id="header" role="banner"> |
|
80 | 78 |
<?php if ($logo): ?> |
81 | 79 |
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo"><img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" /></a> |
82 | 80 |
<?php endif; ?> |
7.x/themes/zen_dataportal/theme-settings.php | ||
---|---|---|
43 | 43 |
// custom images for banner, body and page backgrounds |
44 | 44 |
// |
45 | 45 |
foreach(_zen_dataportal_imagenames() as $which_image) { |
46 |
$image_label = str_replace('_', ' ', $which_image); |
|
47 |
$form['zen_dataportal_' . $which_image] = array( |
|
48 |
'#type' => 'fieldset', |
|
49 |
'#title' => ucfirst(t($image_label)) . ' ' . t('image settings'), |
|
50 |
'#description' => t('If toggled on, the following image will be displayed.'), |
|
51 |
'#attributes' => array('class' => array('theme-settings-bottom')), |
|
52 |
); |
|
53 |
$form['zen_dataportal_' . $which_image]['default_' . $which_image] = array( |
|
54 |
'#type' => 'checkbox', |
|
55 |
'#title' => t('Use the default') . t($which_image), |
|
56 |
'#default_value' => theme_get_setting('default_' . $which_image), |
|
57 |
'#tree' => FALSE, |
|
58 |
'#description' => t('Check here if you want the theme to use the image supplied with it.') |
|
59 |
); |
|
60 |
$form['zen_dataportal_' . $which_image]['settings'] = array( |
|
61 |
'#type' => 'container', |
|
62 |
'#states' => array( |
|
63 |
// Hide the logo settings when using the default logo. |
|
64 |
'invisible' => array( |
|
65 |
'input[name="default_' . $which_image . '"]' => array('checked' => TRUE), |
|
66 |
), |
|
67 |
), |
|
68 |
); |
|
69 |
|
|
70 |
// If $path is a public:// URI, display the path relative to the files |
|
71 |
// directory; stream wrappers are not end-user friendly. |
|
72 |
$path = theme_get_setting($which_image . '_path'); |
|
73 |
$image = ''; |
|
74 |
if (file_uri_scheme($path) == 'public') { |
|
75 |
$url = file_create_url($path); |
|
76 |
$path = file_uri_target($path); |
|
77 |
$form['zen_dataportal_' . $which_image]['settings'][$which_image . '_preview'] = array( |
|
78 |
'#type' => 'item', |
|
79 |
'#title' => t('Preview'), |
|
80 |
'#markup' => '<div class="image-preview"><img src="' . $url . '"/></div>', |
|
81 |
); |
|
82 |
} |
|
83 |
$form['zen_dataportal_' . $which_image]['settings'][$which_image . '_path'] = array( |
|
84 |
'#type' => 'textfield', |
|
85 |
'#title' => t('Path to custom') . ' ' . t($image_label), |
|
86 |
'#description' => t('The path to the file you would like to use as your') . ' ' . t($image_label), |
|
87 |
'#default_value' => $path, |
|
88 |
); |
|
89 |
$form['zen_dataportal_' . $which_image]['settings'][$which_image . '_upload'] = array( |
|
90 |
'#type' => 'file', |
|
91 |
'#title' => t('Upload') . ' ' . t($image_label) . t(' image'), |
|
92 |
'#maxlength' => 40, |
|
93 |
'#description' => t("If you don't have direct file access to the server, use this field to upload your image.") |
|
94 |
); |
|
95 |
} // END of loop over image names |
|
46 |
zen_dataportal_form_widget_image($form, $which_image); |
|
47 |
} |
|
96 | 48 |
|
97 | 49 |
|
98 | 50 |
$form['#validate'][] = 'zen_dataportal_theme_settings_validate'; |
99 | 51 |
$form['#submit'][] = 'zen_dataportal_theme_settings_submit'; |
100 |
|
|
101 |
|
|
102 | 52 |
// We are editing the $form in place, so we don't need to return anything. |
103 | 53 |
} |
104 | 54 |
|
... | ... | |
111 | 61 |
*/ |
112 | 62 |
function zen_dataportal_theme_settings_submit($form, &$form_state) { |
113 | 63 |
|
114 |
$values = &$form_state['values']; |
|
115 | 64 |
|
116 | 65 |
foreach(_zen_dataportal_imagenames() as $which_image) { |
117 |
// If the user uploaded a new image, save it to a permanent location |
|
118 |
// and use it in place of the default theme-provided file. |
|
119 |
if ($file = $values[$which_image . '_upload']) { |
|
120 |
unset($values[$which_image . '_upload']); |
|
121 |
$filename = file_unmanaged_copy($file->uri); |
|
122 |
$values['default_' .$which_image ] = 0; |
|
123 |
$values[$which_image . '_path'] = $filename; |
|
124 |
$values['toggle_' . $which_image] = 1; |
|
125 |
} |
|
126 |
if (!empty($values[$which_image . '_path'])) { |
|
127 |
$values[$which_image . '_path'] = _system_theme_settings_validate_path($values[$which_image . '_path']); |
|
128 |
} |
|
66 |
zen_dataportal_form_widget_image_submit($form_state, $which_image); |
|
67 |
} |
|
68 |
|
|
69 |
// update logo information like wich one to use and size, this is needed to |
|
70 |
// offset the banner and menu bar |
|
71 |
$values = &$form_state['values']; |
|
72 |
if(!theme_get_setting('default_logo')) { |
|
73 |
$logo_file = path_to_theme() . '/logo.png'; |
|
74 |
} else { |
|
75 |
$logo_file = theme_get_setting('logo_path'); |
|
76 |
} |
|
77 |
$logo_file_info = image_get_info($logo_file); |
|
78 |
if(isset($logo_file_info['width'])) { |
|
79 |
$values['logo_size'] = array('width' => $logo_file_info['width'], 'height' => $logo_file_info['height']); |
|
80 |
} |
|
81 |
|
|
129 | 82 |
|
130 |
} // END of loop over image names |
|
131 | 83 |
|
132 | 84 |
/* |
133 | 85 |
* Ok, we are done here the $values will be saved in the theme |
134 | 86 |
* variable by system_theme_settings_submit($form, &$form_state) |
135 | 87 |
* in modules/system/system.admin.inc |
136 | 88 |
*/ |
137 |
|
|
138 | 89 |
} |
139 | 90 |
|
140 | 91 |
/** |
... | ... | |
146 | 97 |
*/ |
147 | 98 |
function zen_dataportal_theme_settings_validate($form, &$form_state) { |
148 | 99 |
|
149 |
$validators = array('file_validate_is_image' => array()); |
|
150 |
|
|
151 | 100 |
foreach(_zen_dataportal_imagenames() as $which_image) { |
152 |
// Check for a new uploaded logo. |
|
153 |
$file = file_save_upload($which_image . '_upload', $validators); |
|
154 |
if (isset($file)) { |
|
155 |
// File upload was attempted. |
|
156 |
if ($file) { |
|
157 |
// Put the temporary file in form_values so we can save it on submit. |
|
158 |
$form_state['values'][$which_image . '_upload'] = $file; |
|
159 |
} |
|
160 |
else { |
|
161 |
// File upload failed. |
|
162 |
form_set_error($which_image . '_upload', t('The image could not be uploaded.')); |
|
163 |
} |
|
101 |
zen_dataportal_form_widget_image_validate($form_state, $which_image); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
/******************************************************************* |
|
106 |
* form widget functions |
|
107 |
*******************************************************************/ |
|
108 |
|
|
109 |
/** |
|
110 |
* |
|
111 |
* Enter description here ... |
|
112 |
* @param $form |
|
113 |
* Nested array of form elements that comprise the form. |
|
114 |
* @param unknown_type $which_image |
|
115 |
*/ |
|
116 |
function zen_dataportal_form_widget_image(&$form, $which_image){ |
|
117 |
$image_label = str_replace('_', ' ', $which_image); |
|
118 |
$form['zen_dataportal_' . $which_image] = array( |
|
119 |
'#type' => 'fieldset', |
|
120 |
'#title' => ucfirst(t($image_label)) . ' ' . t('image settings'), |
|
121 |
'#description' => t('If toggled on, the following image will be displayed.'), |
|
122 |
'#attributes' => array('class' => array('theme-settings-bottom')), |
|
123 |
); |
|
124 |
$form['zen_dataportal_' . $which_image]['default_' . $which_image] = array( |
|
125 |
'#type' => 'checkbox', |
|
126 |
'#title' => t('Use the default') . t($which_image), |
|
127 |
'#default_value' => theme_get_setting('default_' . $which_image), |
|
128 |
'#tree' => FALSE, |
|
129 |
'#description' => t('Check here if you want the theme to use the image supplied with it.') |
|
130 |
); |
|
131 |
$form['zen_dataportal_' . $which_image]['settings'] = array( |
|
132 |
'#type' => 'container', |
|
133 |
'#states' => array( |
|
134 |
// Hide the logo settings when using the default logo. |
|
135 |
'invisible' => array( |
|
136 |
'input[name="default_' . $which_image . '"]' => array('checked' => TRUE), |
|
137 |
), |
|
138 |
), |
|
139 |
); |
|
140 |
|
|
141 |
// If $path is a public:// URI, display the path relative to the files |
|
142 |
// directory; stream wrappers are not end-user friendly. |
|
143 |
$path = theme_get_setting($which_image . '_path'); |
|
144 |
$image = ''; |
|
145 |
if (file_uri_scheme($path) == 'public') { |
|
146 |
$url = file_create_url($path); |
|
147 |
$path = file_uri_target($path); |
|
148 |
$form['zen_dataportal_' . $which_image]['settings'][$which_image . '_preview'] = array( |
|
149 |
'#type' => 'item', |
|
150 |
'#title' => t('Preview'), |
|
151 |
'#markup' => '<div class="image-preview"><img src="' . $url . '"/></div>', |
|
152 |
); |
|
153 |
} // FIXME manully entered files without scheme public: are omitted here |
|
154 |
$form['zen_dataportal_' . $which_image]['settings'][$which_image . '_path'] = array( |
|
155 |
'#type' => 'textfield', |
|
156 |
'#title' => t('Path to custom') . ' ' . t($image_label), |
|
157 |
'#description' => t('The path to the file you would like to use as your') . ' ' . t($image_label), |
|
158 |
'#default_value' => $path, |
|
159 |
); |
|
160 |
$form['zen_dataportal_' . $which_image]['settings'][$which_image . '_upload'] = array( |
|
161 |
'#type' => 'file', |
|
162 |
'#title' => t('Upload') . ' ' . t($image_label) . t(' image'), |
|
163 |
'#maxlength' => 40, |
|
164 |
'#description' => t("If you don't have direct file access to the server, use this field to upload your image.") |
|
165 |
); |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* |
|
170 |
* Enter description here ... |
|
171 |
* @param $form_state |
|
172 |
* A keyed array containing the current state of the form. |
|
173 |
* @param unknown_type $which_image |
|
174 |
*/ |
|
175 |
function zen_dataportal_form_widget_image_submit(&$form_state, $which_image){ |
|
176 |
// If the user uploaded a new image, save it to a permanent location |
|
177 |
// and use it in place of the default theme-provided file. |
|
178 |
$values = &$form_state['values']; |
|
179 |
if ($file = $values[$which_image . '_upload']) { |
|
180 |
unset($values[$which_image . '_upload']); |
|
181 |
$filename = file_unmanaged_copy($file->uri); |
|
182 |
$values['default_' .$which_image ] = 0; |
|
183 |
$values[$which_image . '_path'] = $filename; |
|
184 |
$values['toggle_' . $which_image] = 1; |
|
185 |
} |
|
186 |
if (!empty($values[$which_image . '_path'])) { |
|
187 |
$values[$which_image . '_path'] = _system_theme_settings_validate_path($values[$which_image . '_path']); |
|
188 |
} |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* |
|
193 |
* Enter description here ... |
|
194 |
* @param $form_state |
|
195 |
* A keyed array containing the current state of the form. |
|
196 |
* @param unknown_type $which_image |
|
197 |
*/ |
|
198 |
function zen_dataportal_form_widget_image_validate(&$form_state, $which_image){ |
|
199 |
$validators = array('file_validate_is_image' => array('gif', 'jpg', 'png')); |
|
200 |
// Check for a new uploaded logo. |
|
201 |
$file = file_save_upload($which_image . '_upload', $validators); |
|
202 |
if (isset($file)) { |
|
203 |
// File upload was attempted. |
|
204 |
if ($file) { |
|
205 |
// Put the temporary file in form_values so we can save it on submit. |
|
206 |
$form_state['values'][$which_image . '_upload'] = $file; |
|
207 |
} |
|
208 |
else { |
|
209 |
// File upload failed. |
|
210 |
form_set_error($which_image . '_upload', t('The image could not be uploaded.')); |
|
164 | 211 |
} |
165 |
} // END of loop over image names
|
|
212 |
} |
|
166 | 213 |
} |
Also available in: Unified diff
theme customization improved - layout adapts to image sizes