def main():
	ryw.check_logging(os.path.join(RepositoryRoot, 'WWW', 'logs'),
                      'upload.log')
	 
	logging.debug("delete outgoing image entered")
	ryw.print_header()
	form = cgi.FieldStorage()
	if delAllReq(form):
		deleteAll()
	else:
		deleteRequested(form)
	logging.debug("delete image done")
def main():
    ryw.check_logging(os.path.join(RepositoryRoot, 'WWW', 'logs'),
                      'upload.log')
    logging.debug('EmptyQueue: entered...')

    ryw.print_header()

    success,rfpath = ryw.get_queue_args()
    if not success:
        sys.exit(1)

    ryw.empty_download_queue(rfpath)
    sys.exit(0)
def init(enteredMsg, headerMsg):
    ryw.check_logging(os.path.join(RepositoryRoot, 'WWW', 'logs'),
                      'upload.log')
    logging.debug(enteredMsg)
    ryw.print_header()
    print headerMsg

    success,objID,version = ryw.get_obj_str()
    if not success:
        return (False, None, None)

    logging.debug('CreateNewThumbDir.init: objstr: ' + objID + '#' +
                  str(version))
    print ryw_view.begin_print_str()
    return (True, objID, version)
def main():
    ryw.check_logging(os.path.join(RepositoryRoot, 'WWW', 'logs'),
                      'upload.log')
    logging.debug('DeleteObject: entered...')

    ryw.print_header()

    success,objID,version = ryw.get_obj_str()
    if not success:
        sys.exit(1)

    success,searchFile = do_delete(objID, version)
    if success:
	sys.stdout.write("True")
        #ryw.give_good_news('Delete object: apparent success', logging.info)

    if searchFile:
        searchFile.done()

    sys.exit(0)
示例#5
0
def main():
	ryw.print_header()

	pdrive = get_pdrive()
	if not pdrive:
		if not local():
			ryw.give_news("Request is not local",logging.debug)
			sys.stdout.write("False")
			sys.exit(0)
	
	success, url = get_url()
	if not success:
		sys.stdout.write("False")
		sys.exit(1)
		
	path = url2path(url, pdrive)
	
	if launchExplorer(path):
		sys.stdout.write("True")
	else:
		sys.stdout.write("False")

	sys.exit(0)
示例#6
0
import os,ryw,limit_size_strs


ryw.print_header()
print limit_size_strs.give_str("/cgi-bin/FlushQueue.py")

