From: Thierry Parmentelat Date: Thu, 19 Feb 2009 18:41:19 +0000 (+0000) Subject: split in two X-Git-Tag: PLEWWW-4.3-1~35 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=878ce4154f4619a5d07c780bf1f76dfd46771df4;p=plewww.git split in two --- diff --git a/Makefile b/Makefile index d1c2f44..6f15a95 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ ifeq (,$(SSHURL)) @echo " or make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr" @exit 1 else - +$(RSYNC) planetlab modules $(SSHURL)/var/www/html/ + +$(RSYNC) planetlab plekit modules $(SSHURL)/var/www/html/ endif #################### convenience, for debugging only diff --git a/modules/planetlab.module b/modules/planetlab.module index ae5497b..857ebd6 100644 --- a/modules/planetlab.module +++ b/modules/planetlab.module @@ -34,7 +34,7 @@ function planetlab_menu($may_cache) { if ($may_cache) { $items[] = array( - 'path' => 'planetlab/logout', + 'path' => 'planetlab/common/logout', 'title' => t('Log out of %s', array('%s' => variable_get('site_name', 'local'))), 'callback' => 'planetlab_logout', 'access' => TRUE, diff --git a/planetlab/about.php b/planetlab/common/about.php similarity index 100% rename from planetlab/about.php rename to planetlab/common/about.php diff --git a/planetlab/actions.php b/planetlab/common/actions.php similarity index 100% rename from planetlab/actions.php rename to planetlab/common/actions.php diff --git a/planetlab/adminsearch.php b/planetlab/common/adminsearch.php similarity index 99% rename from planetlab/adminsearch.php rename to planetlab/common/adminsearch.php index c3c32d9..45a1c61 100644 --- a/planetlab/adminsearch.php +++ b/planetlab/common/adminsearch.php @@ -165,7 +165,7 @@ $_roles= $_person['role_ids']; echo "
\n -
\n"; + \n"; if( $_POST['userquery'] or $_GET['userquery']) { if ( $_POST['userquery'] ) { diff --git a/planetlab/login.php b/planetlab/common/login.php similarity index 100% rename from planetlab/login.php rename to planetlab/common/login.php diff --git a/planetlab/logout.php b/planetlab/common/logout.php similarity index 100% rename from planetlab/logout.php rename to planetlab/common/logout.php diff --git a/planetlab/sulogout.php b/planetlab/common/sulogout.php similarity index 100% rename from planetlab/sulogout.php rename to planetlab/common/sulogout.php diff --git a/planetlab/css/demo.css b/planetlab/css/demo.css deleted file mode 100644 index c6907ea..0000000 --- a/planetlab/css/demo.css +++ /dev/null @@ -1,165 +0,0 @@ -/* - Add the following to your CSS file should you wish the cursor to - "wait" while the script is processing the sort -*/ - -body.sort-active * - { - cursor:wait; - } - -body - { - padding:0; - border:0; - margin:0; - text-align:center; - font-size:12px; - font-family: verdana,arial,sans-serif; - color:#545454; - min-width: 800px; - } -h2 span - { - font-variant:small-caps; - } -p a - { - font-weight:normal; - outline:none; - } -p a:link, -p a:visited - { - color:#333; - text-decoration:underline; - } -p a:hover - { - color:#fff; - text-decoration:none; - background:#000; - } -p a:active - { - color:#000; - text-decoration:underline; - } -code - { - font-family:'andale mono','lucida console','courier new',monospace; - font-size:1em; - } -p - { - line-height:1.6em; - margin:0 0 1em 0; - } -h1 - { - font-weight:lighter; - font-family:georgia, times new roman, times, georgia, palatino, serif; - text-align:center; - margin-top:0.6em; - color:#000; - font-size:2em; - } -h2 - { - font-weight:lighter; - font-family:verdana,arial,sans-serif; - text-align:center; - margin-top:1em; - color:#333; - text-transform:uppercase; - letter-spacing:1px; - font-size:1.2em; - } -h2 span - { - font-variant:small-caps; - text-transform:none; - } -.cs1 - { - width:30em; - } -.cs2 - { - width:20em; - } -.cs1 td, -.cs2 td, -#scientificNotation - { - text-align:right; - } -caption - { - padding: 0 0 5px 0; - margin:0 auto; - width:auto; - font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; - text-align: right; - } -td.total - { - border-top: 0; - border-left: 0; - border-right: 1px solid #C1DAD7; - background: none; - text-align:right; - font-weight:bold; - text-transform:uppercase; - letter-spacing:1px; - } -/* -These styles should be added when very long tables are expected -th.sort-active - { - background:#CAE8EA url(../media/bg_header_sorting.jpg) no-repeat 0 0; - cursor:wait; - } -th.sort-active a - { - color:#a80000 !important; - cursor:wait; - } -*/ -th a - { - text-decoration:none; - color: #4f6b72; - background:transparent; - } -td a - { - text-decoration:none; - color:#239; - background:transparent; - } -td img - { - margin:0 auto; - border:3px solid #ddd; - } -td a:hover - { - color:#a84444; - border-bottom:1px dotted #a80000; - background:transparent; - } -td.lft - { - text-align:left; - } -/* Image free rules for Internet Explorer < 7 */ -* html tr.alt td - { - background-color:#F5FAFA; - } -* html tr td.alt, -* html tr.alt td.alt - { - background-color:#edf3f3; - } diff --git a/planetlab/events/events.php b/planetlab/events/events.php index 685370a..ccd6444 100644 --- a/planetlab/events/events.php +++ b/planetlab/events/events.php @@ -14,9 +14,9 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_tables.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_datepicker.php'; +require_once 'table.php'; +require_once 'linetabs.php'; +require_once 'datepicker.php'; // needs much memory ini_set("memory_limit","256M"); diff --git a/planetlab/events/events_choser.php b/planetlab/events/events_choser.php index 8d1d272..6463185 100644 --- a/planetlab/events/events_choser.php +++ b/planetlab/events/events_choser.php @@ -14,9 +14,9 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_details.php'; -require_once 'plc_datepicker.php'; +require_once 'linetabs.php'; +require_once 'details.php'; +require_once 'datepicker.php'; //set default title drupal_set_title('Events choser'); diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index 636da7a..5e8fcc2 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -10,23 +10,6 @@ function my_is_int ($x) { return (is_numeric($x) ? intval($x) == $x : false); } -//// belongs to plkit -// returns array ['url' => path, 'values' => hash (key=>value)* ] -function plkit_split_url ($full_url) { - list($url,$args) = explode("?",$full_url); - $values=array(); - if ($args) { - $pairs=explode("&",$args); - foreach ($pairs as $pair) { - list ($name,$value) = explode("=",$pair); - $values[$name]=$value; - } - } - return array("url"=>$url,"values"=>$values); -} - - - //////////////////////////////////////////////////////////// roles & other checks on global $plc function plc_is_admin () { global $plc; @@ -64,7 +47,7 @@ function href ($url,$text) { return "" . $text . ""; // l_object_t($object_id,text) -> an tag that shows text and links to the above // l_object_add () -> the url to that object-afding page -function l_actions () { return "/db/actions.php"; } +function l_actions () { return "/db/common/actions.php"; } // some complex node actions are kept separate, e.g. the ones related to getbootmedium function l_actions_download () { return "/db/nodes/node_downloads.php"; } @@ -108,7 +91,7 @@ function l_person_obj ($person) { return l_person_t($person['person_id'],$perso function l_tags () { return "/db/tags/index.php"; } function l_tag ($tag_type_id) { return "/db/tags/index.php?id=$tag_type_id"; } -function l_tag_obj ($tag) { return href(l_tag($tag['tag-type_id']),$tag['tagname']); } +function l_tag_obj ($tag) { return href(l_tag($tag['tag_type_id']),$tag['tagname']); } function l_nodegroups () { return "/db/tags/nodegroups.php"; } function l_nodegroup ($nodegroup_id) { return "/db/tags/nodegroup.php?id=$nodegroup_id"; } @@ -124,14 +107,14 @@ function l_peer_t($peer_id,$text) { return href(l_peer($peer_id),$text); } function l_comon($id_name,$id_value) { return "/db/nodes/comon.php?$id_name=$id_value"; } function l_sirius() { return "/db/sirius/index.php"; } -function l_about() { return "/db/about.php"; } +function l_about() { return "/db/common/about.php"; } function l_doc_plcapi() { return "/db/doc/PLCAPI.php"; } function l_doc_nmapi() { return "/db/doc/NMAPI.php"; } -function l_admin() { return "/db/adminsearch.php"; } +function l_admin() { return "/db/common/adminsearch.php"; } -function l_login() { return "/db/login.php"; } -function l_logout() { return "/planetlab/logout.php"; } -function l_sulogout() { return "/planetlab/sulogout.php"; } +function l_login() { return "/db/common/login.php"; } +function l_logout() { return "/planetlab/common/logout.php"; } +function l_sulogout() { return "/planetlab/common/sulogout.php"; } function l_reset_password() { return "/db/persons/reset_password.php"; } function l_person_register() { return "/db/persons/register.php"; } function l_site_register() { return "/db/sites/register.php"; } diff --git a/planetlab/includes/plc_functions_trash.php b/planetlab/includes/plc_functions_trash.php deleted file mode 100644 index 95d2839..0000000 --- a/planetlab/includes/plc_functions_trash.php +++ /dev/null @@ -1,234 +0,0 @@ - $val ) { -// if( substr( $key, -3 ) == "_id" ) - if ( $key == $table_id ) { - $id[$key]= $val; - } else { - $data[$key]= $val; - } - } - - foreach( $id as $key => $val ) - $arr2[$key]= $val; - - foreach( $data as $key => $val ) - $arr2[$key]= $val; - - $as_array[]= $arr2; - } - - $totalrows= count( $as_array ); - - // if array has no rows display msg - if( $totalrows == 0 ) - return "Nothing to display"; - - // set key and break up data struct - $newkey= $page - 1; - $newarray= array_chunk( $as_array, $limit ); - - // start table output - $echo.= "\n"; - - // if there is a caption add it to table - if( $caption ) - $echo.= "\n"; - - $echo.= ""; - - // go through keys of one array row for table headers - foreach( $newarray[$newkey][0] as $key => $val ) { -// if( substr( $key, -3 ) != "_id" ) - if ( $key != $table_id && $key != 'peer_id' ) - $echo.= ""; - } - - if( $other_func == 'slivers' ) - $echo.= ""; - - $echo.= "\n"; - - // go through array row by row to output table rows - foreach( $newarray[$newkey] as $assoc ) { - - $extraclass=""; - if ($assoc['peer_id']) { - $extraclass="plc-foreign"; - } - - - $echo.= ""; - - foreach( $assoc as $key => $val ) { - // do not rely on keys order - $id = $assoc[$table_id]; -// if( substr( $key, -3 ) == "_id" ) - if ($key == $table_id) { -// $id= $val; - continue; - } elseif( $key == $main_field ) { - $echo.= ""; - } elseif ($key != 'peer_id') { - $echo.= ""; - } - - } - - if( $other_func == 'slivers' ) - $echo.= ""; - - $echo.= "\n"; - } - - // close table - $echo.= "
$caption
". ucfirst( $key ) ."Slivers
$val"; - if( is_array( $val ) ) { - $count= 1; - $tot= count( $val ); - foreach( $val as $k => $v ) { - $echo.= $v; - if( $count != $tot ) - $echo.= ", "; - $count++; - } - } - else - $echo.= $val; - $echo.= "view
\n"; - $echo.= "
\n"; - - // find total number of pages - $numofpages = $totalrows / $limit; - - // start navigation links - if( $numofpages > 1 ) { - // if page is not 1 display first and prev links - if( $page != 1 && $page ) { - $pageprev= $page - 1; - $echo.= "
FIRST   "; - $echo.= " PREV ".$limit."   "; - } - else - $echo.= "PREV ". $limit ." "; - - // if less than 30 pages display all - // otherwise show 30 pages but put ... inbetween - if( $numofpages < 30 ) { - $npages= $numofpages; - $start= 1; - } - else { - $npages= $page + 9; - if( $npages > $numofpages ) - $npages= $numofpages; - $start= $page - 10; - if( $start < 1 ) - $start= 1; - if( $page != 1 ) - $echo.= " ... "; - } - - // display pages, no link if current page - for( $i= $start; $i <= $npages; $i++ ) { - if( $i == $page ) - $echo.= $i ." "; - else - $echo.= "$i "; - - } - - if( ( $totalrows % $limit ) != 0 ) { - $last= $numofpages + 1; - if( $i == $page ) - $echo.= $i ." "; - else - $echo.= "$i "; - } - else - $last= $numofpages; - - if( $numofpages >= 30 ) { - if( $page != $numofpages ) - $echo.= " ... "; - } - - if( ( $totalrows - ($limit * $page) ) > 0 ) { - $pagenext= $page + 1; - $echo.= "   NEXT ".$limit."   "; - } - else - $echo.= "NEXT ". $limit; - - $echo.= " LAST\n"; - - } - - return $echo; - -} - -// function for getting the diff of multi dimention array -function arr_diff( $a1, $a2 ) { - $diff= array(); - foreach( $a1 as $k=>$v ) { - unset( $dv ); - for( $x= 0; $x < count( $a2 ); $x++ ) { - if( is_int( $k ) ) { - if( array_search( $v, $a2 ) === false ) - $dv=$v; - else if( is_array( $v ) ) - $dv= arr_diff( $v, $a2[$x] ); - if( $dv && !in_array( $dv, $diff ) ) - $diff[]=$dv; - } - else { - - if( !$a2[$k] ) - $dv=$v; - else if(is_array($v)) - $dv=arr_diff($v,$a2[$x]); - if($dv) - $diff[$x]=$dv; - } - } - } - return $diff; -} - -// obsolete ? -function plc_js_confirm($message) { - return "onclick=\"javascript:return confirm('Are you sure you want to delete " . $message . " ?')\""; -} - -function plc_delete_link($url,$delete_message,$visible) { - return "" . $visible . ""; -} - -function plc_delete_link_button($url,$delete_message,$width=15) { - return "" . - plc_delete_icon_bubble($width,"Delete this entry") . - ""; -} - -?> diff --git a/planetlab/includes/prototype.php b/planetlab/includes/prototype.php deleted file mode 100644 index 667bef1..0000000 --- a/planetlab/includes/prototype.php +++ /dev/null @@ -1,7 +0,0 @@ - -'); - -?> diff --git a/planetlab/nodes/interface.php b/planetlab/nodes/interface.php index 0822143..70afd19 100644 --- a/planetlab/nodes/interface.php +++ b/planetlab/nodes/interface.php @@ -9,10 +9,10 @@ global $plc, $api; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_details.php'; -require_once 'plc_tables.php'; -require_once 'plc_toggles.php'; +require_once 'linetabs.php'; +require_once 'details.php'; +require_once 'table.php'; +require_once 'toggle.php'; require_once 'plc_drupal.php'; include 'plc_header.php'; diff --git a/planetlab/nodes/node.php b/planetlab/nodes/node.php index c6e26f0..bf475ec 100644 --- a/planetlab/nodes/node.php +++ b/planetlab/nodes/node.php @@ -16,11 +16,11 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_peers.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; -require_once 'plc_details.php'; -require_once 'plc_forms.php'; -require_once 'plc_toggles.php'; +require_once 'linetabs.php'; +require_once 'table.php'; +require_once 'details.php'; +require_once 'form.php'; +require_once 'toggle.php'; require_once 'plc_objects.php'; // -------------------- diff --git a/planetlab/nodes/nodes.php b/planetlab/nodes/nodes.php index 16f8ef6..90a3b3a 100644 --- a/planetlab/nodes/nodes.php +++ b/planetlab/nodes/nodes.php @@ -16,8 +16,8 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_peers.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; +require_once 'linetabs.php'; +require_once 'table.php'; // -------------------- // recognized URL arguments diff --git a/planetlab/peers/peer.php b/planetlab/peers/peer.php index c424d8f..f0736cc 100644 --- a/planetlab/peers/peer.php +++ b/planetlab/peers/peer.php @@ -13,8 +13,8 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_details.php'; -require_once 'plc_minitabs.php'; +require_once 'details.php'; +require_once 'linetabs.php'; $tabs=array(); $tabs['Back to peers list']=l_peers(); diff --git a/planetlab/peers/peers.php b/planetlab/peers/peers.php index 7e346fb..96f6dff 100644 --- a/planetlab/peers/peers.php +++ b/planetlab/peers/peers.php @@ -13,8 +13,8 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_tables.php'; -require_once 'plc_minitabs.php'; +require_once 'table.php'; +require_once 'linetabs.php'; drupal_set_title('All Peers'); diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index fc20c1c..5fac9b2 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -16,11 +16,11 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_peers.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; -require_once 'plc_details.php'; -require_once 'plc_forms.php'; -require_once 'plc_toggles.php'; +require_once 'linetabs.php'; +require_once 'table.php'; +require_once 'details.php'; +require_once 'form.php'; +require_once 'toggle.php'; // -------------------- // recognized URL arguments @@ -294,7 +294,7 @@ $toggle->end(); //////////////////// roles $toggle=new PlcToggle ('roles','Roles',array('trigger-tagname'=>'h2')); -$togle->start(); +$toggle->start(); if (! $roles) plc_warning ("This user has no role !"); diff --git a/planetlab/persons/persons.php b/planetlab/persons/persons.php index 79366a8..d1d46d8 100644 --- a/planetlab/persons/persons.php +++ b/planetlab/persons/persons.php @@ -16,8 +16,8 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_peers.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; +require_once 'linetabs.php'; +require_once 'table.php'; //fix the memory limit for this page ini_set("memory_limit","48M"); diff --git a/planetlab/sites/site.php b/planetlab/sites/site.php index 7f75d79..b56e62e 100644 --- a/planetlab/sites/site.php +++ b/planetlab/sites/site.php @@ -16,11 +16,11 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_peers.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; -require_once 'plc_details.php'; -require_once 'plc_forms.php'; -require_once 'plc_toggles.php'; +require_once 'linetabs.php'; +require_once 'table.php'; +require_once 'details.php'; +require_once 'form.php'; +require_once 'toggle.php'; // -------------------- // recognized URL arguments diff --git a/planetlab/js/plc_functions.js b/planetlab/sites/site_form.js similarity index 100% rename from planetlab/js/plc_functions.js rename to planetlab/sites/site_form.js diff --git a/planetlab/sites/site_form.php b/planetlab/sites/site_form.php index a5105e5..7304e95 100644 --- a/planetlab/sites/site_form.php +++ b/planetlab/sites/site_form.php @@ -57,7 +57,7 @@ function build_site_form ($register_mode) { if ($register_mode) { // required for the following code - drupal_set_html_head(''); + drupal_set_html_head(''); $fill_from_pi_button = <<< EOF '); diff --git a/planetlab/tags/nodegroup.php b/planetlab/tags/nodegroup.php index 08da358..30a6d51 100644 --- a/planetlab/tags/nodegroup.php +++ b/planetlab/tags/nodegroup.php @@ -15,10 +15,10 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; -require_once 'plc_details.php'; -require_once 'plc_toggles.php'; +require_once 'linetabs.php'; +require_once 'table.php'; +require_once 'details.php'; +require_once 'toggle.php'; // -------------------- // recognized URL arguments diff --git a/planetlab/tags/nodegroups.php b/planetlab/tags/nodegroups.php index 23259a5..8531125 100644 --- a/planetlab/tags/nodegroups.php +++ b/planetlab/tags/nodegroups.php @@ -15,8 +15,8 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; +require_once 'linetabs.php'; +require_once 'table.php'; // -------------------- // recognized URL arguments @@ -32,7 +32,7 @@ $node_filter=array(); // fetch objs -$nodegroup_columns=array("nodegroup_id","groupname","tagname","value","node_ids"); +$nodegroup_columns=array("nodegroup_id","groupname","tagname","value","node_ids","tag_type_id"); // server-side filtering - set pattern in $_GET for filtering on hostname if ($pattern) { @@ -68,7 +68,8 @@ $table->start(); foreach ($nodegroups as $nodegroup) { $table->row_start(); $table->cell (href(l_nodegroup($nodegroup['nodegroup_id']),$nodegroup['groupname'])); - $table->cell ($nodegroup['tagname']); + // yes, a nodegroup is not a tag, but knows enough for this to work + $table->cell (l_tag_obj($nodegroup)); $table->cell ($nodegroup['value']); $table->cell (count($nodegroup['node_ids'])); $table->row_end(); diff --git a/planetlab/tags/tag.php b/planetlab/tags/tag.php index da0a6c8..2eabae6 100644 --- a/planetlab/tags/tag.php +++ b/planetlab/tags/tag.php @@ -15,11 +15,11 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_details.php'; -require_once 'plc_tables.php'; -require_once 'plc_forms.php'; -require_once 'plc_toggles.php'; +require_once 'linetabs.php'; +require_once 'details.php'; +require_once 'table.php'; +require_once 'form.php'; +require_once 'toggle.php'; // -------------------- // recognized URL arguments diff --git a/planetlab/tags/tag_set.php b/planetlab/tags/tag_set.php index afb66ce..1d3313b 100644 --- a/planetlab/tags/tag_set.php +++ b/planetlab/tags/tag_set.php @@ -15,8 +15,8 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; +require_once 'linetabs.php'; +require_once 'table.php'; drupal_set_message ("xxx tag_set.php is deprecated - use planetlab/actions.php instead"); return; diff --git a/planetlab/tags/tags.php b/planetlab/tags/tags.php index b210cb2..d222f14 100644 --- a/planetlab/tags/tags.php +++ b/planetlab/tags/tags.php @@ -15,9 +15,9 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; -require_once 'plc_forms.php'; +require_once 'linetabs.php'; +require_once 'table.php'; +require_once 'form.php'; // -------------------- // recognized URL arguments @@ -27,7 +27,6 @@ $pattern=$_GET['pattern']; $title="Tag Types"; $tabs=array(); $tabs []= tab_tags(); -$tabs []= tab_nodes(); $tabs []= tab_nodes_local(); $tabs []= tab_slices(); diff --git a/planetlab/datepicker/URL b/plekit/datepicker/URL similarity index 100% rename from planetlab/datepicker/URL rename to plekit/datepicker/URL diff --git a/planetlab/datepicker/datepicker.css b/plekit/datepicker/datepicker.css similarity index 100% rename from planetlab/datepicker/datepicker.css rename to plekit/datepicker/datepicker.css diff --git a/planetlab/datepicker/datepicker.js b/plekit/datepicker/datepicker.js similarity index 100% rename from planetlab/datepicker/datepicker.js rename to plekit/datepicker/datepicker.js diff --git a/planetlab/css/plc_details.css b/plekit/details/details.css similarity index 100% rename from planetlab/css/plc_details.css rename to plekit/details/details.css diff --git a/planetlab/minitabs/URL b/plekit/linetabs/URL similarity index 100% rename from planetlab/minitabs/URL rename to plekit/linetabs/URL diff --git a/planetlab/minitabs/minitabs.css b/plekit/linetabs/linetabs.css similarity index 100% rename from planetlab/minitabs/minitabs.css rename to plekit/linetabs/linetabs.css diff --git a/planetlab/minitabs/minitabs.js b/plekit/linetabs/linetabs.js similarity index 100% rename from planetlab/minitabs/minitabs.js rename to plekit/linetabs/linetabs.js diff --git a/plekit/linetabs/minitabs.css b/plekit/linetabs/minitabs.css new file mode 100644 index 0000000..fe364ae --- /dev/null +++ b/plekit/linetabs/minitabs.css @@ -0,0 +1,69 @@ +/* $Id$ */ + +div.minitabs { + padding: 20px; + margin: 8px 0; + width:80%; + margin:8px auto; +} +div.minitabs>ul { + width: 100%; + float: left; + font-size: small; /* could be specified at a higher level */ + margin: 0; + padding: 0 5px 0 5px; + /* thickness and color for the fixed thin horizontal bar */ + border-bottom: 1px solid #696; + position:relative; + z-index:2; +} + +input.minitabs-submit { + font-family: verdana, sans-serif; + font-size: 14px; + text-align: center; + font-style: oblique; + border: 0; + /* buttons are normally outlined */ + background-color: transparent; + /*padding-bottom: 6px;*/ + border-bottom: 0px; +} +div.minitabs>ul>li { + float: left; + margin: 0; + padding: 0 8px 0 8px; + display: inline; + list-style: none; + position:relative; +} + +div.minitabs>ul>li input.minitabs-submit { + float: left; + font-size: 85%; + line-height: 20px; + font-weight: bold; + margin: 0 5px 0 5px; + text-decoration: none; + /* color when passive */ + color: #9c9; +} + +div.minitabs>ul>li input.active { + /* border-bottom: 4px solid #696; */ + /* padding-bottom: 2px; */ + /* color when mouse is on button */ + color: #696; +} + +#minitabs-sliding { + position: absolute; + z-index: 1; + font-size: 85%; + line-height: 20px; + padding-bottom: 2px; + /* color for the sliding bar */ + border-bottom: 4px solid #696; + margin-bottom: 0px; +} + diff --git a/plekit/linetabs/minitabs.js b/plekit/linetabs/minitabs.js new file mode 100644 index 0000000..5e89f0f --- /dev/null +++ b/plekit/linetabs/minitabs.js @@ -0,0 +1,208 @@ +/* + $Id$ + + Animated miniTabs by frequency decoder (http://www.frequency-decoder.com/) + + Based on an idea by Rob L Glazebrook (http://www.rootarcana.com/test/smartmini/) itself + derived from the original idea of Stephen Clark (http://www.sgclark.com/sandbox/minislide/) + + Rewritten by Thierry Parmentelat -- INRIA + support http-POST + support multiple instances + uses prototype.js + +*/ + +/* class */ +function minitabs () { + this.currentTab = 0; + this.activeTab = 0; + this.destX = 0; + this.destW = 0; + this.t = 0; + this.b = 0; + this.c = 0; + this.d = 20; + this.animInterval = null; + this.slideObj = null; + this.aHeight = 0; +} + +minitabs.prototype.init = function (div) { + this.ul = div.down('ul'); + /* the array of
  • 's */ + this.li_s = this.ul.select('li'); + /* the array of active 's - without any hidden one */ + this.input_s = this.ul.select('input.minitabs-submit'); + + /* attach event handlers */ + this.li_s.each ( function (li) { + li.observe ('mouseover', function(event) { + var elem = event.element(); + /* make sure we're on the 'li' element */ + if ( ! elem.match('li') ) elem=elem.up('li'); + /* determine current position */ + var pos = 0; + while(elem.previousSibling) { + elem = elem.previousSibling; + if (elem.tagName && elem.tagName == "LI") pos++; + } + minitabs_namespace.the_minitabs(elem).initSlide(pos,true); + } ) + } ); + + this.ul.observe('mouseout', function (event) { + var mt = minitabs_namespace.the_minitabs(event.element()); + mt.initSlide(mt.currentTab,true); + mt.setActive (mt.activeTab,false); + }); + + /* set active and current, default is index 0, set 'active' class otherwise */ + this.input_s.each ( function (input) { + if (input.hasClassName("active")) this.activeTab = this.currentTab = i; + }); + + /* create slice object */ + this.slideObj = this.ul.parentNode.appendChild(document.createElement("div")); + this.slideObj.appendChild(document.createTextNode(String.fromCharCode(160))); + this.slideObj.id = "minitabs-sliding"; + + /* position it */ + this.setSlidingTop(); + this.slideObj.style.left = (this.ul.offsetLeft + this.li_s[this.activeTab].offsetLeft + + this.input_s[this.activeTab].offsetLeft) + "px"; + this.slideObj.style.width = this.input_s[this.activeTab].offsetWidth + "px"; + this.aHeight = (this.ul.offsetTop + this.li_s[this.activeTab].offsetTop + + this.input_s[this.activeTab].offsetTop); + + this.initSlide(this.activeTab, true); + +}; + +minitabs.prototype.initSlide = function (pos, force) { + + if(!force && pos == this.activeTab) return; + this.setActive (this.activeTab,false); + this.activeTab = pos; + this.setActive (this.activeTab,true); + this.initAnim(); +}; + +minitabs.prototype.setActive = function (pos,active) { + var input=this.li_s[pos].select('input.minitabs-submit')[0]; + if (active) + input.addClassName('active'); + else + input.removeClassName('active'); +}; + +minitabs.prototype.setSlidingTop = function () { + var delta=0; + /* up 5px for firefox */ + /*window.console.log('agent=' + navigator.userAgent);*/ + if (navigator.userAgent.match(/Firefox/)) delta=-5; + this.slideObj.style.top = (this.ul.offsetTop + this.li_s[this.activeTab].offsetTop + + this.input_s[this.activeTab].offsetTop + delta ) + "px"; +}; + +minitabs.prototype.initAnim = function() { + /* search for the input with type != hidden */ + var input=this.li_s[this.activeTab].select('input.minitabs-submit')[0]; + this.destX = parseInt(this.li_s[this.activeTab].offsetLeft + input.offsetLeft + + this.ul.offsetLeft); + this.destW = parseInt(input.offsetWidth); + this.t = 0; + this.b = this.slideObj.offsetLeft; + this.c = this.destX - this.b; + + this.bW = this.slideObj.offsetWidth; + this.cW = this.destW - this.bW; + + this.setSlidingTop(); +}; + +minitabs.prototype.slideIt = function() { + + // Has the browser text size changed? + var active_li = this.li_s[this.activeTab]; + var active_input = this.input_s[this.activeTab]; + if (this.aHeight != this.ul.offsetTop + active_li.offsetTop + active_input.offsetTop) { + this.initAnim(); + this.aHeight = this.ul.offsetTop + active_li.offsetTop + active_input.offsetTop; + } + + + if (this.t++ < this.d) { + var x = this.animate(this.t,this.b,this.c,this.d); + var w = this.animate(this.t,this.bW,this.cW,this.d); + + this.slideObj.style.left = parseInt(x) + "px"; + this.slideObj.style.width = parseInt(w) + "px"; + } else { + this.slideObj.style.left = this.destX + "px"; + this.slideObj.style.width = this.destW +"px"; + } +}; + +minitabs.prototype.animate = function(t,b,c,d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; +}; + +minitabs.prototype.submit = function (message) { + /* save activeTab before confirmation; some browsers - firefox - send mouseout during confirm .. */ + var submitTab = this.activeTab; + /* ask for confirmation if message is not empty */ + if (message && ! confirm (message) ) return; + + /* get the form and trigger */ + this.li_s[submitTab].down('form').submit(); + +} + +// globals +var minitabs_namespace = { + init: function () { + $$('div.minitabs').each (function (div) { + /* create instance and attach it to the
    element */ + div.minitabs = new minitabs (); + div.minitabs.init(div); + } ) ; + + var intervalMethod = function () { + $$('div.minitabs').each (function (div) { + minitabs_namespace.the_minitabs(div).slideIt(); + } ) ; + } ; + minitabs_namespace.animInterval = setInterval(intervalMethod,10); + }, + + cleanUp: function() { + clearInterval(minitabs_namespace.animInterval); + minitabs_namespace.animInterval = null; + }, + + resize: function (e) { + $$('div.minitabs').each ( function (div) { + var mt = div.minitabs; + mt.initSlide(mt.activeTab,true); + } ); + }, + + submit: function (id,message) { + $(id).minitabs.submit(message); + }, + + // find the enclosing minitabs object + the_minitabs: function (elem) { + if (elem.match('div.minitabs')) + return elem.minitabs; + else + return elem.up('div.minitabs').minitabs; + } + +}; + +window.onload = minitabs_namespace.init; +window.onunload = minitabs_namespace.cleanUp; +window.onresize = minitabs_namespace.resize; diff --git a/planetlab/includes/plc_datepicker.php b/plekit/php/datepicker.php similarity index 88% rename from planetlab/includes/plc_datepicker.php rename to plekit/php/datepicker.php index db1f09d..54de9bf 100644 --- a/planetlab/includes/plc_datepicker.php +++ b/plekit/php/datepicker.php @@ -5,8 +5,8 @@ // see the demo at http://www.frequency-decoder.com/demo/date-picker-v4/ drupal_set_html_head(' - - + + '); // supported options diff --git a/planetlab/includes/plc_details.php b/plekit/php/details.php similarity index 98% rename from planetlab/includes/plc_details.php rename to plekit/php/details.php index 684adf5..ccf1c4a 100644 --- a/planetlab/includes/plc_details.php +++ b/plekit/php/details.php @@ -3,10 +3,10 @@ // $Id$ require_once 'plc_functions.php'; -require_once 'plc_forms.php'; +require_once 'form.php'; drupal_set_html_head(' - + '); diff --git a/planetlab/includes/plc_forms.php b/plekit/php/form.php similarity index 98% rename from planetlab/includes/plc_forms.php rename to plekit/php/form.php index d054097..c4b1fba 100644 --- a/planetlab/includes/plc_forms.php +++ b/plekit/php/form.php @@ -2,7 +2,7 @@ // $Id$ -require_once 'plc_functions.php'; +require_once 'plekit-utils.php'; // the rationale behind having function names with _html is that // the first functions that we had were actually printing the stuff instead of returning it @@ -20,7 +20,7 @@ class PlcForm { // and add them to the 'values' argument if any // extract var=value settings from url if any - $split=plkit_split_url($full_url); + $split=plekit_split_url($full_url); $this->url=$split['url']; $url_values=$split['values']; diff --git a/planetlab/includes/plc_minitabs.php b/plekit/php/linetabs.php similarity index 94% rename from planetlab/includes/plc_minitabs.php rename to plekit/php/linetabs.php index 20a9efa..b26dffc 100644 --- a/planetlab/includes/plc_minitabs.php +++ b/plekit/php/linetabs.php @@ -1,11 +1,12 @@ - + + '); @@ -62,7 +63,7 @@ function plc_tabs ($array, $id=NULL) { if ( ! $todo['method'] ) $todo['method']='GET'; // extract var=value settings from url if any $full_url=$todo['url']; - $split=plkit_split_url($full_url); + $split=plekit_split_url($full_url); $url=$split['url']; $url_values=$split['values']; diff --git a/plekit/php/plekit-utils.php b/plekit/php/plekit-utils.php new file mode 100644 index 0000000..e6184c2 --- /dev/null +++ b/plekit/php/plekit-utils.php @@ -0,0 +1,19 @@ + path, 'values' => hash (key=>value)* ] +function plekit_split_url ($full_url) { + list($url,$args) = explode("?",$full_url); + $values=array(); + if ($args) { + $pairs=explode("&",$args); + foreach ($pairs as $pair) { + list ($name,$value) = explode("=",$pair); + $values[$name]=$value; + } + } + return array("url"=>$url,"values"=>$values); +} + +?> diff --git a/plekit/php/prototype.php b/plekit/php/prototype.php new file mode 100644 index 0000000..c0c6c99 --- /dev/null +++ b/plekit/php/prototype.php @@ -0,0 +1,7 @@ + +'); + +?> diff --git a/planetlab/includes/plc_tables.php b/plekit/php/table.php similarity index 95% rename from planetlab/includes/plc_tables.php rename to plekit/php/table.php index 5d7f379..e7837a7 100644 --- a/planetlab/includes/plc_tables.php +++ b/plekit/php/table.php @@ -3,11 +3,11 @@ // $Id$ drupal_set_html_head(' - - - - - + + + + + '); //////////////////////////////////////// diff --git a/planetlab/includes/plc_toggles.php b/plekit/php/toggle.php similarity index 96% rename from planetlab/includes/plc_toggles.php rename to plekit/php/toggle.php index 7700401..f8d6051 100644 --- a/planetlab/includes/plc_toggles.php +++ b/plekit/php/toggle.php @@ -5,8 +5,8 @@ require_once 'prototype.php'; drupal_set_html_head(' - - + + '); // This is for creating an area that users can hide and show diff --git a/planetlab/prototype/URL b/plekit/prototype/URL similarity index 100% rename from planetlab/prototype/URL rename to plekit/prototype/URL diff --git a/planetlab/prototype/prototype-1.6.0.3.js b/plekit/prototype/prototype-1.6.0.3.js similarity index 100% rename from planetlab/prototype/prototype-1.6.0.3.js rename to plekit/prototype/prototype-1.6.0.3.js diff --git a/planetlab/prototype/prototype.js b/plekit/prototype/prototype.js similarity index 100% rename from planetlab/prototype/prototype.js rename to plekit/prototype/prototype.js diff --git a/planetlab/css/plc_tables.css b/plekit/table/table.css similarity index 100% rename from planetlab/css/plc_tables.css rename to plekit/table/table.css diff --git a/planetlab/js/plc_tables.js b/plekit/table/table.js similarity index 97% rename from planetlab/js/plc_tables.js rename to plekit/table/table.js index afd4238..6fa8ca1 100644 --- a/planetlab/js/plc_tables.js +++ b/plekit/table/table.js @@ -118,9 +118,10 @@ function plc_table_filter (table_id,pattern_id,and_id) { // re compile all patterns - ignore case var pattern_texts = pattern_text.split(" "); var patterns=new Array(); - var i; - for (i in pattern_texts) + for (var i=0; i < pattern_texts.length; i++) { + window.console.log ('compiled ' + i + '-th pattern = <' + pattern_texts[i] + '>'); patterns[i]=new RegExp(pattern_texts[i],"i"); + } // scan rows for (row_index = 0; row=rows[row_index]; row_index++) { diff --git a/planetlab/tablesort/URL b/plekit/tablesort/URL similarity index 100% rename from planetlab/tablesort/URL rename to plekit/tablesort/URL diff --git a/planetlab/tablesort/customsort.js b/plekit/tablesort/customsort.js similarity index 100% rename from planetlab/tablesort/customsort.js rename to plekit/tablesort/customsort.js diff --git a/planetlab/tablesort/paginate.js b/plekit/tablesort/paginate.js similarity index 100% rename from planetlab/tablesort/paginate.js rename to plekit/tablesort/paginate.js diff --git a/planetlab/tablesort/tablesort.js b/plekit/tablesort/tablesort.js similarity index 100% rename from planetlab/tablesort/tablesort.js rename to plekit/tablesort/tablesort.js diff --git a/planetlab/css/plc_toggles.css b/plekit/toggle/toggle.css similarity index 100% rename from planetlab/css/plc_toggles.css rename to plekit/toggle/toggle.css diff --git a/planetlab/js/plc_toggles.js b/plekit/toggle/toggle.js similarity index 100% rename from planetlab/js/plc_toggles.js rename to plekit/toggle/toggle.js diff --git a/PLCWWW.spec b/plewww.spec similarity index 91% rename from PLCWWW.spec rename to plewww.spec index ba4aa86..7cc1133 100644 --- a/PLCWWW.spec +++ b/plewww.spec @@ -3,8 +3,8 @@ # # what the myplc rpm requires -%define name PLCWWW -%define version PLE.5.0 +%define name plewww +%define version 5.0 %define taglevel 0 # no need to mention pldistro as this module differs in both distros @@ -32,14 +32,22 @@ Requires: php >= 5.0 Requires: postgresql >= 8.0 Requires: PLCAPI >= 5.0 Requires: drupal = 4.7 +Requires: plewww-plekit + +# this is what MyPLC requires +Provides: PLCWWW # on centos5, when rebuilding the full monty, we get: # Error: Missing Dependency: perl(GD) is needed by package PLCWWW # and the perl-GD rpm is nowhere to be found AutoReqProv: no +%package plekit +Summary: Utilities for building the plewww pages, for the benefit of other PL-related UI components. +Group: Applications/Systems + %description -The PLCWWW package is made of the web pages that run on top of the +The plewww package is made of the web pages that run on top of the PLCAPI component to provide the Web Interface to MyPLC users. %prep @@ -100,9 +108,15 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -/var/www/html +/var/www/html/modules +/var/www/html/planetlab +/var/www/html/googlemap +/var/www/html/drupal-hacks /etc/httpd/conf.d/plcwww.conf +%files plekit +/var/www/html/plekit + %changelog * Fri Apr 25 2008 Thierry Parmentelat - PLCWWW-onelab.4.2-11 - everyone is welcome to add nodes