/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { $name = RequestContext::name($fieldName); $m = "<input type='text' \n\t\t\t\tname='{$name}' \n\t\t\t\tid='{$fieldName}' \n\t\t\t\tsize='" . $this->_size . "' maxlength='" . $this->_maxlength . "'" . (!$this->isEnabled() ? " readonly='readonly'" : ""); if ($this->_value != null && $this->_value != $this->_startingDisplay) { $m .= " value='" . htmlspecialchars($this->_value, ENT_QUOTES) . "'"; } else { if ($this->_startingDisplay) { $v = htmlspecialchars($this->_startingDisplay, ENT_QUOTES); $m .= "\n\t\t\t\tvalue='{$v}' style='color: #888' "; $m .= "\n\t\t\t\tonfocus='if (this.value == \"{$v}\") { this.value=\"\"; this.style.color=\"#000\";}'"; $m .= "\n\t\t\t\tonblur='if (this.value == \"\") { this.value=\"{$v}\"; this.style.color=\"#888\";}'"; } } if ($this->_style) { $m .= "\n\t\t\t\tstyle=\"" . str_replace("\"", "\\\"", $this->_style) . "\""; } if ($this->_onchange) { $m .= "\n\t\t\t\tonchange=\"" . str_replace("\"", "\\\"", $this->_onchange) . "\""; } $m .= " />"; $errText = $this->getErrorText(); $errRule = $this->getErrorRule(); $errStyle = $this->getErrorStyle(); if ($errText && $errRule) { $m .= "\n\t\t<span id='" . $fieldName . "_error' style=\"padding-left: 10px; {$errStyle}\">« {$errText}</span>"; $m .= Wizard::getValidationJavascript($fieldName, $errRule, $fieldName . "_error", $this->_showError); $this->_showError = false; } return $m; }
function buildContent() { $harmoni = Harmoni::instance(); $centerPane = $this->getActionRows(); $centerPane->add(new Heading(_("Upload a file to view its EXIF/IPTC data"), 2), null, null, LEFT, TOP); ob_start(); print "\n<form action='" . $harmoni->request->quickURL() . "' method='post' enctype='multipart/form-data'>"; print "\n\t<input type='file' name='" . RequestContext::name('image_file') . "'/>"; print "\n\t<input type='submit'/>"; print "\n</form>"; $centerPane->add(new Block(ob_get_clean(), STANDARD_BLOCK), null, null, LEFT, TOP); if (isset($_FILES[RequestContext::name('image_file')]) && !$_FILES[RequestContext::name('image_file')]['error']) { $fileArray = $_FILES[RequestContext::name('image_file')]; ob_start(); print "<h2>" . $fileArray['name'] . "</h2>"; $exifImporter = new ExifRepositoryImporter($fileArray['tmp_name'], null, false); $exifImporter->getSingleAssetInfo($fileArray['tmp_name']); // printpre($exifImporter->_photoshopIPTC); print "\n<h3>" . _("IPTC Fields") . "</h3>"; $this->printFields($exifImporter->extractPhotoshopMetaData()); print "\n<h3>" . _("EXIF Fields") . "</h3>"; $this->printFields($exifImporter->extractExifMetadata($fileArray['tmp_name'])); $centerPane->add(new Block(ob_get_clean(), STANDARD_BLOCK), null, null, LEFT, TOP); } }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { ob_start(); print "<div>"; print "<input type='hidden' name='" . RequestContext::name($fieldName) . "' value=''/>"; $steps = $this->_stepContainer->getSteps(); $currStep = $this->_stepContainer->getCurrentStep(); $a = array(); foreach (array_keys($steps) as $stepKey) { ob_start(); if ($stepKey == $currStep) { print "<b>"; } else { print "<a href='#' onclick=\""; print "var input = this.parentNode.firstChild; "; print "input.value = '" . $stepKey . "'; "; print "submitWizard(input.form); "; print "return false; \">"; } print $stepKey + 1 . ". " . $steps[$stepKey]->getDisplayName(); if ($stepKey == $currStep) { print "</b>"; } else { print "</a>"; } $a[] = ob_get_clean(); } print implode("\n»\n", $a); print "</div>"; return ob_get_clean(); }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); $pageRows = new Container(new YLayout(), OTHER, 1); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("polyphony-agents"); $agentManager = Services::getService("Agent"); $idManager = Services::getService("Id"); $cm = Services::getService("CourseManagement"); $everyoneId = $idManager->getId("edu.middlebury.agents.everyone"); $usersId = $idManager->getId("edu.middlebury.agents.users"); /********************************************************* * the agent search form *********************************************************/ // Users header $actionRows->add(new Heading(_("Users"), 2), "100%", null, LEFT, CENTER); ob_start(); $self = $harmoni->request->quickURL(); $lastCriteria = $harmoni->request->get("search_criteria"); $search_criteria_name = RequestContext::name("search_criteria"); $search_type_name = RequestContext::name("search_type"); print _("Search For Users") . ": "; print "<form action='{$self}' method='post'>\n\t\t\t<div>\n\t\t\t<input type='text' name='{$search_criteria_name}' value='{$lastCriteria}' />"; print "\n\t<input type='submit' value='" . _("Search") . "' />"; print "\n\t<a href='" . $harmoni->request->quickURL() . "'>"; print "<input type='button' value='" . _("Clear") . "' /></a>"; print "\n</div>\n</form>"; $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); /********************************************************* * the agent search results *********************************************************/ ob_start(); if ($search_criteria = $harmoni->request->get('search_criteria')) { //$typeParts = explode("::", @html_entity_decode($search_type, ENT_COMPAT, 'UTF-8')); $searchType = new HarmoniType("Agent & Group Search", "edu.middlebury.harmoni", "TokenSearch"); //$searchType = new HarmoniType("Agent & Group Search", "edu.middlebury.harmoni", "WildcardSearch"); $string = "*" . $search_criteria . "*"; $agents = $agentManager->getAgentsBySearch($string, $searchType); print "search: " . $search_criteria; while ($agents->hasNext()) { $agent = $agents->next(); $id = $agent->getId(); $harmoni->history->markReturnURL("polyphony/agents/edit_agent_details"); print "\n<p align='center'><a href='" . $harmoni->request->quickURL("agents", "edit_agent_details", array("agentId" => $id->getIdString())) . "'>"; print "\n" . $agent->getDisplayName() . "</a>"; print "\n - <a href=\"Javascript:alert('" . _("Id:") . '\\n\\t' . addslashes($id->getIdString()) . "')\">Id</a></p>"; } print "\n</div>"; $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); } }
/** * Answer a description of this category for display purposes * * @return string * @access public * @since 4/1/08 */ public function getDescription() { $harmoni = Harmoni::instance(); $handler = $harmoni->getOutputHandler(); $handler->setHead($handler->getHead() . "\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/PortalSearch.js'></script>"); ob_start(); print "\n<form onsubmit='PortalSearch.submitForm(this); return false;' action='"; print $harmoni->request->quickUrl('portal', 'perform_search'); print "' method='post'>"; print "\n\t<input type='text' name='" . RequestContext::name('query') . "' size='15'/>"; print "\n\t<input type='submit' value='" . _("Search »") . "'/>"; print "\n</form>"; return ob_get_clean(); }
/** * Initialize this object * * @return void * @access public * @since 5/15/06 */ function init() { if (!$this->_initilaized) { $harmoni = Harmoni::instance(); $harmoni->request->startNamespace('SimpleFieldModule'); $this->_contextFieldName = RequestContext::name($this->_fieldname); if (RequestContext::value($this->_fieldname)) { $this->_value = RequestContext::value($this->_fieldname); } else { $this->_value = null; } $harmoni->request->endNamespace(); $this->_initilaized = true; } }
/** * Add the site header gui components * * @return Component * @access public * @since 4/7/08 */ public function getSiteHeader() { $harmoni = Harmoni::instance(); ob_start(); $harmoni->request->startNamespace('polyphony-tags'); print "\n<form action='" . SiteDispatcher::quickURL(null, null, array('tag' => RequestContext::value('tag'))) . "' method='post' style='display: inline;'>"; print "\n\t<select name='" . RequestContext::name('num_tags') . "'"; print " onchange='this.form.submit()'>"; $options = array(50, 100, 200, 400, 600, 1000, 0); foreach ($options as $option) { print "\n\t\t<option value='" . $option . "' " . ($option == $this->getNumTags() ? " selected='selected'" : "") . ">" . ($option ? $option : _('all')) . "</option>"; } print "\n\t</select>"; print "\n</form>"; $harmoni->request->endNamespace(); return new Block(str_replace('%1', ob_get_clean(), _("Showing top %1 tags")), STANDARD_BLOCK); }
/** * Build the content for this action * * @return boolean * @access public * @since 2/28/08 */ function buildContent() { $harmoni = Harmoni::instance(); $actionRows = $this->getActionRows(); ob_start(); print "\n<form action='" . $harmoni->request->quickURL() . "' method='get'>"; print "\n\t<input name='" . RequestContext::name('interval_size') . "' size='3' value='"; if (RequestContext::value('interval_size')) { print RequestContext::value('interval_size'); } else { print '3'; } print "'/>"; if (RequestContext::value('interval_unit')) { $val = RequestContext::value('interval_unit'); } else { $val = 'MONTH'; } $units = array('DAY', 'WEEK', 'MONTH', 'YEAR'); print "\n\t<select name='" . RequestContext::name('interval_unit') . "'>"; foreach ($units as $unit) { print "\n\t\t<option value='" . $unit . "'"; if ($val == $unit) { print " selected='selected'"; } print ">" . ucfirst(strtolower($unit . 's')) . "</option>"; } print "\n\t</select>"; print "\n\t<input type='submit' value='" . _('Set Date Range') . "'/>"; print "\n</form>"; print "\n<p>"; $params = array(); if (RequestContext::value('interval_size')) { $params['interval_size'] = RequestContext::value('interval_size'); } if (RequestContext::value('interval_unit')) { $params['interval_unit'] = RequestContext::value('interval_unit'); } print "<img src='" . $harmoni->request->quickURL("logs", "usage_graph", $params) . "' alt='" . _("Usage Graph") . "'/>"; print "</p>"; $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, CENTER, CENTER); }
/** * Answer the markup for a set of search results * * @param string $fieldName * @param array $results An array of WSearchResult objects * @return string * @access public * @since 11/27/07 */ public function getResultsMarkup($fieldName, $results) { $harmoni = Harmoni::instance(); if (count($results)) { print "\n\t<table id='" . RequestContext::name($fieldName) . "_output' class='search_results' cellspacing='0'>"; $colorKey = 0; foreach ($results as $result) { print "\n\t\t<tr class='search_result_item '>"; print "\n\t\t\t<td class='color" . $colorKey . "'>"; print $result->getMarkup(); print "\n\t\t\t</td>"; print "\n\t\t\t<td class='action_button color" . $colorKey . "'>"; $url = $harmoni->request->quickURL('roles', 'modify', array('node' => SiteDispatcher::getCurrentNodeId(), 'agent' => $result->getIdString())); print "\n\t\t\t<button onclick='window.location = \"{$url}\".urlDecodeAmpersands(); return false;'>" . _("Modify Roles »") . "</button>"; print "\n\t\t\t</td>"; print "\n\t\t</tr>"; $colorKey = intval(!$colorKey); } print "\n\t</table>"; } }
/** * Initialize this object * * @return void * @access public * @since 5/15/06 */ function init() { if (!$this->_initilaized) { $harmoni = Harmoni::instance(); $harmoni->request->startNamespace('PartAndValuesModule'); $this->_contextPartStructFieldName = RequestContext::name($this->_partStructFieldName); $this->_contextValueFieldName = RequestContext::name($this->_valueFieldName); if (RequestContext::value($this->_partStructFieldName)) { $this->_partStruct = RequestContext::value($this->_partStructFieldName); } else { $this->_partStruct = null; } if (RequestContext::value($this->_valueFieldName)) { $this->_value = RequestContext::value($this->_valueFieldName); } else { $this->_value = null; } $harmoni->request->endNamespace(); $this->_initilaized = true; } }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); ob_start(); $userPrefs = UserData::instance(); // $userPrefs->setPreference('test_pref2', 'goodbye world'); print "\n<input type='button' value='" . _("Clear Session-Values") . "'/>"; // print "\n<input type='button' value='"._("Delete All Values")."'/>"; print "\n<table border='1'>"; print "\n\t<thead>"; print "\n\t\t<tr>"; print "\n\t\t\t<th>" . "</th>"; print "\n\t\t\t<th>" . _('Key') . "</th>"; print "\n\t\t\t<th>" . _('Value') . "</th>"; print "\n\t\t\t<th>" . "</th>"; print "\n\t\t\t<th>" . _('Session-Value') . "</th>"; print "\n\t\t\t<th>" . _('Stored-Value') . "</th>"; print "\n\t\t</tr>"; print "\n\t</thead>"; print "\n\t<tbody>"; foreach ($userPrefs->getPreferenceKeys() as $key) { print "\n\t\t<tr>"; print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('delete') . "' value='" . _("Delete") . "'/></td>"; print "\n\t\t\t<td class='user_pref_key'>" . $key . "</td>"; print "\n\t\t\t<td class='user_pref_val'><input type='text' name='" . RequestContext::name('pref_val') . "' value=\"" . $userPrefs->getPreference($key) . "\"/></td>"; print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('save') . "' value='" . _("Save Changes") . "'/></td>"; print "\n\t\t\t<td class='user_pref_sess_val'>" . $userPrefs->getPreferenceSessionValue($key) . "</td>"; print "\n\t\t\t<td class='user_pref_stored_val'>" . $userPrefs->getPreferencePersistantValue($key) . "</td>"; print "\n\t\t</tr>"; } print "\n\t\t<tr>"; print "\n\t\t\t<td></td>"; print "\n\t\t\t<td><input type='text' name='" . RequestContext::name('pref_key') . "'/></td>"; print "\n\t\t\t<td><input type='text' name='" . RequestContext::name('pref_val') . "'/></td>"; print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('new') . "' value='" . _("Create New Preference") . "'/></td>"; print "\n\t\t\t<td></td>"; print "\n\t\t\t<td></td>"; print "\n\t\t</tr>"; print "\n\t</tbody>"; print "\n</table>"; $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); textdomain($defaultTextDomain); }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { $name = RequestContext::name($fieldName) . "[]"; $style = ''; if ($this->_style) { $style = " style=\"" . addslashes($this->_style) . "\""; } $m = "<select name='{$name}' size='" . $this->_size . "' multiple{$style}>\n"; foreach (array_keys($this->_items) as $key) { $disp = $this->_items[$key]; $selected = in_array($key, $this->_value) ? " selected='selected'" : ""; $val = htmlspecialchars($key, ENT_QUOTES); $m .= "<option value='{$val}'{$selected}>" . htmlspecialchars($disp) . "</option>\n"; } $m .= "</select>\n"; return $m; }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { $guimanager = Services::getService("GUIManager"); $name = RequestContext::name($fieldName); $value = $this->_value; $settings = $this->_settings; $colorwheelurl = "http://slug.middlebury.edu/~nstamato/polyphony/main/library/Wizard/Components/WColorWheelFiles/"; $style = ''; if ($this->_style) { $style = " style=\"" . addslashes($this->_style) . "\""; } $guimanager->setHead($guimanager->getHead() . "\n<link rel=\"stylesheet\" \n\t\thref='" . $colorwheelurl . "colorwheel.css' type=\"text/css\">" . "\n<script type=\"text/javascript\" src='" . $colorwheelurl . "colorblind.js'></script>" . "\n<script type=\"text/javascript\" src='" . $colorwheelurl . "colorwheel.js'></script>"); $m = "<br /><div id=\"maindiv\" style='position:relative; border:1px solid #000; height:500px; width:800px; font:11px/1.2 verdana,sans-serif;'>\n\t\t\n\t\t<div id=\"maincolorsample\"></div>\n\t\t<div id='image'>\n\t\t\t<div id=\"wheelarea\"></div>\n\t\t\t<div id=\"pointer0\"></div>\n\t\t\t<div id=\"pointer1\"></div>\n\t\t\t<div id=\"pointer2\"></div>\n\t\t\t<div id=\"pointer3\"></div>\n\t\t</div>\n\t\t<div id=\"maincolorhue\"></div>\n\t\t\n\t\t\n\t\t<div id='scheme-select'>\n\t\t\t<img id=\"previmg-mono\" src=" . $colorwheelurl . "prev_mono.gif\" alt=\"\" width=\"41\" height=\"52\" onclick=\"selectScheme('mono')\">\n\t\t\t<img id=\"previmg-compl\" class='previmg' src=" . $colorwheelurl . "prev_compl.gif\" alt=\"\" width=\"41\" height=\"52\" onclick=\"selectScheme('compl')\">\n\t\t\t<img id=\"previmg-triad\" class='previmg' src=" . $colorwheelurl . "prev_triad.gif\" alt=\"\" width=\"41\" height=\"52\" onclick=\"selectScheme('triad')\">\n\t\t\t<img id=\"previmg-tetrad\" class='previmg' src=" . $colorwheelurl . "prev_tetrad.gif\" alt=\"\" width=\"41\" height=\"52\" onclick=\"selectScheme('tetrad')\">\n\t\t\t<img id=\"previmg-analog\" class='previmg' src=" . $colorwheelurl . "prev_analog.gif\" alt=\"\" width=\"41\" height=\"52\" onclick=\"selectScheme('analog')\">\n\t\t\n\t\t</div>\n\t\t\n\t\t<div id=\"scheme-slider\">\n\t\t\t<div id=\"pointer-slider\"></div>\n\t\t</div>\n\t\t\n\t\t<div id=\"scheme-addcompl\">\n\t\t\t<input type=\"checkbox\" id=\"analogCompl\" onchange=\"createScheme(false)\" onclick=\"createScheme(false)\"> <label for=\"analogCompl\">add the complement</label>\n\t\t</div>\n\t\t\n\t\t<div id=\"scheme-searchrgb\">\n\t\t\t<a href=\"#\" onclick=\"searchRGB(false)\">Enter RGB</a> (rough conversion)\n\t\t</div>\n\t\t\n\t\t<div id=\"colsample\">\n\t\t\n\t\t\t<div id=\"color0\" class=\"col\">\n\t\t\t\t<div id=\"color0-0\" class=\"col-0\" onclick=\"drawVar(0,0)\"></div>\n\t\t\t\t<div id=\"color0-1\" class=\"col-1\" onclick=\"drawVar(0,1)\"></div>\n\t\t\t\t<div id=\"color0-2\" class=\"col-2\" onclick=\"drawVar(0,2)\"></div>\n\t\t\t\t<div id=\"color0-3\" class=\"col-3\" onclick=\"drawVar(0,3)\"></div>\n\t\t\t</div>\n\t\t\n\t\t\t<div id=\"color1\" class=\"col\">\n\t\t\t\t<div id=\"color1-0\" class=\"col-0\" onclick=\"drawVar(1,0)\"></div>\n\t\t\t\t<div id=\"color1-1\" class=\"col-1\" onclick=\"drawVar(1,1)\"></div>\n\t\t\t\t<div id=\"color1-2\" class=\"col-2\" onclick=\"drawVar(1,2)\"></div>\n\t\t\t\t<div id=\"color1-3\" class=\"col-3\" onclick=\"drawVar(1,3)\"></div>\n\t\t\t</div>\n\t\t\n\t\t\t<div id=\"color2\" class=\"col\">\n\t\t\t\t<div id=\"color2-0\" class=\"col-0\" onclick=\"drawVar(2,0)\"></div>\n\t\t\t\t<div id=\"color2-1\" class=\"col-1\" onclick=\"drawVar(2,1)\"></div>\n\t\t\t\t<div id=\"color2-2\" class=\"col-2\" onclick=\"drawVar(2,2)\"></div>\n\t\t\t\t<div id=\"color2-3\" class=\"col-3\" onclick=\"drawVar(2,3)\"></div>\n\t\t\t</div>\n\t\t\n\t\t\t<div id=\"color3\" class=\"col\">\n\t\t\t\t<div id=\"color3-0\" class=\"col-0\" onclick=\"drawVar(3,0)\"></div>\n\t\t\t\t<div id=\"color3-1\" class=\"col-1\" onclick=\"drawVar(3,1)\"></div>\n\t\t\t\t<div id=\"color3-2\" class=\"col-2\" onclick=\"drawVar(3,2)\"></div>\n\t\t\t\t<div id=\"color3-3\" class=\"col-3\" onclick=\"drawVar(3,3)\"></div>\n\t\t\t</div>\n\t\t\n\t\t\n\t\t\t<div id=\"textBlack\">Lorem ipsum <strong>dolor sit amet</strong></div>\n\t\t\t<div id=\"textWhite\"><strong>Lorem ipsum</strong> dolor sit amet</div>\n\t\t</div>\n\t\t\n\t\t<div id=\"coltable\"></div>\n\t\t\n\t\t<div id=\"websnapswitch\">\n\t\t\t<input type=\"checkbox\" id=\"websnapper\" onclick=\"switchWebSnap(this.checked)\" onchange=\"switchWebSnap(this.checked)\"> <label for=\"websnapper\">Reduce to \"safe\" colors (WebColors)</label>\n\t\t</div>\n\t\t\n\t\t<div id=\"presetswitch\">\n\t\t\tVariations:\n\t\t\t<a href=\"\" id=\"preset-default\" class=\"btn\" onclick=\"switchPreset('default');return false\">Default</a>\n\t\t\t<a href=\"\" id=\"preset-pastel\" class=\"btn\" onclick=\"switchPreset('pastel');return false\">Pastel</a>\n\t\t\t<a href=\"\" id=\"preset-soft\" class=\"btn\" onclick=\"switchPreset('soft');return false\">Dark pastel</a>\n\t\t\t<a href=\"\" id=\"preset-light\" class=\"btn\" onclick=\"switchPreset('light');return false\">Light pastel</a>\n\t\t\t<a href=\"\" id=\"preset-hard\" class=\"btn\" onclick=\"switchPreset('hard');return false\">Contrast</a>\n\t\t\t<a href=\"\" id=\"preset-pale\" class=\"btn\" onclick=\"switchPreset('pale');return false\">Pale</a>\n\t\t</div>\n\t\t\n\t\t<a id=\"url\" href=\"index.html\">URL of this scheme</a>\n\t\t\n\t\t<div style='position:absolute; left:300px; top:385px; height:100; width: 450px; text-align: right;'>\n\t\t\n\t\t\n\t\t\t<select id=\"cbmodeswitcher\" onchange=\"switchBlindlessMode()\">\n\t\t\t\t<option value=\"\">Normal vision (cca 85,5 % of population)</option>\n\t\t\t\t<option value=\"1\">Protanopy (1 % of men)</option>\n\t\t\t\t<option value=\"2\">Deuteranopy (1 % of men)</option>\n\t\t\t\t<option value=\"3\">Tritanopy (cca 0,003 % of population)</option>\n\t\t\t\t<option value=\"4\">Protanomaly (1 % of men)</option>\n\t\t\t\t<option value=\"5\">Deuteranomaly (5 % of men, 0.4 % of women)</option>\n\t\t\t\t<option value=\"6\">Tritanomaly (almost 0 %)</option>\n\t\t\t\t<option value=\"7\">Full colorblindness (0,005% of population)</option>\n\t\t\t\t<option value=\"8\">Atypical monochromatism</option>\n\t\t\t</select>\n\t\t\n\t\t</div>\n\t\t<div id=\"colsamplevarsswitch\"><div class=\"bottomaligner\">\n\t\t\t<a href=\"\" class=\"btn\" id=\"cancelsamplevars\" onclick=\"drawSample();return false\">Back</a>\n\t\t</div></div>\n\t\t<div id=\"colsamplevars\"></div>\n\t\t\n\t\t<p id=\"info\">\n\t\t\t<a href=\"http://www.wellstyled.com\">Wellstyled.com</a> →\n\t\t\t<strong>Color schemes generator 2</strong> •\n\t\t\tPlease read <a id=\"helptext\" href=" . $colorwheelurl . "help.html>more info & help</a><br>\n\t\t\t• Copyright <a href=\"http://www.pixy.cz\">pixy</a> © 2002, 2004\n\t\t</p></div>"; $m .= "<div id=\"display\">\n\t\t<input type='hidden' name='" . $name . "_colors' id='wizardColorWheelColors' value='{$value}' /></div>"; $m .= "<div id=\"settings\">\n\t\t<input type='hidden' name='" . $name . "_settings' id='settingsdata' value='{$settings}' /></div>"; return $m; }
/** * This just adds an agent list for debugging purposes. * * @return void * @access public * @since 11/07/06 */ function buildContent() { parent::buildContent(); $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); ob_start(); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("polyphony-tags"); ob_start(); print "\n<select name='" . RequestContext::name('num_tags') . "'"; print " onchange=\""; print "var url='" . $harmoni->request->quickURL(null, null, array('num_tags' => 'XXXXX')) . "'; "; print "window.location = url.replace(/XXXXX/, this.value).urlDecodeAmpersands(); "; print "\">"; $options = array(50, 100, 200, 400, 600, 1000, 0); foreach ($options as $option) { print "\n\t<option value='" . $option . "' " . ($option == $this->getNumTags() ? " selected='selected'" : "") . ">" . ($option ? $option : _('all')) . "</option>"; } print "\n</select>"; print str_replace('%1', ob_get_clean(), _("Showing top %1 tags")); $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); $harmoni->request->endNamespace(); textdomain($defaultTextDomain); }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { $name = RequestContext::name($fieldName); $m = "\n\t\t\t<textarea rows='" . $this->_rows . "' cols='" . $this->_cols . "'"; if (isset($this->_wrapStyle) && is_string($this->_wrapStyle)) { $m .= " wrap='" . $this->_wrapStyle . "'"; } $m .= "\n\t\t\t\tname='{$name}'"; $m .= "\n\t\t\t\tid='{$name}'"; $m .= !$this->isEnabled() ? " readonly='readonly'" : ""; if ($this->_style) { $m .= "\n\t\t\t\tstyle=\"" . str_replace("\"", "\\\"", $this->_style) . "\""; } if ($this->_onchange) { $m .= "\n\t\t\t\tonchange=\"" . str_replace("\"", "\\\"", $this->_onchange) . "\""; } if ($this->_value != null && $this->_value != $this->_startingDisplay) { $m .= ">" . htmlspecialchars($this->_value); } else { if ($this->_startingDisplay) { $v = htmlspecialchars($this->_startingDisplay, ENT_QUOTES); $m .= "\n\t\t\t\tonfocus='if (this.value == \"{$v}\") { this.value=\"\"; this.style.color=\"#000\";}'"; $m .= "\n\t\t\t\tonblur='if (this.value == \"\") { this.value=\"{$v}\"; this.style.color=\"#888\";}'"; $m .= " style='color: #888'>" . $v; } else { $m .= ">" . htmlspecialchars($this->_value); } } $m .= "</textarea>"; $errText = $this->getErrorText(); $errRule = $this->getErrorRule(); $errStyle = $this->getErrorStyle(); if ($errText && $errRule) { $m .= "<span id='" . $fieldName . "_error' style=\"padding-left: 10px; {$errStyle}\">« {$errText}</span>"; $m .= Wizard::getValidationJavascript($fieldName, $errRule, $fieldName . "_error", $this->_showError); $this->_showError = false; } return $m; }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { $m = ""; $m .= "\n\t<div title='" . $this->_label . "' style='vertical-align: top; padding: 0px; margin: 0px;'>"; $newId = RequestContext::name($fieldName . "_new_container"); if ($this->isUsingNewValue()) { $display = " display: block;"; } else { $display = " display: none;"; } $this->_select->addOnChange("var newField = document.get_element_by_id('{$newId}'); if (this.value == '__NEW_VALUE__') { newField.style.display = 'block'; } else { newField.style.display = 'none'; }"); $m .= "\n\t\t" . $this->_select->getMarkup($fieldName . "_select"); $m .= "\n\t</div>"; $m .= "\n\t<div id='{$newId}' style='padding: 0px; margin: 0px; {$display}'>"; $m .= "\n\t\t" . $this->_new->getMarkup($fieldName . "_new"); $m .= "\n\t</div>"; $errText = $this->getErrorText(); $errRule = $this->getErrorRule(); $errStyle = $this->getErrorStyle(); //$todo fix the darn validation if ($errText && $errRule) { //$m .= "\n\t\t<span id='".$fieldName."_error' style=\"padding-left: 10px; $errStyle\">« $errText</span>"; //$m .= Wizard::getValidationJavascript($fieldName."_new", $errRule, $fieldName."_error", !$this->validate()); } return $m; }
/** * Answer a string of controls html to go along with this folder. In many cases * it will be empty, but some implementations may need controls for adding new slots. * * @return string * @access public * @since 4/1/08 */ public function getControlsHtml() { $message = ''; try { $this->createNewSlotIfRequested(); } catch (OperationFailedException $e) { $message = $e->getMessage(); } // Form if (PersonalSlot::hasPersonal()) { ob_start(); $harmoni = Harmoni::instance(); $authN = Services::getService("AuthN"); $harmoni->request->startNamespace('personal_slot'); $url = $harmoni->request->quickURL(); print "<div style='float: left;'>"; print "<strong>" . _("Create a new site") . " <span style='font-size: smaller;'>(" . Help::link('Portal') . ")</span>:</strong><br/>"; print "<span style='font-size: smaller;'>" . _("1. Chose a name for the placeholder of your new site. <br/>2. Create a new site in that placeholder.") . "</span>"; print "</div>"; print "<div style='float: right;'>"; print "\n<form class='add_slot_form' method='post' action='{$url}'>"; print "<div style='text-align: center;'>" . _("Placeholder Name:") . "</div>"; print PersonalSlot::getPersonalShortname($authN->getFirstUserId()); print "-"; print "\n\t<input type='text' name='" . RequestContext::name('slot_postfix') . "' value='' size='10'/>"; print "\n\t<input type='submit' value='" . _('Create') . "'/>"; if (strlen($message)) { print "\n\t<div class='error'>" . $message . "</div>"; } print "\n</form>\n"; print "\n\t</div>"; print "\n\t<div class='no_float_spacer'>"; $harmoni->request->endNamespace(); return ob_get_clean(); } }
/** * Print the dateRange form * * @param object DateAndTime $startDate * @param object DateAndTime $endDate * @return void * @access public * @since 3/8/06 */ function printDateRangeForm($startDate, $endDate) { $min = $this->minDate(); $max = DateAndTime::tomorrow(); $harmoni = Harmoni::instance(); print "\n<form action='"; $harmoni->request->forget('startYear'); $harmoni->request->forget('startMonth'); $harmoni->request->forget('startDay'); $harmoni->request->forget('startHour'); $harmoni->request->forget('endYear'); $harmoni->request->forget('endMonth'); $harmoni->request->forget('endDay'); $harmoni->request->forget('endHour'); print $harmoni->request->quickURL('logs', 'browse'); $harmoni->request->passthrough('log', 'priority', 'startYear', 'startMonth', 'startDay', 'startHour', 'endYear', 'endMonth', 'endDay', 'endHour', 'agent_id', 'node_id', 'category'); print "' method='post'>"; print "\n\t<select name='" . RequestContext::name("startMonth") . "'>"; $month = 1; while ($month <= 12) { print "\n\t\t<option value='" . $month . "'"; print $month == $startDate->month() ? " selected='selected'" : ""; print ">" . Month::nameOfMonth($month) . "</option>"; $month++; } print "\n\t</select>"; print "\n\t<select name='" . RequestContext::name("startDay") . "'>"; $day = 1; while ($day <= 31) { print "\n\t\t<option value='" . $day . "'"; print $day == $startDate->dayOfMonth() ? " selected='selected'" : ""; print ">" . $day . "</option>"; $day++; } print "\n\t</select>"; print "\n\t<select name='" . RequestContext::name("startYear") . "'>"; $year = $max->year(); $minYear = $min->year(); while ($year >= $minYear) { print "\n\t\t<option value='" . $year . "'"; print $year == $startDate->year() ? " selected='selected'" : ""; print ">{$year}</option>"; $year--; } print "\n\t</select>"; print "\n\t<select name='" . RequestContext::name("startHour") . "'>"; $hour = 0; while ($hour <= 23) { print "\n\t\t<option value='" . $hour . "'"; print $hour == $startDate->hour() ? " selected='selected'" : ""; print ">" . sprintf("%02d", $hour) . ":00</option>"; $hour++; } print "\n\t</select>"; print "\n\t<strong> to: </strong>"; print "\n\t<select name='" . RequestContext::name("endMonth") . "'>"; $month = 1; while ($month <= 12) { print "\n\t\t<option value='" . $month . "'"; print $month == $endDate->month() ? " selected='selected'" : ""; print ">" . Month::nameOfMonth($month) . "</option>"; $month++; } print "\n\t</select>"; print "\n\t<select name='" . RequestContext::name("endDay") . "'>"; $day = 1; while ($day <= 31) { print "\n\t\t<option value='" . $day . "'"; print $day == $endDate->dayOfMonth() ? " selected='selected'" : ""; print ">" . $day . "</option>"; $day++; } print "\n\t</select>"; print "\n\t<select name='" . RequestContext::name("endYear") . "'>"; $year = $max->year(); $minYear = $min->year(); while ($year >= $minYear) { print "\n\t\t<option value='" . $year . "'"; print $year == $endDate->year() ? " selected='selected'" : ""; print ">{$year}</option>"; $year--; } print "\n\t</select>"; print "\n\t<select name='" . RequestContext::name("endHour") . "'>"; $hour = 0; while ($hour <= 23) { print "\n\t\t<option value='" . $hour . "'"; print $hour == $endDate->hour() ? " selected='selected'" : ""; print ">" . sprintf("%02d", $hour) . ":00</option>"; $hour++; } print "\n\t</select>"; print "\n\t<input type='submit' value='" . _("Set Range") . "'/>"; print "\n\t<a href='"; print $harmoni->request->quickURL('logs', 'browse', array('startYear' => $min->year(), 'startMonth' => $min->month(), 'startDay' => $min->dayOfMonth(), 'startHour' => $min->hour(), 'endYear' => $max->year(), 'endMonth' => $max->month(), 'endDay' => $max->dayOfMonth(), 'endHour' => $max->hour())); print "'>"; print "\n\t\t<input type='button' value='" . _("Clear") . "' />"; print "</a>"; print "\n</form>"; }
/** * Answer the javascript for hiding and showing choices. * * @return string * @access public * @since 1/7/08 */ public function getVersionChoiceJS() { $oldName = RequestContext::name('early_rev'); $newName = RequestContext::name('late_rev'); return <<<END \t\t \t<script type='text/javascript'> \t// <![CDATA[ \t \tif (!Array.prototype.push) { \t\t/** \t\t * IE 5.01 does not implement the push method, so it needs to be \t\t * added \t\t * \t\t * @param mixed element \t\t * @return int \t\t * @access public \t\t * @since 1/31/07 \t\t */ \t\tArray.prototype.push = function ( element ) { \t\t\tvar key = this.length; \t\t\tthis[key] = element; \t\t\treturn key; \t\t} \t\t \t} \t \t/** \t * Update the radio buttons checked if needed to preven un-allowed situations: \t * \t\t- comparing a version to itself \t *\t\t- mixing up new and old versions \t * \t * @param object RadioButton button \t * @return void \t * @access public \t * @since 2/2/07 \t */ \tfunction updateVersionSelection (button) { \t\tvar oldButtons = new Array(); \t\toldButtons.push(null); \t\tvar newButtons = new Array(); \t\t \t\tfor (var i = 0; i < button.form.elements.length; i++) { \t\t\t// Sort the elements into old and new arrays and record \t\t\t// what row in each is selected \t\t\tvar element = button.form.elements[i]; \t\t\tif (element.name == '{$oldName}') { \t\t\t\toldButtons.push(element); \t\t\t\tif (element.checked) \t\t\t\t\tvar oldRow = oldButtons.length - 1; \t\t\t} else if (element.name == '{$newName}') { \t\t\t\tnewButtons.push(element); \t\t\t\tif (element.checked) \t\t\t\t\tvar newRow = newButtons.length - 1; \t\t\t} \t\t} \t\t\t\t\t\t \t\t// If a new version was selected make sure that the old version is older \t\tif (button.name == '{$newName}') { \t\t\tif (oldRow <= newRow) { \t\t\t\toldButtons[oldRow].checked = ''; \t\t\t\toldButtons[newRow + 1].checked = 'checked'; \t\t\t} \t\t\t \t\t\tfor (var i = 1; i < oldButtons.length; i++) { \t\t\t\tif (i <= newRow) \t\t\t\t\toldButtons[i].style.visibility = 'hidden'; \t\t\t\telse \t\t\t\t\toldButtons[i].style.visibility = 'visible'; \t\t\t} \t\t} \t\t// If an old version was selected make sure that the new version is newer \t\telse { \t\t\tif (newRow >= oldRow) { \t\t\t\tnewButtons[newRow].checked = ''; \t\t\t\tnewButtons[oldRow - 1].checked = 'checked'; \t\t\t} \t\t\t \t\t\tfor (var i = 1; i < newButtons.length; i++) { \t\t\t\tif (i >= oldRow) \t\t\t\t\tnewButtons[i].style.visibility = 'hidden'; \t\t\t\telse \t\t\t\t\tnewButtons[i].style.visibility = 'visible'; \t\t\t} \t\t} \t} \t \t// ]]> \t</script> \t\t END; }
/** * Callback function for printing an agent * * @param object Agent $member * @return void * @access public * @ignore */ function printMember($member) { $harmoni = Harmoni::instance(); $harmoni->request->forget("expandedGroups"); $harmoni->request->forget("search_criteria"); $harmoni->request->forget("search_type"); $harmoni->request->forget("agentId"); $oldNS = $harmoni->request->endNamespace(); $harmoni->request->startNamespace("polyphony-agents"); $agentId = $member->getId(); $agentIdString = $agentId->getIdString(); $harmoni->history->markReturnURL("polyphony/agents/edit_agent_details"); $link = $harmoni->request->quickURL("agents", "edit_agent_details", array("agentId" => $agentIdString)); $harmoni->request->endNamespace(); $harmoni->request->startNamespace($oldNS); $id = $member->getId(); $memberType = $member->getType(); print "<input type='radio' id='agentId' name='" . RequestContext::name("agentId") . "' value='" . $id->getIdString() . "' />"; print "<a title='" . $id->getIdString() . "' href='{$link}'>"; print "<span style='text-decoration: underline;'>" . $member->getDisplayName() . "</span></a>"; print " - <em>" . $memberType->getDescription() . "</em>"; // $harmoni->request->endNamespace(); $harmoni->request->passthrough(); // $harmoni->request->startNamespace($oldNS); }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); $pageRows = new Container(new YLayout(), OTHER, 1); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("polyphony-agents"); $agentManager = Services::getService("Agent"); $idManager = Services::getService("Id"); $cm = Services::getService("CourseManagement"); /********************************************************* * the select menu *********************************************************/ // Users header //$actionRows->add(new Heading(_("Select Term"), 2), "100%", null, LEFT, CENTER); ob_start(); $self = $harmoni->request->quickURL(); $lastTerm = $harmoni->request->get("term_name"); $term_name = RequestContext::name("term_name"); //$search_type_name = RequestContext::name("search_type"); print _("<p align='center'>Select a Term") . ": </p>"; print <<<END \t\t<form action='{$self}' method='post'> \t\t\t<div> \t\t \t\t\t<p align='center'><select name='{$term_name}'> END; $searchTypes = $agentManager->getAgentSearchTypes(); $classId = $idManager->getId("OU=Classes,OU=Groups,DC=middlebury,DC=edu "); $classes = $agentManager->getGroup($classId); $terms = $classes->getGroups(false); while ($terms->hasNext()) { $termGroup = $terms->next(); $termName = $termGroup->getDisplayName(); $term = $this->_getTerm($termName); $id = $term->getId(); $idString = $id->getIdString(); print "\n\t\t<option value='" . $idString . "'"; if ($harmoni->request->get('term_name') == $idString) { print " selected='selected'"; } print ">" . $term->getDisplayName() . "</option>"; } print "\n\t</select>"; print "\n\t<input type='submit' value='" . _("Suck!") . "' />"; //print "\n\t<a href='".$harmoni->request->quickURL()."'>"; print "\n</p>\n</div></form>"; print "\n <p align='center'>Sucking may take a few minutes</p>"; $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); /********************************************************* * the agent search results *********************************************************/ ob_start(); if ($termIdString = $harmoni->request->get('term_name')) { $classId = $idManager->getId("OU=Classes,OU=Groups,DC=middlebury,DC=edu "); $classes = $agentManager->getGroup($classId); $terms = $classes->getGroups(false); while ($terms->hasNext()) { $termGroup = $terms->next(); $termName = $termGroup->getDisplayName(); $term = $this->_getTerm($termName); $id = $term->getId(); if ($termIdString == $id->getIdString()) { break; } } $pageRows->add(new Heading(_("Courses Sucked from " . $term->getDisplayName() . ""), 2), "100%", null, LEFT, CENTER); ob_start(); $last = ""; $sections = $termGroup->getGroups(false); while ($sections->hasNext()) { $section = $sections->next(); $sectionName = $section->getDisplayName(); if (substr($sectionName, 0, 4) == "phed") { continue; } if (substr($sectionName, 0, strlen($sectionName) - 5) != $last) { $last = substr($sectionName, 0, strlen($sectionName) - 5); $canonicalCourseId = $this->_getCanonicalCourse($sectionName); } } print "Success!"; // Create a layout for this group using the GroupPrinter $groupLayout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $pageRows->add($groupLayout, "100%", null, LEFT, CENTER); //} // In order to preserve proper nesting on the HTML output, the checkboxes // are all in the pagerows layout instead of actionrows. $actionRows->add($pageRows, null, null, CENTER, CENTER); } textdomain($defaultTextDomain); }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { $name = RequestContext::name($fieldName); $dummyName = $fieldName . "_dummy"; $val = $this->_value ? "1" : "0"; $checked = $this->_value ? " checked='checked'" : ""; $style = " style='cursor: pointer;'"; if ($this->_style) { $style = " style=\"cursor: pointer; " . htmlspecialchars($this->_style) . "\""; } $m = "\n\t\t\t<input type='hidden' \n\t\t\t\tname='{$name}' \n\t\t\t\tid='{$fieldName}' \n\t\t\t\tvalue='{$val}' />"; $m .= "\n\t\t\t<input type='checkbox' "; if (!$this->isEnabled()) { $m .= "\n\t\t\t\tdisabled=\"disabled\""; } else { $m .= "\n\t\t\t\tonclick=\""; if (isset($this->_confirms) && count($this->_confirms)) { $m .= "var confirmed = (confirm('"; $m .= implode("') && confirm('", $this->_confirms); $m .= "'));"; } else { $m .= "var confirmed = true; "; } $m .= " if (confirmed) { "; $m .= $this->getSetJS($fieldName); $m .= " } else { "; $m .= " this.checked = " . ($this->_value ? "true" : "false") . ";"; $m .= " }\""; } $m .= "\n\t\t\t\tid='{$dummyName}'{$checked} />"; $m .= "\n\t\t\t<label{$style} "; if ($this->isEnabled()) { $m .= "\n\t\t\t\tonclick=\""; if (isset($this->_confirms) && count($this->_confirms)) { $m .= "var confirmed = (confirm('"; $m .= implode("') && confirm('", $this->_confirms); $m .= "'));"; } else { $m .= "var confirmed = true; "; } $m .= " if (confirmed) { "; $m .= $this->getToggleJS($fieldName); $m .= " }\" "; } $m .= "\n\t\t\t>" . $this->_label . "</label>"; return $m; }
/** * Answer the form for Adding new components * * @param string $organizerId * @param integer $cellIndex * @param array $allowed Which components to allow addition of: MenuOrganizer, FlowOrganizer, FixedOrganizer * @return string The form HTML * @access public * @since 4/14/06 */ function getInsertFormHTML($director, $organizerId, $cellIndex, $allowed) { ob_start(); $harmoni = Harmoni::instance(); print "\n<form action='"; print $harmoni->request->quickURL('ui2', 'addComponent', array('returnNode' => SiteDispatcher::getCurrentNodeId(), 'returnAction' => $this->_action)); print "' method='post'>"; print "\n\t<input type='hidden' name='" . RequestContext::name('organizerId') . "' value='" . $organizerId . "'/>"; print "\n\t<input type='hidden' name='" . RequestContext::name('cellIndex') . "' value='" . $cellIndex . "'/>"; print "\n\t<div style='text-decoration: underline; cursor: pointer; white-space: nowrap;'"; print "onclick='this.style.display=\"none\"; this.nextSibling.style.display=\"block\";'"; print ">"; print "\n\t\t" . _("Insert New..."); print "\n\t</div>"; print "<div style='display: none'>"; // Selection of our menu target if (in_array('MenuOrganizer', $allowed)) { $menuTarget = $this->getDefaultMenuTargetId($director, $organizerId, $cellIndex); if (!$menuTarget) { $menuTarget = 'NewCellInNavOrg'; } // print "<br/>".$menuTarget; print "\n\t\t\t<input type='hidden' name='" . RequestContext::name('menuTarget') . "' value='" . $menuTarget . "'/>"; } print "\n\t\t<select name='" . RequestContext::name('componentType') . "'>"; foreach ($allowed as $type) { print "\n\t\t\t<option value='" . $type->asString() . "'>"; if (isset($this->_classNames[$type->getKeyword()])) { print $this->_classNames[$type->getKeyword()]; } else { print $type->getKeyword(); } print "</option>"; } print "\n\t\t</select>"; print "\n\t\t<div style=''>"; print "\n\t\t\t<input type='submit' value='" . _('Create') . "'/>"; print "\n\t\t\t<input type='button' "; print "onclick='this.parentNode.parentNode.style.display=\"none\"; this.parentNode.parentNode.previousSibling.style.display=\"block\";'"; print " value='" . _("Cancel") . "'/>"; print "\n\t\t</div>"; print "\n\t</div>"; print "</form>"; return ob_get_clean(); }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { ob_start(); print $this->_pre; $style = ''; if ($this->_style) { $style = " style=\"" . addslashes($this->_style) . "\""; } $s = array(); foreach (array_keys($this->_items) as $i => $key) { print $this->_eachPre; $display = $this->_items[$key]; $extendedHtml = $this->_extendedHtml[$key]; $name = RequestContext::name($fieldName . "__" . $i); $javascript = ''; if ($this->_onchange) { $javascript = " " . str_replace("\"", "\\\"", $this->_onchange) . "; "; } print "<input type='submit' name='{$name}' value=\"{$display}\" onclick=\"{$javascript}\"/>"; print $extendedHtml; print $this->_eachPost; } print $this->_post; return ob_get_clean(); }
/** * Answer the markup for a set of search results * * @param string $fieldName * @param array $results An array of WSearchResult objects * @return string * @access public * @since 11/27/07 */ public function getResultsMarkup($fieldName, $results) { $harmoni = Harmoni::instance(); if (count($results)) { print "\n\t<table id='" . RequestContext::name($fieldName) . "_output' class='search_results' cellspacing='0'>"; $colorKey = 0; foreach ($results as $result) { print "\n\t\t<tr class='search_result_item '>"; print "\n\t\t\t<td class='color" . $colorKey . "'>"; print $result->getMarkup(); print "\n\t\t\t</td>"; print "\n\t\t\t<td class='action_button color" . $colorKey . "'>"; // Create a button for each result. if (!isset($this->buttons[$result->getIdString()])) { $this->buttons[$result->getIdString()] = WEventButton::withLabel('+'); $this->buttons[$result->getIdString()]->setParent($this->parent); } print $this->buttons[$result->getIdString()]->getMarkup($fieldName . '_' . $this->getKey($result->getIdString())); print "\n\t\t\t</td>"; print "\n\t\t</tr>"; $colorKey = intval(!$colorKey); } print "\n\t</table>"; } }
/** * The following function has many forms, and due to PHP's lack of * method overloading they are all contained within the same class * method. * * write() * write(array $vars) * write(string $key1, string $value1, [string $key2, string $value2, [...]]) * * @access public * @return string The URL. */ function write() { if (!defined("MYURL")) { throwError(new Error("GETMethodURLWriter requires that 'MYURL' is defined and set to the full URL of the main index PHP script of this Harmoni program!", "GETMethodRequestHandler", true)); } $num = func_num_args(); $args = func_get_args(); if ($num > 1 && $num % 2 == 0) { for ($i = 0; $i < $num; $i += 2) { $this->_vars[RequestContext::name($args[$i])] = $args[$i + 1]; } } else { if ($num == 1 && is_array($args[0])) { $this->setValues($args[0]); } } $url = $this->_base; $pairs = array(); $harmoni = Harmoni::instance(); if (!$harmoni->config->get("sessionUseOnlyCookies") && defined("SID") && SID) { $pairs[] = strip_tags(SID); } $pairs[] = "module=" . $this->_module; $pairs[] = "action=" . $this->_action; foreach ($this->_vars as $key => $val) { if (is_object($val)) { throwError(new Error("Expecting string for key '{$key}', got '{$val}'.", "GETMethodRequestHandler", true)); } // For multi-select form elements if (is_array($val)) { foreach ($val as $arrayVal) { $pairs[] = $key . "=" . urlencode($arrayVal); } } else { $pairs[] = $key . "=" . urlencode($val); } } $url .= "?" . implode("&", $pairs); return $url; }
/** * Move a value to the beginning of the values array if it is set. * * @param string $key * @return void * @access public * @since 8/22/08 */ public function moveValueToBeginning($key) { $key = RequestContext::name($key); if (isset($this->_vars[$key])) { $newVars = array(); // Add it first. $newVars[$key] = $this->_vars[$key]; // Add the rest after it. foreach ($this->_vars as $key2 => $val) { if ($key2 != $key) { $newVars[$key2] = $val; } } $this->_vars = $newVars; } }
/** * Build a form to add information to add course sections. * * @return void * @access public * @since 8/29/05 */ function getAddForm($offering) { $harmoni = Harmoni::instance(); $cmm = Services::getService("CourseManagement"); $idManager = Services::getService("Id"); $am = Services::GetService("AgentManager"); ob_start(); $offeringName = $offering->getDisplayName(); $offeringId = $offering->getId(); $offeringIdString = $offeringId->getIdString(); print _("<h3>Course offering: " . $offeringName . "</h3>") . ""; print _("<h4>Please enter the following information to add a course section in " . $offeringName . ".</h4>") . ""; // Search header $self = $harmoni->request->quickURL("coursemanagement", "createcoursesection", array("sectionType", "sectionStatus", "sectionLocation")); $last_type = $harmoni->request->get("sectionType"); $section_type = RequestContext::name("sectionType"); $last_status = $harmoni->request->get("sectionStatus"); $section_status = RequestContext::name("sectionStatus"); $last_location = $harmoni->request->get("sectionLocation"); $section_location = RequestContext::name("sectionLocation"); print "<form action='{$self}' method='post'>\n\t\t\t<div>\n\t\t\t<p>Section Type: <br/><input type='text' name='{$section_type}' value='{$last_type}' /></p>\n\t\t\t<p>Section Status: <br/><input type='text' name='{$section_status}' value='{$last_type}' /></p>\n\t\t\t<p>Section Location: <br/><input type='text' name='{$section_location}' value='{$last_location}' /></p>"; print "\n\t<input type='submit' value='" . _("Add") . "' />"; print "\n\t<a href='" . $harmoni->request->quickURL() . "'>"; print "<input type='button' value='" . _("Clear") . "' /></a>"; print "\n</div>\n</form>\n"; $link = $harmoni->request->quickURL("coursemanagement", "edit_offering_details", array("courseId" => $offeringIdString)); print _("<h4><a href='{$link}'>Click here to return to offering details.</a></h4>") . ""; $output = new Block(ob_get_clean(), STANDARD_BLOCK); return $output; }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); $pageRows = new Container(new YLayout(), OTHER, 1); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("polyphony-agents"); $agentManager = Services::getService("Agent"); $idManager = Services::getService("Id"); $cm = Services::getService("CourseManagement"); $everyoneId = $idManager->getId("edu.middlebury.agents.everyone"); $usersId = $idManager->getId("edu.middlebury.agents.users"); /********************************************************* * the agent search form *********************************************************/ // Users header $actionRows->add(new Heading(_("Users"), 2), "100%", null, LEFT, CENTER); ob_start(); $self = $harmoni->request->quickURL(); $lastCriteria = $harmoni->request->get("search_criteria"); $search_criteria_name = RequestContext::name("search_criteria"); $search_type_name = RequestContext::name("search_type"); print _("Search For Users") . ": "; print <<<END \t\t<form action='{$self}' method='post'> \t\t\t<div> \t\t\t<input type='text' name='{$search_criteria_name}' value='{$lastCriteria}' /> \t\t\t<select name='{$search_type_name}'> END; $searchTypes = $agentManager->getAgentSearchTypes(); while ($searchTypes->hasNext()) { $type = $searchTypes->next(); $typeString = htmlspecialchars($type->getDomain() . "::" . $type->getAuthority() . "::" . $type->getKeyword()); print "\n\t\t<option value='{$typeString}'"; if ($harmoni->request->get("search_type") == $typeString) { print " selected='selected'"; } print ">" . $type->getKeyword() . "</option>"; } print "\n\t</select>"; print "\n\t<input type='submit' value='" . _("Search") . "' />"; print "\n\t<a href='" . $harmoni->request->quickURL() . "'>"; print "<input type='button' value='" . _("Clear") . "' /></a>"; print "\n</div>\n</form>"; $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); /********************************************************* * The dropdown menu *********************************************************/ //$pageRows->add(new Heading(_("Agents to Choose".$term->getDisplayName().""), 2), "100%", null, LEFT, CENTER); if (($search_criteria = $harmoni->request->get('search_criteria')) && ($search_type = $harmoni->request->get('search_type'))) { ob_start(); $typeParts = explode("::", @html_entity_decode($search_type, ENT_COMPAT, 'UTF-8')); $searchType = new HarmoniType($typeParts[0], $typeParts[1], $typeParts[2]); $agents = $agentManager->getAgentsBySearch($search_criteria, $searchType); print "search: " . $search_criteria; $self = $harmoni->request->quickURL(); $lastCriteria = $harmoni->request->get("agent_id"); $agent_name = RequestContext::name("agent_id"); print <<<END \t\t<form action='{$self}' method='post'> \t\t\t<div> \t\t\t<p align='center'> \t\t\t<select name='{$agent_name}'> END; $searchTypes = $agentManager->getAgentSearchTypes(); while ($agents->hasNext()) { $agent = $agents->next(); $id = $agent->getId(); $idString = $id->getIdString(); print "\n\t\t<option value='" . $idString . "'"; if ($harmoni->request->get("agent_id") == $idString) { print " selected='selected'"; } print ">" . $agent->getDisplayName() . "</option>"; } print "\n\t</select>"; print "\n\t<input type='submit' value='" . _("Suck Agent's info") . "' />"; print "\n</p></div>\n</form>"; print "\n <p align='center'>Sucking may take a few minutes</p>"; $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); } if ($agentIdString = $harmoni->request->get('agent_id')) { ob_start(); $id = $idManager->getId($agentIdString); $agent = $agentManager->getAgent($id); $this->refreshAgentDetails($agent); $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); } }
static function createAgentForm() { $harmoni = Harmoni::instance(); print "<center><form action='" . $harmoni->request->quickURL() . "' method='post'>\n\t\t\t\t<table>"; //switch($GLOBALS["AuthNMethod"]){ // case "dbAuthType": print "<tr><td>\n\t\t\t\t\t*Username:\n\t\t\t\t</td><td>\n\t\t\t\t\t<input type='text' name='" . RequestContext::name("username") . "' />\n\t\t\t\t</td></tr>\n\t\t\t\t<tr><td>\n\t\t\t\t\t*Password:\n\t\t\t\t</td><td>\n\t\t\t\t\t<input type='password' name='" . RequestContext::name("password") . "' />\n\t\t\t\t</td></tr>"; // break; //} print "<tr><td>\n\t\t\t*" . _("Add to type: ") . "\n\t\t\t</td><td>\n\t\t\t\t<select name='" . RequestContext::name("authn_type") . "'>"; $authNManager = Services::getService("AuthN"); $typesIterator = $authNManager->getAuthenticationTypes(); while ($typesIterator->hasNext()) { $tempType = $typesIterator->next(); $authNMethods = Services::getService("AuthNMethods"); try { $tempMethod = $authNMethods->getAuthNMethodForType($tempType); if (!$tempMethod->supportsTokenAddition()) { continue; } print "<option value='" . HarmoniType::typeToString($tempType) . "'>" . HarmoniType::typeToString($tempType) . "</option>"; } catch (Exception $e) { // Skip if is not available, such as the change-user type } } print "</select>"; print "</td></tr>"; print "\t<tr><td>\n\t\t\t\t\tDisplay Name:\n\t\t\t\t</td><td>\n\t\t\t\t\t<input type='text' name='" . RequestContext::name("display_name") . "' />\n\t\t\t\t</td></tr>\n\t<!--\t\t\t<tr><td>\n\t\t\t\t\tDepartment:\n\t\t\t\t</td><td>\n\t\t\t\t\t<input type='text' name='" . RequestContext::name("property_department") . "' />\n\t\t\t\t</td></tr> -->\n\t\t\t\t</table>\t\n\t\t\t\t<input type='submit' value='Create New User' />\n\t\t\t\t<input type='hidden' name='" . RequestContext::name("form_submitted") . "' value='true' />\n\t\t\t\t</form></center>"; }