root/trunk/PluginManager/plugins/PluginManager/tmpl/list.tmpl @ 1

Revision 1, 6.0 kB (checked in by breese, 4 years ago)

added PluginManager?

Line 
1<TMPL_INCLUDE NAME="header.tmpl">
2
3<script type="text/javascript" src="<TMPL_VAR NAME=STATIC_URI>plugins/PluginManager/js/app.js"></script>
4<script type="text/javascript">
5<!--
6function toggle_install() {
7  var form = getByID("install-wrapper");
8  if (form.style.display == 'block') {
9    form.style.display = 'none';
10    form.style.visibility = 'hidden';
11  } else {
12    form.style.display = 'block';
13    form.style.visibility = 'visible';
14  }
15}
16function uninstall_selected() {
17  if (confirm("<MT_TRANS phrase="Are you sure you wish to uninstall the currently selected plugin?">")) {
18    window.location = "?__mode=uninstall&id="+selected;
19  }
20}
21var upgrading = 0;
22function upgrade( plugin_id ) {
23  upgrading = 1;
24  window.location = "?__mode=upgrade&id="+plugin_id;
25}
26var selected = -1;
27function unselect( id ) {
28  selected = -1;
29  var p = getByID("plugin-" + id);
30  p.style.background = '#ffffff';
31  p.style.color = '#000000';
32}
33function select( id ) {
34  selected = id;
35  var p = getByID("plugin-" + id);
36  p.style.background = '#3f658c';
37  p.style.color = '#ffffff';
38}
39function toggleSelect( id ) {
40  var b = getByID("uninstall");
41  if (upgrading) { return; }
42  if (selected != -1 && selected != id) {
43    unselect(selected);
44    select(id);
45  } else if (selected == id) {
46    unselect(id);
47    b.disabled = true;
48  } else {
49    select(id);
50    b.disabled = false;
51  }
52}
53
54function onClickHandler(evt) {
55    // try to find our "window" element in dom hierarchy
56    evt = evt || event;
57    var element = evt.target || evt.srcElement;
58    // nothing is selected, do nothing
59    if (selected == -1) { return true; }
60
61    // user clicked on uninstall button - do nothing
62    var b = getByID('uninstall');
63    if (b == element) { return true; }
64
65/*
66    // user clicked on upgrade button - do nothing
67    for (i=0;i<plugin_keys.length;i++) {
68      var el = getByID('upgrade-'+plugin_keys[i]);
69      if (element == el) { return true; }
70    }
71*/
72
73    // user clicked on selected item, deselect it
74    var c = getByID('plugin-'+selected);
75    if (c == element) { unselect(selected); return true; }
76
77    // unselect everything (default)
78    for (i=0;i<plugin_keys.length;i++) {
79      var el = getByID('plugin-'+plugin_keys[i]);
80      if (element == el) { return true; }
81    }
82    return true;
83}
84
85if ( document.addEventListener )
86        document.addEventListener( "click", onClickHandler, true );
87else if ( document.attachEvent )
88        document.attachEvent( "onclick", onClickHandler );
89
90function check_updates( arry ) {
91  for (i=0; i < arry.length; i++) {
92    check_for_update(arry[i]);
93  }
94}
95
96function check_for_update( id ) {
97  clients[id] = getHTTPObject(); // We create the HTTP Object
98  var url = 'plugins.cgi?__mode=check_ajax&id='+id;
99  clients[id].open("GET", url, true);
100  clients[id].onreadystatechange = function() {
101    if (clients[id].readyState == 1) { 
102      getByID('plugin-actions-'+id).innerHTML = '<img src="<TMPL_VAR NAME=STATIC_URI>plugins/PluginManager/images/indicator.gif" />';
103    } else if (clients[id].readyState == 4) { 
104      var txt = clients[id].responseText;
105      getByID('plugin-actions-'+id).innerHTML = txt;
106      clients[id] = 0;
107    }
108  };
109  clients[id].send(null);
110}
111var plugin_keys = new Array();
112<TMPL_LOOP NAME=PLUGIN_LOOP>
113plugin_keys[<TMPL_VAR NAME=COUNT>] = <TMPL_VAR NAME=KEY>;
114</TMPL_LOOP>
115-->
116</script>
117
118<h2><MT_TRANS phrase="Plugin Manager">: <span class="title-highlight"><MT_TRANS phrase="Installed Plugins"></span></h2>
119
120<div class="tabs">
121<ul>
122  <li class="yah"><a href=""><MT_TRANS phrase="Plugins"></a></li>
123  <li class="special">
124    <img src="<TMPL_VAR NAME=STATIC_URI>images/status_icons/create.gif" alt="<MT_TRANS phrase="Add Sidebar">" width="9" height="9" />
125    <a href="#" onclick="toggle_install(); return false;"><MT_TRANS phrase="Install Plugin"></a>
126  </li>
127</ul>
128</div>
129
130<div id="install-wrapper">
131  <form method="post" enctype="multipart/form-data">
132    <input type="hidden" name="__mode" value="install" />
133    <p><MT_TRANS phrase="Use the form below to upload a plugin you wish to install, or provide the URL where Plugin Manager can find the file to be downloaded."></p>
134    <div id="upload-fields" class="fields">
135      <label for="upload"><MT_TRANS phrase="Upload Plugin:"></label>
136      <input type="file" name="uploaded_plugin" size="40" id="upload" />
137    </div>
138    <p class="indent">Or</p>
139    <div id="url-fields" class="fields">
140      <label for="url"><MT_TRANS phrase="Plugin URL:"></label>
141      <input type="text" name="url" size="40" id="url" />
142    </div>
143    <p class="indent buttons">
144      <input type="submit" value="<MT_TRANS phrase="Install Plugin">" />
145      <input type="button" value="<MT_TRANS phrase="Cancel">" onclick="toggle_install(); return false;" />
146    </p>
147  </form>
148</div>
149
150<div class="list-wrapper">
151  <div class="list" id="plugin-list">
152
153<TMPL_LOOP NAME=PLUGIN_LOOP>
154    <div id="plugin-<TMPL_VAR NAME=KEY>" class="plugin pkg"
155         onclick="toggleSelect(<TMPL_VAR NAME=KEY>)">
156      <div class="plugin-logo" <TMPL_IF NAME=ICON>style="background: transparent url(<TMPL_VAR NAME=ICON>) no-repeat; border: 0;"</TMPL_IF>>
157      </div>
158      <div class="plugin-info">
159        <h4><TMPL_VAR NAME=NAME> <span class="plugin-version">Version <TMPL_VAR NAME=VERSION></span></h4>
160        <p><TMPL_VAR NAME=DESCRIPTION></p>
161      </div>
162      <div id="plugin-actions-<TMPL_VAR NAME=KEY>" class="plugin-actions">
163      </div>
164    </div>
165</TMPL_LOOP>
166  </div>
167</div>
168
169  <div id="actions" class="pkg">
170    <div id="actions-left" class="actions">
171        <input type="button" value="Uninstall" id="uninstall" onclick="uninstall_selected();" disabled="1" />
172    </div>
173    <div id="actions-right" class="actions">
174        <input type="button" value="Find Updates" id="updates" onclick="check_updates(plugin_keys);" />
175        <a target="new" href="http://www.sixapart.com/pronet/plugins/">Find more plugins</a>
176    </div>
177  </div>
178
179  <div id="sidebar-promo">
180    <MT_TRANS phrase="Please support free software,"> <a href="http://www.majordojo.com/projects/PluginManager/downloads/"><MT_TRANS phrase="donate to Plugin Manager"></a>.
181  </div>
182
183</div>
184
185<TMPL_INCLUDE NAME="footer.tmpl">
Note: See TracBrowser for help on using the browser.