示例#7
0
def show_meta_edit_page(meta, editScriptName, objstr,
                        titleStr="Edit Existing Content Information"):
    """called by both ShowObject.py and CloneVersion_form.py"""

    #######################################################################
    # the following is just the html page for editing meta data.
    #######################################################################
    
    page = """
<HTML>
<HEAD>
<TITLE>%(titleStr)s</TITLE>
</HEAD>

<BODY>

%(begin_java_script)s

<CENTER>
<A HREF="/index.html">
<IMG SRC="%(smallLogoFileName)s" BORDER=0 %(smallLogoDimension)s></A>
<BR>

<H3>%(titleStr)s</H3>

If you're unsure about any fields on this page, leave them unchanged.
<P>

<TABLE BORDER=0 WIDTH=800><TR><TD>

<FORM ACTION="%(script_name)s" METHOD="post"
ENCTYPE="multipart/form-data">

<CENTER>
<INPUT TYPE="submit" VALUE="Update">
</CENTER>
<P>
<BR>

<B><I>required fields:</I></B>
<P>

<TABLE BORDER=0>
<TR><TD WIDTH=1></TD>
<TD>

<UL>
<LI>
<U>title</U>:
<INPUT TYPE="TEXT" NAME="title" SIZE=80 VALUE="%(title)s">
<P>

%(trans_title)s:
<INPUT TYPE="TEXT" NAME="hindi_title" SIZE=80 VALUE="%(hindi_title)s"
%(trans_txt_style)s>
<P>


</UL>

</TD>
</TR>
</TABLE>

<BR>


<B><I>optional fields:</I></B>
<P>


<TABLE BORDER=0>
<TR><TD WIDTH=1></TD>
<TD>

<UL>

<LI>
<U>description:</U><BR>
<TEXTAREA NAME="description" ROWS=5 COLS=70>%(description)s</TEXTAREA>
<P>

%(trans_description)s:<BR>
<TEXTAREA NAME="hindi_description" ROWS=5 COLS=70 %(trans_txt_style)s>%(hindi_description)s</TEXTAREA>
<P>


<LI>
<U>file directories</U>:&nbsp;&nbsp;
%(file_directories)s
<P>

<LI>
<U>media attributes</U>:&nbsp;&nbsp;
re-extract
<INPUT type=checkbox name=med_reext CHECKED>
<P>


<LI>
<U>students concerned</U>:
<INPUT TYPE="TEXT" NAME="students" SIZE=80 VALUE="%(students)s">
<P>

%(trans_students_concerned)s:
<INPUT TYPE="TEXT" NAME="hindi_students" SIZE=80 VALUE="%(hindi_students)s"
%(trans_txt_style)s>
<P>





<LI>
<U>subjects</U> (check all that apply) [%(trans_subjects)s]:

English [%(trans_english)s]
<INPUT type=checkbox name=subjects value=English %(subject_English_value)s>,

Hindi [%(trans_hindi)s]
<INPUT type=checkbox name=subjects value=Hindi %(subject_Hindi_value)s>,

Sanskrit [%(trans_sanskrit)s]
<INPUT type=checkbox name=subjects value=Sanskrit %(subject_Sanskrit_value)s>,

science [%(trans_science)s]
<INPUT type=checkbox name=subjects value=science %(subject_science_value)s>

(
physics [%(trans_physics)s]
<INPUT type=checkbox name=subjects value=physics %(subject_physics_value)s>,

chemistry [%(trans_chemistry)s]
<INPUT type=checkbox name=subjects value=chemistry
%(subject_chemistry_value)s>,

astronomy [%(trans_astronomy)s]
<INPUT type=checkbox name=subjects value=astronomy
%(subject_astronomy_value)s>,

biology [%(trans_biology)s]
<INPUT type=checkbox name=subjects value=biology
%(subject_biology_value)s>
),

geology [%(trans_geology)s]
<INPUT type=checkbox name=subjects value=geology
%(subject_geology_value)s>
),

mathematics [%(trans_mathematics)s]
<INPUT type=checkbox name=subjects value=mathematics
%(subject_mathematics_value)s>

(
arithmetic [%(trans_arithmetic)s]
<INPUT type=checkbox name=subjects value=arithmetic
%(subject_arithmetic_value)s>,

algebra [%(trans_algebra)s]
<INPUT type=checkbox name=subjects value=algebra
%(subject_algebra_value)s>,

geometry [%(trans_geometry)s]
<INPUT type=checkbox name=subjects value=geometry
%(subject_geometry_value)s>
),

history [%(trans_history)s]
<INPUT type=checkbox name=subjects value=history
%(subject_history_value)s>,

social studies [%(trans_social_studies)s]
<INPUT type=checkbox name=subjects value="social_studies"
%(subject_social_studies_value)s>,

home science [%(trans_home_science)s]
<INPUT type=checkbox name=subjects value="home_science"
%(subject_home_science_value)s>,

agriculture [%(trans_agriculture)s]
<INPUT type=checkbox name=subjects value=agriculture
%(subject_agriculture_value)s>,

commerce [%(trans_commerce)s]
<INPUT type=checkbox name=subjects value=commerce
%(subject_commerce_value)s>,

culture and customs [%(trans_culture_and_customs)s]
<INPUT type=checkbox name=subjects value="culture_and_customs"
%(subject_culture_and_customs_value)s>,

general knowledge [%(trans_general_knowledge)s]
<INPUT type=checkbox name=subjects value="general_knowledge"
%(subject_general_knowledge_value)s>,

food and nutrition [%(trans_food_and_nutrition)s]
<INPUT type=checkbox name=subjects value="food_and_nutrition"
%(subject_food_and_nutrition_value)s>,

arts and crafts [%(trans_arts_and_crafts)s]
<INPUT type=checkbox name=subjects value="arts_and_crafts"
%(subject_arts_and_crafts_value)s>,

computer literacy [%(trans_computer_literacy)s]
<INPUT type=checkbox name=subjects value="computer_literacy"
%(subject_computer_literacy_value)s>,

games [%(trans_games)s]
<INPUT type=checkbox name=subjects value="games"
%(subject_games_value)s>,

stories [%(trans_stories)s]
<INPUT type=checkbox name=subjects value="stories"
%(subject_stories_value)s>,

plays [%(trans_plays)s]
<INPUT type=checkbox name=subjects value="plays"
%(subject_plays_value)s>,

with vocabulary [%(trans_with_vocabulary)s]
<INPUT type=checkbox name=subjects value="with_vocabulary"
%(subject_with_vocabulary_value)s>,

environmental science [%(trans_environmental_science)s]
<INPUT type=checkbox name=subjects value="environmental_science"
%(subject_environmental_science_value)s>,

health care [%(trans_health_care)s]
<INPUT type=checkbox name=subjects value="health_care"
%(subject_health_care_value)s>

(nursing [%(trans_nursing)s]
<INPUT type=checkbox name=subjects value="nursing"
%(subject_nursing_value)s>,

reproductive health [%(trans_reproductive_health)s]
<INPUT type=checkbox name=subjects value="reproductive_health"
%(subject_reproductive_health_value)s>,

children health [%(trans_children_health)s]
<INPUT type=checkbox name=subjects value="children_health"
%(subject_children_health_value)s>),

women rights [%(trans_women_rights)s]
<INPUT type=checkbox name=subjects value="women_rights"
%(subject_women_rights_value)s>,

Kannada [%(trans_kannada)s]
<INPUT type=checkbox name=subjects value="Kannada"
%(subject_Kannada_value)s>,

Tamil [%(trans_tamil)s]
<INPUT type=checkbox name=subjects value="Tamil"
%(subject_Tamil_value)s>,

Bengali [%(trans_bengali)s]
<INPUT type=checkbox name=subjects value="Bengali"
%(subject_Bengali_value)s>,

Marathi [%(trans_marathi)s]
<INPUT type=checkbox name=subjects value="Marathi"
%(subject_Marathi_value)s>,

Punjabi [%(trans_punjabi)s]
<INPUT type=checkbox name=subjects value="Punjabi"
%(subject_Punjabi_value)s>,

Urdu [%(trans_urdu)s]
<INPUT type=checkbox name=subjects value="Urdu"
%(subject_Urdu_value)s>,

Nepali [%(trans_nepali)s]
<INPUT type=checkbox name=subjects value="Nepali"
%(subject_Nepali_value)s>,

children program [%(trans_children_program)s]
<INPUT type=checkbox name=subjects value="children_program"
%(subject_children_program_value)s>,

other subject (specify):
<INPUT TYPE="TEXT" NAME="subject_other" SIZE=20
VALUE="%(subject_other_value)s">

&nbsp;&nbsp;

%(trans_other_subject)s:
<INPUT TYPE="TEXT" NAME="subject_other_hindi" SIZE=20 %(trans_txt_style)s
VALUE="%(hindi_subject_other_value)s">
<P>




<LI>
<U>content type</U>:
<SELECT NAME="content_type">
%(content_type_options)s
</SELECT>

&nbsp;&nbsp;&nbsp;

%(trans_content_type)s:
<SELECT NAME="hindi_content_type" %(trans_txt_style)s>
%(hindi_content_type_options)s
</SELECT>
<P>





<LI>
<U>language</U> (check all that apply) [%(trans_language)s]:
English [%(trans_english)s]
<INPUT type=checkbox name=languages value=English
%(language_English_value)s>,

Hindi [%(trans_hindi)s]
<INPUT type=checkbox name=languages value=Hindi
%(language_Hindi_value)s>,

Kannada [%(trans_kannada)s]
<INPUT type=checkbox name=languages value=Kannada
%(language_Kannada_value)s>,

Tamil [%(trans_tamil)s]
<INPUT type=checkbox name=languages value=Tamil
%(language_Tamil_value)s>,

Bengali [%(trans_bengali)s]
<INPUT type=checkbox name=languages value=Bengali
%(language_Bengali_value)s>,

Marathi [%(trans_marathi)s]
<INPUT type=checkbox name=languages value=Marathi
%(language_Marathi_value)s>,

Punjabi [%(trans_punjabi)s]
<INPUT type=checkbox name=languages value=Punjabi
%(language_Punjabi_value)s>,

Nepali [%(trans_nepali)s]
<INPUT type=checkbox name=languages value=Nepali
%(language_Nepali_value)s>,

Telegu [%(trans_telegu)s]
<INPUT type=checkbox name=languages value=Telegu
%(language_Telegu_value)s>,

Gujarati [%(trans_gujarati)s]
<INPUT type=checkbox name=languages value=Gujarati
%(language_Gujarati_value)s>,

Kashmiri [%(trans_kashmiri)s]
<INPUT type=checkbox name=languages value=Kashmiri
%(language_Kashmiri_value)s>,

other language (specify):
<INPUT TYPE="TEXT" NAME="language_other" SIZE="20"
VALUE="%(language_other_value)s">

&nbsp;&nbsp;

%(trans_other_language)s:
<INPUT TYPE="TEXT" NAME="language_other_hindi" SIZE="20" %(trans_txt_style)s
VALUE="%(hindi_language_other_value)s">
<P>




<LI>
<U>for class</U>:
<SELECT NAME="class">
%(class_options)s
</SELECT>

&nbsp;&nbsp;

%(trans_for_class)s:
<SELECT NAME="hindi_class" %(trans_txt_style)s>
%(hindi_class_options)s
</SELECT>
<P>






<LI>
<U>applicable age</U>: 
from
<SELECT NAME="age_from">
%(age_from_options)s
</SELECT>
to
<SELECT NAME="age_to">
%(age_to_options)s
</SELECT>
<P>

%(trans_applicable_age)s: 
%(trans_from)s
<SELECT NAME="hindi_age_from" %(trans_txt_style)s>
%(hindi_age_from_options)s
</SELECT>
%(trans_to)s
<SELECT NAME="hindi_age_to" %(trans_txt_style)s>
%(hindi_age_to_options)s
</SELECT>
<P>






<LI>
<U>media type</U> (check all that apply) [%(trans_media_type)s]:
video [%(trans_video)s] <INPUT type=checkbox name=media value=video
%(media_video_value)s>,

(DVD <INPUT type=checkbox name=media value=DVD %(media_DVD_value)s>,

VCD <INPUT type=checkbox name=media value=VCD %(media_VCD_value)s>,

extracted by firewire [%(trans_extracted_by_firewire)s]
<INPUT type=checkbox name=media value="extracted_by_firewire"
%(media_extracted_by_firewire_value)s>,

recorded by Plextor [%(trans_recorded_by_Plextor)s]
<INPUT type=checkbox name=media value="recorded_by_Plextor"
%(media_recorded_by_Plextor_value)s>,

recorded from TV [%(trans_recorded_from_TV)s]
<INPUT type=checkbox name=media value="recorded_from_TV"
%(media_recorded_from_TV_value)s>,

from YouTube [%(trans_from_YouTube)s]
<INPUT type=checkbox name=media value="from_YouTube"
%(media_from_YouTube_value)s>,

VHS tape digitized [%(trans_VHS_tape_digitized)s]
<INPUT type=checkbox name=media value="VHS_tape_digitized"
%(media_VHS_tape_digitized_value)s>,

recorded by webcam [%(trans_recorded_by_webcam)s]
<INPUT type=checkbox name=media value="recorded_by_webcam"
%(media_recorded_by_webcam_value)s>,

recorded by Mustek [%(trans_recorded_by_Mustek)s]
<INPUT type=checkbox name=media value="recorded_by_Mustek"
%(media_recorded_by_Mustek_value)s>,

recorded by Aiptek [%(trans_recorded_by_Aiptek)s]
<INPUT type=checkbox name=media value="recorded_by_Aiptek"
%(media_recorded_by_Aiptek_value)s>,

recorded by CamStudio [%(trans_recorded_by_CamStudio)s]
<INPUT type=checkbox name=media value="recorded_by_CamStudio"
%(media_recorded_by_CamStudio_value)s>,

created by ProShow [%(trans_created_by_ProShow)s]
<INPUT type=checkbox name=media value="created_by_ProShow"
%(media_created_by_ProShow_value)s>,

has subtitle [%(trans_has_subtitle)s]
<INPUT type=checkbox name=media value="has_subtitle"
%(media_has_subtitle_value)s>,

SMIL <INPUT type=checkbox name=media value=SMIL %(media_SMIL_value)s)>,

audio without video [%(trans_audio_without_video)s]
<INPUT type=checkbox name=media value="audio_without_video"
%(media_audio_without_video_value)s>,

Flash <INPUT type=checkbox name=media value=Flash %(media_Flash_value)s>,

images <INPUT type=checkbox name=media value=images %(media_images_value)s>,

powerpoint <INPUT type=checkbox name=media value=powerpoint
%(media_powerpoint_value)s>

documents [%(trans_documents)s]
<INPUT type=checkbox name=media value=documents %(media_documents_value)s>,

executables [%(trans_executables)s]
<INPUT type=checkbox name=media value=executables %(media_executables_value)s>,

slideshows [%(trans_slideshows)s]
<INPUT type=checkbox name=media value=slideshows %(media_slideshows_value)s>,

other type (specify):
<INPUT TYPE="TEXT" NAME="media_other" SIZE="20"
VALUE="%(media_other_value)s">
&nbsp;&nbsp;
%(trans_other_type)s:
<INPUT TYPE="TEXT" NAME="media_other_hindi" SIZE=20 %(trans_txt_style)s
VALUE="%(hindi_media_other_value)s">
<P>







<LI>
<U>video resolution</U> (width in pixels)
[%(trans_video_resolution)s]:
<SELECT NAME="video_resolution">
%(video_resolution_options)s
</SELECT>
<P>






<LI>
<U>content duration</U> [%(trans_content_duration)s]:

hours [%(trans_hours)s]
<SELECT NAME="time_length_hours">
%(time_length_hours_options)s
</SELECT>

minutes [%(trans_minutes)s]
<SELECT NAME="time_length_minutes">
%(time_length_minutes_options)s
</SELECT>

seconds [%(trans_seconds)s]
<SELECT NAME="time_length_seconds">
%(time_length_seconds_options)s
</SELECT>
<P>



<LI>
<U>data size</U> [%(trans_data_size)s]:
<INPUT TYPE="TEXT" NAME="size_text" SIZE="6" VALUE="%(size_text)s">
<SELECT NAME="size_unit">
%(data_size_options)s
</SELECT>
<P>





<LI>
<U>content alias</U> (9-character code) [%(trans_content_alias)s]:
<INPUT TYPE="TEXT" NAME="content_alias" SIZE="20" VALUE="%(content_alias)s">
<P>

<LI>
<U>chapter number</U> [%(trans_chapter_number)s]:
<INPUT TYPE="TEXT" NAME="chapter_number" SIZE="10" VALUE="%(chapter_number)s">
<P>

<LI>
<U>related content</U> [%(trans_related_content)s]:
<INPUT TYPE="TEXT" NAME="related_content" SIZE="40" VALUE="%(related_content)s">
<P>

<LI>
<U>show</U> [%(trans_show)s]:
copyrighted [%(trans_copyrighted)s]
<INPUT type=checkbox name=show value=copyrighted
%(show_copyrighted_value)s>,

discreet [%(trans_discreet)s]
<INPUT type=checkbox name=show value=discreet
%(show_discreet_value)s>
<P>

<LI>
<U>cache</U> [%(trans_cache)s]:
sticky [%(trans_sticky)s]
<INPUT type=checkbox name=cache value=sticky
%(cache_sticky_value)s>
<P>

<LI>
<U>teacher/author</U> (person name):<INPUT TYPE="TEXT" NAME="author_name" SIZE="40" VALUE="%(author_name)s">
<P>

%(trans_teacher)s
<FONT SIZE=4><B>/</B></FONT>
%(trans_author)s:
<INPUT TYPE="TEXT" NAME="hindi_author_name" SIZE="40"
VALUE="%(hindi_author_name)s"
%(trans_txt_style)s>
<P>

<LI>
<U>uploaded by</U> (person name):<INPUT TYPE="TEXT" NAME="uploaded_by_name" SIZE="40" VALUE="%(uploaded_by_name)s">
<P>

<!-- Hindi field temporarily commented out
%(trans_uploaded_by)s:
<INPUT TYPE="TEXT" NAME="hindi_uploaded_by_name" SIZE="40"
VALUE="%(hindi_uploaded_by_name)s" %(trans_txt_style)s>
<P>
-->

<LI>
<U>uploaded by</U> (site name):<INPUT TYPE="TEXT" NAME="uploaded_by_site" SIZE="40" VALUE="%(uploaded_by_site)s">
<P>


<!-- Hindi field temporarily commented out
%(trans_uploaded_by_site)s:
<INPUT TYPE="TEXT" NAME="hindi_uploaded_by_site" SIZE="40"
VALUE="%(hindi_uploaded_by_site)s" %(trans_txt_style)s>
<P>
-->



<LI>
<U>date and time</U> %(trans_date_and_time)s:
<INPUT TYPE="TEXT" NAME="uploaded_date_time" SIZE="14"
VALUE="%(uploaded_date_time_val)s">
<P>





</UL>

</TD>
</TR>
</TABLE>

<INPUT TYPE="hidden" NAME="objstr" VALUE="%(objstr)s">


<CENTER>
<INPUT TYPE="submit" VALUE="Update">
</CENTER>

</FORM>

</TD></TR></TABLE>

</CENTER>

<BR>

<HR WIDTH=75%%>

%(uploadFooter)s

<HR WIDTH=75%%>

</BODY>
</HTML>
"""

    #######################################################################
    # end of html page for editing meta data.
    #######################################################################

    ryw.print_header()
    dict = ryw_customize.dict
    dict['titleStr'] = titleStr
    dict['begin_java_script'] = ryw_view.begin_print_str()
    dict['script_name'] = editScriptName
    dict['objstr'] = objstr
    dict['year'] = ryw.get_year()

    if meta.has_key('creator') and meta['creator']:
        meta['uploaded_by_site'] = meta['creator']


    #
    # deal with data size.
    #
    make_data_size(meta, dict)

    #
    # deal with English fields.
    #
    for key in editableKeys:
        if meta.has_key(key):
            dict[key] = scrub_string_value(meta[key])
        else:
            dict[key] = ''

    #
    # deal with Hindi field labels. 
    # (may deal with different set of things to iterate over in the future.)
    #
    for key in transWords:
        dict['trans_' + key] = ryw_hindi.size4_html(key)
    dict['trans_txt_style'] = ryw_hindi.HINDI_TEXT_ATTR
        
    #
    # deal with Hindi field values.
    # (may deal with different set of things to iterate over in the future.)
    #
    for key in editableKeys:
        formStr = 'hindi_' + key
        dict[formStr] = ''
        if not meta.has_key('hindi'):
            continue
        hindi = meta['hindi']
        if hindi.has_key(key):
            dict[formStr] = scrub_string_value(hindi[key])

    #
    # deal with subjects
    #
    make_form_checkboxes(meta,
                         ['subjects', 'english', 'hindi',
                          'sanskrit', 'science', 'physics', 'chemistry',
                          'astronomy', 'biology', 'geology',
                          'mathematics', 'arithmetic',
                          'algebra', 'geometry', 'history', 'social_studies',
                          'home_science', 'agriculture', 'commerce',
                          'culture_and_customs',
                          'general_knowledge',
                          'food_and_nutrition', 'arts_and_crafts',
                          'computer_literacy',
                          'games', 'stories', 'plays', 'with_vocabulary',
                          'environmental_science',
                          'health_care',
                          'nursing', 
                          'reproductive_health',
                          'children_health',
                          'women_rights',
                          'children_program',
                          'kannada', 'tamil',
                          'bengali', 'marathi', 'punjabi', 'urdu', 'nepali',
                          'other_subject'],
                         'subjects',
                         ryw_upload.POSSIBLE_SUBJECTS, 'subject', dict)

    #
    # deal with content type
    #
    make_form_dropdown(meta, ['content_type'], 'content_type', 
                       ryw_upload.POSSIBLE_CONTENT_TYPES, dict)

    #
    # deal with language checkboxes
    #
    make_form_checkboxes(meta,
                         ['language', 'english', 'hindi', 'kannada',
                          'tamil', 'bengali', 'marathi', 'punjabi', 'urdu',
                          'nepali',
                          'telegu', 'gujarati', 'kashmiri', 
                          'other_language'],
                         'languages',
                         ryw_upload.POSSIBLE_LANGUAGES, 'language', dict)

    #
    # deal with show or no show checkboxes
    #
    make_form_checkboxes(meta,
                         ['show', 'copyrighted', 'discreet'], 'show',
                         ryw_upload.POSSIBLE_SHOW, 'show', dict)

    #
    # deal with cache sticky checkbox
    #
    make_form_checkboxes(meta,
                         ['cache', 'sticky'], 'cache',
                         ryw_upload.POSSIBLE_CACHE, 'cache', dict)

    #
    # deal with class
    #
    make_form_dropdown(meta, ['for_class'], 'class',
                       ryw_upload.POSSIBLE_CLASSES, dict)

    #
    # deal with applicable age
    #
    make_bracket_dropdowns(meta, ['applicable_age', 'from', 'to'], 'age',
                           'age_from', 'age_to',
                           ryw_upload.POSSIBLE_AGES, ryw_upload.POSSIBLE_AGES,
                           dict)

    #
    # deal with media type
    #
    make_form_checkboxes(meta,
                         ['media_type', 'video', 'other_type',
                          'extracted_by_firewire',
                          'recorded_by_Plextor',
                          'recorded_from_TV',
                          'from_YouTube',
                          'VHS_tape_digitized',
                          'recorded_by_webcam',
                          'recorded_by_Mustek', 'recorded_by_CamStudio',
                          'recorded_by_Aiptek',
                          'created_by_ProShow', 'has_subtitle',
                          'audio_without_video', 'images',
                          'documents', 'executables',
                          'slideshows'],
                         'media',
                         ryw_upload.POSSIBLE_MEDIA, 'media', dict)

    #
    # deal with video resolution
    #
    make_form_dropdown(meta, ['video_resolution'], 'video_resolution',
                       ryw_upload.POSSIBLE_VIDEO_RESOLUTION, dict,
                       noHindi = True)

    #
    # deal with content duration
    #
    make_bracket_dropdowns(meta, ['content_duration', 'hours', 'minutes'],
                           'time_length',
                           'time_length_hours', 'time_length_minutes',
                           ryw_upload.POSSIBLE_HOURS,
                           ryw_upload.POSSIBLE_MINUTES, dict, noHindi=True)

    #
    # deal with new seconds field
    #
    make_form_dropdown(meta, ['seconds'], 'time_length_seconds',
                       ryw_upload.POSSIBLE_SECONDS, dict,
                       noHindi = True)

    #
    # deal with file directories
    #
    dict['file_directories'] = make_dir_strs(meta)

    #
    # deal with upload time
    #
    dict['uploaded_date_time_val'] = make_date_time_val(meta)


    #
    # get rid of empty brackets left behind by untranslated Hindi strings.
    #
    page = page % dict
    page = page.replace('[<FONT FACE=Kundli COLOR=blue SIZE=4></FONT>]','')
       
    print page
