Commit 19ba10ad authored by ñull's avatar ñull Committed by Marco Villegas
Browse files

Issue #940380 by ñull, marvil07: Provide width/height options to customize the...

Issue #940380 by ñull, marvil07: Provide width/height options to customize the embed on ffpageflip ffpresentation formatter output.
parent 7736eeba
Loading
Loading
Loading
Loading
+28 −4
Changes for issuu.module: 28 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -63,6 +63,22 @@ function issuu_admin() {
    '#description' => t('The issuu.com API secret that is neede to calculate the signature of each request.'),
    '#required' => TRUE,
  );
  $form['issuu_global_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Embed Width (px)'),
    '#default_value' => variable_get('issuu_global_width', '420'),
    '#maxlength' => 4,
    '#description' => t('Width for Page Flip and presentation formatters in pixels.'),
    '#required' => TRUE,
  );
  $form['issuu_global_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Embed Height (px)'),
    '#default_value' => variable_get('issuu_global_height', '297'),
    '#maxlength' => 4,
    '#description' => t('Height for Page Flip and presentation formatters in pixels.'),
    '#required' => TRUE,
  );

  return system_settings_form($form);
}
@@ -73,6 +89,8 @@ function issuu_admin() {
function issuu_admin_validate($form, &$form_state) {
  $issuu_global_apikey = $form_state['values']['issuu_global_apikey'];
  $issuu_global_apisecret = $form_state['values']['issuu_global_apisecret'];
  $issuu_global_width = $form_state['values']['issuu_global_width'];
  $issuu_global_height = $form_state['values']['issuu_global_height'];

  if (strlen($issuu_global_apikey) != 32) {
    form_set_error('issuu_global_apikey', t('You must enter a valid issuu.com API key(32 characters).'));
@@ -80,6 +98,12 @@ function issuu_admin_validate($form, &$form_state) {
  if (strlen($issuu_global_apisecret) != 32) {
    form_set_error('issuu_global_apisecret', t('You must enter a valid issuu.com API secret(32 characters).'));
  }
  if ( $issuu_global_width<=0 || $issuu_global_width!=round($issuu_global_width) ) {
    form_set_error('issuu_global_width', t('Width should be a positive integer number.'));
  }
  if ( $issuu_global_height<=0 || $issuu_global_height!=round($issuu_global_height)  ) {
    form_set_error('issuu_global_height', t('Height should be a positive integer number.'));
  }
}

/**
@@ -449,8 +473,8 @@ function theme_issuu_formatter_ffpageflip($element) {
      'docName' => $data['name'],
      'username' => $data['username'],
      'loadingInfoText' => $data['title'],
      'width' => '420',
      'height' => '297',
      'width' => variable_get('issuu_global_width', '420'),
      'height' => variable_get('issuu_global_height', '297'),
      'jsAPIClientDomain' => $base_url,
    ),
  );
@@ -477,8 +501,8 @@ function theme_issuu_formatter_ffpresentation($element) {
      'docName' => $data['name'],
      'username' => $data['username'],
      'loadingInfoText' => $data['title'],
      'width' => '420',
      'height' => '297',
      'width' => variable_get('issuu_global_width', '420'),
      'height' => variable_get('issuu_global_height', '297'),
      'jsAPIClientDomain' => $base_url,
    ),
  );