def MakeTOCWave(admin_wave, conference): SetupRobot() conference_id = conference.key().id() toc_wave = myrobot.new_wave(domain=admin_wave.domain, submit=True, participants=[conference.owner], proxy_for_id=wavedata.MAIN_PROXY(conference)) admin_wave.root_blip.first(element.Gadget).update_element( {'wave_id': toc_wave.wave_id}) AddConferenceTags(toc_wave, conference) AddConferenceParticipants(toc_wave, conference) AddPublic(toc_wave, conference) AddTitle(toc_wave, conference.name + ' ' + text.MAINWAVE_TITLE) blip = toc_wave.root_blip AddHeader(blip, text.MAINWAVE_EXTENSION_HEADER) ModBlip(blip, text.MAINWAVE_EXTENSION_TEXT) installer = element.Installer( manifest=util.GetInstallerUrl(conference.key().id())) ModBlip(blip, installer) AddHeader(blip, text.MAINWAVE_WAVES_HEADER) ModBlip(blip, text.MAINWAVE_WAVES_TEXT) myrobot.submit(toc_wave) conference.toc_wave = toc_wave.wave_id conference.toc_wave_ser = simplejson.dumps(toc_wave.serialize()) conference.put()
def AddToGallery(wavelet): participants = [config.GALLERYGROUP, config.GALLERYMOD] new_wavelet = submitty.new_wave(DOMAIN, participants, proxy_for_id='noudw') blip = EnhancedBlip(wavelet.root_blip) extension_url = blip.get_input_value('installer_url') extension_name = installerchecker.get_name(extension_url) new_wavelet.title = extension_name new_blip = new_wavelet.root_blip new_blip.append('\n') new_blip.append(element.Installer(extension_url)) new_wavelet.submit_with(wavelet)
def AddToGallery(wavelet): group = '*****@*****.**' pamela = '*****@*****.**' public = '*****@*****.**' domain = 'googlewave.com' # Get info blip = wavelet.root_blip installer_url = GetInputValue(blip, 'installer_url') extension_name = GetInputValue(blip, 'name') extension_summary = GetInputValue(blip, 'summary') extension_description = GetTextAreaValue(blip, 'description') extension_screenshot = GetInputValue(blip, 'screenshot') if installer_url: extension_thumbnail = installerchecker.get_thumbnail(installer_url) else: extension_thumbnail = 'http://wave-samples-gallery.appspot.com/static/img/project_gallery_logo.png' # Create installer wave # Create discussion wave participants = [pamela, public] discussion_wave = submitty.new_wave(domain, participants, submit=True) discussion_wave.title = 'Discuss: %s' % extension_name blip = discussion_wave.root_blip blip.append('\n%s\n\n' % extension_description) if installer_url: blip.append(element.Installer(installer_url)) gadget_url = 'http://mashable-submitty.appspot.com/gadget_ratings.xml' blip.append(element.Gadget(gadget_url)) gadget_url = 'http://mashable-submitty.appspot.com/gadget_twitter.xml' props = {'wavetitle': extension_name} blip.append(element.Gadget(gadget_url, props)) submitty.submit(discussion_wave) # Add to TOC wave toc_wave_id = 'googlewave.com!w+DYz-iagTK' toc_wavelet_id = 'googlewave.com!conv+root' toc_wavelet = submitty.fetch_wavelet(toc_wave_id, toc_wavelet_id) blip = toc_wavelet.root_blip line = element.Line(line_type='h2') blip.append(line) blip.append(extension_name) blip.append('\n') image = element.Image(url=extension_thumbnail, width=120, height=120) blip.append(image) blip.append("\n%s\n" % extension_summary) AddLink(blip, discussion_wave.title, discussion_wave.wave_id) blip.append('\n\n') blip.at(len(blip.text) - 2).clear_annotation('style/fontStyle') blip.at(len(blip.text) - 2).clear_annotation('link/wave') blip.at(len(blip.text) - 2).clear_annotation('link/manual') submitty.submit(toc_wavelet)
def MakeMainWave(wavelet, collection): SetupOauth(wavelet) new_wave = myrobot.new_wave(domain=wavelet.domain, submit=True, participants=[collection.owner]) new_wave.title = collection.name + ' Main Wave' blip = new_wave.root_blip blip.append_markup(text.main_html_2) installer = element.Installer( manifest=util.GetInstallerUrl(collection.key().id())) blip.append(installer) blip.append_markup(text.main_html) myrobot.submit(new_wave) collection.toc_wave = new_wave.wave_id collection.toc_wave_ser = simplejson.dumps(new_wave.serialize()) collection.put()
def OnSelfAdded(event, wavelet): """Invoked when any participants have been added/removed from the wavelet.""" logging.info('OnSelfAdded') blip = event.blip wavelet.title = 'A wavelet title' blip.append( element.Image(url='http://www.google.com/logos/clickortreat1.gif', width=320, height=118)) blip.append(element.Line(line_type='li', indent='2')) blip.append('bulleted!') blip.append( element.Installer( 'http://wave-skynet.appspot.com/public/extensions/areyouin/manifest.xml' )) # add a reply to the blip authored by a proxy. Effectively # the address on this will be [email protected]. # Note that as a side effect this will also add this # participant to the wave. wavelet.proxy_for('proxy').reply().append('hi from douwe') inlineBlip = blip.insert_inline_blip(5) inlineBlip.append('hello again!') # Create a new wave. The new wave will have its own operation queue. # new_wave also takes an optional 'message' parameter which can be # set to an arbitrary string. By setting it to the serialized version # of the current wave, we can reconstruct the current wave when the # other wave is constructed and update the current wave. new_wave = sinky.new_wave(wavelet.domain, wavelet.participants, message=wavelet.serialize()) new_wave.participants.set_role(wavelet.creator, wavelet_mod.Participants.ROLE_READ_ONLY) new_wave.root_blip.append('A new day and a new wave') new_wave.root_blip.append_markup( '<p>Some stuff!</p><p>Not the <b>beautiful</b></p>') # since the new wave has its own operation queue, we need to submit # it explicitly through the active gateway, or, as in this case, # submit it together with wavelet, which will handle the submit # automatically. new_wave.submit_with(wavelet)
def lookForInstaller(wavelet): blip = EnhancedBlip(wavelet.root_blip) if INSTALLER_STATUS in wavelet.data_documents: return installer_input, installer_index = blip.get_input('installer_url') if installer_input is None: return installer_url = installer_input.value if len(installer_url) < 20: return errors = installerchecker.check(installer_url) response_blip = blip.insert_inline_blip(installer_index + 1) if len(errors) > 0: wavelet.data_documents[INSTALLER_STATUS] = 'errors' response_blip.append('\n'.join(errors)) else: wavelet.data_documents[INSTALLER_STATUS] = 'success' response_blip.append('Installer looks good!') response_blip.append(element.Installer(installer_url))