$(".g-progress-bar").progressbar("value", 100);
    } else if (current_value != target_value || delta != 1) {
      var new_value = Math.min(current_value + delta, target_value);
      $(".g-progress-bar").progressbar("value", new_value);
      animation = setTimeout(function() { animate_progress_bar(target_value); }, 100);
    } else {
      animation = null;
      delta = 1;
    }
    $.fn.gallery_hover_init();
  }

  update = function() {
    $.ajax({
      url: <?php 
echo html::js_string(url::site("admin/maintenance/run/{$task->id}?csrf={$csrf}"));
?>
,
      dataType: "json",
      success: function(data) {
        target_value = data.task.percent_complete;
        if (!animation) {
          animate_progress_bar();
        }
        $("#g-status").html("" + data.task.status);
        if (data.task.done) {
          $("#g-pause-button").hide();
          $("#g-done-button").show();
        } else {
          setTimeout(update, 100);
        }
echo html::js_string(url::site("admin/comments/delete/__ID__?csrf={$csrf}"));
?>
;

  function del(id) {
    $.get(delete_url.replace("__ID__", id),
          {},
          function() {
            $("#g-comment-" + id).slideUp();
            update_menu();
          });
  }

  function update_menu() {
    $.get(<?php 
echo html::js_string(url::site("admin/comments/menu_labels"));
?>
, {},
          function(data) {
            for (var i = 0; i < data.length; i++) {
              $("#g-admin-comments-menu li:eq(" + i + ") a").html(data[i]);
            }
          },
          "json");
  }
</script>

<div id="g-admin-comments">
  <h1> <?php 
echo t("Manage Comments");
?>
<?php

defined("SYSPATH") or die("No direct script access.");
?>
<script type="text/javascript">
  $(document).ready(function() {
    $(".g-available .g-block").equal_heights();
    select_toolkit = function(el) {
      if (!$(this).hasClass("g-unavailable")) {
        window.location = <?php 
echo html::js_string(url::site("admin/graphics/choose/__TK__?csrf={$csrf}"));
?>
          .replace("__TK__", $(this).attr("id"));
      }
    };
    $("#g-admin-graphics div.g-available .g-block").click(select_toolkit);
  });
</script>

<div id="g-admin-graphics" class="g-block ui-helper-clearfix">
  <h1> <?php 
echo t("Graphics settings");
?>
 </h1>
  <p>
    <?php 
echo t("Gallery needs a graphics toolkit in order to manipulate your photos.  Please choose one from the list below.");
?>
    <?php 
echo t("Can't decide which toolkit to choose?  <a href=\"%url\">We can help!</a>", array("url" => "http://codex.gallery2.org/Gallery3:Choosing_A_Graphics_Toolkit"));
?>
           class="g-button ui-state-default ui-corner-all"><?php 
echo t("Copy source text");
?>
</a>
      </form>
    </div>
  </div>
  <script type="text/javascript">
    var MSG_TRANSLATE_TEXT = <?php 
echo t("Translate text")->for_js();
?>
;
    var l10n_client_data = <?php 
echo json_encode($string_list);
?>
;
    var plural_forms = <?php 
echo json_encode($plural_forms);
?>
;
    var toggle_l10n_mode_url = <?php 
echo html::js_string(url::site("l10n_client/toggle_l10n_mode"));
?>
;
    var csrf = <?php 
echo html::js_string(access::csrf_token());
?>
;
  </script>
</div>
defined("SYSPATH") or die("No direct script access.");
?>
<script type="text/javascript">
  $("document").ready(function() {
    // using JS for adding link titles to avoid running t() for each tag
    $("#g-page-admin .g-page-name").attr("title", <?php 
echo t("Click to edit this page")->for_js();
?>
);
    $("#g-page-admin .g-delete-link").attr("title", $(".g-delete-link:first span").html());

    // In-place editing for tag admin
    $(".g-editable").gallery_in_place_edit({
      form_url: <?php 
echo html::js_string(url::site("admin/pages/form_rename/__ID__"));
?>
    });
  });
</script>

<?php 
$pages_per_column = $pages->count() / 5;
$column_page_count = 0;
?>

<div class="g-block">
  <h1> <?php 
echo t("Manage pages");
?>
 </h1>
<?php

defined("SYSPATH") or die("No direct script access.");
echo form::dropdown("g-select-session-locale", $installed_locales, $selected);
?>
<script type="text/javascript">
  $("select[name=g-select-session-locale]").change(function() {
    var old_locale_preference = <?php 
echo html::js_string($selected);
?>
;
    var locale = $(this).val();
    if (old_locale_preference == locale) {
      return;
    }

    var expires = -1;
    if (locale) {
      expires = 365;
    }
    $.cookie("g_locale", locale, {"expires": expires, "path": "/"});
    window.location.reload(true);
  });
</script>

Exemple #7
0
<?php

defined("SYSPATH") or die("No direct script access.");
?>

<? if (access::can("view_full", $theme->item())): ?>
<!-- Use javascript to show the full size as an overlay on the current page -->
<script type="text/javascript">
  $(document).ready(function() {
    $(".g-fullsize-link").click(function() {
      $.gallery_show_full_size(<?php 
echo html::js_string($theme->item()->file_url());
?>
, "<?php 
echo $theme->item()->width;
?>
", "<?php 
echo $theme->item()->height;
?>
");
      return false;
    });
  });
</script>
<? endif ?>

<div id="g-item">
  <?php 
echo $theme->photo_top();
?>
    if (this.checked) {
      $("input[type='radio'][value='" + this.value + "']").enable();
    } else {
      if ($("input[type='radio'][value='" + this.value + "']").selected()) { // if you deselect your default language, switch to some other installed language
        $("input[type='radio'][value='" + old_default_locale + "']").attr("checked", "checked");
      }
      $("input[type='radio'][value='" + this.value + "']").attr("disabled", "disabled");
    }
  });

  $("g-languages-form").ajaxForm({
    dataType: "json",
    success: function(data) {
      if (data.result == "success") {
        el = $('<a href="' + <?php 
echo html::js_string(url::site("admin/maintenance/start/gallery_task::update_l10n?csrf={$csrf}"));
?>
 + '"></a>'); // this is a little hack to trigger the update_l10n task in a dialog
        el.gallery_dialog();
        el.trigger('click');
      }
    }
  });
</script>

<div class="g-block">
  <h1> <?php 
echo t("Languages and Translation");
?>
 </h1>
<?php

defined("SYSPATH") or die("No direct script access.");
?>
<script type="text/javascript">
  update_blocks = function() {
    $.get(<?php 
echo html::js_string(url::site("admin/dashboard/reorder"));
?>
,
          {"csrf": "<?php 
echo $csrf;
?>
",
           "dashboard_center[]": $("#g-admin-dashboard").sortable(
             "toArray", {attribute: "block_id"}),
           "dashboard_sidebar[]": $("#g-admin-dashboard-sidebar").sortable(
             "toArray", {attribute: "block_id"})});
  };

  $(document).ready(function(){
    $("#g-admin-dashboard .g-block .ui-widget-header").addClass("g-draggable");
    $("#g-admin-dashboard").sortable({
      connectWith: ["#g-admin-dashboard-sidebar"],
      cursor: "move",
      handle: $(".ui-widget-header"),
      opacity: 0.6,
      placeholder: "g-target",
      stop: update_blocks
    });
Exemple #10
0
    $("#gTagAdmin .delete-link").attr("title", $(".delete-link:first span").html());

    // In-place editing for tag admin
    $(".gEditable").bind("click", editInPlace);
  });
  // make some values available within tag.js
  var csrf_token = "<?php 
echo $csrf;
?>
";
  var save_i18n = <?php 
echo html::js_string(t("save")->for_html_attr());
?>
;
  var cancel_i18n = <?php 
echo html::js_string(t("cancel")->for_html_attr());
?>
;
</script>
<div class="gBlock">
  <h2>
    <?php 
echo t("Tag Admin");
?>
  </h2>

  <?php 
$tags_per_column = $tags->count() / 5;
?>
  <?php 
$column_tag_count = 0;
echo html::js_string(ini_get("upload_max_filesize") ? num::convert_to_bytes(ini_get("upload_max_filesize")) . "B" : "100MB");
?>
,
    file_types: "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4",
    file_types_description: <?php 
echo t("Photos and Movies")->for_js();
?>
,
    file_upload_limit: 1000,
    file_queue_limit: 0,
    custom_settings: { },
    debug: false,

    // Button settings
    button_image_url: <?php 
echo html::js_string(url::file("themes/default/images/select-photos-backg.png"));
?>
,
    button_width: "202",
    button_height: "45",
    button_placeholder_id: "gChooseFilesButtonPlaceholder",
    button_text: <?php 
echo json_encode('<span class="swfUploadFont">' . t("Select photos...") . '</span>');
?>
,
    button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }",
    button_text_left_padding: 30,
    button_text_top_padding: 10,

    // The event handler functions are defined in handlers.js
    file_queued_handler: file_queued,
Exemple #12
0
 public function js_string_test()
 {
     $string = html::js_string("hello's <p  >world</p>");
     $this->assert_equal('"hello\'s <p  >world<\\/p>"', $string);
 }
          animate_progress_bar();
        }
        $("#g-status").html("" + data.status);
        if (data.done) {
          dismiss();
        } else {
          setTimeout(update, 100);
        }
      }
    });
  }
  $(".g-progress-bar").progressbar({value: 0});
  update();
  dismiss = function() {
    window.location = <?php 
echo html::js_string(url::site("admin/themes"));
?>
;
  }
