60 |
60 |
'#title' => t('Renderer'),
|
61 |
61 |
'#type' => 'select',
|
62 |
62 |
'#options' => array(
|
63 |
|
'google' => 'Google Viewer',
|
64 |
|
'direct' => 'Direct Embed',
|
|
63 |
'google' => 'Google Viewer',
|
|
64 |
'direct' => 'Direct Embed',
|
65 |
65 |
'pdf-js' => 'pdf.js'),
|
66 |
66 |
'#default_value' => $settings['renderer'],
|
67 |
67 |
);
|
... | ... | |
98 |
98 |
*/
|
99 |
99 |
function pdf_reader_field_formatter_settings_summary($field, $instance, $view_mode) {
|
100 |
100 |
$renderers = array(
|
101 |
|
'google' => 'Google Viewer',
|
102 |
|
'direct' => 'Direct Embed',
|
|
101 |
'google' => 'Google Viewer',
|
|
102 |
'direct' => 'Direct Embed',
|
103 |
103 |
'pdf-js' => 'pdf.js');
|
104 |
104 |
$display = $instance['display'][$view_mode];
|
105 |
105 |
$settings = $display['settings'];
|
106 |
106 |
|
107 |
|
$summary = 'Size: ' . $settings['pdf_width'] . 'x' . $settings['pdf_height']
|
108 |
|
. ' Using: ' . $renderers[$settings['renderer']]
|
109 |
|
. '<br> Download Link: ' . ($settings['download'] == 1 ? 'YES' : 'NO')
|
110 |
|
. ' Use colorbox: ' . ($settings['colorbox'] == 1 ? 'YES' : 'NO')
|
111 |
|
. ' Colorbox link text: ' . $settings['colorbox_link_text'];
|
|
107 |
$summary = 'Size: ' . $settings['pdf_width'] . 'x' . $settings['pdf_height']
|
|
108 |
. ' Using: ' . $renderers[$settings['renderer']]
|
|
109 |
. '<br> Download Link: ' . ($settings['download'] == 1 ? 'YES' : 'NO')
|
|
110 |
. ' Use colorbox: ' . ($settings['colorbox'] == 1 ? 'YES' : 'NO')
|
|
111 |
. ' Colorbox link text: ' . $settings['colorbox_link_text'];
|
112 |
112 |
return $summary;
|
113 |
113 |
}
|
114 |
114 |
|
... | ... | |
143 |
143 |
),
|
144 |
144 |
'pdf_js' => array(
|
145 |
145 |
'template' => 'pdf_js',
|
146 |
|
'path' => drupal_get_path('module', 'pdf_reader') .'/theme'
|
|
146 |
'path' => drupal_get_path('module', 'pdf_reader') . '/theme'
|
147 |
147 |
)
|
148 |
148 |
);
|
149 |
149 |
}
|
... | ... | |
155 |
155 |
$file_url = isset($variables['file']['uri']) ? file_create_url($variables['file']['uri']) : $variables['file']['value'];
|
156 |
156 |
|
157 |
157 |
switch ($variables['settings']['renderer']) {
|
158 |
|
case 0:
|
159 |
158 |
case 'google':
|
160 |
|
default:
|
161 |
159 |
$output = '<iframe id="pdf_reader" src="//docs.google.com/viewer?embedded=true&url='
|
162 |
|
. urlencode($file_url)
|
163 |
|
. '" width="' . $variables['settings']['pdf_width']
|
164 |
|
. '" height="' . $variables['settings']['pdf_height']
|
165 |
|
. '" scrolling="no'
|
166 |
|
. '" style="border: none;"></iframe>';
|
|
160 |
. urlencode($file_url)
|
|
161 |
. '" width="' . $variables['settings']['pdf_width']
|
|
162 |
. '" height="' . $variables['settings']['pdf_height']
|
|
163 |
. '" scrolling="no'
|
|
164 |
. '" style="border: none;"></iframe>';
|
167 |
165 |
break;
|
168 |
|
|
169 |
|
case 2:
|
|
166 |
|
170 |
167 |
case 'direct':
|
171 |
168 |
$output = '<object id="pdf_reader" data="' . $file_url . '#view=Fit' . '" '
|
172 |
|
. 'type="application/pdf' . '" '
|
173 |
|
. 'width="' . $variables['settings']['pdf_width'] . '" '
|
174 |
|
. 'height="' . $variables['settings']['pdf_height'] . '">'
|
175 |
|
. '<embed src="' . $file_url . '#view=Fit' . '"'
|
176 |
|
. 'width="' . $variables['settings']['pdf_width'] . '" '
|
177 |
|
. 'height="' . $variables['settings']['pdf_height'] . '" '
|
178 |
|
. 'type="application/pdf">'
|
179 |
|
. '<p>' . t('It appears your Web browser is not configured to display PDF files. ')
|
180 |
|
. l(t('Download adobe Acrobat '), 'http://www.adobe.com/products/reader.html')
|
181 |
|
. ' ' . t('or') . ' ' . l(t('click here to download the PDF file.'), $file_url) . '</p>'
|
182 |
|
. '</embed></object>';
|
|
169 |
. 'type="application/pdf' . '" '
|
|
170 |
. 'width="' . $variables['settings']['pdf_width'] . '" '
|
|
171 |
. 'height="' . $variables['settings']['pdf_height'] . '">'
|
|
172 |
. '<embed src="' . $file_url . '#view=Fit' . '"'
|
|
173 |
. 'width="' . $variables['settings']['pdf_width'] . '" '
|
|
174 |
. 'height="' . $variables['settings']['pdf_height'] . '" '
|
|
175 |
. 'type="application/pdf">'
|
|
176 |
. '<p>' . t('It appears your Web browser is not configured to display PDF files. ')
|
|
177 |
. l(t('Download adobe Acrobat '), 'http://www.adobe.com/products/reader.html')
|
|
178 |
. ' ' . t('or') . ' ' . l(t('click here to download the PDF file.'), $file_url) . '</p>'
|
|
179 |
. '</embed></object>';
|
183 |
180 |
break;
|
184 |
181 |
|
185 |
|
case 3:
|
186 |
182 |
case 'pdf-js':
|
187 |
183 |
_pdf_reader_load_pdf_js($file_url);
|
188 |
184 |
$output = theme('pdf_js');
|
... | ... | |
200 |
196 |
'attributes' => array('class' => array('colorbox-inline', 'show')),
|
201 |
197 |
'query' => array(
|
202 |
198 |
'width' => $variables['settings']['pdf_width'],
|
203 |
|
'height' => $variables['settings']['pdf_height'],
|
|
199 |
'height' => $variables['settings']['pdf_height'],
|
204 |
200 |
'inline' => 'true',
|
205 |
|
),
|
|
201 |
),
|
206 |
202 |
'fragment' => 'pdf_reader',
|
207 |
203 |
);
|
208 |
204 |
|
... | ... | |
210 |
206 |
|
211 |
207 |
$output .= '<div style="display:none">' . $html . '</div>';
|
212 |
208 |
}
|
213 |
|
|
|
209 |
|
214 |
210 |
return $output;
|
215 |
211 |
}
|
216 |
212 |
|
Update pdf_reader from 1.0-rc5 to 1.0-rc6