示例#8
0
	def generate(self):
            """Main Browse View function."""
            ryw.print_header()
            self.print_initialHTML()
            form = cgi.FieldStorage()
            #	setup_logging()

            viewroot = form.getfirst('viewroot', '')
            if not viewroot:
                ryw.give_bad_news('viewroot not found',logging.error)
                sys.exit(1)

            ryw.db_print2('Browse.generate: viewroot is: ' + viewroot, 61)
                          
            if viewroot[-1] == os.sep:
	       	viewroot = viewroot[:-1]

            relpath = form.getfirst('relpath', os.sep)
            ryw.db_print2('Browse.generate: relpath1: ' + relpath, 61)
            relpath = ryw_bizarro.fix_browse_rel_path(relpath)
            ryw.db_print2('Browse.generate: relpath2: ' + relpath, 61)
            
            if relpath[0] != os.sep:
	       	relpath = os.sep + relpath
            if relpath[-1] != os.sep:
	       	relpath = relpath + os.sep

            ryw.db_print2('Browse.generate: relpath3: ' + relpath, 61)
            path = viewroot + relpath

            self.viewroot = viewroot
            self.relpath = relpath

            # path must be a directory

            if not os.path.exists(path):
	       	ryw.give_news('path no longer exists: ' + path,
	       		      logging.warning)
	       	sys.exit(1)
            ll = os.listdir(path)

            #success,searchFile = ryw.open_search_file(
            #    self.scriptName + ':', self.logDir, self.logFile,
            #    self.searchFile, False)
            #if not success:
            #    sys.exit(1)

            count=0

            title = relpath[1:-1]
            title = title.replace("\\"," &raquo; ")
            #print "<H2>The Digital StudyHall</H2>"
            ryw_view.print_logo()
            if title != "":
	       	print "<H3> content repository: %s </H3>" % (title,)
            else:
                print "<H3> content repository: </H3>"

            print "<TABLE border=0 width=100%><TR>"
            for i in ll:
                if not os.path.isfile(path+i):
                    print '<td width=20%%><A HREF="%s?viewroot=%s&relpath=%s%s"><img src="/icons/folder.gif" border=0><br>%s</A></td>' % (self.scriptName,viewroot,relpath,i,i)
                    count += 1
                    if (count == 5):
                        print "</TR><TR>"
                        count = 0
            while (count < 5):
	       	print "<td width=20%>&nbsp;</td>"
	       	count += 1
            print "</TR></TABLE>"
				      
				
            metalist = []

            for i in ll:
            
	       	if os.path.isfile(path + i):
                    # get its metadata from server and add option
                    # for 'add to downloadqueue'
                    f = open(path + i)
                    line = f.readline()
                    f.close()
                    if line[-1] == '\n':
                        line = line[:-1]
                    objname, version = line.split('#')
                    version = int(version)

                    #success,d = searchFile.get_meta(objname,
                    #				       version)
                    success,d = ryw.get_meta(self.absObjStoreRoot,
                                             objname,
                                             version)
                    if not success:
                        logging.warning(
                            self.scriptName + ': get_meta failed: ' +
                            objname + ' ' + str(version))
                        continue
			  
                    metalist.append(d)


            metalist = ryw.sortmeta(metalist)

            success,searchFile,reverseLists = \
                ReverseLists.open_searchfile_reverselists(
                    'Browse.generate:')
            if not success:
                sys.exit(1)

            displayObject = ryw_view.DisplayObject(
                self.Root, calledByVillageSide = self.calledByVillageSide,
                missingFileFunc = reqDownloadFunc,
                searchFile = searchFile,
                reverseLists = reverseLists)

            displayObject.begin_print()
            for i in metalist:
                #self.generate_row(d)
                displayObject.show_an_object_compact(i)
		      
            displayObject.end_print()
            self.print_footer()
            searchFile.done()
            reverseLists.done()