Changeset 9a7862 in indico


Ignore:
Timestamp:
03/16/10 17:40:32 (3 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, prov-dual-interface, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 36509dd327b5670bb394f5ec070c14653b4c9c19
Children:
721175
Parents:
0f3143
git-author:
David Martín Clavo <david.martin.clavo@…> (03/16/10 10:13:10)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (03/16/10 17:40:32)
Message:

[FTR] New Reschedule Popup

-fixes #305
-Warning: URLs added to vars.js.tpl, please
delete .tmp file.

Location:
indico
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/rh/conferenceModif.py

    r7fdb9b r9a7862  
    70437043        self._minute=params.get("minute","") 
    70447044        self._action=params.get("action","duration") 
    7045         self._targetDay=params.get("targetDay",None) 
     7045        self._targetDay=params.get("targetDay",None) #comes in format YYYYMMDD, ex: 20100317 
    70467046        if self._targetDay is None: 
    70477047            raise MaKaCError( _("Error while rescheduling timetable: not target day")) 
    70487048        else: 
    7049             self._day=timezone(self._conf.getTimezone()).localize(datetime(int(params["targetDay"][0:4]),int(params["targetDay"][5:7]),int(params["targetDay"][8:]))) 
     7049            self._day=timezone(self._conf.getTimezone()).localize(datetime(int(params["targetDay"][0:4]), 
     7050                                                                           int(params["targetDay"][4:6]), 
     7051                                                                           int(params["targetDay"][6:8]))) 
    70507052        if self._ok: 
    70517053            if self._hour.strip() == "" or self._minute.strip() == "": 
  • indico/MaKaC/webinterface/rh/sessionModif.py

    ra21bf8 r9a7862  
    15661566        self._minute=params.get("minute","") 
    15671567        self._action=params.get("action","duration") 
     1568        self._currentDay = params.get("currentDay", "") 
     1569        self._inSessionTimetable = (params.get("inSessionTimetable", "no") == "yes") 
     1570 
    15681571        if self._ok: 
    15691572            if self._hour.strip() == "" or self._minute.strip() == "": 
     
    15741577            except ValueError, e: 
    15751578                raise MaKaCError( _("Please write a number to specify the time HH:MM. For instance, 00:05 to indicate 'O hours' and '5 minutes'")) 
     1579 
     1580    def _formatRedirectURL(self, baseURL): 
     1581        target = "".join([str(baseURL), 
     1582                        "#", 
     1583                        self._currentDay, 
     1584                        ".s", 
     1585                        self._session.getId(), 
     1586                        "l", 
     1587                        self._slotId]) 
     1588 
     1589        return target 
    15761590 
    15771591    def _process(self): 
     
    15841598                t=timedelta(hours=int(self._hour), minutes=int(self._minute)) 
    15851599                slot.recalculateTimes(self._action, t) 
    1586         self._redirect(urlHandlers.UHSessionModifSchedule.getURL(self._session)) 
     1600 
     1601        if (self._inSessionTimetable): 
     1602            self._redirect(self._formatRedirectURL(urlHandlers.UHSessionModifSchedule.getURL(self._session))) 
     1603        else: 
     1604            self._redirect(self._formatRedirectURL(urlHandlers.UHConfModifSchedule.getURL(self._conf))) 
    15871605 
    15881606class RHSlotEdit( RoomBookingDBMixin, RHSessionModUnrestrictedTTCoordinationBase ): 
  • indico/MaKaC/webinterface/tpls/js/vars.js.tpl

    r8feaa1 r9a7862  
    104104        ContributionModification: "<%= urlHandlers.UHContributionModification.getURL() %>", 
    105105        BreakModification: "<%= urlHandlers.UHConfModifyBreak.getURL() %>", 
     106 
    106107        Reschedule: "<%= urlHandlers.UHConfModifReschedule.getURL() %>", 
     108        SlotCalc: "<%= urlHandlers.UHSessionModSlotCalc.getURL() %>", 
     109        SlotCompact: "<%= urlHandlers.UHSessionModSlotCompact.getURL() %>", 
    107110 
    108111        UploadAction: { 
  • indico/htdocs/css/Default.css

    rbe6f07 r9a7862  
    52955295} 
    52965296 
     5297 
     5298/* Reschedule dialog */ 
     5299 
     5300div.rescheduleSection { 
     5301    padding-bottom: 20px; 
     5302} 
     5303 
     5304div.rescheduleTitle { 
     5305    font-size: 14pt; 
     5306    padding-bottom: 5px; 
     5307} 
     5308 
     5309 
     5310tr.selectedAction { 
     5311    background-color: #CDEB8B; 
     5312} 
     5313 
     5314td.rescheduleAction { 
     5315    vertical-align:top; 
     5316    padding-bottom: 5px; 
     5317    padding-top: 5px; 
     5318} 
     5319 
     5320div.rescheduleLabelTitle { 
     5321    font-size:12pt; 
     5322    cursor: default; 
     5323} 
     5324 
     5325div.rescheduleLabelDetails { 
     5326    font-size:9pt; 
     5327    font-style: italic; 
     5328    cursor: default; 
     5329} 
     5330 
     5331 
     5332 
     5333.rescheduleWarning { 
     5334    font-weight: bold; 
     5335    color: #D01F3C; 
     5336} 
     5337 
     5338/* End of reschedule dialog */ 
     5339 
     5340 
    52975341.slotTitle { 
    52985342    font-size:14px; 
  • indico/htdocs/js/indico/Management/Timetable.js

    r8feaa1 r9a7862  
    12031203                                }); 
    12041204        }); 
     1205 
     1206 
     1207/** 
     1208 * Dialog to reschedule a timetable day or an interval 
     1209 * @param {Timetable} parentTimetable The timetable object from which this dialog is launched. 
     1210 */ 
     1211type("RescheduleDialog", ["ExclusivePopupWithButtons"], { 
     1212 
     1213    /** 
     1214     * For top level timetable, returns the current day formatted as Fri 26/07 
     1215     */ 
     1216    __getCurrentDayText: function(){ 
     1217        return this.tt._titleTemplate(this.tt.currentDay); 
     1218    }, 
     1219 
     1220    /** 
     1221     * For an interval timetable, returns the title of the interval 
     1222     */ 
     1223    __getIntervalTitle: function(){ 
     1224        return '"' + this.tt.contextInfo.title + '"'; 
     1225    }, 
     1226 
     1227    /** 
     1228     * Draws the step 1: choose "starting time" or "duration" as action 
     1229     */ 
     1230    __drawChooseAction: function(){ 
     1231        var self = this; 
     1232 
     1233        // Step 1: choose action 
     1234        var actionChooseTitle = Html.div("rescheduleTitle", $T("Step 1: Choose type of rescheduling")); 
     1235 
     1236        var startTimeRescheduleRB = Html.radio({name:"rescheduleAction", id:"startTimeRescheduleRB", style:{verticalAlign: "middle"}}); 
     1237        var startTimeRescheduleLabel = Html.label({style: {fontWeight: "normal"}}, 
     1238                Html.div("rescheduleLabelTitle", $T("Adjust starting time of all entries")), 
     1239                Html.div("rescheduleLabelDetails", 
     1240                    this.isTopLevelTimetable ? 
     1241                        $T("Move the entries of ") + this.__getCurrentDayText() +$T(" by changing their") : 
     1242                        $T("Move the entries of the interval ") + this.__getIntervalTitle() + $T(" by changing their"), 
     1243                    Html.strong({}, $T(" starting times. ")), 
     1244                    this.isTopLevelTimetable ? 
     1245                            $T("The first entry will start when the event starts (") + this.tt.eventInfo.startDate.time.slice(0,5) + "), " : 
     1246                            $T("The first entry will start when the interval starts (") + this.tt.contextInfo.startDate.time.slice(0,5) + "), " , 
     1247                    $T("and the other entries will follow consecutively after it (with no gaps by default). The durations of the entries will not change."))); 
     1248 
     1249        startTimeRescheduleLabel.dom.htmlFor = "startTimeRescheduleRB"; 
     1250 
     1251        var durationRescheduleRB = Html.radio({name:"rescheduleAction", id:"durationRescheduleRB", style:{verticalAlign: "middle"}}); 
     1252        var durationRescheduleLabel = Html.label({style: {fontWeight: "normal"}}, 
     1253                Html.div("rescheduleLabelTitle", $T("Adjust duration of all entries")), 
     1254                Html.div("rescheduleLabelDetails", 
     1255                    $T("Adjust the "), Html.strong({}, $T(" duration ")), $T("of the entries of "), 
     1256                    this.isTopLevelTimetable ? 
     1257                        this.__getCurrentDayText() + "," : 
     1258                        $T("the interval ") + this.__getIntervalTitle(), 
     1259                        $T(" so that there are no entries running in parallel (and no gaps by default). "), 
     1260                    $T("The starting times will not change."))); 
     1261 
     1262        durationRescheduleLabel.dom.htmlFor = "durationRescheduleRB"; 
     1263 
     1264        var actionChoose = Html.table({cellpadding:0, cellPadding:0, cellspacing:0, cellSpacing:0}); 
     1265        var actionChooseTbody = Html.tbody(); 
     1266 
     1267        var startTimeRescheduleTr = Html.tr(); 
     1268        startTimeRescheduleTr.append(Html.td("rescheduleAction", startTimeRescheduleRB)); 
     1269        startTimeRescheduleTr.append(Html.td({className: "rescheduleAction", style:{paddingRight:pixels(5)}}, startTimeRescheduleLabel)); 
     1270        actionChooseTbody.append(startTimeRescheduleTr); 
     1271 
     1272        var durationRescheduleTr = Html.tr(); 
     1273        durationRescheduleTr.append(Html.td("rescheduleAction", durationRescheduleRB)); 
     1274        durationRescheduleTr.append(Html.td({className: "rescheduleAction", style:{paddingRight:pixels(5)}}, durationRescheduleLabel)); 
     1275        actionChooseTbody.append(durationRescheduleTr); 
     1276 
     1277        actionChoose.append(actionChooseTbody); 
     1278 
     1279        startTimeRescheduleRB.observeClick(function(){ 
     1280            self.rescheduleButton.enable(); 
     1281            self.rescheduleAction = "startingTime"; 
     1282            startTimeRescheduleTr.dom.className = "selectedAction"; 
     1283            durationRescheduleTr.dom.className = ""; 
     1284        }); 
     1285        durationRescheduleRB.observeClick(function(){ 
     1286            self.rescheduleButton.enable(); 
     1287            self.rescheduleAction = "duration"; 
     1288            durationRescheduleTr.dom.className = "selectedAction"; 
     1289            startTimeRescheduleTr.dom.className = ""; 
     1290        }); 
     1291 
     1292        return Html.div("rescheduleSection", actionChooseTitle, actionChoose); 
     1293    }, 
     1294 
     1295 
     1296    /** 
     1297     * Draws the step 2: choose gap between entries 
     1298     */ 
     1299    __drawChooseInterval: function (){ 
     1300        var self = this; 
     1301        // Step 2: choose interval between entries 
     1302        var intervalTitle = Html.div("rescheduleTitle", $T("Step 2: Choose time gap between entries")); 
     1303 
     1304        this.minuteInput = Html.input("text", {style:{width:"3em", textAlign:"right", marginTop: pixels(5), marginBottom: pixels(5)}}, "00"); 
     1305        var timeInputLabel = Html.span({style:{marginLeft: pixels(5)}}, "(minutes)"); 
     1306        var intervalInputDiv = Html.div({style:{textAlign:"center"}}, this.minuteInput, timeInputLabel); 
     1307 
     1308        this.intervalExplanationDiv = Html.div(); 
     1309 
     1310        this.minuteInput.observeEvent("change", function(event){ 
     1311            self.__intervalObserver(); 
     1312        }); 
     1313 
     1314        return Html.div("rescheduleSection", intervalTitle, intervalInputDiv, this.intervalExplanationDiv); 
     1315    }, 
     1316 
     1317 
     1318    /** 
     1319     * Function that will be called when the gap between entries changes 
     1320     */ 
     1321    __intervalObserver: function(){ 
     1322 
     1323        var minutes = this.minuteInput.get(); 
     1324 
     1325        var errors = false; 
     1326        if (!IndicoUtil.isInteger(minutes) || minutes < 0) { 
     1327            return; 
     1328        } 
     1329 
     1330        minutes = parseInt(minutes, 10); 
     1331 
     1332        if (minutes === 0) { 
     1333            this.intervalExplanationDiv.set($T("There will be no gaps between consecutive entries.")); 
     1334        } else { 
     1335            var h = Math.floor(minutes / 60); 
     1336            var m = minutes % 60; 
     1337 
     1338            intervalExplanationText = $T("Entries will be separated by gaps of "); 
     1339            if (h === 1) { 
     1340                intervalExplanationText += $T("1 hour "); 
     1341            } else if (h > 0) { 
     1342                intervalExplanationText += h + $T(" hours "); 
     1343            } 
     1344 
     1345            if (h !==0 && m!== 0) { 
     1346                intervalExplanationText += $T("and "); 
     1347            } 
     1348 
     1349            if (m === 1) { 
     1350                intervalExplanationText += $T("1 minute."); 
     1351            } else  if (m > 0) { 
     1352                intervalExplanationText += m + $T(" minutes."); 
     1353            } 
     1354 
     1355            this.intervalExplanationDiv.set(intervalExplanationText); 
     1356        } 
     1357    }, 
     1358 
     1359 
     1360    /** 
     1361     * Draws the reschedule and cancel buttons 
     1362     */ 
     1363    __drawButtons: function() { 
     1364        var self = this; 
     1365        // Reschedule and cancel buttons 
     1366        this.rescheduleButton = new DisabledButton(Html.input("button", {disabled:true, style:{marginRight:pixels(3)}}, $T("Reschedule"))); 
     1367        var rescheduleButtonTooltip; 
     1368        this.rescheduleButton.observeEvent('mouseover', function(event){ 
     1369            if (!self.rescheduleButton.isEnabled()) { 
     1370                rescheduleButtonTooltip = IndicoUI.Widgets.Generic.errorTooltip(event.clientX, event.clientY, $T("Please select type of rescheduling"), "tooltipError"); 
     1371            } 
     1372        }); 
     1373        this.rescheduleButton.observeEvent('mouseout', function(event){ 
     1374            Dom.List.remove(document.body, rescheduleButtonTooltip); 
     1375        }); 
     1376 
     1377        this.rescheduleButton.observeClick(function() { 
     1378            self.__reschedule(); 
     1379        }); 
     1380 
     1381        var cancelButton = Html.input("button", {style:{marginLeft:pixels(3)}}, $T("Cancel")); 
     1382        cancelButton.observeClick(function(){self.close();}); 
     1383 
     1384        return Html.div({}, this.rescheduleButton.draw(), cancelButton); 
     1385    }, 
     1386 
     1387 
     1388    /** 
     1389     * Builds the parameter manager that checks validity of fields 
     1390     */ 
     1391    __buildParameterManager: function() { 
     1392        this.parameterManager = new IndicoUtil.parameterManager(); 
     1393        this.parameterManager.add(this.minuteInput, "non_negative_int", false); 
     1394    }, 
     1395 
     1396 
     1397    /** 
     1398     * Function called when the user presses the reschedule button 
     1399     */ 
     1400    __reschedule: function() { 
     1401        var self = this; 
     1402 
     1403        if (this.parameterManager.check()) { 
     1404 
     1405            var confirmHandler = function(confirm) { 
     1406 
     1407                if (confirm) { 
     1408 
     1409                    if (self.isTopLevelTimetable) { 
     1410                        // We are in a top level management timetable 
     1411 
     1412                        IndicoUI.Dialogs.Util.progress($T("Rescheduling day ") + self.__getCurrentDayText() + "..."); 
     1413 
     1414                        Util.postRequest(Indico.Urls.Reschedule, 
     1415                                { 
     1416                                    confId: self.tt.eventInfo.id 
     1417                                }, 
     1418                                { 
     1419                                    OK: "ok", 
     1420                                    action: self.rescheduleAction, 
     1421                                    hour: "0", 
     1422                                    minute: self.minuteInput.get(), 
     1423                                    targetDay: self.tt.currentDay 
     1424                                }); 
     1425 
     1426                    } else if (self.isIntervalTimetable) { 
     1427 
     1428                        // We are in an interval management timetable 
     1429 
     1430                        IndicoUI.Dialogs.Util.progress($T("Rescheduling interval... ")); 
     1431 
     1432                        var inSessionTimetable = "no"; 
     1433                        if (exists(self.tt.parentTimetable.isSessionTimetable) && self.tt.parentTimetable.isSessionTimetable === true) { 
     1434                            inSessionTimetable = "yes"; 
     1435                        } 
     1436 
     1437                        Util.postRequest(Indico.Urls.SlotCalc, 
     1438                                { 
     1439                                    confId: self.tt.eventInfo.id, 
     1440                                    sessionId: self.tt.contextInfo.sessionId, 
     1441                                    slotId: self.tt.contextInfo.sessionSlotId 
     1442                                }, 
     1443                                { 
     1444                                    OK: "ok", 
     1445                                    action: self.rescheduleAction, 
     1446                                    hour: "0", 
     1447                                    minute: self.minuteInput.get(), 
     1448                                    currentDay: self.tt.currentDay, 
     1449                                    inSessionTimetable: inSessionTimetable 
     1450                                }); 
     1451                    } 
     1452                } 
     1453            }; 
     1454 
     1455            var confirmText = Html.div({}, 
     1456                Html.div({}, $T("Are you sure you want to reschedule? ")), 
     1457                Html.div({}, $T("All entries "), 
     1458                        this.isTopLevelTimetable ? "on " + this.__getCurrentDayText() : "of the interval " + this.__getIntervalTitle() , 
     1459                        $T(" will have their "), 
     1460                        this.rescheduleAction === "startingTime" ? $T("starting times") : $T("duration"), 
     1461                        $T(" changed.")), 
     1462                Html.br(), 
     1463                Html.div("rescheduleWarning", "This change cannot be undone.") 
     1464            ); 
     1465 
     1466            var confirmPopup = new ConfirmPopup($T("Please review your choice"), confirmText, confirmHandler); 
     1467            confirmPopup.open(); 
     1468        } 
     1469 
     1470    }, 
     1471 
     1472    /** 
     1473     * Draw the dialog 
     1474     */ 
     1475    draw: function(){ 
     1476        var self = this; 
     1477 
     1478        var actionChooseDiv = this.__drawChooseAction(); 
     1479        var intervalDiv = this.__drawChooseInterval(); 
     1480 
     1481        this.mainContent = Html.div({style:{width:pixels(450)}}, actionChooseDiv, intervalDiv); 
     1482        var buttonContent = this.__drawButtons(); 
     1483 
     1484        this.__intervalObserver(); 
     1485        this.__buildParameterManager(); 
     1486 
     1487        return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.mainContent, buttonContent); 
     1488 
     1489    } 
     1490}, 
     1491    /** 
     1492     * Constructor 
     1493     */ 
     1494    function(parentTimetable){ 
     1495        this.ExclusivePopupWithButtons(Html.div({style:{textAlign:"center"}},$T("Reschedule Entries")), positive); 
     1496        this.tt = parentTimetable; 
     1497 
     1498        this.isTopLevelTimetable = exists(this.tt.TopLevelManagementTimeTable); 
     1499        this.isIntervalTimetable = exists(this.tt.IntervalManagementTimeTable); 
     1500 
     1501        this.rescheduleAction = null; 
     1502        this.timeInput = null; 
     1503        this.rescheduleButton = null; 
     1504    } 
     1505); 
  • indico/htdocs/js/indico/Timetable/Base.js

    r3cd3b7 r9a7862  
    663663 
    664664        this.separator = Html.span({}, " | "); 
    665         // TODO: implement reschedule function 
    666         var href = Indico.Urls.Reschedule; 
    667         this.rescheduleLink = Html.a({style: {margin: '0 15px'}}, Html.span({style: {cursor: 'default', color: '#888'}}, 'Reschedule')); 
    668  
    669         var underConstr = function(event) { 
    670             IndicoUI.Widgets.Generic.tooltip(this, event,"This option will be available soon"); 
    671         }; 
    672         this.rescheduleLink.dom.onmouseover = underConstr; 
     665 
     666        this.rescheduleLink = Html.span({className: 'fakeLink', style:{paddingLeft: pixels(15), paddingRight: pixels(15)}}, 'Reschedule'); 
     667        this.rescheduleLink.observeClick(function(){ 
     668            var popup = new RescheduleDialog(self); 
     669            popup.open(); 
     670        }); 
    673671 
    674672        // JUST FOR SessionManagementTimetable 
Note: See TracChangeset for help on using the changeset viewer.