diff options
Diffstat (limited to 'modules/organize/views')
| -rw-r--r-- | modules/organize/views/organize_dialog.html.php | 171 | ||||
| -rw-r--r-- | modules/organize/views/organize_thumb_grid.html.php | 22 | ||||
| -rw-r--r-- | modules/organize/views/organize_tree.html.php | 29 | 
3 files changed, 128 insertions, 94 deletions
| diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php index 38d05b81..8160a339 100644 --- a/modules/organize/views/organize_dialog.html.php +++ b/modules/organize/views/organize_dialog.html.php @@ -1,48 +1,133 @@  <?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script> +<style type="text/css" media="screen"> +  #flashContent { +    display:none; +  } + +  .g-organize { +    padding: 0; +    margins: 0; +  } + +  object { +    display: block; +    outline: none; +  } + +  #g-dialog { +    padding: 0; +  } +</style> +  <script type="text/javascript"> -  var move_url = "<?= url::site("organize/move_to/__ALBUM_ID__?csrf=$csrf") ?>"; -  var rearrange_url = "<?= url::site("organize/rearrange/__TARGET_ID__/__BEFORE__?csrf=$csrf") ?>"; -  var sort_order_url = "<?= url::site("organize/sort_order/__ALBUM_ID__/__COL__/__DIR__?csrf=$csrf") ?>"; -  var tree_url = "<?= url::site("organize/tree/__ALBUM_ID__") ?>"; +      $("#g-dialog").bind("dialogclose", function(event, ui) { +        // @todo do a call to organize/closing to end the batch +        window.location.reload(); +      }); + +  function closeOrganizeDialog() { +    $("#g-dialog").dialog("close"); +  } + +  function setTitle(title) { +    $("#ui-dialog-title-g-dialog").text(<?= t("Organize :: ")->for_js() ?> + title); +  } + +  function getOrganizeStyles() { +    return { +      color: colorToHex($("#g-organize").css("color")), +      backgroundColor: colorToHex($("#g-organize").css("backgroundColor")), +      borderColor: colorToHex($("#g-organize").css("borderLeftColor")), +      rollOverColor: colorToHex($("#g-organize-hover").css("backgroundColor")), +      selectionColor: colorToHex($("#g-organize-active").css("backgroundColor")) +    }; +  } + +  function colorToHex(color) { +    // Surprising no one, the color extracted from the css is in a different format +    // in IE than it is when extracted from FF or Chrome.  FF and Chrome return +    // the of "rgb(nn,nn,nn)". Where as IE returns it as #hhhhhh. + +    if (color.indexOf("#") === 0) { +      return '0x' + color.substring(1); +    } else { +      var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color); + +      var red = parseInt(digits[2]); +      var green = parseInt(digits[3]); +      var blue = parseInt(digits[4]); + +      var rgb = blue | (green << 8) | (red << 16); +      return digits[1] + '0x' + rgb.toString(16); +    } +  } + +  function getTextStrings() { +    return { +      statusText: <?= t("Drag and drop photos to re-order or move between album")->for_js() ?>, +      remoteError: +        <?= t("Remote server error, please contact your gallery administrator")->for_js() ?>, +      addAlbumError: <?= t("The above highlighted fields are invalid")->for_js() ?>, +      errorOccurred: <?= t("Remote error ocurred")->for_js() ?>, +      addAlbum: <?= t("Add album")->for_js() ?>, +      addImages: <?= t("Add photo")->for_js() ?>, +      deleteSelected: <?= t("Delete")->for_js() ?>, +      uploadedText: <?= t("Uploaded {0}")->for_js() ?>, +      removeFileText: <?= t("Remove")->for_js() ?>, +      progressLabel:  <?= t("Completed image %1 of %2")->for_js() ?>, +      uploadLabel:  <?= t("Loaded %1 of %2 bytes")->for_js() ?>, +      moveTitle:  <?= t("Move images")->for_js() ?>, +      deleteTitle:  <?= t("Delete image")->for_js() ?>, +      uploadTitle:  <?= t("Upload image")->for_js() ?>, +      cancel: <?= t("Cancel")->for_js() ?>, +      close: <?= t("Close")->for_js() ?> +    }; +  } + +  function getGalleryParameters() { +    return { +      dialogWidth: $("#g-dialog:parent").width(), +      dialogHeight: $("#g-dialog").height(), +      domain: "<?= $domain ?>", +      accessKey: "<?= $access_key ?>", +      protocol: "<?= $protocol ?>", +      fileFilter: "<?= $file_filter ?>", +      sortOrder: "<?= $sort_order ?>", +      sortFields: "<?= $sort_fields ?>", +      albumId: "<?= $album->id ?>", +      restUri: "<?= url::site("rest") ?>/", +      controller: "<?= url::site("organize") ?>/" +    }; +  }; +  /* +    For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), +    for no version detection. +  */ +  var swfVersionStr = "0.0.0"; +  /* To use express install, set to playerProductInstall.swf, otherwise the empty string.*/ +  var xiSwfUrlStr = ""; +  var flashvars = {}; + +  var size = $.gallery_get_viewport_size(); + +  var params = {}; +  params.quality = "high"; +  params.bgcolor = "#ffffff"; +  params.allowNetworking = "all"; +  params.allowscriptaccess = "sameDomain"; +  params.allowfullscreen = "true"; +  var attributes = {}; +  attributes.id = "Gallery3WebClient"; +  attributes.name = "Gallery3WebClient"; +  attributes.align = "middle"; +  swfobject.embedSWF("<?= url::file("modules/organize/lib/Gallery3WebClient.swf") ?>", +                     "flashContent", size.width() - 100,  size.height() - 135, +                     swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);  </script>  <div id="g-organize" class="g-dialog-panel"> -  <h1 style="display:none"><?= t("Organize %name", array("name" => html::purify($album->title))) ?></h1> -  <div id="g-organize-content-pane"> -    <div id="g-organize-tree-container" class="g-left ui-helper-clearfix"> -      <h3><?= t("Albums") ?></h3> -      <ul id="g-organize-album-tree"> -        <?= $album_tree ?> -      </ul> -    </div> -    <div id="g-organize-detail" class="g-left ui-helper-clearfix"> -      <ul id="g-action-status" class="g-message-block"> -        <li class="g-info"><?= t("Drag and drop photos to re-order or move between albums") ?></li> -      </ul> -      <div id="g-organize-microthumb-grid" class="ui-widget" -           ref="<?= url::site("organize/album/__ITEM_ID__/__OFFSET__") ?>"> -          <?= $micro_thumb_grid ?> -      </div> -      <div id="g-organize-controls" class="ui-widget-header"> -        <a id="g-organize-close" href="#" ref="done" -           class="g-button g-right ui-corner-all ui-state-default"><?= t("Close") ?></a> -        <form> -          <ul> -            <li id="g-organize-sort-order-text" class="g-left"><?= t("Sort order") ?></li> -            <li class="g-left"> -            <?= form::dropdown(array("id" => "g-organize-sort-column"), -                               album::get_sort_order_options(), $album->sort_column) ?> -            </li> -            <li class="g-left"> -            <?= form::dropdown(array("id" => "g-organize-sort-order"), -                               array("ASC" => t("Ascending"), "DESC" => t("Descending")), $album->sort_order) ?> -            </li> -          </ul> -        </form> -      </div> -    </div> -  </div> +    <!-- The following spans are placeholders so we can load the hover and active styles for the flex component --> +    <span id="g-organize-hover" /><span id="g-organize-active" /> +  <h1 style="display:none"><?= t("Organize :: %name", array("name" => html::purify($album->title))) ?></h1> +    <div id="flashContent"> </div>  </div> - -<script type="text/javascript"> -  $("#g-organize").ready($.organize.init); -</script> diff --git a/modules/organize/views/organize_thumb_grid.html.php b/modules/organize/views/organize_thumb_grid.html.php deleted file mode 100644 index f5db53d4..00000000 --- a/modules/organize/views/organize_thumb_grid.html.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<? foreach ($album->children(25, $offset) as $child): ?> -<div class="g-organize-microthumb-grid-cell g-left ui-state-default ui-state-active <?= $child->is_album() ? "g-album" : "g-photo" ?>" -    ref="<?= $child->id ?>"> -  <?= $child->thumb_img(array("class" => "g-thumbnail", "ref" => $child->id), 90, true) ?> -  <span<?= $child->is_album() ? " class=\"ui-icon ui-icon-note\"" : "" ?>></span> -</div> -<? endforeach ?> - -<? if ($album->children_count() > $offset): ?> -<script type="text/javascript"> -  setTimeout(function() { -    $.get("<?= url::site("organize/album/$album->id/" . ($offset + 25)) ?>", -          {}, -          function(data) { -            $("#g-organize-microthumb-grid").append(data.grid); -            $.organize.set_handlers(); -          }, -          "json"); -  }, 50); -</script> -<? endif ?> diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php deleted file mode 100644 index 044b6858..00000000 --- a/modules/organize/views/organize_tree.html.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<li class="g-organize-album ui-icon-left <?= access::can("edit", $album) ? "" : "g-view-only" ?>" -    ref="<?= $album->id ?>"> -  <span class="ui-icon ui-icon-minus g-left"> -  </span> -  <span class="g-organize-album-text <?= $selected && $album->id == $selected->id ? "ui-state-focus" : "" ?>" -        ref="<?= $album->id ?>"> -    <?= html::clean($album->title) ?> -  </span> -  <? $child_albums = $album->viewable()->children(null, null, array(array("type", "=", "album"))); ?> -  <? if (!empty($child_albums)): ?> -  <ul> -  <? foreach ($child_albums as $child): ?> -    <? if ($selected && $child->contains($selected)): ?> -    <?= View::factory("organize_tree.html", array("selected" => $selected, "album" => $child)); ?> -    <? else: ?> -    <li class="g-organize-album ui-icon-left <?= access::can("edit", $child) ? "" : "g-view-only" ?>" -        ref="<?= $child->id ?>"> -      <span class="ui-icon ui-icon-plus g-left"></span> -      <span class="g-organize-album-text <?= $selected && $child->id == $selected->id ? "ui-state-focus" : "" ?>" ref="<?= $child->id ?>"> -        <?= html::clean($child->title) ?> -      </span> -    </li> -    <? endif ?> -    <? endforeach ?> -  </ul> -  <? endif ?> -</li> - | 
