Esempio n. 1
0
def expand_option( accum_ids, menu_name, menu_def, option_name, images_dct, action_scripts, init_hidden, \
	slide_shows_dct, movies_dct, mp_dct, is_dct, click_panels_dct, cpo_dct, embeds_dct ):

	option_def = menu_def[option_name]

	tot_style = ""
	tot_content = ""
	top_scripts = ""
	off_scriptlet = ""
	on_scriptlet= ""
	init_scriptlet = ""

	for item in option_def:
		asset_name = item["asset_name"]

		if asset_name.startswith("img"):
			# determine the script, if any...
			script = None
			ahref = None
			exturl = None
			if item.has_key("link") and item["link"]!="":
        			link = item["link"]
                		if link.startswith("option:"):
                			ltype,parm = link.split(":")
					funcname = "func_%s_%s" % (menu_name, parm)
                        		test = action_scripts[funcname]
					script = "%s ();" % funcname
				elif link.startswith("url:"):
					idx = link.find(":") + 1
					ahref = link[idx:]
                                elif link.startswith("nurl:"):
                                        idx = link.find(":") + 1
                                        ahref = link[idx:]
                                        exturl = True
				elif link.startswith("mss"):
					idx = link.find(":") + 1
					page_name = gen_multipage_slideshow.get_link( item, is_dct,"first")
					#print "PAGEN->", page_name
					ahref = page_name
				else:
					print "ERROR: gen_menus: Unknown link type", asset_name, item
					sys.exit(1)	

			# determine initial css visibility, if any...
			init_vis = None
			if item.has_key("init") and item["init"]!="":
				init_vis = item["init"] 
			style, content, script, scriptlet_dct = gen_images.expand_item( accum_ids, item, images_dct, script, init_vis, ahref, exturl )

			tot_style += style
			tot_content += content
			top_scripts += script

			# accumulate on/off scriptlet...
			off_scriptlet += scriptlet_dct['off']	
			on_scriptlet += scriptlet_dct['on']	
			init_scriptlet += scriptlet_dct['init']

		elif asset_name.startswith("ss"):
			print "MENU - CALLING GEN SLIDE SHOWS EXPAND", asset_name, "cp->", click_panels_dct.keys()

			style, content, top_script, scriptlet_dct = gen_slide_shows.expand_item( accum_ids, item, images_dct, movies_dct, \
				mp_dct, click_panels_dct, slide_shows_dct, cpo_dct, embeds_dct )

			tot_style += style
			tot_content += content
			top_scripts += top_script

			# accumulate on/off scriptlet...
                        off_scriptlet += scriptlet_dct['off']
                        on_scriptlet += scriptlet_dct['on']
			init_scriptlet += scriptlet_dct['init']
			print "ss init->", init_scriptlet

                elif asset_name.startswith("mov"):
                        style, content, scr_dct = gen_movies.expand_item( accum_ids, item, images_dct, movies_dct )
                        tot_style += style
                        tot_content += content
               
			off_scriptlet += scr_dct['off']
                        on_scriptlet += scr_dct['on']
			init_scriptlet += scr_dct['init']


		elif asset_name.startswith("mp"):
			style, content, scr_dct = gen_movie_panels.expand_item( accum_ids, item, images_dct, movies_dct, mp_dct, embeds_dct )
			tot_style += style
			tot_content += content

			off_scriptlet += scr_dct['off']
			on_scriptlet += scr_dct['on']
			init_scriptlet += scr_dct['init']

		elif asset_name.startswith("embed"):
			style, content, foo, scr_dct = gen_embeds.expand_item( accum_ids, item, embeds_dct, images_dct, None, None )
			tot_style += style
			tot_content += content

			off_scriptlet += scr_dct['off']
			on_scriptlet += scr_dct['on']
			init_scriptlet += scr_dct['init']
		

		else:
			print "ERROR: gen_menus: Can't process asset->", asset_name, item
			sys.exit(1)



	scriptlet_dct = {}
	scriptlet_dct['on'] = on_scriptlet
	scriptlet_dct['off'] = off_scriptlet
	scriptlet_dct['init'] = init_scriptlet

	return [ tot_style, tot_content, top_scripts, scriptlet_dct ]
