Changeset 4763 for waeup/branches/ulif-layout/src
- Timestamp:
- 9 Jan 2010, 13:32:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser.txt
r4762 r4763 555 555 556 556 557 CertificateCourses 558 ================== 559 560 Once we have a certificate, we can add also certificate courses. These 561 are references to courses with some extra data. 562 563 Before we can work with certificate courses, we need some certificates 564 and courses to be available. 565 566 >>> root = getRootFolder() 567 >>> dept = root['myuniversity']['faculties']['TF']['TD'] 568 569 >>> browser.open(dept_url + '/addcourse') 570 >>> ctrl = browser.getControl(name='form.title') 571 >>> ctrl.value = 'Another course with same code' 572 >>> browser.getControl(name='form.code').value = 'COURSE1' 573 >>> browser.getControl(name='form.title').value = 'Course 1' 574 >>> browser.getControl('Add course').click() 575 576 >>> browser.open(dept_url + '/addcourse') 577 >>> ctrl = browser.getControl(name='form.title') 578 >>> ctrl.value = 'Another course with same code' 579 >>> browser.getControl(name='form.code').value = 'COURSE2' 580 >>> browser.getControl(name='form.title').value = 'Course 2' 581 >>> browser.getControl('Add course').click() 582 583 >>> browser.open(dept_url + '/addcertificate') 584 >>> ctrl = browser.getControl(name='form.title') 585 >>> ctrl.value = 'Another cert with same code' 586 >>> browser.getControl(name='form.code').value = 'CERT1' 587 >>> browser.getControl(name='form.title').value = 'Certificate 1' 588 >>> browser.getControl(name='form.category').value = 'UME' 589 >>> browser.getControl(name='form.study_mode').value = 'combined' 590 >>> browser.getControl(name='form.start_level').value = '100' 591 >>> browser.getControl(name='form.end_level').value = '400' 592 >>> browser.getControl(name='form.application_category').value = 'UME' 593 >>> browser.getControl(name='form.m_prefix').value = 'something' 594 >>> browser.getControl(name='form.max_pass').value = '400' 595 >>> browser.getControl('Add certificate').click() 596 597 >>> browser.open(dept_url + '/addcertificate') 598 >>> ctrl = browser.getControl(name='form.title') 599 >>> ctrl.value = 'Another cert with same code' 600 >>> browser.getControl(name='form.code').value = 'CERT2' 601 >>> browser.getControl(name='form.title').value = 'Certificate 2' 602 >>> browser.getControl(name='form.category').value = 'UME' 603 >>> browser.getControl(name='form.study_mode').value = 'combined' 604 >>> browser.getControl(name='form.start_level').value = '100' 605 >>> browser.getControl(name='form.end_level').value = '400' 606 >>> browser.getControl(name='form.application_category').value = 'UME' 607 >>> browser.getControl(name='form.m_prefix').value = 'something' 608 >>> browser.getControl(name='form.max_pass').value = '400' 609 >>> browser.getControl('Add certificate').click() 610 611 612 Adding certificatecourses 613 ------------------------- 614 615 Certcourses are stored in :class:`ICertificate` instances 616 with their code as key. 617 618 Each certificate provides a ``Add course`` action button near top. 619 620 Certificates provide an add-form to add new certcourses: 621 622 >>> cert_url = dept_url + '/certificates/CERT1' 623 >>> browser.open(cert_url + '/addcertificatecourse') 624 >>> print browser.contents 625 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 626 ...<span class="required">*</span><span>Level of this course</span> 627 ... 628 629 In the add-form we will get a list of available courses to select 630 from. This list will contain all courses stored in the site, not only 631 the ones from local department: 632 633 >>> ctrl = browser.getControl(name='form.course') 634 >>> ctrl.displayOptions 635 ['COURSE1 Course 1', 'COURSE2 Course 2'] 636 637 If we do not select anything else, the first item will be 638 selected. That's okay for us. Finally, we create the 639 certificatecourse: 640 641 >>> browser.getControl('Add course').click() 642 643 Our certificatecourse will be linked on the parent certificate page: 644 645 >>> browser.open(cert_url) 646 >>> browser.getLink('COURSE1').click() 647 >>> browser.url 648 'http://localhost/my...sity/faculties/TF/TD/certificates/CERT1/COURSE1_100' 649 650 When we started to add a new certificatecourse, we can also cancel the 651 process before submitting. This will bring us back to the certificate 652 page: 653 654 >>> browser.open(cert_url + '/addcertificatecourse') 655 >>> browser.getControl('Cancel').click() 656 >>> browser.url 657 'http://localhost/myuniversity/faculties/TF/TD/certificates/CERT1' 658 659 660 Modifying certificatecourses 661 ---------------------------- 662 663 We can change the settings for a certcourse by clicking on the 664 provided 'Edit settings' link: 665 666 >>> browser.open(cert_url + '/COURSE1_100') 667 >>> browser.getLink('Edit settings').click() 668 669 Let's set a new level (it was 100 before) and save the form. This will 670 bring us to the certificate index page afterwards: 671 672 >>> browser.getControl(name='form.level').value = "200" 673 >>> ctrl = browser.getControl("Save and return") 674 >>> ctrl.click() 675 676 As we changed the level, also the URL will change: 677 678 >>> browser.getLink('COURSE1').click() 679 >>> browser.url 680 'http://localhost/myun.../TF/TD/certificates/CERT1/COURSE1_200' 681 682 If we go to the settings page and click ``Cancel`` nothing will be 683 changed: 684 685 >>> browser.getLink('Edit settings').click() 686 >>> browser.getControl(name='form.level').value = "666" 687 >>> browser.getControl('Cancel').click() 688 689 Our certcourse provides a new level of 200 and not 666: 690 691 >>> browser.open(cert_url + '/COURSE1_200') 692 >>> print browser.contents 693 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 694 ...Level of this course 695 ...200... 696 ... 697 698 699 Deleting certificatecourses 700 --------------------------- 701 702 We can delete certcourses by browsing the containing certificate and 703 clicking on the appropriate 'Delete' button. As we have only one 704 certcourse, there is only one 'Delete' button yet: 705 706 >>> browser.open(cert_url) 707 >>> 'COURSE1_200' in browser.contents 708 True 709 710 >>> browser.getControl('delete').click() 711 712 >>> browser.open(cert_url) 713 >>> 'COURSE1_200' in browser.contents 714 False 715 716 557 717 Data Center 558 718 ===========
Note: See TracChangeset for help on using the changeset viewer.