Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add features for living stories pluging

  • Loading branch information...
commit c0b1be30da3c4e4abbd216d379c54bd04a8d1c13 1 parent e379fdf
@hunk authored
View
8 RCCWP_CustomField.php
@@ -62,8 +62,7 @@ function Create($customGroupId, $name, $label, $order = 1, $required_field = 0,
$customFieldId = $wpdb->insert_id;
$field_type = RCCWP_CustomField::GetCustomFieldTypes($type);
- if ($field_type->has_options == "true")
- {
+ if ($field_type->has_options == "true"){
if (!is_array($options)) {
$options = stripslashes($options);
$options = explode("\n", $options);
@@ -89,17 +88,14 @@ function Create($customGroupId, $name, $label, $order = 1, $required_field = 0,
$wpdb->query($sql);
}
- if ($field_type->has_properties == "true")
- {
+ if ($field_type->has_properties == "true"){
$sql = sprintf(
"INSERT INTO " . MF_TABLE_CUSTOM_FIELD_PROPERTIES .
" (custom_field_id, properties) values (%d, %s)",
$customFieldId,
RC_Format::TextToSql(serialize($properties))
);
-
$wpdb->query($sql);
-
}
return $customFieldId;
View
53 RCCWP_CustomWritePanel.php
@@ -139,11 +139,11 @@ function Delete($customWritePanelId = null) {
$customWritePanel = RCCWP_CustomWritePanel::Get($customWritePanelId);
- $sql = sprintf(
+ $sql = sprintf(
"DELETE FROM " . MF_TABLE_PANELS .
" WHERE id = %d",
$customWritePanel->id
- );
+ );
$wpdb->query($sql);
$sql = sprintf(
@@ -181,6 +181,19 @@ function Get($customWritePanelId) {
}
/**
+ * Gets a write panel id based on write panel name.
+ *
+ * @param string $name
+ * @return the write panel id
+ */
+ function GetIdByName($name) {
+ global $wpdb;
+
+ return $wpdb->get_var("SELECT id FROM ".MF_TABLE_PANELS." WHERE name='".$name."'");
+ }
+
+
+ /**
* Get the properties of a write panel
*
* @param unknown_type $customWritePanelId
@@ -518,10 +531,10 @@ function GetCustomGroups($customWritePanelId)
* @param string $panelFilePath the full path of the panel file
* @param string $writePanelName the write panel name, if this value if false, the function will
* use the pnl filename as the write panel name. The default value is false
+ * @param boolean $overwrite whether to overwrite existing panels with the same name
* @return the panel id, or false in case of error.
*/
- function Import($panelFilePath, $writePanelName = false)
- {
+ function Import($panelFilePath, $writePanelName = false, $overwrite = false){
global $wpdb;
include_once('RCCWP_CustomGroup.php');
@@ -534,13 +547,16 @@ function Import($panelFilePath, $writePanelName = false)
if ($writePanelName == '') return false;
- // Append a number if the panel already exists,
- $i = 1;
- $temp_name = $writePanelName;
- while ($wpdb->get_var("SELECT id FROM ".MF_TABLE_PANELS." WHERE name='".$temp_name."'")){
- $temp_name = $writePanelName. "_" . $i++;
+ $writePanelID = RCCWP_CustomWritePanel::GetIdByName($writePanelName);
+ if ($writePanelID && !$overwrite) {
+ // Append a number if the panel already exists,
+ $i = 2;
+ $temp_name = $writePanelName . "_1";
+ while (RCCWP_CustomWritePanel::GetIdByName($temp_name)){
+ $temp_name = $writePanelName. "_" . $i++;
+ }
+ $writePanelName = $temp_name;
}
- $writePanelName = $temp_name;
// Unserialize file
$imported_data = unserialize(file_get_contents($panelFilePath));
@@ -558,8 +574,14 @@ function Import($panelFilePath, $writePanelName = false)
}
}
//Create write panel
- $writePanelID = RCCWP_CustomWritePanel::Create($writePanelName, $imported_data['panel']->description, $imported_data['panel']->standardFieldsIDs, $assignedCategories,$imported_data['panel']->display_order, $imported_data['panel']->type, false,$imported_data['panel']->single,$imported_data['panel']->theme, $imported_data['panel']->parent_page);
-
+ if($writePanelID && $overwrite) {
+ RCCWP_CustomWritePanel::Update($existingPanelId, $writePanelName, $imported_data['panel']->description, $imported_data['panel']->standardFieldsIDs, $assignedCategories,$imported_data['panel']->display_order, $imported_data['panel']->type, false,$imported_data['panel']->single,$imported_data['panel']->theme, $imported_data['panel']->parent_page);
+ foreach (RCCWP_CustomWritePanel::GetCustomGroups($writePanelID) as $group) {
+ RCCWP_CustomGroup::Delete($group->id);
+ }
+ } else {
+ $writePanelID = RCCWP_CustomWritePanel::Create($writePanelName, $imported_data['panel']->description, $imported_data['panel']->standardFieldsIDs, $assignedCategories,$imported_data['panel']->display_order, $imported_data['panel']->type, false,$imported_data['panel']->single,$imported_data['panel']->theme, $imported_data['panel']->parent_page);
+ }
if(is_array($imported_data['fields'])){
foreach($imported_data['fields'] as $groupName => $group){
// For backward compatability
@@ -575,7 +597,11 @@ function Import($panelFilePath, $writePanelName = false)
foreach ($group->fields as $field){
$fieldOptions = @implode("\n", $field->options);
$fieldDefault = @implode("\n", $field->default_value);
- RCCWP_CustomField::Create($groupID, $field->name, $field->description, $field->display_order, $field->required_field, $types[$field->type], $fieldOptions, $fieldDefault, $field->properties, $field->duplicate,$field->help_text,$field->css);
+ if ($field->type == "Related Type") {
+ $field->properties["panel_id"] = RCCWP_CustomWritePanel::GetIdByName($field->properties["panel_name"]);
+ unset($field->properties["panel_name"]);
+ }
+ RCCWP_CustomField::Create($groupID, $field->name, $field->description, $field->display_order, $field->required_field, $types[$field->type], $fieldOptions, $fieldDefault, $field->properties, $field->duplicate,$field->help_text);
}
}
}
@@ -583,7 +609,6 @@ function Import($panelFilePath, $writePanelName = false)
return $writePanelID;
}
-
/**
* Export a write panel to file
View
18 RCCWP_CustomWritePanelPage.php
@@ -362,13 +362,13 @@ function confirmBeforeDelete()
<br class="clear"/>
- <table cellpadding="3" cellspacing="3" width="100%" class="widefat">
+ <table cellpadding="3" cellspacing="3" width="100%" class="widefat">
<thead>
<tr>
<th width="60%" scope="col"><?php _e('Name', $mf_domain)?></th>
<th width="20%" scope="col"><?php _e('Type', $mf_domain)?></th>
- <th width="20%" scope="col"><?php _e('Actions', $mf_domain)?></th>
- </tr>
+ <th width="20%" scope="col"><?php _e('Actions', $mf_domain)?></th>
+ </tr>
</thead>
<tbody>
<?php
@@ -417,13 +417,16 @@ function Import()
if(isset($_FILES['import-write-panel-file']) && !empty($_FILES['import-write-panel-file']['tmp_name']) ) {
$filePath = $_FILES['import-write-panel-file']['tmp_name'];
- }
- else {
+ }else{
die(__('Error uploading file!', $mf_domain));
}
+
+ if(isset($_REQUEST['overwrite-existing'])) {
+ $overwrite = true;
+ }
$writePanelName = basename($_FILES['import-write-panel-file']['name'], ".pnl");
- $panelID = RCCWP_CustomWritePanel::Import($filePath, $writePanelName);
+ $panelID = RCCWP_CustomWritePanel::Import($filePath, $writePanelName, $overwrite);
unlink($filePath);
@@ -444,7 +447,8 @@ function ViewWritePanels()
<form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('import-write-panel')?>" method="post" id="posts-filter" name="ImportWritePanelForm" enctype="multipart/form-data">
<h2><?php _e('Custom Write Panel',$mf_domain); ?></h2>
<p id="post-search">
- <input id="import-write-panel-file" name="import-write-panel-file" type="file" />
+ <input id="import-write-panel-file" name="import-write-panel-file" type="file" />
+ <input id="overwrite-existing" name="overwrite-existing" type="checkbox"/> Overwrite existing panel
<a href="#none" class="button-secondary" style="display:inline" onclick="document.ImportWritePanelForm.submit();"><?php _e('Import a Write Panel',$mf_domain); ?></a>
<a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-write-panel'); ?>" class="button-secondary" style="display:inline">+ <?php _e('Create a Write Panel',$mf_domain); ?></a>
</p>
View
242 js/jquery.metadata.js
@@ -1,122 +1,122 @@
-/*
- * Metadata - jQuery plugin for parsing metadata from elements
- *
- * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
- *
- */
-
-/**
- * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
- * in the JSON will become a property of the element itself.
- *
- * There are three supported types of metadata storage:
- *
- * attr: Inside an attribute. The name parameter indicates *which* attribute.
- *
- * class: Inside the class attribute, wrapped in curly braces: { }
- *
- * elem: Inside a child element (e.g. a script tag). The
- * name parameter indicates *which* element.
- *
- * The metadata for an element is loaded the first time the element is accessed via jQuery.
- *
- * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
- * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
- *
- * @name $.metadata.setType
- *
- * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
- * @before $.metadata.setType("class")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from the class attribute
- *
- * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
- * @before $.metadata.setType("attr", "data")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a "data" attribute
- *
- * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
- * @before $.metadata.setType("elem", "script")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a nested script element
- *
- * @param String type The encoding type
- * @param String name The name of the attribute to be used to get metadata (optional)
- * @cat Plugins/Metadata
- * @descr Sets the type of encoding to be used when loading metadata for the first time
- * @type undefined
- * @see metadata()
- */
-
-(function($) {
-
-$.extend({
- metadata : {
- defaults : {
- type: 'class',
- name: 'metadata',
- cre: /({.*})/,
- single: 'metadata'
- },
- setType: function( type, name ){
- this.defaults.type = type;
- this.defaults.name = name;
- },
- get: function( elem, opts ){
- var settings = $.extend({},this.defaults,opts);
- // check for empty string in single property
- if ( !settings.single.length ) settings.single = 'metadata';
-
- var data = $.data(elem, settings.single);
- // returned cached data if it already exists
- if ( data ) return data;
-
- data = "{}";
-
- if ( settings.type == "class" ) {
- var m = settings.cre.exec( elem.className );
- if ( m )
- data = m[1];
- } else if ( settings.type == "elem" ) {
- if( !elem.getElementsByTagName )
- return undefined;
- var e = elem.getElementsByTagName(settings.name);
- if ( e.length )
- data = $.trim(e[0].innerHTML);
- } else if ( elem.getAttribute != undefined ) {
- var attr = elem.getAttribute( settings.name );
- if ( attr )
- data = attr;
- }
-
- if ( data.indexOf( '{' ) <0 )
- data = "{" + data + "}";
-
- data = eval("(" + data + ")");
-
- $.data( elem, settings.single, data );
- return data;
- }
- }
-});
-
-/**
- * Returns the metadata object for the first member of the jQuery object.
- *
- * @name metadata
- * @descr Returns element's metadata object
- * @param Object opts An object contianing settings to override the defaults
- * @type jQuery
- * @cat Plugins/Metadata
- */
-$.fn.metadata = function( opts ){
- return $.metadata.get( this[0], opts );
-};
-
+/*
+ * Metadata - jQuery plugin for parsing metadata from elements
+ *
+ * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
+ *
+ */
+
+/**
+ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
+ * in the JSON will become a property of the element itself.
+ *
+ * There are three supported types of metadata storage:
+ *
+ * attr: Inside an attribute. The name parameter indicates *which* attribute.
+ *
+ * class: Inside the class attribute, wrapped in curly braces: { }
+ *
+ * elem: Inside a child element (e.g. a script tag). The
+ * name parameter indicates *which* element.
+ *
+ * The metadata for an element is loaded the first time the element is accessed via jQuery.
+ *
+ * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
+ * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
+ *
+ * @name $.metadata.setType
+ *
+ * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
+ * @before $.metadata.setType("class")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from the class attribute
+ *
+ * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
+ * @before $.metadata.setType("attr", "data")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a "data" attribute
+ *
+ * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
+ * @before $.metadata.setType("elem", "script")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a nested script element
+ *
+ * @param String type The encoding type
+ * @param String name The name of the attribute to be used to get metadata (optional)
+ * @cat Plugins/Metadata
+ * @descr Sets the type of encoding to be used when loading metadata for the first time
+ * @type undefined
+ * @see metadata()
+ */
+
+(function($) {
+
+$.extend({
+ metadata : {
+ defaults : {
+ type: 'class',
+ name: 'metadata',
+ cre: /({.*})/,
+ single: 'metadata'
+ },
+ setType: function( type, name ){
+ this.defaults.type = type;
+ this.defaults.name = name;
+ },
+ get: function( elem, opts ){
+ var settings = $.extend({},this.defaults,opts);
+ // check for empty string in single property
+ if ( !settings.single.length ) settings.single = 'metadata';
+
+ var data = $.data(elem, settings.single);
+ // returned cached data if it already exists
+ if ( data ) return data;
+
+ data = "{}";
+
+ if ( settings.type == "class" ) {
+ var m = settings.cre.exec( elem.className );
+ if ( m )
+ data = m[1];
+ } else if ( settings.type == "elem" ) {
+ if( !elem.getElementsByTagName )
+ return undefined;
+ var e = elem.getElementsByTagName(settings.name);
+ if ( e.length )
+ data = $.trim(e[0].innerHTML);
+ } else if ( elem.getAttribute != undefined ) {
+ var attr = elem.getAttribute( settings.name );
+ if ( attr )
+ data = attr;
+ }
+
+ if ( data.indexOf( '{' ) <0 )
+ data = "{" + data + "}";
+
+ data = eval("(" + data + ")");
+
+ $.data( elem, settings.single, data );
+ return data;
+ }
+ }
+});
+
+/**
+ * Returns the metadata object for the first member of the jQuery object.
+ *
+ * @name metadata
+ * @descr Returns element's metadata object
+ * @param Object opts An object contianing settings to override the defaults
+ * @type jQuery
+ * @cat Plugins/Metadata
+ */
+$.fn.metadata = function( opts ){
+ return $.metadata.get( this[0], opts );
+};
+
})(jQuery);
View
166 js/sevencolorpicker.js
@@ -1,84 +1,84 @@
-/**
-*Seven Color Picker 1.1.0
-*Author: Seven Yu
-*E-mail: dofyyu#gmail.com
-**/
-jQuery.fn.SevenColorPicker = function()
-{
- var _SCP_FLAG = '_I_AM_SCP';
- var _SCP_NUMS_PRE_LINE = 8; // 每行显示颜色个数
- var _SCP_ITEM_SIZE = 15; // 色块大小
- var _SCP_ITEM_OFFSET = 2; // 色块间距
- var _SCP_OFFSET = 3; // 面板间距
- var _SCP_BORDER_WIDTH = 1; // 边框宽度
- var _SCP_COLORS1 = ['ff8080','ffff80','80ff80','00ff80','80ffff','0080ff','ff80c0','ff80ff',
- 'ff0000','ffff00','80ff00','00ff40','00ffff','0080c0','8080c0','ff00ff',
- '804040','ff8040','00ff00','008080','004080','8080ff','800040','ff0080',
- '800000','ff8000','008000','008040','0000ff','0000a0','800080','8000ff',
- '400000','804000','004000','004040','000080','000040','400040','408080',
- '000000','808000','808040','808080','408080','c0c0c0','400040','ffffff'];
-
- if(!jQuery.SCP_Selecter)
- {
-
- var html = '<div id="unk"><ul>';
- var result = jQuery('<div id="_seven_color_selecter" />');
- for(x=0;x<=47;x=x+1)
- html += '<li id="'+_SCP_COLORS1[x]+'"><a href="javascript:void(\'#'+_SCP_COLORS1[x]+'\');" ref="#'+_SCP_COLORS1[x]+'" style="background-color:#'+_SCP_COLORS1[x]+';"></a></li>';
- html += '</ul><form style="margin:0;padding:3px;clear:both;text-align:center;">'+
- 'HEX: <input id="_seven_color_code" maxlength="7" size="10" style="font:10px verdana" /> '+
- '<input type="submit" value=" OK " style="font:10px verdana" /></form></div>';
- result.html(html);
- jQuery(document).mouseup(function(){result.hide()}).find('body').append(result);
- var setColor = function(col)
- {
- if(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.test(col))
- {
- col = col.charAt(0) == '#' ? col : '#' + col;
- jQuery.SCP_Active.css('background-color',col);
- jQuery.SCP_Target.val(col);
- }
- }
- result.hide().css({'position':'absolute','font':'10px verdana','margin':0,'padding':0})
- .find('div').css({'background-color':'#f2f2f2','border':_SCP_BORDER_WIDTH+'px solid #999','margin':0,'padding':_SCP_OFFSET})
- .width(_SCP_NUMS_PRE_LINE*(_SCP_ITEM_SIZE+_SCP_ITEM_OFFSET*2+_SCP_BORDER_WIDTH*2))
- .find('form').submit(function()
- {
- setColor(jQuery(this).children('#_seven_color_code').val());
- jQuery.SCP_Selecter.hide();
- return false;
- }).end()
- .find('ul').css({'margin':0,'padding':0,'list-style':'none'})
- .find('li').css({'margin':0,'padding':0,'float':'left'})
- .find('a').css({'margin':_SCP_ITEM_OFFSET,'padding':0,'display':'block','border':_SCP_BORDER_WIDTH+'px solid #ccc'})
- .width(_SCP_ITEM_SIZE).height(_SCP_ITEM_SIZE)
- .mouseover(function(){jQuery('#_seven_color_code').val(jQuery(this).attr('ref')).focus().select();})
- .mousedown(function(){setColor(jQuery(this).attr('ref'));})
- .mouseover(function(){jQuery(this).css({'border':_SCP_BORDER_WIDTH+'px solid #333'});})
- .mouseout(function(){jQuery(this).css({'border':_SCP_BORDER_WIDTH+'px solid #ccc'});});
- jQuery.SCP_Selecter = result;
- if(jQuery.browser.msie && jQuery.browser.version == '6.0')
- result.find('div').before('<iframe frameborder="0" width="'+result.width()+'" height="'+result.height()+'" style="position:absolute;z-index:-1;"></iframe>');
- }
- return this.each(function()
- {
- var myPicker = jQuery(this).next(':text');
- if(myPicker.attr('ref') != _SCP_FLAG)
- {
- jQuery(this).hide().after(
- jQuery('<input ref="'+_SCP_FLAG+'" />')
- .width(_SCP_ITEM_SIZE).height(_SCP_ITEM_SIZE)
- .mouseover(function()
- {
- var offset = jQuery(this).offset();
- var left = offset.left;
- var top = offset.top+jQuery(this).height()+_SCP_BORDER_WIDTH;
- jQuery.SCP_Target = jQuery(this).prev();
- jQuery.SCP_Active = jQuery(this);
- jQuery.SCP_Selecter.show().css({'left':left,'top':top}).find('#_seven_color_code').val(jQuery.SCP_Target.val()).focus().select();
- }).attr('readonly','true')
- .css({'border':_SCP_BORDER_WIDTH+'px solid #999','cursor':'pointer','padding':0,'background-color':jQuery(this).val()})
- );
- }
- });
+/**
+*Seven Color Picker 1.1.0
+*Author: Seven Yu
+*E-mail: dofyyu#gmail.com
+**/
+jQuery.fn.SevenColorPicker = function()
+{
+ var _SCP_FLAG = '_I_AM_SCP';
+ var _SCP_NUMS_PRE_LINE = 8; // 每行显示颜色个数
+ var _SCP_ITEM_SIZE = 15; // 色块大小
+ var _SCP_ITEM_OFFSET = 2; // 色块间距
+ var _SCP_OFFSET = 3; // 面板间距
+ var _SCP_BORDER_WIDTH = 1; // 边框宽度
+ var _SCP_COLORS1 = ['ff8080','ffff80','80ff80','00ff80','80ffff','0080ff','ff80c0','ff80ff',
+ 'ff0000','ffff00','80ff00','00ff40','00ffff','0080c0','8080c0','ff00ff',
+ '804040','ff8040','00ff00','008080','004080','8080ff','800040','ff0080',
+ '800000','ff8000','008000','008040','0000ff','0000a0','800080','8000ff',
+ '400000','804000','004000','004040','000080','000040','400040','408080',
+ '000000','808000','808040','808080','408080','c0c0c0','400040','ffffff'];
+
+ if(!jQuery.SCP_Selecter)
+ {
+
+ var html = '<div id="unk"><ul>';
+ var result = jQuery('<div id="_seven_color_selecter" />');
+ for(x=0;x<=47;x=x+1)
+ html += '<li id="'+_SCP_COLORS1[x]+'"><a href="javascript:void(\'#'+_SCP_COLORS1[x]+'\');" ref="#'+_SCP_COLORS1[x]+'" style="background-color:#'+_SCP_COLORS1[x]+';"></a></li>';
+ html += '</ul><form style="margin:0;padding:3px;clear:both;text-align:center;">'+
+ 'HEX: <input id="_seven_color_code" maxlength="7" size="10" style="font:10px verdana" /> '+
+ '<input type="submit" value=" OK " style="font:10px verdana" /></form></div>';
+ result.html(html);
+ jQuery(document).mouseup(function(){result.hide()}).find('body').append(result);
+ var setColor = function(col)
+ {
+ if(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.test(col))
+ {
+ col = col.charAt(0) == '#' ? col : '#' + col;
+ jQuery.SCP_Active.css('background-color',col);
+ jQuery.SCP_Target.val(col);
+ }
+ }
+ result.hide().css({'position':'absolute','font':'10px verdana','margin':0,'padding':0})
+ .find('div').css({'background-color':'#f2f2f2','border':_SCP_BORDER_WIDTH+'px solid #999','margin':0,'padding':_SCP_OFFSET})
+ .width(_SCP_NUMS_PRE_LINE*(_SCP_ITEM_SIZE+_SCP_ITEM_OFFSET*2+_SCP_BORDER_WIDTH*2))
+ .find('form').submit(function()
+ {
+ setColor(jQuery(this).children('#_seven_color_code').val());
+ jQuery.SCP_Selecter.hide();
+ return false;
+ }).end()
+ .find('ul').css({'margin':0,'padding':0,'list-style':'none'})
+ .find('li').css({'margin':0,'padding':0,'float':'left'})
+ .find('a').css({'margin':_SCP_ITEM_OFFSET,'padding':0,'display':'block','border':_SCP_BORDER_WIDTH+'px solid #ccc'})
+ .width(_SCP_ITEM_SIZE).height(_SCP_ITEM_SIZE)
+ .mouseover(function(){jQuery('#_seven_color_code').val(jQuery(this).attr('ref')).focus().select();})
+ .mousedown(function(){setColor(jQuery(this).attr('ref'));})
+ .mouseover(function(){jQuery(this).css({'border':_SCP_BORDER_WIDTH+'px solid #333'});})
+ .mouseout(function(){jQuery(this).css({'border':_SCP_BORDER_WIDTH+'px solid #ccc'});});
+ jQuery.SCP_Selecter = result;
+ if(jQuery.browser.msie && jQuery.browser.version == '6.0')
+ result.find('div').before('<iframe frameborder="0" width="'+result.width()+'" height="'+result.height()+'" style="position:absolute;z-index:-1;"></iframe>');
+ }
+ return this.each(function()
+ {
+ var myPicker = jQuery(this).next(':text');
+ if(myPicker.attr('ref') != _SCP_FLAG)
+ {
+ jQuery(this).hide().after(
+ jQuery('<input ref="'+_SCP_FLAG+'" />')
+ .width(_SCP_ITEM_SIZE).height(_SCP_ITEM_SIZE)
+ .mouseover(function()
+ {
+ var offset = jQuery(this).offset();
+ var left = offset.left;
+ var top = offset.top+jQuery(this).height()+_SCP_BORDER_WIDTH;
+ jQuery.SCP_Target = jQuery(this).prev();
+ jQuery.SCP_Active = jQuery(this);
+ jQuery.SCP_Selecter.show().css({'left':left,'top':top}).find('#_seven_color_code').val(jQuery.SCP_Target.val()).focus().select();
+ }).attr('readonly','true')
+ .css({'border':_SCP_BORDER_WIDTH+'px solid #999','cursor':'pointer','padding':0,'background-color':jQuery(this).val()})
+ );
+ }
+ });
}
Please sign in to comment.
Something went wrong with that request. Please try again.