Esempio n. 2
0
def gen_page( accum_ids, page_name, page_def, movies_dct, images_dct, menus_dct, movie_panels_dct, click_panels_dct, slide_shows_dct, embeds_dct, cpo_dct ):
	
	print "MAIN - GEN PAGE ITEMS->", page_def, [ a["asset_name"] for a in page_def ]

	accum_body = ""
	accum_style = ""
	accum_top_script = ""
	accum_load_script = ""

	# create a master subpage div...
	#accum_body += "<div id=\"dmaster\" style=\"visibility:hidden;\" >"

	for item in page_def:

		scriptlet_dct = {}
		top_script = ""
		style = ""
		content = ""

		asset_name = item["asset_name"]

		if asset_name.startswith("mov"):

			print "MAIN - CALLING GEN MOV", asset_name, item
			style, content, scriptlet_dct = gen_movies.expand_item( accum_ids, item, images_dct, movies_dct )

		elif asset_name.startswith("img"):
			
			print "MAIN - CALLING GEN IMG", asset_name, item

                        # determine the script, if any...
                        script = None
                        ahref = None
			exturl = False
                        if item.has_key("link") and item["link"]!="":
                                link = item["link"]
                                if link.startswith("option:"):
                                        ltype,parm = link.split(":")
                                        funcname = "func_%s_%s" % (menu_name, parm)
                                        test = action_scripts[funcname]
                                        script = "%s ();" % funcname
                                elif link.startswith("url:"):
                                        idx = link.find(":") + 1
                                        ahref = link[idx:]
				elif link.startswith("nurl:"):
					idx = link.find(":") + 1
					ahref = link[idx:]
					exturl = True
                                elif link.startswith("mss"):
                                        idx = link.find(":") + 1
                                        page_name = gen_multipage_slideshow.get_link( item, is_dct,"first")
                                        print "PAGEN->", page_name
                                        ahref = page_name
                                else:
                                        print "ERROR: gen_menus: Unknown link type", asset_name, item
                                        sys.exit(1)

			style, content, top_script, scriptlet_dct = gen_images.expand_item( accum_ids, item, images_dct, script, None, \
				ahref, exturl )
 
		elif asset_name.startswith("embed"):

			print "MAIN - CALLING GEN EMBED", asset_name, item
			style, content, top_script, scriptlet_dct = gen_embeds.expand_item( accum_ids, item, embeds_dct )

		elif asset_name.startswith("menu"):

			print "MAIN - CALLING GEN MENUS EXPAND", asset_name, item
			style, content, top_script, scriptlet_dct  = gen_menus.expand_item( accum_ids, item, images_dct, menus_dct, \
				slide_shows_dct, movies_dct, movie_panels_dct, image_sets_dct, click_panels_dct, cpo_dct )
 
		elif asset_name.startswith("cp"):

			print "MAIN - CALLING GEN CLICK PANEL", asset_name, item, len(click_panels_dct.keys()), len(cpo_dct.keys())
			style, content, top_script, scriptlet_dct  = gen_click_panels.expand_item( accum_ids, item, images_dct, \
				movies_dct, movie_panels_dct, click_panels_dct, cpo_dct )

			print "CP SCRIPTLET INIT->", scriptlet_dct['init']

		elif asset_name.startswith("ss"):

			print "MAIN - CALLING GEN SS", asset_name, item
			style, content, top_script, scriptlet_dct = \
				gen_slide_shows.expand_item( accum_ids, item, images_dct, movies_dct, movie_panels_dct, \
				click_panels_dct, slide_shows_dct, cpo_dct )

			print "SS SCRIPTLET INIT->",scriptlet_dct['init']
		else:

			print "ERROR: gen_page: Unknown asset type->", asset_name
			sys.exit(1)

		accum_style += style
		accum_body += content
		accum_top_script += top_script
		accum_load_script += scriptlet_dct["init"]

        #accum_body += "</div>"

	return accum_style, accum_body, accum_top_script, accum_load_script