def expand_pinterest( accum_ids, asset_def, embeds_dct, images_dct = None, override_link=None, override_image=None ): asset_name = asset_def["asset_name"] # get id... htmlid = common.get_id(asset_name,accum_ids) accum_ids.append( htmlid ) # get parms... x = get_attr( 'x', asset_name, asset_def, embeds_dct ) y = get_attr( 'y', asset_name, asset_def, embeds_dct ) z = get_attr( 'z', asset_name, asset_def, embeds_dct,'0') if override_link: link = override_link else: link = get_attr( 'link', asset_name, asset_def, embeds_dct,'http://www.pinterest.com') link = common.site_replace(link) if override_image: image = override_image else: image = get_attr( 'image', asset_name, asset_def, embeds_dct, 'http://thestudio.codetodesign.com/content_7_6_2012/main_logo4.png' ) image = common.site_replace( image ) # possibly use img path... br1 = image.find("[") br2 = image.find("]") if (br1>=0) and (br2>=0): imgref = image[br1:(br2+1)] imgref = imgref[1:-1] print images_dct pathimg = get_img_path( imgref, images_dct ) image = image[0:br1] + pathimg + image[br2+1:] print "ref->",imgref, pathimg, image else: image = common.path_replace( image) f = open("embeds/pinterest.txt",'r') tmpl = f.read() f.close() txt = tmpl.replace("HTMLID",htmlid) link = urllib2.quote(link) link = link.replace( "/", "%2F" ) txt = txt.replace("LINK",link) image = urllib2.quote(image) image = image.replace( "/", "%2F" ) txt = txt.replace("IMAGE", image) style = "#%s { position:absolute;top:%dpx;left:%dpx;z-index:%d;} " % (asset_name, int(y), int(x), int(z) ) content = txt scriptlet_dct = { "on":"", "off":"", "init":"" } return [ style, content, "", scriptlet_dct ]
def expand_twitter( accum_ids, asset_def, embeds_dct, override_link ): asset_name = asset_def["asset_name"] # get id... htmlid = common.get_id(asset_name,accum_ids) accum_ids.append( htmlid ) # get parms... x = get_attr( 'x', asset_name, asset_def, embeds_dct ) y = get_attr( 'y', asset_name, asset_def, embeds_dct ) z = get_attr( 'z', asset_name, asset_def, embeds_dct,'0') if override_link: link = override_link else: link = get_attr( 'link', asset_name, asset_def, embeds_dct,'http://www.twitter.com') link = common.site_replace(link) # get template and replace vars... f = open("embeds/twitter.txt",'r') tmpl = f.read() f.close() txt = tmpl.replace("HTMLID",htmlid) txt = txt.replace("LINK",link ) # produce html parts... style = "#%s { position:absolute;top:%dpx;left:%dpx;z-index:%d;} " % (asset_name, int(y), int(x), int(z) ) content = txt scriptlet_dct = { "on":"", "off":"", "init":"" } return [ style, content, "", scriptlet_dct ]