</script>
<div id="g-progress">
</div>
  <h1> <?php 
echo $task->name;
?>
 </h1>
  <div class="g-progress-bar"></div>
  <div id="g-status">
    <?php 
echo t("Starting up...");
?>
echo html::js_string(ini_get("upload_max_filesize") ? num::convert_to_bytes(ini_get("upload_max_filesize")) . "B" : "100MB");
?>
,
    file_types: "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4",
    file_types_description: <?php 
echo t("Photos and Movies")->for_js();
?>
,
    file_upload_limit: 1000,
    file_queue_limit: 0,
    custom_settings: { },
    debug: false,

    // Button settings
    button_image_url: <?php 
echo html::js_string(url::file(gallery::find_file("images", "select-photos-backg.png")));
?>
,
    button_width: "202",
    button_height: "45",
    button_placeholder_id: "g-choose-files-placeholder",
    button_text: <?php 
echo json_encode('<span class="swfUploadFont">' . t("Select photos...") . '</span>');
?>
,
    button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }",
    button_text_left_padding: 30,
    button_text_right_padding: 30,
    button_text_top_padding: 10,

    // The event handler functions are defined in handlers.js
<li class="ui-icon-left">
  <span class="ui-icon ui-icon-folder-open"></span>
  <span ondblclick="open_dir('')">
    <?php 
echo t("All");
?>
  </span>
  <ul>

    <?php 
foreach ($parents as $dir) {
    ?>
    <li class="ui-icon-left">
      <span class="ui-icon ui-icon-folder-open"></span>
      <span ondblclick='open_dir(<?php 
    echo html::js_string($dir);
    ?>
)'>
        <?php 
    echo html::clean(basename($dir));
    ?>
      </span>
      <ul>
        <?php 
}
?>

        <?php 
foreach ($files as $file) {
    ?>
        <li class="ui-icon-left">