Exemplo n.º 1
0
									<p>
										<?php 
    echo gettext('Tag matching:');
    generateRadiobuttonsFromArray((int) getOption('exact_tag_match'), array(gettext('<em>partial</em>') => 0, gettext('<em>word</em>') => 2, gettext('<em>exact</em>') => 1), 'tag_match', false, false);
    ?>
									</p>
									<p>
										<?php 
    echo gettext('Treat spaces as');
    generateRadiobuttonsFromArray(getOption('search_space_is'), array(gettext('<em>space</em>') => '', gettext('<em>OR</em>') => 'OR', gettext('<em>AND</em>') => 'AND'), 'search_space_is', false, false);
    ?>
									</p>
									<p>
										<?php 
    echo gettext('Default search');
    generateRadiobuttonsFromArray(getOption('search_within'), array(gettext('<em>New</em>') => '0', gettext('<em>Within</em>') => '1'), 'search_within', false, false);
    ?>
									</p>
									<p>
										<label>
											<input type="checkbox" name="search_no_albums" value="1" <?php 
    checked('1', getOption('search_no_albums'));
    ?>
 />
											<?php 
    echo gettext('Do not return <em>album</em> matches');
    ?>
										</label>
									</p>
									<p>
										<label>
Exemplo n.º 2
0
function customOptions($optionHandler, $indent = "", $album = NULL, $showhide = false, $supportedOptions = NULL, $theme = false, $initial = 'none', $extension = NULL)
{
    if (is_null($supportedOptions)) {
        $supportedOptions = $optionHandler->getOptionsSupported();
    }
    if (count($supportedOptions) > 0) {
        $whom = get_class($optionHandler);
        $options = $supportedOptions;
        $option = array_shift($options);
        if (array_key_exists('order', $option)) {
            $options = sortMultiArray($supportedOptions, 'order', false, true, false, true);
            $options = array_keys($options);
        } else {
            $options = array_keys($supportedOptions);
            natcasesort($options);
        }
        if (method_exists($optionHandler, 'handleOptionSave')) {
            ?>
				<input type="hidden" name="<?php 
            echo CUSTOM_OPTION_PREFIX;
            ?>
save-<?php 
            echo $whom;
            ?>
" value="<?php 
            echo $extension;
            ?>
" />
				<?php 
        }
        foreach ($options as $option) {
            $descending = NULL;
            $row = $supportedOptions[$option];
            if (false !== ($i = stripos($option, chr(0)))) {
                $option = substr($option, 0, $i);
            }
            $type = $row['type'];
            $desc = $row['desc'];
            $key = @$row['key'];
            $postkey = postIndexEncode($key);
            $optionID = $whom . '_' . $key;
            if (isset($row['multilingual'])) {
                $multilingual = $row['multilingual'];
            } else {
                $multilingual = $type == OPTION_TYPE_TEXTAREA;
            }
            if ($type == OPTION_TYPE_RICHTEXT || isset($row['texteditor']) && $row['texteditor']) {
                $editor = 'texteditor';
            } else {
                $editor = '';
            }
            if (isset($row['disabled']) && $row['disabled']) {
                $disabled = ' disabled="disabled"';
            } else {
                $disabled = '';
            }
            if (isset($row['deprecated']) && $option) {
                $deprecated = $row['deprecated'];
                if (!$deprecated) {
                    $deprecatedd = gettext('Deprecated.');
                }
                $option = '<div class="warningbox">' . $option . '<br /><em>' . $deprecated . '</em></div>';
            }
            if ($theme) {
                $v = getThemeOption($key, $album, $theme);
            } else {
                $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($key);
                $db = query_single_row($sql);
                if ($db) {
                    $v = $db['value'];
                } else {
                    $v = NULL;
                }
            }
            if ($showhide) {
                ?>
					<tr id="tr_<?php 
                echo $optionID;
                ?>
" class="<?php 
                echo $showhide;
                ?>
extrainfo" style="display:<?php 
                echo $initial;
                ?>
">
						<?php 
            } else {
                ?>
					<tr id="tr_<?php 
                echo $optionID;
                ?>
">
						<?php 
            }
            if ($type != OPTION_TYPE_NOTE) {
                ?>
						<td width="175"><?php 
                if ($option) {
                    echo $indent . $option;
                }
                ?>
</td>
						<?php 
            }
            switch ($type) {
                case OPTION_TYPE_NOTE:
                    ?>
							<td colspan="3"><?php 
                    echo $desc;
                    ?>
</td>
							<?php 
                    break;
                case OPTION_TYPE_NUMBER:
                case OPTION_TYPE_CLEARTEXT:
                case OPTION_TYPE_PASSWORD:
                case OPTION_TYPE_TEXTBOX:
                case OPTION_TYPE_TEXTAREA:
                case OPTION_TYPE_RICHTEXT:
                    $clear = '';
                    $wide = '338px';
                    switch ($type) {
                        case OPTION_TYPE_CLEARTEXT:
                            $clear = 'clear';
                            $multilingual = false;
                        default:
                            $inputtype = 'text';
                            break;
                        case OPTION_TYPE_PASSWORD:
                            $inputtype = 'password" autocomplete="off';
                            $multilingual = false;
                            break;
                        case OPTION_TYPE_NUMBER:
                            $multilingual = false;
                            $clear = 'numeric';
                            if (!is_numeric($v)) {
                                $v = 0;
                            }
                            $wide = '100px';
                            if (isset($row['limits'])) {
                                $inputtype = 'number';
                                if (isset($row['limits']['min'])) {
                                    $inputtype .= '" min="' . $row['limits']['min'];
                                }
                                if (isset($row['limits']['max'])) {
                                    $inputtype .= '" max="' . $row['limits']['max'];
                                }
                                if (isset($row['limits']['step'])) {
                                    $inputtype .= '" step="' . $row['limits']['step'];
                                } else {
                                    $inputtype .= '" step="1';
                                }
                            } else {
                                $inputtype = 'number" min="0" step="1';
                            }
                            break;
                    }
                    ?>
							<td width="350">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . $clear . 'text-' . $postkey;
                    ?>
" value="1" />
								<?php 
                    if ($multilingual) {
                        print_language_string_list($v, $postkey, $type, NULL, $editor);
                    } else {
                        if ($type == OPTION_TYPE_TEXTAREA || $type == OPTION_TYPE_RICHTEXT) {
                            $v = get_language_string($v);
                            // just in case....
                            ?>
										<textarea id="<?php 
                            echo $key;
                            ?>
"<?php 
                            if ($type == OPTION_TYPE_RICHTEXT) {
                                echo ' class="texteditor"';
                            }
                            ?>
 name="<?php 
                            echo $postkey;
                            ?>
" cols="<?php 
                            echo TEXTAREA_COLUMNS;
                            ?>
"	style="width: 320px" rows="6"<?php 
                            echo $disabled;
                            ?>
><?php 
                            echo html_encode($v);
                            ?>
</textarea>
										<?php 
                        } else {
                            ?>
										<input type="<?php 
                            echo $inputtype;
                            ?>
" id="<?php 
                            echo $key;
                            ?>
" name="<?php 
                            echo $postkey;
                            ?>
" style="width: <?php 
                            echo $wide;
                            ?>
" value="<?php 
                            echo html_encode($v);
                            ?>
"<?php 
                            echo $disabled;
                            ?>
 />
										<?php 
                        }
                    }
                    ?>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_CHECKBOX:
                    ?>
							<td width="350">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'chkbox-' . $postkey;
                    ?>
" value="1" />
								<input type="checkbox" id="<?php 
                    echo $key;
                    ?>
" name="<?php 
                    echo $postkey;
                    ?>
" value="1" <?php 
                    checked('1', $v);
                    echo $disabled;
                    ?>
 />
							</td>
							<?php 
                    break;
                case OPTION_TYPE_CUSTOM:
                    ?>
							<td width="350">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'custom-' . $postkey;
                    ?>
" value="0" />
								<?php 
                    $optionHandler->handleOption($key, $v);
                    ?>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_RADIO:
                    $behind = isset($row['behind']) && $row['behind'];
                    ?>
							<td width="350">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'radio-' . $postkey;
                    ?>
" value="1"<?php 
                    echo $disabled;
                    ?>
 />
								<?php 
                    generateRadiobuttonsFromArray($v, $row['buttons'], $postkey, $behind, 'checkboxlabel', $disabled);
                    ?>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_SELECTOR:
                    $descending = false;
                case OPTION_TYPE_ORDERED_SELECTOR:
                    ?>
							<td width="350">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'selector-' . $postkey;
                    ?>
" value="1" />
								<select id="<?php 
                    echo $key;
                    ?>
" name="<?php 
                    echo $postkey;
                    ?>
"<?php 
                    echo $disabled;
                    ?>
 >
									<?php 
                    if (array_key_exists('null_selection', $row)) {
                        ?>
										<option value=""<?php 
                        if (empty($v)) {
                            echo ' selected="selected"';
                        }
                        ?>
 style="background-color:LightGray;"><?php 
                        echo $row['null_selection'];
                        ?>
</option>
										<?php 
                    }
                    $list = array();
                    foreach ($row['selections'] as $rowkey => $rowvalue) {
                        $list[$rowkey] = $rowvalue;
                    }
                    generateListFromArray(array($v), $list, $descending, true);
                    ?>
								</select>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_CHECKBOX_ARRAY:
                    $behind = isset($row['behind']) && $row['behind'];
                    ?>
							<td width="350">
								<?php 
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        if ($theme) {
                            $v = getThemeOption($checkbox, $album, $theme);
                        } else {
                            $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($checkbox);
                            $db = query_single_row($sql);
                            if ($db) {
                                $v = $db['value'];
                            } else {
                                $v = 0;
                            }
                        }
                        $display = str_replace(' ', '&nbsp;', $display);
                        ?>
									<input type="hidden" name="<?php 
                        echo CUSTOM_OPTION_PREFIX . 'chkbox-' . postIndexEncode($checkbox);
                        ?>
" value="1" />
									<label class="checkboxlabel">
										<?php 
                        if ($behind) {
                            echo $display;
                        }
                        ?>
										<input type="checkbox" id="<?php 
                        echo $checkbox;
                        ?>
" name="<?php 
                        echo postIndexEncode($checkbox);
                        ?>
" value="1"<?php 
                        checked('1', $v);
                        echo $disabled;
                        ?>
 />
										<?php 
                        if (!$behind) {
                            echo $display;
                        }
                        ?>
									</label>
									<?php 
                    }
                    ?>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_CHECKBOX_UL:
                    ?>
							<td width="350">
								<?php 
                    $all = true;
                    $cvarray = array();
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        ?>
									<input type="hidden" name="<?php 
                        echo CUSTOM_OPTION_PREFIX . 'chkbox-' . postIndexEncode($checkbox);
                        ?>
" value="1" />
									<?php 
                        if ($theme) {
                            $v = getThemeOption($checkbox, $album, $theme);
                        } else {
                            $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($checkbox);
                            $db = query_single_row($sql);
                            if ($db) {
                                $v = $db['value'];
                            } else {
                                $v = 0;
                            }
                        }
                        if ($v) {
                            $cvarray[] = $checkbox;
                        } else {
                            $all = false;
                        }
                    }
                    ?>
								<ul class="customchecklist">
									<?php 
                    generateUnorderedListFromArray($cvarray, $row['checkboxes'], '', '', true, true, 'all_' . $key);
                    ?>
								</ul>
								<script type="text/javascript">
									// <!-- <![CDATA[
									function <?php 
                    echo $key;
                    ?>
_all() {
										var check = $('#all_<?php 
                    echo $key;
                    ?>
').prop('checked');
										$('.all_<?php 
                    echo $key;
                    ?>
').prop('checked', check);
									}
									// ]]> -->
								</script>
								<label>
									<input type="checkbox" name="all_<?php 
                    echo $key;
                    ?>
" id="all_<?php 
                    echo $key;
                    ?>
" class="all_<?php 
                    echo $key;
                    ?>
" onclick="<?php 
                    echo $key;
                    ?>
_all();" <?php 
                    if ($all) {
                        echo ' checked="checked"';
                    }
                    ?>
/>
									<?php 
                    echo gettext('all');
                    ?>
								</label>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_COLOR_PICKER:
                    if (empty($v)) {
                        $v = '#000000';
                    }
                    ?>
							<td width="350" style="margin:0; padding:0">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'text-' . $postkey;
                    ?>
" value="1" />
								<script type="text/javascript">
									// <!-- <![CDATA[
									$(document).ready(function () {
										$('#<?php 
                    echo $key;
                    ?>
_colorpicker').farbtastic('#<?php 
                    echo $key;
                    ?>
');
									});
									// ]]> -->
								</script>
								<table style="margin:0; padding:0" >
									<tr>
										<td><input type="text" id="<?php 
                    echo $key;
                    ?>
" name="<?php 
                    echo $postkey;
                    ?>
"	value="<?php 
                    echo $v;
                    ?>
" style="height:100px; width:100px; float:right;" /></td>
										<td><div id="<?php 
                    echo $key;
                    ?>
_colorpicker"></div></td>
									</tr>
								</table>
							</td>
							<?php 
                    break;
                case OPTION_TYPE_SLIDER:
                    $min = $row['min'];
                    $max = $row['max'];
                    ?>
							<td width="350" style="margin:0; padding:0">
								<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'slider-' . $postkey;
                    ?>
" value="1" />
								<?php 
                    putSlider('', $postkey, $min, $max, $v);
                    ?>
							</td>
							<?php 
                    break;
            }
            if ($type != OPTION_TYPE_NOTE) {
                ?>
						<td><?php 
                echo $desc;
                ?>
</td>
						<?php 
            }
            ?>
				</tr>
				<?php 
        }
    }
}
Exemplo n.º 3
0
/**
 * Generates the HTML for custom options (e.g. theme options, plugin options, etc.)
 *
 * @param object $optionHandler the object to handle custom options
 * @param string $indent used to indent the option for nested options
 * @param object $album if not null, the album to which the option belongs
 * @param bool $hide set to true to hide the output (used by the plugin-options folding
 *
 * There are four type of custom options:
 * 		0: a textbox
 * 		1: a checkbox
 * 		2: handled by $optionHandler->handleOption()
 * 		3: a textarea
 * 		4: radio buttons (button names are in the 'buttons' index of the supported options array)
 * 		5: selector (selection list is in the 'selections' index of the supported options array)
 * 		6: checkbox array (checkboxed list is in the 'checkboxes' index of the suppoprted options array.)
 * 		7: checkbox UL (checkboxed list is in the 'checkboxes' index of the suppoprted options array.)
 *
 * type 0 and 3 support multi-lingual strings.
 */
function customOptions($optionHandler, $indent = "", $album = NULL, $hide = false)
{
    $supportedOptions = $optionHandler->getOptionsSupported();
    if (count($supportedOptions) > 0) {
        $options = array_keys($supportedOptions);
        natcasesort($options);
        foreach ($options as $option) {
            $row = $supportedOptions[$option];
            $type = $row['type'];
            $desc = $row['desc'];
            $multilingual = isset($row['multilingual']) && $row['multilingual'];
            if (isset($row['texteditor']) && $row['texteditor']) {
                $editor = 'texteditor';
            } else {
                $editor = '';
            }
            if (isset($row['key'])) {
                $key = $row['key'];
            } else {
                // backward compatibility
                $key = $option;
                $option = str_replace('_', ' ', $option);
            }
            if (is_null($album)) {
                $db = false;
            } else {
                $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`='" . escape($key) . "' AND `ownerid`=" . $album->id;
                $db = query_single_row($sql);
            }
            if (!$db) {
                $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`='" . escape($key) . "';";
                $db = query_single_row($sql);
            }
            if ($db) {
                $v = $db['value'];
            } else {
                $v = 0;
            }
            if ($hide) {
                echo "\n<tr class='" . $hide . "extrainfo' style='display:none'>\n";
            }
            echo '<td width="175">' . $indent . $option . ":</td>\n";
            switch ($type) {
                case 0:
                    // text box
                // text box
                case 3:
                    // text area
                    echo '<td width="350px">';
                    echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'text-' . $key . '" value=0 />' . "\n";
                    if ($multilingual || $type) {
                        print_language_string_list($v, $key, $type, NULL, $editor);
                    } else {
                        echo '<input type="text" size="40" name="' . $key . '" style="width: 338px" value="' . html_encode($v) . '">' . "\n";
                    }
                    echo '</td>' . "\n";
                    break;
                case 1:
                    // check box
                    echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'chkbox-' . $key . '" value=0 />' . "\n";
                    echo '<td width="350px"><input type="checkbox" name="' . $key . '" value="1"';
                    echo checked('1', $v);
                    echo " /></td>\n";
                    break;
                case 2:
                    // custom handling
                    echo '<td width="350px">' . "\n";
                    echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'custom-' . $key . '" value=0 />' . "\n";
                    $optionHandler->handleOption($key, $v);
                    echo "</td>\n";
                    break;
                case 4:
                    // radio button
                    echo '<td width="350px">' . "\n";
                    echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'radio-' . $key . '" value=0 />' . "\n";
                    generateRadiobuttonsFromArray($v, $row['buttons'], $key);
                    echo "</td>\n";
                    break;
                case 5:
                    // selector
                    echo '<td width="350px">' . "\n";
                    echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'selector-' . $key . '" value=0 />' . "\n";
                    echo '<select id="' . $option . '" name="' . $key . '">' . "\n";
                    generateListFromArray(array($v), $row['selections'], false, true);
                    echo "</select>\n";
                    echo "</td>\n";
                    break;
                case 6:
                    // checkbox array
                    echo "<td width=\"350px>\"\n";
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        $ck_sql = str_replace($key, $checkbox, $sql);
                        $db = query_single_row($ck_sql);
                        if ($db) {
                            $v = $db['value'];
                        } else {
                            $v = 0;
                        }
                        $display = str_replace(' ', '&nbsp;', $display);
                        echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'chkbox-' . $checkbox . '" value=0 />' . "\n";
                        echo '<input type="checkbox" name="' . $checkbox . '" value="1"';
                        echo checked('1', $v);
                        echo " />&nbsp;{$display}\n";
                    }
                    echo "</td>\n";
                    break;
                case 7:
                    // checkbox UL
                    echo "<td width=\"350px>\"\n";
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'chkbox-' . $checkbox . '" value=0 />' . "\n";
                    }
                    echo '<ul class="customchecklist">' . "\n";
                    generateUnorderedListFromArray($row['currentvalues'], $row['checkboxes'], '', '', true, true);
                    echo '</ul>';
                    echo "</td>\n";
                    break;
            }
            echo '<td>' . $desc . "</td>\n";
            echo "</tr>\n";
        }
    }
}
Exemplo n.º 4
0
function customOptions($optionHandler, $indent = "", $album = NULL, $showhide = false, $supportedOptions = NULL, $theme = false, $initial = 'none')
{
    if (is_null($supportedOptions)) {
        $supportedOptions = $optionHandler->getOptionsSupported();
    }
    if (count($supportedOptions) > 0) {
        $whom = get_class($optionHandler);
        $options = $supportedOptions;
        $option = array_shift($options);
        if (array_key_exists('order', $option)) {
            $options = sortMultiArray($supportedOptions, 'order');
            $options = array_keys($options);
        } else {
            $options = array_keys($supportedOptions);
            natcasesort($options);
        }
        foreach ($options as $option) {
            $row = $supportedOptions[$option];
            if (false !== ($i = stripos($option, chr(0)))) {
                $option = substr($option, 0, $i);
            }
            $type = $row['type'];
            $desc = $row['desc'];
            $key = $row['key'];
            $optionID = $whom . '_' . $key;
            if (isset($row['multilingual'])) {
                $multilingual = $row['multilingual'];
            } else {
                $multilingual = $type == OPTION_TYPE_TEXTAREA;
            }
            if (isset($row['texteditor']) && $row['texteditor']) {
                $editor = 'texteditor';
            } else {
                $editor = '';
            }
            if (isset($row['disabled']) && $row['disabled']) {
                $disabled = ' disabled="disabled"';
            } else {
                $disabled = '';
            }
            if ($theme) {
                $v = getThemeOption($key, $album, $theme);
            } else {
                $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($key);
                $db = query_single_row($sql);
                if ($db) {
                    $v = $db['value'];
                } else {
                    $v = NULL;
                }
            }
            if ($showhide) {
                ?>
				<tr id="tr_<?php 
                echo $optionID;
                ?>
" class="<?php 
                echo $showhide;
                ?>
extrainfo" style="display:<?php 
                echo $initial;
                ?>
">
				<?php 
            } else {
                ?>
				<tr id="tr_<?php 
                echo $optionID;
                ?>
">
				<?php 
            }
            if ($type != OPTION_TYPE_NOTE) {
                ?>
				<td width="175"><?php 
                if ($option) {
                    echo $indent . $option;
                }
                ?>
</td>
				<?php 
            }
            switch ($type) {
                case OPTION_TYPE_NOTE:
                    ?>
					<td colspan="3"><?php 
                    echo $desc;
                    ?>
</td>
					<?php 
                    break;
                case OPTION_TYPE_CLEARTEXT:
                    $multilingual = false;
                case OPTION_TYPE_TEXTBOX:
                case OPTION_TYPE_TEXTAREA:
                    if ($type == OPTION_TYPE_CLEARTEXT) {
                        $clear = 'clear';
                    } else {
                        $clear = '';
                    }
                    ?>
					<td width="350">
						<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . $clear . 'text-' . $key;
                    ?>
" value="0" />
						<?php 
                    if ($multilingual) {
                        print_language_string_list($v, $key, $type, NULL, $editor);
                    } else {
                        if ($type == OPTION_TYPE_TEXTAREA) {
                            ?>
								<textarea id="<?php 
                            echo $key;
                            ?>
" name="<?php 
                            echo $key;
                            ?>
" cols="<?php 
                            echo TEXTAREA_COLUMNS;
                            ?>
"	style="width: 320px" rows="6"<?php 
                            echo $disabled;
                            ?>
><?php 
                            echo html_encode($v);
                            ?>
</textarea>
								<?php 
                        } else {
                            ?>
								<input type="text" size="40" id="<?php 
                            echo $key;
                            ?>
" name="<?php 
                            echo $key;
                            ?>
" style="width: 338px" value="<?php 
                            echo html_encode($v);
                            ?>
"<?php 
                            echo $disabled;
                            ?>
 />
								<?php 
                        }
                    }
                    ?>
					</td>
					<?php 
                    break;
                case OPTION_TYPE_CHECKBOX:
                    ?>
					<td width="350">
						<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'chkbox-' . $key;
                    ?>
" value="0" />
						<input type="checkbox" id="<?php 
                    echo $key;
                    ?>
" name="<?php 
                    echo $key;
                    ?>
" value="1" <?php 
                    echo checked('1', $v);
                    echo $disabled;
                    ?>
 />
					</td>
					<?php 
                    break;
                case OPTION_TYPE_CUSTOM:
                    ?>
					<td width="350">
						<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'custom-' . $key;
                    ?>
" value="0" />
						<?php 
                    $optionHandler->handleOption($key, $v);
                    ?>
					</td>
					<?php 
                    break;
                case OPTION_TYPE_RADIO:
                    $behind = isset($row['behind']) && $row['behind'];
                    ?>
					<td width="350">
						<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'radio-' . $key;
                    ?>
" value="0"<?php 
                    echo $disabled;
                    ?>
 />
						<?php 
                    generateRadiobuttonsFromArray($v, $row['buttons'], $key, $behind);
                    ?>
					</td>
					<?php 
                    break;
                case OPTION_TYPE_SELECTOR:
                    ?>
					<td width="350">
						<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'selector-' . $key;
                    ?>
" value="0" />
						<select id="<?php 
                    echo $key;
                    ?>
" name="<?php 
                    echo $key;
                    ?>
"<?php 
                    echo $disabled;
                    ?>
 >
							<?php 
                    if (array_key_exists('null_selection', $row)) {
                        ?>
								<option value=""<?php 
                        if (empty($v)) {
                            echo ' selected="selected"';
                        }
                        ?>
><?php 
                        echo $row['null_selection'];
                        ?>
</option>
								<?php 
                    }
                    ?>
							<?php 
                    generateListFromArray(array($v), $row['selections'], false, true);
                    ?>
						</select>
					</td>
					<?php 
                    break;
                case OPTION_TYPE_CHECKBOX_ARRAY:
                    $behind = isset($row['behind']) && $row['behind'];
                    ?>
					<td width="350">
						<?php 
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        if ($theme) {
                            $v = getThemeOption($checkbox, $album, $theme);
                        } else {
                            $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($checkbox);
                            $db = query_single_row($sql);
                            if ($db) {
                                $v = $db['value'];
                            } else {
                                $v = 0;
                            }
                        }
                        $display = str_replace(' ', '&nbsp;', $display);
                        ?>
							<input type="hidden" name="<?php 
                        echo CUSTOM_OPTION_PREFIX . 'chkbox-' . $checkbox;
                        ?>
" value="0" />

							<label class="checkboxlabel">
								<?php 
                        if ($behind) {
                            echo $display;
                        }
                        ?>
								<input type="checkbox" id="<?php 
                        echo $checkbox;
                        ?>
" name="<?php 
                        echo $checkbox;
                        ?>
" value="1"<?php 
                        echo checked('1', $v);
                        echo $disabled;
                        ?>
 />
								<?php 
                        if (!$behind) {
                            echo $display;
                        }
                        ?>
							</label>
							<?php 
                    }
                    ?>
					</td>
					<?php 
                    break;
                case OPTION_TYPE_CHECKBOX_UL:
                    ?>
					<td width="350">
						<?php 
                    $all = true;
                    $cvarray = array();
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        ?>
							<input type="hidden" name="<?php 
                        echo CUSTOM_OPTION_PREFIX . 'chkbox-' . $checkbox;
                        ?>
" value="0" />
							<?php 
                        if ($theme) {
                            $v = getThemeOption($checkbox, $album, $theme);
                        } else {
                            $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($checkbox);
                            $db = query_single_row($sql);
                            if ($db) {
                                $v = $db['value'];
                            } else {
                                $v = 0;
                            }
                        }
                        if ($v) {
                            $cvarray[] = $checkbox;
                        } else {
                            $all = false;
                        }
                    }
                    ?>
						<ul class="customchecklist">
							<?php 
                    generateUnorderedListFromArray($cvarray, $row['checkboxes'], '', '', true, true);
                    ?>
						</ul>
						<script type="text/javascript">
							// <!-- <![CDATA[
							function <?php 
                    echo $key;
                    ?>
_all() {
								var check = $('#all_<?php 
                    echo $key;
                    ?>
').attr('checked');
								<?php 
                    foreach ($row['checkboxes'] as $display => $checkbox) {
                        ?>
									$('#<?php 
                        echo $checkbox;
                        ?>
').attr('checked',check);
									<?php 
                    }
                    ?>
							}
							// ]]> -->
						</script>
						<label>
							<input type="checkbox" name="all_<?php 
                    echo $key;
                    ?>
" id="all_<?php 
                    echo $key;
                    ?>
" onclick="<?php 
                    echo $key;
                    ?>
_all();" <?php 
                    if ($all) {
                        echo ' checked="checked"';
                    }
                    ?>
/>
							<?php 
                    echo gettext('all');
                    ?>
						</label>
					</td>
					<?php 
                    break;
                case OPTION_TYPE_COLOR_PICKER:
                    if (empty($v)) {
                        $v = '#000000';
                    }
                    ?>
					<td width="350" style="margin:0; padding:0">
						<input type="hidden" name="<?php 
                    echo CUSTOM_OPTION_PREFIX . 'text-' . $key;
                    ?>
" value="0" />
						<script type="text/javascript">
							// <!-- <![CDATA[
							$(document).ready(function() {
								$('#<?php 
                    echo $key;
                    ?>
_colorpicker').farbtastic('#<?php 
                    echo $key;
                    ?>
');
							});
							// ]]> -->
						</script>
						<table style="margin:0; padding:0" >
							<tr>
								<td><input type="text" id="<?php 
                    echo $key;
                    ?>
" name="<?php 
                    echo $key;
                    ?>
"	value="<?php 
                    echo $v;
                    ?>
" style="height:100px; width:100px; float:right;" /></td>
								<td><div id="<?php 
                    echo $key;
                    ?>
_colorpicker"></div></td>
							</tr>
						</table>
					</td>
					<?php 
                    break;
            }
            if ($type != OPTION_TYPE_NOTE) {
                ?>
					<td><?php 
                echo $desc;
                ?>
</td>
					<?php 
            }
            ?>
			</tr>
			<?php 
        }
    }
}
Exemplo n.º 5
0
    ?>
					<td>
						<?php 
    echo gettext('Fields list:');
    ?>
						<ul class="searchchecklist">
							<?php 
    generateUnorderedListFromArray($set_fields, $fields, 'SEARCH_', false, true, true, NULL, $extra);
    ?>
						</ul>
						<br />
						<?php 
    echo gettext('Treat spaces as');
    ?>
						<?php 
    generateRadiobuttonsFromArray(getOption('search_space_is'), array(gettext('<em>space</em>') => '', gettext('<em>OR</em>') => 'OR', gettext('<em>AND</em>') => 'AND'), 'search_space_is', false, false);
    ?>

						<p>
							<label>
								<input type="checkbox" name="search_no_albums" value="1" <?php 
    echo checked('1', getOption('search_no_albums'));
    ?>
 />
								<?php 
    echo gettext('Do not return <em>album</em> matches');
    ?>
							</label>
						</p>
						<p>
							<label>