Page
<#--Header--> < #assign pagetitle= "Media Management" > < #assign currentnav= ' media ' > < #include '/wxj/ BACKENDCOMMONS/HEADER.FTL "> <#--introduces custom macros--> < #include"/MACROS/MACROS.FTL "> <div id=" Content-container "class=" container "> <div class=" col-md-12 "><div class=" Panel panel-default pane L-col "> <div class=" panel-heading page-header clearfix "> <a href="/secure/wxj/manage/media/picture " class= "btn btn-info btn-sm pull-right" > Return </a> <button class= "btn btn-info btn-sm pull-right" id= "add-p Icture-btn "data-toggle=" modal "data-target=" #modal "data-url="/secure/wxj/manage/media/${courseid}/picture/add " data-backdrop= "Static" style= "margin-right:10px;" > Add picture </button> <a href= "/secure/wxj/manage/media/${courseid}/picture/add?way=batch" class= btn btn-in Fo btn-sm pull-right "style=" margin-right:10px; "> Bulk Add Picture </a> Atlas Management--<span>${(course.tit Le)! '} </span&Gt </div> <#--Picture List--> <div class= "Panel-body content-picture" > <div> <labe L class= "Checkbox-inline" ><input id= "Batch-select" type= "checkbox" data-role= "Batch-select" > select all </label > <button id= "batch-delete" class= "btn btn-default btn-sm MLM" data-role= "Batch-delete" data-name= "Picture" Da Ta-url= "/secure/wxj/manage/media/picture/delete" > Delete </button> </div> <a href= "/secure/wxj/m Anage/media/${courseid}/picture "class=" btn btn-info btn-sm pull-right "> Default sort </a> <a href="/secure/wxj/ma Nage/media/${courseid}/picture?sort=time "class=" btn btn-info btn-sm pull-right "style=" margin-right:20px; "> Time sequencing </a> <table class= "table table-striped table-hover" id= "picture-table" > <thead> <t
r> <th> serial </th> <th width= "50%" > Photo description </th> <th> upload </th> <th> Display Order </tH> <th> Add time </th> <th> operation </th> </tr> </thead> <tbody> < #if uimglist?has_content> < #list uimglist as c> <tr> <TD&G
T <span> <input value= "${(C.imageid)!" type= "checkbox" data-role= "Batch-item" ></span> < span>${c_index+1} </span> </td> <td> <a class= "Pull-left" href= " /wxj/picture/${c.courseid}/show "target=" _blank "> </a> <a href=" # "class=" MLM "target=" _bla NK ">${(c.description)!"} </a> </td> <td>${c.nickname! " --"}</td> <td> <span>${(c.ordered)!"
1 '}</span> </td> <td> <span class= "text-muted" > ${(c.dateadded)? string (' Yyyy-mm-dd HH:mm:ss ')}</span> </td > <td> <div class= "Btn-group" style= "margin-right:10px;" > <button class= "btn btn-default btn-sm" data-url=/secure/wxj/manage/media/${(C.imageid)! '} /picture/editor "data-toggle=" modal "data-target=" #modal "data-backdrop=" static "> Edit </button> <a href= "#" type= "button" class= "btn btn-default btn-sm dropdown-toggle" data-toggle= "dropdown" > <span
class= "Caret" ></span> </a> <ul class= "Dropdown-menu pull-right" > <li><a class= "delete-picture" data-role= delete-picture "href=" javascript: "Data-url="/secure/wxj/manage/ media/${(C.imageid)! '} /picture/delete "><span class=" Glyphicon glyphicon-trash "></span> Delete </a></li> < /ul> </div> <button class= "btn btn-info btn-sm" Data-url=/secure/wxj/manage/media/${(c.imagei d)! '}
/picture/replace "data-toggle=" modal "data-target=" #modal "data-backdrop=" static "> Replace show Map </button> </td> </tr> </#list > </#if > </tbody> </table>
;/div> </div> </div> </div> </div> <script> var app = {};
App.debug = false;
App.controller = ' picture/list '; </script> <script src= "/resources/js/bootstrap-notify.js" ></script> <script>//Bulk Selected $ ("# Batch-select "). Click (function () {if ($ (this). Is (": checked ") = = True) {$ ('. Content-picture '). Find (' [Data-role=ba
Tch-select], [Data-role=batch-item] '). Prop (' checked ', true);
else {$ ('. Content-picture '). Find (' [Data-role=batch-select], [Data-role=batch-item] '). Prop (' checked ', false);
}
}); Bulk Delete $ ("#batch-delete"). Click(function () {var $btn = $ (this);
Name = $btn. Data (' name ');
var ids = [];
$ (". Content-picture"). Find (' [data-role=batch-item]:checked ']. each (function () {Ids.push (this.value);
});
if (ids.length = 0) {notify.danger (' no ' + name is selected);
return; !confirm (' OK to delete the selected ' + ids.length + ' + ' + ' + ' + name + ').
") {return;
$ (". Content-picture"). Find ('. btn '). addclass (' disabled '); Notify.info (' deleting ' + name + '), please wait a moment.
', 60);
var values=ids.tostring ();
$.post ($btn. Data (' URL '), {ids:values}, function () {window.location.reload ();
});
});
</script> <#--footer Start--> < #include "/WXJ/BACKENDCOMMONS/FOOTER.FTL" >
Control layer:
/**
* Bulk Delete pictures.
* *
@RequestMapping (value = "/picture/delete", method = {requestmethod.get, requestmethod.post}) public
Responseentity<ajaxpostresponse> deletepicturelist (HttpServletRequest request) {
//list
of picture IDs to be deleted String imageids = servletrequestutils.getstringparameter (Request, "IDs", "");
string[] imageList = imageids.tostring (). Split (",");
list<string> imageidlist = arrays.aslist (imageList);//array converted to list
try {
Boolean opstatus = Uploadedimagemanager.delete (imageidlist);
Logger.info ("Bulk Delete pictures: opstatus={}", opstatus);
Return This.okresponse (Opstatus);
} catch (Exception e) {
logger.error ("An exception occurred while deleting a picture in bulk, Cause:", e);
Return This.errorresponse (E.getmessage ());
}
Serveis:
@Override Public
Boolean Delete (list<string> imageids) {
//delete notification
Uploadedimageexample example = new Uploadedimageexample ();
Example.createcriteria (). Andimageidin (imageids);
int rows = Uploadedimagemapper.deletebyexample (example);
return (Rows > 0);
}