/**
  * Stores the configuration. Calls the parent configuration first,
  * then does additional operations.
  * 
  * @param object Properties $configuration
  * @return object
  * @access public
  * @since 3/24/05
  */
 function assignConfiguration(Properties $configuration)
 {
     // Set the configuration values to our custom values.
     $configuration->addProperty('authentication_table', 'auth_visitor');
     $configuration->addProperty('username_field', 'email');
     $configuration->addProperty('password_field', 'password');
     $propertiesFields = array('name' => 'display_name', 'email' => 'email');
     $configuration->addProperty('properties_fields', $propertiesFields);
     try {
         ArgumentValidator::validate($configuration->getProperty('email_from_name'), NonzeroLengthStringValidatorRule::getRule());
     } catch (InvalidArgumentException $e) {
         throw new ConfigurationErrorException("'email_from_name' must be a string. " . $e->getMessage());
     }
     try {
         ArgumentValidator::validate($configuration->getProperty('email_from_address'), RegexValidatorRule::getRule('/^.+@.+$/'));
     } catch (InvalidArgumentException $e) {
         throw new ConfigurationErrorException("'email_from_address' must be an email address. " . $e->getMessage());
     }
     try {
         ArgumentValidator::validate($configuration->getProperty('domain_blacklist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule())));
         ArgumentValidator::validate($configuration->getProperty('domain_whitelist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule())));
     } catch (InvalidArgumentException $e) {
         throw new ConfigurationErrorException("'domain_blacklist' and 'domain_whitelist' if specified must be arrays of domain name strings. " . $e->getMessage());
     }
     parent::assignConfiguration($configuration);
 }
Example #2
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function UrlSC($value)
 {
     $errDescription = "Could not validate the url StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: url(URL), where URL is an absolute or relative link \n\t   \t\t\t\t\t   (optionally quoted with single or double quotes).";
     $rule = RegexValidatorRule::getRule("/^url\\(.+\\)\$/");
     $displayName = "URL";
     $description = "Specifies a url linking to a resource (an image, an audio file, etc).\n\t\t\t\t\t\tAllowed values are: url(URL), where URL is an absolute or relative link \n\t\t\t\t\t\t(optionally quoted with single or double quotes).";
     $this->StyleComponent($value, $rule, null, null, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function TextSpacingSC($value)
 {
     $options = array("normal");
     $errDescription = "Could not validate the text-spacing StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . "\n  \t\t\t\t\t       or a specific distance value (in length units, i.e. px,\n\t\t\t\t\t\t   in, etc. but NOT %).";
     $rule = RegexValidatorRule::getRule("/^(normal|-?[0-9]+(\\.[0-9]+)?(in|cm|mm|em|ex|pt|pc|px))\$/");
     $displayName = "Text Spacing";
     $description = "Affects the text spacing between words. Allowed values are: " . implode(", ", $options) . "\n  \t\t\t\t\t    or a specific distance value (in length units, i.e. px,\n\t\t\t\t\t\tin, etc. but NOT %).";
     $this->StyleComponent($value, $rule, $options, false, $errDescription, $displayName, $description);
 }
Example #4
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function FontStyleSC($value = null)
 {
     $options = array("normal", "italic", "oblique");
     $errDescription = "Could not validate the font-style StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Font Style";
     $description = "Specifies the font style. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #5
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function RepeatSC($value)
 {
     $options = array("repeat", "repeat-x", "repeat-y", "no-repeat");
     $errDescription = "Could not validate the Repeat StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Repeat";
     $description = "Specifies the values for CSS property 'repeat'. Allowed values are: \n\t\t\t\t\t\t" . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function LineHeightSC($value)
 {
     $options = array("normal");
     $errDescription = "Could not validate the line-height StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ", a non-negative\n\t\t\t\t\t\t   multiplier, or a specific line-height value \n\t\t\t\t\t\t   (a length value, i.e. px, in, %, etc.).";
     $rule = RegexValidatorRule::getRule("/^(normal|-?[0-9]+(\\.[0-9]+)?(%|in|cm|mm|em|ex|pt|pc|px)|[0-9]+(\\.[0-9]+)?)\$/");
     $displayName = "Line Height";
     $description = "Specifies the line height. This property allows one to modify\n\t\t\t\t\t\tthe distance between text lines. For example, you can use it to achieve the effect\n\t\t\t\t\t\tof a double-spaced text. Allowed values are: " . implode(", ", $options) . ", a non-negative\n\t\t\t\t\t\tmultiplier (use 2 for double-spaced text), or a specific line-height value \n\t\t\t\t\t\t(a length value, i.e. px, in, %, etc.).";
     $this->StyleComponent($value, $rule, $options, false, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function FontVariantSC($value = null)
 {
     $options = array("normal", "small-caps");
     $errDescription = "Could not validate the font-variant StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Font Variant";
     $description = "Specifies the font variant. This property allows one to\n\t\t\t\t\t\tcreate text composed of capital letters. Allowed values \n\t\t\t\t\t\tare: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #8
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function PositionSC($value)
 {
     $options = array("static", "relative", "absolute", "fixed");
     $errDescription = "Could not validate the position StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Position";
     $description = "Specifies the position property value. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #9
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function DisplaySC($value)
 {
     $options = array("none", "inline", "block", "list-item");
     $errDescription = "Could not validate the display StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Display";
     $description = "Specifies the display value to use. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #10
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function CursorSC($value)
 {
     $options = array("auto", "n-resize", "ne-resize", "e-resize", "se-resize", "s-resize", "sw-resize", "w-resize", "nw-resize", "crosshair", "pointer", "move", "text", "wait", "help", "hand");
     $errDescription = "Could not validate the cursor StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Cursor";
     $description = "Specifies the cursor type to use when the pointing device is over\n\t\t\t\t\t    the element . Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #11
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function AttachmentSC($value)
 {
     $options = array("scroll", "fixed");
     $errDescription = "Could not validate the Attachment StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Attachment";
     $description = "Specifies the values for CSS property 'attachment'. Allowed values are: \n\t\t\t\t\t\t" . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #12
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function FontWeightSC($value = null)
 {
     $options = array("100", "200", "300", "400", "500", "600", "700", "800", "900", "normal", "bold", "lighter", "bolder");
     $errDescription = "Could not validate the font-weight StyleComponent value \"%s\".\n\t\t\t\t\t\t   Allowed values are: " . implode(", ", $options) . ".";
     $displayName = "Font Weight";
     $description = "Specifies the font weight (thickness). Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function TextDecorationSC($value)
 {
     $options = array("none", "underline", "overline", "line-through", "blink");
     $errDescription = "Could not validate the text-decoration StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Text Decoration";
     $description = "Specifies the text decoration. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #14
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function TextAlignSC($value)
 {
     $options = array("left", "right", "center", "justify");
     $errDescription = "Could not validate the text-align StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Text Alignment";
     $description = "Specifies the text alignment. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function BorderStyleSC($value)
 {
     $options = array("none", "dotted", "dashed", "solid", "groove", "ridge", "inset", "outset", "double");
     $errDescription = "Could not validate the border-style StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Border Style";
     $description = "Specifies the border style. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #16
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function WhiteSpaceSC($value)
 {
     $options = array("normal", "pre", "nowrap");
     $errDescription = "Could not validate the white-space StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "White Space";
     $description = "Specifies the white space property. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #17
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function DirectionSC($value)
 {
     $options = array("ltr", "rtl");
     $errDescription = "Could not validate the direction StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Direction";
     $description = "Specifies the text direction (left-to-right or right-to-left).\n\t\t\t\t\t\tAllowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function BackgroundAttachmentSC($value)
 {
     $options = array("scroll", "fixed");
     $errDescription = "Could not validate the background-attachment StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Background Attachment";
     $description = "Specifies the background-attachment value. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #19
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function OverflowSC($value)
 {
     $options = array("visible", "hidden", "scroll", "auto");
     $errDescription = "Could not validate the overflow StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Overflow";
     $description = "Specifies the overflow property value. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #20
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function VisibilitySC($value)
 {
     $options = array("visible", "hidden", "collapse");
     $errDescription = "Could not validate the visiblity StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Visibility";
     $description = "Specifies the visibility. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function TextTransformSC($value)
 {
     $options = array("none", "capitalize", "uppercase", "lowercase");
     $errDescription = "Could not validate the text-transform StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Text Transform";
     $description = "Specifies the text transformation. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #22
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function ZIndexSC($value)
 {
     $options = array("auto");
     $errDescription = "Could not validate the z-index StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . " or a \n\t\t\t\t\t\t\tspecific integer value.";
     $rule = RegexValidatorRule::getRule("/^(auto|-?[0-9]+)\$/");
     $displayName = "Z-Index";
     $description = "Specifies the z-index. Allowed values are: " . implode(", ", $options) . ".\n\t\t\t\t\t\tor a specific integer value.";
     $this->StyleComponent($value, $rule, $options, false, $errDescription, $displayName, $description);
 }
Example #23
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function FloatSC($value)
 {
     $options = array("none", "left", "right");
     $errDescription = "Could not validate the float StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Float";
     $description = "Specifies whether an element will float left, right, or not float at all. \n\t\t\t\t\t\tAllowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
Example #24
0
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @access public
  **/
 function ClearSC($value)
 {
     $options = array("none", "left", "right", "both");
     $errDescription = "Could not validate the clear StyleComponent value \"%s\". ";
     $errDescription .= "Allowed values are " . implode(", ", $options) . ".";
     $displayName = "Clear";
     $description = "Specifies the clear value. Allowed values are: " . implode(", ", $options) . ".";
     $rule = RegexValidatorRule::getRuleByArray($options);
     $this->StyleComponent($value, $rule, $options, true, $errDescription, $displayName, $description);
 }
 /**
  * Stores the configuration. Calls the parent configuration first,
  * then does additional operations.
  *
  * @param object Properties $configuration
  * @return object
  * @access public
  * @since 3/24/05
  */
 function assignConfiguration(Properties $configuration)
 {
     parent::assignConfiguration($configuration);
     $format = $configuration->getProperty('DISPLAY_NAME_FORMAT');
     ArgumentValidator::validate($format, RegexValidatorRule::getRule('/\\[\\[([^]]+)\\]\\]/'));
     $this->displayNameFormat = $format;
     if ($debug = $configuration->getProperty('CAS_DEBUG_PATH')) {
         ArgumentValidator::validate($debug, StringValidatorRule::getRule());
         phpCAS::setDebug($debug);
     }
     $host = $configuration->getProperty('CAS_HOST');
     ArgumentValidator::validate($host, RegexValidatorRule::getRule('/^[a-z0-9]+\\.[a-z0-9]+.[a-z]+$/'));
     $port = $configuration->getProperty('CAS_PORT');
     ArgumentValidator::validate($port, RegexValidatorRule::getRule('/^[0-9]+$/'));
     $path = $configuration->getProperty('CAS_PATH');
     ArgumentValidator::validate($path, RegexValidatorRule::getRule('/^\\/.*$/'));
     phpCAS::client(CAS_VERSION_2_0, $host, intval($port), $path, false);
     if ($cert = $configuration->getProperty('CAS_CERT')) {
         phpCAS::setCasServerCACert($cert);
     } else {
         phpCAS::setNoCasServerValidation();
     }
     // Allow group lookup via a CASDirectory:
     // https://mediawiki.middlebury.edu/wiki/LIS/CAS_Directory
     $dirUrl = $configuration->getProperty('CASDIRECTORY_BASE_URL');
     ArgumentValidator::validate($dirUrl, StringValidatorRule::getRule());
     $this->directoryUrl = $dirUrl;
     // set the callback URL for the PGT to be sent to. This must be an https url
     // whose certificate is trusted by CAS.
     // 		$callbackUrl = $configuration->getProperty('CALLBACK_URL');
     // 		ArgumentValidator::validate($callbackUrl, RegexValidatorRule::getRule('/^https:\/\/.*$/'));
     // 		phpCAS::setFixedCallbackURL($callbackUrl);
     $adminAccess = $configuration->getProperty('CASDIRECTORY_ADMIN_ACCESS');
     ArgumentValidator::validate($adminAccess, StringValidatorRule::getRule());
     $this->adminAccess = $adminAccess;
     $classRoot = $configuration->getProperty('CASDIRECTORY_CLASS_ROOT');
     if ($classRoot) {
         ArgumentValidator::validate($classRoot, StringValidatorRule::getRule());
         $this->classRoot = $classRoot;
     } else {
         $this->classRoot = null;
     }
     $groupIdRegex = $configuration->getProperty('CASDIRECTORY_GROUP_ID_REGEX');
     if ($groupIdRegex) {
         ArgumentValidator::validate($groupIdRegex, StringValidatorRule::getRule());
         $this->groupIdRegex = $groupIdRegex;
     } else {
         $this->groupIdRegex = null;
     }
     // Root Groups to expose
     ArgumentValidator::validate($configuration->getProperty('ROOT_GROUPS'), ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule()));
     $this->rootGroups = array_unique($configuration->getProperty('ROOT_GROUPS'));
 }
Example #26
0
 /**
  * Answer a slot based on shortname
  * 
  * @param string shortname
  * @return array
  * @access public
  * @since 8/16/07
  */
 public function getSlotByShortname($shortname)
 {
     ArgumentValidator::validate($shortname, NonzeroLengthStringValidatorRule::getRule());
     $shortname = strtolower($shortname);
     ArgumentValidator::validate($shortname, RegexValidatorRule::getRule('/^[a-z0-9\\._-]+$/'));
     if (!isset($this->slots[$shortname])) {
         $this->getSlots();
         if (!isset($this->slots[$shortname])) {
             $this->loadSlotsFromDB(array($shortname));
         }
         if (!isset($this->slots[$shortname])) {
             $slotClass = $this->slotTypes[Slot::custom];
             $this->slots[$shortname] = new $slotClass($shortname);
         }
     }
     return $this->slots[$shortname];
 }
 /**
  * The constructor.
  * @param string value The value to assign to this SC.
  * @param ref object rule The ValidatorRule that will be used to validate the 
  * values of this SC. If <code>NULL</code>, no validator rule will be used.
  * @param array options An array of strings that represents the allowed values 
  * (i.e. the list of options) of this SC. If this argument is not null, hasOptions()
  * will return <code>true</code> and getOptions() will return an iterator of
  * the options. In addition, if <code>limitedToOptions</code> is set to <code>TRUE</code>,
  * then a new ChoiceValidatorRule will be created with the given options. 
  * If this argument is <code>null</code>, then hasOptions() will
  * return <code>false</code>.
  * @param mixed limitedToOptions This is either a boolean or null. If TRUE, 
  * a new ChoiceValidatorRule will be created for the given list of options. 
  * If <code>limitedToOptions</code> is not set, then the value of the argument is irrelevant.
  * FALSE and <code>null</code> will result the same behavior but it is recommended
  * that <code>FALSE</code> is used whenever <code>options</code> is set, and <code>null</code>
  * if not.
  * @param ref mixed This is one of the following two: 1) The ValidatorRule
  * that will be used to validate the values of this SC, or 2) An array of strings
  * that represents the allowed values (i.e. the list of options) of this SC. Pass the
  * array whenever you want hasOptions() and getOptions to function accordingly.
  * @param ref object error This is the Error to throw when validation fails.
  * @param string displayName The display name of the SC.
  * @param string description The description of the SC.
  * @access public
  **/
 function StyleComponent($value, $rule, $options, $limitedToOptions, $errorDescription, $displayName, $description)
 {
     if (isset($rule) && !is_null($rule)) {
         $this->_rule = $rule;
     } else {
         //always true regex rule
         $this->_rule = RegexValidatorRule::getRule("/.*/");
     }
     if (func_num_args() < 7) {
         throwError(new Error("Too few parameters for StyleComponent", "GUIManager", true));
     }
     $this->_displayName = $displayName;
     $this->_description = $description;
     $this->_errorDescription = $errorDescription;
     $this->_limitedToOptions = false;
     $this->_options = array();
     if (isset($options) && is_array($options)) {
         // the SC will have a list of options
         $this->_options = $options;
         if ($limitedToOptions) {
             // create the appropriate ChoiceValidatorRule with the given options
             $this->_limitedToOptions = true;
             //$choiceRule = ChoiceValidatorRule::getRule($options);
             //$this->_rule = AndValidatorRule::getRule($this->_rule, $choiceRule);
         }
         //else
         //	$this->_rule = OrValidatorRule::getRule($this->_rule, ChoiceValidatorRule::getRule($options));
     }
     // validate the value
     if (!$this->_rule->check($value)) {
         throwError(new Error($this->_errorDescription, "GUIManager", true));
     }
     $this->_value = $value;
 }
Example #28
0
 /**
  * Optional: Add an enclosure. As of this writing the RSS 2.0 spec does not
  * allow multiple enclosures. Some aggregators however, support them anyway
  * and the one's I've (Adam) tested in simply ignore the extra enclosures.
  * Add multiple enclosures at your own risk.
  * 
  * @param string $url
  * @param integer $length
  * @param string $mimeType
  * @return void
  * @access public
  * @since 8/7/06
  */
 function addEnclosure($url, $length, $mimeType)
 {
     ArgumentValidator::validate($url, StringValidatorRule::getRule());
     ArgumentValidator::validate($length, IntegerValidatorRule::getRule());
     ArgumentValidator::validate($mimeType, RegexValidatorRule::getRule('/^(text|image|audio|video|application)\\/.+$/'));
     $this->_enclosures[] = array('url' => $url, 'length' => $length, 'mimeType' => $mimeType);
 }
 /**
  * Assign the configuration of this Manager. Valid configuration options are as
  * follows:
  *	database_index			integer
  *	database_name			string
  * 
  * @param object Properties $configuration (original type: java.util.Properties)
  * 
  * @throws object OsidException An exception with one of the following
  *		   messages defined in org.osid.OsidException:	{@link
  *		   org.osid.OsidException#OPERATION_FAILED OPERATION_FAILED},
  *		   {@link org.osid.OsidException#PERMISSION_DENIED
  *		   PERMISSION_DENIED}, {@link
  *		   org.osid.OsidException#CONFIGURATION_ERROR
  *		   CONFIGURATION_ERROR}, {@link
  *		   org.osid.OsidException#UNIMPLEMENTED UNIMPLEMENTED}, {@link
  *		   org.osid.OsidException#NULL_ARGUMENT NULL_ARGUMENT}
  * 
  * @access public
  */
 function assignConfiguration(Properties $configuration)
 {
     $this->_configuration = $configuration;
     $hierarchyId = $configuration->getProperty('hierarchy_id');
     $agentFlavor = $configuration->getProperty('defaultAgentFlavor');
     // ** parameter validation
     ArgumentValidator::validate($hierarchyId, StringValidatorRule::getRule(), true);
     ArgumentValidator::validate($agentFlavor, StringValidatorRule::getRule(), true);
     // ** end of parameter validation
     $idManager = Services::getService("Id");
     $this->_hierarchyId = $idManager->getId($hierarchyId);
     $this->_agentFlavor = $agentFlavor;
     $hierarchyManager = Services::getService("Hierarchy");
     $hierarchy = $hierarchyManager->getHierarchy($this->_hierarchyId);
     if ($this->_configuration->getProperty('group_ip_ranges')) {
         ArgumentValidator::validate($this->_configuration->getProperty('group_ip_ranges'), ArrayValidatorRule::getRule());
         $stringRule = NonzeroLengthStringValidatorRule::getRule();
         $rangeRule = RegexValidatorRule::getRule('/^([0-9]{1,3}|\\*|[0-9]{1,3}-[0-9]{1,3})\\.([0-9]{1,3}|\\*|[0-9]{1,3}-[0-9]{1,3})\\.([0-9]{1,3}|\\*|[0-9]{1,3}-[0-9]{1,3})\\.([0-9]{1,3}|\\*|[0-9]{1,3}-[0-9]{1,3})$/');
         foreach ($this->_configuration->getProperty('group_ip_ranges') as $groupIdString => $range) {
             ArgumentValidator::validate($groupIdString, $stringRule);
             ArgumentValidator::validate($range, $rangeRule);
         }
     }
     // initialize our Agent Search Types
     $this->_agentSearches = array();
     $this->_agentSearches["Agent & Group Search::edu.middlebury.harmoni::TokenSearch"] = new TokenSearch();
     $this->_agentSearches["Agent & Group Search::edu.middlebury.harmoni::AgentPropertiesSearch"] = new AgentPropertiesSearch($this->_configuration->getProperty('database_index'));
     // initialize our Group Search Types
     $this->_groupSearches = array();
     $this->_groupSearches["Agent & Group Search::edu.middlebury.harmoni::AncestorGroups"] = new AncestorGroupSearch($hierarchy);
     $this->_groupSearches["Agent & Group Search::edu.middlebury.harmoni::RootGroups"] = new RootGroupSearch($hierarchy);
     $this->_groupSearches["Agent & Group Search::edu.middlebury.harmoni::TokenSearch"] = $this->_agentSearches["Agent & Group Search::edu.middlebury.harmoni::TokenSearch"];
     $this->_groupSearches["Agent & Group Search::edu.middlebury.harmoni::AgentPropertiesSearch"] = $this->_agentSearches["Agent & Group Search::edu.middlebury.harmoni::AgentPropertiesSearch"];
     $this->_everyoneGroup = new EveryoneGroup($hierarchy, $hierarchy->getNode($this->_everyoneId));
 }