Changeset cebb45b in indico
- Timestamp:
- 11/08/11 17:45:21 (19 months ago)
- Branches:
- master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- 306ce5
- Parents:
- b65b01
- git-author:
- Adrian Moennich <jerome.ernst.monnich@…> (11/08/11 17:43:56)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (11/08/11 17:45:21)
- Location:
- indico/MaKaC/webinterface
- Files:
-
- 2 edited
-
rh/conferenceModif.py (modified) (2 diffs)
-
tpls/ConfModifBadgeDesign.tpl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/webinterface/rh/conferenceModif.py
rb65b01 rcebb45b 7552 7552 7553 7553 def _process(self): 7554 from MaKaC.services.interface.rpc import json 7554 7555 if self._target.isClosed(): 7555 p = conferences.WPConferenceModificationClosed( self, self._target ) 7556 return p 7556 return json.encode_iframe({'status': 'error'}) 7557 7557 else: 7558 7558 if self._tempFilePath is not None: … … 7571 7571 backgroundId = len(value) - 1 7572 7572 7573 7574 return "".join(['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', 7575 '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>', 7576 '<span id="background_id">', 7577 str(backgroundId), 7578 '</span>', 7579 '<span id="background_url">', 7580 str(urlHandlers.UHConfModifBadgeGetBackground.getURL(self._conf, self.__templateId, backgroundId)), 7581 '</span>', 7582 '</body></html>' 7583 ]) 7573 return json.encode_iframe({ 7574 'status': 'OK', 7575 'id': backgroundId, 7576 'url': str(urlHandlers.UHConfModifBadgeGetBackground.getURL(self._conf, self.__templateId, backgroundId)) 7577 }) 7584 7578 7585 7579 class RHConfBadgeGetBackground(RHConfBadgeBase): -
indico/MaKaC/webinterface/tpls/ConfModifBadgeDesign.tpl
rdad7bd rcebb45b 363 363 } 364 364 365 function sent() {366 var iframeDocument = $('#uploadTarget')[0].contentDocument || $('#uploadTarget')[0].contentWindow;367 if (iframeDocument.document) {368 iframeDocument = iframeDocument.document;369 }370 371 try {372 if (backgroundId != -1) {373 $('#background').remove();374 }375 backgroundId = $('#background_id', iframeDocument).html();376 var backgroundURL = $('#background_url', iframeDocument).html();377 displayBackground(backgroundURL);378 }379 catch (err) {380 $('#loadingIcon').hide();381 }382 }383 384 365 function displayBackground(backgroundURL) { 385 366 $('<img/>', { … … 421 402 }).change(); 422 403 423 // show a throbber when uploading a background 424 $('#bgForm').submit(function() { 425 $('#uploadTarget').one('load', sent); 426 $('#loadingIcon').show(); 404 $('#bgForm').ajaxForm({ 405 dataType: 'json', 406 iframe: true, 407 success: function(data) { 408 if(data.status != 'OK') { 409 alert($T('An error occurred.')); 410 $('#loadingIcon').hide(); 411 return; 412 } 413 if (backgroundId != -1) { 414 $('#background').remove(); 415 } 416 backgroundId = data.id; 417 displayBackground(data.url); 418 }, 419 beforeSubmit: function() { 420 $('#loadingIcon').show(); 421 } 427 422 }); 428 423 … … 485 480 486 481 487 <iframe id="uploadTarget" name="uploadTarget" src="" style="width:0px;height:0px;border:0"></iframe>488 489 482 <div style="width:100%"> 490 483 <br/> … … 507 500 <span class="titleCellFormat"> ${ _("Background")}<br><small>(${ _("picture file in jpeg, png or gif")})</small></span> 508 501 </td> 509 <form id="bgForm" action="${ saveBackgroundURL }" method="POST" enctype="multipart/form-data" target="uploadTarget">502 <form id="bgForm" action="${ saveBackgroundURL }" method="POST" enctype="multipart/form-data"> 510 503 <td height="20px" NOWRAP align="left" colspan="3"> 511 504 <input name="file" size="58" type="file">
Note: See TracChangeset
for help on using the changeset viewer.
