aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-02-09 00:02:11 +0000
committerplegall <plg@piwigo.org>2012-02-09 00:02:11 +0000
commit62c69bb477ced2427a75e77c50e1bcad1f02e15a (patch)
tree85029f7429eccd186068a443527d1087013aa9c4 /admin/themes/default
parent9788bf8e7b4cdccacb4cd93201ecc982f1842d63 (diff)
feature 2470 added: ability to create a new album "on the fly" on the
"associate to album" action of the Batch Manager. The code was moved from the upload form and is now used by the upload form + Batch Manager. git-svn-id: http://piwigo.org/svn/trunk@13063 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl4
-rw-r--r--admin/themes/default/template/include/add_album.inc.tpl102
-rw-r--r--admin/themes/default/template/photos_add_direct.tpl99
3 files changed, 106 insertions, 99 deletions
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index d278bb7f4..856633421 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -1,6 +1,7 @@
{include file='include/tag_selection.inc.tpl'}
{include file='include/datepicker.inc.tpl'}
{include file='include/colorbox.inc.tpl'}
+{include file='include/add_album.inc.tpl'}
{footer_script}{literal}
pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
@@ -644,9 +645,10 @@ jQuery(window).load(function() {
<!-- associate -->
<div id="action_associate" class="bulkAction">
- <select style="width:400px" name="associate" size="1">
+ <select id="albumSelect" style="width:400px" name="associate" size="1">
{html_options options=$associate_options }
</select>
+<br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</div>
<!-- dissociate -->
diff --git a/admin/themes/default/template/include/add_album.inc.tpl b/admin/themes/default/template/include/add_album.inc.tpl
new file mode 100644
index 000000000..82178ab11
--- /dev/null
+++ b/admin/themes/default/template/include/add_album.inc.tpl
@@ -0,0 +1,102 @@
+{footer_script}{literal}
+jQuery(document).ready(function(){
+ function fillCategoryListbox(selectId, selectedValue) {
+ jQuery.getJSON(
+ "ws.php?format=json&method=pwg.categories.getList",
+ {
+ recursive: true,
+ fullname: true,
+ format: "json",
+ },
+ function(data) {
+ jQuery.each(
+ data.result.categories,
+ function(i,category) {
+ var selected = null;
+ if (category.id == selectedValue) {
+ selected = "selected";
+ }
+
+ jQuery("<option/>")
+ .attr("value", category.id)
+ .attr("selected", selected)
+ .text(category.name)
+ .appendTo("#"+selectId)
+ ;
+ }
+ );
+ }
+ );
+ }
+
+ jQuery(".addAlbumOpen").colorbox({
+ inline:true,
+ href:"#addAlbumForm",
+ onComplete:function(){
+ jQuery("input[name=category_name]").focus();
+ }
+ });
+
+ jQuery("#addAlbumForm form").submit(function(){
+ jQuery("#categoryNameError").text("");
+
+ jQuery.ajax({
+ url: "ws.php?format=json&method=pwg.categories.add",
+ data: {
+ parent: jQuery("select[name=category_parent] option:selected").val(),
+ name: jQuery("input[name=category_name]").val(),
+ },
+ beforeSend: function() {
+ jQuery("#albumCreationLoading").show();
+ },
+ success:function(html) {
+ jQuery("#albumCreationLoading").hide();
+
+ var newAlbum = jQuery.parseJSON(html).result.id;
+ jQuery(".addAlbumOpen").colorbox.close();
+
+ jQuery("#albumSelect").find("option").remove();
+ fillCategoryListbox("albumSelect", newAlbum);
+
+ /* we refresh the album creation form, in case the user wants to create another album */
+ jQuery("#category_parent").find("option").remove();
+
+ jQuery("<option/>")
+ .attr("value", 0)
+ .text("------------")
+ .appendTo("#category_parent")
+ ;
+
+ fillCategoryListbox("category_parent", newAlbum);
+
+ jQuery("#addAlbumForm form input[name=category_name]").val('');
+
+ jQuery("#albumSelection").show();
+
+ return true;
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrows) {
+ jQuery("#albumCreationLoading").hide();
+ jQuery("#categoryNameError").text(errorThrows).css("color", "red");
+ }
+ });
+
+ return false;
+ });
+});
+{/literal}{/footer_script}
+
+<div style="display:none">
+ <div id="addAlbumForm" style="text-align:left;padding:1em;">
+ <form>
+ {'Parent album'|@translate}<br>
+ <select id ="category_parent" name="category_parent">
+ <option value="0">------------</option>
+ {html_options options=$category_parent_options selected=$category_parent_options_selected}
+ </select>
+
+ <br><br>{'Album name'|@translate}<br><input name="category_name" type="text"> <span id="categoryNameError"></span>
+ <br><br><br><input type="submit" value="{'Create'|@translate}"> <span id="albumCreationLoading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span>
+ </form>
+ </div>
+</div>
diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl
index e996cabd1..5d3c1fbd6 100644
--- a/admin/themes/default/template/photos_add_direct.tpl
+++ b/admin/themes/default/template/photos_add_direct.tpl
@@ -7,6 +7,7 @@
{/if}
{include file='include/colorbox.inc.tpl'}
+{include file='include/add_album.inc.tpl'}
{footer_script}{literal}
jQuery(document).ready(function(){
@@ -67,90 +68,6 @@ jQuery(document).ready(function(){
return byteSize+suffix;
}
- function fillCategoryListbox(selectId, selectedValue) {
- jQuery.getJSON(
- "ws.php?format=json&method=pwg.categories.getList",
- {
- recursive: true,
- fullname: true,
- format: "json",
- },
- function(data) {
- jQuery.each(
- data.result.categories,
- function(i,category) {
- var selected = null;
- if (category.id == selectedValue) {
- selected = "selected";
- }
-
- jQuery("<option/>")
- .attr("value", category.id)
- .attr("selected", selected)
- .text(category.name)
- .appendTo("#"+selectId)
- ;
- }
- );
- }
- );
- }
-
- jQuery(".addAlbumOpen").colorbox({
- inline:true,
- href:"#addAlbumForm",
- onComplete:function(){
- jQuery("input[name=category_name]").focus();
- }
- });
-
- jQuery("#addAlbumForm form").submit(function(){
- jQuery("#categoryNameError").text("");
-
- jQuery.ajax({
- url: "ws.php?format=json&method=pwg.categories.add",
- data: {
- parent: jQuery("select[name=category_parent] option:selected").val(),
- name: jQuery("input[name=category_name]").val(),
- },
- beforeSend: function() {
- jQuery("#albumCreationLoading").show();
- },
- success:function(html) {
- jQuery("#albumCreationLoading").hide();
-
- var newAlbum = jQuery.parseJSON(html).result.id;
- jQuery(".addAlbumOpen").colorbox.close();
-
- jQuery("#albumSelect").find("option").remove();
- fillCategoryListbox("albumSelect", newAlbum);
-
- /* we refresh the album creation form, in case the user wants to create another album */
- jQuery("#category_parent").find("option").remove();
-
- jQuery("<option/>")
- .attr("value", 0)
- .text("------------")
- .appendTo("#category_parent")
- ;
-
- fillCategoryListbox("category_parent", newAlbum);
-
- jQuery("#addAlbumForm form input[name=category_name]").val('');
-
- jQuery("#albumSelection").show();
-
- return true;
- },
- error:function(XMLHttpRequest, textStatus, errorThrows) {
- jQuery("#albumCreationLoading").hide();
- jQuery("#categoryNameError").text(errorThrows).css("color", "red");
- }
- });
-
- return false;
- });
-
jQuery("#hideErrors").click(function() {
jQuery("#formErrors").hide();
return false;
@@ -351,20 +268,6 @@ var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */
<div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div>
</div>
-<div style="display:none">
- <div id="addAlbumForm" style="text-align:left;padding:1em;">
- <form>
- {'Parent album'|@translate}<br>
- <select id ="category_parent" name="category_parent">
- <option value="0">------------</option>
- {html_options options=$category_parent_options selected=$category_parent_options_selected}
- </select>
-
- <br><br>{'Album name'|@translate}<br><input name="category_name" type="text"> <span id="categoryNameError"></span>
- <br><br><br><input type="submit" value="{'Create'|@translate}"> <span id="albumCreationLoading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span>
- </form>
- </div>
-</div>
<form id="uploadForm" enctype="multipart/form-data" method="post" action="{$form_action}" class="properties">
{if $upload_mode eq 'multiple'}