8 const VIEW_META =
'View-Meta';
10 const FORMAT_HEX =
'hex';
11 const FORMAT_TEXT =
'text';
12 const FORMAT_FLOW =
'flow';
14 const TARGET_DEFAULT =
'default';
15 const TARGET_VIEW =
'view';
17 private $formatOptions = array(self::FORMAT_FLOW, self::FORMAT_TEXT, self::FORMAT_HEX);
19 private $textFormats = array(self::FORMAT_HEX, self::FORMAT_TEXT, self::FORMAT_FLOW);
21 private $targets = array(
22 self::TARGET_DEFAULT => array(MicroMenu::VIEW_META, MicroMenu::VIEW),
23 self::TARGET_VIEW => array(MicroMenu::VIEW)
26 public function insert($groups, $name, $position, $module, $uri, $tooltip)
28 if (!is_array($groups)) {
29 $groups = $this->targets[$groups];
34 foreach ($groups as $group) {
52 if (in_array($selectedFormat, $this->formatOptions)) {
53 return $selectedFormat;
56 return self::FORMAT_FLOW;
59 list($type, $dummy) = explode(
"/", $mimeType, 2);
60 return $type ==
'text' ? self::FORMAT_TEXT : self::FORMAT_FLOW;
71 $uri = preg_replace(
"/&format=[a-zA-Z0-9]*/",
"", $uri);
72 $uri = preg_replace(
"/&page=[0-9]*/",
"", $uri);
74 $pageNumberHex = null;
75 $pageNumberText = null;
77 $tooltipTexts = array(
78 self::FORMAT_HEX => _(
"View as a hex dump"),
79 self::FORMAT_TEXT => _(
"View as unformatted text"),
80 self::FORMAT_FLOW => _(
"View as formatted text")
84 self::FORMAT_HEX =>
"Hex",
85 self::FORMAT_TEXT =>
"Text",
86 self::FORMAT_FLOW =>
"Formatted" 92 foreach ($this->textFormats as $currentFormat) {
94 if ($currentFormat == $selectedFormat) {
97 $targetPageNumber = $currentFormat == self::FORMAT_HEX ? $hexFactor * $pageNumberHex : $pageNumber;
98 menu_insert($menuName, $menuPosition--,
"$uri&format=$currentFormat&pageNumber=$targetPageNumber", $tooltipTexts[$currentFormat]);
Traceback_parm($ShowMod=1)
Get the URI query to this location.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
list_t type structure used to keep various lists. (e.g. there are multiple lists).
GetMimeType($Item)
Given an uploadtree_pk, return a string that describes the mime type.